From 7eb9351d905ddf6316fd6b177fff967fbac6fc94 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Apr 2022 10:19:09 +0800 Subject: * rename decoration to item --- .../Scripts/UI/Panel/PanelDecorationBar.meta | 8 ----- .../Panel/PanelDecorationBar/UIDecorationWidget.cs | 30 ---------------- .../PanelDecorationBar/UIDecorationWidget.cs.meta | 11 ------ .../Assets/Scripts/UI/Panel/PanelItemBar.meta | 8 +++++ .../Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs | 30 ++++++++++++++++ .../UI/Panel/PanelItemBar/UIItemWidget.cs.meta | 11 ++++++ .../UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs | 4 +-- .../UI/Panel/PanelTopStuffBar/UIDecorationBar.cs | 42 ---------------------- .../Panel/PanelTopStuffBar/UIDecorationBar.cs.meta | 11 ------ .../Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs | 42 ++++++++++++++++++++++ .../UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta | 11 ++++++ 11 files changed, 104 insertions(+), 104 deletions(-) delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs.meta delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs delete mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs create mode 100644 SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta (limited to 'SurvivalTest/Assets/Scripts/UI/Panel') diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta deleted file mode 100644 index 01fa061..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fb019ee665a1bd64fab6f1cbf9a8c98c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs deleted file mode 100644 index c9d9312..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public struct UIDecorationWidgetParam -{ - public DecorationBase decoration; -} - -public class UIDecorationWidget : UIGridPropBase -{ - public Image Image_Icon; - - public DecorationBase decoration { get { return m_Decoration; } } - private DecorationBase m_Decoration; - - public override void Set(object param) - { - UIDecorationWidgetParam info = (UIDecorationWidgetParam)param; - m_Decoration = info.decoration; - - Image_Icon.sprite = ResourceManager.Instance.Load(info.decoration.iconPath); - } - - private void Update() - { - } - -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs.meta deleted file mode 100644 index 893e695..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 686d7a38ee74b0d4489402f2727a1765 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta new file mode 100644 index 0000000..01fa061 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb019ee665a1bd64fab6f1cbf9a8c98c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs new file mode 100644 index 0000000..0f9d623 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public struct UIItemWidgetParam +{ + public ItemBase item; +} + +public class UIItemWidget : UIGridPropBase +{ + public Image Image_Icon; + + public ItemBase item { get { return m_Item; } } + private ItemBase m_Item; + + public override void Set(object param) + { + UIItemWidgetParam info = (UIItemWidgetParam)param; + m_Item = info.item; + + Image_Icon.sprite = ResourceManager.Instance.Load(info.item.iconPath); + } + + private void Update() + { + } + +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs.meta new file mode 100644 index 0000000..893e695 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 686d7a38ee74b0d4489402f2727a1765 +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 98ff288..c523152 100644 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs @@ -6,12 +6,12 @@ public class PanelTopStuffBar : PanelBase { public UIWeaponBar m_WeaponBar; public UIPropBar m_PropBar; - public UIDecorationBar m_DecorationBar; + public UIItemBar m_ItemBar; public override void Set(object param) { m_WeaponBar.Set(); m_PropBar.Set(); - m_DecorationBar.Set(); + m_ItemBar.Set(); } } \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs deleted file mode 100644 index 6dce384..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class UIDecorationBar : MonoBehaviour -{ - public UIDecorationWidget m_DecorationTemplate; - - public UISimpleGrid m_DecorationGrid; - - private List m_Decorations = new List(); - - public void Set() - { - m_DecorationTemplate.gameObject.SetActive(false); - - for (int i = 0; i < PlayerManager.Instance.decorations.Count; ++i) - { - UIDecorationWidget widget = MakeDecorationWidget(PlayerManager.Instance.decorations[i]); - m_Decorations.Add(widget); - } - } - - UIDecorationWidget MakeDecorationWidget(DecorationBase decoration) - { - UIDecorationWidget widget = Instantiate(m_DecorationTemplate); - widget.transform.SetParent(m_DecorationGrid.transform); - widget.gameObject.SetActive(true); - widget.GetComponent().anchoredPosition = new Vector2(0, 0); -#if UNITY_EDITOR - widget.name = "decoration (" + decoration.name + ")"; -#endif - - UIDecorationWidgetParam param = new UIDecorationWidgetParam(); - param.decoration = decoration; - widget.Set(param); - return widget; - } - - - -} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta deleted file mode 100644 index ac771c3..0000000 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d41adc469fe729a488b68790c33b6856 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs new file mode 100644 index 0000000..1269c0a --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs @@ -0,0 +1,42 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class UIItemBar : MonoBehaviour +{ + public UIItemWidget m_ItemTemplate; + + public UISimpleGrid m_ItemGrid; + + private List m_Items = new List(); + + public void Set() + { + m_ItemTemplate.gameObject.SetActive(false); + + for (int i = 0; i < PlayerManager.Instance.items.Count; ++i) + { + UIItemWidget widget = MakeItemWidget(PlayerManager.Instance.items[i]); + m_Items.Add(widget); + } + } + + UIItemWidget MakeItemWidget(ItemBase item) + { + UIItemWidget widget = Instantiate(m_ItemTemplate); + 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 + + UIItemWidgetParam param = new UIItemWidgetParam(); + param.item = item; + widget.Set(param); + return widget; + } + + + +} \ No newline at end of file diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta new file mode 100644 index 0000000..ac771c3 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d41adc469fe729a488b68790c33b6856 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0