コード例 #1
0
        void SetupSUT(string html)
        {
            procedure = new Procedure("procedure", Parse.ParseFrom(html));

            result  = new TypedValue("result");
            target  = new TypedValue("target");
            fixture = new TypedValue("fixture");

            testStatus = new TestStatus();

            processor = new Mock <CellProcessor>();
            runtime   = new RuntimeProcedure {
                Processor = processor.Object
            };

            processor.Setup(p => p.TestStatus).Returns(testStatus);
            processor.Setup(p => p.Contains(It.Is <Procedure>(v => v.Id == "member"))).Returns(false);
            processor.Setup(p => p.Contains(It.Is <Procedure>(v => v.Id == "procedure"))).Returns(true);
            processor.Setup(p => p.Load(It.Is <Procedure>(v => v.Id == "procedure"))).Returns(procedure);

            processor.Setup(p => p.Parse(typeof(Interpreter), target, It.Is <Tree <Cell> >(c => IsDoFixture(c))))
            .Returns(fixture);

            processor.Setup(p => p.Execute(fixture, It.Is <Tree <Cell> >(t => IsTablesWithVerb(t))))
            .Returns((TypedValue f, Tree <Cell> t) => {
                t.Branches[0].Branches[0].Branches[0].Value.SetAttribute(CellAttribute.Label, "stuff");
                testStatus.PopReturn();
                testStatus.PushReturn(result);
                return(TypedValue.Void);
            });

            processor.Setup(p => p.Parse(typeof(StoryTestString), It.IsAny <TypedValue>(),
                                         It.Is <Tree <Cell> >(t => IsTableWithVerb(t))))
            .Returns(new TypedValue("procedure log"));
        }
コード例 #2
0
        public override void OnUpdate(IFsm <IProcedureManager> procedureOwner)
        {
            if (m_StartGame)
            {
                procedureOwner.SetData(Constant.ProcedureData.NextSceneId, new VarInt(GameEntry.Config.GetInt("Scene.Main")));
                procedureOwner.SetData(Constant.ProcedureData.GameMode, new VarInt((int)GameMode.Survival));

                RuntimeProcedure.ChangeProcedure <HotProcedureChangeScene>(procedureOwner);
            }
        }
コード例 #3
0
        public override void OnUpdate(IFsm <IProcedureManager> procedureOwner)
        {
            if (!m_IsChangeSceneComplete)       //检查是否完成
            {
                return;
            }

            //清空对象池
            GameEntry.ObjectPool.ReleaseAllUnused();

            //切换流程
            if (m_ChangeToMenu)
            {
                RuntimeProcedure.ChangeProcedure <HotProcedureMenu>(procedureOwner);
            }
            else
            {
                RuntimeProcedure.ChangeProcedure <HotProcedureMain>(procedureOwner);
            }
        }
コード例 #4
0
        public override void OnUpdate(IFsm <IProcedureManager> procedureOwner)
        {
            if (m_CurrentGame != null && !m_CurrentGame.IsGameOver)
            {
                m_CurrentGame.Update(HotfixEntry.deltaTime, HotfixEntry.unscaleDeltaTime);
                return;
            }

            if (!m_GotoMenu)
            {
                m_GotoMenu             = true;
                m_GotoMenuDelaySeconds = 0f;
            }

            m_GotoMenuDelaySeconds += HotfixEntry.deltaTime;
            if (m_GotoMenuDelaySeconds >= GameOverDelayedSeconds)
            {
                procedureOwner.SetData <VarInt>(Constant.ProcedureData.NextSceneId, new VarInt(GameEntry.Config.GetInt("Scene.Menu")));
                RuntimeProcedure.ChangeProcedure <HotProcedureChangeScene>(procedureOwner);
            }
        }
コード例 #5
0
        private void SetupSUT(string html)
        {
            procedure = new Procedure("procedure", new HtmlParser().Parse(html));

            result = new TypedValue("result");
            target = new TypedValue("target");
            fixture = new TypedValue("fixture");

            testStatus = new TestStatus();

            processor = new Mock<CellProcessor>();
            runtime = new RuntimeProcedure {Processor = processor.Object};

            processor.Setup(p => p.TestStatus).Returns(testStatus);
            processor.Setup(p => p.Contains(It.Is<Procedure>(v => v.Id == "member"))).Returns(false);
            processor.Setup(p => p.Contains(It.Is<Procedure>(v => v.Id == "procedure"))).Returns(true);
            processor.Setup(p => p.Load(It.Is<Procedure>(v => v.Id == "procedure"))).Returns(procedure);

            processor.Setup(p => p.Parse(typeof (Interpreter), target, It.Is<Tree<Cell>>(c => IsDoFixture(c))))
                .Returns(fixture);

            processor.Setup(p => p.Execute(fixture, It.Is<Tree<Cell>>(t => IsTablesWithVerb(t))))
                .Returns((TypedValue f, Tree<Cell> t) => {
                    t.Branches[0].Branches[0].Branches[0].Value.SetAttribute("some", "stuff");
                    testStatus.PopReturn();
                    testStatus.PushReturn(result);
                    return TypedValue.Void;
                });

            processor.Setup(p => p.Parse(typeof (StoryTestString), It.IsAny<TypedValue>(),
                                         It.Is<Tree<Cell>>(t => IsTableWithVerb(t))))
                .Returns(new TypedValue("procedure log"));
        }