feat: add the option if restart game when game disconnects (#3839)

选择是否在游戏掉线时自动重连,在WPF中实现相关逻辑
This commit is contained in:
MistEO
2023-03-06 17:41:02 +08:00
committed by GitHub
8 changed files with 44 additions and 1 deletions

View File

@@ -731,7 +731,18 @@ namespace MaaWpfGui
break;
case "OfflineConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("GameDrop"), UILogColor.Warning);
if (_settingsViewModel.AutoRestartOnDrop)
{
_taskQueueViewModel.AddLog(Localization.GetString("GameDrop"), UILogColor.Warning);
}
else
{
_taskQueueViewModel.AddLog(Localization.GetString("GameDropNoRestart"), UILogColor.Warning);
using var toast = new ToastNotification(Localization.GetString("GameDropNoRestart"));
toast.Show();
_taskQueueViewModel.Stop();
}
break;
case "GamePass":

View File

@@ -626,6 +626,18 @@ namespace MaaWpfGui
{ "txwy", "ZH_TW" },
};
private bool _autoRestartOnDrop = bool.Parse(ViewStatusStorage.Get("Start.AutoRestartOnDrop", "True"));
public bool AutoRestartOnDrop
{
get => _autoRestartOnDrop;
set
{
SetAndNotify(ref _autoRestartOnDrop, value);
ViewStatusStorage.Set("Start.AutoRestartOnDrop", value.ToString());
}
}
/// <summary>
/// Gets the server type.
/// </summary>

View File

@@ -180,6 +180,7 @@
<system:String x:Key="LaunchOnSystemStartup">Auto start with PC</system:String>
<system:String x:Key="RunTaskAfterLaunch">Auto Run task after launched</system:String>
<system:String x:Key="ClientType">Client Type</system:String>
<system:String x:Key="AutoRestartOption">Restart when game disconnects</system:String>
<system:String x:Key="OpenEmulatorAfterLaunch">Startup Emulator after launched</system:String>
<system:String x:Key="MinimizingStartup">Minimizing the startup Emulator</system:String>
<system:String x:Key="WaitForEmulator">Delay time</system:String>
@@ -450,6 +451,7 @@
<system:String x:Key="UpperLimit">Investment limit reached</system:String>
<system:String x:Key="GameCrash">Game crashed pending restart</system:String>
<system:String x:Key="GameDrop">Game disconnected, pending reconnect</system:String>
<system:String x:Key="GameDropNoRestart">Game disconnected, not restarting, stopping</system:String>
<system:String x:Key="RoguelikeGamePass">Game cleared! congratulations!</system:String>
<system:String x:Key="SSSGamePass">Game cleared! congratulations!</system:String>
<system:String x:Key="Trader">Stage: Trader</system:String>

View File

@@ -180,6 +180,7 @@
<system:String x:Key="LaunchOnSystemStartup">スタートアップ</system:String>
<system:String x:Key="RunTaskAfterLaunch">アプリの起動時に自動的に実行</system:String>
<system:String x:Key="ClientType">クライアントバージョン</system:String>
<system:String x:Key="AutoRestartOption">ゲームが切断されたときに自動的に再接続する</system:String>
<system:String x:Key="OpenEmulatorAfterLaunch">起動時にエミュレータ自動起動</system:String>
<system:String x:Key="MinimizingStartup">エミュレーターの起動を最小化する</system:String>
<system:String x:Key="WaitForEmulator">エミュレータを待つ時間(秒)</system:String>
@@ -451,6 +452,7 @@
<system:String x:Key="UpperLimit">源石錐が上限に達しました</system:String>
<system:String x:Key="GameCrash">ゲームがクラッシュ。再起動を行います</system:String>
<system:String x:Key="GameDrop">回線が落ちました。再接続を行います</system:String>
<system:String x:Key="GameDropNoRestart">ゲームが落ちる、再接続しない、クエストを停止する</system:String>
<system:String x:Key="RoguelikeGamePass">ゲームクリア、おめでとうございます!</system:String>
<system:String x:Key="SSSGamePass">ゲームクリア、おめでとうございます!</system:String>
<system:String x:Key="Trader">ステージ:怪しい旅商人</system:String>

View File

