diff --git a/.gitignore b/.gitignore index 338ed2d8..05ff3ef6 100644 --- a/.gitignore +++ b/.gitignore @@ -664,5 +664,6 @@ Testing/ .Publish/ Testing_honkai/ Testing_wuwa/ +Testing_ZZZ/ # End of https://www.toptal.com/developers/gitignore/api/visualstudio,csharp,rider diff --git a/src/GIMI-ModManager.Core/GamesService/FileNames.cs b/src/GIMI-ModManager.Core/GamesService/FileNames.cs index 86fe37ce..e4afe4d5 100644 --- a/src/GIMI-ModManager.Core/GamesService/FileNames.cs +++ b/src/GIMI-ModManager.Core/GamesService/FileNames.cs @@ -21,5 +21,6 @@ public enum SupportedGames { Genshin, Honkai, - WuWa + WuWa, + ZZZ } \ No newline at end of file diff --git a/src/GIMI-ModManager.Core/GamesService/GameService.cs b/src/GIMI-ModManager.Core/GamesService/GameService.cs index 51f92705..d0e28713 100644 --- a/src/GIMI-ModManager.Core/GamesService/GameService.cs +++ b/src/GIMI-ModManager.Core/GamesService/GameService.cs @@ -112,10 +112,11 @@ public async Task InitializeAsync(InitializationOptions options) Initialized?.Invoke(this, EventArgs.Empty); } - public async Task GetGameInfoAsync(SupportedGames game) + public static async Task GetGameInfoAsync(SupportedGames game) { - var gameFilePath = Path.Combine(_assetsDirectory.Parent!.FullName, game.ToString(), - FileNames.GameSettingsFileName); + var gameAssetDir = Path.Combine(AppContext.BaseDirectory, "Assets", "Games", game.ToString()); + + var gameFilePath = Path.Combine(gameAssetDir, "game.json"); if (!File.Exists(gameFilePath)) return null; @@ -126,8 +127,7 @@ public async Task InitializeAsync(InitializationOptions options) if (jsonGameInfo is null) throw new InvalidOperationException($"{gameFilePath} file is empty"); - return new GameInfo(jsonGameInfo, - new DirectoryInfo(Path.Combine(_assetsDirectory.Parent!.FullName, game.ToString()))); + return new GameInfo(jsonGameInfo, new DirectoryInfo(gameAssetDir)); } public async Task> PreInitializedReadModObjectsAsync(string assetsDirectory) diff --git a/src/GIMI-ModManager.Core/GamesService/IGameService.cs b/src/GIMI-ModManager.Core/GamesService/IGameService.cs index af394701..737eb984 100644 --- a/src/GIMI-ModManager.Core/GamesService/IGameService.cs +++ b/src/GIMI-ModManager.Core/GamesService/IGameService.cs @@ -13,8 +13,6 @@ public interface IGameService public event EventHandler? Initialized; - public Task GetGameInfoAsync(SupportedGames game); - public Task> PreInitializedReadModObjectsAsync(string assetsDirectory); public Task InitializeAsync(string assetsDirectory, string localSettingsDirectory); diff --git a/src/GIMI-ModManager.Core/GamesService/JsonModels/JsonGame.cs b/src/GIMI-ModManager.Core/GamesService/JsonModels/JsonGame.cs index 28c685ab..01e6c194 100644 --- a/src/GIMI-ModManager.Core/GamesService/JsonModels/JsonGame.cs +++ b/src/GIMI-ModManager.Core/GamesService/JsonModels/JsonGame.cs @@ -8,4 +8,9 @@ internal class JsonGame public string RarityName { get; set; } = string.Empty; public string GameBananaUrl { get; set; } = string.Empty; public string GameModelImporterUrl { get; set; } = string.Empty; + public string GameModelImporterName { get; set; } = string.Empty; + + public string GameModelImporterShortName { get; set; } = string.Empty; + + public string[] GameModelImporterExeName { get; set; } = []; } \ No newline at end of file diff --git a/src/GIMI-ModManager.Core/GamesService/Models/GameInfo.cs b/src/GIMI-ModManager.Core/GamesService/Models/GameInfo.cs index a3f62d74..6e477f9e 100644 --- a/src/GIMI-ModManager.Core/GamesService/Models/GameInfo.cs +++ b/src/GIMI-ModManager.Core/GamesService/Models/GameInfo.cs @@ -9,13 +9,17 @@ internal GameInfo(JsonGame jsonGame, DirectoryInfo assetsDirectoryInfo) GameName = jsonGame.GameName?.Trim() ?? ""; GameShortName = jsonGame.GameShortName?.Trim() ?? ""; GameIcon = Path.Combine(assetsDirectoryInfo.FullName, "Images", jsonGame.GameIcon?.Trim() ?? "Start_Game.png"); - GameBananaUrl = Uri.TryCreate(jsonGame?.GameBananaUrl, UriKind.Absolute, out var gameBananaUrl) + GameBananaUrl = Uri.TryCreate(jsonGame.GameBananaUrl, UriKind.Absolute, out var gameBananaUrl) ? gameBananaUrl : new Uri("https://gamebanana.com/"); GameModelImporterUrl = - Uri.TryCreate(jsonGame?.GameModelImporterUrl, UriKind.Absolute, out var gameModelImporterUrl) + Uri.TryCreate(jsonGame.GameModelImporterUrl, UriKind.Absolute, out var gameModelImporterUrl) ? gameModelImporterUrl : new Uri("https://github.com/SilentNightSound"); + + GameModelImporterName = jsonGame.GameModelImporterName ?? ""; + GameModelImporterShortName = jsonGame.GameModelImporterShortName ?? ""; + GameModelImporterExeNames = jsonGame.GameModelImporterExeName.ToList() ?? []; } public string GameName { get; } @@ -23,4 +27,8 @@ internal GameInfo(JsonGame jsonGame, DirectoryInfo assetsDirectoryInfo) public string GameIcon { get; } public Uri GameBananaUrl { get; } public Uri GameModelImporterUrl { get; } + public string GameModelImporterName { get; } + public string GameModelImporterShortName { get; } + + public IReadOnlyList GameModelImporterExeNames { get; } } \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/Genshin/game.json b/src/GIMI-ModManager.WinUI/Assets/Games/Genshin/game.json index f477a580..1559104a 100644 --- a/src/GIMI-ModManager.WinUI/Assets/Games/Genshin/game.json +++ b/src/GIMI-ModManager.WinUI/Assets/Games/Genshin/game.json @@ -3,5 +3,9 @@ "GameShortName": "Genshin", "RarityName": "Quality", "GameIcon": "Start_Game.png", - "GameBananaUrl": "https://gamebanana.com/games/8552" + "GameBananaUrl": "https://gamebanana.com/games/8552", + "GameModelImporterUrl": "https://github.com/SilentNightSound/GI-Model-Importer", + "GameModelImporterName": "Genshin-Impact-Model-Importer", + "GameModelImporterShortName": "GIMI", + "GameModelImporterExeName": ["3DMigoto Loader.exe"] } \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/Honkai/game.json b/src/GIMI-ModManager.WinUI/Assets/Games/Honkai/game.json index 0797a873..19267c13 100644 --- a/src/GIMI-ModManager.WinUI/Assets/Games/Honkai/game.json +++ b/src/GIMI-ModManager.WinUI/Assets/Games/Honkai/game.json @@ -3,5 +3,9 @@ "GameShortName": "Honkai", "RarityName": "Rarity", "GameIcon": "Start_Game.webp", - "GameBananaUrl": "https://gamebanana.com/games/18366" + "GameBananaUrl": "https://gamebanana.com/games/18366", + "GameModelImporterUrl": "https://github.com/SilentNightSound/SR-Model-Importer", + "GameModelImporterName": "Star-Rail-Model-Importer", + "GameModelImporterShortName": "SRMI", + "GameModelImporterExeName": [ "3DMigotoLoader.exe" ] } \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/WuWa/game.json b/src/GIMI-ModManager.WinUI/Assets/Games/WuWa/game.json index dde3f216..602652fe 100644 --- a/src/GIMI-ModManager.WinUI/Assets/Games/WuWa/game.json +++ b/src/GIMI-ModManager.WinUI/Assets/Games/WuWa/game.json @@ -3,5 +3,9 @@ "GameShortName": "WuWa", "RarityName": "Rarity", "GameIcon": "Start_Game.png", - "GameBananaUrl": "https://gamebanana.com/games/20357" + "GameBananaUrl": "https://gamebanana.com/games/20357", + "GameModelImporterUrl": "https://gamebanana.com/tools/17252", + "GameModelImporterName": "Wuthering Waves Model Importer", + "GameModelImporterShortName": "WWMI", + "GameModelImporterExeName": ["WWMI Loader.exe"] } \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Anby.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Anby.webp new file mode 100644 index 00000000..8cafebe7 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Anby.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Anton.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Anton.webp new file mode 100644 index 00000000..e83a5274 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Anton.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Belle.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Belle.webp new file mode 100644 index 00000000..90da51e7 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Belle.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Ben.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Ben.webp new file mode 100644 index 00000000..f271fb80 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Ben.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Billy.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Billy.webp new file mode 100644 index 00000000..3852a70a Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Billy.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Character_Others.png b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Character_Others.png new file mode 100644 index 00000000..1872c52d Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Character_Others.png differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Corin.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Corin.webp new file mode 100644 index 00000000..e96145ce Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Corin.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Ellen.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Ellen.webp new file mode 100644 index 00000000..4d71fb0b Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Ellen.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Grace.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Grace.webp new file mode 100644 index 00000000..162e3470 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Grace.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Koleda.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Koleda.webp new file mode 100644 index 00000000..54dbc510 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Koleda.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Lucy.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Lucy.webp new file mode 100644 index 00000000..4fd8e919 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Lucy.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Lycaon.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Lycaon.webp new file mode 100644 index 00000000..54e18995 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Lycaon.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Miyabi.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Miyabi.webp new file mode 100644 index 00000000..a6ccf40e Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Miyabi.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Nekomata.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Nekomata.webp new file mode 100644 index 00000000..fa87ff32 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Nekomata.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Nicole.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Nicole.webp new file mode 100644 index 00000000..53e3b10c Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Nicole.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Piper.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Piper.webp new file mode 100644 index 00000000..9c276b48 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Piper.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Rina.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Rina.webp new file mode 100644 index 00000000..987441ea Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Rina.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Soldier11.png b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Soldier11.png new file mode 100644 index 00000000..f934d036 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Soldier11.png differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Soukaku.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Soukaku.webp new file mode 100644 index 00000000..8e871d78 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Soukaku.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Wise.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Wise.webp new file mode 100644 index 00000000..1dfcca21 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/Wise.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/ZhuYuan.webp b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/ZhuYuan.webp new file mode 100644 index 00000000..b890cc28 Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Characters/ZhuYuan.webp differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Electric.svg b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Electric.svg new file mode 100644 index 00000000..a0394632 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Electric.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Ether.svg b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Ether.svg new file mode 100644 index 00000000..ff7c36d2 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Ether.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Fire.svg b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Fire.svg new file mode 100644 index 00000000..543c295d --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Fire.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Ice.svg b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Ice.svg new file mode 100644 index 00000000..d7bc3f46 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Ice.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Physical.svg b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Physical.svg new file mode 100644 index 00000000..d69ba421 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Elements/Physical.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Start_Game.png b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Start_Game.png new file mode 100644 index 00000000..894db55f Binary files /dev/null and b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/Images/Start_Game.png differ diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/characters.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/characters.json new file mode 100644 index 00000000..87af2647 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/characters.json @@ -0,0 +1,345 @@ +[ + { + "Keys": [ + "belle" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Belle.webp", + "Rarity": 0, + "Element": "None", + "Class": "None", + "Region": [ + "Phaethon" + ], + "ModFilesName": "belle", + "InGameSkins": [], + "InternalName": "Belle", + "DisplayName": "Belle" + }, + { + "Keys": [ + "wise" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Wise.webp", + "Rarity": 0, + "Element": "None", + "Class": "None", + "Region": [ + "Phaethon" + ], + "ModFilesName": "wise", + "InGameSkins": [], + "InternalName": "Wise", + "DisplayName": "Wise" + }, + { + "Keys": [ + "alexandrina", + "rina" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Rina.webp", + "Rarity": 5, + "Element": "Electric", + "Class": "Support", + "Region": [ + "Victoria" + ], + "ModFilesName": "Rina", + "InGameSkins": [], + "InternalName": "Rina", + "DisplayName": "Rina" + }, + { + "Keys": [ + "ellen" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Ellen.webp", + "Rarity": 5, + "Element": "Ice", + "Class": "Attack", + "Region": [ + "Victoria" + ], + "ModFilesName": "ellen", + "InGameSkins": [], + "InternalName": "Ellen", + "DisplayName": "Ellen" + }, + { + "Keys": [ + "grace" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Grace.webp", + "Rarity": 5, + "Element": "Electric", + "Class": "Anomoly", + "Region": [ + "Belobog" + ], + "ModFilesName": "grace", + "InGameSkins": [], + "InternalName": "Grace", + "DisplayName": "Grace" + }, + { + "Keys": [ + "koleda" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Koleda.webp", + "Rarity": 5, + "Element": "Fire", + "Class": "Stun", + "Region": [ + "Belobog" + ], + "ModFilesName": "koleda", + "InGameSkins": [], + "InternalName": "Koleda", + "DisplayName": "Koleda" + }, + { + "Keys": [ + "nekomiya", + "nekomata" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Nekomata.webp", + "Rarity": 5, + "Element": "Physical", + "Class": "Attack", + "Region": [ + "CHares" + ], + "ModFilesName": "nekomata", + "InGameSkins": [], + "InternalName": "Nekomata", + "DisplayName": "Nekomata" + }, + { + "Keys": [ + "soldier11" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Soldier11.png", + "Rarity": 5, + "Element": "Fire", + "Class": "Attack", + "Region": [ + "OBOL" + ], + "ModFilesName": "soldier 11", + "InGameSkins": [], + "InternalName": "Soldier11", + "DisplayName": "Soldier 11" + }, + { + "Keys": [ + "lycaon" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Lycaon.webp", + "Rarity": 5, + "Element": "Ice", + "Class": "Stun", + "Region": [ + "Victoria" + ], + "ModFilesName": "lycaon", + "InGameSkins": [], + "InternalName": "Lycaon", + "DisplayName": "Lycaon" + }, + { + "Keys": [ + "zhuyuan" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "ZhuYuan.webp", + "Rarity": 5, + "Element": "Ether", + "Class": "Attack", + "Region": [ + "ResponseTeam" + ], + "ModFilesName": "zhu yuan", + "InGameSkins": [], + "InternalName": "ZhuYuan", + "DisplayName": "Zhu Yuan" + }, + { + "Keys": [ + "anby" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Anby.webp", + "Rarity": 4, + "Element": "Electric", + "Class": "Support", + "Region": [ + "CHares" + ], + "ModFilesName": "anby", + "InGameSkins": [], + "InternalName": "Anby", + "DisplayName": "Anby" + }, + { + "Keys": [ + "anton" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Anton.webp", + "Rarity": 4, + "Element": "Electric", + "Class": "Attack", + "Region": [ + "Belobog" + ], + "ModFilesName": "anton", + "InGameSkins": [], + "InternalName": "Anton", + "DisplayName": "Anton" + }, + { + "Keys": [ + "ben" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Ben.webp", + "Rarity": 4, + "Element": "Fire", + "Class": "Defense", + "Region": [ + "Belobog" + ], + "ModFilesName": "ben", + "InGameSkins": [], + "InternalName": "Ben", + "DisplayName": "Ben" + }, + { + "Keys": [ + "billy" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Billy.webp", + "Rarity": 4, + "Element": "Physical", + "Class": "Attack", + "Region": [ + "CHares" + ], + "ModFilesName": "billy", + "InGameSkins": [], + "InternalName": "Billy", + "DisplayName": "Billy" + }, + { + "Keys": [ + "corin" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Corin.webp", + "Rarity": 4, + "Element": "Physical", + "Class": "Attack", + "Region": [ + "Victoria" + ], + "ModFilesName": "corin", + "InGameSkins": [], + "InternalName": "Corin", + "DisplayName": "Corin" + }, + { + "Keys": [ + "luciana", + "lucy" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Lucy.webp", + "Rarity": 4, + "Element": "Fire", + "Class": "Support", + "Region": [ + "Calydon" + ], + "ModFilesName": "lucy", + "InGameSkins": [], + "InternalName": "Lucy", + "DisplayName": "Lucy" + }, + { + "Keys": [ + "nicole" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Nicole.webp", + "Rarity": 4, + "Element": "Ether", + "Class": "Support", + "Region": [ + "CHares" + ], + "ModFilesName": "nicole", + "InGameSkins": [], + "InternalName": "Nicole", + "DisplayName": "Nicole" + }, + { + "Keys": [ + "piper" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Piper.webp", + "Rarity": 4, + "Element": "Physical", + "Class": "Anomoly", + "Region": [ + "Calydon" + ], + "ModFilesName": "piper", + "InGameSkins": [], + "InternalName": "Piper", + "DisplayName": "Piper" + }, + { + "Keys": [ + "soukaku" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Soukaku.webp", + "Rarity": 4, + "Element": "Ice", + "Class": "Support", + "Region": [ + "Section6" + ], + "ModFilesName": "soukaku", + "InGameSkins": [], + "InternalName": "Soukaku", + "DisplayName": "Soukaku" + }, + { + "Keys": [ + "miyabi" + ], + "ReleaseDate": "2024-07-4T00:10:00", + "Image": "Miyabi.webp", + "Rarity": 5, + "Element": "Ice", + "Class": "Attack", + "Region": [ + "Section6" + ], + "ModFilesName": "miyabi", + "InGameSkins": [], + "InternalName": "Miyabi", + "DisplayName": "Miyabi" + } +] \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/elements.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/elements.json new file mode 100644 index 00000000..c3776beb --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/elements.json @@ -0,0 +1,27 @@ +[ + { + "InternalName": "Fire", + "DisplayName": "Fire", + "Image": "Fire.svg" + }, + { + "InternalName": "Electric", + "DisplayName": "Electric", + "Image": "Electric.svg" + }, + { + "InternalName": "Ice", + "DisplayName": "Ice", + "Image": "Ice.svg" + }, + { + "InternalName": "Physical", + "DisplayName": "Physical", + "Image": "Physical.svg" + }, + { + "InternalName": "Ether", + "DisplayName": "Ether", + "Image": "Ether.svg" + } +] \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/game.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/game.json new file mode 100644 index 00000000..a69a6f79 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/game.json @@ -0,0 +1,11 @@ +{ + "GameName": "Zenless Zone Zero", + "GameShortName": "ZZZ", + "RarityName": "Rank", + "GameIcon": "Start_Game.png", + "GameBananaUrl": "https://gamebanana.com/games/19567", + "GameModelImporterUrl": "https://gamebanana.com/tools/games/19567?", + "GameModelImporterName": "ZZZ-Impact-Model-Importer", + "GameModelImporterShortName": "ZZZIMI", + "GameModelImporterExeName": [ "3DMigoto Loader.exe", "ZZZ3dmLoader.exe" ] +} \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/npcs.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/npcs.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/npcs.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/objects.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/objects.json new file mode 100644 index 00000000..579e30d5 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/objects.json @@ -0,0 +1,3 @@ +[ + +] \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/regions.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/regions.json new file mode 100644 index 00000000..fdf6a283 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/regions.json @@ -0,0 +1,34 @@ +[ + { + "InternalName": "Belogbog", + "DisplayName": "Belobog Heavy Industries" + }, + { + "InternalName": "ResponseTeam", + "DisplayName": "Criminal Investigation Special Response Team" + }, + { + "InternalName": "CHares", + "DisplayName": "Cunning Hares" + }, + { + "InternalName": "OBOLS", + "DisplayName": "OBOLS Squad" + }, + { + "InternalName": "Section6", + "DisplayName": "Section 6" + }, + { + "InternalName": "Calydon", + "DisplayName": "Sons of Calydon" + }, + { + "InternalName": "Victoria", + "DisplayName": "Victoria Housekeeping" + }, + { + "InternalName": "Phaethon", + "DisplayName": "Phaethon" + } +] \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/weaponClasses.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/weaponClasses.json new file mode 100644 index 00000000..ba66ee3d --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/weaponClasses.json @@ -0,0 +1,22 @@ +[ + { + "InternalName": "Anomaly", + "DisplayName": "Anomaly" + }, + { + "InternalName": "Attack", + "DisplayName": "Attack" + }, + { + "InternalName": "Defense", + "DisplayName": "Defense" + }, + { + "InternalName": "Stun", + "DisplayName": "Stun" + }, + { + "InternalName": "Support", + "DisplayName": "Support" + } +] diff --git a/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/weapons.json b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/weapons.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Assets/Games/ZZZ/weapons.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj b/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj index 872b4530..028e2d10 100644 --- a/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj +++ b/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj @@ -529,7 +529,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -549,6 +585,7 @@ + @@ -1070,6 +1107,9 @@ PreserveNewest + + MSBuild:Compile + MSBuild:Compile @@ -1083,4 +1123,6 @@ MSBuild:Compile + + diff --git a/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj.DotSettings b/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj.DotSettings new file mode 100644 index 00000000..bed94f27 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj.DotSettings @@ -0,0 +1,2 @@ + + UI \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/Services/AppManagement/SelectedGameService.cs b/src/GIMI-ModManager.WinUI/Services/AppManagement/SelectedGameService.cs index 1a3224c2..f51efe9f 100644 --- a/src/GIMI-ModManager.WinUI/Services/AppManagement/SelectedGameService.cs +++ b/src/GIMI-ModManager.WinUI/Services/AppManagement/SelectedGameService.cs @@ -19,9 +19,10 @@ public class SelectedGameService private const string ConfigFile = "game.json"; private readonly string _configPath; - public const string Genshin = "Genshin"; - public const string Honkai = "Honkai"; - public const string WuWa = "WuWa"; + private const string Genshin = "Genshin"; + private const string Honkai = "Honkai"; + private const string WuWa = "WuWa"; + private const string ZZZ = "ZZZ"; public SelectedGameService(ILocalSettingsService localSettingsService, ILogger logger) @@ -83,9 +84,10 @@ public async Task GetNotSelectedGameAsync() return selectedGame switch { - Genshin => [SupportedGames.Honkai, SupportedGames.WuWa], - Honkai => [SupportedGames.Genshin, SupportedGames.Honkai], - WuWa => [SupportedGames.Honkai, SupportedGames.Genshin], + Genshin => [SupportedGames.Honkai, SupportedGames.WuWa, SupportedGames.ZZZ], + Honkai => [SupportedGames.Genshin, SupportedGames.Honkai, SupportedGames.ZZZ], + WuWa => [SupportedGames.Honkai, SupportedGames.Genshin, SupportedGames.ZZZ], + ZZZ => [SupportedGames.WuWa, SupportedGames.Honkai, SupportedGames.Genshin], _ => throw new ArgumentOutOfRangeException() }; } diff --git a/src/GIMI-ModManager.WinUI/Services/ModHandling/GameBananaService.cs b/src/GIMI-ModManager.WinUI/Services/ModHandling/GameBananaService.cs index dd618ee9..95500161 100644 --- a/src/GIMI-ModManager.WinUI/Services/ModHandling/GameBananaService.cs +++ b/src/GIMI-ModManager.WinUI/Services/ModHandling/GameBananaService.cs @@ -77,7 +77,7 @@ public async Task GetAvailableModFiles(Guid modId, bool ign return new ModsRetrievedResult() { ModId = modGbId, - LastCheck = modSettings.LastChecked ?? DateTime.MinValue, + LastCheck = modSettings.LastChecked ?? modSettings.DateAdded ?? DateTime.MinValue, CheckTime = DateTime.Now, ModFiles = result, SitePageUrl = modSettings.ModUrl diff --git a/src/GIMI-ModManager.WinUI/Validators/ContainsAnyFileSystemEntryWithNames.cs b/src/GIMI-ModManager.WinUI/Validators/ContainsAnyFileSystemEntryWithNames.cs index 5276cf18..8eb0c03c 100644 --- a/src/GIMI-ModManager.WinUI/Validators/ContainsAnyFileSystemEntryWithNames.cs +++ b/src/GIMI-ModManager.WinUI/Validators/ContainsAnyFileSystemEntryWithNames.cs @@ -5,18 +5,20 @@ namespace GIMI_ModManager.WinUI.Validators; public class ContainsAnyFileSystemEntryWithNames : AbstractValidator { - public ContainsAnyFileSystemEntryWithNames(string[] filenames, string? customMessage = null, bool warning = false) + public ContainsAnyFileSystemEntryWithNames(IEnumerable filenames, string? customMessage = null, bool warning = false) { - filenames = filenames.Select(name => name.ToLower()).ToArray(); + var fileNamesArray = filenames.ToArray(); + var filenamesLowerArray = fileNamesArray.Select(name => name.ToLower()).ToArray(); + customMessage ??= - $"Folder does not contain any entry with the specified names: {string.Join(" OR ", filenames)}"; + $"Folder does not contain any entry with the specified names: {string.Join(" Or ", fileNamesArray)}"; RuleFor(x => x.Path) .Must(path => path is not null && Directory.Exists(path) && Directory.GetFileSystemEntries(path) - .Any(entry => filenames.Any(name => entry.ToLower().EndsWith(name))) + .Any(entry => filenamesLowerArray.Any(name => entry.ToLower().EndsWith(name))) ) .WithMessage(customMessage) .WithSeverity(warning ? Severity.Warning : Severity.Error); diff --git a/src/GIMI-ModManager.WinUI/Validators/PreConfigured/GimiFolderRootValidators.cs b/src/GIMI-ModManager.WinUI/Validators/PreConfigured/GimiFolderRootValidators.cs index ce40fafb..71e9ac82 100644 --- a/src/GIMI-ModManager.WinUI/Validators/PreConfigured/GimiFolderRootValidators.cs +++ b/src/GIMI-ModManager.WinUI/Validators/PreConfigured/GimiFolderRootValidators.cs @@ -5,9 +5,13 @@ namespace GIMI_ModManager.WinUI.Validators.PreConfigured; public static class GimiFolderRootValidators { - public static ICollection> Validators => new AbstractValidator[] + public static ICollection> Validators(IEnumerable validMiExeFilenames) { - new FolderExists(), - new ContainsAnyFileSystemEntryWithNames(new[] { "3DMigoto Loader.exe", "3DMigotoLoader.exe" }) - }; + return new AbstractValidator[] + { + new IsValidPathFormat(), + new FolderExists(), + new ContainsAnyFileSystemEntryWithNames(validMiExeFilenames, warning: true) + }; + } } \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/ViewModels/SettingsViewModel.cs b/src/GIMI-ModManager.WinUI/ViewModels/SettingsViewModel.cs index 6494b278..370d6448 100644 --- a/src/GIMI-ModManager.WinUI/ViewModels/SettingsViewModel.cs +++ b/src/GIMI-ModManager.WinUI/ViewModels/SettingsViewModel.cs @@ -76,7 +76,8 @@ [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(IgnoreNewVersionCommand) { SupportedGames.Genshin.ToString(), SupportedGames.Honkai.ToString(), - SupportedGames.WuWa.ToString() + SupportedGames.WuWa.ToString(), + SupportedGames.ZZZ.ToString() }; [ObservableProperty] private string _selectedGame = string.Empty; @@ -144,7 +145,7 @@ public SettingsViewModel( _modManagerOptions = localSettingsService.ReadSetting(ModManagerOptions.Section); - PathToGIMIFolderPicker = new PathPicker(GimiFolderRootValidators.Validators); + PathToGIMIFolderPicker = new PathPicker(); PathToModsFolderPicker = new PathPicker(ModsFolderValidator.Validators); CharacterAsSkinsCheckbox = _modManagerOptions?.CharacterSkinsAsCharacters ?? false; @@ -747,6 +748,14 @@ await _localSettingsService.ReadOrCreateSettingAsync(SelectedGame)); + + if (gameInfo is not null) + { + PathToGIMIFolderPicker.SetValidators(GimiFolderRootValidators.Validators(gameInfo.GameModelImporterExeNames)); + } + + } [ObservableProperty] private string _maxCacheSizeString = string.Empty; diff --git a/src/GIMI-ModManager.WinUI/ViewModels/StartupViewModel.cs b/src/GIMI-ModManager.WinUI/ViewModels/StartupViewModel.cs index eb34c8e2..83d7803c 100644 --- a/src/GIMI-ModManager.WinUI/ViewModels/StartupViewModel.cs +++ b/src/GIMI-ModManager.WinUI/ViewModels/StartupViewModel.cs @@ -1,8 +1,10 @@ using System.Collections.ObjectModel; +using ABI.Windows.ApplicationModel.Calls.Background; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using GIMI_ModManager.Core.Contracts.Services; using GIMI_ModManager.Core.GamesService; +using GIMI_ModManager.Core.GamesService.Models; using GIMI_ModManager.Core.Helpers; using GIMI_ModManager.Core.Services; using GIMI_ModManager.Core.Services.GameBanana; @@ -34,35 +36,26 @@ public partial class StartupViewModel : ObservableRecipient, INavigationAware private readonly ModArchiveRepository _modArchiveRepository; - private const string _genshinModelImporterName = "Genshin-Impact-Model-Importer"; - private const string _genshinModelImporterShortName = "GIMI"; - private readonly Uri _genshinGameBananaUrl = new("https://gamebanana.com/games/8552"); - private readonly Uri _genshinModelImporterUrl = new("https://github.com/SilentNightSound/GI-Model-Importer"); - - private const string _honkaiModelImporterName = "Star-Rail-Model-Importer"; - private const string _honkaiModelImporterShortName = "SRMI"; - private readonly Uri _honkaiGameBananaUrl = new("https://gamebanana.com/games/18366"); - private readonly Uri _honkaiModelImporterUrl = new("https://github.com/SilentNightSound/SR-Model-Importer"); - public PathPicker PathToGIMIFolderPicker { get; } + public PathPicker PathToModsFolderPicker { get; } [ObservableProperty] private bool _reorganizeModsOnStartup; [ObservableProperty] private bool _disableMods; - [ObservableProperty] private string _selectedGame = SelectedGameService.Genshin; + [ObservableProperty] private GameComboBoxEntryVM _selectedGame = new GameComboBoxEntryVM(SupportedGames.Genshin) + { + GameName = "Genshin Impact", + GameShortName = SupportedGames.Genshin.ToString(), + GameIconPath = null! + }; - [ObservableProperty] private string _modelImporterName = _genshinModelImporterName; - [ObservableProperty] private string _modelImporterShortName = _genshinModelImporterShortName; + [ObservableProperty] private string _modelImporterName = "Genshin-Impact-Model-Importer"; + [ObservableProperty] private string _modelImporterShortName = "GIMI"; [ObservableProperty] private Uri _gameBananaUrl = new("https://gamebanana.com/games/8552"); [ObservableProperty] private Uri _modelImporterUrl = new("https://github.com/SilentNightSound"); - public ObservableCollection Games { get; } = new() - { - SelectedGameService.Genshin, - SelectedGameService.Honkai, - SelectedGameService.WuWa - }; + public ObservableCollection Games { get; } = new(); public StartupViewModel(INavigationService navigationService, ILocalSettingsService localSettingsService, IWindowManagerService windowManagerService, ISkinManagerService skinManagerService, @@ -79,7 +72,7 @@ public StartupViewModel(INavigationService navigationService, ILocalSettingsServ _userPreferencesService = userPreferencesService; _modArchiveRepository = modArchiveRepository; - PathToGIMIFolderPicker = new PathPicker(GimiFolderRootValidators.Validators); + PathToGIMIFolderPicker = new PathPicker([]); PathToModsFolderPicker = new PathPicker(ModsFolderValidator.Validators); @@ -104,7 +97,7 @@ private async Task SaveStartupSettings() UnloadedModsFolderPath = null }; - await _selectedGameService.SetSelectedGame(SelectedGame); + await _selectedGameService.SetSelectedGame(SelectedGame.Value.ToString()); await _gameService.InitializeAsync( Path.Combine(App.ASSET_DIR, "Games", await _selectedGameService.GetSelectedGameAsync()), @@ -144,7 +137,9 @@ await _skinManagerService.InitializeAsync(modManagerOptions.ModsFolderPath!, nul App.GetService().ShowNotification("Startup settings saved", $"Startup settings saved successfully to '{_localSettingsService.SettingsLocation}'", TimeSpan.FromSeconds(7)); +#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async () => +#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed { await Task.Delay(TimeSpan.FromSeconds(7)); App.GetService().ShowNotification("JASM is still in alpha", @@ -176,10 +171,11 @@ public async void OnNavigatedTo(object parameter) var settings = await _localSettingsService.ReadOrCreateSettingAsync(ModManagerOptions.Section); - SetPaths(settings); + await SetGameComboBoxValues(); - SelectedGame = await _selectedGameService.GetSelectedGameAsync(); - SetGameInfo(SelectedGame); + SetSelectedGame(await _selectedGameService.GetSelectedGameAsync()); + await SetGameInfo(SelectedGame.Value.ToString()); + SetPaths(settings); ReorganizeModsOnStartup = true; } @@ -190,41 +186,57 @@ private async Task SetGameAsync(string game) return; await _selectedGameService.SetSelectedGame(game); - SelectedGame = game; + SetSelectedGame(game); var settings = await _localSettingsService.ReadOrCreateSettingAsync(ModManagerOptions.Section); + await SetGameInfo(game); SetPaths(settings); - SetGameInfo(game); } - private void SetGameInfo(string game) + private async Task SetGameInfo(string game) + { + var gameInfo = await GameService.GetGameInfoAsync(Enum.Parse(game)); + + if (gameInfo is null) + { + _logger.Error("Game info for {Game} is null", game); + return; + } + + ModelImporterName = gameInfo.GameModelImporterName; + ModelImporterShortName = gameInfo.GameModelImporterShortName; + GameBananaUrl = gameInfo.GameBananaUrl; + ModelImporterUrl = gameInfo.GameModelImporterUrl; + PathToGIMIFolderPicker.SetValidators(GimiFolderRootValidators.Validators(gameInfo.GameModelImporterExeNames)); + } + + private async Task SetGameComboBoxValues() { - switch (game) + foreach (var supportedGame in Enum.GetValues()) { - case SelectedGameService.Genshin: - ModelImporterName = _genshinModelImporterName; - ModelImporterShortName = _genshinModelImporterShortName; - GameBananaUrl = _genshinGameBananaUrl; - ModelImporterUrl = _genshinModelImporterUrl; - break; - case SelectedGameService.Honkai: - ModelImporterName = _honkaiModelImporterName; - ModelImporterShortName = _honkaiModelImporterShortName; - GameBananaUrl = _honkaiGameBananaUrl; - ModelImporterUrl = _honkaiModelImporterUrl; - break; - case SelectedGameService.WuWa: - ModelImporterName = _genshinModelImporterName; - ModelImporterShortName = _genshinModelImporterShortName; - GameBananaUrl = new Uri("https://gamebanana.com/games/20357"); - ModelImporterUrl = _genshinModelImporterUrl; - break; + var gameInfo = await GameService.GetGameInfoAsync(supportedGame); + if (gameInfo is null) + continue; + + Games.Add(new GameComboBoxEntryVM(supportedGame) + { + GameIconPath = new Uri(gameInfo.GameIcon), + GameName = gameInfo.GameName, + GameShortName = gameInfo.GameShortName + }); } } + private void SetSelectedGame(string game) + { + var selectedGame = Games.FirstOrDefault(g => g.Value.ToString() == game); + if (selectedGame is not null) + SelectedGame = selectedGame; + } + private void SetPaths(ModManagerOptions settings) { diff --git a/src/GIMI-ModManager.WinUI/ViewModels/SubVms/GameComboBoxEntryVM.cs b/src/GIMI-ModManager.WinUI/ViewModels/SubVms/GameComboBoxEntryVM.cs new file mode 100644 index 00000000..340518a5 --- /dev/null +++ b/src/GIMI-ModManager.WinUI/ViewModels/SubVms/GameComboBoxEntryVM.cs @@ -0,0 +1,12 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using GIMI_ModManager.Core.GamesService; + +namespace GIMI_ModManager.WinUI.ViewModels.SubVms; + +public class GameComboBoxEntryVM(SupportedGames value) +{ + public SupportedGames Value { get; } = value; + public required string GameName { get; init; } + public required string GameShortName { get; init; } + public required Uri GameIconPath { get; init; } +} \ No newline at end of file diff --git a/src/GIMI-ModManager.WinUI/ViewModels/SubVms/PathPicker.cs b/src/GIMI-ModManager.WinUI/ViewModels/SubVms/PathPicker.cs index 460b0132..9ddd89b3 100644 --- a/src/GIMI-ModManager.WinUI/ViewModels/SubVms/PathPicker.cs +++ b/src/GIMI-ModManager.WinUI/ViewModels/SubVms/PathPicker.cs @@ -37,6 +37,13 @@ public PathPicker(IEnumerable> validators) _validators.AddRange(validators); } + public void SetValidators(IEnumerable> validators) + { + _validators.Clear(); + _validators.AddRange(validators); + Validate(); + } + public void Validate(string? pathToSett = null) { diff --git a/src/GIMI-ModManager.WinUI/Views/Controls/DataTemplates.xaml b/src/GIMI-ModManager.WinUI/Views/Controls/DataTemplates.xaml new file mode 100644 index 00000000..a97f033e --- /dev/null +++ b/src/GIMI-ModManager.WinUI/Views/Controls/DataTemplates.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GIMI-ModManager.WinUI/Views/ShellPage.xaml.cs b/src/GIMI-ModManager.WinUI/Views/ShellPage.xaml.cs index 9687f13b..3964f2f8 100644 --- a/src/GIMI-ModManager.WinUI/Views/ShellPage.xaml.cs +++ b/src/GIMI-ModManager.WinUI/Views/ShellPage.xaml.cs @@ -159,13 +159,14 @@ private void GameServiceOnInitialized(object? sender, EventArgs e) App.MainWindow.DispatcherQueue.EnqueueAsync(async () => { - if (await ViewModel.SelectedGameService.GetSelectedGameAsync() == SelectedGameService.WuWa) + var selectedGame = await ViewModel.SelectedGameService.GetSelectedGameAsync(); + if (selectedGame == SupportedGames.WuWa.ToString() || selectedGame == SupportedGames.ZZZ.ToString()) return; var notSelectedGame = await ViewModel.SelectedGameService.GetNotSelectedGameAsync(); - var gameInfo = await ViewModel.GameService.GetGameInfoAsync(notSelectedGame.First()); + var gameInfo = await GameService.GetGameInfoAsync(notSelectedGame.First()); if (gameInfo is null) return; diff --git a/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml b/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml index d56b6862..e99b5240 100644 --- a/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml +++ b/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml @@ -9,6 +9,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> + + + + + + + + @@ -31,8 +39,10 @@ - - + diff --git a/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml.cs b/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml.cs index 32c31494..f61d3a6c 100644 --- a/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml.cs +++ b/src/GIMI-ModManager.WinUI/Views/StartupPage.xaml.cs @@ -1,4 +1,5 @@ using GIMI_ModManager.WinUI.ViewModels; +using GIMI_ModManager.WinUI.ViewModels.SubVms; using GIMI_ModManager.WinUI.Views.Controls; using Microsoft.UI.Xaml.Controls; @@ -24,6 +25,6 @@ private void ModsFolder_OnPathChangedEvent(object? sender, FolderSelector.String private async void GameSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0) return; - await ViewModel.SetGameCommand.ExecuteAsync((string)e.AddedItems[0]!).ConfigureAwait(false); + await ViewModel.SetGameCommand.ExecuteAsync(((GameComboBoxEntryVM)e.AddedItems[0]!).Value.ToString()).ConfigureAwait(false); } } \ No newline at end of file diff --git a/src/GIMI-ModManager.sln.DotSettings b/src/GIMI-ModManager.sln.DotSettings new file mode 100644 index 00000000..a4a8baab --- /dev/null +++ b/src/GIMI-ModManager.sln.DotSettings @@ -0,0 +1,3 @@ + + GIMI + ZZZ \ No newline at end of file