Item Selector
This commit is contained in:
+2
-1
@@ -18,6 +18,7 @@
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/UnluckyField.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/VSField.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Items/Item.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Items/ItemSelector.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Items/UIItem.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/AnimationHandler.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/NoPlayablePlayer.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
@@ -134,7 +135,7 @@
|
||||
<workItem from="1677516389539" duration="4730000" />
|
||||
<workItem from="1677521614865" duration="735000" />
|
||||
<workItem from="1677789832911" duration="4364000" />
|
||||
<workItem from="1677881158579" duration="4292000" />
|
||||
<workItem from="1677881158579" duration="7214000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ItemSelector : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject[] itemButtons;
|
||||
[SerializeField] private Image[] itemImages;
|
||||
|
||||
|
||||
public void Init(Item[] items)
|
||||
{
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
{
|
||||
if (items[i] != null)
|
||||
{
|
||||
itemButtons[i].SetActive(true);
|
||||
itemImages[i].sprite = items[i].sprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemButtons[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0eebc4bee1ee3be48bb72d5aefe33a57
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -28,6 +28,8 @@ public class PlayablePlayer : Player
|
||||
|
||||
public Client client;
|
||||
|
||||
private static PlayablePlayer instance;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
TMP_Text[] playerTexts = GetComponentsInChildren<TMP_Text>();
|
||||
@@ -37,9 +39,15 @@ public class PlayablePlayer : Player
|
||||
QualitySettings.vSyncCount = 0;
|
||||
Application.targetFrameRate = 61;
|
||||
diceScript = dice.GetComponent<Dice>();
|
||||
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static PlayablePlayer GetCurrentInstance()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -91,11 +91,11 @@ public abstract class Player : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateItem(int index, Item.Type type)
|
||||
public void ActivateItem(int index)
|
||||
{
|
||||
activeItem = items[index].type;
|
||||
uiItems[index].gameObject.SetActive(false);
|
||||
items[index] = null;
|
||||
activeItem = type;
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider c)
|
||||
|
||||
@@ -11,6 +11,7 @@ public class UIHandler : MonoBehaviour
|
||||
[SerializeField] private GameObject layoutMiniMap;
|
||||
[SerializeField] private GameObject layoutBuyStar;
|
||||
[SerializeField] private GameObject layoutItemShop;
|
||||
[SerializeField] private GameObject layoutSelectItem;
|
||||
|
||||
private static UIHandler currentInstance;
|
||||
|
||||
@@ -37,6 +38,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
|
||||
currentInstance = this;
|
||||
}
|
||||
@@ -49,6 +51,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutMiniMap()
|
||||
@@ -59,6 +62,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutBuyStar(Player player)
|
||||
@@ -70,6 +74,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutBuyStar.SetActive(true);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
|
||||
LayoutBuyStarController controller = layoutBuyStar.GetComponent<LayoutBuyStarController>();
|
||||
|
||||
@@ -95,6 +100,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(true);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutItemShop()
|
||||
@@ -106,12 +112,28 @@ public class UIHandler : MonoBehaviour
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(true);
|
||||
layoutItemShop.GetComponent<ItemShop>().Init(currentPlayer);
|
||||
layoutSelectItem.SetActive(false);
|
||||
}
|
||||
|
||||
//TODO: Only temp, make additional function for Item selection
|
||||
|
||||
public void ActivateLayoutItemSelect()
|
||||
{
|
||||
currentPlayer.ActivateItem(0, Item.Type.Mushroom);
|
||||
|
||||
currentPlayer = PlayablePlayer.GetCurrentInstance();
|
||||
|
||||
if(currentPlayer.activated)
|
||||
{
|
||||
layout0.SetActive(false);
|
||||
layout1.SetActive(false);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
|
||||
layoutSelectItem.GetComponent<ItemSelector>().Init(currentPlayer.items);
|
||||
|
||||
layoutSelectItem.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ButtonBuyStar()
|
||||
@@ -142,4 +164,10 @@ public class UIHandler : MonoBehaviour
|
||||
ActivateLayout1();
|
||||
((PlayablePlayer)currentPlayer).SkipShop();
|
||||
}
|
||||
|
||||
public void ButtonSelectItem(int index)
|
||||
{
|
||||
currentPlayer.ActivateItem(index);
|
||||
ActivateLayout1();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,9 @@ PlayerSettings:
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 0.1
|
||||
preloadedAssets: []
|
||||
preloadedAssets:
|
||||
- {fileID: -6230802382160794249, guid: 90cd1b71078984c4980fcd1aa03eaaa3, type: 2}
|
||||
- {fileID: 11400000, guid: 48bf7376b3770c44cbfe3f40e77359ab, type: 2}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
||||
Generated
+1
-1
@@ -89,7 +89,7 @@
|
||||
<workItem from="1677445028345" duration="816000" />
|
||||
<workItem from="1677520608630" duration="13000" />
|
||||
<workItem from="1677789901008" duration="661000" />
|
||||
<workItem from="1677881295823" duration="2233000" />
|
||||
<workItem from="1677881295823" duration="2895000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user