292 lines
8.4 KiB
C#
292 lines
8.4 KiB
C#
|
using Games.LogicObj;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using GCGame;
|
|||
|
using Module.Log;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.Events;
|
|||
|
|
|||
|
public class MeridiaSoulMain : MonoBehaviour
|
|||
|
{
|
|||
|
|
|||
|
public MeridiaSoul m_MeridiaSoulWndScript;
|
|||
|
public KungfuSoul m_KungfuSoulWndScript;
|
|||
|
public HeartSoul m_HeartWnScript;
|
|||
|
public BossBookPanel m_BossBookPanelScript;
|
|||
|
|
|||
|
public Text BloodLimitLevel;
|
|||
|
public GameObject BloodLimit;
|
|||
|
|
|||
|
public Text SoulLimitLevel;
|
|||
|
public GameObject SoulLimit;
|
|||
|
|
|||
|
public Text HeartLimitLevel;
|
|||
|
public GameObject HeartLimit;
|
|||
|
|
|||
|
public GameObject BloodToggle;
|
|||
|
public GameObject SoulToggle;
|
|||
|
public GameObject HeartToggle;
|
|||
|
public UITagPanel _TagPanel;
|
|||
|
|
|||
|
private static MeridiaSoulMain _instance;
|
|||
|
public static MeridiaSoulMain Instance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if(_instance != null)
|
|||
|
{
|
|||
|
return _instance;
|
|||
|
}
|
|||
|
|
|||
|
return null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 红点更新
|
|||
|
public GameObject[] redPoints;
|
|||
|
|
|||
|
void Awake()
|
|||
|
{
|
|||
|
if(_instance == null)
|
|||
|
{
|
|||
|
_instance = this;
|
|||
|
}
|
|||
|
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.MeridiaSoulInfo, SetNewVeinList);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.UPGradeVein, UpGradeVein);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.KungFuSoulInfo, SoulInfo);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.UPSoulInfo, UPSoulInfo);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.FreshWishNum, FreshWishNum);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.UpdateHeartSoulData, UpdateHeartSoul);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.MainPlayerLevelUP, MainPlayerLevelUp);
|
|||
|
|
|||
|
Hashtable calbackMoveparam = new Hashtable();
|
|||
|
calbackMoveparam["name"] = "MeridiaSoulMain";
|
|||
|
Games.Events.MessageEventCallBack fun = FreshItems;
|
|||
|
calbackMoveparam.Add("callFun", fun);
|
|||
|
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.FRESHSAMEUSETIP, calbackMoveparam);
|
|||
|
}
|
|||
|
|
|||
|
void OnDestroy()
|
|||
|
{
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.MainPlayerLevelUP, MainPlayerLevelUp);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.MeridiaSoulInfo, SetNewVeinList);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.UPGradeVein, UpGradeVein);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.KungFuSoulInfo, SoulInfo);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.UPSoulInfo, UPSoulInfo);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.FreshWishNum, FreshWishNum);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.UpdateHeartSoulData, UpdateHeartSoul);
|
|||
|
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.FRESHSAMEUSETIP, "MeridiaSoulMain");
|
|||
|
|
|||
|
_instance = null;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if(WaitOneFrame > 0)
|
|||
|
{
|
|||
|
WaitOneFrame--;
|
|||
|
if(WaitOneFrame == 0)
|
|||
|
{
|
|||
|
WaitOneFrame = -1;
|
|||
|
OnEnableWaitOneFrame();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (DataDuty < 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if(DataDuty == 0)
|
|||
|
{
|
|||
|
MeridiaSoulData.Instance.CheckIsHasUp(true);
|
|||
|
SetRedPoint();
|
|||
|
}
|
|||
|
DataDuty--;
|
|||
|
}
|
|||
|
|
|||
|
int DataDuty = -1;
|
|||
|
public void SetDataDuty()
|
|||
|
{
|
|||
|
DataDuty = 5;
|
|||
|
}
|
|||
|
|
|||
|
private void OnDisable()
|
|||
|
{
|
|||
|
WaitOneFrame = -1;
|
|||
|
UIManager.CloseUI(UIInfo.MoneyInfoPanel);
|
|||
|
if (m_KungfuSoulWndScript != null)
|
|||
|
m_KungfuSoulWndScript.OnClose();
|
|||
|
}
|
|||
|
|
|||
|
public void MainPlayerLevelUp(object args)
|
|||
|
{
|
|||
|
m_MeridiaSoulWndScript.SetDataDuty();
|
|||
|
m_KungfuSoulWndScript.SetDataDuty();
|
|||
|
}
|
|||
|
|
|||
|
public void FreshItems(Hashtable add ,Hashtable send)
|
|||
|
{
|
|||
|
if(m_MeridiaSoulWndScript.gameObject.activeSelf)
|
|||
|
m_MeridiaSoulWndScript.ContentReFresh();
|
|||
|
if (m_KungfuSoulWndScript.gameObject.activeSelf)
|
|||
|
m_KungfuSoulWndScript.ContentReFresh();
|
|||
|
}
|
|||
|
|
|||
|
public void TagShowPage(int page)
|
|||
|
{
|
|||
|
ShowPage(page);
|
|||
|
}
|
|||
|
|
|||
|
public void ShowPage(int page)
|
|||
|
{
|
|||
|
switch(page)
|
|||
|
{
|
|||
|
case 0: m_MeridiaSoulWndScript.SetDataDuty();break;
|
|||
|
case 1: m_KungfuSoulWndScript.SetDataDuty(); break;
|
|||
|
case 2: m_HeartWnScript.Show(); break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//心脉数据
|
|||
|
public void UpdateHeartSoul(object args)
|
|||
|
{
|
|||
|
if(m_HeartWnScript.gameObject.activeSelf)
|
|||
|
m_HeartWnScript.Show();
|
|||
|
SetDataDuty();
|
|||
|
}
|
|||
|
|
|||
|
public void FreshHeartToggle()
|
|||
|
{
|
|||
|
Tab_HeartBase heartBase = TableManager.GetHeartBaseByID(1, 0);
|
|||
|
if (heartBase == null || Singleton<ObjManager>.Instance.MainPlayer==null)
|
|||
|
return;
|
|||
|
int MainPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
|||
|
|
|||
|
HeartLimit.SetActive(MainPlayerLevel < heartBase.OpenLevel);
|
|||
|
HeartToggle.SetActive(MainPlayerLevel >= heartBase.OpenLevel);
|
|||
|
|
|||
|
BloodLimit.SetActive(MainPlayerLevel < heartBase.BloodOpenLevel);
|
|||
|
BloodToggle.SetActive(MainPlayerLevel >= heartBase.BloodOpenLevel);
|
|||
|
|
|||
|
SoulLimit.SetActive(MainPlayerLevel < heartBase.SoulOpenLevel);
|
|||
|
SoulToggle.SetActive(MainPlayerLevel >= heartBase.SoulOpenLevel);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void HeartLimitClick()
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{65003}"));
|
|||
|
}
|
|||
|
|
|||
|
public void KungLimitClick()
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{65002}"));
|
|||
|
}
|
|||
|
|
|||
|
//武魂祝福值
|
|||
|
public void FreshWishNum(object args)
|
|||
|
{
|
|||
|
if(m_KungfuSoulWndScript.gameObject.activeSelf)
|
|||
|
m_KungfuSoulWndScript.SetWish();
|
|||
|
}
|
|||
|
|
|||
|
//武魂升级 点击升级后的信息返回,包括成功与不成功
|
|||
|
public void UPSoulInfo(object args)
|
|||
|
{
|
|||
|
if (m_KungfuSoulWndScript.gameObject.activeSelf)
|
|||
|
{
|
|||
|
int result = (int)args;
|
|||
|
if (result == 0)
|
|||
|
{
|
|||
|
m_KungfuSoulWndScript.UpSoulFailed();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
m_KungfuSoulWndScript.UpGrade();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//武魂信息更新
|
|||
|
public void SoulInfo(object args)
|
|||
|
{
|
|||
|
if (m_KungfuSoulWndScript.gameObject.activeSelf)
|
|||
|
m_KungfuSoulWndScript.SetDataDuty();
|
|||
|
SetDataDuty();
|
|||
|
}
|
|||
|
|
|||
|
//经脉信息
|
|||
|
public void UpGradeVein(object args)
|
|||
|
{
|
|||
|
if (m_MeridiaSoulWndScript.gameObject.activeSelf)
|
|||
|
m_MeridiaSoulWndScript.UpGrade(args);
|
|||
|
SetDataDuty();
|
|||
|
}
|
|||
|
//经脉信息更新
|
|||
|
public void SetNewVeinList(object args)
|
|||
|
{
|
|||
|
if(m_KungfuSoulWndScript.gameObject.activeSelf == false
|
|||
|
&& m_HeartWnScript.gameObject.activeSelf == false
|
|||
|
&& m_BossBookPanelScript.gameObject.activeSelf == false)
|
|||
|
|
|||
|
{
|
|||
|
_TagPanel.ShowPage(0);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (m_MeridiaSoulWndScript.gameObject.activeSelf)
|
|||
|
m_MeridiaSoulWndScript.SetDataDuty();
|
|||
|
SetDataDuty();
|
|||
|
}
|
|||
|
|
|||
|
private int WaitOneFrame = -1;
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
WaitOneFrame = 1;
|
|||
|
|
|||
|
SetRedPoint();
|
|||
|
}
|
|||
|
|
|||
|
void OnEnableWaitOneFrame()
|
|||
|
{
|
|||
|
FreshHeartToggle();
|
|||
|
UIManager.ShowUI(UIInfo.MoneyInfoPanel);
|
|||
|
MeridiaSoulData.Instance.SendAskDataCmd();
|
|||
|
}
|
|||
|
|
|||
|
public void Close_Click()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.MeridiaSoulWnd);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设置境界界面左侧菜单栏的红点状态
|
|||
|
/// </summary>
|
|||
|
/// <param name="index">红点索引,从 0 开始</param>
|
|||
|
/// <param name="isShow">是否显示</param>
|
|||
|
public void SetRedPoint()
|
|||
|
{
|
|||
|
|
|||
|
if (redPoints.Length > 0)
|
|||
|
{
|
|||
|
redPoints[0].SetActive(MeridiaSoulData.Instance.MerialSoulHasUp);
|
|||
|
}
|
|||
|
if (redPoints.Length > 1)
|
|||
|
{
|
|||
|
redPoints[1].SetActive(MeridiaSoulData.Instance.KungfuHasUp);
|
|||
|
}
|
|||
|
if (redPoints.Length > 2)
|
|||
|
{
|
|||
|
redPoints[2].SetActive(MeridiaSoulData.Instance.HeartHasUp);
|
|||
|
}
|
|||
|
if (redPoints.Length > 3)
|
|||
|
{
|
|||
|
redPoints[3].SetActive(BossBookPanel.IsNeedShowTips());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|