84 lines
2.4 KiB
C#
84 lines
2.4 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
public class CrossServerPost : MonoBehaviour
|
|||
|
{
|
|||
|
public CrossServerPostItem[] CrossServerPostItems;
|
|||
|
public Text FinishTimes;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.DialogWithNPC,Show);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.ActivityCount, ActivityCount);
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.DialogWithNPC, Show);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.ActivityCount, ActivityCount);
|
|||
|
}
|
|||
|
|
|||
|
private void ActivityCount(object obj)
|
|||
|
{
|
|||
|
OnEnable();
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
int complete = ActivityDataManager.Instance.GetActivityCompleteTimes((int)ActivityDataManager.Activity_Type.CROSS_SER_ESCORT,false);
|
|||
|
|
|||
|
Tab_ActivityBase activityBase = ActivityDataManager.Instance.GetActivityTabByServerType(ActivityDataManager.Activity_Type.CROSS_SER_ESCORT);
|
|||
|
if (activityBase != null)
|
|||
|
{
|
|||
|
FinishTimes.text = string.Format("{0}/{1}", complete, activityBase.ActityLimitTimes);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void Show(object Npc)
|
|||
|
{
|
|||
|
int NpcID = (int)Npc;
|
|||
|
|
|||
|
var CrossSerEscortConfigs = TableManager.GetCrossSerEscortConfig().Values;
|
|||
|
foreach(var config in CrossSerEscortConfigs)
|
|||
|
{
|
|||
|
int Quality = config.Quality - 1;
|
|||
|
if (config.NPCID == NpcID)
|
|||
|
{
|
|||
|
if(Quality < CrossServerPostItems.Length)
|
|||
|
{
|
|||
|
CrossServerPostItems[Quality].Init(config);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (CrossServerPostItems.Length > 0)
|
|||
|
CrossServerPostItems[0].SetSelect(true);
|
|||
|
}
|
|||
|
|
|||
|
public void Click_Select(int index)
|
|||
|
{
|
|||
|
for (int i = 0; i < CrossServerPostItems.Length; i++)
|
|||
|
{
|
|||
|
CrossServerPostItems[i].SetSelect(i == index);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Click_AcceptMission()
|
|||
|
{
|
|||
|
for(int i=0;i< CrossServerPostItems.Length;i++)
|
|||
|
{
|
|||
|
CrossServerPostItems[i].Click_AcceptMission();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Click_ShowHelp()
|
|||
|
{
|
|||
|
MessageHelpLogic.ShowHelpMessage(51);
|
|||
|
}
|
|||
|
|
|||
|
public void Click_Close()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.CrossServerPost);
|
|||
|
}
|
|||
|
}
|