|
@@ -3,6 +3,8 @@ using FairyGUI;
|
|
|
using System.Collections.Generic;
|
|
|
using UI.Main;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.PlayerLoop;
|
|
|
+
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
public class StoryChapterListView : BaseWindow
|
|
@@ -12,6 +14,7 @@ namespace GFGGame
|
|
|
private int subType = ConstInstanceZonesSubType.Normal;
|
|
|
private List<StoryChapterCfg> _chapterCfgs;
|
|
|
private int chapterIndex = 1;
|
|
|
+ private int rewardID = 0;
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
if (_ui != null)
|
|
@@ -50,6 +53,17 @@ namespace GFGGame
|
|
|
|
|
|
|
|
|
}
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+ EventAgent.AddEventListener(ConstMessage.STORYCHAPREDUPDATE, UpdateChapterRed);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.STORYCHAPREDUPDATE,UpdateChapterRed);
|
|
|
+ }
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
@@ -148,6 +162,7 @@ namespace GFGGame
|
|
|
{
|
|
|
GObject chapterItem = context.sender as GObject;
|
|
|
int chapterID = (int)chapterItem.data;
|
|
|
+ rewardID = chapterID;
|
|
|
int status;
|
|
|
if(MainStoryDataManager.ChapterRewardStatusDic.TryGetValue(chapterID,out status) && status == 1)
|
|
|
{
|
|
@@ -155,11 +170,28 @@ namespace GFGGame
|
|
|
bool result = await MainStorySProxy.GetStoryBonusReward(chapterID);
|
|
|
if(result)
|
|
|
{
|
|
|
+ EventAgent.DispatchEvent(ConstMessage.STORYCHAPREDUPDATE);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void UpdateChapterRed()
|
|
|
+ {
|
|
|
+ //UpdateList();
|
|
|
+ foreach (var item in ChapterRewardCfgArray.Instance.dataArray)
|
|
|
+ {
|
|
|
+ if (item.chapterId == rewardID)
|
|
|
+ {
|
|
|
+ UI_ListChapterItem listItem = UI_ListChapterItem.Proxy(_ui.m_listChapter.GetChildAt(item.id%10));
|
|
|
+ listItem.m_content.m_reward.target.visible = false;
|
|
|
+ RedDotController.Instance.SetComRedDot(listItem.m_content.m_reward.target, false, "");
|
|
|
+ UI_ListChapterItem.ProxyEnd();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void ListChapterItem(int index, GObject item)
|
|
|
{
|
|
|
if (index == 0 || index == _ui.m_listChapter.numItems - 1)
|
|
@@ -290,13 +322,13 @@ namespace GFGGame
|
|
|
int status;
|
|
|
if (MainStoryDataManager.ChapterRewardStatusDic.TryGetValue(chapterID, out status))
|
|
|
{
|
|
|
- List<ChapterRewardCfg> chapterReward = ChapterRewardCfgArray.Instance.GetCfgsBychapterId(chapterID);
|
|
|
- listItem.m_content.m_reward.m_rewardIcon.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(chapterReward[0].bonusOnceArr[0][0]).res, "png");
|
|
|
- listItem.m_content.m_reward.m_rewardNum.text = string.Format("x{0}", chapterReward[0].bonusOnceArr[0][1].ToString());
|
|
|
+ ChapterRewardCfg chapterReward = ChapterRewardCfgArray.Instance.GetCfgBychapterId(chapterID);
|
|
|
+ listItem.m_content.m_reward.m_rewardIcon.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(chapterReward.bonusOnceArr[0][0]).res, "png");
|
|
|
+ listItem.m_content.m_reward.m_rewardNum.text = string.Format("x{0}", chapterReward.bonusOnceArr[0][1].ToString());
|
|
|
}
|
|
|
if (MainStoryDataManager.ChapterRewardStatusDic.TryGetValue(chapterID, out status) && status == 1)
|
|
|
{
|
|
|
- RedDotController.Instance.SetComRedDot(listItem.m_content.m_reward.target, true, "");
|
|
|
+ RedDotController.Instance.SetComRedDot(listItem.m_content.m_reward.target, true, "",-50,20);
|
|
|
}
|
|
|
else if (MainStoryDataManager.ChapterRewardStatusDic.TryGetValue(chapterID, out status) && status == 2)
|
|
|
{
|
|
@@ -307,7 +339,7 @@ namespace GFGGame
|
|
|
{
|
|
|
listItem.m_content.m_reward.target.onClick.Add(OnClickReward);
|
|
|
}
|
|
|
- listItem.m_content.m_reward.target.data = chapterCfg.id;
|
|
|
+ listItem.m_content.m_reward.target.data = chapterID;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -336,6 +368,11 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //暂定精英关卡不显示
|
|
|
+ if (subType == 1)
|
|
|
+ {
|
|
|
+ listItem.m_content.m_reward.target.visible = false;
|
|
|
+ }
|
|
|
UI_ListChapterItem.ProxyEnd();
|
|
|
}
|
|
|
if (isView)
|