54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class ShopMenuItem : MonoBehaviour
|
|
{
|
|
[SerializeField] RectTransform image;
|
|
[SerializeField] TMP_Text text;
|
|
|
|
GameObject typeObj;
|
|
|
|
ShopData shopData;
|
|
|
|
bool isSelect = false;
|
|
|
|
public void Set(ShopData shopData, GameObject typeObj)
|
|
{
|
|
this.shopData = shopData;
|
|
this.typeObj = typeObj;
|
|
if (shopData.image_type == eImageType.bigImage)
|
|
{
|
|
typeObj.GetComponent<ShopUiType1>().Set(shopData.index);
|
|
}
|
|
else
|
|
{
|
|
typeObj.GetComponent<ShopUiType2>().Set(shopData.index);
|
|
}
|
|
text.text = shopData.name;
|
|
}
|
|
|
|
public void SelectButton()
|
|
{
|
|
isSelect = true;
|
|
ShopUiCtrl.Instance.SelectShopMenu();
|
|
}
|
|
|
|
public void ChangeButton()
|
|
{
|
|
if (isSelect)
|
|
{
|
|
image.offsetMin = new Vector2(-15.0f, -5.0f);
|
|
image.offsetMax = new Vector2(0.0f, 5.0f);
|
|
text.fontSize = 43.2f;
|
|
}
|
|
else
|
|
{
|
|
image.offsetMin = new Vector2 (0.0f, 0.0f);
|
|
image.offsetMax = new Vector2(0.0f, 0.0f);
|
|
text.fontSize = 36.0f;
|
|
}
|
|
typeObj.SetActive(isSelect);
|
|
isSelect = false;
|
|
}
|
|
}
|