UI's added, shop and basic currency are done, BUGS: can move around the map when scrolling shop, object do not get selected
This commit is contained in:
34
Assets/Game/Scripts/ShopScript.cs
Normal file
34
Assets/Game/Scripts/ShopScript.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class ShopScript : MonoBehaviour
|
||||
{
|
||||
public GameObject shopUI;
|
||||
public GameObject GemsMenu;
|
||||
public string shopButtonName;
|
||||
|
||||
|
||||
public void openShop()
|
||||
{
|
||||
shopButtonName = EventSystem.current.currentSelectedGameObject.name;
|
||||
checkButton();
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
public void closeShop()
|
||||
{
|
||||
shopUI.SetActive(false);
|
||||
GemsMenu.SetActive(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user