Skip to content

Commit

Permalink
修改主题色运作模式,初步完成游戏安装对话框前端
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSpring114 committed Dec 29, 2024
1 parent 7943b86 commit 7d22be6
Show file tree
Hide file tree
Showing 16 changed files with 733 additions and 168 deletions.
8 changes: 8 additions & 0 deletions WonderLab.Infrastructure/Enums/VersionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace WonderLab.Infrastructure.Enums;

public enum VersionType {
Release,
Snapshot,
Old_Beta,
Old_Alpha,
}
39 changes: 31 additions & 8 deletions WonderLab/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ResourceInclude Source="/Controls/Theme/ColorTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/FrameTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/ButtonTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/TextBoxTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/ExpanderTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/FontIconTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/ComboBoxTheme.axaml"/>
Expand All @@ -33,15 +34,37 @@
<ResourceInclude Source="/Controls/Theme/NotificationCardTheme.axaml"/>
<ResourceInclude Source="/Controls/Theme/ColorPicker/ColorPickerStyles.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

<Thickness x:Key="FlyoutContentThemePadding">0</Thickness>

<SolidColorBrush x:Key="NormalAccentBrush"/>
<SolidColorBrush x:Key="DarkAccentBrush1"/>
<SolidColorBrush x:Key="DarkAccentBrush2"/>
<SolidColorBrush x:Key="LightAccentBrush1"/>
<SolidColorBrush x:Key="LightAccentBrush2"/>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="RadioButtonCheckedBackground" Color="{DynamicResource NormalAccentColor}"/>
<SolidColorBrush x:Key="RadioButtonCheckedBorderBrush" Color="{DynamicResource LightAccentColor3}"/>
</ResourceDictionary>

<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="RadioButtonCheckedBackground" Color="{DynamicResource NormalAccentColor}"/>
<SolidColorBrush x:Key="RadioButtonCheckedBorderBrush" Color="{DynamicResource DarkAccentColor1}"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<Color x:Key="NormalAccentColor">#fee7ef</Color>
<Color x:Key="DarkAccentColor1">#fee7ef</Color>
<Color x:Key="DarkAccentColor2">#fee7ef</Color>
<Color x:Key="DarkAccentColor3">#fee7ef</Color>
<Color x:Key="LightAccentColor1">#fee7ef</Color>
<Color x:Key="LightAccentColor2">#fee7ef</Color>
<Color x:Key="LightAccentColor3">#fee7ef</Color>

<SolidColorBrush x:Key="NormalAccentBrush" Color="{DynamicResource NormalAccentColor}"/>
<SolidColorBrush x:Key="DarkAccentBrush1" Color="{DynamicResource DarkAccentColor1}"/>
<SolidColorBrush x:Key="DarkAccentBrush2" Color="{DynamicResource DarkAccentColor2}"/>
<SolidColorBrush x:Key="DarkAccentBrush3" Color="{DynamicResource DarkAccentColor3}"/>
<SolidColorBrush x:Key="LightAccentBrush1" Color="{DynamicResource LightAccentColor1}"/>
<SolidColorBrush x:Key="LightAccentBrush2" Color="{DynamicResource LightAccentColor2}"/>
<SolidColorBrush x:Key="LightAccentBrush3" Color="{DynamicResource LightAccentColor3}"/>

<Thickness x:Key="FlyoutContentThemePadding">0</Thickness>
</ResourceDictionary>

<FontFamily x:Key="MinecraftFontFamily">resm:WonderLab.Assets.Font.MinecraftTen.ttf?assembly=WonderLab#Minecraft Ten</FontFamily>

Expand Down
28 changes: 18 additions & 10 deletions WonderLab/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using WonderLab.Services.UI;
using WonderLab.ViewModels.Dialog;
using WonderLab.ViewModels.Dialog.Auth;
using WonderLab.ViewModels.Dialog.Download;
using WonderLab.ViewModels.Page;
using WonderLab.ViewModels.Page.Download;
using WonderLab.ViewModels.Page.Setting;
Expand Down Expand Up @@ -84,20 +85,26 @@ private void OnStartup(object sender, ControlledApplicationLifetimeStartupEventA
Get<AccountService>().Initialize();

//Override AccentColors
Current.Resources["NormalAccentBrush"] =
configService.Entries.ActiveAccentColor.ToColor().ToBrush();
Current.Resources["NormalAccentColor"] =
configService.Entries.ActiveAccentColor.ToColor();

Current.Resources["DarkAccentBrush1"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(-0.15f).ToBrush();
Current.Resources["DarkAccentColor1"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(-0.15f);

Current.Resources["DarkAccentBrush2"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(-0.30f).ToBrush();
Current.Resources["DarkAccentColor2"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(-0.30f);

Current.Resources["LightAccentBrush1"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(0.15f).ToBrush();
Current.Resources["DarkAccentColor3"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(-0.45f);

Current.Resources["LightAccentBrush2"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(0.30f).ToBrush();
Current.Resources["LightAccentColor1"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(0.15f);

Current.Resources["LightAccentColor2"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(0.30f);

Current.Resources["LightAccentColor3"] =
configService.Entries.ActiveAccentColor.ToColor().GetColorAfterLuminance(0.45f);

I18NExtension.Culture = new(configService.Entries.ActiveLanguage);

Expand Down Expand Up @@ -126,6 +133,7 @@ private static IHost ConfigureIoC(out IHost host) {
builder.Services.AddTransient<OfflineAuthDialogViewModel>();
builder.Services.AddTransient<MicrosoftAuthDialogViewModel>();
builder.Services.AddTransient<YggdrasilAuthDialogViewModel>();
builder.Services.AddTransient<InstallMinecraftDialogViewModel>();
builder.Services.AddTransient<ChooseAccountTypeDialogViewModel>();

//Configure Page
Expand Down
Loading

0 comments on commit 7d22be6

Please sign in to comment.