|
|
@@ -12,6 +12,7 @@ import '../model/HouseInfo.dart';
|
|
|
import '../styles/totast.dart';
|
|
|
import 'StartWindow.dart';
|
|
|
import '../model/PlayerInfo.dart';
|
|
|
+import '../widget/VideoWidget.dart';
|
|
|
|
|
|
class RoomInfo extends StatefulWidget {
|
|
|
RoomInfo({Key key, this.roomId}) : super(key: key);
|
|
|
@@ -30,6 +31,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Map colorInfo;
|
|
|
bool isJoin = true;
|
|
|
PlayerInfo playerInfo;
|
|
|
+ bool isPop = false;
|
|
|
|
|
|
//获取房间信息
|
|
|
void getRoomInfo() async {
|
|
|
@@ -38,6 +40,9 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
await HttpManager.get("houseInfo/getOne", data: {"id": widget.roomId});
|
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
|
+ if (isPop) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
setState(() {
|
|
|
roomInfo = res.data;
|
|
|
houseInfo = HouseInfo.fromJson(res.data);
|
|
|
@@ -57,6 +62,9 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
if (houseInfo.statusFlag == 0 && res.data["statusFlag"] == 2) {
|
|
|
showStart();
|
|
|
}
|
|
|
+ if (isPop) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
setState(() {
|
|
|
houseInfo.playerNumber = res.data["playerNumber"];
|
|
|
houseInfo.statusFlag = res.data["statusFlag"];
|
|
|
@@ -87,8 +95,9 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
),
|
|
|
);
|
|
|
Map<String, dynamic> data = {"id": playerInfo.id};
|
|
|
+ bool success=true;
|
|
|
if (result) {
|
|
|
- bool success = await ScreenStreamPlugin.start(
|
|
|
+ success = await ScreenStreamPlugin.start(
|
|
|
'rtmp://49.4.66.233:1935/myapp/' +
|
|
|
playerInfo.userId.toString() +
|
|
|
'?playerInfoId=' +
|
|
|
@@ -109,17 +118,10 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
if (data['statusFlag'] == 2) {
|
|
|
await Future.delayed(Duration(milliseconds: 100));
|
|
|
showSucessInfo();
|
|
|
- Future.delayed(Duration(seconds: 3), () async {
|
|
|
- const url = 'pubgmhd1106467070://';
|
|
|
- if (await canLaunch(url)) {
|
|
|
- await launch(url);
|
|
|
- } else {
|
|
|
- throw 'Could not launch $url';
|
|
|
- }
|
|
|
- });
|
|
|
+ getTotast(10);
|
|
|
} else {
|
|
|
// showBackDialog();
|
|
|
- Future.delayed(Duration(milliseconds: 100), () => showBackDialog());
|
|
|
+ Future.delayed(Duration(milliseconds: 100), () => showBackDialog(success?1:0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -134,7 +136,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
content: Container(
|
|
|
height: 50,
|
|
|
child: Text(
|
|
|
- '已经成功开启录屏,请保留当前页面,将在3秒后自动打开刺激战场,如未自动打开请您手动打开,祝您取得好成绩!',
|
|
|
+ '已经成功开启录屏,请保留当前页面,10秒倒计时结束将自动打开游戏,如未自动打开请您手动打开,祝您取得好成绩!',
|
|
|
style: TextStyle(color: Colors.black),
|
|
|
),
|
|
|
),
|
|
|
@@ -157,10 +159,32 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
).then((val) {
|
|
|
Navigator.of(context).pop();
|
|
|
});
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ getTotast(int index)async{
|
|
|
+ if(isPop){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Toast.show(context, index.toString(), 500, 'num');
|
|
|
+ if(index==0){
|
|
|
+ Future.delayed(Duration(seconds: 1),()async{
|
|
|
+ const url = 'pubgmhd1106467070://';
|
|
|
+ if (await canLaunch(url)) {
|
|
|
+ await launch(url);
|
|
|
+ } else {
|
|
|
+ throw 'Could not launch $url';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ Future.delayed(Duration(seconds: 1),()=>getTotast(index-1));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//未确认比赛弹窗
|
|
|
- showBackDialog() {
|
|
|
+ showBackDialog(type) {
|
|
|
showDialog<Null>(
|
|
|
context: context,
|
|
|
barrierDismissible: false,
|
|
|
@@ -169,7 +193,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
content: Container(
|
|
|
height: 50,
|
|
|
child: Text(
|
|
|
- '您未在十秒内点击开始按钮,系统已经判定您放弃比赛,参赛奖金不予退还。',
|
|
|
+ (type==1?'您未在十秒内点击开始按钮':'您未允许录屏')+',系统已经判定您放弃比赛,参赛奖金不予退还。',
|
|
|
style: TextStyle(color: Colors.black),
|
|
|
),
|
|
|
),
|
|
|
@@ -198,11 +222,17 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
if (res.success) {
|
|
|
print(res.data);
|
|
|
if (res.data == null) {
|
|
|
+ if (isPop) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
setState(() {
|
|
|
isJoin = false;
|
|
|
});
|
|
|
} else {
|
|
|
playerInfo = PlayerInfo.fromJson(res.data);
|
|
|
+ if (isPop) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
setState(() {
|
|
|
isJoin = true;
|
|
|
});
|
|
|
@@ -227,6 +257,9 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
|
Toast.show(context, '加入成功', 1500, 'success');
|
|
|
+ if (isPop) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
setState(() {
|
|
|
isJoin = true;
|
|
|
});
|
|
|
@@ -322,9 +355,15 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
),
|
|
|
onWillPop: () {
|
|
|
- Toast.hide();
|
|
|
- Navigator.of(context).pop();
|
|
|
- return Future.value(false);
|
|
|
+ if (houseInfo==null||(houseInfo.statusFlag!=0)) {
|
|
|
+ isPop = true;
|
|
|
+ Toast.hide();
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ return Future.value(false);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ Toast.show(context, '比赛即将开始,暂不能离开房间', 1500, 'info');
|
|
|
+ }
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
@@ -366,7 +405,10 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
child: Container(
|
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
|
- Image.network(topImg, width: double.infinity),
|
|
|
+ houseInfo != null
|
|
|
+ ? VideoWidget(videoSrc: houseInfo.video)
|
|
|
+ : Container(),
|
|
|
+ // Image.network(topImg, width: double.infinity),
|
|
|
Container(
|
|
|
padding: EdgeInsets.only(top: 10),
|
|
|
child: Row(
|
|
|
@@ -875,10 +917,11 @@ class SecondPageState extends State<SecondPage> {
|
|
|
margin: EdgeInsets.only(right: 12),
|
|
|
width: 36,
|
|
|
height: 36,
|
|
|
- child: CircleAvatar(
|
|
|
- backgroundImage: NetworkImage(
|
|
|
- info.userInfo != null ? info.userInfo.icon : ''),
|
|
|
- ),
|
|
|
+ child: info.userInfo != null
|
|
|
+ ? CircleAvatar(
|
|
|
+ backgroundImage: NetworkImage(info.userInfo.icon),
|
|
|
+ )
|
|
|
+ : Container(),
|
|
|
),
|
|
|
Expanded(
|
|
|
flex: 1,
|