public void Add(FGUI ui, bool asChildGObject) { if (ui == null || ui.IsEmpty) { throw new Exception($"ui can not be empty"); } if (string.IsNullOrWhiteSpace(ui.Name)) { throw new Exception($"ui.Name can not be empty"); } if (fuiChildren.ContainsKey(ui.Name)) { throw new Exception($"ui.Name({ui.Name}) already exist"); } fuiChildren.Add(ui.Name, ui); if (IsComponent && asChildGObject) { GObject.asCom.AddChild(ui.GObject); } ui.Parent = this; }
public static void Add(this GObject self, FGUI fui) { if (self != null && fui != null) { keyValuePairs[self] = fui; } }
public void Add(FGUI ui, UILayer layer = UILayer.Mid, bool asChildGObject = true) { var layerUI = Root?.Get(layer.ToString()); if (layerUI != null) { layerUI.Add(ui, asChildGObject); } }
public override void Dispose() { if (IsDisposed) { return; } base.Dispose(); Root?.Dispose(); Root = null; }
public void Awake(Scene scene) { for (int i = 0; i < (int)UILayer.All; i++) { GComponent com = new GComponent(); com.name = ((UILayer)i).ToString(); com.SetSize(GRoot.inst.width, GRoot.inst.height); com.SetXY(0, 0); #if UNITY_EDITOR com.displayObject.gameObject.name = com.name; #endif FGUI layer = EntityFactory.Create <FGUI, GObject>(scene, com); Root.Add(layer, true); } //Root.GObject.asCom.AddChild(ui.GObject); }