//动态增加ui时需传入uipath,在uitype和uiname中均需要配置 public UIOperateBase showUI <T>(UITypes type, string path = "") where T : UIOperateBase { if (!_UIList.ContainsKey(type)) { if (!checkNameConfig(type)) { return(null); } string name = UIName.Type2Name[type]; if (path == "") { _UIList.Add(type, UIOperateBase.New <T>(name)); } else { _UIList.Add(type, UIOperateBase.DynamicNew <T>(name, path)); } } _UIList[type].Open(); if (!checkIsHUDUI(type)) { updateOpenCout(1); } EventManager.SendEvent(EventMacro.SHOW_UI, type); _layerController.updateLayer(type, UILayers.HIGHEST); return(_UIList[type]); }
public void register(UIOperateBase ui) { if (!_UIList.ContainsKey(ui.uiType)) { _UIList.Add(ui.uiType, ui); } }
void AddChild(UIOperateBase child) { if (childrenList.Contains(child)) { return; } childrenList.Add(child); }
public void SetParent(UIOperateBase parent) { this.transform.parent = parent.transform; this.parent = parent; parent.AddChild(this); RectTransform rectTrans = GetComponent <RectTransform>(); rectTrans.anchorMin = new Vector2(0.5f, 0.5f); rectTrans.anchorMax = new Vector2(0.5f, 0.5f); }
public virtual void Dispose() { foreach (UIOperateBase child in childrenList) { child.Dispose(); } this.transform.parent = null; this.parent = null; Destroy(viewGo); viewGo = null; }
public void registerUI <T>(UITypes type) where T : UIOperateBase { if (!checkNameConfig(type)) { return; } string name = UIName.Type2Name[type]; _UIList.Add(type, UIOperateBase.New <T>(name)); _layerController.register(_UIList[type]); }
public void OpenText() { if (itemBag == null) { itemBag = UIOperateBase.New <UIOpBag> ("Bag"); } else { itemBag.Open(); } //text.gameObject.SetActive (true); }
void Awake() { uiOpRoot = GameObject.Find("Canvas").AddComponent <UIOperateBase>(); }