Skip to content

Commit 78db974

Browse files
authored
Merge pull request #1 from moorestech/feature/generate
CommandForgeGeneratorのコード
2 parents 0935cd5 + 589bdd1 commit 78db974

66 files changed

Lines changed: 884 additions & 5163 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/nuget_push.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
with:
1414
dotnet-version: 8.0.x
1515
- name: BuildGenerator
16-
run: dotnet build mooresmaster.Generator/ -c release
16+
run: dotnet build CommandForgeGenerator/ -c release
1717
- name: Pack
18-
run: dotnet pack mooresmaster.Generator/
18+
run: dotnet pack CommandForgeGenerator/
1919
- name: Push
20-
run: dotnet nuget push ./mooresmaster.Generator/bin/Release/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
20+
run: dotnet nuget push ./CommandForgeGenerator/bin/Release/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
with:
1919
dotnet-version: 8.0.x
2020
- name: BuildGenerator
21-
run: dotnet build mooresmaster.Generator/ -c release
21+
run: dotnet build CommandForgeGenerator/ -c release
2222
- name: Test
2323
run: dotnet test

CommandForgeGenerator.SandBox/CommandForgeGenerator.SandBox.csproj

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,23 @@
55
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8-
<DefineConstants>ENABLE_MOORESMASTER_GENERATOR</DefineConstants>
8+
<DefineConstants>ENABLE_COMMAND_FORGE_GENERATOR</DefineConstants>
99
</PropertyGroup>
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\CommandForgeGenerator\CommandForgeGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<AdditionalFiles Include="schema\ref\blockConnectInfo.yml"/>
17-
<AdditionalFiles Include="schema\ref\inventoryConnects.yml"/>
18-
<AdditionalFiles Include="schema\ref\gearConnects.yml"/>
19-
<AdditionalFiles Include="schema\ref\inventoryConnects.yml"/>
20-
<AdditionalFiles Include="schema\ref\mineSettings.yml"/>
21-
22-
<AdditionalFiles Include="schema\blocks.yml"/>
23-
<AdditionalFiles Include="schema\challenges.yml"/>
24-
<AdditionalFiles Include="schema\craftRecipes.yml"/>
25-
<AdditionalFiles Include="schema\items.yml"/>
26-
<AdditionalFiles Include="schema\machineRecipes.yml"/>
27-
<AdditionalFiles Include="schema\mapObjects.yml"/>
16+
<AdditionalFiles Include="SampleProject\commands.yaml"/>
2817
</ItemGroup>
29-
3018
<ItemGroup>
3119
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
3220
<PackageReference Include="Unity3D.UnityEngine" Version="2018.3.5.1"/>
3321
</ItemGroup>
3422

3523
<ItemGroup>
36-
<None Update="TestMod\blocks.json">
37-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
38-
</None>
39-
<None Update="TestMod\challenges.json">
40-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
41-
</None>
42-
<None Update="TestMod\craftRecipes.json">
43-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
44-
</None>
45-
<None Update="TestMod\items.json">
46-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
47-
</None>
48-
<None Update="TestMod\machineRecipes.json">
49-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
50-
</None>
51-
<None Update="TestMod\mapObjects.json">
24+
<None Update="SampleProject/commands.yaml">
5225
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5326
</None>
5427
</ItemGroup>
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1-
using CommandForgeGenerator.Loader.BlocksModule;
1+
using CommandForgeGenerator.Command;
22
using Newtonsoft.Json;
33
using Newtonsoft.Json.Linq;
4+
using UnityEngine.Assertions;
45

56
namespace CommandForgeGenerator.SandBox;
67

