diff --git a/android/app/src/main/java/co/steamcloud/game/Config.java b/android/app/src/main/java/co/steamcloud/game/Config.java index a73f438..74b058f 100644 --- a/android/app/src/main/java/co/steamcloud/game/Config.java +++ b/android/app/src/main/java/co/steamcloud/game/Config.java @@ -1,7 +1,7 @@ package co.steamcloud.game; public class Config { - public static String url = "https://admin.shhuanmeng.com/";//接口域名 + public static String url = "https://api.onelight.vip/";//接口域名 public static String BsUrl = "https://os.zhijierongxing.com/";//游戏域名 public static String channel_id = "d612a79436ef9ceeee4d6847d854b2e1"; diff --git a/android/app/src/main/java/co/steamcloud/game/MainActivity.java b/android/app/src/main/java/co/steamcloud/game/MainActivity.java index dde9ab3..8451dea 100644 --- a/android/app/src/main/java/co/steamcloud/game/MainActivity.java +++ b/android/app/src/main/java/co/steamcloud/game/MainActivity.java @@ -46,6 +46,7 @@ public class MainActivity extends FlutterActivity { public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); EventBus.getDefault().register(this); + WhaleCloud.getInstance().isShowLog(true); } @@ -100,6 +101,7 @@ public class MainActivity extends FlutterActivity { Config.userToken = call.argument("userToken"); Config.Channel = call.argument("Channel"); Config.Version = call.argument("Version"); + Config.url = call.argument("Url"); initSdk(Config.BsUrl, Config.client_sid, gameToken, Config.sn); Log.d(TAG, "onMethodCall: initData"); diff --git a/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java b/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java index 27fc220..c545145 100644 --- a/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java +++ b/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java @@ -2880,7 +2880,6 @@ public class PlayGameActivity extends Activity { } }); - } } @@ -2904,7 +2903,7 @@ public class PlayGameActivity extends Activity { @Override public void onGameStop() { //游戏结束 - Log.i(TAG, "onGameStop: "); + Log.i(TAG, "onGameStop: 游戏结束"); if (ActivityCollector.activities != null && ActivityCollector.activities.size() > 0) { ActivityCollector.removeActivity(PlayGameActivity.this); } @@ -2931,7 +2930,6 @@ public class PlayGameActivity extends Activity { TagMap.put("tag", "exitGame"); EventBus.getDefault().post(TagMap, EventBusParams.MAIN); - finish(); } @@ -3138,6 +3136,7 @@ public class PlayGameActivity extends Activity { public void closeGame() { + Log.d(TAG, "closeGame: "); ActivityCollector.removeActivity(this); // netHander.stopSession(Config.gamePara.sc_id); // Config.is_SolidHandle = String.valueOf(isHandelEnter()); diff --git a/android/app/src/main/res/drawable/bg_base_dialog1.xml b/android/app/src/main/res/drawable/bg_base_dialog1.xml index 970187a..e1b3758 100644 --- a/android/app/src/main/res/drawable/bg_base_dialog1.xml +++ b/android/app/src/main/res/drawable/bg_base_dialog1.xml @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/shap_exit_game.xml b/android/app/src/main/res/drawable/shap_exit_game.xml new file mode 100644 index 0000000..d195500 --- /dev/null +++ b/android/app/src/main/res/drawable/shap_exit_game.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/shap_exit_game_cancel.xml b/android/app/src/main/res/drawable/shap_exit_game_cancel.xml new file mode 100644 index 0000000..c7544a0 --- /dev/null +++ b/android/app/src/main/res/drawable/shap_exit_game_cancel.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/dialog_with_title.xml b/android/app/src/main/res/layout/dialog_with_title.xml index 09648b1..e379b40 100644 --- a/android/app/src/main/res/layout/dialog_with_title.xml +++ b/android/app/src/main/res/layout/dialog_with_title.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="320dp" android:layout_height="188dp" - android:background="@mipmap/bg_base_dialog" + android:background="@drawable/shap_exit_game" android:orientation="vertical"> @@ -14,7 +14,7 @@ android:layout_height="wrap_content" android:layout_marginTop="14dp" android:gravity="center" - android:textColor="#000000" + android:textColor="@color/white" android:textSize="20sp" android:textStyle="bold" app:layout_constraintLeft_toLeftOf="parent" @@ -27,9 +27,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" - android:layout_marginTop="40dp" + android:layout_marginTop="30dp" android:gravity="center" - android:textColor="#000000" + android:textColor="@color/white" android:textSize="16sp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" @@ -42,7 +42,7 @@ android:layout_width="120dp" android:layout_height="40dp" android:layout_gravity="center" - android:layout_marginTop="20dp" + android:layout_marginTop="30dp" android:layout_marginBottom="20dp" android:layout_weight="1" android:background="@drawable/bg_base_dialog1" @@ -61,10 +61,10 @@ android:layout_width="120dp" android:layout_height="40dp" android:layout_gravity="center" - android:layout_marginTop="20dp" + android:layout_marginTop="30dp" android:layout_marginBottom="20dp" android:layout_weight="1" - android:background="@mipmap/btn_di" + android:background="@drawable/shap_exit_game_cancel" android:gravity="center" android:text="取消" android:textColor="#FFFFFF" @@ -80,6 +80,7 @@ android:layout_height="40dp" android:layout_marginTop="5dp" android:layout_marginEnd="5dp" + android:visibility="gone" android:padding="10dp" android:src="@mipmap/btn_cuohao3" app:layout_constraintRight_toRightOf="parent" diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index db77bb4..0977726 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 17987b7..0977726 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 09d4391..0977726 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..0977726 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/lib/tools/home_model.dart b/lib/tools/home_model.dart index 1e82d45..3610bd2 100644 --- a/lib/tools/home_model.dart +++ b/lib/tools/home_model.dart @@ -249,6 +249,7 @@ class HomeModel { Future exitPlayGame(gameId) async { RequestCenter.instance.request(NetworkConfig.exitPlayGame, { "gameId": gameId, + "playGameDetails": "playGameDetails", }, (BaseEntity dataEntity) { // ReconnectBean reconnectBean = ReconnectBean.fromJson(dataEntity.data); diff --git a/lib/tools/home_page.dart b/lib/tools/home_page.dart index b1865e3..238b1a5 100644 --- a/lib/tools/home_page.dart +++ b/lib/tools/home_page.dart @@ -46,6 +46,7 @@ class _HomePageState extends State with TickerProviderStateMixin { late BuildContext lineUpContext; late ReconnectBean reconnectBean; + bool isLineUp = false; DateTime? _lastPressTime; @@ -116,6 +117,7 @@ class _HomePageState extends State with TickerProviderStateMixin { "signKey": NetworkConfig.signKey, "Channel": NetworkConfig.Channel, "Version": NetworkConfig.Version, + "Url": NetworkConfig.ServerDomain_Online, }; ///传值初始化游戏token @@ -125,6 +127,7 @@ class _HomePageState extends State with TickerProviderStateMixin { ///启动游戏 case "playGame": + isLineUp = false; EasyLoading.dismiss(); Map gameMap = { "gameId": event['gameId'], @@ -136,7 +139,7 @@ class _HomePageState extends State with TickerProviderStateMixin { ///游戏错误 case "gameError": - EasyLoading.showToast("网络异常,请稍后再试"); + EasyLoading.showToast("${event['data']}"); _viewModel.cancelQueue(event['gameId']); break; @@ -145,31 +148,24 @@ class _HomePageState extends State with TickerProviderStateMixin { EasyLoading.dismiss(); QueueBean queueBean = event['data']; String gameId = event['gameId']; - // FunctionUtil.bottomNoSheetDialog( - // context, - // LineUpDialog( - // lineUpDialogKey, - // num: queueBean.queue_pos!, - // onTap: () { - // _viewModel.cancelQueue(gameId); - // // lineUpDialogKey.currentState?.setNum(3); - // }, - // )); - showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - lineUpContext = context; - return LineUpDialog( - lineUpDialogKey, - num: queueBean.queue_pos!, - onTap: () { - _timer.cancel(); - _viewModel.cancelQueue(gameId); - }, - ); - }); + if (!isLineUp) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + lineUpContext = context; + return LineUpDialog( + lineUpDialogKey, + num: queueBean.queue_pos!, + onTap: () { + _timer.cancel(); + _viewModel.cancelQueue(gameId); + }, + ); + }); + isLineUp = true; + } //调用排队 _timer = Timer.periodic(const Duration(milliseconds: 5000), (as) { @@ -181,17 +177,19 @@ class _HomePageState extends State with TickerProviderStateMixin { ///游戏排队队列 case "playGameQueue": QueueBean queueBean = event['data']; - lineUpDialogKey.currentState?.setNum(queueBean.queue_pos); - break; + ///取消排队 case "cancelQueue": + isLineUp = false; + lineUpDialogKey.currentState?.setNum(0); _timer.cancel(); break; ///排队成功 开始游戏 case "gameQueueSuccess": + print("gameQueueSuccess"); Navigator.pop(lineUpContext); _timer.cancel(); _viewModel.playGame(NetworkConfig.gameId);