using asap.core; using cfg; using GameCore; using System.Collections.Generic; using System; using TMPro; using UnityEngine; public class GiftPopupPanel_8 : GiftPopupPanel { protected TriggerPackManager packManager; TMP_Text txt_packName; protected override void Awake() { base.Awake(); Transform text_title = transform.Find("root/text_title"); txt_packName = text_title?.GetComponent(); } protected override void Start() { base.Start(); btn_close.onClick.AddListener(OnClickClose); SetData(); SetTriggerPackTimer(); } protected virtual void SetPack() { int vipLevel = GContext.container.Resolve().PriceLv; int packIDA = packManager.VIPPackList[vipLevel][0]; EnergyDef energyDef = _tables.TbEnergyDef.DataList[GContext.container.Resolve().magnification]; int packIDB = energyDef.PackID; if (packIDA > packIDB + 2) { packIDA = packIDB + 2; } else if (packIDA < packIDB) { packIDA = packIDB; } pack = _tables.TbPack.GetOrDefault(packIDA); } public void SetData() { int id = 4000011; packManager = _tables.TbTriggerPackManager.GetOrDefault(id); SetPack(); iAPItemList = _tables.TbIAPItemList.GetOrDefault(pack.IAPID); itemDatas = GContext.container.Resolve().GetItemDataByDropIdAndTypeLureInflation(null, pack.DropID); SetShowData(); SKUDetailDataEvent sKUDetailDataEvent = new SKUDetailDataEvent(iAPItemList); GContext.Publish(sKUDetailDataEvent); text_buy.text = sKUDetailDataEvent.price; tag_more.SetActive(pack.Rebate > 0.01); text_best.text = LocalizationMgr.GetFormatTextValue("UI_FishingShopPanel_2", (pack.Rebate * 100).ToString("F0")); text_time.text = ConvertTools.ConvertTime2(0, 24, 0, 0); if (txt_packName != null) { txt_packName.text = LocalizationMgr.GetText(pack.Title_l10n_key); } } protected override ShopBuyTypeData GetShopBuyTypeData() { ShopBuyTypeData shopBuyTypeData = new ShopBuyTypeData(); shopBuyTypeData.type = ShopBuyType.None; return shopBuyTypeData; } protected override void OnBuySuccess() { OnClickClose(); } public async void SetTriggerPackTimer() { DateTime dateTime = ZZTimeHelper.UtcNow().UtcNowOffset(); DateTime dateTime1 = dateTime.AddDays(1).Date; while (this != null && dateTime.Ticks < dateTime1.Ticks) { TimeSpan now = dateTime1 - dateTime; text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds); await System.Threading.Tasks.Task.Delay(1000); dateTime.AddSeconds(1); } if (this != null && dateTime.Ticks >= dateTime1.Ticks) { SetTriggerPackTimer(); } } protected virtual void OnClickClose() { UIManager.Instance.DestroyUI(UITypes.GiftPopupPanel_8); GContext.Publish(new GiftPopupPanelEnergyEvent { isClose = true }); } }