Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Docs/VS_Scratch_Mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Scratch ブロックと FUnity 独自 Visual Scripting Unit の対応関係で
| ○秒待つ | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WaitSecondsUnit | ○秒待つ | FUnity/Scratch/制御 | 指定時間待機。Visual Scripting 標準のコルーチン経由で待機し、完了後に後続フローへ進む。定義: Runtime/.../WaitSecondsUnit.cs |
| 自分のクローンを作る | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.CreateCloneOfSelfUnit | 自分のクローンを作る | FUnity/Scratch/制御 | 自身を複製。定義: Runtime/.../CloneUnits.cs |
| ○のクローンを作る | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.CreateCloneOfDisplayNameUnit | ○のクローンを作る | FUnity/Scratch/制御 | 指定俳優を複製。定義: Runtime/.../CloneUnits.cs |
| クローンされたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenIStartAsCloneUnit | クローンされたとき | Events/FUnity/Scratch/制御 | クローン生成時に発火する Scratch スクリプトの入口。イベントコルーチン開始時に `StartScratchCoroutine` でスレッド登録を行う。定義: Runtime/.../CloneUnits.cs |
| クローンされたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenIStartAsCloneUnit | クローンされたとき | Events/FUnity/Scratch/制御 | クローン生成時に発火する Scratch スクリプトの入口。イベントコルーチン開始時に `StartScratchCoroutine` でスレッド登録し、`flow.StartCoroutine(trigger)` を開始する(Scratch 側のコルーチンは登録直後に終了する暫定対応)。定義: Runtime/.../CloneUnits.cs |
| このクローンを削除する | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.DeleteThisCloneUnit | このクローンを削除する | FUnity/Scratch/制御 | クローンを破棄。定義: Runtime/.../CloneUnits.cs |
| すべてを止める | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.StopAllUnit | Scratch/すべてを止める | FUnity/Scratch/制御 | Scratch 用スレッドテーブル経由で全スレッド停止。定義: Runtime/.../StopControlUnits.cs |
| このスクリプトを止める | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.StopThisScriptUnit | Scratch/このスクリプトを止める | FUnity/Scratch/制御 | 現在の Scratch スレッドのみ停止。定義: Runtime/.../StopControlUnits.cs |
Expand All @@ -85,11 +85,11 @@ Scratch ブロックと FUnity 独自 Visual Scripting Unit の対応関係で
## イベント
| Scratch ブロック (日本語) | FUnity Unit クラス | UnitTitle | UnitCategory | 備考 |
| --- | --- | --- | --- | --- |
| 緑の旗が押されたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenGreenFlagClickedUnit | 緑の旗が押されたとき | Events/FUnity/Scratch/イベント | Runner 対象の緑の旗イベント。EventBus 登録時に Flow を生成し、`StartScratchCoroutine` を経由して Scratch スレッドへ登録した上で `flow.StartCoroutine(trigger)` でコルーチン専用ポートも安全に起動する。定義: Runtime/.../GreenFlagUnits.cs |
| ○キーが押されたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.OnKeyPressedUnit | ○キーが押されたとき | Events/FUnity/Scratch/イベント | Update フックを自前登録し、押下エッジ検出後に Flow を新規作成して `StartScratchCoroutine` を実行する。trigger は `flow.StartCoroutine(trigger)` で実行し、Forever などのコルーチン専用ポートでも例外なく動作する。定義: Runtime/.../InputEventUnits.cs |
| 緑の旗が押されたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenGreenFlagClickedUnit | 緑の旗が押されたとき | Events/FUnity/Scratch/イベント | Runner 対象の緑の旗イベント。EventBus 登録時に Flow を生成し、`StartScratchCoroutine` Scratch スレッドへ登録した上で `flow.StartCoroutine(trigger)` を開始する(登録直後に Scratch 側コルーチンは終了)。定義: Runtime/.../GreenFlagUnits.cs |
| ○キーが押されたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.OnKeyPressedUnit | ○キーが押されたとき | Events/FUnity/Scratch/イベント | Update フックを自前登録し、押下エッジ検出後に Flow を新規作成して `StartScratchCoroutine` を実行する。trigger は `flow.StartCoroutine(trigger)` を開始するのみとし、Scratch 側のコルーチンは登録直後に終了する暫定実装。定義: Runtime/.../InputEventUnits.cs |
| メッセージを送る | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.BroadcastMessageUnit | メッセージを送る | FUnity/Scratch/イベント | 即時配信。定義: Runtime/.../MessagingUnits.cs |
| メッセージを送って待つ | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.BroadcastAndWaitUnit | メッセージを送って待つ | FUnity/Scratch/イベント | 同期配信後に継続。定義: Runtime/.../MessagingUnits.cs |
| メッセージを受け取ったとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenIReceiveMessageUnit | メッセージを受け取ったとき | Events/FUnity/Scratch/イベント | フィルタ一致時に Flow を生成して `StartScratchCoroutine` へ渡し、イベント登録と同時に Scratch スレッドを登録する。停止ブロックとの連動を担保。定義: Runtime/.../MessagingUnits.cs |
| メッセージを受け取ったとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenIReceiveMessageUnit | メッセージを受け取ったとき | Events/FUnity/Scratch/イベント | フィルタ一致時に Flow を生成して `StartScratchCoroutine` へ渡し、登録直後に `flow.StartCoroutine(trigger)` を開始する(Scratch 側コルーチンは直後に完了する暫定対応)。停止ブロックとの連動を担保。定義: Runtime/.../MessagingUnits.cs |