@@ -174,6 +174,7 @@
<system:String x:Key="LaunchOnSystemStartup">시스템 시작 시 MAA 실행</system:String>
<system:String x:Key="RunTaskAfterLaunch">MAA 실행 후 작업 자동 시작</system:String>
<system:String x:Key="ClientType">클라이언트 종류</system:String>
<system:String x:Key="AutoRestartOption">게임 연결이 끊어지면 자동으로 다시 연결</system:String>
<system:String x:Key="OpenEmulatorAfterLaunch">MAA 실행 후 에뮬레이터를 실행</system:String>
<system:String x:Key="MinimizingStartup">시작 시뮬레이터 최소화</system:String>
<system:String x:Key="WaitForEmulator">에뮬레이터 실행 대기 (초)</system:String>
@@ -438,6 +439,7 @@
<system:String x:Key="UpperLimit">투자가 한계에 도달했습니다</system:String>
<system:String x:Key="GameCrash">게임이 강제종료되었습니다. 다시 시작해야 합니다.</system:String>
<system:String x:Key="GameDrop">연결이 끊어졌습니다. 다시 연결 중입니다.</system:String>
<system:String x:Key="GameDropNoRestart">게임 중단, 다시 연결되지 않음, 퀘스트 중지</system:String>
<system:String x:Key="RoguelikeGamePass">게임 클리어, 축하합니다!</system:String>
<system:String x:Key="SSSGamePass">게임 클리어, 축하합니다!</system:String>
<system:String x:Key="Trader">레벨: 교활한 상인</system:String>

View File

@@ -181,6 +181,7 @@
<system:String x:Key="LaunchOnSystemStartup">开机自动启动MAA</system:String>
<system:String x:Key="RunTaskAfterLaunch">启动MAA后直接运行</system:String>
<system:String x:Key="ClientType">客户端类型</system:String>
<system:String x:Key="AutoRestartOption">游戏掉线时自动重连</system:String>
<system:String x:Key="HelpUsWithOverseasServersTip">外服适配滞销,帮帮我们!不会编程也可以</system:String>
<system:String x:Key="OpenEmulatorAfterLaunch">启动MAA后自动开启模拟器</system:String>
<system:String x:Key="MinimizingStartup">最小化启动模拟器</system:String>
@@ -453,6 +454,7 @@
<system:String x:Key="UpperLimit">投资达到上限</system:String>
<system:String x:Key="GameCrash">游戏崩溃,重新启动</system:String>
<system:String x:Key="GameDrop">游戏掉线,重新连接</system:String>
<system:String x:Key="GameDropNoRestart">游戏掉线,不重新连接,停止任务</system:String>
<system:String x:Key="RoguelikeGamePass">肉鸽通关啦!</system:String>
<system:String x:Key="SSSGamePass">保全通关啦!</system:String>
<system:String x:Key="Trader">关卡:诡意行商</system:String>

View File

@@ -137,6 +137,7 @@
<system:String x:Key="LaunchOnSystemStartup">開機自動啟動</system:String>
<system:String x:Key="RunTaskAfterLaunch">啟動後直接運行</system:String>
<system:String x:Key="ClientType">用戶端類型</system:String>
<system:String x:Key="AutoRestartOption">遊戲掉線時自動重連</system:String>
<system:String x:Key="OpenEmulatorAfterLaunch">啟動後自動開啟模擬器</system:String>
<system:String x:Key="MinimizingStartup">最小化啟動模擬器</system:String>
<system:String x:Key="WaitForEmulator">等待模擬器啟動時間(秒)</system:String>
@@ -386,6 +387,7 @@
<system:String x:Key="UpperLimit">投資達到上限</system:String>
<system:String x:Key="GameCrash">遊戲崩潰,重新啟動</system:String>
<system:String x:Key="GameDrop">遊戲斷線,重新連接</system:String>
<system:String x:Key="GameDropNoRestart">遊戲掉線,不重新連接,停止任務</system:String>
<system:String x:Key="RoguelikeGamePass">肉鴿通關啦!</system:String>
<system:String x:Key="Trader">關卡:詭意行商</system:String>
<system:String x:Key="SafeHouse">關卡:安全的角落</system:String>

View File

@@ -32,6 +32,16 @@
ItemsSource="{Binding ClientTypeList}"
SelectedValue="{Binding ClientType}"
SelectedValuePath="Value" />
<CheckBox
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding AutoRestartOnDrop}"
Content="{DynamicResource AutoRestartOption}" />
<maa:TextBlock
HorizontalAlignment="Center"
Text="帮帮"
Visibility="{c:Binding '(ClientType != &quot;Official&quot;) and (ClientType != &quot;Bilibili&quot;) and (ClientType != &quot;&quot;)'}" />
<maa:TextBlock HorizontalAlignment="Center" Visibility="{c:Binding '(ClientType != &quot;Official&quot;) and (ClientType != &quot;Bilibili&quot;) and (ClientType != &quot;&quot;)'}">
<Hyperlink
Cursor="Hand"