コード例 #1
0
ファイル: ControlStatementsTest.cs プロジェクト: yole/unhood
        public void Continue()
        {
            var builder = new StatementListBuilder();

            builder
            .AddForeach(0, 136, "Outer.WorldInfo.AllControllers(Class'PlayerController', PC)")
            .AddJumpIfNot(37, 135, "PC.bIsPlayer && PC.IsLocalPlayerController()")
            .Add(79, "DCC = (DebugCameraController) PC")
            .AddJumpIfNot(95, 132, "DCC != None && DCC.OryginalControllerRef == None")
            .AddIteratorNext(128)
            .AddJump(129, 136)
            .AddJump(132, 136)
            .AddIteratorNext(135)
            .AddIteratorPop(136)
            .AddReturn(137);
            VerifyText(builder,
                       "foreach Outer.WorldInfo.AllControllers(Class'PlayerController', PC)",
                       "{",
                       "    if (PC.bIsPlayer && PC.IsLocalPlayerController())",
                       "    {",
                       "        DCC = (DebugCameraController) PC;",
                       "        if (DCC != None && DCC.OryginalControllerRef == None)",
                       "        {",
                       "            continue;",
                       "        }",
                       "        break;",
                       "    }",
                       "}");
        }
コード例 #2
0
ファイル: ControlStatementsTest.cs プロジェクト: yole/unhood
        public void BreakInElseInForeach()
        {
            var builder = new StatementListBuilder();

            builder
            .AddForeach(320, 438, "LocalPlayerControllers(Class'PlayerController', P)")
            .AddJumpIfNot(339, 437, "P.ViewTarget != None")
            .AddJumpIfNot(359, 402, "P.Pawn == Instigator && Instigator != None")
            .AddIteratorPop(396)
            .AddReturn(397, "true")
            .AddJump(399, 437)
            .Add(402, "bResult = CheckMaxEffectDistance(P, SpawnLocation, CullDistance)")
            .AddJump(434, 438)
            .AddIteratorNext(437)
            .AddIteratorPop(438)
            .AddReturn(439, "bResult");
            VerifyText(builder,
                       "foreach LocalPlayerControllers(Class'PlayerController', P)",
                       "{",
                       "    if (P.ViewTarget != None)",
                       "    {",
                       "        if (P.Pawn == Instigator && Instigator != None)",
                       "        {",
                       "            return true;",
                       "        }",
                       "        else",
                       "        {",
                       "            bResult = CheckMaxEffectDistance(P, SpawnLocation, CullDistance);",
                       "            break;",
                       "        }",
                       "    }",
                       "}",
                       "return bResult;");
        }
コード例 #3
0
ファイル: ControlStatementsTest.cs プロジェクト: yole/unhood
        public void BreakInIfInForeach()
        {
            var builder = new StatementListBuilder();

            builder
            .AddForeach(0, 99, "Outer.WorldInfo.AllControllers(Class'Controller', P)")
            .AddJumpIfNot(37, 98, "P.bIsPlayer && P.PlayerReplicationInfo.GetPlayerAlias() ~= S")
            .AddJump(95, 99)
            .AddIteratorNext(98)
            .AddIteratorPop(99)
            .AddReturn(100);
            VerifyText(builder,
                       "foreach Outer.WorldInfo.AllControllers(Class'Controller', P)",
                       "{",
                       "    if (P.bIsPlayer && P.PlayerReplicationInfo.GetPlayerAlias() ~= S)",
                       "    {",
                       "        break;",
                       "    }",
                       "}");
        }
コード例 #4
0
ファイル: ControlStatementsTest.cs プロジェクト: yole/unhood
        public void IfInForeach()
        {
            var builder = new StatementListBuilder();

            builder
            .AddForeach(175, 238, "Outer.DynamicActors(Class'Actor', A)")
            .AddJumpIfNot(200, 237, "ClassIsChildOf(A.Class, aClass)")
            .Add(225, "A.Destroy()")
            .AddIteratorNext(237)
            .AddIteratorPop(238)
            .AddReturn(239);
            VerifyText(builder,
                       "foreach Outer.DynamicActors(Class'Actor', A)",
                       "{",
                       "    if (ClassIsChildOf(A.Class, aClass))",
                       "    {",
                       "        A.Destroy();",
                       "    }",
                       "}");
        }
コード例 #5
0
ファイル: ControlStatementsTest.cs プロジェクト: yole/unhood
        public void ForEachSimple()
        {
            var builder = new StatementListBuilder();

            builder
            .AddForeach(0, 52, "Outer.DynamicActors(Class'Actor', A)")
            .Add(25, "I++")
            .Add(32, "LogInternal(I @ A))")
            .AddIteratorNext(51)
            .AddIteratorPop(52)
            .Add(53, "LogInternal(\"Num dynamic actors: \" $ I)")
            .AddReturn(87);
            VerifyText(builder,
                       "foreach Outer.DynamicActors(Class'Actor', A)",
                       "{",
                       "    I++;",
                       "    LogInternal(I @ A));",
                       "}",
                       "LogInternal(\"Num dynamic actors: \" $ I);");
        }
コード例 #6
0
ファイル: ControlStatementsTest.cs プロジェクト: yole/unhood
        public void ReturnInForeach()
        {
            var builder = new StatementListBuilder();

            builder
            .AddForeach(0, 106, "Outer.AllActors(Class'Actor', A)")
            .AddJumpIfNot(25, 105, "A.Name == actorName")
            .Add(49, "Outer.SetViewTarget(A)")
            .AddIteratorPop(102)
            .AddReturn(103)
            .AddIteratorNext(105)
            .AddIteratorPop(106)
            .AddReturn(107);
            VerifyText(builder,
                       "foreach Outer.AllActors(Class'Actor', A)",
                       "{",
                       "    if (A.Name == actorName)",
                       "    {",
                       "        Outer.SetViewTarget(A);",
                       "        return;",
                       "    }",
                       "}");
        }