using System; using I2.Loc; using UnityEngine; using wf; public class CasinoItemUI : MonoBehaviour { private void IconHoverOver() { KasaSceneMgr.Instance.ShowItenInfo(this.m_ItemData, base.transform); } private void IconHoverOut() { KasaSceneMgr.Instance.HideItemInfo(); } private void IconClick() { if (KasaSceneMgr.Instance.SelectTrywear != this.m_ItemData) { KasaSceneMgr.Instance.SetTrywearItem(this.m_ItemData); } else { KasaSceneMgr.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.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(); this.m_IconButton = this.m_ItemIconObj.GetComponent(); this.m_IconButton.enabled = item_data.IsCategoryCostume; this.m_IconEvent = this.m_ItemIconObj.GetComponent(); 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(); this.m_BuyButtonIcon = this.m_BuyButtonObj.GetComponent(); this.m_BuyButtonIconLocalize = this.m_BuyButtonObj.GetComponent(); 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.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; }