/// <summary> /// 关闭界面。 /// </summary> /// <param name="uiKey"></param> public void CloseUI(UIPanleID uiKey) { GameObject uiObject = null; if (!allOpenUIDic.TryGetValue(uiKey, out uiObject)) { return; } if (uiObject == null) { if (allOpenUIDic.ContainsKey(uiKey)) { allOpenUIDic.Remove(uiKey); } } else { GUIBase baseUI = uiObject.GetComponent <GUIBase>(); if (baseUI != null) { baseUI.StateChanged += CloseHandler; baseUI.Release(); } else { GameObject.Destroy(uiObject); allOpenUIDic.Remove(uiKey); } } }
public static void PlayBGmByClose(UIPanleID panelId) { string bgm = GetBgmByPanelId(panelId); if (AudioController.Instance.bgmPlaying.Equals(bgm)) { StartLandingShuJu.GetInstance().PlayBgMusic(); } }
//打开窗口播放某个背景音乐 public static void PlayBgmWithUI(UIPanleID panelId) { string bgm = GetBgmByPanelId(panelId); if (!AudioController.Instance.bgmPlaying.Equals(bgm)) { AudioController.Instance.PlayBackgroundMusic(bgm, true); } }
private void OpenMutexUI(UIPanleID uiKey, object[] uiObjParams) { if (!mutexUIList.Contains(uiKey)) { UIPanleID[] uiKeys = new UIPanleID[1]; uiKeys[0] = uiKey; OpenUI(false, uiKeys, uiObjParams); mutexUIList.Add(uiKey); } }
/// <summary> /// 获取界面对象。 /// </summary> /// <param name="uiKey"></param> /// <returns>GameObject</returns> public GameObject GetUIObject(UIPanleID uiKey) { GameObject uiObject = null; if (allOpenUIDic.TryGetValue(uiKey, out uiObject)) { return(uiObject); } return(null); }
/// <summary> /// 打开界面 /// </summary> /// <param name="uikey"></param> /// <param name="openType">打开界面的类型</param> /// <param name="isCloseAllUI">是否关闭所有UI</param> /// <param name="uiObjParams">可传参数</param> public static void ShowGUI(UIPanleID uikey, EnumOpenUIType openType, bool isCloseAllUI = false, params object[] uiObjParams) { if (openType == EnumOpenUIType.DefaultUIOrSecond) { Singleton <GUIManager> .Instance.OpenUI(uikey, isCloseAllUI, uiObjParams); } else if (openType == EnumOpenUIType.OpenNewCloseOld) { Singleton <GUIManager> .Instance.OpenMutexUI(isCloseAllUI, uikey, uiObjParams); } }
/// <summary> /// 获取界面对象上的Script /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uiKey"></param> /// <returns></returns> public T GetUI <T>(UIPanleID uiKey) where T : GUIBase { GameObject uiObject = this.GetUIObject(uiKey); if (uiObject != null) { return(uiObject.GetComponent <T>()); } return(null); }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="isRepel"></param> /// <param name="args"></param> /// <returns></returns> public GUIBase Hide(UIPanleID uiKey) { ui = null; if (allOpenUIDic.TryGetValue(uiKey, out ui)) { if (GetUI <GUIBase>(uiKey) != null) { GetUI <GUIBase>(uiKey).Hide(); } } return(GetUI <GUIBase>(uiKey)); }
/// <summary> /// ui,是否排斥其他界面isRepel=true,关闭所有打开界面,界面isRepel=false关闭界面 /// </summary> public GUIBase Show(UIPanleID uiKey) { ui = null; //Debug.Log(dict.TryGetValue(key, out ui)); if (allOpenUIDic.ContainsKey(uiKey)) { if (GetUI <GUIBase>(uiKey) != null) { GetUI <GUIBase>(uiKey).Show(); } } return(GetUI <GUIBase>(uiKey)); }
/// <summary> /// 打开单一界面 /// </summary> /// <param name="isCloseOthers">是否关闭其他所有界面,返回时不会打开来源界面</param> /// <param name="uiKey"></param> /// <param name="uiObjParams"></param> public void OpenMutexUI(bool isCloseOthers, UIPanleID uiKey, params object[] uiObjParams) { if (isCloseOthers) { CloseMutexUI(); } if (mutexUIList.Count > 0) { CloseUI(mutexUIList[mutexUIList.Count - 1]); } for (int i = 0; i < mutexUIList.Count; i++) { if (mutexUIList[i] == uiKey) { mutexUIList.RemoveAt(i); } } OpenMutexUI(uiKey, uiObjParams); }
/// <summary> /// 注册消息 /// </summary> /// <param name="messageID"></param> /// <param name="uiKey"></param> public void RegistMessageID(UInt32 messageID, UIPanleID uiKey) { if (!dicData.ContainsKey(messageID)) { List <UIPanleID> ls = new List <UIPanleID>(); ls.Add(uiKey); dicData.Add(messageID, ls); } else { List <UIPanleID> ls = null; if (dicData.TryGetValue(messageID, out ls)) { if (!ls.Contains(uiKey)) { ls.Add(uiKey); } } } }
static string GetBgmByPanelId(UIPanleID panelId) { string result = string.Empty; switch (panelId) { case UIPanleID.UIMountAndPet: result = "mount"; break; case UIPanleID.UIHeroList: case UIPanleID.EquipDevelop: result = "hero"; break; case UIPanleID.UIActivityPanel: result = "shilian"; break; case UIPanleID.UIShopPanel: result = "shop"; break; case UIPanleID.UIPvP: result = "duizhan"; break; case UIPanleID.UILevel: result = "copyUI"; break; case UIPanleID.UILottery: result = "lucky"; break; default: break; } return(result); }
/// <summary> /// 打开界面的核心方法 /// </summary> /// <param name="isCloseAll"></param> /// <param name="uiKey"></param> /// <param name="uiObjParams"></param> private void OpenUI(bool isCloseAll, UIPanleID[] uiKey, params object[] uiObjParams) { ///关闭所有UI。 if (isCloseAll) { this.CloseAllUI(); } //把要打开的UI压入栈中。 for (int i = 0; i < uiKey.Length; i++) { UIPanleID uiId = uiKey[i]; if (!allOpenUIDic.ContainsKey(uiId)) { string path = this.GetPrefabPathFromKey(uiId); stackOpenUI.Push(new UIInfoData(uiId, path, uiObjParams)); } } //协同打开UI if (Game.Instance != null) { Game.Instance.StartCoroutine(AyncCallbackOpenUI()); } }
public void AddOrDeletFullScreenUI(UIPanleID uiKey, bool isAdd) { if (isAdd) { for (int i = 0; i < mutexUIList.Count; i++) { if (mutexUIList[i] == uiKey) { mutexUIList.RemoveAt(i); } } mutexUIList.Add(uiKey); } else { for (int i = 0; i < mutexUIList.Count; i++) { if (mutexUIList[i] == uiKey) { mutexUIList.RemoveAt(i); } } } }
/// <summary> /// ui,isRepel = false排斥其他界面,args被关闭的界面 /// </summary> public static GUIBase Show(UIPanleID uikey) { return(Singleton <GUIManager> .Instance.Show(uikey)); }
/// <summary> /// 通过界面ID获取界面上的脚本 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uiKey"></param> /// <returns></returns> public static GUIBase GetUI <T>(UIPanleID uiKey) { return(Singleton <GUIManager> .Instance.GetUI <GUIBase>(uiKey)); }
/// <summary> /// 打开界面。默认的界面或者二级界面用这个方法打开 /// </summary> /// <param name="uiKey"></param> /// <param name="uiObjParams"></param> public void OpenUI(UIPanleID uiKey, bool isCloseAllUI, params object[] uiObjParams) { UIPanleID[] uiKeys = new UIPanleID[1]; uiKeys[0] = uiKey; this.OpenUI(isCloseAllUI, uiKeys, uiObjParams); }
/// <summary> /// 关闭默认界面或者二级界面时使用 /// </summary> /// <param name="uiKey"></param> public static void HideGUI(UIPanleID uiKey) { Singleton <GUIManager> .Instance.CloseUI(uiKey); }
/// <summary> /// 根据界面ID获取预设。 /// </summary> /// <param name="uiType">User interface type.</param> private string GetPrefabPathFromKey(UIPanleID uiKey) { string path = string.Empty; switch (uiKey) { case UIPanleID.UILogin: path = UIResourcesPath.UI_PREFAB + "UILogin"; break; case UIPanleID.UIRegister: path = UIResourcesPath.UI_PREFAB + "UIRegister"; break; case UIPanleID.UI_SelectServer: path = UIResourcesPath.UI_PREFAB + "UISelectServer"; break; case UIPanleID.UI_ServerList: path = UIResourcesPath.UI_PREFAB + "UIServerList"; break; case UIPanleID.UIGameAffiche: path = UIResourcesPath.UI_PREFAB + "UIGameAffiche"; break; case UIPanleID.UI_CreateRole: path = UIResourcesPath.UI_PREFAB + "UICreateRole"; break; case UIPanleID.UILoading: path = UIResourcesPath.UI_PREFAB + "UILoading"; break; case UIPanleID.UIPromptBox: path = UIResourcesPath.UI_PREFAB + "UIPromptBox"; break; case UIPanleID.UIRole: path = UIResourcesPath.UI_PREFAB + "UIRole"; break; case UIPanleID.UIPause: path = UIResourcesPath.UI_PREFAB + "UIPause"; break; case UIPanleID.ChangeIcon: path = UIResourcesPath.UI_PREFAB + "ChangeIcon"; break; case UIPanleID.UIRoleInfo: path = UIResourcesPath.UI_PREFAB + "UIRoleInfo"; break; case UIPanleID.ChangeName: path = UIResourcesPath.UI_PREFAB + "ChangeName"; break; case UIPanleID.Upgrade: path = UIResourcesPath.UI_PREFAB + "Upgrade"; break; case UIPanleID.UIMoney: path = UIResourcesPath.UI_PREFAB + "UIMoney"; break; case UIPanleID.UIChat: path = UIResourcesPath.UI_PREFAB + "UIChat"; break; case UIPanleID.UISetting: path = UIResourcesPath.UI_PREFAB + "UISetting"; break; //case UIPanleID.UIPopRefresh: // path = UIResourcesPath.UI_PREFAB + "UIPopRefresh"; // break; case UIPanleID.UIPopBuy: path = UIResourcesPath.UI_PREFAB + "UIPopBuy"; break; case UIPanleID.UIMask: path = UIResourcesPath.UI_PREFAB + "UIMask"; break; case UIPanleID.UIShopPanel: path = UIResourcesPath.UI_PREFAB + "UIShopPanel"; break; case UIPanleID.UILottery: path = UIResourcesPath.UI_PREFAB + "UILottery"; break; case UIPanleID.UIResultLottery: path = UIResourcesPath.UI_PREFAB + "UIResultLottery"; break; case UIPanleID.UIPopLottery: path = UIResourcesPath.UI_PREFAB + "UIPopLottery"; break; case UIPanleID.UIGetWayPanel: path = UIResourcesPath.UI_PREFAB + "UIGetWayPanel"; break; case UIPanleID.UILevel: path = UIResourcesPath.UI_PREFAB + "UILevel"; break; case UIPanleID.UIHeroList: path = UIResourcesPath.UI_PREFAB + "UIHeroList"; break; case UIPanleID.UIHeroDetail: path = UIResourcesPath.UI_PREFAB + "UIHeroDetail"; break; case UIPanleID.UIKnapsack: path = UIResourcesPath.UI_PREFAB + "UIKnapsack"; break; case UIPanleID.UISkillAndGoldHintPanel: path = UIResourcesPath.UI_PREFAB + "UISkillAndGoldHintPanel"; break; case UIPanleID.UIEmbattle: path = UIResourcesPath.UI_PREFAB + "UIEmbattle"; break; case UIPanleID.UISalePanel: path = UIResourcesPath.UI_PREFAB + "UISalePanel"; break; case UIPanleID.UIGoldHand: path = UIResourcesPath.UI_PREFAB + "UIGoldHand"; break; case UIPanleID.UITaskList: path = UIResourcesPath.UI_PREFAB + "UITaskList"; break; case UIPanleID.UICountdownPanel: path = UIResourcesPath.UI_PREFAB + "UICountdownPanel"; break; case UIPanleID.UIHeroUseExp: path = UIResourcesPath.UI_PREFAB + "UIHeroUseExp"; break; case UIPanleID.UIBuyEnergyVitality: path = UIResourcesPath.UI_PREFAB + "UIBuyEnergyVitality"; break; case UIPanleID.UIShopSell: path = UIResourcesPath.UI_PREFAB + "UIShopSell"; break; case UIPanleID.UIDialogue: path = UIResourcesPath.UI_PREFAB + "UIDialogue"; break; case UIPanleID.UIRankList: path = UIResourcesPath.UI_PREFAB + "UIRankList"; break; case UIPanleID.UIMailPanel: path = UIResourcesPath.UI_PREFAB + "UIMailPanel"; break; case UIPanleID.UIChatPanel: path = UIResourcesPath.UI_PREFAB + "UIChatPanel"; break; case UIPanleID.UIPlayerInteractionPort: path = UIResourcesPath.UI_PREFAB + "UIPlayerInteractionPort"; break; case UIPanleID.UIWaitForSever: path = UIResourcesPath.UI_PREFAB + "UIWaitForSever"; break; case UIPanleID.UITaskInfoPanel: path = UIResourcesPath.UI_PREFAB + "UITaskInfoPanel"; break; case UIPanleID.UITaskRewardPanel: path = UIResourcesPath.UI_PREFAB + "UITaskRewardPanel"; break; case UIPanleID.UIFriends: path = UIResourcesPath.UI_PREFAB + "UIFriends"; break; case UIPanleID.UIPlayerTitlePanel: path = UIResourcesPath.UI_PREFAB + "UIPlayerTitlePanel"; break; case UIPanleID.UIMarquee: path = UIResourcesPath.UI_PREFAB + "UIMarquee"; break; case UIPanleID.UIWelfare: path = UIResourcesPath.UI_PREFAB + "UIWelfare"; break; case UIPanleID.UISign_intBox: path = UIResourcesPath.UI_PREFAB + "UISign_intBox"; break; case UIPanleID.UITooltips: path = UIResourcesPath.UI_PREFAB + "UITooltips"; break; case UIPanleID.UITaskCollectPanel: path = UIResourcesPath.UI_PREFAB + "UITaskCollectPanel"; break; case UIPanleID.UIActivities: path = UIResourcesPath.UI_PREFAB + "UIActivities"; break; case UIPanleID.UIPopUp: path = UIResourcesPath.UI_PREFAB + "UIPopUp"; break; case UIPanleID.UIGoodsGetWayPanel: path = UIResourcesPath.UI_PREFAB + "UIGoodsGetWayPanel"; break; case UIPanleID.UITaskUseItemPanel: path = UIResourcesPath.UI_PREFAB + "UITaskUseItemPanel"; break; case UIPanleID.UIFriendTip: path = UIResourcesPath.UI_PREFAB + "UIFriendTip"; break; case UIPanleID.UIAbattiorList: path = UIResourcesPath.UI_PREFAB + "UIAbattiorList"; break; case UIPanleID.SceneEntry: path = UIResourcesPath.UI_PREFAB + "SceneEntry"; break; case UIPanleID.UITaskTracker: path = UIResourcesPath.UI_PREFAB + "UITaskTracker"; break; case UIPanleID.UIExpBar: path = UIResourcesPath.UI_PREFAB + "UIExpBar"; break; case UIPanleID.UIBoxGoodsTip: path = UIResourcesPath.UI_PREFAB + "UIBoxGoodsTip"; break; case UIPanleID.UIArenaModePanel: path = UIResourcesPath.UI_PREFAB + "UIArenaModePanel"; break; case UIPanleID.UIExptips: path = UIResourcesPath.UI_PREFAB + "UIExptips"; break; case UIPanleID.UIUseExpVialPanel: path = UIResourcesPath.UI_PREFAB + "UIUseExpVialPanel"; break; case UIPanleID.UINotJoinSocietyPanel: path = UIResourcesPath.UI_PREFAB + "UINotJoinSocietyPanel"; break; case UIPanleID.UIHaveJoinSocietyPanel: path = UIResourcesPath.UI_PREFAB + "UIHaveJoinSocietyPanel"; break; case UIPanleID.UISocietyInfoPanel: path = UIResourcesPath.UI_PREFAB + "UISocietyInfoPanel"; break; case UIPanleID.UISocietyInteractionPort: path = UIResourcesPath.UI_PREFAB + "UISocietyInteractionPort"; break; case UIPanleID.UIMountAndPet: path = UIResourcesPath.UI_PREFAB + "UIMountAndPet"; break; case UIPanleID.UILottryEffect: path = UIResourcesPath.UI_PREFAB + "UILottryEffect"; break; case UIPanleID.UILottryHeroEffect: path = UIResourcesPath.UI_PREFAB + "UILottryHeroEffect"; break; case UIPanleID.UIPvP: path = UIResourcesPath.UI_PREFAB + "UIPVP"; break; case UIPanleID.UIUseEnergyItemPanel: path = UIResourcesPath.UI_PREFAB + "UIUseEnergyItemPanel"; break; case UIPanleID.UISocietyIconPanel: path = UIResourcesPath.UI_PREFAB + "UISocietyIconPanel"; break; case UIPanleID.EquipDevelop: path = UIResourcesPath.UI_PREFAB + "EquipDevelop"; break; case UIPanleID.UIEquipDetailPanel: path = UIResourcesPath.UI_PREFAB + "UIEquipDetailPanel"; break; case UIPanleID.UIExpPropPanel: path = UIResourcesPath.UI_PREFAB + "UIExpPropPanel"; break; case UIPanleID.UIDeadToReborn: path = UIResourcesPath.UI_PREFAB + "UIDeadToReborn"; break; case UIPanleID.ArenaWinPanel: path = UIResourcesPath.UI_PREFAB + "ArenaWinPanel"; break; case UIPanleID.FlopPanel: path = UIResourcesPath.UI_PREFAB + "FlopPanel"; break; case UIPanleID.HeroSelectTipsPanel: path = UIResourcesPath.UI_PREFAB + "HeroSelectTipsPanel"; break; case UIPanleID.MobaMap: path = UIResourcesPath.UI_PREFAB + "MobaMap"; break; case UIPanleID.MobaStatInfo: path = UIResourcesPath.UI_PREFAB + "MobaStatInfo"; break; case UIPanleID.UIActivity: path = UIResourcesPath.UI_PREFAB + "UIActivity"; break; case UIPanleID.UICreateName: path = UIResourcesPath.UI_PREFAB + "UICreateName"; break; case UIPanleID.UITaskEffectPanel: path = UIResourcesPath.UI_PREFAB + "UITaskEffectPanel"; break; case UIPanleID.UITheBattlePanel: path = UIResourcesPath.UI_PREFAB + "TheBattlePanel"; break; case UIPanleID.UIFubenTaskDialogue: path = UIResourcesPath.UI_PREFAB + "UIFubenTaskDialogue"; break; default: path = string.Empty; break; } return(path); }
public UIInfoData(UIPanleID uiKey, string path, object[] uiObjParams) { UIKey = uiKey; Path = path; UIObjParams = uiObjParams; }
/// <summary> /// 通过界面ID获取界面GameObject /// </summary> /// <param name="uiKey"></param> /// <returns></returns> public static GameObject GetUIObject(UIPanleID uiKey) { return(Singleton <GUIManager> .Instance.GetUIObject(uiKey)); }
public static void Hide(UIPanleID uikey) { Singleton <GUIManager> .Instance.Hide(uikey); }
public static void AddOrDeletFullScreenUI(UIPanleID uiKey, bool isAdd = true) { Singleton <GUIManager> .Instance.AddOrDeletFullScreenUI(uiKey, isAdd); }