|
- using System;
- using CIG;
- using CIG.Translation;
- using SUISS.Core;
- using SUISSEngine;
- using UnityEngine;
-
- public class BuyMoreCurrencyButton : MonoBehaviour
- {
- public void OnButtonClicked()
- {
- if (this._data != null && this._data.Callback != null)
- {
- BuyMoreCurrencyButton.BuyMoreCurrency data = this._data;
- this._data = null;
- data.Callback(data);
- }
- }
-
- public void Init(BuyMoreCurrencyButton.BuyMoreCurrency data)
- {
- if (this._data != data)
- {
- this._data = data;
- bool flag = this._data.Currency.Contains("Gold");
- bool flag2 = this._data.Currency.Contains("Cash");
- this._goldContainer.SetActive(flag);
- this._cashContainer.SetActive(flag2);
- this._plusContainer.SetActive(flag && flag2);
- this._goldAmountLabel.LocalizedString = Localization.Concat(new ILocalizedString[]
- {
- Localization.Integer(this._data.Currency.GetValue("Gold")),
- this._data.Price
- });
- this._cashAmountLabel.LocalizedString = Localization.Concat(new ILocalizedString[]
- {
- Localization.Integer(this._data.Currency.GetValue("Cash")),
- this._data.Price
- });
- }
- if (this._data.IsIAP)
- {
- SingletonMonobehaviour<CIGGameStats>.Instance.AddIAPViewed();
- }
- }
-
- [SerializeField]
- private GameObject _cashContainer;
-
- [SerializeField]
- private GameObject _plusContainer;
-
- [SerializeField]
- private GameObject _goldContainer;
-
- [SerializeField]
- private LocalizedText _cashAmountLabel;
-
- [SerializeField]
- private LocalizedText _goldAmountLabel;
-
- private BuyMoreCurrencyButton.BuyMoreCurrency _data;
-
- public class BuyMoreCurrency
- {
- public BuyMoreCurrency(CIG3StoreProduct storeProduct, Currencies curr, Action<BuyMoreCurrencyButton.BuyMoreCurrency> callback, ILocalizedString price = null)
- {
- this.StoreProduct = storeProduct;
- this.Currency = curr;
- this.Price = (price ?? Localization.EmptyLocalizedString);
- this.Callback = callback;
- }
-
- public CIG3StoreProduct StoreProduct { get; private set; }
-
- public bool IsIAP
- {
- get
- {
- return this.StoreProduct != null;
- }
- }
-
- public Currencies Currency { get; private set; }
-
- public ILocalizedString Price { get; private set; }
-
- public Action<BuyMoreCurrencyButton.BuyMoreCurrency> Callback { get; private set; }
- }
- }
|