174 lines
5.0 KiB
C#
174 lines
5.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Events;
|
|
using Module.Log;
|
|
|
|
public class MagicMain : MonoBehaviour
|
|
{
|
|
#region static
|
|
|
|
// 功能已开启 - true
|
|
// 功能未开启 - false
|
|
public static bool ShowMagicPageStr(int pageIndex, UInt64 id = Games.GlobeDefine.GlobeVar.INVALID_GUID)
|
|
{
|
|
Tab_FunctionOpen tab = TableManager.GetFunctionOpenByID(7);
|
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < tab.OpenLevel)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5407}", tab.OpenLevel));
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
Hashtable info = new Hashtable();
|
|
info["pageIndex"] = pageIndex;
|
|
info["guid"] = id;
|
|
UIManager.ShowUI(UIInfo.MagicWndPath, (sucess, param) =>
|
|
{
|
|
if (sucess == true)
|
|
{
|
|
Hashtable p = param as Hashtable;
|
|
if (p != null)
|
|
{
|
|
MagicMain.Instance.needSelectId = (UInt64)p["guid"];
|
|
MagicMain.Instance._TagPanel.ShowPage((int)p["pageIndex"]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
LogModule.ErrorLog("Can't show MagicWndPath");
|
|
}
|
|
|
|
}, info);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public GameObject redPoint; // 红点提示
|
|
public static MagicMain Instance;
|
|
public MagicInfoWnd InfoWnd; // 佩戴界面
|
|
public MagicClearWnd ClearWnd; // 锻造界面
|
|
public MagicCombinWnd CombinWnd; // 合成界面
|
|
|
|
public UITagPanel _TagPanel;
|
|
public UInt64 needSelectId = Games.GlobeDefine.GlobeVar.INVALID_GUID;
|
|
|
|
void Awake()
|
|
{
|
|
Instance = this;
|
|
Hashtable calbackMoveparam1 = new Hashtable();
|
|
calbackMoveparam1["name"] = "MagicItemUpdate";
|
|
MessageEventCallBack fun1 = ItemUpdate;
|
|
calbackMoveparam1.Add("callFun", fun1);
|
|
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.MagicItemUpdate, calbackMoveparam1);
|
|
|
|
Hashtable calbackMoveparam2 = new Hashtable();
|
|
calbackMoveparam2["name"] = "UpdateShowModel";
|
|
MessageEventCallBack fun2 = UpdateShowModel;
|
|
calbackMoveparam2.Add("callFun", fun2);
|
|
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.MagicShowModel, calbackMoveparam2);
|
|
}
|
|
|
|
void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.MagicItemUpdate, "MagicItemUpdate");
|
|
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.MagicShowModel, "UpdateShowModel");
|
|
}
|
|
|
|
public void UpdateShowModel(Hashtable addParam, Hashtable sendParam)
|
|
{
|
|
InfoWnd.UpdateDressTip();
|
|
}
|
|
|
|
public void ItemUpdate(Hashtable addParam, Hashtable sendParam)
|
|
{
|
|
InfoWnd.Start();
|
|
CombinWnd.InitStart();
|
|
ClearWnd.InitStart();
|
|
}
|
|
|
|
public void OnEnable()
|
|
{
|
|
_TagPanel.ShowPage(0);
|
|
UIManager.ShowUI(UIInfo.MoneyInfoPanel);
|
|
}
|
|
|
|
public void OnDisable()
|
|
{
|
|
_TagPanel.Reset();
|
|
UIManager.CloseUI(UIInfo.MoneyInfoPanel);
|
|
}
|
|
|
|
//public void OpenChildWnd(int page, UInt64 id)
|
|
//{
|
|
// if (IsFuncOpen())
|
|
// {
|
|
// needSelectId = id;
|
|
// _TagPanel.ShowPage(page);
|
|
// }
|
|
//}
|
|
|
|
public void SetUseItem(int dataID)
|
|
{
|
|
ClearWnd.SetPayItem(dataID);
|
|
}
|
|
|
|
public void TagShowPage(int page)
|
|
{
|
|
if (page == 0)
|
|
{
|
|
InfoWnd.Start();
|
|
}
|
|
if (page == 1)
|
|
{
|
|
ClearWnd.InitStart();
|
|
needSelectId = Games.GlobeDefine.GlobeVar.INVALID_GUID;
|
|
}
|
|
if (page == 2)
|
|
{
|
|
CombinWnd.InitStart();
|
|
needSelectId = Games.GlobeDefine.GlobeVar.INVALID_GUID;
|
|
}
|
|
}
|
|
|
|
public void OnClick_Close()
|
|
{
|
|
UIManager.CloseUI(UIInfo.MagicWndPath);
|
|
}
|
|
|
|
public void SetRedPoint(bool isShow)
|
|
{
|
|
if(redPoint != null)
|
|
{
|
|
if(redPoint.activeSelf != isShow)
|
|
{
|
|
redPoint.SetActive(isShow);
|
|
RedTipPoint.RedPointStateChange(RedTipPoint.PointType.Magic, isShow);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public static void UpdateRedPoint(Hashtable addParam = null, Hashtable sendParam = null)
|
|
{
|
|
// 当页面法宝页面存时,页面也会逐层更新红单,就省去此处检测
|
|
if (MagicMain.Instance != null && MagicMain.Instance.gameObject.activeInHierarchy)
|
|
return;
|
|
|
|
if (MagicInfoWnd.HasRedPoint())
|
|
{
|
|
RedTipPoint.RedPointStateChange(RedTipPoint.PointType.Magic,true);
|
|
}
|
|
else
|
|
{
|
|
RedTipPoint.RedPointStateChange(RedTipPoint.PointType.Magic, false);
|
|
}
|
|
}
|
|
} |