using System; using UILib; using UnityEngine; using XMainClient.UI; using XMainClient.UI.Battle; using XMainClient.UI.UICommon; using XUtliPoolLib; namespace XMainClient { public class XGameUI : XSingleton, IXGameUI, IXInterface { public int Base_UI_Width { get; set; } public int Base_UI_Height { get; set; } public bool Deprecated { get; set; } public GameObject DlgControllerTpl { get { return this._dlgControllerTpl; } } public GameObject[] buttonTpl { get { return this._buttonTpl; } } public GameObject[] spriteTpl { get { return this._spriteTpl; } } public IXUIPanel HpbarRoot { get { return this.m_objHpbarRoot; } set { this.m_objHpbarRoot = value; } } public IXUIPanel NpcHpbarRoot { get { return this.m_objNpcHpbarRoot; } set { this.m_objNpcHpbarRoot = value; } } public GameObject UIAudio { get { return this.m_uiAudio; } } public Transform UIRoot { get { return this.m_objUIRoot; } set { this.m_objUIRoot = value; this.m_uiTool = (this.m_objUIRoot.GetComponent("XUITool") as IXUITool); GameObject gameObject = this.m_objUIRoot.Find("GenericEventHandle").gameObject; this.m_uiAudio = this.m_objUIRoot.Find("uiplayaudio").gameObject; XSingleton.singleton.StoreAudioSource(this.m_uiAudio); this.m_uiTool.SetUIGenericEventHandle(gameObject); XSingleton.singleton.UIRoot = this.m_objUIRoot; } } public Camera UICamera { get { return this.m_uiCamera; } set { this.m_uiCamera = value; } } private Transform m_objUIRoot = null; private IXUIPanel m_objHpbarRoot = null; private IXUIPanel m_objNpcHpbarRoot = null; private Camera m_uiCamera = null; public IXUITool m_uiTool = null; private IXUISprite m_overlay = null; private GameObject m_connect = null; private GameObject m_block = null; private GameObject m_uiAudio = null; public static int _far_far_away = 1000; public static Vector3 Far_Far_Away = new Vector3(10000f, 10000f, 0f); private GameObject[] _buttonTpl = new GameObject[3]; private GameObject[] _spriteTpl = new GameObject[1]; private GameObject _dlgControllerTpl = null; public override bool Init() { XSingleton.singleton.AddLog("XMainClient.XGameUI.Init --------------------------------", null, null, null, null, null, XDebugColor.XDebug_None); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("XGameUI"), this); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("IModalDlg"), DlgBase.singleton); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("IXNormalItemDrawer"), XSingleton.singleton.normalItemDrawer); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("IGameSysMgr"), XSingleton.singleton); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("IUiUtility"), XSingleton.singleton); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("ITssSdkSend"), XSingleton.singleton); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("IX3DAvatarMgr"), XSingleton.singleton); XSingleton.singleton.AttachInterface(XSingleton.singleton.XHash("ILuaExtion"), XSingleton.singleton); bool flag = this.UIRoot == null; if (flag) { this.UIRoot = (XSingleton.singleton.CreateFromPrefab("UI/Common/work/UIRoot", false, true) as GameObject).transform; UnityEngine.Object.DontDestroyOnLoad(this.UIRoot); } bool flag2 = this.HpbarRoot == null; if (flag2) { GameObject gameObject = XSingleton.singleton.CreateFromPrefab("UI/Common/work/HpbarRoot", false, true) as GameObject; bool flag3 = gameObject != null; if (flag3) { this.HpbarRoot = (gameObject.GetComponent("XUIPanel") as IXUIPanel); UnityEngine.Object.DontDestroyOnLoad(gameObject); } } bool flag4 = this.NpcHpbarRoot == null; if (flag4) { GameObject gameObject2 = XSingleton.singleton.CreateFromPrefab("UI/Common/work/HpbarRoot", false, true) as GameObject; bool flag5 = gameObject2 != null; if (flag5) { gameObject2.name = "NpcHpbarRoot"; this.NpcHpbarRoot = (gameObject2.GetComponent("XUIPanel") as IXUIPanel); UnityEngine.Object.DontDestroyOnLoad(gameObject2); } } for (int i = 0; i < 3; i++) { this._buttonTpl[i] = (XSingleton.singleton.CreateFromPrefab("UI/Common/work/XButton" + (i + 1), false, true) as GameObject); this._buttonTpl[i].SetActive(false); UnityEngine.Object.DontDestroyOnLoad(this._buttonTpl[i]); } for (int j = 0; j < 1; j++) { this._spriteTpl[j] = (XSingleton.singleton.CreateFromPrefab("UI/Common/work/XSprite" + (j + 1), false, true) as GameObject); this._spriteTpl[j].SetActive(false); UnityEngine.Object.DontDestroyOnLoad(this._spriteTpl[j]); } this._dlgControllerTpl = (XSingleton.singleton.CreateFromPrefab("UI/Common/work/DlgAnimation", false, true) as GameObject); this._dlgControllerTpl.SetActive(false); UnityEngine.Object.DontDestroyOnLoad(this._dlgControllerTpl); return true; } public override void Uninit() { } public void GetOverlay() { bool flag = this.m_overlay == null; if (flag) { this.m_overlay = (this.m_objUIRoot.Find("fade_panel/fade_canvas").GetComponent("XUISprite") as IXUISprite); this.m_overlay.gameObject.SetActive(false); } } public float GetOverlayAlpha() { this.GetOverlay(); return this.m_overlay.gameObject.activeSelf ? this.m_overlay.GetAlpha() : 0f; } public void SetOverlayAlpha(float alpha) { this.GetOverlay(); bool flag = alpha > 0f; if (flag) { bool flag2 = !this.m_overlay.gameObject.activeSelf; if (flag2) { this.m_overlay.gameObject.SetActive(true); } this.m_overlay.SetAlpha(alpha); } else { this.m_overlay.gameObject.SetActive(false); } } private void ShowConnecting(bool bVisible) { bool flag = this.m_connect == null; if (flag) { this.m_connect = this.m_objUIRoot.Find("fade_panel/connecting").gameObject; } if (bVisible) { bool flag2 = !this.m_connect.activeSelf; if (flag2) { this.m_connect.SetActive(bVisible); } } else { bool activeSelf = this.m_connect.activeSelf; if (activeSelf) { this.m_connect.SetActive(bVisible); } } } public void ShowBlock(bool bVisible) { bool flag = this.m_block == null; if (flag) { this.m_block = this.m_objUIRoot.Find("block").gameObject; } if (bVisible) { bool flag2 = !this.m_block.activeSelf; if (flag2) { this.m_block.SetActive(bVisible); } } else { bool activeSelf = this.m_block.activeSelf; if (activeSelf) { this.m_block.SetActive(bVisible); } } } public void OnGenericClick() { bool flag = XSingleton.singleton.CurrentStage != null; if (flag) { bool flag2 = !XSingleton.singleton.Exculsive; if (flag2) { bool flag3 = DlgBase.singleton.IsLoaded(); if (flag3) { DlgBase.singleton.HideToolTip(false); } bool flag4 = DlgBase.singleton.IsLoaded(); if (flag4) { DlgBase.singleton.HideToolTip(false); } bool flag5 = DlgBase.singleton.IsLoaded(); if (flag5) { DlgBase.singleton.HideToolTip(false); } bool flag6 = DlgBase.singleton.IsLoaded(); if (flag6) { DlgBase.singleton.HideToolTip(false); } bool flag7 = DlgBase.singleton.IsLoaded(); if (flag7) { DlgBase.singleton.HideToolTip(false); } bool flag8 = DlgBase.singleton.IsLoaded(); if (flag8) { DlgBase.singleton.HideToolTip(false); } bool flag9 = DlgBase.singleton.IsLoaded(); if (flag9) { DlgBase.singleton.HideToolTip(false); } bool flag10 = DlgBase.singleton.IsLoaded(); if (flag10) { DlgBase.singleton.HideToolTip(false); } bool flag11 = DlgBase.singleton.IsLoaded(); if (flag11) { DlgBase.singleton.HideToolTip(false); } bool flag12 = DlgBase.singleton.IsLoaded(); if (flag12) { DlgBase.singleton.HideToolTip(false); } } bool flag13 = XSingleton.singleton.Exculsive && XSingleton.singleton.ExculsiveOnGeneric; if (flag13) { bool flag14 = DlgBase.singleton.IsLoaded(); if (flag14) { DlgBase.singleton.HideToolTip(false); } bool flag15 = DlgBase.singleton.IsLoaded(); if (flag15) { DlgBase.singleton.HideToolTip(false); } bool flag16 = DlgBase.singleton.IsLoaded(); if (flag16) { DlgBase.singleton.HideToolTip(false); } bool flag17 = DlgBase.singleton.IsLoaded(); if (flag17) { DlgBase.singleton.HideToolTip(false); } bool flag18 = DlgBase.singleton.IsLoaded(); if (flag18) { DlgBase.singleton.HideToolTip(false); } bool flag19 = DlgBase.singleton.IsLoaded(); if (flag19) { DlgBase.singleton.HideToolTip(false); } bool flag20 = DlgBase.singleton.IsLoaded(); if (flag20) { DlgBase.singleton.HideToolTip(false); } bool flag21 = DlgBase.singleton.IsLoaded(); if (flag21) { DlgBase.singleton.HideToolTip(false); } bool flag22 = DlgBase.singleton.IsLoaded(); if (flag22) { DlgBase.singleton.HideToolTip(false); } bool flag23 = DlgBase.singleton.IsLoaded(); if (flag23) { DlgBase.singleton.HideToolTip(false); } XSingleton.singleton.OnTutorialClicked(); } } } public void ShowCutSceneUI() { DlgBase.singleton.Load(); DlgBase.singleton.SetVisible(true, true); } public void UpdateNetUI() { this.ShowConnecting(XSingleton.singleton.FetchTokenDelay || XSingleton.singleton.LoginDelay || XSingleton.singleton.XConnect.OnConnectDelay || XSingleton.singleton.XConnect.OnRpcDelay || XSingleton.singleton.XConnect.OnReconnect); } internal void LoadLoginUI(EXStage eStage) { DlgBase.singleton.Load(); DlgBase.singleton.SetVisible(true, true); } internal void UnloadLoginUI() { DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); } internal void LoadSelectCharUI(EXStage eStage) { DlgBase.singleton.Load(); DlgBase.singleton.SetVisible(true, true); } internal void UnLoadSelectCharUI() { DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); } internal void LoadWorldUI(EXStage eStage) { bool bSpectator = XSingleton.singleton.bSpectator; if (bSpectator) { DlgBase.singleton.Load(); } else { DlgBase.singleton.Load(); } DlgBase.singleton.Load(); DlgBase.singleton.Load(); DlgBase.singleton.Load(); } internal void UnloadWorldUI() { DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); DlgBase.singleton.UnLoad(false); } internal void LoadHallUI(EXStage eStage) { DlgBase.singleton.Load(); } internal void LoadConcreteUI(EXStage eStage) { } public void SetUIOptOption(bool globalMerge, bool selectMerge, bool lowDeviceMerge, bool refreshUI = true) { bool flag = this.m_uiTool != null; if (flag) { this.m_uiTool.SetUIOptOption(globalMerge, selectMerge, lowDeviceMerge); } if (refreshUI) { bool flag2 = this.m_objUIRoot != null; if (flag2) { this.m_objUIRoot.gameObject.SetActive(false); this.m_objUIRoot.gameObject.SetActive(true); } bool flag3 = this.m_objHpbarRoot != null; if (flag3) { this.m_objHpbarRoot.gameObject.SetActive(false); this.m_objHpbarRoot.gameObject.SetActive(true); } bool flag4 = this.m_objNpcHpbarRoot != null; if (flag4) { this.m_objNpcHpbarRoot.gameObject.SetActive(false); this.m_objNpcHpbarRoot.gameObject.SetActive(true); } } } } }