Пример #1
0
    public void _23_0_CollectedConditionsDescriptorDirectory()
    {
        var conditionCategories = new List <string> {
            "Act", "Anim"
        };

        var classDesc = new NoConstructorClassDescriptor(
            new List <string> {
            "System"
        },
            new List <string> {
            "generated CollectedConditions by Automatine."
        },
            "public",
            "partial",
            "CollectedConditions_dummy0",
            () =>
        {
            var source = new CollectedConditionDefineDesc("CollectedConditions_dummy0", conditionCategories);
            return(source.data);
        }
            );

        var basePath   = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor");
        var outputPath = Path.Combine(basePath, "_23_0_CollectedConditionsDescriptorDirectory.cs");

        // write class file
        using (var sw = new StreamWriter(outputPath))
        {
            sw.Write(classDesc.data);
        }
    }
Пример #2
0
    public void _24_0_ChangerDescriptorDirectory()
    {
        var routeName       = "TestRoute0";
        var ChangerComments = new List <string> {
            "this changer is for change auto from move to other."
        };
        var branches = new List <ChangerBranchData>();
        // branch0
        {
            var branchComments = new List <string> {
                "comment for branchName0"
            };
            var branchConditions = new List <ConditionBindData> {
                new ConditionBindData(ChangerCondKey.NOTCONTAINS, new List <ConditionTypeValueData> {
                    new ConditionTypeValueData("Act", "SPAWN")
                }),
                new ConditionBindData(ChangerCondKey.CONTAINS, new List <ConditionTypeValueData> {
                    new ConditionTypeValueData("Act", "DEFAULT")
                }),
                new ConditionBindData(ChangerCondKey.CONTAINSALL, new List <ConditionTypeValueData> {
                    new ConditionTypeValueData("Act", "DEFAULT")
                }),
                new ConditionBindData(ChangerCondKey.NOTCONTAINSALL, new List <ConditionTypeValueData> {
                    new ConditionTypeValueData("Act", "SPAWN")
                })
            };
            var branchNext     = "MoveAuto";
            var branchContinue = false;
            var branchInherits = new List <string> {
                "Move"
            };

            branches.Add(new ChangerBranchData(branchComments, branchConditions, branchNext, branchContinue, branchInherits));
        }

        {
            // branch1
            var branchComments = new List <string> {
                "comment for branchName1"
            };
            var branchConditions = new List <ConditionBindData> {
                new ConditionBindData(ChangerCondKey.CONTAINS, new List <ConditionTypeValueData> {
                    new ConditionTypeValueData("Act", "SPAWN")
                })
            };
            var branchNext     = string.Empty;
            var branchContinue = true;
            var branchInherits = new List <string>();

            branches.Add(new ChangerBranchData(branchComments, branchConditions, branchNext, branchContinue, branchInherits));
        }

        var finallyBranchDict = new FinallyBranchData();

        var classCommentBase = new List <string> {
            routeName, "generated Changer by Automatine."
        };

        classCommentBase.AddRange(ChangerComments);

        var classDesc = new NoConstructorClassDescriptor(
            new List <string> {
            "System", "Automatine"
        },
            classCommentBase,
            "public",
            string.Empty,
            "Changer_" + routeName + " : IAutoChanger",
            () =>
        {
            var source = new ChangerMethodDesc(routeName, branches, finallyBranchDict);
            return(source.data);
        },
            () =>
        {
            var source = new ChangerShouldImplementMethodDesc(routeName, branches, finallyBranchDict);
            return(source.data);
        }
            );

        var desc = classDesc.data;

        var basePath   = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor");
        var outputPath = Path.Combine(basePath, "_24_0_ChangerDescriptorDirectory.cs");

        // write class file
        using (var sw = new StreamWriter(outputPath))
        {
            sw.Write(desc);
        }
    }