diff --git a/src/ui/flutter/lib/engine/engine.dart b/src/ui/flutter/lib/engine/engine.dart index 3ca138fb..bb9ba295 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 { humanVsCloud, humanVsAi, humanVsHuman, aiVsAi } +enum EngineType { humanVsAi, humanVsHuman, aiVsAi, humanVsCloud } class EngineResponse { final String type; diff --git a/src/ui/flutter/lib/l10n/intl_en.arb b/src/ui/flutter/lib/l10n/intl_en.arb index a85ddcde..4a51fadf 100644 --- a/src/ui/flutter/lib/l10n/intl_en.arb +++ b/src/ui/flutter/lib/l10n/intl_en.arb @@ -2,5 +2,21 @@ "appName": "Mill Game", "@appName": { "description": "The App name" + }, + "humanVsAi": "Human Vs AI", + "@humanVsAi": { + "description": "Human Vs AI" + }, + "humanVsHuman": "Human Vs Human", + "@humanVsHuman": { + "description": "Human Vs Human" + }, + "aiVsAi": "AI Vs AI", + "@aiVsAi": { + "description": "AI Vs AI" + }, + "humanVsCloud": "Human Vs Cloud", + "@humanVsCloud": { + "description": "Human Vs Cloud" } -} \ No newline at end of file +} diff --git a/src/ui/flutter/lib/l10n/intl_zh.arb b/src/ui/flutter/lib/l10n/intl_zh.arb index 33526006..9bd04a9f 100644 --- a/src/ui/flutter/lib/l10n/intl_zh.arb +++ b/src/ui/flutter/lib/l10n/intl_zh.arb @@ -1,3 +1,7 @@ { - "appName": "直棋" + "appName": "直棋", + "humanVsAi": "人机对战", + "humanVsHuman": "双人对战", + "aiVsAi": "机器对战", + "humanVsCloud": "挑战云端" } \ No newline at end of file diff --git a/src/ui/flutter/lib/widgets/game_page.dart b/src/ui/flutter/lib/widgets/game_page.dart index 978b695b..f9da38b5 100644 --- a/src/ui/flutter/lib/widgets/game_page.dart +++ b/src/ui/flutter/lib/widgets/game_page.dart @@ -21,6 +21,7 @@ import 'package:flutter/material.dart'; import 'package:sanmill/engine/analyze.dart'; import 'package:sanmill/engine/engine.dart'; import 'package:sanmill/engine/native_engine.dart'; +import 'package:sanmill/generated/l10n.dart'; import 'package:sanmill/main.dart'; import 'package:sanmill/mill/game.dart'; import 'package:sanmill/mill/mill.dart'; @@ -428,7 +429,13 @@ class _GamePageState extends State { } Widget createPageHeader() { - // + Map engineTypeToString = { + EngineType.humanVsAi: S.of(context).humanVsAi, + EngineType.humanVsHuman: S.of(context).humanVsHuman, + EngineType.aiVsAi: S.of(context).aiVsAi, + EngineType.humanVsCloud: S.of(context).humanVsCloud, + }; + final titleStyle = TextStyle(fontSize: 28, color: UIColors.darkTextPrimaryColor); final subTitleStyle = @@ -448,11 +455,7 @@ class _GamePageState extends State { Expanded(child: SizedBox()), Hero(tag: 'logo', child: Image.asset('images/logo-mini.png')), SizedBox(width: 10), - Text( - widget.engineType == EngineType.humanVsCloud - ? '挑战云主机' - : '人机对战', - style: titleStyle), + Text(engineTypeToString[widget.engineType], style: titleStyle), Expanded(child: SizedBox()), IconButton( icon: diff --git a/src/ui/flutter/lib/widgets/main_menu.dart b/src/ui/flutter/lib/widgets/main_menu.dart index 682638ec..95ea3d9e 100644 --- a/src/ui/flutter/lib/widgets/main_menu.dart +++ b/src/ui/flutter/lib/widgets/main_menu.dart @@ -121,29 +121,29 @@ class _MainMenuState extends State with TickerProviderStateMixin { ), Expanded(child: SizedBox()), FlatButton( - child: Text('人机对战', style: menuItemStyle), + child: Text(S.of(context).humanVsAi, style: menuItemStyle), onPressed: () => navigateTo(GamePage(EngineType.humanVsAi)), ), Expanded(child: SizedBox()), FlatButton( - child: Text('双人对战', style: menuItemStyle), + child: Text(S.of(context).humanVsHuman, style: menuItemStyle), onPressed: () => navigateTo(GamePage(EngineType.humanVsHuman)), ), Expanded(child: SizedBox()), FlatButton( - child: Text('机器对战', style: menuItemStyle), + child: Text(S.of(context).aiVsAi, style: menuItemStyle), onPressed: () => navigateTo(GamePage(EngineType.aiVsAi)), ), Expanded(child: SizedBox()), Text( - ' 健康游戏忠告\n' - '抵制不良游戏,拒绝盗版游戏。\n' - '注意自我保护,谨防受骗上当。\n' - '适度游戏益脑,沉迷游戏伤身。\n' - '合理安排时间,享受健康生活。', + ' ??????\n' + '??????,???????\n' + '??????,???????\n' + '??????,???????\n' + '??????,???????', style: TextStyle(color: Colors.black54, fontSize: 16)), Expanded(child: SizedBox()), - Text('Copyright © 2019-2020 The Sanmill Authors', + Text('Copyright 2019-2020 The Sanmill Authors', style: TextStyle(color: Colors.black54, fontSize: 16)), Expanded(child: SizedBox()), ],