flutter: 首页添加“健康游戏忠告”以及版权信息并添加双人对战和机器对战的选项

双人对战和机器对战的功能未完成。
This commit is contained in:
Calcitem 2020-11-29 10:51:00 +08:00
parent ee41ff9bad
commit 29b08e04a5
3 changed files with 26 additions and 5 deletions

View File

@ -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;

View File

@ -361,7 +361,7 @@ class _GamePageState extends State<GamePage> {
},
);
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<GamePage> {
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(

View File

@ -120,10 +120,28 @@ class _MainMenuState extends State<MainMenu> 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()),
],