123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using System;
- using I2.Loc;
- using UnityEngine;
- using wf;
- public class CasinoItemUI : MonoBehaviour
- {
- private void IconHoverOver()
- {
- KasaSceneMgr<SceneCasinoShop>.Instance.ShowItenInfo(this.m_ItemData, base.transform);
- }
- private void IconHoverOut()
- {
- KasaSceneMgr<SceneCasinoShop>.Instance.HideItemInfo();
- }
- private void IconClick()
- {
- if (KasaSceneMgr<SceneCasinoShop>.Instance.SelectTrywear != this.m_ItemData)
- {
- KasaSceneMgr<SceneCasinoShop>.Instance.SetTrywearItem(this.m_ItemData);
- }
- else
- {
- KasaSceneMgr<SceneCasinoShop>.Instance.RecetTrywearItem();
- }
- }
- private void ItemBuy()
- {
- if (!this.m_ItemData.IsCanBuy)
- {
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("SceneCasino/ダイアログ/カジノコインが不足しています。", null, SystemDialog.TYPE.OK, null, null);
- return;
- }
- string messageTerm = "SceneCasino/ダイアログ/{0}を購入しますか?";
- string[] array = new string[]
- {
- this.m_ItemData.Name,
- Utility.ConvertMoneyText(this.m_ItemData.Price)
- };
- if (Product.supportMultiLanguage)
- {
- array[0] = LocalizationManager.GetTranslation(this.m_ItemData.NameTerm, true, 0, true, false, null, null);
- }
- GameMain.Instance.SysDlg.ShowFromLanguageTerm(messageTerm, array, SystemDialog.TYPE.OK_CANCEL, delegate
- {
- KasaSceneMgr<SceneCasinoShop>.Instance.ItemBuy(this.m_ItemData);
- }, null);
- }
- public void Init(CasinoShopItem item_data)
- {
- this.m_ItemData = item_data;
- this.m_NameLabel.text = item_data.Name;
- Utility.SetLocalizeTerm(this.m_NameLabel, item_data.NameTerm, false);
- this.m_PriceLabel.text = Utility.ConvertMoneyText(item_data.Price);
- this.m_ItemIcon = this.m_ItemIconObj.GetComponent<UI2DSprite>();
- this.m_IconButton = this.m_ItemIconObj.GetComponent<UIButton>();
- this.m_IconButton.enabled = item_data.IsCategoryCostume;
- this.m_IconEvent = this.m_ItemIconObj.GetComponent<UIEventTrigger>();
- this.m_IconFrame = this.m_ItemIconObj.transform.GetChild(0).gameObject;
- this.m_ItemIcon.sprite2D = item_data.Icon;
- EventDelegate.Add(this.m_IconEvent.onHoverOut, new EventDelegate.Callback(this.IconHoverOut));
- EventDelegate.Add(this.m_IconEvent.onHoverOver, new EventDelegate.Callback(this.IconHoverOver));
- if (this.m_ItemData.IsCategoryCostume)
- {
- EventDelegate.Add(this.m_IconButton.onClick, new EventDelegate.Callback(this.IconClick));
- }
- this.m_BuyButton = this.m_BuyButtonObj.GetComponent<UIButton>();
- this.m_BuyButtonIcon = this.m_BuyButtonObj.GetComponent<UISprite>();
- this.m_BuyButtonIconLocalize = this.m_BuyButtonObj.GetComponent<Localize>();
- EventDelegate.Add(this.m_BuyButton.onClick, new EventDelegate.Callback(this.ItemBuy));
- this.UIUpdate();
- }
- public void UIUpdate()
- {
- this.m_BuyButton.isEnabled = !this.m_ItemData.IsSoldOut;
- this.m_PriceLabel.color = ((!this.m_ItemData.IsCanBuy && !this.m_ItemData.IsSoldOut) ? this.m_CannotBuyCol : this.m_CanBuyCol);
- Utility.SetLocalizeTerm(this.m_BuyButtonIconLocalize, (!this.m_ItemData.IsSoldOut) ? this.m_BuySprite : this.m_SoldSprite, false);
- }
- public void SwitchFrame()
- {
- this.m_IconFrame.SetActive(KasaSceneMgr<SceneCasinoShop>.Instance.SelectTrywear == this.m_ItemData);
- }
- private CasinoShopItem m_ItemData;
- [SerializeField]
- private UILabel m_NameLabel;
- [SerializeField]
- private UILabel m_PriceLabel;
- [SerializeField]
- private Color m_CanBuyCol = Color.white;
- [SerializeField]
- private Color m_CannotBuyCol = Color.red;
- [SerializeField]
- private GameObject m_BuyButtonObj;
- [SerializeField]
- private GameObject m_ItemIconObj;
- [SerializeField]
- private string m_BuySprite;
- [SerializeField]
- private string m_SoldSprite;
- private UIButton m_IconButton;
- private UI2DSprite m_ItemIcon;
- private UIEventTrigger m_IconEvent;
- private GameObject m_IconFrame;
- private UIButton m_BuyButton;
- private UISprite m_BuyButtonIcon;
- private Localize m_BuyButtonIconLocalize;
- }
|