From 29b08e04a5a40f7055dd594742dac61d3d8d3243 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 29 Nov 2020 10:51:00 +0800 Subject: [PATCH] =?UTF-8?q?flutter:=20=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E2=80=9C=E5=81=A5=E5=BA=B7=E6=B8=B8=E6=88=8F=E5=BF=A0=E5=91=8A?= =?UTF-8?q?=E2=80=9D=E4=BB=A5=E5=8F=8A=E7=89=88=E6=9D=83=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=8F=8C=E4=BA=BA=E5=AF=B9=E6=88=98?= =?UTF-8?q?=E5=92=8C=E6=9C=BA=E5=99=A8=E5=AF=B9=E6=88=98=E7=9A=84=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 双人对战和机器对战的功能未完成。 --- src/ui/flutter/lib/engine/engine.dart | 2 +- src/ui/flutter/lib/widgets/game_page.dart | 7 +++++-- src/ui/flutter/lib/widgets/main_menu.dart | 22 ++++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/ui/flutter/lib/engine/engine.dart b/src/ui/flutter/lib/engine/engine.dart index bad829a3..3ca138fb 100644 --- a/src/ui/flutter/lib/engine/engine.dart +++ b/src/ui/flutter/lib/engine/engine.dart @@ -19,7 +19,7 @@ import 'package:sanmill/mill/position.dart'; -enum EngineType { Cloud, Native } +enum EngineType { humanVsCloud, humanVsAi, humanVsHuman, aiVsAi } class EngineResponse { final String type; diff --git a/src/ui/flutter/lib/widgets/game_page.dart b/src/ui/flutter/lib/widgets/game_page.dart index be2e4189..978b695b 100644 --- a/src/ui/flutter/lib/widgets/game_page.dart +++ b/src/ui/flutter/lib/widgets/game_page.dart @@ -361,7 +361,7 @@ class _GamePageState extends State { }, ); - if (widget.engineType == EngineType.Cloud) + if (widget.engineType == EngineType.humanVsCloud) Player.shared.increaseWinCloudEngine(); else Player.shared.increaseWinAi(); @@ -448,7 +448,10 @@ class _GamePageState extends State { Expanded(child: SizedBox()), Hero(tag: 'logo', child: Image.asset('images/logo-mini.png')), SizedBox(width: 10), - Text(widget.engineType == EngineType.Cloud ? '挑战云主机' : '人机对战', + Text( + widget.engineType == EngineType.humanVsCloud + ? '挑战云主机' + : '人机对战', style: titleStyle), Expanded(child: SizedBox()), IconButton( diff --git a/src/ui/flutter/lib/widgets/main_menu.dart b/src/ui/flutter/lib/widgets/main_menu.dart index db1485cf..72e19514 100644 --- a/src/ui/flutter/lib/widgets/main_menu.dart +++ b/src/ui/flutter/lib/widgets/main_menu.dart @@ -120,10 +120,28 @@ class _MainMenuState extends State with TickerProviderStateMixin { Expanded(child: SizedBox()), FlatButton( child: Text('人机对战', style: menuItemStyle), - onPressed: () => navigateTo(GamePage(EngineType.Native)), + onPressed: () => navigateTo(GamePage(EngineType.humanVsAi)), ), Expanded(child: SizedBox()), - Text('Calcitem', + FlatButton( + child: Text('双人对战', style: menuItemStyle), + onPressed: () => navigateTo(GamePage(EngineType.humanVsHuman)), + ), + Expanded(child: SizedBox()), + FlatButton( + child: Text('机器对战', style: menuItemStyle), + onPressed: () => navigateTo(GamePage(EngineType.aiVsAi)), + ), + Expanded(child: SizedBox()), + Text( + ' 健康游戏忠告\n' + '抵制不良游戏,拒绝盗版游戏。\n' + '注意自我保护,谨防受骗上当。\n' + '适度游戏益脑,沉迷游戏伤身。\n' + '合理安排时间,享受健康生活。', + style: TextStyle(color: Colors.black54, fontSize: 16)), + Expanded(child: SizedBox()), + Text('Copyright © 2019-2020 The Sanmill Authors', style: TextStyle(color: Colors.black54, fontSize: 16)), Expanded(child: SizedBox()), ],