Exemple #1
0
        public void NotifyModalDone <Result>(Result result, uint i_modalId)
        {
            Type      t    = GetClassType <Result>();
            ModalInfo info = m_levels.Pop();

            Debug.Assert(info.type == t);
            Debug.Assert(info.modalData.id == i_modalId);
            for (int i = SceneManager.sceneCount - 1; i >= 0; --i)
            {
                Scene scene = SceneManager.GetSceneAt(i);
                if (scene.name == info.level)
                {
                    SceneManager.UnloadSceneAsync(scene);
                    break;
                }
            }

            UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(info.lastSelectable.gameObject);
            if (m_levels.Count > 0)
            {
                ModalInfo stackedModalGameplay = m_levels.Peek();
                stackedModalGameplay.lastSelectable = null;
                if (stackedModalGameplay.gameplay != null)
                {
                    stackedModalGameplay.gameplay.Resume();
                }
            }
        }
Exemple #2
0
 internal TextInputComponentInfo(Builders.TextInputComponentBuilder builder, ModalInfo modal) : base(builder, modal)
 {
     Style        = builder.Style;
     Placeholder  = builder.Placeholder;
     MinLength    = builder.MinLength;
     MaxLength    = builder.MaxLength;
     InitialValue = builder.InitialValue;
 }
        /// <inheritdoc/>
        public override ModalCommandParameterBuilder SetParameterType(Type type)
        {
            if (typeof(IModal).IsAssignableFrom(type))
            {
                Modal = ModalUtils.GetOrAdd(type);
            }

            return(base.SetParameterType(type));
        }
Exemple #4
0
        public void StartWithGameplay <Result>(ModalMenuInput <Result> i_modalData, IModalGameplay i_gameplay)
        {
            Debug.Assert(m_levels.Count == 0);
            Type      t    = GetClassType <Result>();
            ModalInfo info = new ModalInfo();

            info.modalData = i_modalData;
            info.type      = t;
            info.gameplay  = i_gameplay;
            m_levels.Push(info);
        }
Exemple #5
0
        public ModalMenuInput <Result> ExtractData <Result>(IModalGameplay i_gameplay = null)
        {
            //Type t = GetClassType<Result>();
            if (m_levels.Count == 0)
            {
                return(null);
            }
            ModalInfo info = m_levels.Peek();

            info.gameplay = i_gameplay;
            return(info.modalData as ModalMenuInput <Result>);
        }
Exemple #6
0
        public ModalYield <Result> LoadMenu <Result>(ModalMenuInput <Result> i_modalData, string i_menuLevel)
        {
            Type      t    = GetClassType <Result>();
            ModalInfo info = new ModalInfo();

            info.modalData      = i_modalData;
            info.level          = i_menuLevel;
            info.type           = t;
            info.lastSelectable = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>();
            if (m_levels.Count > 0)
            {
                ModalInfo stackedModalGameplay = m_levels.Peek();
                if (stackedModalGameplay.gameplay != null)
                {
                    stackedModalGameplay.gameplay.Suspend();
                }
            }
            m_levels.Push(info);

            SceneManager.LoadScene(i_menuLevel, LoadSceneMode.Additive);
            return(i_modalData.yielder);
        }
 internal override TextInputComponentInfo Build(ModalInfo modal) =>
Exemple #8
0
 internal abstract TInfo Build(ModalInfo modal);