From 18d9ccb8ab55611d20d63d297c60812054e6ce15 Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Sat, 22 Jun 2024 19:21:06 +0800 Subject: [PATCH] =?UTF-8?q?Adjust=20the=20namespace.=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prefab/packsacks/packsack.tscn | 2 +- prefab/weapons/staffOfTheUndead.tscn | 2 +- scripts/GameSceneNodeHolder.cs | 1 - scripts/behaviorTree/ai/AiPickNode.cs | 2 +- .../behavior/PatrolBehaviorTree.cs | 36 ------------------- scripts/character/CharacterTemplate.cs | 3 +- scripts/character/Player.cs | 1 - scripts/{item => inventory}/IItem.cs | 2 +- scripts/inventory/IItemContainer.cs | 1 - scripts/inventory/ItemSlotNode.cs | 2 -- scripts/{item => inventory}/ItemType.cs | 3 +- .../{item => inventory}/ItemTypeManager.cs | 4 +-- .../{item => inventory}/ItemTypeRegister.cs | 3 +- scripts/{item => inventory}/Packsack.cs | 6 ++-- scripts/inventory/UniversalItemContainer.cs | 1 - scripts/loader/uiLoader/MainMenuLoader.cs | 2 +- scripts/pickable/PickAbleTemplate.cs | 2 +- scripts/projectile/ProjectileTemplate.cs | 3 +- scripts/utils/NodeUtils.cs | 4 +-- scripts/{item => }/weapon/ProjectileWeapon.cs | 3 +- scripts/{item => }/weapon/WeaponTemplate.cs | 3 +- 21 files changed, 18 insertions(+), 68 deletions(-) delete mode 100644 scripts/behaviorTree/behavior/PatrolBehaviorTree.cs rename scripts/{item => inventory}/IItem.cs (97%) rename scripts/{item => inventory}/ItemType.cs (96%) rename scripts/{item => inventory}/ItemTypeManager.cs (99%) rename scripts/{item => inventory}/ItemTypeRegister.cs (98%) rename scripts/{item => inventory}/Packsack.cs (93%) rename scripts/{item => }/weapon/ProjectileWeapon.cs (97%) rename scripts/{item => }/weapon/WeaponTemplate.cs (98%) diff --git a/prefab/packsacks/packsack.tscn b/prefab/packsacks/packsack.tscn index f588a82..cac9ee7 100644 --- a/prefab/packsacks/packsack.tscn +++ b/prefab/packsacks/packsack.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=3 uid="uid://cn10fimoem04m"] -[ext_resource type="Script" path="res://scripts/item/Packsack.cs" id="1_slakl"] +[ext_resource type="Script" path="res://scripts/inventory/Packsack.cs" id="1_slakl"] [ext_resource type="Texture2D" uid="uid://dvx10dfjctn7t" path="res://sprites/packsack.png" id="2_40jca"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_brthl"] diff --git a/prefab/weapons/staffOfTheUndead.tscn b/prefab/weapons/staffOfTheUndead.tscn index 01d4dc3..c666b57 100644 --- a/prefab/weapons/staffOfTheUndead.tscn +++ b/prefab/weapons/staffOfTheUndead.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=6 format=3 uid="uid://dnnn2xyayiehk"] [ext_resource type="Texture2D" uid="uid://e6670ykyq145" path="res://sprites/weapon/staffOfTheUndead.png" id="1_ms3us"] -[ext_resource type="Script" path="res://scripts/item/weapon/ProjectileWeapon.cs" id="1_w8hhv"] +[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w8hhv"] [ext_resource type="PackedScene" uid="uid://c01av43yk1q71" path="res://prefab/projectile/curseOfTheUndead.tscn" id="2_34250"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"] diff --git a/scripts/GameSceneNodeHolder.cs b/scripts/GameSceneNodeHolder.cs index e97cd51..6dc2f79 100644 --- a/scripts/GameSceneNodeHolder.cs +++ b/scripts/GameSceneNodeHolder.cs @@ -1,6 +1,5 @@ using ColdMint.scripts.character; using ColdMint.scripts.inventory; -using ColdMint.scripts.item; using ColdMint.scripts.loader.uiLoader; using ColdMint.scripts.map.events; using ColdMint.scripts.utils; diff --git a/scripts/behaviorTree/ai/AiPickNode.cs b/scripts/behaviorTree/ai/AiPickNode.cs index 727fbdd..9f98d0e 100644 --- a/scripts/behaviorTree/ai/AiPickNode.cs +++ b/scripts/behaviorTree/ai/AiPickNode.cs @@ -1,6 +1,6 @@ using ColdMint.scripts.character; -using ColdMint.scripts.item.weapon; +using WeaponTemplate = ColdMint.scripts.weapon.WeaponTemplate; namespace ColdMint.scripts.behaviorTree.ai; diff --git a/scripts/behaviorTree/behavior/PatrolBehaviorTree.cs b/scripts/behaviorTree/behavior/PatrolBehaviorTree.cs deleted file mode 100644 index ce64f85..0000000 --- a/scripts/behaviorTree/behavior/PatrolBehaviorTree.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ColdMint.scripts.behaviorTree.ai; -using ColdMint.scripts.character; - -namespace ColdMint.scripts.behaviorTree.behavior; - -/// -/// Represents a behavior tree for patrol -/// 表示巡逻的行为树 -/// -public class PatrolBehaviorTree : BehaviorTreeTemplate -{ - public AiCharacter? Character { get; set; } - protected override IBehaviorTreeNode CreateRoot() - { - var patrolNode = new AiPatrolNode(); - var aiWalkNode = new AiWalkNode(); - var aiRotorNode = new AiRotorNode(); - var aIPickNode = new AiPickNode(); - var aiAttackNode = new AiAttackNode(); - aiWalkNode.Character = Character; - patrolNode.Character = Character; - aiRotorNode.Character = Character; - aIPickNode.Character = Character; - aiAttackNode.Character = Character; - patrolNode.AddChild(aiWalkNode); - patrolNode.AddChild(aiRotorNode); - patrolNode.AddChild(aIPickNode); - patrolNode.AddChild(aiAttackNode); - return patrolNode; - } - - protected override string CreateId() - { - return Config.BehaviorTreeId.Patrol; - } -} \ No newline at end of file diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index b74d21f..42d4e35 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -6,12 +6,11 @@ using ColdMint.scripts.damage; using ColdMint.scripts.debug; using ColdMint.scripts.health; using ColdMint.scripts.inventory; -using ColdMint.scripts.item; using ColdMint.scripts.utils; -using ColdMint.scripts.item.weapon; using ColdMint.scripts.loot; using ColdMint.scripts.pickable; using Godot; +using WeaponTemplate = ColdMint.scripts.weapon.WeaponTemplate; namespace ColdMint.scripts.character; diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index ecb6d72..66a0eb2 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using ColdMint.scripts.damage; using ColdMint.scripts.deathInfo; using ColdMint.scripts.inventory; -using ColdMint.scripts.item; using ColdMint.scripts.map.events; using ColdMint.scripts.utils; using ColdMint.scripts.pickable; diff --git a/scripts/item/IItem.cs b/scripts/inventory/IItem.cs similarity index 97% rename from scripts/item/IItem.cs rename to scripts/inventory/IItem.cs index 2b40859..65ece50 100644 --- a/scripts/item/IItem.cs +++ b/scripts/inventory/IItem.cs @@ -1,6 +1,6 @@ using Godot; -namespace ColdMint.scripts.item; +namespace ColdMint.scripts.inventory; public interface IItem { diff --git a/scripts/inventory/IItemContainer.cs b/scripts/inventory/IItemContainer.cs index 48a0302..052b2d1 100644 --- a/scripts/inventory/IItemContainer.cs +++ b/scripts/inventory/IItemContainer.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using ColdMint.scripts.item; using ColdMint.scripts.map.events; using Godot; diff --git a/scripts/inventory/ItemSlotNode.cs b/scripts/inventory/ItemSlotNode.cs index ce083aa..a422073 100644 --- a/scripts/inventory/ItemSlotNode.cs +++ b/scripts/inventory/ItemSlotNode.cs @@ -1,6 +1,4 @@ using System; -using System.Text.RegularExpressions; -using ColdMint.scripts.item; using ColdMint.scripts.utils; using Godot; diff --git a/scripts/item/ItemType.cs b/scripts/inventory/ItemType.cs similarity index 96% rename from scripts/item/ItemType.cs rename to scripts/inventory/ItemType.cs index 3c33da2..c1581a8 100644 --- a/scripts/item/ItemType.cs +++ b/scripts/inventory/ItemType.cs @@ -1,8 +1,7 @@ using System; - using Godot; -namespace ColdMint.scripts.item; +namespace ColdMint.scripts.inventory; public readonly struct ItemType(string id, Func newItemFunc, Texture2D? icon, int maxStackQuantity) { diff --git a/scripts/item/ItemTypeManager.cs b/scripts/inventory/ItemTypeManager.cs similarity index 99% rename from scripts/item/ItemTypeManager.cs rename to scripts/inventory/ItemTypeManager.cs index 1e29cca..9da7404 100644 --- a/scripts/item/ItemTypeManager.cs +++ b/scripts/inventory/ItemTypeManager.cs @@ -1,10 +1,8 @@ using System.Collections.Generic; - using ColdMint.scripts.utils; - using Godot; -namespace ColdMint.scripts.item; +namespace ColdMint.scripts.inventory; /// /// Item manager diff --git a/scripts/item/ItemTypeRegister.cs b/scripts/inventory/ItemTypeRegister.cs similarity index 98% rename from scripts/item/ItemTypeRegister.cs rename to scripts/inventory/ItemTypeRegister.cs index 65ff272..c0fb919 100644 --- a/scripts/item/ItemTypeRegister.cs +++ b/scripts/inventory/ItemTypeRegister.cs @@ -6,9 +6,10 @@ using ColdMint.scripts.serialization; using ColdMint.scripts.utils; using Godot; -namespace ColdMint.scripts.item; +namespace ColdMint.scripts.inventory; /// +/// Responsible for registering items from documents /// 负责从文件注册物品 /// public static class ItemTypeRegister diff --git a/scripts/item/Packsack.cs b/scripts/inventory/Packsack.cs similarity index 93% rename from scripts/item/Packsack.cs rename to scripts/inventory/Packsack.cs index 54477ef..8d91306 100644 --- a/scripts/item/Packsack.cs +++ b/scripts/inventory/Packsack.cs @@ -1,11 +1,9 @@ -using ColdMint.scripts.inventory; -using ColdMint.scripts.pickable; +using ColdMint.scripts.pickable; using ColdMint.scripts.utils; - using Godot; using PacksackUi = ColdMint.scripts.loader.uiLoader.PacksackUi; -namespace ColdMint.scripts.item; +namespace ColdMint.scripts.inventory; /// /// packsack diff --git a/scripts/inventory/UniversalItemContainer.cs b/scripts/inventory/UniversalItemContainer.cs index 2e5f853..e5fcc68 100644 --- a/scripts/inventory/UniversalItemContainer.cs +++ b/scripts/inventory/UniversalItemContainer.cs @@ -2,7 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using ColdMint.scripts.item; using ColdMint.scripts.map.events; using ColdMint.scripts.utils; using Godot; diff --git a/scripts/loader/uiLoader/MainMenuLoader.cs b/scripts/loader/uiLoader/MainMenuLoader.cs index 7360ae9..2283d67 100644 --- a/scripts/loader/uiLoader/MainMenuLoader.cs +++ b/scripts/loader/uiLoader/MainMenuLoader.cs @@ -6,7 +6,7 @@ using ColdMint.scripts.camp; using ColdMint.scripts.contribute; using ColdMint.scripts.deathInfo; using ColdMint.scripts.debug; -using ColdMint.scripts.item; +using ColdMint.scripts.inventory; using ColdMint.scripts.loot; using ColdMint.scripts.map; using ColdMint.scripts.map.roomInjectionProcessor; diff --git a/scripts/pickable/PickAbleTemplate.cs b/scripts/pickable/PickAbleTemplate.cs index 4a04051..bf2b40c 100644 --- a/scripts/pickable/PickAbleTemplate.cs +++ b/scripts/pickable/PickAbleTemplate.cs @@ -2,7 +2,7 @@ using ColdMint.scripts.camp; using ColdMint.scripts.character; using ColdMint.scripts.damage; -using ColdMint.scripts.item; +using ColdMint.scripts.inventory; using Godot; namespace ColdMint.scripts.pickable; diff --git a/scripts/projectile/ProjectileTemplate.cs b/scripts/projectile/ProjectileTemplate.cs index 684eda4..57e2434 100644 --- a/scripts/projectile/ProjectileTemplate.cs +++ b/scripts/projectile/ProjectileTemplate.cs @@ -3,8 +3,7 @@ using System; using ColdMint.scripts.camp; using ColdMint.scripts.character; using ColdMint.scripts.damage; -using ColdMint.scripts.item; -using ColdMint.scripts.item.weapon; +using ColdMint.scripts.inventory; using ColdMint.scripts.pickable; using Godot; diff --git a/scripts/utils/NodeUtils.cs b/scripts/utils/NodeUtils.cs index 538659b..e6558e9 100644 --- a/scripts/utils/NodeUtils.cs +++ b/scripts/utils/NodeUtils.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.Threading.Tasks; using ColdMint.scripts.debug; -using ColdMint.scripts.item; -using ColdMint.scripts.item.weapon; using Godot; +using Packsack = ColdMint.scripts.inventory.Packsack; using PacksackUi = ColdMint.scripts.loader.uiLoader.PacksackUi; +using WeaponTemplate = ColdMint.scripts.weapon.WeaponTemplate; namespace ColdMint.scripts.utils; diff --git a/scripts/item/weapon/ProjectileWeapon.cs b/scripts/weapon/ProjectileWeapon.cs similarity index 97% rename from scripts/item/weapon/ProjectileWeapon.cs rename to scripts/weapon/ProjectileWeapon.cs index bef4302..1939c7b 100644 --- a/scripts/item/weapon/ProjectileWeapon.cs +++ b/scripts/weapon/ProjectileWeapon.cs @@ -1,10 +1,9 @@ using ColdMint.scripts.debug; using ColdMint.scripts.projectile; using ColdMint.scripts.utils; - using Godot; -namespace ColdMint.scripts.item.weapon; +namespace ColdMint.scripts.weapon; /// /// Projectile weapons diff --git a/scripts/item/weapon/WeaponTemplate.cs b/scripts/weapon/WeaponTemplate.cs similarity index 98% rename from scripts/item/weapon/WeaponTemplate.cs rename to scripts/weapon/WeaponTemplate.cs index e3a01d3..1fc0aa7 100644 --- a/scripts/item/weapon/WeaponTemplate.cs +++ b/scripts/weapon/WeaponTemplate.cs @@ -1,10 +1,9 @@ using System; - using ColdMint.scripts.character; using ColdMint.scripts.pickable; using Godot; -namespace ColdMint.scripts.item.weapon; +namespace ColdMint.scripts.weapon; /// /// WeaponTemplate