Example #1
0
        public virtual void Close()
        {
            if (!_closed)
            {
                _closed = true;

                UIManager.ClosePopUp(this);

                if (Closed != null)
                {
                    Closed(this);
                }
            }
        }
Example #2
0
        public static T OpenPopUp <T>(UIController parentController, params object[] args)
            where T : UIPopUpController
        {
            _args.Push(args);

            bool oneItemOnScene = false;

            foreach (Attribute eachAttribute in typeof(T).GetCustomAttributes(false))
            {
                if (eachAttribute is SingletoneAttribute)
                {
                    oneItemOnScene = true;
                    break;
                }
            }

            if (oneItemOnScene)
            {
                T existingController = (T)UnityEngine.Object.FindObjectOfType(typeof(T));

                if (existingController != null)
                {
                    UIManager.ClosePopUp(existingController);
                }
            }

            UIPopUpController controller = PopUpFactory.CreateInstance <T>(parentController);

            if (PopUpOpen != null)
            {
                PopUpOpen(controller);
            }

            if (parentController is IUIPopUpControllerHandler)
            {
                controller.Handler = (IUIPopUpControllerHandler)parentController;
            }

            return(controller as T);
        }
 public virtual void OnClose()
 {
     UIManager.ClosePopUp(this);
 }