/// <summary> /// 销毁UI /// </summary> /// <param name="type">UI逻辑类</param> public void DestroyUI(Type type) { if (_worldUIs.ContainsKey(type)) { UILogicBase ui = _worldUIs[type]; if (!ui.IsCreated) { return; } if (ui.IsOpened) { return; } ui.OnDestroy(); Destroy(ui.UIEntity); ui.UIEntity = null; } else { throw new HTFrameworkException(HTFrameworkModule.UI, "销毁UI失败:UI对象 " + type.Name + " 并未存在!"); } }
/// <summary> /// 销毁UI /// </summary> /// <param name="type">UI逻辑类</param> public void DestroyUI(Type type) { if (_worldUIs.ContainsKey(type)) { UILogicBase ui = _worldUIs[type]; if (!ui.IsCreated) { return; } if (ui.IsOpened) { return; } ui.OnDestroy(); Destroy(ui.UIEntity); ui.UIEntity = null; } else { GlobalTools.LogError(string.Format("销毁UI失败:UI对象 {0} 并未存在!", type.Name)); } }
/// <summary> /// 销毁UI实体 /// </summary> /// <param name="uILogic">UI逻辑类对象</param> private void DestroyUIEntity(UILogicBase uILogic) { if (!uILogic.IsCreated) { return; } uILogic.OnDestroy(); Main.Kill(uILogic.UIEntity); uILogic.UIEntity = null; }
/// <summary> /// 销毁UI /// </summary> /// <param name="type">UI逻辑类</param> public void DestroyUI(Type type) { if (_worldUIs.ContainsKey(type)) { UILogicBase ui = _worldUIs[type]; if (!ui.IsCreated) { return; } ui.OnDestroy(); Main.Kill(ui.UIEntity); ui.UIEntity = null; } }
/// <summary> /// 销毁域 /// </summary> public void OnTermination() { foreach (var ui in _worldUIs) { UILogicBase uiLogic = ui.Value; if (!uiLogic.IsCreated) { continue; } uiLogic.OnDestroy(); Destroy(uiLogic.UIEntity); uiLogic.UIEntity = null; } _worldUIs.Clear(); Destroy(_worldUIRoot.gameObject); }
/// <summary> /// 终结助手 /// </summary> public void OnTermination() { _defineUIAndEntitys.Clear(); foreach (var ui in OverlayUIs) { UILogicBase uiLogic = ui.Value; if (!uiLogic.IsCreated) { continue; } uiLogic.OnDestroy(); Main.Kill(uiLogic.UIEntity); uiLogic.UIEntity = null; } OverlayUIs.Clear(); foreach (var ui in CameraUIs) { UILogicBase uiLogic = ui.Value; if (!uiLogic.IsCreated) { continue; } uiLogic.OnDestroy(); Main.Kill(uiLogic.UIEntity); uiLogic.UIEntity = null; } CameraUIs.Clear(); foreach (var ui in WorldUIs) { ui.Value.OnTermination(); } WorldUIs.Clear(); }
public override void OnTermination() { base.OnTermination(); foreach (KeyValuePair <Type, UILogicBase> ui in _overlayUIs) { UILogicBase uiLogic = ui.Value; if (!uiLogic.IsCreated) { continue; } uiLogic.OnDestroy(); Destroy(uiLogic.UIEntity); uiLogic.UIEntity = null; } _overlayUIs.Clear(); foreach (KeyValuePair <Type, UILogicBase> ui in _cameraUIs) { UILogicBase uiLogic = ui.Value; if (!uiLogic.IsCreated) { continue; } uiLogic.OnDestroy(); Destroy(uiLogic.UIEntity); uiLogic.UIEntity = null; } _cameraUIs.Clear(); foreach (KeyValuePair <string, WorldUIDomain> ui in _worldUIs) { ui.Value.Termination(); } _worldUIs.Clear(); }
/// <summary> /// 销毁UI /// </summary> /// <param name="type">UI逻辑类</param> public void DestroyUI(Type type) { UIResourceAttribute attribute = type.GetCustomAttribute <UIResourceAttribute>(); if (attribute != null) { switch (attribute.EntityType) { case UIType.Overlay: if (OverlayUIs.ContainsKey(type)) { UILogicBase ui = OverlayUIs[type]; if (!ui.IsCreated) { return; } if (ui.IsOpened) { return; } ui.OnDestroy(); Main.Kill(ui.UIEntity); ui.UIEntity = null; } else { throw new HTFrameworkException(HTFrameworkModule.UI, "销毁UI失败:UI对象 " + type.Name + " 并未存在!"); } break; case UIType.Camera: if (CameraUIs.ContainsKey(type)) { UILogicBase ui = CameraUIs[type]; if (!ui.IsCreated) { return; } if (ui.IsOpened) { return; } ui.OnDestroy(); Main.Kill(ui.UIEntity); ui.UIEntity = null; } else { throw new HTFrameworkException(HTFrameworkModule.UI, "销毁UI失败:UI对象 " + type.Name + " 并未存在!"); } break; case UIType.World: if (WorldUIs.ContainsKey(attribute.WorldUIDomainName)) { WorldUIs[attribute.WorldUIDomainName].DestroyUI(type); } else { throw new HTFrameworkException(HTFrameworkModule.UI, "销毁UI失败:UI对象 " + type.Name + " 的域 " + attribute.WorldUIDomainName + " 并未存在!"); } break; } } }
/// <summary> /// 销毁UI /// </summary> /// <param name="type">UI逻辑类</param> public void DestroyUI(Type type) { UIResourceAttribute attribute = type.GetCustomAttribute <UIResourceAttribute>(); if (attribute != null) { switch (attribute.EntityType) { case UIType.Overlay: if (_overlayUIs.ContainsKey(type)) { UILogicBase ui = _overlayUIs[type]; if (!ui.IsCreated) { return; } if (ui.IsOpened) { return; } ui.OnDestroy(); Destroy(ui.UIEntity); ui.UIEntity = null; } else { GlobalTools.LogError(string.Format("销毁UI失败:UI对象 {0} 并未存在!", type.Name)); } break; case UIType.Camera: if (_cameraUIs.ContainsKey(type)) { UILogicBase ui = _cameraUIs[type]; if (!ui.IsCreated) { return; } if (ui.IsOpened) { return; } ui.OnDestroy(); Destroy(ui.UIEntity); ui.UIEntity = null; } else { GlobalTools.LogError(string.Format("销毁UI失败:UI对象 {0} 并未存在!", type.Name)); } break; case UIType.World: if (_worldUIs.ContainsKey(attribute.WorldUIDomainName)) { _worldUIs[attribute.WorldUIDomainName].DestroyUI(type); } else { GlobalTools.LogError(string.Format("销毁UI失败:UI对象 {0} 的域 {1} 并未存在!", type.Name, attribute.WorldUIDomainName)); } break; } } }