|
@@ -4,6 +4,7 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
|
using UI.ActivityAfternoonTea;
|
|
|
using UI.Task;
|
|
|
+using ET;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -11,6 +12,9 @@ namespace GFGGame
|
|
|
{
|
|
|
private UI_ActivityVisitNPCUI _ui;
|
|
|
private int npcId;
|
|
|
+ private int activityId;
|
|
|
+ private bool redDot = false;
|
|
|
+ private bool canGetReward;
|
|
|
private string _currentWords;
|
|
|
private bool isNextChat = false;
|
|
|
private int indexChat;
|
|
@@ -44,7 +48,7 @@ namespace GFGGame
|
|
|
_ui.m_taskList.itemRenderer = RenderTaskList;
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
_ui.m_nextChatBtn.onClick.Add(OnClickNextChat);
|
|
|
- _ui.m_taskIcon.onClick.Add(OnClickRewardTIps);
|
|
|
+ _ui.m_taskIcon.target.onClick.Add(OnClickRewardTIps);
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
@@ -68,11 +72,21 @@ namespace GFGGame
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetSceneBgPath(ActivityVisitCfgArray.Instance.dataArray[npcId].bgRes);
|
|
|
_ui.m_name.text = ActivityVisitCfgArray.Instance.dataArray[npcId].name;
|
|
|
_ui.m_taskList.numItems = ActivityVisitCfgArray.Instance.dataArray[npcId].taskIdArr.Length;
|
|
|
+ redDot = true;
|
|
|
+ for (int i = 0; i < taskCfgs.Count; i++)
|
|
|
+ {
|
|
|
+ var taskCfg = taskCfgs[i];
|
|
|
+ if (TaskDataManager.Instance.GetTaskStateById(taskCfg.id) == 0)
|
|
|
+ {
|
|
|
+ redDot = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GetRewardState();
|
|
|
+
|
|
|
_ui.m_DialogText.m_txtName.text = ActivityVisitCfgArray.Instance.dataArray[npcId].name;
|
|
|
_ui.m_DialogText.m_txtContent.text = "";
|
|
|
_ui.m_DialogText.m_In.Play();
|
|
|
_wordTextField = null;
|
|
|
-
|
|
|
isNextChat = false;
|
|
|
indexChat = 0;
|
|
|
SetTypeWriting();
|
|
@@ -89,10 +103,45 @@ namespace GFGGame
|
|
|
{
|
|
|
ViewManager.GoBackFrom(typeof(ActivityVisitNpcView).FullName);
|
|
|
}
|
|
|
- private void OnClickRewardTIps()
|
|
|
+ private async void OnClickRewardTIps()
|
|
|
{
|
|
|
+ if(canGetReward)
|
|
|
+ {
|
|
|
+ bool result = await ActivityTeaSProxy.ReqGetNPCVisitReward(activityId, npcId);
|
|
|
+ if (!result) return;
|
|
|
+ }
|
|
|
ViewManager.Show<ReWardTipsView>(npcId);
|
|
|
}
|
|
|
+
|
|
|
+ private void GetRewardState()
|
|
|
+ {
|
|
|
+ foreach (NpcVisitProto t in MiniGameDateManager.Instance.NpcInfoList)
|
|
|
+ {
|
|
|
+ if (t.NpcId == npcId + 1)
|
|
|
+ {
|
|
|
+ activityId = t.ActivityId;
|
|
|
+ switch (t.RewrdStatus)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ canGetReward = false;
|
|
|
+ _ui.m_gotReward.visible = false;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ canGetReward = true;
|
|
|
+ _ui.m_gotReward.visible = false;
|
|
|
+ RedDotController.Instance.SetComRedDot(_ui.m_taskIcon.target, (canGetReward && redDot));
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ canGetReward = false;
|
|
|
+ _ui.m_gotReward.visible = true;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
private void RenderTaskList(int index, GObject obj)
|
|
|
{
|
|
|
UI_ActivityVIsitRewardItemUI item = UI_ActivityVIsitRewardItemUI.Proxy(obj);
|
|
@@ -146,16 +195,28 @@ namespace GFGGame
|
|
|
ViewManager.JumpToView(taskCfg.jumpId, param);
|
|
|
}
|
|
|
|
|
|
- private static void ListTaskRewardItemRender(int index, GObject obj)
|
|
|
+ private void ListTaskRewardItemRender(int index, GObject obj)
|
|
|
{
|
|
|
var rewards = (int[][])obj.parent.data;
|
|
|
UI_RewardItemUI item = UI_RewardItemUI.Proxy(obj);
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(rewards[index][0]);
|
|
|
item.m_rewardIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
item.m_rewardNum.text = rewards[index][1].ToString();
|
|
|
+ if (item.target.data == null)
|
|
|
+ {
|
|
|
+ item.target.onClick.Add(OnClickVisitRewardItem);
|
|
|
+ }
|
|
|
+ item.target.data = itemCfg.id;
|
|
|
UI_RewardItemUI.ProxyEnd();
|
|
|
}
|
|
|
|
|
|
+ private void OnClickVisitRewardItem(EventContext context)
|
|
|
+ {
|
|
|
+ if (!(context.sender is GObject btnVisit)) return;
|
|
|
+ int itemID = (int)btnVisit.data;
|
|
|
+ GoodsItemTipsController.ShowItemTips(itemID);
|
|
|
+ }
|
|
|
+
|
|
|
private void OnTasksChange(EventContext context)
|
|
|
{
|
|
|
_ui.m_taskList.numItems = ActivityVisitCfgArray.Instance.dataArray[npcId].taskIdArr.Length;
|