You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.2 KiB
77 lines
2.2 KiB
using UnityEngine; |
|
using UnityEngine.UI; |
|
using TMPro; |
|
using Equip; |
|
|
|
public class StoreSafeDialog : BaseDialog |
|
{ |
|
[SerializeField] TextMeshProUGUI _header; |
|
[SerializeField] TextMeshProUGUI _reward; |
|
[SerializeField] TextMeshProUGUI _coinsCount; |
|
[SerializeField] TextMeshProUGUI _gemsCount; |
|
|
|
[SerializeField] Image _icon; |
|
[SerializeField] Image _rarityBack; |
|
|
|
int _coins = 1000; |
|
int _gems = 50; |
|
|
|
//----------------------------------------------------------------------------------------- |
|
void Start () |
|
{ |
|
m_type = DialogType.STORE_SAFE_DIALOG; |
|
} |
|
|
|
//----------------------------------------------------------------------------------------- |
|
public void Init() |
|
{ |
|
InitTexts(); |
|
InitRandomItem(); |
|
|
|
GlobalsVar.gUser.IncCurrency(Shop.ShopType.Coins, _coins); |
|
GlobalsVar.gUser.IncCurrency(Shop.ShopType.Gems, _gems); |
|
} |
|
|
|
//----------------------------------------------------------------------------------------- |
|
private void InitRandomItem() |
|
{ |
|
EquipItem item = EquipSettings.UnlockRandomItem(); |
|
|
|
if (_icon) |
|
_icon.sprite = Resources.Load<Sprite>(string.Format("Equipment/{0}", item.Icon)); |
|
|
|
if (_rarityBack) |
|
_rarityBack.sprite = Resources.Load<Sprite>(string.Format("Equipment/OBJ_arsenal_{0}", item.Rarity)); |
|
} |
|
|
|
//----------------------------------------------------------------------------------------- |
|
private void InitTexts() |
|
{ |
|
if (_header) |
|
_header.text = GlobalsVar.gGameTextMng.GetGameText(61).ToUpper(); |
|
|
|
if (_reward) |
|
_reward.text = GlobalsVar.gGameTextMng.GetGameText(24).ToUpper(); |
|
|
|
if (_coinsCount) |
|
_coinsCount.text = _coins.ToString(); |
|
|
|
if (_gemsCount) |
|
_gemsCount.text = _gems.ToString(); |
|
} |
|
|
|
//----------------------------------------------------------------------------------------- |
|
public override void Update () |
|
{ |
|
base.Update(); |
|
|
|
if (Input.GetMouseButtonDown(0)) |
|
{ |
|
HideDialog(); |
|
|
|
MainMenu mainMenu = GlobalsVar.gBoard as MainMenu; |
|
if (mainMenu) |
|
mainMenu.Repaint(); |
|
} |
|
} |
|
}
|
|
|