78
internal static class Program
89
{
910
private static void Main(string[] args)
1011
{
11-
var blockJson = GetJson("blocks");
12-
BlocksLoader.Load(blockJson);
12+
var json = GetJson();
13+
var loader = CommandForgeLoader.LoadCommands(json);
14+
15+
if (loader.Count == 152)
16+
{
17+
Console.WriteLine(loader.Count == 152 ? "OK" : "NG");
18+
}
19+
else
20+
{
21+
Console.WriteLine("NG " + loader.Count);
22+
}
1323
}
1424

15-
private static JToken GetJson(string name)
25+
private static JToken GetJson()
1626
{
17-
var blockJsonPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestMod", $"{name}.json");
18-
var blockJson = File.ReadAllText(blockJsonPath);
19-
return (JToken)JsonConvert.DeserializeObject(blockJson);
27+
var skitPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../", "SampleProject", "skits", "sample_skit.json");
28+
Console.WriteLine(skitPath);
29+
var json = File.ReadAllText(skitPath);
30+
return (JToken)JsonConvert.DeserializeObject(json);
2031
}
2132
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
version: 1
2+
commands:
3+
- id: text
4+
label: テキスト
5+
description: 台詞を表示
6+
commandListLabelFormat: "{character}「{body}」"
7+
properties:
8+
character:
9+
type: enum
10+
options: ["キャラA", "キャラB", "キャラC", "キャラD", "先生", "店員"]
11+
required: true
12+
body:
13+
type: string
14+
multiline: true
15+
required: true
16+
17+
- id: emote
18+
label: エモート
19+
description: 立ち絵・表情切替
20+
commandListLabelFormat: "EMOTE: {character}, {emotion}"
21+
properties:
22+
character:
23+
type: enum
24+
options: ["キャラA", "キャラB", "キャラC", "キャラD", "先生", "店員"]
25+
required: true
26+
emotion:
27+
type: enum
28+
options: ["通常", "笑顔", "驚き", "怒り", "悲しみ", "困惑", "照れ", "恐怖", "喜び", "真剣"]
29+
required: true
30+
31+
- id: wait
32+
label: 待機
33+
description: 指定秒数だけウェイト
34+
commandListLabelFormat: "WAIT: {seconds}"
35+
defaultBackgroundColor: '#57e317'
36+
properties:
37+
seconds:
38+
type: number
39+
default: 0.5
40+
constraints:
41+
min: 0
42+
43+
- id: bgm
44+
label: BGM
45+
description: 背景音楽を変更
46+
commandListLabelFormat: "BGM: {track}, volume={volume}"
47+
properties:
48+
track:
49+
type: enum
50+
options: ["なし", "日常", "緊張", "悲しい", "楽しい", "神秘的", "アクション", "ロマンティック", "エンディング"]
51+
required: true
52+
volume:
53+
type: number
54+
default: 1.0
55+
constraints:
56+
min: 0
57+
max: 1.0
58+
59+
- id: sound
60+
label: 効果音
61+
description: 効果音を再生
62+
commandListLabelFormat: "SOUND: {effect}, volume={volume}"
63+
properties:
64+
effect:
65+
type: enum
66+
options: ["ドア", "足音", "衝撃", "爆発", "鐘", "拍手", "警報", "雨", "雷", "風"]
67+
required: true
68+
volume:
69+
type: number
70+
default: 1.0
71+
constraints:
72+
min: 0
73+
max: 1.0
74+
75+
- id: background
76+
label: 背景
77+
description: 背景画像を変更
78+
commandListLabelFormat: "BG: {scene}, effect={transition}"
79+
properties:
80+
scene:
81+
type: enum
82+
options: ["教室", "廊下", "体育館", "屋上", "公園", "駅", "カフェ", "自宅", "図書館", "商店街"]
83+
required: true
84+
transition:
85+
type: enum
86+
options: ["なし", "フェード", "ワイプ", "クロスフェード", "フラッシュ"]
87+
default: "なし"
88+
89+
- id: camera
90+
label: カメラ
91+
description: カメラワークを指定
92+
commandListLabelFormat: "CAMERA: {action}, target={target}"
93+
properties:
94+
action:
95+
type: enum
96+
options: ["ズームイン", "ズームアウト", "パン左", "パン右", "シェイク", "フォーカス", "リセット"]
97+
required: true
98+
target:
99+
type: enum
100+
options: ["全体", "キャラA", "キャラB", "キャラC", "キャラD", "先生", "店員", "背景"]
101+
default: "全体"
102+
103+
- id: choice
104+
label: 選択肢
105+
description: 選択肢を表示
106+
commandListLabelFormat: "CHOICE: {options}"
107+
properties:
108+
options:
109+
type: string
110+
multiline: true
111+
description: "選択肢を1行に1つずつ記述"
112+
required: true
113+
timeout:
114+
type: number
115+
default: 0
116+
description: "自動選択までの秒数(0で無制限)"
117+
118+
- id: action
119+
label: アクション
120+
description: キャラクターのアクションを実行
121+
commandListLabelFormat: "ACTION: {character}, {action}"
122+
properties:
123+
character:
124+
type: enum
125+
options: ["キャラA", "キャラB", "キャラC", "キャラD", "先生", "店員"]
126+
required: true
127+
action:
128+
type: enum
129+
options: ["歩く", "走る", "座る", "立つ", "ジャンプ", "踊る", "倒れる", "手を振る", "指さす", "抱きしめる"]
130+
required: true
131+
direction:
132+
type: enum
133+
options: ["左", "右", "上", "下", "中央"]
134+
default: "中央"
135+
136+
- id: narration
137+
label: ナレーション
138+
description: ナレーションテキストを表示
139+
commandListLabelFormat: "NARRATION: {text}"
140+
properties:
141+
text:
142+
type: string
143+
multiline: true
144+
required: true
145+
style:
146+
type: enum
147+
options: ["通常", "強調", "小さく", "斜体", "点滅"]
148+
default: "通常"
149+
150+
- id: branch
151+
label: 分岐
152+
description: 他のコマンドを参照する分岐
153+
commandListLabelFormat: "BRANCH: Target {targetCommand}"
154+
defaultBackgroundColor: "#f9f0ff"
155+
properties:
156+
targetCommand:
157+
type: command
158+
required: true
159+
commandTypes: ["text", "narration"] # Only allow text and narration commands
160+
condition:
161+
type: string
162+
required: true
163+
multiline: true
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"meta": {
3+
"title": "sample_skit",
4+
"version": 1,
5+
"created": "2025-05-10T12:00:00+09:00",
6+
"modified": "2025-05-24T14:15:18.203Z"
7+
},
8+
"commands": [
9+
{
10+
"id": 1,
11+
"type": "narration",
12+
"text": "とある平和な日の放課後。教室には数人の生徒が残っていた。"
13+
},
14+
{
15+
"id": 2,
16+
"type": "background",
17+
"scene": "教室",
18+
"transition": "フェード"
19+
},
20+
{
21+
"id": 3,
22+
"type": "bgm",
23+
"track": "日常",
24+
"volume": 0.7
25+
},
26+
{
27+
"id": 149,
28+
"type": "group_start",
29+
"groupName": "新しいグループ",
30+
"isCollapsed": false,
31+
"backgroundColor": "#b9b9b9"
32+
},
33+
{
34+
"id": 4,
35+
"type": "camera",
36+
"action": "ズームアウト",
37+
"target": "全体"
38+
},
39+
{
40+
"id": 151,
41+
"type": "group_start",
42+
"groupName": "新しいグループ",
43+
"isCollapsed": false,
44+
"backgroundColor": "#b9b9b9"
45+
},
46+
{
47+
"id": 5,
48+
"type": "emote",
49+
"character": "キャラA",
50+
"emotion": "通常"
51+
},
52+
{
53+
"id": 153,
54+
"type": "group_start",
55+
"groupName": "新しいグループ",
56+
"isCollapsed": false,
57+
"backgroundColor": "#b9b9b9"
58+
},
59+
{
60+
"id": 6,
61+
"type": "emote",
62+
"character": "キャラB",
63+
"emotion": "通常"
64+
},
65+
{
66+
"id": 7,
67+
"type": "text",
68+
"character": "キャラA",
69+
"body": "今日の授業、難しかったね。"
70+
},
71+
{
72+
"id": 8,
73+
"type": "wait",
74+
"seconds": 0.5,
75+
"backgroundColor": "#57e317"
76+
}
77+
]
78+
}

0 commit comments

Comments
 (0)