Files
MinFt/Client/Assets/Scripts/UI/Shop/GiftPopupPanel.cs
Liubing\LB 3d8d4d18f3 first commit
先修复一下,错误的场景

删除不必要的钓场资产

修复into场景

update:更新meta文件,修复报错

update:修复资源

修复第一章节建造

修复建造第三章

update:删除多余内容

update:更新README.md

update:还原图标

update:更新README

update:更新配置
2026-04-28 02:17:22 +08:00

106 lines
3.3 KiB
C#

using asap.core;
using cfg;
using game;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GiftPopupPanel : MonoBehaviour
{
protected GiftRewardAttached giftRewardAttached3;
protected GiftRewardAttached giftRewardAttached4;
protected Tables _tables;
//Button btn_mask;
protected Button btn_close;
protected Button btn_buy;
protected TMP_Text text_buy;
protected TMP_Text text_time;
protected GameObject tag_more;
protected TMP_Text text_best;
protected TMP_Text Remaining;
protected Pack pack;
protected IAPItemList iAPItemList;
protected List<ItemData> itemDatas = new List<ItemData>();
private void Reset()
{
Awake();
}
protected virtual void Awake()
{
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
btn_buy = transform.Find("root/btn_buy/btn_green").GetComponent<Button>();
text_buy = transform.Find("root/btn_buy/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
text_time = transform.Find("root/text_time").GetComponent<TMP_Text>();
giftRewardAttached3 = transform.Find("root/reward_3").GetComponent<GiftRewardAttached>();
giftRewardAttached4 = transform.Find("root/reward_4").GetComponent<GiftRewardAttached>();
tag_more = transform.Find("root/tag_more").gameObject;
text_best = transform.Find("root/tag_more/text_best").GetComponent<TMP_Text>();
Remaining = transform.Find("root/text_remaining").GetComponent<TMP_Text>();
_tables = GContext.container.Resolve<Tables>();
}
protected virtual void Start()
{
btn_buy.onClick.AddListener(OnBuy);
}
async void OnBuy()
{
btn_buy.enabled = false;
if (iAPItemList == null)
{
GContext.Publish(new ShowData(itemDatas));
GContext.container.Resolve<PlayerItemData>().AddItem(itemDatas, null);
GContext.Publish(new ShowData());
OnSuccess();
}
else
{
ShopBuyTypeData shopBuyTypeData = GetShopBuyTypeData();
bool Result = await GContext.container.Resolve<PlayerShopData>().OnBuy(pack.DropID, shopBuyTypeData, iAPItemList, itemDatas);
if (Result)
{
OnBuySuccess();
}
}
btn_buy.enabled = true;
}
protected virtual ShopBuyTypeData GetShopBuyTypeData()
{
ShopBuyTypeData shopBuyTypeData = new ShopBuyTypeData();
shopBuyTypeData.type = ShopBuyType.ShopPackDailyBuy;
return shopBuyTypeData;
}
protected virtual void OnSuccess()
{
}
protected virtual void OnBuySuccess()
{
}
protected virtual void SetShowData()
{
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);
}
}