using System; using CIG.Translation; using CIGEnums; using SUISS.Core; using SUISSEngine; using UnityEngine; using UnityEngine.UI; public class BuyOneBuildingGetOneFreeItem : MonoBehaviour { public void UpdateInfo(CIGBuilding building, bool isFreeItem, Action onClick) { this._onClick = delegate() { onClick(building); }; GridTile tile = building.tile; this._frameImage.sprite = SingletonMonobehaviour.Instance.GetAsset((SurfaceType)tile.requiredGridType); this._buildingTopImage.sprite = tile.spriteRenderer.sprite; bool flag = tile.bottomRenderer != null; this._buildingBottomImage.gameObject.SetActive(flag); if (flag) { this._buildingBottomImage.sprite = tile.bottomRenderer.sprite; } this._buildingText.LocalizedString = building.LocalName; Currencies purchasePrice = building.PurchasePrice; if (purchasePrice.ContainsApproximate("Cash")) { this._costIcon.sprite = SingletonMonobehaviour.Instance.GetAsset(UISpriteType.CashSmall); this._costText.LocalizedString = Localization.Integer(purchasePrice.GetValue("Cash")); } else if (purchasePrice.ContainsApproximate("Gold")) { this._costIcon.sprite = SingletonMonobehaviour.Instance.GetAsset(UISpriteType.GoldSmall); this._costText.LocalizedString = Localization.Integer(purchasePrice.GetValue("Gold")); } this._freeBannerObject.SetActive(isFreeItem); this._costStripeObject.SetActive(isFreeItem); } public void OnItemClicked() { if (this._onClick != null) { Action onClick = this._onClick; this._onClick = null; onClick(); } } [SerializeField] private Image _frameImage; [SerializeField] private Image _buildingTopImage; [SerializeField] private Image _buildingBottomImage; [SerializeField] private LocalizedText _buildingText; [SerializeField] private Image _costIcon; [SerializeField] private LocalizedText _costText; [SerializeField] private GameObject _freeBannerObject; [SerializeField] private GameObject _costStripeObject; private Action _onClick; }