diff --git a/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs b/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs index 130f3a2..f0aab24 100644 --- a/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs +++ b/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs @@ -7,54 +7,11 @@ [Tool] public partial class ActivityMark : Node2D { - public enum MarkActivityType - { - /// - /// 没有前缀 - /// - NonePrefix, - - /// - /// 测试单位 - /// - Test, - - /// - /// 角色 - /// - Role, - - /// - /// 敌人 - /// - Enemy, - - /// - /// 武器 - /// - Weapon, - - /// - /// 子弹 - /// - Bullet, - - /// - /// 弹壳 - /// - Shell, - - /// - /// 其他类型 - /// - Other, - } - /// /// 物体类型 /// [Export] - public MarkActivityType Type = MarkActivityType.NonePrefix; + public ActivityIdPrefix.ActivityPrefixType Type = ActivityIdPrefix.ActivityPrefixType.NonePrefix; /// /// 物体id @@ -74,27 +31,7 @@ /// public string GetItemId() { - switch (Type) - { - case MarkActivityType.NonePrefix: - return ItemId; - case MarkActivityType.Test: - return ActivityIdPrefix.Test + ItemId; - case MarkActivityType.Role: - return ActivityIdPrefix.Role + ItemId; - case MarkActivityType.Enemy: - return ActivityIdPrefix.Enemy + ItemId; - case MarkActivityType.Weapon: - return ActivityIdPrefix.Weapon + ItemId; - case MarkActivityType.Bullet: - return ActivityIdPrefix.Bullet + ItemId; - case MarkActivityType.Shell: - return ActivityIdPrefix.Shell + ItemId; - case MarkActivityType.Other: - return ActivityIdPrefix.Other + ItemId; - } - - return ItemId; + return ActivityIdPrefix.GetNameByPrefixType(Type) + ItemId; } /// diff --git a/DungeonShooting_Godot/src/game/manager/ActivityIdPrefix.cs b/DungeonShooting_Godot/src/game/manager/ActivityIdPrefix.cs index 762856c..e62bbd1 100644 --- a/DungeonShooting_Godot/src/game/manager/ActivityIdPrefix.cs +++ b/DungeonShooting_Godot/src/game/manager/ActivityIdPrefix.cs @@ -2,6 +2,18 @@ //Activity注册类id前缀 public static class ActivityIdPrefix { + public enum ActivityPrefixType + { + NonePrefix, + Test, + Role, + Enemy, + Weapon, + Bullet, + Shell, + Other, + } + /// /// 测试单位 /// @@ -31,4 +43,32 @@ /// 其他类型 /// public const string Other = "other"; + + /// + /// 根据 ActivityPrefixType 中的枚举类型获取类型名称的字符串 + /// + public static string GetNameByPrefixType(ActivityPrefixType prefixType) + { + switch (prefixType) + { + case ActivityPrefixType.NonePrefix: + return ""; + case ActivityPrefixType.Test: + return Test; + case ActivityPrefixType.Role: + return Role; + case ActivityPrefixType.Enemy: + return Enemy; + case ActivityPrefixType.Weapon: + return Weapon; + case ActivityPrefixType.Bullet: + return Bullet; + case ActivityPrefixType.Shell: + return Shell; + case ActivityPrefixType.Other: + return Other; + } + + return ""; + } } \ No newline at end of file