Пример #1
0
        protected override GameUI BindToCanvas(GameObject instance, Transform Parent, AbstractParams p)
        {
            AskCanvas();

            if (instance != null)
            {
                if (!this.isShow())
                {
                    this.ShowUILayout();
                }

                if (Parent == null)
                {
                    this.canvas.AddInstance(instance, false);
                }
                else
                {
                    Parent.AddInstance(instance);
                }
                //set ui
                GameUI ui = instance.GetComponentInChildren <GameUI>();
                if (ui == null)
                {
                    LogMgr.LogErrorFormat("{0} is Null ", instance);
                }
                else
                {
                    ui.ParentLayout = this;
                    ui.BindParent   = Parent;
                }
                return(ui);
            }

            return(null);
        }
Пример #2
0
    public static GameObject TryGetGameObject(this Transform g, string findname)
    {
        Transform trans = g.Find(findname);

        if (trans == null)
        {
            GameObject gameobject = new GameObject(findname);
            g.AddInstance(gameobject);

            trans = gameobject.transform;
        }
        return(trans.gameObject);
    }