panhui 6 лет назад
Родитель
Сommit
052fa486b9
4 измененных файлов с 86 добавлено и 43 удалено
  1. 1 1
      lib/pages/RecordList.dart
  2. 78 38
      lib/pages/roomInfo.dart
  3. 6 3
      lib/pages/roomList.dart
  4. 1 1
      lib/styles/totast.dart

+ 1 - 1
lib/pages/RecordList.dart

@@ -144,7 +144,7 @@ class houseItem extends StatelessWidget {
     if (playerInfo.statusFlag != null) {
     if (playerInfo.statusFlag != null) {
       if (playerInfo.statusFlag == 6) {
       if (playerInfo.statusFlag == 6) {
         tishiStr = '未参加';
         tishiStr = '未参加';
-      } else if (playerInfo.statusFlag < 4) {
+      } else if (playerInfo.statusFlag < 4||(roomInfo.statusFlag>=2&&roomInfo.statusFlag<4)) {
         tishiStr = '结算中';
         tishiStr = '结算中';
       } else if (playerInfo.statusFlag < 2) {
       } else if (playerInfo.statusFlag < 2) {
         tishiStr = '准备中';
         tishiStr = '准备中';

+ 78 - 38
lib/pages/roomInfo.dart

@@ -32,6 +32,7 @@ class RoomInfoState extends State<RoomInfo>
   bool isJoin = true;
   bool isJoin = true;
   PlayerInfo playerInfo;
   PlayerInfo playerInfo;
   bool isPop = false;
   bool isPop = false;
+  bool showBack = false;
 
 
 //获取房间信息
 //获取房间信息
   void getRoomInfo() async {
   void getRoomInfo() async {
@@ -78,6 +79,9 @@ class RoomInfoState extends State<RoomInfo>
 
 
 //开始比赛确认按钮
 //开始比赛确认按钮
   showStart() async {
   showStart() async {
+    if (!isJoin) {
+      return;
+    }
     bool result = await Navigator.of(context).push<bool>(
     bool result = await Navigator.of(context).push<bool>(
       PageRouteBuilder(
       PageRouteBuilder(
         opaque: false,
         opaque: false,
@@ -95,7 +99,7 @@ class RoomInfoState extends State<RoomInfo>
       ),
       ),
     );
     );
     Map<String, dynamic> data = {"id": playerInfo.id};
     Map<String, dynamic> data = {"id": playerInfo.id};
-    bool success=true;
+    bool success = true;
     if (result) {
     if (result) {
       success = await ScreenStreamPlugin.start(
       success = await ScreenStreamPlugin.start(
           'rtmp://49.4.66.233:1935/myapp/' +
           'rtmp://49.4.66.233:1935/myapp/' +
@@ -121,7 +125,8 @@ class RoomInfoState extends State<RoomInfo>
         getTotast(10);
         getTotast(10);
       } else {
       } else {
         // showBackDialog();
         // showBackDialog();
-        Future.delayed(Duration(milliseconds: 100), () => showBackDialog(success?1:0));
+        Future.delayed(
+            Duration(milliseconds: 100), () => showBackDialog(success ? 1 : 0));
       }
       }
     }
     }
   }
   }
@@ -134,53 +139,66 @@ class RoomInfoState extends State<RoomInfo>
       builder: (BuildContext context) {
       builder: (BuildContext context) {
         return new AlertDialog(
         return new AlertDialog(
           content: Container(
           content: Container(
-            height: 50,
-            child: Text(
-              '已经成功开启录屏,请保留当前页面,10秒倒计时结束将自动打开游戏,如未自动打开请您手动打开,祝您取得好成绩!',
-              style: TextStyle(color: Colors.black),
+            height: 150,
+            child: Column(
+              children: <Widget>[
+                Text(
+                  '已经成功开启录屏,请保留当前页面。10秒倒计时之后将自动打开游戏,未自动打开请您手动打开,祝您取得好成绩!',
+                  style: TextStyle(color: Colors.black, fontSize: 14),
+                ),
+                Text(
+                  '完成游戏后返回App,点击下方按钮,结束此次竞赛!',
+                  style: TextStyle(color: Colors.black, fontSize: 14),
+                )
+              ],
             ),
             ),
           ),
           ),
           actions: <Widget>[
           actions: <Widget>[
-            new FlatButton(
-              child: new Text('完成比赛'),
-              onPressed: () async {
-                Toast.show(context, '加载中', -1, 'loading');
-                HttpManager.post("playerInfo/update",
-                    data: {'id': playerInfo.id, 'statusFlag': 3});
-                bool success = await ScreenStreamPlugin.stop();
-                print('stop stream screen:' + success.toString());
-                Toast.hide();
-                Navigator.of(context).pop();
-              },
-            ),
+            Container(
+              width: 260,
+              height: 54,
+              padding: EdgeInsets.only(left: 42, right: 42, bottom: 10),
+              child: RaisedButton(
+                color: PRIMARY_COLOR,
+                textColor: Colors.white,
+                child: new Text('完成比赛'),
+                onPressed: () async {
+                  Toast.show(context, '加载中', -1, 'loading');
+                  HttpManager.post("playerInfo/update",
+                      data: {'id': playerInfo.id, 'statusFlag': 3});
+                  bool success = await ScreenStreamPlugin.stop();
+                  print('stop stream screen:' + success.toString());
+                  Toast.hide();
+                  Navigator.of(context).pop();
+                },
+              ),
+            )
           ],
           ],
         );
         );
       },
       },
     ).then((val) {
     ).then((val) {
       Navigator.of(context).pop();
       Navigator.of(context).pop();
     });
     });
-
   }
   }
 
 
-  getTotast(int index)async{
-    if(isPop){
+//跳转程序
+  getTotast(int index) async {
+    if (isPop) {
       return;
       return;
     }
     }
     Toast.show(context, index.toString(), 500, 'num');
     Toast.show(context, index.toString(), 500, 'num');
-    if(index==0){
-      Future.delayed(Duration(seconds: 1),()async{
+    if (index == 0) {
+      Future.delayed(Duration(seconds: 1), () async {
         const url = 'pubgmhd1106467070://';
         const url = 'pubgmhd1106467070://';
-          if (await canLaunch(url)) {
-            await launch(url);
-          } else {
-            throw 'Could not launch $url';
-          }
+        if (await canLaunch(url)) {
+          await launch(url);
+        } else {
+          throw 'Could not launch $url';
+        }
       });
       });
+    } else {
+      Future.delayed(Duration(seconds: 1), () => getTotast(index - 1));
     }
     }
-    else{
-       Future.delayed(Duration(seconds: 1),()=>getTotast(index-1));
-    }
-
   }
   }
 
 
 //未确认比赛弹窗
 //未确认比赛弹窗
@@ -193,7 +211,8 @@ class RoomInfoState extends State<RoomInfo>
           content: Container(
           content: Container(
             height: 50,
             height: 50,
             child: Text(
             child: Text(
-              (type==1?'您未在十秒内点击开始按钮':'您未允许录屏')+',系统已经判定您放弃比赛,参赛奖金不予退还。',
+              (type == 1 ? '您未在十秒内点击开始按钮' : '您未允许录屏') +
+                  ',系统已经判定您放弃比赛,参赛奖金不予退还。',
               style: TextStyle(color: Colors.black),
               style: TextStyle(color: Colors.black),
             ),
             ),
           ),
           ),
@@ -291,6 +310,8 @@ class RoomInfoState extends State<RoomInfo>
     Future.delayed(Duration.zero, () {
     Future.delayed(Duration.zero, () {
       getRoomInfo();
       getRoomInfo();
       checkJoinInfo();
       checkJoinInfo();
+
+      // showSucessInfo();
       // showBackDialog();
       // showBackDialog();
       // showStart();
       // showStart();
     });
     });
@@ -355,13 +376,12 @@ class RoomInfoState extends State<RoomInfo>
         floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
         floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
       ),
       ),
       onWillPop: () {
       onWillPop: () {
-        if (houseInfo==null||(houseInfo.statusFlag!=0)) {
+        if (houseInfo == null || (houseInfo.statusFlag != 0)) {
           isPop = true;
           isPop = true;
           Toast.hide();
           Toast.hide();
           Navigator.of(context).pop();
           Navigator.of(context).pop();
           return Future.value(false);
           return Future.value(false);
-        }
-        else{
+        } else {
           Toast.show(context, '比赛即将开始,暂不能离开房间', 1500, 'info');
           Toast.show(context, '比赛即将开始,暂不能离开房间', 1500, 'info');
         }
         }
       },
       },
@@ -553,6 +573,11 @@ class RoomInfoState extends State<RoomInfo>
     int joinMoney = houseInfo != null ? houseInfo.houseLevel.entryCoin : 0;
     int joinMoney = houseInfo != null ? houseInfo.houseLevel.entryCoin : 0;
     int statusFlag = houseInfo != null ? houseInfo.statusFlag : 1;
     int statusFlag = houseInfo != null ? houseInfo.statusFlag : 1;
     int playerStatus = playerInfo != null ? playerInfo.statusFlag : 0;
     int playerStatus = playerInfo != null ? playerInfo.statusFlag : 0;
+
+    print('*******');
+    print(statusFlag);
+    print(playerStatus);
+
     if (!isJoin && statusFlag == 0) {
     if (!isJoin && statusFlag == 0) {
       return Container(
       return Container(
         width: ScreenUtil().setWidth(375),
         width: ScreenUtil().setWidth(375),
@@ -594,6 +619,21 @@ class RoomInfoState extends State<RoomInfo>
             ),
             ),
             onPressed: () => joinRoom()),
             onPressed: () => joinRoom()),
       );
       );
