using asap.core; using game; using GameCore; using System; using System.Collections.Generic; public class GiftPopupPanel_7 : GiftPopupPanel { protected string Type = "CollectingTarget"; FishingEventData _fishingEventData; List> VIPPackList; int allCount = 0; int buyCount = 0; protected override void Awake() { base.Awake(); _fishingEventData = GContext.container.Resolve(); } protected override void Start() { VIPPackList = _fishingEventData.VIPPackList; base.Start(); btn_close.onClick.AddListener(OnClickClose); Init(); SetTriggerPackTimer(); } void Init() { SetData(); } public void SetData() { int vipLevel = GContext.container.Resolve().GetVIPLevel(Type); if (VIPPackList != null && VIPPackList.Count > vipLevel) { allCount = VIPPackList[vipLevel].Count; buyCount = GContext.container.Resolve().GetCollectingTargetCount(); if (buyCount >= allCount) { OnClickClose(); return; } pack = _tables.TbPack.GetOrDefault(VIPPackList[vipLevel][buyCount]); iAPItemList = _tables.TbIAPItemList.GetOrDefault(pack.IAPID); itemDatas = GContext.container.Resolve().GetItemDataByDropIdAndType(pack.DropID); SetShowData(); SKUDetailDataEvent sKUDetailDataEvent = new SKUDetailDataEvent(iAPItemList); GContext.Publish(sKUDetailDataEvent); text_buy.text = sKUDetailDataEvent.price; tag_more.SetActive(pack.Rebate > 0.0001); text_best.text = LocalizationMgr.GetFormatTextValue("UI_FishingShopPanel_2", pack.Rebate * 100); } else { OnClickClose(); } } protected override ShopBuyTypeData GetShopBuyTypeData() { ShopBuyTypeData shopBuyTypeData = new ShopBuyTypeData(); shopBuyTypeData.type = ShopBuyType.EventPack; shopBuyTypeData.ID = _fishingEventData.GetEtDropAfterDropDic(0); return shopBuyTypeData; } protected override async void OnSuccess() { GContext.container.Resolve().AddCollectingTargetCount(); OnClickClose(); await System.Threading.Tasks.Task.Delay(1000); GContext.container.Resolve().ShowCTGift(); } protected override async void OnBuySuccess() { OnClickClose(); await System.Threading.Tasks.Task.Delay(1000); GContext.container.Resolve().ShowCTGift(); } public async void SetTriggerPackTimer() { DateTime dateTime = ZZTimeHelper.UtcNow().UtcNowOffset(); DateTime dateTime1 = dateTime.AddDays(1); DateTime endTime = _fishingEventData.GetCollectingTargetEndTime(); while (this != null && dateTime.Ticks < dateTime1.Ticks) { TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset(); if (now.TotalSeconds < 0) { OnClickClose(); } text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds); await System.Threading.Tasks.Task.Delay(1000); dateTime.AddSeconds(1); } } protected override void SetShowData() { base.SetShowData(); Remaining.text = LocalizationMgr.GetFormatTextValue("UI_FishingShopPanel_1", allCount - buyCount, allCount); } protected void OnClickClose() { UIManager.Instance.DestroyUI(UITypes.GiftPopupPanel_7); } }