Skip to content

Commit 4e7f30d

Browse files
committed
二次确认
1 parent 236cab0 commit 4e7f30d

3 files changed

Lines changed: 55 additions & 27 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
* 超域旅行功能支持自动检测是否正在维护状态与维护状态结束后自动恢复服务
22
* 现在在各类取消后会造成文件损坏的操作执行时, 将不会显示取消按钮, 避免误操作
3+
* 为各类游戏文件操作加入了二次确认对话框, 避免误操作
34

45
> 当前分支仅支持 `Windows 11` 的 `x64` 环境,不提供 `Linux`、`macOS` 与 `SteamDeck` 等环境的相关支持

src/XIVLauncher/Windows/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@
784784
Height="18" />
785785
</Button>
786786

787-
<Border x:Name="AccountSwitcherPopupPlaceholder" Visibility="Collapsed" />
787+
<Border Grid.Column="0" x:Name="AccountSwitcherPopupPlaceholder" Visibility="Collapsed" />
788788
</Grid>
789789

790790
</StackPanel>

src/XIVLauncher/Windows/ViewModel/MainWindowViewModel.cs

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public MainWindowViewModel(Window window)
125125
AccountManager,
126126
new DialogService(window),
127127
new ShortcutService(),
128-
() => CloseAccountSwitcher(false)
128+
CloseAccountSwitcher
129129
);
130130
AccountSwitcherButtonCommand = new SyncCommand(ExecuteAccountSwitcherButton);
131131
refreshDalamudInfoCommand = new SyncCommand(_ => RefreshDalamudInfo(), () => Settings.EnableHooks && App.Dalamud.Updater.State != DalamudUpdater.DownloadState.Unknown);
@@ -176,13 +176,15 @@ public MainWindowViewModel(Window window)
176176

177177
DcTravelRuntimeService.MaintenanceStateChanged += state =>
178178
{
179-
Window.Dispatcher.Invoke(() =>
180-
{
181-
var isMaintenance = state == DCTravelMaintenanceState.UnderMaintenance;
182-
DCTravelPage.IsUnderMaintenance = isMaintenance;
183-
DCTravelPage.MaintenanceMessage = isMaintenance ? "超域旅行服务维护中, 请稍后再试" : string.Empty;
184-
DashboardPage.IsDCTravelUnderMaintenance = isMaintenance;
185-
});
179+
Window.Dispatcher.Invoke
180+
(() =>
181+
{
182+
var isMaintenance = state == DCTravelMaintenanceState.UnderMaintenance;
183+
DCTravelPage.IsUnderMaintenance = isMaintenance;
184+
DCTravelPage.MaintenanceMessage = isMaintenance ? "超域旅行服务维护中, 请稍后再试" : string.Empty;
185+
DashboardPage.IsDCTravelUnderMaintenance = isMaintenance;
186+
}
187+
);
186188
};
187189

188190
App.Dalamud.StatusChanged += DalamudUpdaterStatusChanged;
@@ -193,9 +195,7 @@ public MainWindowViewModel(Window window)
193195
};
194196
}
195197

196-
public bool IsAccountSwitcherVisible => IsAccountSwitcherOpen;
197-
198-
public void CloseAccountSwitcher(bool animate) =>
198+
public void CloseAccountSwitcher() =>
199199
IsAccountSwitcherOpen = false;
200200

201201
#region 界面控制
@@ -209,11 +209,8 @@ public void SwitchCard(LoginCardType i, bool shouldCancelLogin = true) =>
209209

210210
if (i == LoginCardType.InjectMode)
211211
{
212-
var currentCard = (LoginCardType)LoginCardTransitionerIndex;
213-
if (currentCard != LoginCardType.InjectMode && currentCard != LoginCardType.Logining)
214-
{
215-
injectModeSourceCard = currentCard;
216-
}
212+
var currentCard = (LoginCardType)LoginCardTransitionerIndex;
213+
if (currentCard != LoginCardType.InjectMode && currentCard != LoginCardType.Logining) injectModeSourceCard = currentCard;
217214

218215
InjectPage.ReturnButtonText = injectModeSourceCard == LoginCardType.Dashboard ? "返回主页面" : "返回账号登录";
219216
}
@@ -511,16 +508,8 @@ private async Task HandleLoginWorkflowExceptionAsync(Exception ex, LoginType log
511508
{
512509
if (App.Settings.GamePath != null && Repository.Ffxiv.IsBaseVer(App.Settings.GamePath))
513510
{
514-
if (CustomMessageBox.Show
515-
(
516-
"未检测到游戏安装, 是否立即下载安装完整游戏?",
517-
"XIVLauncherCN (Soil)",
518-
MessageBoxButton.YesNo,
519-
parentWindow: Window
520-
)
521-
== MessageBoxResult.Yes)
522-
_ = GameClientFileTaskService.RunAsync(GameClientFileTaskKind.FreshInstall);
523-
511+
IsLoggingIn = false;
512+
_ = HandleGameClientFileTask(GameClientFileTaskKind.FreshInstall);
524513
return;
525514
}
526515

@@ -604,6 +593,41 @@ bool usedSavedWeGameToken
604593
AccountManager.Save(account);
605594
}
606595

596+
private bool ConfirmGameClientFileTask(GameClientFileTaskKind kind)
597+
{
598+
string message;
599+
string title;
600+
601+
switch (kind)
602+
{
603+
case GameClientFileTaskKind.Update:
604+
message = "即将检查游戏更新, 并下载安装可能存在的更新文件, 是否要开始?";
605+
title = "更新游戏文件";
606+
break;
607+
608+
case GameClientFileTaskKind.Repair:
609+
message = "即将扫描游戏文件完整性, 并下载安装存在异常的文件、归档多余的文件, 是否要开始?";
610+
title = "修复游戏文件";
611+
break;
612+
613+
case GameClientFileTaskKind.IntegrityCheck:
614+
message = "即将检查游戏文件完整性, 是否要开始?";
615+
title = "检查游戏完整性";
616+
break;
617+
618+
case GameClientFileTaskKind.FreshInstall:
619+
message = "未检测到游戏安装, 即将下载安装完整游戏, 是否要开始?";
620+
title = "安装游戏文件";
621+
break;
622+
623+
default:
624+
return true;
625+
}
626+
627+
return CustomMessageBox.Show(message, title, MessageBoxButton.YesNo, parentWindow: Window)
628+
!= MessageBoxResult.No;
629+
}
630+
607631
private bool ConfirmGamePatchInstall()
608632
{
609633
if (!App.Settings.AskBeforePatchInstall)
@@ -1372,6 +1396,9 @@ private async Task HandleGameClientFileTask(GameClientFileTaskKind kind)
13721396
if (IsLoggingIn)
13731397
return;
13741398

1399+
if (!ConfirmGameClientFileTask(kind))
1400+
return;
1401+
13751402
IsLoggingIn = true;
13761403
IsEnabled = false;
13771404
LoginPage.RefreshCommandStates();

0 commit comments

Comments
 (0)