+    } else if (!isJoin && statusFlag == 2) {
+      return Container(
+        width: double.infinity,
+        padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
+        height: 88,
+        child: RaisedButton(
+          disabledColor: Color(0xFF914244),
+          disabledTextColor: Color(0xFF252532),
+          child: Text(
+            '房间已经开始,加入通道关闭',
+            style: TextStyle(fontSize: 16),
+          ),
+          onPressed: null,
+        ),
+      );
     } else if (isJoin && statusFlag == 0) {
     } else if (isJoin && statusFlag == 0) {
       return Container(
       return Container(
         width: double.infinity,
         width: double.infinity,
@@ -609,7 +649,7 @@ class RoomInfoState extends State<RoomInfo>
           onPressed: null,
           onPressed: null,
         ),
         ),
       );
       );
-    } else if (isJoin && statusFlag == 2 && playerStatus == 3) {
+    } else if (isJoin && statusFlag == 2 && playerStatus >= 3) {
       return Container(
       return Container(
         width: double.infinity,
         width: double.infinity,
         padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
         padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
@@ -639,7 +679,7 @@ class RoomInfoState extends State<RoomInfo>
           onPressed: null,
           onPressed: null,
         ),
         ),
       );
       );
-    } else if (isJoin && statusFlag == 4) {
+    } else if (statusFlag == 4) {
       return Container(
       return Container(
         width: double.infinity,
         width: double.infinity,
         padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
         padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),

+ 6 - 3
lib/pages/roomList.dart

@@ -42,8 +42,8 @@ class RoomListState extends State<RoomList> {
     {"name": '不限状态', "val": ''},
     {"name": '不限状态', "val": ''},
     {"name": '等待中', "val": '0'},
     {"name": '等待中', "val": '0'},
     // {"name": '准备中', "val": '1'},
     // {"name": '准备中', "val": '1'},
-    {"name": '已经开始', "val": '2'},
-    {"name": '正在结算', "val": '3'},
+    // {"name": '已经开始', "val": '2'},
+    // {"name": '正在结算', "val": '3'},
     {"name": '结算完成', "val": '4'}
     {"name": '结算完成', "val": '4'}
   ];
   ];
 
 
@@ -415,8 +415,11 @@ class RoomListState extends State<RoomList> {
     if (status_flag != '') {
     if (status_flag != '') {
       data['advancedQuery'] += 'AND_,status_flag_,=_,' + status_flag + '_;';
       data['advancedQuery'] += 'AND_,status_flag_,=_,' + status_flag + '_;';
     }
     }
+    else{
+      data['statusStr'] ='0,4';
+    }
     Result res = await HttpManager.get("houseInfo/page", data: data);
     Result res = await HttpManager.get("houseInfo/page", data: data);
-    if (res.success) {
+    if (res.success&&res.data['pp']!=null) {
       setState(() {
       setState(() {
        roomList.addAll(res.data['pp']); 
        roomList.addAll(res.data['pp']); 
       });
       });

+ 1 - 1
lib/styles/totast.dart

@@ -66,7 +66,7 @@ class Toast {
             child: Material(
             child: Material(
                 color: Colors.white.withOpacity(0),
                 color: Colors.white.withOpacity(0),
                 child: new Container(
                 child: new Container(
-                  margin: EdgeInsets.only(top:toastType == 'num'?200:0),
+                  margin: EdgeInsets.only(top:toastType == 'num'?0:0),
                   padding: EdgeInsets.symmetric(
                   padding: EdgeInsets.symmetric(
                       horizontal: toastType == 'info' ? 15 : (toastType == 'num'?0:36)),
                       horizontal: toastType == 'info' ? 15 : (toastType == 'num'?0:36)),
                   height: toastType == 'info' ? 40 : (toastType=='num'?60:100),
                   height: toastType == 'info' ? 40 : (toastType=='num'?60:100),