From 480cdb04f64e3b8166a31b03752b951018be056a Mon Sep 17 00:00:00 2001 From: MC_huier_lgsn <107238739+MC-AS-Huier@users.noreply.github.com> Date: Thu, 3 Aug 2023 10:01:46 +0800 Subject: [PATCH] e --- .../Options/OptionBases/FloatOptionBase.cs | 1 + NextShip/Options/OptionManager.cs | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/NextShip/Options/OptionBases/FloatOptionBase.cs b/NextShip/Options/OptionBases/FloatOptionBase.cs index 9259285..b7b2966 100644 --- a/NextShip/Options/OptionBases/FloatOptionBase.cs +++ b/NextShip/Options/OptionBases/FloatOptionBase.cs @@ -8,6 +8,7 @@ public class FloatOptionBase : OptionBase public FloatOptionBase(string Title, int id, optionTab tab, FloatOptionValue floatOptionValue, bool Translation = true) : base(Title, id, tab, optionType.Float, Translation) { _floatOptionValue = floatOptionValue; + OptionManager.AllFloatOption.Add(this); } diff --git a/NextShip/Options/OptionManager.cs b/NextShip/Options/OptionManager.cs index 8aa46bd..c75075a 100644 --- a/NextShip/Options/OptionManager.cs +++ b/NextShip/Options/OptionManager.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using HarmonyLib; using NextShip.Utilities.Attributes; namespace NextShip.Options; @@ -16,7 +17,24 @@ public static class OptionManager public static void Load() { OptionLoad.StartOptionLoad(); + Check(); + } + + public static void Check() + { + var e = new List(); + AllOption.Do(check); + + void check(OptionBase @base) + { + if (e.Contains(@base.id)) + { + Warn($"选项id冲突 id: {@base.id} name: {@base.Title}"); + } + else + { + e.Add(@base.id); + } + } } - - } \ No newline at end of file