Skip to content

Commit

Permalink
可以选择帐号了
Browse files Browse the repository at this point in the history
  • Loading branch information
d3ara1n committed Mar 30, 2024
1 parent 7d82d96 commit 339e018
Show file tree
Hide file tree
Showing 79 changed files with 517 additions and 373 deletions.
63 changes: 44 additions & 19 deletions Polymerium.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Others", "Others", "{C110B95E-E6B9-48BE-8680-8DDA0F31D8CF}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
README.md = README.md
.gitignore = .gitignore
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Changelogs", "Changelogs", "{287C6B18-9178-417D-B603-09C18E2D3DE9}"
Expand All @@ -22,7 +22,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polymerium.Trident", "src\P
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Trident.Abstractions", "src\Trident.Abstractions\Trident.Abstractions.csproj", "{F54A3B89-FAA2-4374-B7B2-2F77D9C30D07}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polymerium.App", "src\Polymerium.App\Polymerium.App.csproj", "{C0967A01-B1B0-41BA-882C-9B88C7B4F891}"
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Polymerium.Package", "src\Polymerium.Package\Polymerium.Package.wapproj", "{62506F6F-E0A8-4049-9111-42B5E7B64FB9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polymerium.App", "src\Polymerium.App\Polymerium.App.csproj", "{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -68,23 +70,46 @@ Global
{F54A3B89-FAA2-4374-B7B2-2F77D9C30D07}.Release|x64.Build.0 = Release|Any CPU
{F54A3B89-FAA2-4374-B7B2-2F77D9C30D07}.Release|x86.ActiveCfg = Release|Any CPU
{F54A3B89-FAA2-4374-B7B2-2F77D9C30D07}.Release|x86.Build.0 = Release|Any CPU
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|Any CPU.ActiveCfg = Debug|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|Any CPU.Build.0 = Debug|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|ARM64.Build.0 = Debug|ARM64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|x64.ActiveCfg = Debug|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|x64.Build.0 = Debug|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|x64.Deploy.0 = Debug|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|x86.ActiveCfg = Debug|x86
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Debug|x86.Build.0 = Debug|x86
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|Any CPU.ActiveCfg = Release|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|Any CPU.Build.0 = Release|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|ARM64.ActiveCfg = Release|ARM64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|ARM64.Build.0 = Release|ARM64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|x64.ActiveCfg = Release|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|x64.Build.0 = Release|x64
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|x86.ActiveCfg = Release|x86
{C0967A01-B1B0-41BA-882C-9B88C7B4F891}.Release|x86.Build.0 = Release|x86
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|Any CPU.ActiveCfg = Debug|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|Any CPU.Build.0 = Debug|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|Any CPU.Deploy.0 = Debug|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|ARM64.Build.0 = Debug|ARM64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|ARM64.Deploy.0 = Debug|ARM64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|x64.ActiveCfg = Debug|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|x64.Build.0 = Debug|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|x64.Deploy.0 = Debug|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|x86.ActiveCfg = Debug|x86
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|x86.Build.0 = Debug|x86
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Debug|x86.Deploy.0 = Debug|x86
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|Any CPU.ActiveCfg = Release|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|Any CPU.Build.0 = Release|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|Any CPU.Deploy.0 = Release|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|ARM64.ActiveCfg = Release|ARM64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|ARM64.Build.0 = Release|ARM64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|ARM64.Deploy.0 = Release|ARM64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|x64.ActiveCfg = Release|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|x64.Build.0 = Release|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|x64.Deploy.0 = Release|x64
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|x86.ActiveCfg = Release|x86
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|x86.Build.0 = Release|x86
{62506F6F-E0A8-4049-9111-42B5E7B64FB9}.Release|x86.Deploy.0 = Release|x86
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|Any CPU.ActiveCfg = Debug|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|Any CPU.Build.0 = Debug|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|ARM64.ActiveCfg = Debug|ARM64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|ARM64.Build.0 = Debug|ARM64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|x64.ActiveCfg = Debug|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|x64.Build.0 = Debug|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|x86.ActiveCfg = Debug|x86
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Debug|x86.Build.0 = Debug|x86
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|Any CPU.ActiveCfg = Release|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|Any CPU.Build.0 = Release|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|ARM64.ActiveCfg = Release|ARM64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|ARM64.Build.0 = Release|ARM64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|x64.ActiveCfg = Release|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|x64.Build.0 = Release|x64
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|x86.ActiveCfg = Release|x86
{5AD9C489-6731-4BDA-8DD4-7E365E08FE63}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,27 @@ Windows
* [ ] 账号管理
* [ ] 账号提供方
* [ ] Microsoft 账号登录
* [x] 设备码添加账号
* [ ] 可用性检查与刷新
* [ ] 回退到离线模式
* [ ] authlib-injector 账号注入
* [ ] 无网模式
* [ ] 部署引擎
* [x] 基于 Iterator 模型
* [x] 香草安装
* [ ] 加载器安装
* [ ] Forge
* [x] Forge
* [ ] NeoForge
* [ ] Fabric
* [ ] Quilt
* [ ] Trident Storage
* [ ] 固化与还原
* [x] Trident Storage
* [x] 固化与还原
* [x] 基于文件池
* [x] 还原引擎
* [x] 基于 Iterator 并发模型
* [ ] 发射引擎
* [ ] 基于 Iterator 模型
* [ ] 下载引擎
* [ ] 基于 Iterator 模型(错误的,什么都往这个模型套是过度设计,除了部署引擎本身就是串行的,其他引擎都是并行的,套到迭代器这种串行模型上面就是错误设计。真正的问题仅需
* [x] 下载引擎
* [x] 基于 Iterator 模型(错误的,什么都往这个模型套是过度设计,除了部署引擎本身就是串行的,其他引擎都是并行的,套到迭代器这种串行模型上面就是错误设计。真正的问题仅需
`Parallel.ForEach(x => DownloadAsync(x))` 甚至 `Task.WaitAll`
就能解决。但我还是要在未来实现它,因为并行工作用串行收集结果很优雅~
* [ ] 资源仓库
Expand All @@ -183,10 +184,10 @@ Windows
* [x] 导入在线整合包
* [ ] 添加在线资源到本地实例
* [ ] 收藏合集:为一个(新)实例添加一系列资源,用以对公共整合包快速个性化
* [ ] 软件设置
* [ ] 游戏实例设置
* [ ] 元数据编辑
* [ ] 私有启动配置页面
* [x] 软件设置
* [x] 游戏实例设置
* [x] 元数据编辑
* [x] 私有启动配置页面
* [ ] 本地化

更多细节请在 [Issues](https://github.com/d3ara1n/Polymerium/issues) 中查询。
Expand Down
2 changes: 1 addition & 1 deletion src/Polymerium.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public App()
Provider = services.BuildServiceProvider();
}

public static new App Current => (App)Application.Current;
public static App Current => (App)Application.Current;

public IServiceProvider Provider { get; }

Expand Down
Binary file removed src/Polymerium.App/Assets/LockScreenLogo.scale-200.png
Binary file not shown.
Binary file removed src/Polymerium.App/Assets/StoreLogo.backup.png
Binary file not shown.
43 changes: 43 additions & 0 deletions src/Polymerium.App/Dialogs/SwitchAccountDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>

<ContentDialog
x:Class="Polymerium.App.Dialogs.SwitchAccountDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="using:Polymerium.App.Models"
xmlns:local="using:Polymerium.App.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:toolkit="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Style="{StaticResource DefaultContentDialogStyle}"
PrimaryButtonStyle="{StaticResource AccentButtonStyle}"
Title="Select Account" PrimaryButtonText="Confirm" CloseButtonText="Cancel">

<Grid>
<ListView ItemsSource="{x:Bind Candidates}" SelectedValue="{x:Bind Result,Mode=TwoWay}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:AccountModel">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid ColumnSpacing="{StaticResource SmallGap}" Padding="{StaticResource SmallMargin}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<toolkit:ImageEx Grid.Column="0"
Source="{x:Bind FaceUrl}"
Width="36" />
<StackPanel Grid.Column="1">
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}" Text="{x:Bind Inner.Username}" />
<TextBlock Text="{x:Bind TypeName}" />
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</ContentDialog>
32 changes: 32 additions & 0 deletions src/Polymerium.App/Dialogs/SwitchAccountDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

using Microsoft.UI.Xaml;
using Polymerium.App.Models;
using System.Collections.Generic;

namespace Polymerium.App.Dialogs
{
public sealed partial class SwitchAccountDialog
{
public IList<AccountModel> Candidates { get; }

public static readonly DependencyProperty ResultProperty = DependencyProperty.Register(
nameof(Result), typeof(AccountModel), typeof(SwitchAccountDialog),
new PropertyMetadata(null));

public AccountModel? Result
{
get { return (AccountModel?)GetValue(ResultProperty); }
set { SetValue(ResultProperty, value); }
}

public SwitchAccountDialog(XamlRoot xamlRoot, IList<AccountModel> candidates)
{
XamlRoot = xamlRoot;
Candidates = candidates;

this.InitializeComponent();
}
}
}
2 changes: 1 addition & 1 deletion src/Polymerium.App/Layout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
VerticalAlignment="Stretch"
Canvas.ZIndex="1">
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<Image Width="24" Source="ms-appx:///Assets/Square44x44Logo.scale-100.png" />
<Image Width="18" Source="ms-appx:///Assets/Logo.png" />
<TextBlock
x:Name="AppTitle"
Margin="12,0,0,0"
Expand Down
2 changes: 1 addition & 1 deletion src/Polymerium.App/Modals/ProjectPreviewModal.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Polymerium.App.Modals
{
public sealed partial class ProjectPreviewModal
{
// Using a DependencyProperty as the backing store for Model. This enables animation, styling, binding, etc...
// Using a DependencyProperty as the backing store for Profile. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ProjectProperty =
DependencyProperty.Register(nameof(Project), typeof(ProjectModel), typeof(ProjectPreviewModal),
new PropertyMetadata(null));
Expand Down
10 changes: 8 additions & 2 deletions src/Polymerium.App/Models/AccountModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ public record AccountModel
public Color Color1 { get; }
public Color Color2 { get; }
public string TypeName { get; }
public string FaceUrl { get; }
public string SkinUrl { get; }

public Reactive<AccountManager, string?, bool> IsDefault { get; }

public ICommand SetAsDefaultCommand { get; }
public ICommand RemoveCommand { get; }

public AccountModel(IAccount inner, Bindable<AccountManager, string?> defaultUuid, ICommand setAsDefault, ICommand remove)
public AccountModel(IAccount inner, Bindable<AccountManager, string?> defaultUuid, ICommand setAsDefault,
ICommand remove)
{
Inner = inner;
switch (inner)
Expand All @@ -30,23 +32,27 @@ public AccountModel(IAccount inner, Bindable<AccountManager, string?> defaultUui
Color1 = Color.FromArgb(255, 131, 158, 255);
Color2 = Color.FromArgb(255, 121, 255, 207);
TypeName = "Microsoft";
FaceUrl = $"https://starlightskins.lunareclipse.studio/render/pixel/{Inner.Uuid}/face";
SkinUrl = $"https://starlightskins.lunareclipse.studio/render/default/{Inner.Uuid}/face";
break;
case FamilyAccount:
Color1 = Color.FromArgb(255, 253, 160, 133);
Color2 = Color.FromArgb(255, 246, 211, 101);
TypeName = "Family Guy";
FaceUrl = $"https://starlightskins.lunareclipse.studio/render/pixel/{Inner.Username}/face";
SkinUrl = $"https://starlightskins.lunareclipse.studio/render/default/{Inner.Username}/face";
break;
case AuthlibAccount:
Color1 = Color.FromArgb(255, 251, 194, 235);
Color2 = Color.FromArgb(255, 166, 193, 238);
TypeName = "Authlib-Injector";
TypeName = "Authlib";
FaceUrl = "";
SkinUrl = "";
break;
default:
throw new NotImplementedException();
}

SetAsDefaultCommand = setAsDefault;
RemoveCommand = remove;
IsDefault = defaultUuid.ToReactive(x => Inner.Uuid == x);
Expand Down
5 changes: 5 additions & 0 deletions src/Polymerium.App/Models/Bindable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ public TValue Value
}

public event PropertyChangedEventHandler? PropertyChanged;

public static Bindable<TOwner, TValue> CreateDummy(TOwner owner, TValue value)
{
return new Bindable<TOwner, TValue>(owner, _ => value, (_, _) => { });
}
}
}
20 changes: 20 additions & 0 deletions src/Polymerium.App/Models/DummyCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Windows.Input;

namespace Polymerium.App.Models;

public class DummyCommand : ICommand
{
public static DummyCommand Instance { get; } = new();
public bool CanExecute(object? parameter)
{
return true;
}

public void Execute(object? parameter)
{
// do nothing
}

public event EventHandler? CanExecuteChanged;
}
Loading

0 comments on commit 339e018

Please sign in to comment.