private void Awake() { GameObject uiCanvas = GameObject.Find("/UICanvas"); uiCanvas.GetComponent<Canvas>().worldCamera = GameObject.Find("/Camera").GetComponent<Camera>(); this.Root = new UI(this.GetOwner<Scene>(), UIType.Root, null, uiCanvas); this.Load(); }
public UI(Scene scene, UIType uiType, UI parent, GameObject gameObject) : base(EntityType.UI) { this.Scene = scene; this.UIType = uiType; gameObject.transform.SetParent(parent?.GameObject.transform); this.GameObject = gameObject; this.AddComponent<ChildrenComponent<UI>>(); }
public UI Create(Scene scene, UIType type, UI parent) { GameObject mainPrefab = Resources.Load<GameObject>("UI/LoginPanel"); mainPrefab = Object.Instantiate(mainPrefab); mainPrefab.layer = LayerMask.NameToLayer(LayerNames.UI); UI ui = new UI(scene, type, parent, mainPrefab); parent.AddChild(ui); return ui; }
public void Add(UIType type, UI ui) { this.uis.Add(type, ui); }
public void Add(UI ui) { this.children.Add(ui.Name, ui); ui.Parent = this; }