-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
Rust importer workflow improvements
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using MyGame.MySequencer; | ||
using UnityEngine; | ||
using WaaS.ComponentModel.Runtime; | ||
using WaaS.Runtime; | ||
using WaaS.Unity; | ||
|
||
public class RunSequenceTest : MonoBehaviour | ||
{ | ||
[SerializeField] private ComponentAsset componentAsset; | ||
|
||
private async void Start() | ||
{ | ||
var component = await componentAsset.LoadComponentAsync(); | ||
var instance = component.Instantiate(new Dictionary<string, ISortedExportable> | ||
{ | ||
{ "my-game:my-sequencer/env", IEnv.CreateWaaSInstance(new Env()) } | ||
}); | ||
using var context = new ExecutionContext(); | ||
var sequence = new ISequence.Wrapper(instance, context); | ||
await sequence.Play(); // ぼく「こんにちは!」 | ||
} | ||
|
||
private class Env : IEnv | ||
{ | ||
public ValueTask ShowMessage(string speaker, string message) | ||
{ | ||
Debug.Log($"{speaker}「{message}」"); | ||
return default; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// <auto-generated /> | ||
#nullable enable | ||
|
||
namespace MyGame.MySequencer | ||
{ | ||
// interface env | ||
[global::WaaS.ComponentModel.Binding.ComponentInterface(@"env")] | ||
public partial interface IEnv | ||
{ | ||
[global::WaaS.ComponentModel.Binding.ComponentApi(@"show-message")] | ||
global::System.Threading.Tasks.ValueTask ShowMessage(string @speaker, string @message); | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// <auto-generated /> | ||
#nullable enable | ||
|
||
namespace MyGame.MySequencer | ||
{ | ||
// world sequence | ||
[global::WaaS.ComponentModel.Binding.ComponentInterface(@"sequence")] | ||
public partial interface ISequence | ||
{ | ||
[global::WaaS.ComponentModel.Binding.ComponentApi(@"play")] | ||
global::System.Threading.Tasks.ValueTask Play(); | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::my_game::my_sequencer::env::show_message; | ||
|
||
wit_bindgen::generate!({ | ||
path: "../../../../../wit", | ||
world: "my-game:my-sequencer/sequence" | ||
}); | ||
|
||
struct Sequence; | ||
|
||
impl Guest for Sequence { | ||
fn play() { | ||
show_message("ぼく", "こんにちは!"); | ||
} | ||
} | ||
|
||
export!(Sequence); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.