public void ContravarianceTestMethod() { IDescriptor <Transport> transportDescriptor = new TransportDescriptor(); IDescriptor <Auto> autoDescriptor = new AutoDescriptor(); autoDescriptor = transportDescriptor; }
public void _22_0_ConditionDescriptorDirectory() { // AutoConditionsのファイルを作り出す。 var conditionName = "Act_dummy"; var comments = new List <string> { "comment of this conditions here", "yes." }; var conditionAndComments = new List <ValueAndCommentData> { new ValueAndCommentData("SAMPLEROUTINE", "routineのサンプル"), new ValueAndCommentData("P0", "comment"), new ValueAndCommentData("P1", "comment"), new ValueAndCommentData("P2", "comment"), new ValueAndCommentData("P3", "comment"), new ValueAndCommentData("SPAWN", "生成アクション"), new ValueAndCommentData("DEFAULT", "デフォルト状態"), new ValueAndCommentData("DAMAGE", "ダメージ受けてる"), new ValueAndCommentData("FIVEFRAME_SPAN", "5Fで終わる"), new ValueAndCommentData("TENFRAME_SPAN", "10Fで終わる") }; var desc = AutoDescriptor.AutoConditions("DummyAutoConditions0", conditionName, comments, conditionAndComments); var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var outputPath = Path.Combine(basePath, "_22_0_ConditionDescriptorDirectory.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } }
public void _22_1_ConditionDescriptorFromJson() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_22_1_ConditionDescriptorFromJson.json"); { var conditionDict = new ConditionValueData( "Act_dummy", new List <string> { "comment of this conditions here", "yes." }, new List <ValueAndCommentData> { new ValueAndCommentData("SAMPLEROUTINE", "routineのサンプル"), new ValueAndCommentData("P0", "comment"), new ValueAndCommentData("P1", "comment"), new ValueAndCommentData("P2", "comment"), new ValueAndCommentData("P3", "comment"), new ValueAndCommentData("SPAWN", "生成アクション"), new ValueAndCommentData("DEFAULT", "デフォルト状態"), new ValueAndCommentData("DAMAGE", "ダメージ受けてる"), new ValueAndCommentData("FIVEFRAME_SPAN", "5Fで終わる"), new ValueAndCommentData("TENFRAME_SPAN", "10Fで終わる") } ); // jsonファイルに吐き出す var serialized = JsonUtility.ToJson(conditionDict); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <ConditionValueData>(body); var conditionName = deserialized.typeId; var conditionComments = deserialized.comment; var conditionsAndComments = deserialized.valueAndComments; var desc = AutoDescriptor.AutoConditions("DummyAutoConditions1", conditionName, conditionComments, conditionsAndComments); var outputPath = Path.Combine(basePath, "_22_1_ConditionDescriptorFromJson.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }
public void _24_2_ChangerDescriptorFromJsonWithFinally() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_24_2_ChangerDescriptorFromJsonWithFinally.json"); { // write to json. var classGenParam = new ChangerData( "TestRouteId2", "TestRoute2", "parentAutoId", new List <string> { "this changer is for change move or not." }, new List <BranchData>(), new FinallyBranchData( "MoveAuto", new List <string> { "Move" } ) ); var serialized = JsonUtility.ToJson(classGenParam); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <ChangerData>(body); var changerName = deserialized.changerName; var commentLines = deserialized.comments; var branches = deserialized.branchs; var finallyBranch = deserialized.finallyBranch; var desc = AutoDescriptor.Changer(changerName, commentLines, branches, finallyBranch); var outputPath = Path.Combine(basePath, "_24_2_ChangerDescriptorFromJsonWithFinally.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }
public void _20_3_AutoGeneratorDescriptorOfEmptyTimeline() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_20_3_AutoGeneratorDescriptorOfEmptyTimeline.json"); { // write to json file. var classGenParam = new AutoData( "2016/01/06 16:55:06", "Auto_Default3", "autoInfo", new List <string> { "複数行のコメント", "描きたいですね。" }, new List <TimelineData> { new TimelineData( "2016/01/06 16:55:06", "timelineInfo_0" ) } ); var serialized = JsonUtility.ToJson(classGenParam); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <AutoData>(body); var desc = AutoDescriptor.Auto("<InitialParamType, UpdateParamType>", deserialized); var outputPath = Path.Combine(basePath, "_20_3_AutoGeneratorDescriptorOfEmptyTimeline.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }
public void _21_1_RoutineDescriptorFromJson() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_21_1_RoutineDescriptorFromJson.json"); { // generate routine file var routineDict = new RoutineData( "Default_dummy1", new List <string> { "デフォルトルーチン、", "ここでデフォルト動作を設定する" } ); // jsonファイルに吐き出す var serialized = JsonUtility.ToJson(routineDict); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <RoutineData>(body); var routineName = deserialized.info; var comments = deserialized.comments; var desc = AutoDescriptor.Routine("DummyRoutineContexts <InitialParamType, UpdateParamType> : RoutineBase<InitialParamType, UpdateParamType>", routineName, comments); var outputPath = Path.Combine(basePath, "_21_1_RoutineDescriptorFromJson.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }
public void _21_0_RoutineDescriptorDirectory() { // routineのファイルを作り出す。 var routineName = "Default_dummy0"; var comments = new List <string> { "デフォルトルーチン、", "ここでデフォルト動作を設定する" }; var desc = AutoDescriptor.Routine("DummyRoutineContexts <InitialParamType, UpdateParamType> : RoutineBase<InitialParamType, UpdateParamType>", routineName, comments); var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var outputPath = Path.Combine(basePath, "_21_0_RoutineDescriptorDirectory.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } }
public void _23_1_CollectedConditionsDescriptorFromJson() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_23_1_CollectedConditionsDescriptorFromJson.json"); { var conditionCategoriesDict = new ConditionTypeData(new List <string> { "Act", "Anim", "Hit" }); // jsonファイルに吐き出す var serialized = JsonUtility.ToJson(conditionCategoriesDict); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <ConditionTypeData>(body); var conditionCategories = deserialized.conditionTypes; var desc = AutoDescriptor.CollectedConditions("DummyCollectedConditions", conditionCategories); var outputPath = Path.Combine(basePath, "_23_1_CollectedConditionsDescriptorFromJson.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }
public void _20_1_AutoGeneratorDescriptorFromJson() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_20_1_AutoGeneratorDescriptorFromJson.json"); { // write to json file. var classGenParam = new AutoData( "2016/01/06 16:55:06", "Auto_Default1", "autoInfo", new List <string> { "複数行のコメント", "描きたいですね。" }, new List <TimelineData> { new TimelineData( "2016/01/06 16:55:06", "timelineInfo_0", new List <TackData> { new TackData( "id", "tackInfo_0", 0, 1, "Act", "DEFAULT", new List <string> { "Default", "_Infinity" } ), new TackData( "id0", "tackInfo_1", 1, 10, "Act", "P0", new List <string> { "Default" } ) } ), new TimelineData( "2016/01/06 16:55:86", "timelineInfo_1", new List <TackData> { new TackData( "id1", "tackInfo_2", 0, 20, "Anim", "DEFAULT", new List <string> { "Default" } ), new TackData( "id2", "tackInfo_3", 20, 100, "Anim", "SPAWN", new List <string> { "Default" } ) } ) } ); var serialized = JsonUtility.ToJson(classGenParam); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <AutoData>(body); var desc = AutoDescriptor.Auto("<InitialParamType, UpdateParamType>", deserialized); var outputPath = Path.Combine(basePath, "_20_1_AutoGeneratorDescriptorFromJson.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }
public void _24_3_ChangerDescriptorFromJsonWithBranchesAndFinally() { var basePath = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor"); var autoGenOutputPath = Path.Combine(basePath, "_24_3_ChangerDescriptorFromJsonWithBranchesAndFinally.json"); { // write to json. var classGenParam = new ChangerData( "TestRouteId3", "TestRoute3", "parentAutoId", new List <string> { "this changer is for change move or not." }, new List <BranchData> { new BranchData( new List <string> { "comment for branchName0" }, new List <ConditionBindData> { new ConditionBindData(ChangerCondKey.CONTAINS, new List <ConditionTypeValueData> { new ConditionTypeValueData("Act", "SPAWN") }) }, "MoveAuto", false, new List <string> { "Move" } ), new BranchData( new List <string> { "comment for branchName1" }, new List <ConditionBindData> { new ConditionBindData(ChangerCondKey.CONTAINS, new List <ConditionTypeValueData> { new ConditionTypeValueData("Act", "SPAWN") }) }, string.Empty, true, new List <string>() ) }, new FinallyBranchData( "MoveAuto", new List <string> { "Move" } ) ); var serialized = JsonUtility.ToJson(classGenParam); // write json file using (var sw = new StreamWriter(autoGenOutputPath)) { sw.Write(serialized); } } { // read json file var body = string.Empty; using (var sr = new StreamReader(autoGenOutputPath)) { body = sr.ReadToEnd(); } var deserialized = JsonUtility.FromJson <ChangerData>(body); var changerName = deserialized.changerName; var commentLines = deserialized.comments; var branches = deserialized.branchs; var finallyBranch = deserialized.finallyBranch; var desc = AutoDescriptor.Changer(changerName, commentLines, branches, finallyBranch); var outputPath = Path.Combine(basePath, "_24_3_ChangerDescriptorFromJsonWithBranchesAndFinally.cs"); // write class file using (var sw = new StreamWriter(outputPath)) { sw.Write(desc); } } }