Skip to content

Commit

Permalink
Merge pull request #27 from ruccho/feature/rust_importer_workflow
Browse files Browse the repository at this point in the history
Rust importer workflow improvements
  • Loading branch information
ruccho authored Dec 10, 2024
2 parents ce04cc0 + 13b9fba commit 1560fae
Show file tree
Hide file tree
Showing 98 changed files with 2,634 additions and 434 deletions.
3 changes: 2 additions & 1 deletion WaaS.Unity/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ crashlytics-build.properties
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

/.idea
/.idea
/target
Empty file.
27 changes: 27 additions & 0 deletions WaaS.Unity/Assets/Component Default.rustimporterpreset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions WaaS.Unity/Assets/RunSequenceTest.cs
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;
}
}
}
3 changes: 3 additions & 0 deletions WaaS.Unity/Assets/RunSequenceTest.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions WaaS.Unity/Assets/WaaS Generated.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions WaaS.Unity/Assets/WaaS Generated/my-game.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions WaaS.Unity/Assets/WaaS Generated/my-game/my-sequencer.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions WaaS.Unity/Assets/WaaS Generated/my-game/my-sequencer/Env.g.cs
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.

16 changes: 16 additions & 0 deletions WaaS.Unity/Assets/test.rs
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);
21 changes: 21 additions & 0 deletions WaaS.Unity/Assets/test.rs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1560fae

Please # to comment.