Skip to content

Commit

Permalink
up 修改很多东西
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Dec 24, 2024
1 parent e58c251 commit 81fad54
Show file tree
Hide file tree
Showing 109 changed files with 1,472 additions and 812 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svg.preview.background": "transparent"
}
16 changes: 15 additions & 1 deletion log.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,22 @@
- 加入OpenP2P
- 加入hal映射

## 已知问题
- 日志窗口与主窗口启动数据不同步
- 游戏其他失败后不能再次启动
- 游戏取消启动处理错误

## 已完成 Done
### 2024.12.22
### 2024.12.24
- 修复游戏无法启动问题
- 修复自定义加载器问题
- 调整启动器背景音乐播放逻辑
- 调整启动器主界面图标
- 调整启动器主界面布局
- 调整Minecraft News显示方式
- 添加MP3ID3读取

### 2024.12.22(A34)
- 修复皮肤显示问题
- 修复登录会产生的崩溃

Expand Down
5 changes: 3 additions & 2 deletions src/ColorMC.Core/CoreMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class ColorMCCore
{
public const int VersionNum = 34;
public const string TopVersion = "A34";
public const string DateVersion = "20241222";
public const string DateVersion = "20241224";

/// <summary>
/// 版本号
Expand Down Expand Up @@ -159,7 +159,8 @@ public static class ColorMCCore
/// 手机端启动
/// </summary>
public static Func<LoginObj, GameSettingObj, JavaInfo, List<string>,
Dictionary<string, string>, IGameHandel> PhoneGameLaunch { internal get; set; }
Dictionary<string, string>, IGameHandel> PhoneGameLaunch
{ internal get; set; }
/// <summary>
/// 手机端Jvm安装
/// </summary>
Expand Down
14 changes: 7 additions & 7 deletions src/ColorMC.Core/Game/Mods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ private static async Task CheckJarInJarAsync(ModObj obj, ZipFile zFile)
}
catch
{

}
}

Expand Down Expand Up @@ -577,8 +577,8 @@ private static async Task CheckJarInJarAsync(ModObj obj, ZipFile zFile)
istest = true;
}
catch
{
{

}
}
}
Expand Down Expand Up @@ -641,9 +641,9 @@ private static async Task CheckJarInJarAsync(ModObj obj, ZipFile zFile)

