Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public static void Add(this GObject self, FGUI fui)
 {
     if (self != null && fui != null)
     {
         keyValuePairs[self] = fui;
     }
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        public override void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            base.Dispose();

            Root?.Dispose();
            Root = null;
        }
Ejemplo n.º 5
0
        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);
        }