diff options
Diffstat (limited to 'SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar')
-rw-r--r-- | SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs | 4 | ||||
-rw-r--r-- | SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs | 42 | ||||
-rw-r--r-- | SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs | 42 | ||||
-rw-r--r-- | SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta (renamed from SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta) | 0 |
4 files changed, 44 insertions, 44 deletions
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<UIDecorationWidget> m_Decorations = new List<UIDecorationWidget>(); - - 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<UIDecorationWidget>(m_DecorationTemplate); - widget.transform.SetParent(m_DecorationGrid.transform); - widget.gameObject.SetActive(true); - widget.GetComponent<RectTransform>().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/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<UIItemWidget> m_Items = new List<UIItemWidget>(); + + 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<UIItemWidget>(m_ItemTemplate); + widget.transform.SetParent(m_ItemGrid.transform); + widget.gameObject.SetActive(true); + widget.GetComponent<RectTransform>().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/UIDecorationBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta index ac771c3..ac771c3 100644 --- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta |