-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Baka632/240501-AddOtherServerSupport
为概览页添加其他语言剧情的支持
- Loading branch information
Showing
23 changed files
with
440 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
namespace ArknightsStoryText.UWP; | ||
using Windows.ApplicationModel; | ||
|
||
namespace ArknightsStoryText.UWP; | ||
|
||
internal static class CommonValues | ||
{ | ||
public const string NotifyUpdateStoriesMessageToken = "Notify_UpdateStories_MessageToken"; | ||
public const string NotifyUpdateStoryFileInfosMessageToken = "Notify_UpdateStoryFileInfos_MessageToken"; | ||
public const string NotifyPivotNavigationMessageToken = "Notify_PivotNavigation_MessageToken"; | ||
public const string AppBackgroundModeSettingsKey = "App_BackgroundMode_SettingsKey"; | ||
public const string NotifyAppBackgroundChangedMessageToken = "Notify_AppBackgroundChanged_MessageToken"; | ||
|
||
/// <summary> | ||
/// 获取应用程序版本 | ||
/// </summary> | ||
public static string AppVersion => $"{Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}.{Package.Current.Id.Version.Revision}"; | ||
/// <summary> | ||
/// 获取带“版本”文字的应用程序版本字符串 | ||
/// </summary> | ||
public static string AppVersionWithText => string.Format("AppVersion_WithPlaceholder".GetLocalized(), AppVersion); | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Helpers/Converter/AppBackgroundModeToStringConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
| ||
using Windows.UI.Xaml.Data; | ||
|
||
namespace ArknightsStoryText.UWP.Helpers.Converter; | ||
|
||
public sealed class AppBackgroundModeToStringConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
if (value is AppBackgroundMode mode) | ||
{ | ||
return mode switch | ||
{ | ||
AppBackgroundMode.Mica => "MicaBackground".GetLocalized(), | ||
AppBackgroundMode.Acrylic => "AcrylicBackground".GetLocalized(), | ||
AppBackgroundMode.PureColor => "PureColorBackground".GetLocalized(), | ||
_ => throw new NotImplementedException() | ||
}; | ||
} | ||
|
||
return DependencyProperty.UnsetValue; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace ArknightsStoryText.UWP.Models; | ||
|
||
/// <summary> | ||
/// 应用背景模式的枚举 | ||
/// </summary> | ||
public enum AppBackgroundMode | ||
{ | ||
/// <summary> | ||
/// 纯色背景 | ||
/// </summary> | ||
PureColor, | ||
/// <summary> | ||
/// 亚克力背景 | ||
/// </summary> | ||
Acrylic, | ||
/// <summary> | ||
/// 云母背景 | ||
/// </summary> | ||
Mica | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using CommunityToolkit.Mvvm.Messaging; | ||
|
||
namespace ArknightsStoryText.UWP.ViewModels; | ||
|
||
public sealed partial class SettingsViewModel : ObservableObject | ||
{ | ||
public readonly IReadOnlyList<AppBackgroundMode> AppBackgroundModes; | ||
|
||
[ObservableProperty] | ||
private int selectedAppBackgroundModeIndex; | ||
|
||
public SettingsViewModel() | ||
{ | ||
List<AppBackgroundMode> bgModes = new(3); | ||
|
||
bool isSupportMica = MicaHelper.IsSupported(); | ||
bool isSupportAcrylic = AcrylicHelper.IsSupported(); | ||
|
||
if (isSupportMica) | ||
{ | ||
bgModes.Add(AppBackgroundMode.Mica); | ||
} | ||
|
||
if (isSupportAcrylic) | ||
{ | ||
bgModes.Add(AppBackgroundMode.Acrylic); | ||
} | ||
|
||
// 不管什么情况,系统一定支持纯色背景显示 | ||
bgModes.Add(AppBackgroundMode.PureColor); | ||
|
||
AppBackgroundModes = bgModes; | ||
|
||
if (SettingsHelper.TryGet(CommonValues.AppBackgroundModeSettingsKey, out string bgModeString) && Enum.TryParse(bgModeString, out AppBackgroundMode backgroundMode)) | ||
{ | ||
// ;-) | ||
} | ||
else | ||
{ | ||
if (isSupportMica) | ||
{ | ||
backgroundMode = AppBackgroundMode.Mica; | ||
} | ||
else if (isSupportAcrylic) | ||
{ | ||
backgroundMode = AppBackgroundMode.Acrylic; | ||
} | ||
else | ||
{ | ||
backgroundMode = AppBackgroundMode.PureColor; | ||
} | ||
} | ||
|
||
selectedAppBackgroundModeIndex = bgModes.IndexOf(backgroundMode); | ||
} | ||
|
||
partial void OnSelectedAppBackgroundModeIndexChanged(int value) | ||
{ | ||
if (value >= 0) | ||
{ | ||
AppBackgroundMode bgMode = AppBackgroundModes[value]; | ||
string bgModeString = bgMode.ToString(); | ||
SettingsHelper.Set(CommonValues.AppBackgroundModeSettingsKey, bgModeString); | ||
|
||
WeakReferenceMessenger.Default.Send(bgModeString, CommonValues.NotifyAppBackgroundChangedMessageToken); | ||
} | ||
} | ||
} |
Oops, something went wrong.