istest = true;
}
catch
catch
{

}
}
}
Expand Down Expand Up @@ -695,8 +695,8 @@ private static async Task CheckJarInJarAsync(ModObj obj, ZipFile zFile)
istest = true;
}
catch
{
{

}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/ColorMC.Core/Helpers/CheckHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ public static async Task<ConcurrentBag<DownloadItemObj>> CheckGameFileAsync(this
var item = node.Value;
if (item.Path != "mods")
{
node = node.Next;
array.Remove(item);
continue;
}
Expand Down
23 changes: 21 additions & 2 deletions src/ColorMC.Core/Helpers/ModPackHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,22 @@ public static async Task<GameRes> InstallCurseForgeModPackAsync(InstallModPackZi
arg.Name = $"{info.Name}-{info.Version}";
}

var gameversion = info.Minecraft.Version;
if (VersionPath.CheckUpdateAsync(gameversion) == null)
{
await VersionPath.GetFromWebAsync();
if (VersionPath.CheckUpdateAsync(gameversion) == null)
{
return new();
}
}

//创建游戏实例
var game = new GameSettingObj()
{
GroupName = arg.Group,
Name = arg.Name,
Version = info.Minecraft.Version,
Version = gameversion,
ModPack = true,
Loader = loaders,
ModPackType = SourceType.CurseForge,
Expand Down Expand Up @@ -828,14 +837,24 @@ public static async Task<GameRes> InstallModrinthModPackAsync(InstallModPackZipA
arg.Name = $"{info.Name}-{info.VersionId}";
}

var gameversion = info.Dependencies["minecraft"];
if (VersionPath.CheckUpdateAsync(gameversion) == null)
{
await VersionPath.GetFromWebAsync();
if (VersionPath.CheckUpdateAsync(gameversion) == null)
{
return new();
}
}

//创建游戏实例
var game = await InstancesPath.CreateGame(new CreateGameArg
{
Game = new GameSettingObj()
{
GroupName = arg.Group,
Name = arg.Name,
Version = info.Dependencies["minecraft"],
Version = gameversion,
ModPack = true,
ModPackType = SourceType.Modrinth,
Loader = loaders,
Expand Down
2 changes: 1 addition & 1 deletion src/ColorMC.Core/Helpers/PathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static Task<bool> MoveToTrash(string dir)
}
catch
{

}

return false;
Expand Down
7 changes: 1 addition & 6 deletions src/ColorMC.Core/Hook/Win32.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;

namespace ColorMC.Core.Hook;

Expand Down
2 changes: 1 addition & 1 deletion src/ColorMC.Core/Net/Login/LegacyLogin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static async Task<LegacyLoginRes> AuthenticateAsync(string server, string
return new LegacyLoginRes
{
State = LoginState.Done,
Auth = new()
Auth = new()
{
UserName = obj2.SelectedProfile.Name,
UUID = obj2.SelectedProfile.Id,
Expand Down
4 changes: 4 additions & 0 deletions src/ColorMC.Gui/ColorMC.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@
<None Remove="Resource\Pic\launch.png" />
<None Remove="Resource\Pic\load.png" />
<None Remove="Resource\Pic\pic1.png" />
<None Remove="Resource\Pic\update.png" />
<None Remove="Resource\Pic\update1.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="icon.ico" />
Expand Down Expand Up @@ -304,6 +306,7 @@
<AvaloniaResource Include="Resource\Icon\Setting\svg9.svg" />
<AvaloniaResource Include="Resource\Icon\skin.svg" />
<AvaloniaResource Include="Resource\Icon\pause.svg" />
<EmbeddedResource Include="Resource\Pic\update.png" />
<EmbeddedResource Include="Resource\Pic\1.png" />
<EmbeddedResource Include="Resource\Pic\2.png" />
<EmbeddedResource Include="Resource\Pic\3.png" />
Expand All @@ -317,6 +320,7 @@
<EmbeddedResource Include="Resource\Pic\game.png" />
<EmbeddedResource Include="Resource\Pic\launch.png" />
<EmbeddedResource Include="Resource\Pic\load.png" />
<EmbeddedResource Include="Resource\Pic\update1.png" />
</ItemGroup>
<ItemGroup>
<!--This helps with theme dll-s trimming.
Expand Down
15 changes: 13 additions & 2 deletions src/ColorMC.Gui/Manager/ImageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Avalonia.Threading;
using ColorMC.Core.Helpers;
using ColorMC.Core.LaunchPath;
using ColorMC.Core.Net;
Expand All @@ -23,7 +24,7 @@ public static class ImageManager
{
public static Bitmap GameIcon { get; private set; }
public static Bitmap LoadIcon { get; private set; }
public static WindowIcon Icon { get; private set; }
public static WindowIcon WindowIcon { get; private set; }

public static Bitmap? BackBitmap { get; private set; }
public static SKBitmap? SkinBitmap { get; private set; }
Expand All @@ -46,7 +47,7 @@ public static void Init(string dir)
{
using var asset1 = AssetLoader.Open(new Uri(SystemInfo.Os == OsType.MacOS
? "resm:ColorMC.Gui.macicon.ico" : "resm:ColorMC.Gui.icon.ico"));
Icon = new(asset1!);
WindowIcon = new(asset1!);
}
{
using var asset1 = AssetLoader.Open(new Uri("resm:ColorMC.Gui.Resource.Pic.load.png"));
Expand Down Expand Up @@ -170,6 +171,16 @@ public static void RemoveSkin()
CapeBitmap = null;
}

public static Bitmap? ReloadImage(GameSettingObj obj)
{
s_gameIcon.Remove(obj.UUID, out var temp);
if (temp != null)
{
Dispatcher.UIThread.Post(temp.Dispose);
}
return GetGameIcon(obj);
}

public static Bitmap? GetGameIcon(GameSettingObj obj)
{
if (s_gameIcon.TryGetValue(obj.UUID, out var image))
Expand Down
17 changes: 16 additions & 1 deletion src/ColorMC.Gui/Manager/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using ColorMC.Gui.UI.Controls.GameLog;
using ColorMC.Gui.UI.Controls.Main;
using ColorMC.Gui.UI.Controls.NetFrp;
using ColorMC.Gui.UI.Controls.News;
using ColorMC.Gui.UI.Controls.ServerPack;
using ColorMC.Gui.UI.Controls.Setting;
using ColorMC.Gui.UI.Controls.Skin;
Expand Down Expand Up @@ -56,6 +57,7 @@ public static class WindowManager
public static AddJavaControl? AddJavaWindow { get; set; }
public static CountControl? CountWindow { get; set; }
public static NetFrpControl? NetFrpWindow { get; set; }
public static MinecraftNewsControl? NewsWindow { get; set; }

public static Dictionary<string, GameEditControl> GameEditWindows { get; } = [];
public static Dictionary<string, GameConfigEditControl> GameConfigEditWindows { get; } = [];
Expand Down Expand Up @@ -93,7 +95,7 @@ public static void Init(string path)
{
AllWindow = new();
AllWindow.Model.HeadDisplay = false;
AllWindow.Opened();
AllWindow.TopOpened();
}
else if (SystemInfo.Os == OsType.Linux ||
(SystemInfo.Os == OsType.Windows && !SystemInfo.IsWin11))
Expand Down Expand Up @@ -627,6 +629,19 @@ public static void ShowNetFrp()
}
}

public static void ShowNews()
{
if (NewsWindow != null)
{
NewsWindow.Window.TopActivate();
}
else
{
NewsWindow = new();
AWindow(NewsWindow);
}
}


public static void ShowError(string? data, Exception? e, bool close = false)
{
Expand Down
Loading

0 comments on commit 81fad54

Please sign in to comment.