public UIChildController CreateChildController(
            System.Type controllerType,
            GameObject parent     = null,
            Vector3 localPosition = new Vector3())
        {
            int context = GetElementCount(controllerType);
            UIChildController childController = UITools.CreateUIChildController(controllerType, context);

            if (childController != null)
            {
                if (!childController.HasUIView())
                {
                    if (parent == null)
                    {
                        parent = this.UINode.chcheGameObject;
                    }

                    GameObject viewObj = childController.CreateUIView(context, parent, localPosition: localPosition);
                }
                if (childController != null)
                {
                    childController.Init();
                }
                AddElementCount(controllerType);
                childControllerList.Add(childController);
            }
            return(childController);
        }
Example #2
0
        public static UIChildController CreateUIChildController(System.Type controllerType, int userContext = 0)
        {
            UIChildController controller   = Activator.CreateInstance(controllerType) as UIChildController;
            string            ControllerID = GetControllerKey(controllerType.Name, userContext);

            controller.SetControllerID(ControllerID);

            return(controller);
        }