|
@@ -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://47.96.141.102:1935/myapp/' +
|
|
'rtmp://47.96.141.102: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),
|