From 8db6c3c67975688df620520187dd2dcd04e9df96 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 7 Aug 2025 19:39:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20wpf=E6=8B=86=E5=88=86Enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Single/MaaTask/RoguelikeTask.cs | 51 +------- src/MaaWpfGui/Constants/Enums.cs | 119 ------------------ .../Constants/Enums/AchievementCategory.cs | 57 +++++++++ .../Constants/Enums/MirrorChyanErrorCode.cs | 72 +++++++++++ .../Enums/RoguelikeCollectibleAward.cs | 65 ++++++++++ src/MaaWpfGui/Models/Achievement.cs | 2 +- 6 files changed, 196 insertions(+), 170 deletions(-) delete mode 100644 src/MaaWpfGui/Constants/Enums.cs create mode 100644 src/MaaWpfGui/Constants/Enums/AchievementCategory.cs create mode 100644 src/MaaWpfGui/Constants/Enums/MirrorChyanErrorCode.cs create mode 100644 src/MaaWpfGui/Constants/Enums/RoguelikeCollectibleAward.cs diff --git a/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs b/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs index 611903ddbe..8a9718b1c9 100644 --- a/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs +++ b/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs @@ -12,7 +12,7 @@ // #nullable enable -using System; +using MaaWpfGui.Constants.Enums; using static MaaWpfGui.Main.AsstProxy; namespace MaaWpfGui.Configuration.Single.MaaTask; @@ -225,52 +225,3 @@ public enum RoguelikeMode /// Exploration = 7, } - -[Flags] -public enum RoguelikeCollectibleAward -{ - /// - /// 热水壶, Roguelike@LastReward - /// - HotWater = 1 << 0, - - /// - /// 护盾, Roguelike@LastReward2 - /// - Shield = 1 << 1, - - /// - /// 源石锭, Roguelike@LastReward3 - /// - Ingot = 1 << 2, - - /// - /// 2希望, Roguelike@LastReward4 - /// - Hope = 1 << 3, - - /// - /// 随机, Roguelike@LastRewardRand - /// - Random = 1 << 4, - - /// - /// 钥匙, Mizuki@Roguelike@LastReward5 - /// - Key = 1 << 5, - - /// - /// 骰子, Mizuki@Roguelike@LastReward6 - /// - Dice = 1 << 6, - - /// - /// 构想, Sarkaz@Roguelike@LastReward5 - /// - Idea = 1 << 7, - - /// - /// 票券, JieGarden@Roguelike@LastReward5 - /// - Ticket = 1 << 8, -} diff --git a/src/MaaWpfGui/Constants/Enums.cs b/src/MaaWpfGui/Constants/Enums.cs deleted file mode 100644 index d1910090cc..0000000000 --- a/src/MaaWpfGui/Constants/Enums.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// Part of the MaaWpfGui project, maintained by the MaaAssistantArknights team (Maa Team) -// Copyright (C) 2021-2025 MaaAssistantArknights Contributors -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License v3.0 only as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY -// - -namespace MaaWpfGui.Constants -{ - public static class Enums - { - public enum MirrorChyanErrorCode - { - /// - /// 请求成功 - /// - Success = 0, - - /// - /// 参数不正确,请参考集成文档 - /// - InvalidParams = 1001, - - /// - /// CDK 已过期 - /// - KeyExpired = 7001, - - /// - /// CDK 错误 - /// - KeyInvalid = 7002, - - /// - /// CDK 今日下载次数已达上限 - /// - ResourceQuotaExhausted = 7003, - - /// - /// CDK 类型和待下载的资源不匹配 - /// - KeyMismatched = 7004, - - /// - /// 对应架构和系统下的资源不存在 - /// - ResourceNotFound = 8001, - - /// - /// 错误的系统参数 - /// - InvalidOs = 8002, - - /// - /// 错误的架构参数 - /// - InvalidArch = 8003, - - /// - /// 错误的更新通道参数 - /// - InvalidChannel = 8004, - - /// - /// 未区分的业务错误,以响应体 JSON 的 msg 为准 - /// - Undivided = 1, - } - - public enum AchievementCategory - { - /// - /// 基础使用类 - /// - BasicUsage, - - /// - /// 功能探索类 - /// - FeatureExploration, - - /// - /// 自动战斗 - /// - AutoBattle, - - /// - /// 搞笑/梗类成就 - /// - Humor, - - /// - /// BUG 相关 - /// - BugRelated, - - /// - /// 用户行为 习惯 时长类 - /// - Behavior, - - /// - /// 彩蛋类 - /// - EasterEgg, - - /// - /// 超级稀有! - /// - Rare, - } - } -} diff --git a/src/MaaWpfGui/Constants/Enums/AchievementCategory.cs b/src/MaaWpfGui/Constants/Enums/AchievementCategory.cs new file mode 100644 index 0000000000..e78e78a522 --- /dev/null +++ b/src/MaaWpfGui/Constants/Enums/AchievementCategory.cs @@ -0,0 +1,57 @@ +// +// Part of the MaaWpfGui project, maintained by the MaaAssistantArknights team (Maa Team) +// Copyright (C) 2021-2025 MaaAssistantArknights Contributors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License v3.0 only as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY +// + +namespace MaaWpfGui.Constants.Enums; + +public enum AchievementCategory +{ + /// + /// 基础使用类 + /// + BasicUsage, + + /// + /// 功能探索类 + /// + FeatureExploration, + + /// + /// 自动战斗 + /// + AutoBattle, + + /// + /// 搞笑/梗类成就 + /// + Humor, + + /// + /// BUG 相关 + /// + BugRelated, + + /// + /// 用户行为 习惯 时长类 + /// + Behavior, + + /// + /// 彩蛋类 + /// + EasterEgg, + + /// + /// 超级稀有! + /// + Rare, +} diff --git a/src/MaaWpfGui/Constants/Enums/MirrorChyanErrorCode.cs b/src/MaaWpfGui/Constants/Enums/MirrorChyanErrorCode.cs new file mode 100644 index 0000000000..c6b9af616f --- /dev/null +++ b/src/MaaWpfGui/Constants/Enums/MirrorChyanErrorCode.cs @@ -0,0 +1,72 @@ +// +// Part of the MaaWpfGui project, maintained by the MaaAssistantArknights team (Maa Team) +// Copyright (C) 2021-2025 MaaAssistantArknights Contributors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License v3.0 only as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY +// + +namespace MaaWpfGui.Constants.Enums; + +public enum MirrorChyanErrorCode +{ + /// + /// 请求成功 + /// + Success = 0, + + /// + /// 参数不正确,请参考集成文档 + /// + InvalidParams = 1001, + + /// + /// CDK 已过期 + /// + KeyExpired = 7001, + + /// + /// CDK 错误 + /// + KeyInvalid = 7002, + + /// + /// CDK 今日下载次数已达上限 + /// + ResourceQuotaExhausted = 7003, + + /// + /// CDK 类型和待下载的资源不匹配 + /// + KeyMismatched = 7004, + + /// + /// 对应架构和系统下的资源不存在 + /// + ResourceNotFound = 8001, + + /// + /// 错误的系统参数 + /// + InvalidOs = 8002, + + /// + /// 错误的架构参数 + /// + InvalidArch = 8003, + + /// + /// 错误的更新通道参数 + /// + InvalidChannel = 8004, + + /// + /// 未区分的业务错误,以响应体 JSON 的 msg 为准 + /// + Undivided = 1, +} diff --git a/src/MaaWpfGui/Constants/Enums/RoguelikeCollectibleAward.cs b/src/MaaWpfGui/Constants/Enums/RoguelikeCollectibleAward.cs new file mode 100644 index 0000000000..3955626acb --- /dev/null +++ b/src/MaaWpfGui/Constants/Enums/RoguelikeCollectibleAward.cs @@ -0,0 +1,65 @@ +// +// Part of the MaaWpfGui project, maintained by the MaaAssistantArknights team (Maa Team) +// Copyright (C) 2021-2025 MaaAssistantArknights Contributors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License v3.0 only as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY +// + +using System; + +namespace MaaWpfGui.Constants.Enums; + +[Flags] +public enum RoguelikeCollectibleAward +{ + /// + /// 热水壶, Roguelike@LastReward + /// + HotWater = 1 << 0, + + /// + /// 护盾, Roguelike@LastReward2 + /// + Shield = 1 << 1, + + /// + /// 源石锭, Roguelike@LastReward3 + /// + Ingot = 1 << 2, + + /// + /// 2希望, Roguelike@LastReward4 + /// + Hope = 1 << 3, + + /// + /// 随机, Roguelike@LastRewardRand + /// + Random = 1 << 4, + + /// + /// 钥匙, Mizuki@Roguelike@LastReward5 + /// + Key = 1 << 5, + + /// + /// 骰子, Mizuki@Roguelike@LastReward6 + /// + Dice = 1 << 6, + + /// + /// 构想, Sarkaz@Roguelike@LastReward5 + /// + Idea = 1 << 7, + + /// + /// 票券, JieGarden@Roguelike@LastReward5 + /// + Ticket = 1 << 8, +} diff --git a/src/MaaWpfGui/Models/Achievement.cs b/src/MaaWpfGui/Models/Achievement.cs index 28cee2ad11..8eee31d526 100644 --- a/src/MaaWpfGui/Models/Achievement.cs +++ b/src/MaaWpfGui/Models/Achievement.cs @@ -17,10 +17,10 @@ using System; using System.Collections.Generic; using System.Windows; using System.Windows.Media; +using MaaWpfGui.Constants.Enums; using MaaWpfGui.Helper; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using static MaaWpfGui.Constants.Enums; namespace MaaWpfGui.Models {