Пример #1
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);
            }
Пример #2
0
        public void EqualsTest()
        {
            var state1 = new PageState <SamplePage>();
            var state2 = new PageState <SamplePage>();

            Assert.AreEqual(state1, state2);

            state1.Stack.Add(new PageEntity <SamplePage>(SamplePage.Page1, null));
            Assert.AreNotEqual(state1, state2);

            state2.Stack.Add(new PageEntity <SamplePage>(SamplePage.Page1, null));
            Assert.AreEqual(state1, state2);

            state2.Stack.RemoveLast();
            state2.Stack.Add(new PageEntity <SamplePage>(SamplePage.Page2, null));
            Assert.AreNotEqual(state1, state2);

            state2.Stack.RemoveLast();
            state2.Stack.Add(new PageEntity <SamplePage>(SamplePage.Page1, new SampleData()));
            Assert.AreNotEqual(state1, state2);
        }
Пример #3
0
            public PageState <TPage> ReduceAdjust(PageState <TPage> pageState, SceneState <TScene> sceneState)
            {
                SceneDuck <TScene> .Remove(sceneState, config.GetPageScenes());

                if (pageState.Stack.Any())
                {
                    var page = pageState.Current.Page;

                    if (!config.PageMap.ContainsKey(page))
                    {
                        Debug.LogWarning(
                            "Page adjust failed. Missing configuration in SceneConfig.PageMap: " + page);
                    }

                    var scenes = config.PageMap[page];

                    SceneDuck <TScene> .Add(sceneState, scenes);
                }

                sceneState.SetStateChanged();
                return(pageState);
            }