Skip to content

Development#57

Merged
BlameTwo merged 13 commits intomasterfrom
development
Apr 30, 2026
Merged

Development#57
BlameTwo merged 13 commits intomasterfrom
development

Conversation

@BlameTwo
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 30, 2026 03:48
@BlameTwo BlameTwo merged commit 285ec69 into master Apr 30, 2026
2 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new in-app “data center” WebView2 window for Wuthering Waves, introduces a “refresh current page” action wired through the MVVM messenger, and adjusts several V2 game page/UI and downloader/update flows (plus version bumps).

Changes:

  • Add KuroDataCenterWindow + WebView2 session bootstrap (WebSessionContext, WebViewHostInitializer) and wire OpenDataCenter to open it.
  • Add “refresh current page” command in shell and hook game pages to run LoadedCommand on page load.
  • Update several V2 game context/download/update behaviors and bump app/setup versions.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/WutheringWavesTool/WindowModels/KuroDataCenterWindow.xaml.cs New WinUI window code-behind hosting the WebView2 data center page.
src/WutheringWavesTool/WindowModels/KuroDataCenterWindow.xaml New window XAML layout for the data center WebView2 view.
src/WutheringWavesTool/ViewModel/WikiViewModels/WavesWikiViewModel.cs Inject IAppContext, remove stamina usage, and open the new data center window.
src/WutheringWavesTool/ViewModel/WikiViewModels/PunishWikiViewModel.cs Make Dispose null-safe.
src/WutheringWavesTool/ViewModel/ShellViewModel.cs Add command to send a refresh message for the current page.
src/WutheringWavesTool/ViewModel/GameViewModels/KuroGameContextViewModelV2/KuroGameContextViewModelV2.cs Register refresh messenger + add Loaded command and some UI text updates.
src/WutheringWavesTool/ViewModel/GameViewModels/KuroGameContextViewModelV2/KuroGameContextViewModelV2.Predownloader.cs Add pause/resume toggle handling for predownload command.
src/WutheringWavesTool/ViewModel/DialogViewModels/UpdateGameViewModel.cs Switch dialog VM to use IGameContextV2.
src/WutheringWavesTool/Pages/ShellPage.xaml Add a refresh button in the title bar footer bound to the new command.
src/WutheringWavesTool/Pages/GameWikis/WavesWikiPage.xaml Update UI text and replace stamina panel with “敬请期待”.
src/WutheringWavesTool/Pages/GamePages/WavesV2GamePage.xaml Invoke LoadedCommand via Xaml behaviors and adjust launcher/predownload UI layout.
src/WutheringWavesTool/Pages/GamePages/PunishV2GamePage.xaml Invoke LoadedCommand via Xaml behaviors and adjust launcher/predownload UI layout.
src/WutheringWavesTool/Pages/Dialogs/UpdateGameDialog.xaml.cs Resolve keyed IGameContextV2 for the update dialog.
src/WutheringWavesTool/Package.appxmanifest Bump package version.
src/WutheringWavesTool/Models/WebSessionContext.cs Add session model + source-gen JSON context used to seed WebView login/session.
src/WutheringWavesTool/Models/Messanger/RefreshGamePageMessager.cs Add a new messenger message type for page refresh.
src/WutheringWavesTool/Haiyu.csproj Update WebView2 package and add XAML Page compile entries.
src/WutheringWavesTool/Common/KuroWebView/WebViewHostInitializer.cs Add WebView2 initialization + JS/cookie session injection for Kuro web pages.
src/WutheringWavesTool/App.xaml.cs Bump app version string.
src/Waves.Core/Services/KuroClient/KuroClient.DataCenter.cs Add retries and minor formatting for data-center API calls.
src/Waves.Core/Services/GameWikiClient.cs Add null guard in GetEventData.
src/Waves.Core/Models/WavesQueryLocalPlayerInfoRequest.cs Make some fields nullable/long? and update recover-time formatting logic.
src/Waves.Core/GameContext/KruoGameContextBaseV2/KuroGameContextBaseV2.cs Refine pause logic for download vs predownload state.
src/Waves.Core/GameContext/KruoGameContextBaseV2/KuroGameContextBaseV2.UpdateGame.cs Adjust CDN/resource selection + update task cleanup and check-all flow.
src/Waves.Core/GameContext/KruoGameContextBaseV2/KuroGameContextBaseV2.Download.cs Adjust completion cleanup and cancellation/state reset behavior.
src/Setup/Project.WPFSetup/ViewModels/UserViewModels/UpdateViewModel.cs Improve process-kill logic to handle multiple running instances.
src/Setup/Project.WPFSetup/ViewModels/UserViewModels/UninstallViewModel.cs Improve process-kill logic to handle multiple running instances.
src/Setup/Project.WPFSetup/Resources/Resource1.resx Bump setup version string.
src/Setup/Project.WPFSetup/Resources/Resource1.Designer.cs Update generated XML doc string for the bumped version.
Files not reviewed (1)
  • src/Setup/Project.WPFSetup/Resources/Resource1.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private AppInstance mainInstance;

