136 lines
4.5 KiB
C#
136 lines
4.5 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class MainUILogic : MonoBehaviour
|
|||
|
{
|
|||
|
private static MainUILogic m_Instance;
|
|||
|
public bool _UIInitLoadOk;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 加载UIPrefab
|
|||
|
/// </summary>
|
|||
|
private bool isInitUI;
|
|||
|
|
|||
|
private Dictionary<string, GameObject> m_dicUI = new Dictionary<string, GameObject>();
|
|||
|
|
|||
|
private Dictionary<string, int> m_dicUILevel = new Dictionary<string, int>();
|
|||
|
|
|||
|
public Dictionary<string, GameObject> DicUI
|
|||
|
{
|
|||
|
get { return m_dicUI; }
|
|||
|
set { m_dicUI = value; }
|
|||
|
}
|
|||
|
|
|||
|
public Dictionary<string, int> DicUILevel
|
|||
|
{
|
|||
|
get { return m_dicUILevel; }
|
|||
|
set { m_dicUILevel = value; }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
m_Instance = this;
|
|||
|
}
|
|||
|
|
|||
|
// Use this for initialization
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
if (GameManager.gameManager && GameManager.gameManager.RunningScene != (int) GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN)
|
|||
|
{
|
|||
|
//LoadUIPrefab(false);
|
|||
|
|
|||
|
if (NetWorkLogic.GetMe().GetConnectStautus() == NetWorkLogic.ConnectStatus.DISCONNECTED)
|
|||
|
NetManager.Instance().ConnectLost();
|
|||
|
|
|||
|
PVPData.CheckAutoShowChallengeUI();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
m_Instance = null;
|
|||
|
m_dicUI = null;
|
|||
|
m_dicUILevel = null;
|
|||
|
}
|
|||
|
|
|||
|
public static MainUILogic Instance()
|
|||
|
{
|
|||
|
return m_Instance;
|
|||
|
}
|
|||
|
|
|||
|
public void ChangeScene(bool loadPopUi = false)
|
|||
|
{
|
|||
|
UIManager.Instance().UnLoadScene();
|
|||
|
if (GameManager.gameManager.RunningScene != (int) GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN)
|
|||
|
{
|
|||
|
LoadUIPrefab(loadPopUi);
|
|||
|
ResourcePool.Instance.InitEmoji(35);
|
|||
|
if (NetWorkLogic.GetMe().GetConnectStautus() == NetWorkLogic.ConnectStatus.DISCONNECTED)
|
|||
|
NetManager.Instance().ConnectLost();
|
|||
|
PVPData.CheckAutoShowChallengeUI();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void LoadUIPrefab(bool loadPopUI)
|
|||
|
{
|
|||
|
if (isInitUI)
|
|||
|
return;
|
|||
|
isInitUI = true;
|
|||
|
//if (GameManager.gameManager.RunningScene == (int)GameDefine_Globe.SCENE_DEFINE.SCENE_YANMENGUANWAI)
|
|||
|
//{
|
|||
|
// UIManager.ShowUI(UIInfo.TargetFrameRoot);
|
|||
|
// UIManager.ShowUI(UIInfo.PlayerFrameRoot);
|
|||
|
// UIManager.ShowUI(UIInfo.JoyStickRoot);
|
|||
|
// UIManager.ShowUI(UIInfo.SkillBarRoot);
|
|||
|
// UIManager.ShowUI(UIInfo.SkillProgress);
|
|||
|
// UIManager.ShowUI(UIInfo.CentreNotice);
|
|||
|
//}
|
|||
|
//else
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.SkillBarRoot);
|
|||
|
UIManager.ShowUI(UIInfo.ExpRoot);
|
|||
|
UIManager.ShowUI(UIInfo.BossFrameRoot);
|
|||
|
UIManager.ShowUI(UIInfo.TargetFrameRoot);
|
|||
|
UIManager.ShowUI(UIInfo.PlayerFrameRoot);
|
|||
|
UIManager.ShowUI(UIInfo.CenterTipsRoot);
|
|||
|
UIManager.ShowUI(UIInfo.FunctionButtonRoot);
|
|||
|
UIManager.ShowUI(UIInfo.FunctionExRoot);
|
|||
|
//UIManager.ShowUI(UIInfo.JoyStickRoot);
|
|||
|
UIManager.ShowUI(UIInfo.ExtraFunTipRoot, (sucess, param) => { _UIInitLoadOk = true; });
|
|||
|
|
|||
|
UIManager.ShowUI(UIInfo.CentreNotice);
|
|||
|
UIManager.ShowUI(UIInfo.SceneItemUseTip);
|
|||
|
//UIManager.ShowUI(UIInfo.SkillProgress);
|
|||
|
UIManager.ShowUI(UIInfo.RollNotice);
|
|||
|
UIManager.ShowUI(UIInfo.ChatFrameRoot);
|
|||
|
|
|||
|
|
|||
|
//PVP场景断线重连之后这些UI不要加载
|
|||
|
if (GameManager.gameManager.RunningScene != GameManager.gameManager.PlayerDataPool.pvpIfo._PvpBattleSceneId
|
|||
|
&& GameManager.gameManager.RunningScene ==
|
|||
|
GameManager.gameManager.PlayerDataPool.pvpIfo._PvpBattleSceneId)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.ActiveBtns);
|
|||
|
UIManager.ShowUI(UIInfo.MiniMapRoot);
|
|||
|
LuaUIManager.Instance.ShowLuaUIType("MarketingActsRoot", LuaUIManager.UIContainerType.Base);
|
|||
|
UIManager.ShowUI(UIInfo.MissionDialogAndLeftTabsRoot); // 任务界面算一级界面 任务对话框特殊处理
|
|||
|
}
|
|||
|
|
|||
|
ProcessInput.Instance.CreateJoyStick();
|
|||
|
|
|||
|
//if (loadPopUI)
|
|||
|
//{
|
|||
|
// UIManager.ShowUI(UIInfo.BackPackRoot, null, null, true);
|
|||
|
// UIManager.ShowUI(UIInfo.SkillInfo,null, null, true);
|
|||
|
// UIManager.ShowUI(UIInfo.PetMainWndPath, null, null, true);
|
|||
|
// UIManager.ShowUI(UIInfo.EquipEnhance, (sucess, param) =>
|
|||
|
// {
|
|||
|
// _UIInitLoadOk = true;
|
|||
|
// }, null, true);
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|