您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

91 行
2.3 KiB

  1. using System;
  2. using CIG;
  3. using CIG.Translation;
  4. using SUISS.Core;
  5. using SUISSEngine;
  6. using UnityEngine;
  7. public class BuyMoreCurrencyButton : MonoBehaviour
  8. {
  9. public void OnButtonClicked()
  10. {
  11. if (this._data != null && this._data.Callback != null)
  12. {
  13. BuyMoreCurrencyButton.BuyMoreCurrency data = this._data;
  14. this._data = null;
  15. data.Callback(data);
  16. }
  17. }
  18. public void Init(BuyMoreCurrencyButton.BuyMoreCurrency data)
  19. {
  20. if (this._data != data)
  21. {
  22. this._data = data;
  23. bool flag = this._data.Currency.Contains("Gold");
  24. bool flag2 = this._data.Currency.Contains("Cash");
  25. this._goldContainer.SetActive(flag);
  26. this._cashContainer.SetActive(flag2);
  27. this._plusContainer.SetActive(flag && flag2);
  28. this._goldAmountLabel.LocalizedString = Localization.Concat(new ILocalizedString[]
  29. {
  30. Localization.Integer(this._data.Currency.GetValue("Gold")),
  31. this._data.Price
  32. });
  33. this._cashAmountLabel.LocalizedString = Localization.Concat(new ILocalizedString[]
  34. {
  35. Localization.Integer(this._data.Currency.GetValue("Cash")),
  36. this._data.Price
  37. });
  38. }
  39. if (this._data.IsIAP)
  40. {
  41. SingletonMonobehaviour<CIGGameStats>.Instance.AddIAPViewed();
  42. }
  43. }
  44. [SerializeField]
  45. private GameObject _cashContainer;
  46. [SerializeField]
  47. private GameObject _plusContainer;
  48. [SerializeField]
  49. private GameObject _goldContainer;
  50. [SerializeField]
  51. private LocalizedText _cashAmountLabel;
  52. [SerializeField]
  53. private LocalizedText _goldAmountLabel;
  54. private BuyMoreCurrencyButton.BuyMoreCurrency _data;
  55. public class BuyMoreCurrency
  56. {
  57. public BuyMoreCurrency(CIG3StoreProduct storeProduct, Currencies curr, Action<BuyMoreCurrencyButton.BuyMoreCurrency> callback, ILocalizedString price = null)
  58. {
  59. this.StoreProduct = storeProduct;
  60. this.Currency = curr;
  61. this.Price = (price ?? Localization.EmptyLocalizedString);
  62. this.Callback = callback;
  63. }
  64. public CIG3StoreProduct StoreProduct { get; private set; }
  65. public bool IsIAP
  66. {
  67. get
  68. {
  69. return this.StoreProduct != null;
  70. }
  71. }
  72. public Currencies Currency { get; private set; }
  73. public ILocalizedString Price { get; private set; }
  74. public Action<BuyMoreCurrencyButton.BuyMoreCurrency> Callback { get; private set; }
  75. }
  76. }