备份CatanBuilding瘦身独立工程
This commit is contained in:
79
Assets/Scripts/UI/Shop/GiftPopupPanel_5.cs
Normal file
79
Assets/Scripts/UI/Shop/GiftPopupPanel_5.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GiftPopupPanel_5 : GiftPopupPanel_Base
|
||||
{
|
||||
protected override int Type => 53;
|
||||
protected GiftRewardAttached giftRewardAttached3;
|
||||
protected GiftRewardAttached giftRewardAttached4;
|
||||
|
||||
Image bgImage1;
|
||||
|
||||
BgDownload bgDownload;
|
||||
protected override void InitPanel()
|
||||
{
|
||||
giftRewardAttached3 = transform.Find("root/reward_3").GetComponent<GiftRewardAttached>();
|
||||
giftRewardAttached4 = transform.Find("root/reward_4").GetComponent<GiftRewardAttached>();
|
||||
bgDownload = transform.Find("root/download").GetComponent<BgDownload>();
|
||||
|
||||
bgImage1 = transform.Find("root/mask_bg2/bg").GetComponent<Image>();
|
||||
imageData = new ShowImageData(bgImage1);
|
||||
}
|
||||
protected override void SetShowData()
|
||||
{
|
||||
var Param = packManager.Param;
|
||||
if (Param.Count > 1)
|
||||
{
|
||||
LoadBg();
|
||||
}
|
||||
if (itemDatas != null && itemDatas.Count > 0)
|
||||
{
|
||||
giftRewardAttached3.gameObject.SetActive(itemDatas.Count <= 3);
|
||||
giftRewardAttached4.gameObject.SetActive(itemDatas.Count > 3);
|
||||
if (itemDatas.Count <= 3)
|
||||
{
|
||||
giftRewardAttached3.SetData(itemDatas);
|
||||
}
|
||||
else
|
||||
{
|
||||
giftRewardAttached4.SetData(itemDatas);
|
||||
}
|
||||
}
|
||||
Remaining.text = LocalizationMgr.GetFormatTextValue("UI_FishingShopPanel_1", 1, 1);
|
||||
}
|
||||
|
||||
bool isLoading = false;
|
||||
ShowImageData imageData;
|
||||
async void LoadBg()
|
||||
{
|
||||
isLoading = true;
|
||||
ShowLoad();
|
||||
imageData.SetName(packManager.Param[1]);
|
||||
await GContext.container.Resolve<IUIService>().SetImageSprite(imageData);
|
||||
if (bgImage1 != null && packManager != null)
|
||||
{
|
||||
if (isLoading && imageData.image.sprite != null && imageData.image.sprite.name == packManager.Param[1])
|
||||
{
|
||||
isLoading = false;
|
||||
bgDownload.OnLoadSucceed();
|
||||
}
|
||||
}
|
||||
}
|
||||
async void ShowLoad()
|
||||
{
|
||||
bgDownload.gameObject.SetActive(false);
|
||||
await Awaiters.Seconds(1);
|
||||
if (isLoading)
|
||||
{
|
||||
bgDownload.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClickClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.MapPackPanel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user