Esempio n. 1
0
 public void AddDialog(string title, string text, DialogAction dialogAction, string dismissMessage)
 {
     if (!dialogIsActive)
     {
         dialogIsActive = true;
         GameObject newDialogObject = dialogPool.GetObject();
         newDialogObject.SetActive(true);
         GenericDialog newDialog = newDialogObject.GetComponent <GenericDialog>();
         newDialog.Init(title, text, dialogAction, dismissMessage);
         currentDialog = newDialog.gameObject;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Will instantiate (from a pool) a UIView of type T (if exist) and it will return a SharedRef of the View.
        /// When the UIView is closed, the SharedRef will be automaticaly set to null.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="priority">Render order for the View</param>
        /// <returns></returns>
        public SharedNullableReference <T> RequestView <T>(EViewPriority priority = EViewPriority.MediumRenderPriority) where T : UIView
        {
            if (m_viewsMap.ContainsKey(typeof(T)))
            {
                T requestedView = m_viewPool.GetObject <T>(m_viewsMap[typeof(T)] as T);
                requestedView.transform.SetParent(m_priorityParentDict[priority], false);
                requestedView.gameObject.SetActive(false);
                NullableReference <UIView> newNullableRef = new NullableReference <UIView>(requestedView);
                m_activeViews.Add(newNullableRef);
                requestedView.RegisterOnFinishClosing(OnViewClosed);
                return(newNullableRef.MakeSharedRefAs <T>());
            }

            return(null);
        }