summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'SurvivalTest/Assets/Scripts')
-rw-r--r--SurvivalTest/Assets/Scripts/Decorations/DecorationBase.cs4
-rw-r--r--SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs14
-rw-r--r--SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs.meta (renamed from SurvivalTest/Assets/Scripts/Equips/Equip_MysteryMask.cs.meta)2
-rw-r--r--SurvivalTest/Assets/Scripts/Decorations/Decoration_PowerRing.cs4
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs (renamed from SurvivalTest/Assets/Scripts/Equips/Equip_MysteryMask.cs)8
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/BattleManager.cs5
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs6
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs13
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta8
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs30
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar.meta8
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs17
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs42
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs41
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs95
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs2
25 files changed, 358 insertions, 13 deletions
diff --git a/SurvivalTest/Assets/Scripts/Decorations/DecorationBase.cs b/SurvivalTest/Assets/Scripts/Decorations/DecorationBase.cs
index a181628..0a7c735 100644
--- a/SurvivalTest/Assets/Scripts/Decorations/DecorationBase.cs
+++ b/SurvivalTest/Assets/Scripts/Decorations/DecorationBase.cs
@@ -8,6 +8,10 @@ using UnityEngine;
public class DecorationBase : MonoBehaviour
{
+ public virtual string name { get; }
+
+ public virtual string iconPath { get; }
+
public virtual void Update()
{
}
diff --git a/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs b/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs
index 8618df6..63cd979 100644
--- a/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs
+++ b/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs
@@ -7,6 +7,8 @@ using UnityEngine;
/// </summary>
public class Decoration_Horn : DecorationBase
{
+ public override string name => "角";
+ public override string iconPath => "art/ui/decoration/mestry_mask";
}
diff --git a/SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs b/SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs
new file mode 100644
index 0000000..fe1868e
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs
@@ -0,0 +1,14 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 神秘面罩
+/// </summary>
+public class Decoration_MystreyMask : DecorationBase
+{
+ public override string name => "神秘面罩";
+
+ public override string iconPath => "art/ui/decoration/mestry_mask";
+
+}
diff --git a/SurvivalTest/Assets/Scripts/Equips/Equip_MysteryMask.cs.meta b/SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs.meta
index 6b15151..b9de910 100644
--- a/SurvivalTest/Assets/Scripts/Equips/Equip_MysteryMask.cs.meta
+++ b/SurvivalTest/Assets/Scripts/Decorations/Decoration_MystreyMask.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 495a4dbf2afa5154f923113b471b18d4
+guid: f800d56501978e247896b4a3b4978f5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/SurvivalTest/Assets/Scripts/Decorations/Decoration_PowerRing.cs b/SurvivalTest/Assets/Scripts/Decorations/Decoration_PowerRing.cs
index 1e7a7d4..79befce 100644
--- a/SurvivalTest/Assets/Scripts/Decorations/Decoration_PowerRing.cs
+++ b/SurvivalTest/Assets/Scripts/Decorations/Decoration_PowerRing.cs
@@ -8,4 +8,8 @@ using UnityEngine;
public class Decoration_PowerRing : DecorationBase
{
+ public override string name => "力量戒指";
+
+ public override string iconPath => "art/ui/decoration/power_ring";
+
}
diff --git a/SurvivalTest/Assets/Scripts/Equips/Equip_MysteryMask.cs b/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs
index 8ec7ccc..a82ddc7 100644
--- a/SurvivalTest/Assets/Scripts/Equips/Equip_MysteryMask.cs
+++ b/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs
@@ -2,15 +2,15 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
-public class Equip_MysteryMask : EquipBase
+public class Equip_LightSaber : EquipBase
{
- public override string name => "神秘面具";
+ public override string name => "光剑";
- public override string iconPath => "art/ui/equipicon/mystery_mask";
+ public override string iconPath => "art/ui/equipicon/light_saber";
public override AutoMode autoMode => AutoMode.Interval;
- public override float interval => 100f;
+ public override float interval => 5f;
public override void OnTrigger(GameObject owner)
{
diff --git a/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta b/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta
new file mode 100644
index 0000000..dcc1028
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cf80263cc579a3c46887c696a8f09d56
+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 4cdaa72..ee52548 100644
--- a/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs
@@ -7,8 +7,9 @@ public class BattleManager : Singleton<BattleManager>
public void Init()
{
- UIManager.Instance.OpenPanel(PanelType.PanelItemBar, null);
- UIManager.Instance.OpenPanel(PanelType.PanelEquipBar, null);
+ UIManager.Instance.OpenPanel(PanelType.PanelTopSuffBar, null);
+ //UIManager.Instance.OpenPanel(PanelType.PanelItemBar, null);
+ //UIManager.Instance.OpenPanel(PanelType.PanelEquipBar, null);
}
public void Update()
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs
index 8bd1dd0..95ad08e 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs
@@ -8,14 +8,11 @@ public partial class PlayerManager : Singleton<PlayerManager>
// 角色
private CrewScript m_Crew;
- // 持有的饰品
- public List<DecorationBase> decorations { get { return m_Decorations; } }
- private List<DecorationBase> m_Decorations = new List<DecorationBase>();
-
public void Init()
{
InitItems();
InitEquips();
+ InitDecorations();
}
public void Update()
@@ -24,6 +21,7 @@ public partial class PlayerManager : Singleton<PlayerManager>
UpdateItems();
UpdateEquips();
+ UpdateDecorations();
}
public void SetCrew(CrewScript crew)
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs
index ce85849..3f1669a 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs
@@ -5,6 +5,19 @@ using UnityEngine;
public partial class PlayerManager : Singleton<PlayerManager>
{
+ // 当前饰品
+ public List<DecorationBase> decorations { get { return m_Decorations; } }
+ private List<DecorationBase> m_Decorations = new List<DecorationBase>();
+ void InitDecorations()
+ {
+ m_Decorations.Add(new Decoration_MystreyMask());
+ m_Decorations.Add(new Decoration_PowerRing());
+ }
+
+ void UpdateDecorations()
+ {
+
+ }
} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
index 73f86ff..44197c7 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
@@ -24,7 +24,7 @@ public partial class PlayerManager : Singleton<PlayerManager>
m_Equips.Add(new Equip_Boomerang());
m_Equips.Add(new Equip_TeslaCoil());
m_Equips.Add(new Equip_MightyGlove());
- m_Equips.Add(new Equip_MysteryMask());
+ m_Equips.Add(new Equip_LightSaber());
m_AutoFire = false;
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta
new file mode 100644
index 0000000..01fa061
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar.meta
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 0000000..57a4071
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.cs
@@ -0,0 +1,30 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public struct UIDecorationWidgetParam
+{
+ public DecorationBase decoration;
+}
+
+public class UIDecorationWidget : UIGridItemBase
+{
+ 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<Sprite>(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
new file mode 100644
index 0000000..893e695
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelDecorationBar/UIDecorationWidget.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/PanelItemBar/ItemWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs
index 552672a..3227bd8 100644
--- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/ItemWidget.cs
@@ -70,7 +70,7 @@ public class ItemWidget : UIGridItemBase
IEnumerator CoUseAnimation()
{
- float speed = 5f;
+ float speed = 7f;
while(m_PendingUse > 0)
{
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar.meta
new file mode 100644
index 0000000..f57d336
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e369b816220311a479b64dffd9f3b5a5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs
new file mode 100644
index 0000000..2d1e02b
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs
@@ -0,0 +1,17 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class PanelTopStuffBar : PanelBase
+{
+ public UIEquipBar m_EquipBar;
+ public UIItemBar m_ItemBar;
+ public UIDecorationBar m_DecorationBar;
+
+ public override void Set(object param)
+ {
+ m_EquipBar.Set();
+ m_ItemBar.Set();
+ m_DecorationBar.Set();
+ }
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs.meta
new file mode 100644
index 0000000..ba0424f
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/PanelTopStuffBar.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9c7a0239a22d86847b5806d7e4f2e500
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs
new file mode 100644
index 0000000..6dce384
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs
@@ -0,0 +1,42 @@
+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/UIDecorationBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta
new file mode 100644
index 0000000..ac771c3
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIDecorationBar.cs.meta
@@ -0,0 +1,11 @@
+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/UIEquipBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs
new file mode 100644
index 0000000..d658663
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs
@@ -0,0 +1,41 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UIEquipBar : MonoBehaviour
+{
+ public UIEquipWidget m_EquipTemplate;
+
+ public UISimpleGrid m_EquipGrid;
+
+ private List<UIEquipWidget> m_Equips = new List<UIEquipWidget>();
+
+ public void Set()
+ {
+ m_EquipTemplate.gameObject.SetActive(false);
+
+ for (int i = 0; i < PlayerManager.Instance.equips.Count; ++i)
+ {
+ UIEquipWidget widget = MakeEquipWidget(PlayerManager.Instance.equips[i]);
+ m_Equips.Add(widget);
+ }
+ }
+
+ UIEquipWidget MakeEquipWidget(EquipBase equip)
+ {
+ UIEquipWidget widget = Instantiate<UIEquipWidget>(m_EquipTemplate);
+ widget.transform.SetParent(m_EquipGrid.transform);
+ widget.gameObject.SetActive(true);
+ widget.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
+#if UNITY_EDITOR
+ widget.name = "equip (" + equip.name + ")";
+#endif
+
+ UIEquipWidgetParam param = new UIEquipWidgetParam();
+ param.equip = equip;
+ widget.Set(param);
+ return widget;
+ }
+
+
+}
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs.meta
new file mode 100644
index 0000000..68bf843
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIEquipBar.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3eefcc4321abff24e88f7cbb843e3fda
+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..ecb6ea1
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs
@@ -0,0 +1,95 @@
+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<ItemWidget> m_Items = new List<ItemWidget>();
+
+ private int m_CurrentIndex = 0;
+
+ public void Set()
+ {
+ 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<ItemWidget>(m_ItemTempalte);
+ 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
+
+ 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
new file mode 100644
index 0000000..0e07369
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.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/UIManager_Panels.cs b/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs
index bf2ada4..d53a4e6 100644
--- a/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs
+++ b/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs
@@ -10,6 +10,7 @@ public enum PanelType
PanelLevelBar,
PanelItemBar,
PanelEquipBar,
+ PanelTopSuffBar,
}
public partial class UIManager : Singleton<UIManager>
@@ -29,6 +30,7 @@ public partial class UIManager : Singleton<UIManager>
AddPanel(PanelType.PanelLevelBar, "PanelLevelBar");
AddPanel(PanelType.PanelItemBar, "PanelItemBar");
AddPanel(PanelType.PanelEquipBar, "PanelEquipBar");
+ AddPanel(PanelType.PanelTopSuffBar, "PanelTopSuffBar");
}
void AddPanel(PanelType type, string path)