building shop UI and grouped objects
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -31,8 +31,15 @@ public class Building : MonoBehaviour
|
||||
public async Task Upgrade(){
|
||||
if(curLevel >= buildingData.levels.Count-1){Debug.Log("Already max");return;}
|
||||
int cost = buildingData.levels[curLevel+1].price;
|
||||
Debug.Log("Upgrading " + buildingData.buildingName + " for " + cost + " coins");
|
||||
|
||||
// Debug.Log("Upgrading " + buildingData.buildingName + " for " + cost + " coins");
|
||||
|
||||
switch (curLevel)
|
||||
{
|
||||
case 0: Debug.Log("1 Star"); break;
|
||||
case 1: Debug.Log("2 Stars"); break;
|
||||
}
|
||||
|
||||
|
||||
await (DBmanager.SetCoins(DBmanager.Coins-cost));
|
||||
Mathf.Clamp(curLevel++,0, buildingData.levels.Count-1);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class SelectedItemMenu : MonoBehaviour
|
||||
|
||||
void OnUpgradeMenuClicked()
|
||||
{
|
||||
Debug.Log("Opening Upgrade Menu for : " + Selector.selectedBuilding.buildingData.name);
|
||||
// Debug.Log("Opening Upgrade Menu for : " + Selector.selectedBuilding.buildingData.name);
|
||||
|
||||
upgradeMenu.SetActive(true);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SelectedItemMenu : MonoBehaviour
|
||||
{
|
||||
upgradeBtn.interactable = (Selector.selectedData.levels[Selector.selectedBuilding.curLevel + 1].price < DBmanager.Coins);
|
||||
upgradeBtn.GetComponentInChildren<TMP_Text>().text = Selector.selectedData.levels[Selector.selectedBuilding.curLevel + 1].price.ToString();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,8 +5,9 @@ using UnityEngine.EventSystems;
|
||||
|
||||
public class ShopScript : MonoBehaviour
|
||||
{
|
||||
public GameObject shopUI;
|
||||
public GameObject CoinMenu;
|
||||
public GameObject GemsMenu;
|
||||
public GameObject BuildMenu;
|
||||
public string shopButtonName;
|
||||
|
||||
|
||||
@@ -51,18 +52,31 @@ public class ShopScript : MonoBehaviour
|
||||
checkButton();
|
||||
}
|
||||
|
||||
public void openBuildingShop()
|
||||
{
|
||||
BuildMenu.SetActive(true);
|
||||
}
|
||||
|
||||
public void closeBuildingShop()
|
||||
{
|
||||
BuildMenu.SetActive(false);
|
||||
}
|
||||
|
||||
public void checkButton()
|
||||
{
|
||||
switch (shopButtonName)
|
||||
{
|
||||
case "Button_Shop": shopUI.SetActive(true); break;
|
||||
case "Coin": shopUI.SetActive(true); GemsMenu.SetActive(false); break;
|
||||
case "Gem": GemsMenu.SetActive(true); shopUI.SetActive(false); break;
|
||||
case "Button_Shop": CoinMenu.SetActive(true); break;
|
||||
case "Coin": CoinMenu.SetActive(true); GemsMenu.SetActive(false); break;
|
||||
case "Gem": GemsMenu.SetActive(true); CoinMenu.SetActive(false); break;
|
||||
|
||||
}
|
||||
}
|
||||
public void closeShop()
|
||||
{
|
||||
shopUI.SetActive(false);
|
||||
CoinMenu.SetActive(false);
|
||||
GemsMenu.SetActive(false);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user