Files
MinFt/Client/Assets/Scripts/UI/RewardPopup/RewardNormal1.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

152 lines
4.0 KiB
C#

using asap.core;
using cfg;
using game;
using Game;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class RewardNormal1 : RewardPopupBase
{
public RewardNormal reward;
public Button btn_next;
public Button btn_all;
public RewardItemNew rewardNew;
public RewardItemNew rewardNewShow;
public TMP_Text text_title;
public GameObject[] _lights;
public float showTime = 0.3f;
int curIndex;
int allCount;
List<ItemData> itemDatas;
ItemData curItemData;
bool isClose;
bool isClickClose;
bool text_title_restore = false;
private void Start()
{
btn_next.onClick.AddListener(OnClickNext);
btn_all.onClick.AddListener(OnClickAll);
}
public void InitRestore(List<ItemData> dropItems)
{
text_title_restore = true;
text_title.text = LocalizationMgr.GetText("UI_RewardPopupPanel_9");
Init(dropItems);
}
public void InitAsync(List<ItemData> itemDatas)
{
text_title_restore = false;
text_title.text = LocalizationMgr.GetText("UI_FishingRewardPanel_101002");
Init(itemDatas);
}
public void Init(List<ItemData> itemDatas)
{
this.itemDatas = itemDatas;
InitResource(itemDatas);
allCount = itemDatas.Count;
curIndex = 0;
SetData();
}
async void SetData()
{
int audioName = curIndex % 4 + 1;
GContext.Publish(new EventUISound($"audio_ui_getreward_{audioName}"));
isClickClose = false;
isClose = false;
curItemData = itemDatas[curIndex];
rewardNew.SetData(curItemData);
rewardNew.PlayOpen("reward_common1_open");
float showCount = curItemData.count;
ItemShow itemShow = GContext.container.Resolve<Tables>().TbItemShow.GetOrDefault(curItemData.id);
int light_index = 1;
if (itemShow != null)
{
light_index = 0;
if (itemShow.Id == 1002)
{
showCount = (showCount / GContext.container.Resolve<PlayerItemData>().ExtraCoinMag());
}
for (int i = itemShow.Count.Count - 1; i >= 0; i--)
{
if (showCount > itemShow.Count[i])
{
light_index = i + 1;
break;
}
}
}
if (light_index >= _lights.Length)
{
light_index = _lights.Length - 1;
}
for (int i = 0; i < _lights.Length; i++)
{
_lights[i].SetActive(i == light_index);
}
receive.SetActive(false);
receive.SetActive(true);
curIndex++;
if (curIndex >= allCount)
{
btn_all.gameObject.SetActive(false);
}
//if (curItemData.id == 1001 || curItemData.id == 1002 || curItemData.id == 1005)
//{
await Awaiters.Seconds(showTime);
rewardNewShow.SetData(curItemData, false);
await rewardNewShow.ParticleAttractor(true);
if (isClickClose)
{
GContext.Publish(new ShowData(RewardType.Destroy));
}
//}
isClose = true;
}
void OnClickNext()
{
if (curIndex >= allCount)
{
receive.SetActive(false);
if (isClose)
{
GContext.Publish(new ShowData(RewardType.Destroy));
}
else
{
isClickClose = true;
}
return;
}
SetData();
}
void OnClickAll()
{
gameObject.SetActive(false);
reward.gameObject.SetActive(true);
var allItemDatas = new List<ItemData>();
for (int i = curIndex; i < allCount; i++)
{
allItemDatas.Add(itemDatas[i]);
}
if (text_title_restore)
{
reward.InitRestore(allItemDatas);
}
else
{
reward.InitAsync(allItemDatas, null);
}
}
}