备份CatanBuilding瘦身独立工程
This commit is contained in:
111
Assets/Scripts/UI/Shop/GiftPopupPanel_7.cs
Normal file
111
Assets/Scripts/UI/Shop/GiftPopupPanel_7.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
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<List<int>> VIPPackList;
|
||||
int allCount = 0;
|
||||
int buyCount = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
_fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
}
|
||||
|
||||
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<TriggerPackData>().GetVIPLevel(Type);
|
||||
if (VIPPackList != null && VIPPackList.Count > vipLevel)
|
||||
{
|
||||
allCount = VIPPackList[vipLevel].Count;
|
||||
buyCount = GContext.container.Resolve<FishingEventData>().GetCollectingTargetCount();
|
||||
if (buyCount >= allCount)
|
||||
{
|
||||
OnClickClose();
|
||||
return;
|
||||
}
|
||||
pack = _tables.TbPack.GetOrDefault(VIPPackList[vipLevel][buyCount]);
|
||||
|
||||
iAPItemList = _tables.TbIAPItemList.GetOrDefault(pack.IAPID);
|
||||
itemDatas = GContext.container.Resolve<PlayerItemData>().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<FishingEventData>().AddCollectingTargetCount();
|
||||
OnClickClose();
|
||||
await System.Threading.Tasks.Task.Delay(1000);
|
||||
GContext.container.Resolve<FishingEventData>().ShowCTGift();
|
||||
}
|
||||
protected override async void OnBuySuccess()
|
||||
{
|
||||
OnClickClose();
|
||||
await System.Threading.Tasks.Task.Delay(1000);
|
||||
GContext.container.Resolve<FishingEventData>().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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user