## 調べる
| Scratch ブロック (日本語) | FUnity Unit クラス | UnitTitle | UnitCategory | 備考 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public override void StopListening(GraphStack stack)
var hook = GetHook(reference);
if (hook.name != null)
{
EventBus.Unregister<CloneEventArgs>(hook, handler);
EventBus.Unregister(hook, handler);
}

s_Handlers.Remove(reference);
Expand Down Expand Up @@ -261,11 +261,8 @@ private IEnumerator RunEventCoroutine(Flow flow, CloneEventArgs args)

AssignArguments(flow, args);

var coroutine = flow.StartCoroutine(trigger);
while (coroutine.MoveNext())
{
yield return coroutine.Current;
}
flow.StartCoroutine(trigger);
yield break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public override void StopListening(GraphStack stack)
var hook = GetHook(reference);
if (hook.name != null)
{
EventBus.Unregister<EmptyEventArgs>(hook, handler);
EventBus.Unregister(hook, handler);
}

s_Handlers.Remove(reference);
Expand Down Expand Up @@ -156,11 +156,8 @@ private IEnumerator RunEventCoroutine(Flow flow, EmptyEventArgs args)

AssignArguments(flow, args);

var coroutine = flow.StartCoroutine(trigger);
while (coroutine.MoveNext())
{
yield return coroutine.Current;
}
flow.StartCoroutine(trigger);
yield break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public override void StopListening(GraphStack stack)
var hook = GetHook(reference);
if (hook.name != null)
{
EventBus.Unregister<EmptyEventArgs>(hook, handler);
EventBus.Unregister(hook, handler);
}

s_Handlers.Remove(reference);
Expand Down Expand Up @@ -163,11 +163,8 @@ private IEnumerator RunEventCoroutine(Flow flow, EmptyEventArgs args)

AssignArguments(flow, args);

var coroutine = flow.StartCoroutine(trigger);
while (coroutine.MoveNext())
{
yield return coroutine.Current;
}
flow.StartCoroutine(trigger);
yield break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public override void StopListening(GraphStack stack)
var hook = GetHook(reference);
if (hook.name != null)
{
EventBus.Unregister<MessagingCommon.Args>(hook, handler);
EventBus.Unregister(hook, handler);
}

s_Handlers.Remove(reference);
Expand Down Expand Up @@ -293,11 +293,8 @@ private IEnumerator RunEventCoroutine(Flow flow, MessagingCommon.Args args)

AssignArguments(flow, args);

var coroutine = flow.StartCoroutine(trigger);
while (coroutine.MoveNext())
{
yield return coroutine.Current;
}
flow.StartCoroutine(trigger);
yield break;
}
}
}
Expand Down