Esempio n. 1
0
            public PageState <TPage> ReducePush(
                PageState <TPage> pageState,
                SceneState <TScene> sceneState,
                IPageEntity <TPage> action
                )
            {
                if (!config.PageMap.ContainsKey(action.Page))
                {
                    Debug.LogWarning(
                        "Page pushing failed. Missing configuration in SceneConfig.PageMap: " + action.Page);
                    return(pageState);
                }

                if (pageState.Stack.Any() && pageState.Current.Page.Equals(action.Page))
                {
                    Debug.LogWarning(
                        "Page pushing failed. Cannot push same page at once: " + action.Page);
                    return(pageState);
                }

                pageState.Stack.Add(action);
                pageState.SetStateChanged();

                ReduceAdjust(pageState, sceneState);
                return(pageState);
            }
Esempio n. 2
0
            public PageState <TPage> ReduceReset(PageState <TPage> pageState, SceneState <TScene> sceneState,
                                                 ResetAction action)
            {
                pageState.Stack.Clear();
                SceneDuck <TScene> .Remove(sceneState, config.GetPageScenes());

                pageState.SetStateChanged();
                return(pageState);
            }
Esempio n. 3
0
            public PageState <TPage> ReduceSetData(PageState <TPage> state, SetDataAction action)
            {
                if (!state.IsReady)
                {
                    Debug.LogWarning("PageDuck.SetData failed. Set some page before you set page data");
                    return(state);
                }

                state.Current.Data = action.Data;
                state.SetStateChanged();
                return(state);
            }
Esempio n. 4
0
            public PageState <TPage> ReducePop(
                PageState <TPage> pageState,
                SceneState <TScene> sceneState,
                PopAction action
                )
            {
                // don't remove last page
                if (pageState.Stack.Count > 1)
                {
                    pageState.Stack.RemoveLast();
                }

                pageState.SetStateChanged();

                ReduceAdjust(pageState, sceneState);
                return(pageState);
            }