2024-09-02 17:12:12 +08:00
|
|
|
|
using cfg.ActorCfg;
|
|
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
using Gameplay;
|
|
|
|
|
|
using Gameplay.Effect;
|
|
|
|
|
|
using Gameplay.Level;
|
|
|
|
|
|
using NLDPB;
|
|
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
using System;
|
2024-01-08 13:13:35 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using Button = UnityEngine.UI.Button;
|
|
|
|
|
|
using Image = UnityEngine.UI.Image;
|
|
|
|
|
|
|
|
|
|
|
|
public class UI_GetItemWindowController : UIWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
//UI GameObj
|
|
|
|
|
|
///Auto Gen Start///
|
|
|
|
|
|
public Image Image_BG;
|
|
|
|
|
|
public Image Image_ItemPic;
|
|
|
|
|
|
public Image Image_Bar;
|
|
|
|
|
|
public TMP_Text Text_ItemNum;
|
|
|
|
|
|
public TMP_Text Text_IteamName;
|
|
|
|
|
|
public TMP_Text Text_Continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///Auto Gen End///
|
2024-09-02 17:12:12 +08:00
|
|
|
|
|
|
|
|
|
|
private List<ListItem> mItems;
|
|
|
|
|
|
//分布展示奖励内容
|
|
|
|
|
|
private int stepIndex = 0;
|
|
|
|
|
|
//用于表示不同奖励列表的类型
|
|
|
|
|
|
private List<ItemSource> itemsType;
|
2024-07-19 16:30:39 +08:00
|
|
|
|
|
2024-07-25 14:07:22 +08:00
|
|
|
|
private EShowType _showType;
|
|
|
|
|
|
|
2024-07-19 16:30:39 +08:00
|
|
|
|
private GameObject _itemTemp;
|
|
|
|
|
|
private GameObject _scrollView;
|
|
|
|
|
|
private GameObject _scrollContent;
|
2024-07-31 17:10:02 +08:00
|
|
|
|
private GameObject _goMaskBg;
|
2024-08-05 16:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
private Action _callBackFunc;
|
2024-07-25 14:07:22 +08:00
|
|
|
|
|
|
|
|
|
|
public enum EShowType
|
|
|
|
|
|
{
|
|
|
|
|
|
Normal,
|
|
|
|
|
|
StorySettle
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private struct Param
|
|
|
|
|
|
{
|
|
|
|
|
|
public EShowType type;
|
2024-09-02 17:12:12 +08:00
|
|
|
|
public List<ListItem> listItem;
|
|
|
|
|
|
public List<ItemSource> itemType;
|
2024-08-05 16:06:48 +08:00
|
|
|
|
public Action cb;
|
2024-07-25 14:07:22 +08:00
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
public Param(EShowType Etype, List<ListItem> list, List<ItemSource> itemType, Action callBack = null)
|
2024-07-25 14:07:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
type = Etype;
|
|
|
|
|
|
listItem = list;
|
2024-09-02 17:12:12 +08:00
|
|
|
|
this.itemType = itemType;
|
2024-08-05 16:06:48 +08:00
|
|
|
|
cb = callBack;
|
2024-07-25 14:07:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-01-08 13:13:35 +08:00
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
#region API
|
2024-04-09 19:40:43 +08:00
|
|
|
|
/// <summary>
|
2024-09-02 17:12:12 +08:00
|
|
|
|
/// 打开奖励获取界面,通用方法,用于单个道具
|
2024-04-09 19:40:43 +08:00
|
|
|
|
/// </summary>
|
2024-08-05 16:06:48 +08:00
|
|
|
|
public static async UniTask<UIWindow> Open(ItemCounts itemCounts, EShowType type = EShowType.Normal, Action cb = null)
|
2024-04-09 19:40:43 +08:00
|
|
|
|
{
|
2024-09-02 17:12:12 +08:00
|
|
|
|
List<ListItem> list = new();
|
2024-06-17 14:33:34 +08:00
|
|
|
|
ListItem itemList = new(itemCounts);
|
2024-09-02 17:12:12 +08:00
|
|
|
|
list.Add(itemList);
|
2024-07-25 14:07:22 +08:00
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
List<ItemSource> source = new();
|
|
|
|
|
|
source.Add(ItemSource.Max);//Max不显示奖励类型
|
2024-09-18 16:56:08 +08:00
|
|
|
|
|
|
|
|
|
|
int rewardCnt = 0;
|
|
|
|
|
|
foreach(var itemL in list)
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int i = 0; i < itemL.Counts.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
rewardCnt += itemL.Counts[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(rewardCnt == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("奖励数量为0,不显示奖励界面");
|
|
|
|
|
|
cb?.Invoke();
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-09-02 17:12:12 +08:00
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_GetItemWindow, new Param(type, list, source, cb));
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 多个道具的奖励领取,此时不显示奖励类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="itemList"></param>
|
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
|
/// <param name="cb"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-08-05 16:06:48 +08:00
|
|
|
|
public static async UniTask<UIWindow> Open(ListItem itemList, EShowType type = EShowType.Normal, Action cb = null)
|
2024-07-25 14:07:22 +08:00
|
|
|
|
{
|
2024-09-02 17:12:12 +08:00
|
|
|
|
List<ListItem> list = new();
|
|
|
|
|
|
list.Add(itemList);
|
|
|
|
|
|
|
|
|
|
|
|
List<ItemSource> source = new();
|
|
|
|
|
|
source.Add(ItemSource.Max);//Max不显示奖励类型
|
2024-09-18 16:56:08 +08:00
|
|
|
|
|
|
|
|
|
|
int rewardCnt = 0;
|
|
|
|
|
|
foreach (var itemL in list)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < itemL.Counts.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
rewardCnt += itemL.Counts[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (rewardCnt == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("奖励数量为0,不显示奖励界面");
|
|
|
|
|
|
cb?.Invoke();
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-09-02 17:12:12 +08:00
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_GetItemWindow, new Param(type, list, source, cb));
|
2024-06-17 14:33:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 多个道具的奖励领取,允许分布显示奖励内容 ;
|
|
|
|
|
|
/// 此时传入EShowType.StorySettle,可以显示奖励类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="itemList"></param>
|
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
|
/// <param name="cb"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-08-05 16:06:48 +08:00
|
|
|
|
public static async UniTask<UIWindow> Open(ItemList itemList, EShowType type = EShowType.Normal, Action cb = null)
|
2024-06-17 14:33:34 +08:00
|
|
|
|
{
|
2024-09-02 17:12:12 +08:00
|
|
|
|
GetRewardsItems(itemList, out List<ListItem> list, out List<ItemSource> source);
|
|
|
|
|
|
|
2024-09-18 16:56:08 +08:00
|
|
|
|
int rewardCnt = 0;
|
|
|
|
|
|
foreach (var itemL in list)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < itemL.Counts.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
rewardCnt += itemL.Counts[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (rewardCnt == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("奖励数量为0,不显示奖励界面");
|
|
|
|
|
|
cb?.Invoke();
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-09-20 13:26:46 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < item.Counts.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (item.Counts[i] == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
CommonUtils.MainLevelRewardEvent(item.Ids[i].ToString(), item.Counts[i]);
|
|
|
|
|
|
DebugUtil.Log("奖励打点:" + item.Ids[i] + " " + item.Counts[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-09-02 17:12:12 +08:00
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_GetItemWindow, new Param(type, list, source, cb));
|
2024-04-09 19:40:43 +08:00
|
|
|
|
}
|
2024-09-02 17:12:12 +08:00
|
|
|
|
#endregion
|
2024-04-09 19:40:43 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-09-02 17:12:12 +08:00
|
|
|
|
/// 奖励分类
|
2024-04-09 19:40:43 +08:00
|
|
|
|
/// </summary>
|
2024-09-02 17:12:12 +08:00
|
|
|
|
/// <param name="itemList"></param>
|
|
|
|
|
|
/// <param name="list"></param>
|
|
|
|
|
|
/// <param name="source"></param>
|
|
|
|
|
|
static void GetRewardsItems(ItemList itemList,out List<ListItem> list,out List<ItemSource> source)
|
|
|
|
|
|
{
|
2024-09-06 18:03:36 +08:00
|
|
|
|
DebugUtil.Log("显示奖励种类数目:" + itemList.Lists.Length);
|
2024-09-02 17:12:12 +08:00
|
|
|
|
list = new();
|
|
|
|
|
|
source = new();
|
|
|
|
|
|
var lists = itemList.Lists;
|
|
|
|
|
|
|
|
|
|
|
|
//首次奖励
|
|
|
|
|
|
var itemFirstList = CommonUtils.GetItemBySource(ItemSource.LevelPassFirst, lists);
|
|
|
|
|
|
if (itemFirstList != null && itemFirstList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var itemFirst = new ListItem(CommonUtils.GetFilterRewardItemList(itemFirstList));
|
|
|
|
|
|
#if DEVELOPMENT_BUILD || DEBUG
|
|
|
|
|
|
DebugUtil.Log("显示首次奖励种类数目:" + itemFirstList.Count);
|
|
|
|
|
|
foreach (var it in itemFirstList)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("首次奖励:" + it.ID + " " + it.Count);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
list.Add(itemFirst);
|
|
|
|
|
|
source.Add(ItemSource.LevelPassFirst);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//常规奖励
|
|
|
|
|
|
var itemFixed = CommonUtils.GetItemBySource(ItemSource.LevelPassNormal, lists);
|
|
|
|
|
|
if (itemFixed != null && itemFixed.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var itemFix = new ListItem(CommonUtils.GetFilterRewardItemList(itemFixed));
|
|
|
|
|
|
#if DEVELOPMENT_BUILD || DEBUG
|
|
|
|
|
|
DebugUtil.Log("显示常规奖励种类数目:" + itemFixed.Count);
|
|
|
|
|
|
foreach (var it in itemFixed)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("常规奖励:" + it.ID + " " + it.Count);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
list.Add(itemFix);
|
|
|
|
|
|
source.Add(ItemSource.LevelPassNormal);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//星级奖励
|
|
|
|
|
|
var itemStarRewards = new List<Item>();
|
|
|
|
|
|
var itemStar1 = CommonUtils.GetItemBySource(ItemSource.LevelPassStar1, lists);
|
|
|
|
|
|
if (itemStar1 != null && itemStar1.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonUtils.CombineListItem(itemStarRewards, CommonUtils.GetFilterRewardItemList(itemStar1));
|
|
|
|
|
|
}
|
|
|
|
|
|
var itemStar2 = CommonUtils.GetItemBySource(ItemSource.LevelPassStar2, lists);
|
|
|
|
|
|
if (itemStar2 != null && itemStar2.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonUtils.CombineListItem(itemStarRewards, CommonUtils.GetFilterRewardItemList(itemStar2));
|
|
|
|
|
|
}
|
|
|
|
|
|
var itemStar3 = CommonUtils.GetItemBySource(ItemSource.LevelPassStar3, lists);
|
|
|
|
|
|
if (itemStar3 != null && itemStar3.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonUtils.CombineListItem(itemStarRewards, CommonUtils.GetFilterRewardItemList(itemStar3));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (itemStarRewards.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var itemStar = new ListItem(itemStarRewards);
|
|
|
|
|
|
#if DEVELOPMENT_BUILD || DEBUG
|
|
|
|
|
|
DebugUtil.Log("显示星级奖励种类数目:" + itemStarRewards.Count);
|
|
|
|
|
|
foreach (var it in itemStarRewards)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("星级奖励:" + it.ID + " " + it.Count);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
list.Add(itemStar);
|
2024-09-06 18:03:36 +08:00
|
|
|
|
source.Add(ItemSource.LevelPassStar1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//章节星级奖励
|
|
|
|
|
|
var itemChapterStar = CommonUtils.GetItemBySource(ItemSource.ChapterStar, lists);
|
|
|
|
|
|
if (itemChapterStar != null && itemChapterStar.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var itemChapter = new ListItem(CommonUtils.GetFilterRewardItemList(itemChapterStar));
|
|
|
|
|
|
#if DEVELOPMENT_BUILD || DEBUG
|
|
|
|
|
|
DebugUtil.Log("显示章节星级奖励种类数目:" + itemChapterStar.Count);
|
|
|
|
|
|
foreach (var it in itemChapterStar)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("章节星级奖励:" + it.ID + " " + it.Count);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
list.Add(itemChapter);
|
2024-09-02 17:12:12 +08:00
|
|
|
|
source.Add(ItemSource.ChapterStar);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具UI图标
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private class ItemCell : UIGameObjectWrapper
|
2024-04-09 19:40:43 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具名
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textName;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-09-02 17:12:12 +08:00
|
|
|
|
/// 固定掉落标识
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject FixedDrop;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 首次掉落标识
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject FirstClearDrop;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 星级掉落标识
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject AchievementReward;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用道具类
|
2024-04-09 19:40:43 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GenericItem genericItem;
|
|
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
public ItemCell(GameObject root) : base(root)
|
2024-04-09 19:40:43 +08:00
|
|
|
|
{
|
|
|
|
|
|
textName = GetComponent<TMP_Text>("Text_IteamName");
|
2024-09-02 17:12:12 +08:00
|
|
|
|
FixedDrop = FindObj("ImageBlue");
|
|
|
|
|
|
FirstClearDrop = FindObj("ImageYellow");
|
|
|
|
|
|
AchievementReward = FindObj("ImageYellow2");
|
2024-04-09 19:40:43 +08:00
|
|
|
|
|
|
|
|
|
|
genericItem = new GenericItem(FindObj("GenericItem"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
public void SetInfo(int itemId, int count, ItemSource itemSource)
|
2024-04-09 19:40:43 +08:00
|
|
|
|
{
|
|
|
|
|
|
DataItem dataItem = TableManager.Instance.Tables.Item.Get(itemId);
|
|
|
|
|
|
if (dataItem == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"获取配置错误 id:{itemId}");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
textName.text = CommonUtils.GetLocalizeText(dataItem.NameLocal);
|
|
|
|
|
|
|
|
|
|
|
|
genericItem.SetInfo(dataItem, count);
|
|
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
FixedDrop.SetActive(itemSource == ItemSource.LevelPassNormal);
|
|
|
|
|
|
FirstClearDrop.SetActive(itemSource == ItemSource.LevelPassFirst);
|
2024-09-06 18:03:36 +08:00
|
|
|
|
AchievementReward.SetActive(itemSource == ItemSource.LevelPassStar1);
|
2024-09-02 17:12:12 +08:00
|
|
|
|
|
2024-04-09 19:40:43 +08:00
|
|
|
|
IsScaleShow = true;
|
|
|
|
|
|
}
|
2024-05-08 13:59:40 +08:00
|
|
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
|
{
|
|
|
|
|
|
genericItem.Dispose();
|
|
|
|
|
|
genericItem = null;
|
|
|
|
|
|
|
|
|
|
|
|
base.Dispose();
|
|
|
|
|
|
}
|
2024-04-09 19:40:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具列表
|
|
|
|
|
|
/// </summary>
|
2024-09-02 17:12:12 +08:00
|
|
|
|
private List<ItemCell> listItem;
|
2024-04-09 19:40:43 +08:00
|
|
|
|
|
2024-06-17 14:33:34 +08:00
|
|
|
|
public override void PreLoad(object data = null)
|
|
|
|
|
|
{
|
2024-07-25 14:07:22 +08:00
|
|
|
|
if (data != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var param = (Param)data;
|
|
|
|
|
|
mItems = param.listItem;
|
2024-09-02 17:12:12 +08:00
|
|
|
|
itemsType = param.itemType;
|
2024-07-25 14:07:22 +08:00
|
|
|
|
_showType = param.type;
|
2024-08-05 16:06:48 +08:00
|
|
|
|
_callBackFunc = param.cb;
|
2024-09-02 17:12:12 +08:00
|
|
|
|
|
|
|
|
|
|
stepIndex = 0;
|
2024-07-25 14:07:22 +08:00
|
|
|
|
}
|
2024-06-17 14:33:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-23 12:25:47 +08:00
|
|
|
|
public override void OnInit()
|
2024-01-08 13:13:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
UI_GetItemWindowBinder.GetComponents(this);
|
|
|
|
|
|
|
2024-04-09 19:40:43 +08:00
|
|
|
|
Transform tsItemRoot = FindObj("Image_BG/Goods").transform;
|
2024-07-19 16:30:39 +08:00
|
|
|
|
_scrollView = FindObj("Image_BG/ScrollView");
|
|
|
|
|
|
_itemTemp = FindObj("Image_BG/Item");
|
|
|
|
|
|
_scrollContent = FindObj("Image_BG/ScrollView/Viewport/Content");
|
2024-07-31 17:10:02 +08:00
|
|
|
|
_goMaskBg = FindObj("Image_BG/ImageMaskBg");
|
2024-04-09 19:40:43 +08:00
|
|
|
|
|
|
|
|
|
|
BindButton(GetComponent<Button>("Image_BG"), OnBgClick);
|
2024-08-29 14:31:45 +08:00
|
|
|
|
|
|
|
|
|
|
AddBgClose(OnBgClick);
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-24 16:32:38 +08:00
|
|
|
|
protected override void OnShowWindow(object data = null)
|
2024-09-18 16:50:48 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (stepIndex < mItems.Count && stepIndex < itemsType.Count)
|
|
|
|
|
|
RefreshMaterial(mItems[stepIndex], itemsType[stepIndex]);
|
|
|
|
|
|
else
|
|
|
|
|
|
DebugUtil.LogError(mItems.Count + "," + itemsType.Count + ",stepIndex: " + stepIndex + "——奖励列表为空");
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|
2024-04-09 19:40:43 +08:00
|
|
|
|
|
2024-05-08 13:59:40 +08:00
|
|
|
|
public override void OnRelease()
|
|
|
|
|
|
{
|
2024-09-02 17:12:12 +08:00
|
|
|
|
foreach (ItemCell item in listItem)
|
2024-05-08 13:59:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
item.Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
listItem.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
base.OnRelease();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 17:12:12 +08:00
|
|
|
|
private void RefreshMaterial(ListItem mItems, ItemSource type)
|
2024-01-08 13:13:35 +08:00
|
|
|
|
{
|
2024-07-19 16:30:39 +08:00
|
|
|
|
_scrollContent.transform.ClearChilds();
|
|
|
|
|
|
listItem = new(mItems.List.Count);
|
|
|
|
|
|
for (int i = 0; i < mItems.List.Count; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
var item = Instantiate(_itemTemp, _scrollContent.transform);
|
2024-09-02 17:12:12 +08:00
|
|
|
|
listItem.Add(new ItemCell(item));
|
2024-07-19 16:30:39 +08:00
|
|
|
|
}
|
2024-04-09 19:40:43 +08:00
|
|
|
|
for (int i = 0; i < listItem.Count; i++)
|
2024-01-08 13:13:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (i < mItems.Ids.Count)
|
|
|
|
|
|
{
|
2024-09-02 17:12:12 +08:00
|
|
|
|
ItemCell item = listItem[i];
|
|
|
|
|
|
item.SetInfo(mItems.Ids[i], mItems.Counts[i], type);
|
2024-04-09 19:40:43 +08:00
|
|
|
|
item.IsActive = true;
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
2024-04-09 19:40:43 +08:00
|
|
|
|
listItem[i].IsActive = false;
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|
2024-07-31 17:10:02 +08:00
|
|
|
|
|
2024-09-23 14:19:52 +08:00
|
|
|
|
//_goMaskBg.SetActive(_showType == EShowType.StorySettle);
|
2024-07-31 17:10:02 +08:00
|
|
|
|
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-09 19:40:43 +08:00
|
|
|
|
private void OnBgClick()
|
|
|
|
|
|
{
|
2024-07-25 14:07:22 +08:00
|
|
|
|
if (_showType == EShowType.StorySettle)
|
|
|
|
|
|
{
|
2024-09-02 17:12:12 +08:00
|
|
|
|
if (stepIndex < mItems.Count - 1)//有未展示完的奖励
|
|
|
|
|
|
{
|
|
|
|
|
|
stepIndex++;
|
|
|
|
|
|
RefreshMaterial(mItems[stepIndex], itemsType[stepIndex]);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
ExitFromLevel();
|
2024-07-25 14:07:22 +08:00
|
|
|
|
}
|
2024-08-05 16:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
_callBackFunc?.Invoke();
|
2024-04-09 19:40:43 +08:00
|
|
|
|
CloseWindow();
|
|
|
|
|
|
}
|
2024-09-02 17:12:12 +08:00
|
|
|
|
|
|
|
|
|
|
async void ExitFromLevel()
|
|
|
|
|
|
{
|
|
|
|
|
|
await GameSceneHelper.Instance.UnLoadSceneForRt();
|
|
|
|
|
|
AudioManager.Instance.StopAll();
|
|
|
|
|
|
LevelManager.Instance.ExitLevelDirectly();
|
|
|
|
|
|
EffectManager.instance.rootObj.SetActive(true);
|
2024-09-20 19:22:12 +08:00
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UIMissionWin);
|
2024-09-02 17:12:12 +08:00
|
|
|
|
}
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|