//--------------------------------------------------------------------- public void DestoryUi(UiBase ui) { foreach (var i in ListUi) { if (i == ui) { i.OnDestroy(); ListUi.Remove(i); Object.Destroy(i.ComUi.displayObject.gameObject); return; } } }
//--------------------------------------------------------------------- public void CreateUi(string name) { UiFactory factory = null; MapUiFactory.TryGetValue(name, out factory); if (factory == null) { return; } UiBase ui = factory.CreateUi(); ui.Name = factory.GetName(); ui.ComUi = UIPackage.CreateObject(ui.Name, ui.Name).asCom; GRoot.inst.AddChild(ui.ComUi); ListUi.Add(ui); ui.OnCreate(); }