From 8131033510c711248de1904649cfa1dbe4bbe69f Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Apr 2022 10:09:11 +0800 Subject: *rename item to prop --- SurvivalTest/Assets/Scripts/Items/ItemBase.cs | 19 ---- SurvivalTest/Assets/Scripts/Items/ItemBase.cs.meta | 11 -- SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs | 24 ---- .../Assets/Scripts/Items/Item_B2Phone.cs.meta | 11 -- .../Assets/Scripts/Items/Item_NuclearBomb.cs | 14 --- .../Assets/Scripts/Items/Item_NuclearBomb.cs.meta | 11 -- .../Assets/Scripts/Items/Item_SpaceBeamer.cs | 21 ---- .../Assets/Scripts/Items/Item_SpaceBeamer.cs.meta | 11 -- .../Assets/Scripts/Managers/BattleManager.cs | 2 +- .../Assets/Scripts/Managers/PlayerManager.cs | 4 +- .../Assets/Scripts/Managers/PlayerManager_Items.cs | 35 ------ .../Scripts/Managers/PlayerManager_Items.cs.meta | 11 -- .../Assets/Scripts/Managers/PlayerManager_Props.cs | 35 ++++++ .../Scripts/Managers/PlayerManager_Props.cs.meta | 11 ++ SurvivalTest/Assets/Scripts/Props.meta | 8 ++ SurvivalTest/Assets/Scripts/Props/PropBase.cs | 19 ++++ SurvivalTest/Assets/Scripts/Props/PropBase.cs.meta | 11 ++ SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs | 24 ++++ .../Assets/Scripts/Props/Prop_B2Phone.cs.meta | 11 ++ .../Assets/Scripts/Props/Prop_NuclearBomb.cs | 14 +++ .../Assets/Scripts/Props/Prop_NuclearBomb.cs.meta | 11 ++ .../Assets/Scripts/Props/Prop_SpaceBeamer.cs | 21 ++++ .../Assets/Scripts/Props/Prop_SpaceBeamer.cs.meta | 11 ++ .../Assets/Scripts/UI/Common/UIGridItemBase.cs | 2 +- .../Panel/PanelDecorationBar/UIDecorationWidget.cs | 2 +- .../Assets/Scripts/UI/Panel/PanelItemBar.meta | 8 -- .../Scripts/UI/Panel/PanelItemBar/ItemWidget.cs | 123 --------------------- .../UI/Panel/PanelItemBar/ItemWidget.cs.meta | 11 -- .../Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs | 95 ---------------- .../UI/Panel/PanelItemBar/PanelItemBar.cs.meta | 11 -- .../Assets/Scripts/UI/Panel/PanelPropBar.meta | 8 ++ .../Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs | 95 ++++++++++++++++ .../UI/Panel/PanelPropBar/PanelPropBar.cs.meta | 11 ++ .../Scripts/UI/Panel/PanelPropBar/PropWidget.cs | 123 +++++++++++++++++++++ .../UI/Panel/PanelPropBar/PropWidget.cs.meta | 11 ++ .../UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs | 4 +- .../Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs | 97 ---------------- .../UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta | 11 -- .../Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs | 97 ++++++++++++++++ .../UI/Panel/PanelTopStuffBar/UIPropBar.cs.meta | 11 ++ .../UI/Panel/PanelWeaponBar/UIWeaponWidget.cs | 2 +- SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs | 4 +- 42 files changed, 542 insertions(+), 534 deletions(-) delete mode 100644 SurvivalTest/Assets/Scripts/Items/ItemBase.cs delete mode 100644 SurvivalTest/Assets/Scripts/Items/ItemBase.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs delete mode 100644 SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs delete mode 100644 SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs delete mode 100644 SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs delete mode 100644 SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs create mode 100644 SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Props.meta create mode 100644 SurvivalTest/Assets/Scripts/Props/PropBase.cs create mode 100644 SurvivalTest/Assets/Scripts/Props/PropBase.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs create mode 100644 SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs create mode 100644 SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs create mode 100644 SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs.meta (limited to 'SurvivalTest/Assets/Scripts') diff --git a/SurvivalTest/Assets/Scripts/Items/ItemBase.cs b/SurvivalTest/Assets/Scripts/Items/ItemBase.cs deleted file mode 100644 index a19ebcf..0000000 --- a/SurvivalTest/Assets/Scripts/Items/ItemBase.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// -/// 物品 -/// -public abstract class ItemBase -{ - - public abstract string name { get; } - - public abstract string iconPath { get; } - - public abstract void OnUse(GameObject owner); - - public virtual void Update() { } - -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Items/ItemBase.cs.meta b/SurvivalTest/Assets/Scripts/Items/ItemBase.cs.meta deleted file mode 100644 index 97b7e17..0000000 --- a/SurvivalTest/Assets/Scripts/Items/ItemBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a1be6fd9c07374849acc8fe23dd6a6d0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs b/SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs deleted file mode 100644 index a7aff51..0000000 --- a/SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// -/// B2呼叫机 -/// -public class Item_B2Phone : ItemBase -{ - public override string name => "B2"; - - public override string iconPath => "art/ui/itemicon/plane"; - - string prefabPath = "prefabs/weapon/b2"; - - public override void OnUse(GameObject owner) - { - TestB2 b2 = UnityEngine.Object.Instantiate(ResourceManager.Instance.Load(prefabPath)); - - Vector3 pos3D = owner.GetComponent().GetProjectedPosition(); - b2.Set(pos3D + new Vector3(-15, 0, 0), pos3D + new Vector3(15, 0, 0), 20f, 3f); - } - -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs.meta b/SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs.meta deleted file mode 100644 index 224b947..0000000 --- a/SurvivalTest/Assets/Scripts/Items/Item_B2Phone.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8c784b1bd77f0eb4384b262c56b0d2bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs b/SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs deleted file mode 100644 index eb483e2..0000000 --- a/SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Item_NuclearBomb : ItemBase -{ - public override string name => "核弹密码箱"; - - public override string iconPath => "art/ui/itemicon/nuclear_bomb"; - - public override void OnUse(GameObject owner) - { - } -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs.meta b/SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs.meta deleted file mode 100644 index 3428826..0000000 --- a/SurvivalTest/Assets/Scripts/Items/Item_NuclearBomb.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 529a65114183a5c479ca08229cb6e458 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs b/SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs deleted file mode 100644 index db76bb8..0000000 --- a/SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Item_SpaceBeamer : ItemBase -{ - public override string name => "卫星射线"; - - public override string iconPath => "art/ui/itemicon/space_beamer"; - - string prefabPath = "prefabs/weapon/space_beam"; - - public override void OnUse(GameObject owner) - { - TestSpaceBeam beam = UnityEngine.Object.Instantiate(ResourceManager.Instance.Load(prefabPath)); - - Vector3 pos3D = owner.GetComponent().position; - beam.Set(pos3D + new Vector3(3, 0, 0)); - } - -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs.meta b/SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs.meta deleted file mode 100644 index 2a064aa..0000000 --- a/SurvivalTest/Assets/Scripts/Items/Item_SpaceBeamer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ce271fd294dfa141b3467d795a524b0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs b/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs index c473a5d..399ea18 100644 --- a/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs +++ b/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs @@ -9,7 +9,7 @@ public class BattleManager : Singleton { UIManager.Instance.OpenPanel(PanelType.PanelTopSuffBar, null); //UIManager.Instance.OpenPanel(PanelType.PanelBossHpBar, null); - //UIManager.Instance.OpenPanel(PanelType.PanelItemBar, null); + //UIManager.Instance.OpenPanel(PanelType.PanelPropBar, null); //UIManager.Instance.OpenPanel(PanelType.PanelWeaponBar, null); } diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs index bae437e..ce27739 100644 --- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs +++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs @@ -10,7 +10,7 @@ public partial class PlayerManager : Singleton public void Init() { - InitItems(); + InitProps(); InitWeapons(); InitDecorations(); } @@ -19,7 +19,7 @@ public partial class PlayerManager : Singleton { CheckInput(); - UpdateItems(); + UpdateProps(); UpdateWeapons(); UpdateDecorations(); } diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs deleted file mode 100644 index a22947a..0000000 --- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class PlayerManager : Singleton -{ - // 持有的物品 - public List items { get { return m_Items; } } - private List m_Items = new List(); - - void InitItems() - { - m_Items.Add(new Item_B2Phone()); - m_Items.Add(new Item_SpaceBeamer()); - m_Items.Add(new Item_NuclearBomb()); - } - - public void UseItem(ItemBase item) - { - if(!items.Contains(item)) - { - Debug.LogError("No such item, name=" + item.name); - return; - } - item.OnUse(m_Crew.gameObject); - } - - void UpdateItems() - { - for(int i = 0; i < items.Count; ++i) - { - items[i].Update(); - } - } -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs.meta b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs.meta deleted file mode 100644 index c0307e5..0000000 --- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Items.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2b31f1faa8e2c6a4085213ca15e56220 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs new file mode 100644 index 0000000..59801f7 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public partial class PlayerManager : Singleton +{ + // 持有的物品 + public List props { get { return m_Props; } } + private List m_Props = new List(); + + void InitProps() + { + m_Props.Add(new Prop_B2Phone()); + m_Props.Add(new Prop_SpaceBeamer()); + m_Props.Add(new Prop_NuclearBomb()); + } + + public void UseProp(PropBase prop) + { + if(!props.Contains(prop)) + { + Debug.LogError("No such prop, name=" + prop.name); + return; + } + prop.OnUse(m_Crew.gameObject); + } + + void UpdateProps() + { + for(int i = 0; i < props.Count; ++i) + { + props[i].Update(); + } + } +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs.meta b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs.meta new file mode 100644 index 0000000..7588f45 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 704fc6666fbbf0146be9db79e42d7601 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Props.meta b/SurvivalTest/Assets/Scripts/Props.meta new file mode 100644 index 0000000..5a2e05a --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2bbb6fa5760fbef4284bb97f88132a7f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Props/PropBase.cs b/SurvivalTest/Assets/Scripts/Props/PropBase.cs new file mode 100644 index 0000000..3976a3c --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/PropBase.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +/// +/// 物品 +/// +public abstract class PropBase +{ + + public abstract string name { get; } + + public abstract string iconPath { get; } + + public abstract void OnUse(GameObject owner); + + public virtual void Update() { } + +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Props/PropBase.cs.meta b/SurvivalTest/Assets/Scripts/Props/PropBase.cs.meta new file mode 100644 index 0000000..524ed68 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/PropBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2699d737bf98397438346e5642d38a2d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs b/SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs new file mode 100644 index 0000000..40d2f87 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +/// +/// B2呼叫机 +/// +public class Prop_B2Phone : PropBase +{ + public override string name => "B2"; + + public override string iconPath => "art/ui/propicon/plane"; + + string prefabPath = "prefabs/weapon/b2"; + + public override void OnUse(GameObject owner) + { + TestB2 b2 = UnityEngine.Object.Instantiate(ResourceManager.Instance.Load(prefabPath)); + + Vector3 pos3D = owner.GetComponent().GetProjectedPosition(); + b2.Set(pos3D + new Vector3(-15, 0, 0), pos3D + new Vector3(15, 0, 0), 20f, 3f); + } + +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs.meta b/SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs.meta new file mode 100644 index 0000000..f9e8411 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/Prop_B2Phone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ecd5acd5480dcc841819ef81be7f8a09 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs b/SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs new file mode 100644 index 0000000..576e24e --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Prop_NuclearBomb : PropBase +{ + public override string name => "核弹密码箱"; + + public override string iconPath => "art/ui/propicon/nuclear_bomb"; + + public override void OnUse(GameObject owner) + { + } +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs.meta b/SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs.meta new file mode 100644 index 0000000..2084041 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/Prop_NuclearBomb.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 849a1a076e0ee154884d0ef95cb784cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs b/SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs new file mode 100644 index 0000000..e191d41 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Prop_SpaceBeamer : PropBase +{ + public override string name => "卫星射线"; + + public override string iconPath => "art/ui/propicon/space_beamer"; + + string prefabPath = "prefabs/weapon/space_beam"; + + public override void OnUse(GameObject owner) + { + TestSpaceBeam beam = UnityEngine.Object.Instantiate(ResourceManager.Instance.Load(prefabPath)); + + Vector3 pos3D = owner.GetComponent().position; + beam.Set(pos3D + new Vector3(3, 0, 0)); + } + +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs.meta b/SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs.meta new file mode 100644 index 0000000..925d582 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/Props/Prop_SpaceBeamer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33aa5992bcf34864fb2fa6254c0da57c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Common/UIGridItemBase.cs b/SurvivalTest/Assets/Scripts/UI/Common/UIGridItemBase.cs index 8e5ff24..d593a39 100644 --- a/SurvivalTest/Assets/Scripts/UI/Common/UIGridItemBase.cs +++ b/SurvivalTest/Assets/Scripts/UI/Common/UIGridItemBase.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public abstract class UIGridItemBase : MonoBehaviour +public abstract class UIGridPropBase : MonoBehaviour { public abstract void Set(object param); diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs index 57a4071..c9d9312 100644 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs @@ -8,7 +8,7 @@ public struct UIDecorationWidgetParam public DecorationBase decoration; } -public class UIDecorationWidget : UIGridItemBase +public class UIDecorationWidget : UIGridPropBase { public Image Image_Icon; diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta deleted file mode 100644 index 4d64c73..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d8e34da1453880542b1bb02a066a5df9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs deleted file mode 100644 index 3227bd8..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public struct ItemWidgetParam -{ - // 主动点击 - public System.Action onSelected; - public ItemBase item; -} - -public class ItemWidget : UIGridItemBase -{ - public Image Image_Icon; - public Image Image_SelectBg; - - public Image Image_Use; - - private System.Action onSelected; - - public ItemBase item { get { return m_Item; } } - private ItemBase m_Item; - - private Coroutine m_CoUse; - - private int m_PendingUse = 0; - - public void SetSelectBg(bool selected) - { - Image_SelectBg.gameObject.SetActive(selected); - } - - public override void Set(object param) - { - ItemWidgetParam info = (ItemWidgetParam)param; - onSelected = info.onSelected; - m_Item = info.item; - - Image_Icon.sprite = ResourceManager.Instance.Load(info.item.iconPath); - - SetSelectBg(false); - - Image_Use.gameObject.SetActive(false); - } - - public void OnSelectCallback() - { - SetSelectBg(true); - } - - public void OnDeselectCallback() - { - SetSelectBg(false); - } - - public void OnUseCallback() - { - m_PendingUse++; - PlayUseAnimation(); - } - - private void PlayUseAnimation() - { - if (m_CoUse != null) - return; - Image_Use.gameObject.SetActive(true); - m_CoUse = StartCoroutine(CoUseAnimation()); - } - - IEnumerator CoUseAnimation() - { - float speed = 7f; - - while(m_PendingUse > 0) - { - Image_Use.fillOrigin = (int)Image.OriginVertical.Bottom; - float t = 0; - while (true) - { - t += speed * Time.deltaTime; - - if (t > 1) - break; - - Image_Use.fillAmount = Mathf.Lerp(0, 1, t); - - yield return null; - } - - Image_Use.fillOrigin = (int)Image.OriginVertical.Top; - t = 0; - while (true) - { - t += speed * Time.deltaTime; - - if (t > 1) - break; - - Image_Use.fillAmount = Mathf.Lerp(1, 0, t); - - yield return null; - } - m_PendingUse--; - } - - Image_Use.gameObject.SetActive(false); - - m_CoUse = null; - - yield break; - } - - private void StopUseAnimation() - { - if (m_CoUse != null) - { - StopCoroutine(m_CoUse); - } - Image_Use.gameObject.SetActive(false); - } - -} diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs.meta deleted file mode 100644 index 29d8747..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 677576640bb11e34e961b72e3c139f6a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs deleted file mode 100644 index 9ca1220..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class PanelItemBar : PanelBase -{ - public ItemWidget m_ItemTempalte; - - public UISimpleGrid m_ItemGrid; - - public Text m_TextName; - - private List m_Items = new List(); - - private int m_CurrentIndex = 0; - - public override void Set(object param) - { - for(int i = 0; i < PlayerManager.Instance.items.Count; ++i) - { - ItemWidget widget = MakeItemWidget(PlayerManager.Instance.items[i]); - m_Items.Add(widget); - } - - SelectItemWidget(0); - } - - bool SwitchToLeft() - { - return Input.GetButtonDown("LeftItem"); - } - - bool SwitchToRight() - { - return Input.GetButtonDown("RightItem"); - } - - bool UseItem() - { - return Input.GetButtonDown("Fire3"); - } - - ItemWidget MakeItemWidget(ItemBase item) - { - ItemWidget widget = Instantiate(m_ItemTempalte); - widget.transform.SetParent(m_ItemGrid.transform); - widget.gameObject.SetActive(true); - widget.GetComponent().anchoredPosition = new Vector2(0, 0); -#if UNITY_EDITOR - widget.name = "item (" + item.name + ")"; -#endif - - ItemWidgetParam param = new ItemWidgetParam(); - //param.onSelected = OnSelectItemWidget; - param.item = item; - widget.Set(param); - return widget; - } - - protected override void Update() - { - if (SwitchToLeft()) - { - int newIndex = Mathf.Clamp(m_CurrentIndex - 1, 0, m_Items.Count - 1); - SelectItemWidget(newIndex); - } - if (SwitchToRight()) - { - int newIndex = Mathf.Clamp(m_CurrentIndex + 1, 0, m_Items.Count - 1); - SelectItemWidget(newIndex); - } - if (UseItem()) - { - m_Items[m_CurrentIndex].OnUseCallback(); - PlayerManager.Instance.UseItem(m_Items[m_CurrentIndex].item); - } - } - - void SelectItemWidget(int index) - { - if(index < 0 || index > m_Items.Count - 1) - { - return ; - } - m_Items[m_CurrentIndex].OnDeselectCallback(); - m_Items[index].OnSelectCallback(); - - m_TextName.text = m_Items[index].item.name; - m_TextName.gameObject.SetActive(false); - - m_CurrentIndex = index; - } - -} diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs.meta deleted file mode 100644 index 3925db5..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/PanelItemBar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b3e9f15745561dd4f9119ac8f893dbfc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar.meta new file mode 100644 index 0000000..4d64c73 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d8e34da1453880542b1bb02a066a5df9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs new file mode 100644 index 0000000..99a2c58 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs @@ -0,0 +1,95 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class PanelPropBar : PanelBase +{ + public PropWidget m_PropTempalte; + + public UISimpleGrid m_PropGrid; + + public Text m_TextName; + + private List m_Props = new List(); + + private int m_CurrentIndex = 0; + + public override void Set(object param) + { + for(int i = 0; i < PlayerManager.Instance.props.Count; ++i) + { + PropWidget widget = MakePropWidget(PlayerManager.Instance.props[i]); + m_Props.Add(widget); + } + + SelectPropWidget(0); + } + + bool SwitchToLeft() + { + return Input.GetButtonDown("LeftProp"); + } + + bool SwitchToRight() + { + return Input.GetButtonDown("RightProp"); + } + + bool UseProp() + { + return Input.GetButtonDown("Fire3"); + } + + PropWidget MakePropWidget(PropBase prop) + { + PropWidget widget = Instantiate(m_PropTempalte); + widget.transform.SetParent(m_PropGrid.transform); + widget.gameObject.SetActive(true); + widget.GetComponent().anchoredPosition = new Vector2(0, 0); +#if UNITY_EDITOR + widget.name = "prop (" + prop.name + ")"; +#endif + + PropWidgetParam param = new PropWidgetParam(); + //param.onSelected = OnSelectPropWidget; + param.prop = prop; + widget.Set(param); + return widget; + } + + protected override void Update() + { + if (SwitchToLeft()) + { + int newIndex = Mathf.Clamp(m_CurrentIndex - 1, 0, m_Props.Count - 1); + SelectPropWidget(newIndex); + } + if (SwitchToRight()) + { + int newIndex = Mathf.Clamp(m_CurrentIndex + 1, 0, m_Props.Count - 1); + SelectPropWidget(newIndex); + } + if (UseProp()) + { + m_Props[m_CurrentIndex].OnUseCallback(); + PlayerManager.Instance.UseProp(m_Props[m_CurrentIndex].prop); + } + } + + void SelectPropWidget(int index) + { + if(index < 0 || index > m_Props.Count - 1) + { + return ; + } + m_Props[m_CurrentIndex].OnDeselectCallback(); + m_Props[index].OnSelectCallback(); + + m_TextName.text = m_Props[index].prop.name; + m_TextName.gameObject.SetActive(false); + + m_CurrentIndex = index; + } + +} diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs.meta new file mode 100644 index 0000000..3925db5 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PanelPropBar.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b3e9f15745561dd4f9119ac8f893dbfc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs new file mode 100644 index 0000000..863e89e --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs @@ -0,0 +1,123 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public struct PropWidgetParam +{ + // 主动点击 + public System.Action onSelected; + public PropBase prop; +} + +public class PropWidget : UIGridPropBase +{ + public Image Image_Icon; + public Image Image_SelectBg; + + public Image Image_Use; + + private System.Action onSelected; + + public PropBase prop { get { return m_Prop; } } + private PropBase m_Prop; + + private Coroutine m_CoUse; + + private int m_PendingUse = 0; + + public void SetSelectBg(bool selected) + { + Image_SelectBg.gameObject.SetActive(selected); + } + + public override void Set(object param) + { + PropWidgetParam info = (PropWidgetParam)param; + onSelected = info.onSelected; + m_Prop = info.prop; + + Image_Icon.sprite = ResourceManager.Instance.Load(info.prop.iconPath); + + SetSelectBg(false); + + Image_Use.gameObject.SetActive(false); + } + + public void OnSelectCallback() + { + SetSelectBg(true); + } + + public void OnDeselectCallback() + { + SetSelectBg(false); + } + + public void OnUseCallback() + { + m_PendingUse++; + PlayUseAnimation(); + } + + private void PlayUseAnimation() + { + if (m_CoUse != null) + return; + Image_Use.gameObject.SetActive(true); + m_CoUse = StartCoroutine(CoUseAnimation()); + } + + IEnumerator CoUseAnimation() + { + float speed = 7f; + + while(m_PendingUse > 0) + { + Image_Use.fillOrigin = (int)Image.OriginVertical.Bottom; + float t = 0; + while (true) + { + t += speed * Time.deltaTime; + + if (t > 1) + break; + + Image_Use.fillAmount = Mathf.Lerp(0, 1, t); + + yield return null; + } + + Image_Use.fillOrigin = (int)Image.OriginVertical.Top; + t = 0; + while (true) + { + t += speed * Time.deltaTime; + + if (t > 1) + break; + + Image_Use.fillAmount = Mathf.Lerp(1, 0, t); + + yield return null; + } + m_PendingUse--; + } + + Image_Use.gameObject.SetActive(false); + + m_CoUse = null; + + yield break; + } + + private void StopUseAnimation() + { + if (m_CoUse != null) + { + StopCoroutine(m_CoUse); + } + Image_Use.gameObject.SetActive(false); + } + +} diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs.meta new file mode 100644 index 0000000..f9f85a3 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelPropBar/PropWidget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ccf65ebe78138644a8bc5283d21ae1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs index 6e91c6b..98ff288 100644 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs @@ -5,13 +5,13 @@ using UnityEngine; public class PanelTopStuffBar : PanelBase { public UIWeaponBar m_WeaponBar; - public UIItemBar m_ItemBar; + public UIPropBar m_PropBar; public UIDecorationBar m_DecorationBar; public override void Set(object param) { m_WeaponBar.Set(); - m_ItemBar.Set(); + m_PropBar.Set(); m_DecorationBar.Set(); } } \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs deleted file mode 100644 index 9025984..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class UIItemBar : MonoBehaviour -{ - public ItemWidget m_ItemTempalte; - - public UISimpleGrid m_ItemGrid; - - public Text m_TextName; - - private List m_Items = new List(); - - private int m_CurrentIndex = 0; - - public void Set() - { - m_ItemTempalte.gameObject.SetActive(false); - - for (int i = 0; i < PlayerManager.Instance.items.Count; ++i) - { - ItemWidget widget = MakeItemWidget(PlayerManager.Instance.items[i]); - m_Items.Add(widget); - } - - SelectItemWidget(0); - } - - bool SwitchToLeft() - { - return Input.GetButtonDown("LeftItem"); - } - - bool SwitchToRight() - { - return Input.GetButtonDown("RightItem"); - } - - bool UseItem() - { - return Input.GetButtonDown("Fire3"); - } - - ItemWidget MakeItemWidget(ItemBase item) - { - ItemWidget widget = Instantiate(m_ItemTempalte); - widget.transform.SetParent(m_ItemGrid.transform); - widget.gameObject.SetActive(true); - widget.GetComponent().anchoredPosition = new Vector2(0, 0); -#if UNITY_EDITOR - widget.name = "item (" + item.name + ")"; -#endif - - ItemWidgetParam param = new ItemWidgetParam(); - //param.onSelected = OnSelectItemWidget; - param.item = item; - widget.Set(param); - return widget; - } - - protected void Update() - { - if (SwitchToLeft()) - { - int newIndex = Mathf.Clamp(m_CurrentIndex - 1, 0, m_Items.Count - 1); - SelectItemWidget(newIndex); - } - if (SwitchToRight()) - { - int newIndex = Mathf.Clamp(m_CurrentIndex + 1, 0, m_Items.Count - 1); - SelectItemWidget(newIndex); - } - if (UseItem()) - { - m_Items[m_CurrentIndex].OnUseCallback(); - PlayerManager.Instance.UseItem(m_Items[m_CurrentIndex].item); - } - } - - void SelectItemWidget(int index) - { - if (index < 0 || index > m_Items.Count - 1) - { - return; - } - m_Items[m_CurrentIndex].OnDeselectCallback(); - m_Items[index].OnSelectCallback(); - - m_TextName.text = m_Items[index].item.name; - m_TextName.gameObject.SetActive(false); - - m_CurrentIndex = index; - } - -} diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta deleted file mode 100644 index 0e07369..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b480696215d6c2a4b8d69edc2946cf3d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs new file mode 100644 index 0000000..d50aed1 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs @@ -0,0 +1,97 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class UIPropBar : MonoBehaviour +{ + public PropWidget m_PropTempalte; + + public UISimpleGrid m_PropGrid; + + public Text m_TextName; + + private List m_Props = new List(); + + private int m_CurrentIndex = 0; + + public void Set() + { + m_PropTempalte.gameObject.SetActive(false); + + for (int i = 0; i < PlayerManager.Instance.props.Count; ++i) + { + PropWidget widget = MakePropWidget(PlayerManager.Instance.props[i]); + m_Props.Add(widget); + } + + SelectPropWidget(0); + } + + bool SwitchToLeft() + { + return Input.GetButtonDown("LeftProp"); + } + + bool SwitchToRight() + { + return Input.GetButtonDown("RightProp"); + } + + bool UseProp() + { + return Input.GetButtonDown("Fire3"); + } + + PropWidget MakePropWidget(PropBase prop) + { + PropWidget widget = Instantiate(m_PropTempalte); + widget.transform.SetParent(m_PropGrid.transform); + widget.gameObject.SetActive(true); + widget.GetComponent().anchoredPosition = new Vector2(0, 0); +#if UNITY_EDITOR + widget.name = "prop (" + prop.name + ")"; +#endif + + PropWidgetParam param = new PropWidgetParam(); + //param.onSelected = OnSelectPropWidget; + param.prop = prop; + widget.Set(param); + return widget; + } + + protected void Update() + { + if (SwitchToLeft()) + { + int newIndex = Mathf.Clamp(m_CurrentIndex - 1, 0, m_Props.Count - 1); + SelectPropWidget(newIndex); + } + if (SwitchToRight()) + { + int newIndex = Mathf.Clamp(m_CurrentIndex + 1, 0, m_Props.Count - 1); + SelectPropWidget(newIndex); + } + if (UseProp()) + { + m_Props[m_CurrentIndex].OnUseCallback(); + PlayerManager.Instance.UseProp(m_Props[m_CurrentIndex].prop); + } + } + + void SelectPropWidget(int index) + { + if (index < 0 || index > m_Props.Count - 1) + { + return; + } + m_Props[m_CurrentIndex].OnDeselectCallback(); + m_Props[index].OnSelectCallback(); + + m_TextName.text = m_Props[index].prop.name; + m_TextName.gameObject.SetActive(false); + + m_CurrentIndex = index; + } + +} diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs.meta new file mode 100644 index 0000000..0e07369 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIPropBar.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b480696215d6c2a4b8d69edc2946cf3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs index f061a3b..baac0d2 100644 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs @@ -8,7 +8,7 @@ public struct UIWeaponWidgetParam public WeaponBase weapon; } -public class UIWeaponWidget : UIGridItemBase +public class UIWeaponWidget : UIGridPropBase { public Image Image_Icon; public Image Image_CD; diff --git a/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs b/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs index 649d685..bb48afd 100644 --- a/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs +++ b/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs @@ -8,7 +8,7 @@ public enum PanelType None, PanelLevelBar, - PanelItemBar, + PanelPropBar, PanelWeaponBar, PanelTopSuffBar, PanelBossHpBar, @@ -29,7 +29,7 @@ public partial class UIManager : Singleton void SetPanels() { AddPanel(PanelType.PanelLevelBar, "PanelLevelBar"); - AddPanel(PanelType.PanelItemBar, "PanelItemBar"); + AddPanel(PanelType.PanelPropBar, "PanelPropBar"); AddPanel(PanelType.PanelWeaponBar, "PanelWeaponBar"); AddPanel(PanelType.PanelTopSuffBar, "PanelTopSuffBar"); AddPanel(PanelType.PanelBossHpBar, "PanelBossHpBar"); -- cgit v1.1-26-g67d0