public static string AppVersion => "1.2.20";
public static string AppVersion => "1.2.21";
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVersion was bumped to 1.2.21, but Package.appxmanifest is still Version="1.2.20.0" (and setup resources are also 1.2.21). Keeping these versions in sync avoids confusing users and update systems; update the manifest (and any other version sources) to match.

Copilot uses AI. Check for mistakes.
Comment on lines +238 to +240
<Page Update="Pages\Communitys\KuroDataCenterWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project file includes Pages\Communitys\KuroDataCenterWindow.xaml, but that file does not exist under src/WutheringWavesTool/Pages/Communitys. This will break builds; remove this <Page Update=...> entry or add the missing XAML file.

Suggested change
<Page Update="Pages\Communitys\KuroDataCenterWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

Copilot uses AI. Check for mistakes.
Comment on lines +33 to 37
for (int i = 0; i < 5; i++)
{
return null;
}
var result = await HttpClientService.HttpClient.SendAsync(request, token);
var jsonStr = await result.Content.ReadAsStringAsync(token);

Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry loop reuses the same HttpRequestMessage instance for multiple SendAsync calls. HttpRequestMessage is single-use; retrying with the same instance can throw (e.g., "The request message was already sent") or reuse disposed content. Build a new request inside the loop (or clone the request/content) before each retry.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,36 @@
using ABI.System;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using ABI.System; appears unused in this file. Removing it avoids unnecessary/unused imports (and potential type name ambiguity) under nullable/analyzer settings.

Suggested change
using ABI.System;

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +12
private string? _documentScriptId;
private WebSessionContext _currentSession;
private bool _eventsHooked;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_currentSession is declared non-nullable but never initialized in the constructor, and it is used from the NavigationCompleted handler. This will raise nullable warnings and could throw if NavigationCompleted fires before InitializeAsync sets the session. Consider making it nullable and guarding before use (or initialize to a non-null sentinel).

Copilot uses AI. Check for mistakes.
Comment on lines +136 to 140
if (value == null)
{
field = 0;
}
if (value == 0)
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When StoreEnergyRecoverTime is null, the setter assigns field = 0 but then continues execution; later it dereferences value!.Value, which will throw. After handling null, return immediately (or normalize null to 0 before subsequent checks).

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +171
{
field = 0;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When EnergyRecoverTime is null, the setter assigns field = 0 but then continues execution; later it dereferences value!.Value, which will throw. After handling null, return immediately (or normalize null to 0 before subsequent checks).

Suggested change
{
field = 0;
{
this.EnergyRecoverEndTime = "已充满";
field = 0;
return;

Copilot uses AI. Check for mistakes.
Comment on lines 795 to 799
var cdnResult = await TestCdnAsync(
launcher.ResourceDefault.CdnList,
launcher.ResourceDefault.ResourcesBasePath,
patch.Resource
checkAllResource!.Resource
);
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetGameResourceAsync returns IndexGameResource?, but checkAllResource!.Resource is dereferenced without a null check. If the resource index request fails or returns null, this will throw at runtime. Handle the null case before calling TestCdnAsync.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +10
WebViewHostInitializer hostInitializer;

public KuroDataCenterWindow(nint value, WebSessionContext context)
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostInitializer is a non-nullable field but it is only assigned in grid_Loaded. With <Nullable>enable</Nullable>, this will produce a nullability warning (and may be treated as an error depending on build settings). Make it nullable (WebViewHostInitializer?) or initialize it in the constructor.

Copilot uses AI. Check for mistakes.

public class RefreshGamePageMessager(bool isRefresh)
{

Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RefreshGamePageMessager(bool isRefresh) defines a constructor parameter that is never stored or exposed, so the boolean passed by senders is effectively ignored. Either remove the parameter to make this a pure marker message, or add a public property/field so receivers can read isRefresh.

Suggested change
public bool IsRefresh { get; } = isRefresh;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants