123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- using System;
- using I2.Loc;
- using UnityEngine;
- using UnityEngine.UI;
- using wf;
- public class ExChangeUI : MonoBehaviour
- {
- public static ExChangeUI Instance { get; private set; }
- public bool IsActive
- {
- get
- {
- return base.gameObject.activeSelf;
- }
- }
- private void Awake()
- {
- ExChangeUI.Instance = this;
- this.FadeInStartAction = (Action)Delegate.Combine(this.FadeInStartAction, new Action(delegate()
- {
- this.m_ExchangeButton.interactable = false;
- }));
- this.FadeInStartAction = (Action)Delegate.Combine(this.FadeInStartAction, new Action(this.SetExchangeMax));
- this.FadeOutStartAction = (Action)Delegate.Combine(this.FadeOutStartAction, new Action(this.TextUIUpdate));
- MoneySetttingUI moneySetting = this.m_MoneySetting;
- moneySetting.ValueUpdateAction = (MoneySetttingUI.ValueUpdateMethod)Delegate.Combine(moneySetting.ValueUpdateAction, new MoneySetttingUI.ValueUpdateMethod(this.UIStateUpdate));
- this.m_MyCanvas = base.GetComponent<CanvasGroup>();
- this.m_RateText.text = string.Format("コイン1枚 = {0}CR", Utility.ConvertMoneyText(this.m_CoinRate));
- if (Product.SPP)
- {
- Localize localize = this.m_RateText.gameObject.AddComponent<Localize>();
- localize.TermArgs = new Localize.ArgsPair[]
- {
- Localize.ArgsPair.Create(Utility.ConvertMoneyText(this.m_CoinRate))
- };
- Utility.SetLocalizeTerm(localize, "SceneCasino/コイン1枚 = {0}CR");
- }
- this.TextUIUpdate();
- this.m_MoneySetting.SetMoneyUI(this.m_MoneySetting.MinValue, true);
- base.gameObject.SetActive(false);
- }
- private void SetExchangeMax()
- {
- long num = 999999L - GameMain.Instance.CharacterMgr.status.casinoCoin;
- if (num <= this.m_MoneySetting.MinValue)
- {
- num = this.m_MoneySetting.MinValue;
- }
- if (num * (long)this.m_CoinRate > GameMain.Instance.CharacterMgr.status.money)
- {
- num = GameMain.Instance.CharacterMgr.status.money / (long)this.m_CoinRate;
- }
- this.m_MoneySetting.SetMaxValue(num);
- }
- public void TextUIUpdate()
- {
- this.m_MoneyUI.text = GameMain.Instance.CharacterMgr.status.moneyText;
- this.m_CoinUI.text = Utility.ConvertMoneyText(GameMain.Instance.CharacterMgr.status.casinoCoin);
- }
- public void SetButtonState(bool conditon)
- {
- this.m_ExchangeButton.interactable = conditon;
- }
- public void UIStateUpdate()
- {
- long money = GameMain.Instance.CharacterMgr.status.money;
- this.m_BalanceText.text = string.Format("-{0:#,##0}", this.m_MoneySetting.MoneyValue * (long)this.m_CoinRate);
- this.m_CurrentCoin.text = Utility.ConvertMoneyText(GameMain.Instance.CharacterMgr.status.casinoCoin + this.m_MoneySetting.MoneyValue);
- }
- public void PushOKButton()
- {
- GameMain.Instance.CharacterMgr.status.money -= this.m_MoneySetting.MoneyValue * (long)this.m_CoinRate;
- GameMain.Instance.CharacterMgr.status.casinoCoin += this.m_MoneySetting.MoneyValue;
- if (this.FadeOutStartAction != null)
- {
- this.FadeOutStartAction();
- }
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_MyCanvas, true, this.m_FadeTime, this.FadeOutEndAction, true, true));
- }
- public void PushCancelButton()
- {
- if (this.FadeOutStartAction != null)
- {
- this.FadeOutStartAction();
- }
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_MyCanvas, true, this.m_FadeTime, this.FadeOutEndAction, true, true));
- }
- public void PushResetButton()
- {
- this.m_MoneySetting.SetMoneyUI(this.m_MoneySetting.MinValue, false);
- }
- public void PushMaxButton()
- {
- this.m_MoneySetting.SetMoneyUI(this.m_MoneySetting.MaxValue, false);
- }
- public void FadeIn()
- {
- if (GameMain.Instance.CharacterMgr.status.money < this.m_MoneySetting.MinValue * (long)this.m_CoinRate)
- {
- string messageTerm = string.Format("SceneCasino/ダイアログ/換金するには最低でも資金が必用です", this.m_MoneySetting.MinValue * (long)this.m_CoinRate);
- GameMain.Instance.SysDlg.ShowFromLanguageTerm(messageTerm, new string[]
- {
- string.Format("{0:#,##0}", this.m_MoneySetting.MinValue * (long)this.m_CoinRate)
- }, SystemDialog.TYPE.OK, null, null);
- return;
- }
- if (GameMain.Instance.CharacterMgr.status.casinoCoin >= 999999L - this.m_MoneySetting.MinValue)
- {
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("SceneCasino/ダイアログ/これ以上換金できません", null, SystemDialog.TYPE.OK, null, null);
- return;
- }
- if (this.FadeInStartAction != null)
- {
- this.FadeInStartAction();
- }
- base.gameObject.SetActive(true);
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_MyCanvas, false, this.m_FadeTime, this.FadeInEndAction, true, true));
- }
- private CanvasGroup m_MyCanvas;
- [SerializeField]
- private int m_CoinRate = 100;
- [SerializeField]
- private float m_FadeTime = 0.5f;
- [SerializeField]
- [Header("このUIを呼び出すボタン")]
- private Button m_ExchangeButton;
- [SerializeField]
- [Header("所持金表示UI")]
- private Text m_MoneyUI;
- [SerializeField]
- [Header("カジノコイン表示UI")]
- private Text m_CoinUI;
- [SerializeField]
- [HideInInspector]
- private MoneySetttingUI m_MoneySetting;
- [SerializeField]
- [HideInInspector]
- private Button m_OKButton;
- [SerializeField]
- [HideInInspector]
- private Button m_CancelButton;
- public Action FadeInStartAction;
- public Action FadeInEndAction;
- public Action FadeOutStartAction;
- public Action FadeOutEndAction;
- [SerializeField]
- [Header("レート表示UI")]
- private Text m_RateText;
- [SerializeField]
- [Header("残額UI")]
- private Text m_BalanceText;
- [SerializeField]
- [Header("現コイン表示UI")]
- private Text m_CurrentCoin;
- }
|