diff --git a/.DS_Store b/.DS_Store index 92b7b76c..3da77962 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Assets/.DS_Store b/Assets/.DS_Store index e21ded53..95f80706 100644 Binary files a/Assets/.DS_Store and b/Assets/.DS_Store differ diff --git a/Assets/Dojo.meta b/Assets/Dojo.meta new file mode 100644 index 00000000..f8b4eee0 --- /dev/null +++ b/Assets/Dojo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce259779027ee48b59902e404513419a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Editor.meta b/Assets/Dojo/Editor.meta new file mode 100644 index 00000000..2ecfeb3b --- /dev/null +++ b/Assets/Dojo/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b8b6cfcfd03c41e7b1293fd2c1e0123 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Editor/DojoEditor.asmdef b/Assets/Dojo/Editor/DojoEditor.asmdef new file mode 100644 index 00000000..6ed45ec5 --- /dev/null +++ b/Assets/Dojo/Editor/DojoEditor.asmdef @@ -0,0 +1,14 @@ +{ + "name": "DojoEditor", + "rootNamespace": "Dojo", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Dojo/Editor/DojoEditor.asmdef.meta b/Assets/Dojo/Editor/DojoEditor.asmdef.meta new file mode 100644 index 00000000..9fd71c98 --- /dev/null +++ b/Assets/Dojo/Editor/DojoEditor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 44dccc43b55394782954b8638b312697 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Prefabs.meta b/Assets/Dojo/Prefabs.meta new file mode 100644 index 00000000..0bac7062 --- /dev/null +++ b/Assets/Dojo/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dff4b7ec0b4304501a12dd9c4daca5de +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Prefabs/WorldManager.prefab b/Assets/Dojo/Prefabs/WorldManager.prefab new file mode 100644 index 00000000..e7c757ad --- /dev/null +++ b/Assets/Dojo/Prefabs/WorldManager.prefab @@ -0,0 +1,74 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4900589733936057544 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3269270482660702203} + - component: {fileID: 1648136030876143075} + - component: {fileID: 4477060482053654553} + m_Layer: 0 + m_Name: WorldManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3269270482660702203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4900589733936057544} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1648136030876143075 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4900589733936057544} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 85bbcaeafdf5e41c6a2f48ff65820b7d, type: 3} + m_Name: + m_EditorClassIdentifier: + toriiUrl: + rpcUrl: + relayUrl: + relayWebrtcUrl: + worldAddress: + synchronizationMaster: {fileID: 4477060482053654553} + dojoConfig: {fileID: 11400000, guid: 1d6a5fa48aab79f0084b213f6fc768c5, type: 2} +--- !u!114 &4477060482053654553 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4900589733936057544} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 03336b1725e0144688810398fccab79e, type: 3} + m_Name: + m_EditorClassIdentifier: + worldManager: {fileID: 1648136030876143075} + limit: 100 + OnSynchronized: + m_PersistentCalls: + m_Calls: [] + OnEntitySpawned: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/Dojo/Prefabs/WorldManager.prefab.meta b/Assets/Dojo/Prefabs/WorldManager.prefab.meta new file mode 100644 index 00000000..23f27721 --- /dev/null +++ b/Assets/Dojo/Prefabs/WorldManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d2e25933f4d69473a8994ee7470b2610 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime.meta b/Assets/Dojo/Runtime.meta new file mode 100644 index 00000000..cd9a615e --- /dev/null +++ b/Assets/Dojo/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74c077164077e4fdb8fa59bef633eb0f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Config.meta b/Assets/Dojo/Runtime/Config.meta new file mode 100644 index 00000000..1e1f5a1c --- /dev/null +++ b/Assets/Dojo/Runtime/Config.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a265271cc899c81a0be5a1edede52821 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Config/WorldManagerData.cs b/Assets/Dojo/Runtime/Config/WorldManagerData.cs new file mode 100644 index 00000000..12e62f25 --- /dev/null +++ b/Assets/Dojo/Runtime/Config/WorldManagerData.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using Dojo.Starknet; +using Dojo.Torii; +using UnityEngine; + +namespace Dojo +{ + [CreateAssetMenu(fileName = "WorldManagerData", menuName = "ScriptableObjects/WorldManagerData", order = 2)] + public class WorldManagerData : ScriptableObject + { + [Header("RPC")] + public string toriiUrl = "http://localhost:8080"; + public string rpcUrl = "http://localhost:5050"; + public string relayUrl = "/ip4/127.0.0.1/tcp/9090"; + public string relayWebrtcUrl; + [Header("World")] + public FieldElement worldAddress; + public Query query = new Query(100, 0); + } +} diff --git a/Assets/Dojo/Runtime/Config/WorldManagerData.cs.meta b/Assets/Dojo/Runtime/Config/WorldManagerData.cs.meta new file mode 100644 index 00000000..e25d3c61 --- /dev/null +++ b/Assets/Dojo/Runtime/Config/WorldManagerData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: faed63f2427f3ed83a42d16bb3e73e6d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Config/WorldManagerLocalConfig.asset b/Assets/Dojo/Runtime/Config/WorldManagerLocalConfig.asset new file mode 100644 index 00000000..7b6fc1d4 --- /dev/null +++ b/Assets/Dojo/Runtime/Config/WorldManagerLocalConfig.asset @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: faed63f2427f3ed83a42d16bb3e73e6d, type: 3} + m_Name: WorldManagerLocalConfig + m_EditorClassIdentifier: + toriiUrl: http://localhost:8080 + rpcUrl: http://localhost:5050 + relayUrl: /ip4/127.0.0.1/tcp/9090 + relayWebrtcUrl: /ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/uEiAS9CpA5yNwO7iidBM5f9FcPl67PwohiK-1J9BhnFMrHg + worldAddress: + hex: 0x00e2ea9b5dd9804d13903edf712998943b7d5d606c139dd0f13eeb8f5b84da8d + query: + limit: 100 + offset: 0 + dont_include_hashed_keys: 0 diff --git a/Assets/Dojo/Runtime/Config/WorldManagerLocalConfig.asset.meta b/Assets/Dojo/Runtime/Config/WorldManagerLocalConfig.asset.meta new file mode 100644 index 00000000..b6794a9b --- /dev/null +++ b/Assets/Dojo/Runtime/Config/WorldManagerLocalConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d6a5fa48aab79f0084b213f6fc768c5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/DojoRuntime.asmdef b/Assets/Dojo/Runtime/DojoRuntime.asmdef new file mode 100644 index 00000000..fc15a4e9 --- /dev/null +++ b/Assets/Dojo/Runtime/DojoRuntime.asmdef @@ -0,0 +1,14 @@ +{ + "name": "DojoRuntime", + "rootNamespace": "Dojo", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/DojoRuntime.asmdef.meta b/Assets/Dojo/Runtime/DojoRuntime.asmdef.meta new file mode 100644 index 00000000..48100bb2 --- /dev/null +++ b/Assets/Dojo/Runtime/DojoRuntime.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1cfdd07e9f0f54188b58166d8196b85c +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/ModelInstance.cs b/Assets/Dojo/Runtime/ModelInstance.cs new file mode 100644 index 00000000..430586f3 --- /dev/null +++ b/Assets/Dojo/Runtime/ModelInstance.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Dojo.Starknet; +using Dojo.Torii; +using dojo_bindings; +using UnityEngine; +using UnityEngine.Events; +using System.Numerics; +using System.Reflection; +using Newtonsoft.Json; + +namespace Dojo +{ + [AttributeUsage(AttributeTargets.Field)] + public class ModelField : Attribute + { + public string Name { get; } + + public ModelField(string name) + { + Name = name; + } + } + + // Base class for the definition of a model + public abstract class ModelInstance : MonoBehaviour + { + public UnityEvent OnUpdated = new UnityEvent(); + public Model Model { get; private set; } + + // Initialize the model instance with the model + // Uses the ModelField attribute to map the model fields to the class fields + // One can override this method to do custom initialization + // If reflection isn't an option. + // Called upon instantiation and model update + public virtual void Initialize(Model model) + { + Model = model; + + var fields = GetType().GetFields(); + foreach (var field in fields) + { + // Check if the field has the ModelField attribute + var attribute = field.GetCustomAttributes(typeof(ModelField), false); + if (attribute.Length == 0) + { + continue; + } + + var modelField = (ModelField)attribute[0]; + if (!model.Members.ContainsKey(modelField.Name)) + { + Debug.LogWarning($"Model field {modelField.Name} not found in model {model.Name}"); + continue; + } + + var member = model.Members[modelField.Name]; + + field.SetValue(this, HandleField(field.FieldType, member)); + } + } + + // Handles the initialization of a field + // of a model instance. Uses reflection to set the field + // to the value of the model member. + private static object HandleField(Type type, object ty) + { + // if the field is a primitive, we can just set it + // fieldelement is included as a primitive because its a class + // but its already instantiated + if (type.IsPrimitive || type == typeof(FieldElement) || type == typeof(BigInteger) || type == typeof(string)) + { + return ty.GetType() != type ? Convert.ChangeType(ty, type) : ty; + } + // handle array + else if (type.IsArray) + { + var elementType = type.GetElementType(); + var array = (IList)ty; + var instance = Array.CreateInstance(elementType, array.Count); + for (var i = 0; i < array.Count; i++) + { + instance.SetValue(HandleField(elementType, array[i]), i); + } + return instance; + } + // handle tuple (ValueTuple - (T1, T2)) + else if (type.FullName.StartsWith(typeof(ValueTuple).FullName)) + { + var tupleTypes = type.GetGenericArguments(); + var instance = Activator.CreateInstance(type); + var fields = type.GetFields(); + for (var i = 0; i < fields.Length; i++) + { + fields[i].SetValue(instance, HandleField(tupleTypes[i], ((IList)ty)[i])); + } + return instance; + } + // dynamic types + // handle record (rust-like) enums + else if (ty is Model.Enum enumVariant) + { + var variantType = type.GetNestedType(enumVariant.option); + if (variantType == null) + { + throw new Exception($"Could not find variant {enumVariant.option} in enum {type}"); + } + + if (type.GenericTypeArguments.Length > 0) + { + variantType = variantType.MakeGenericType(type.GenericTypeArguments); + } + + List args = new List(); + if (variantType.GetProperty("value") is PropertyInfo prop) + { + args.Add(HandleField(prop.PropertyType, enumVariant.value)); + } + + return Activator.CreateInstance(variantType, args.ToArray()); + + } + // if the field is a struct/class. we check if our member is a dictionary + // and we go through each of its keys and values and set them to the fields + // of the instantiated struct/class + else if (ty is Model.Struct struct_) + { + var instance = Activator.CreateInstance(type); + var fields = type.GetFields(); + + foreach (var field in fields) + { + field.SetValue(instance, HandleField(field.FieldType, struct_.members[field.Name])); + } + + return instance; + } + else + { + throw new Exception($"Could not handle field of type {type}"); + } + } + + // Called when the model is updated + public virtual void OnUpdate(Model model) + { + Initialize(model); + OnUpdated.Invoke(); + } + } +} diff --git a/Assets/Dojo/Runtime/ModelInstance.cs.meta b/Assets/Dojo/Runtime/ModelInstance.cs.meta new file mode 100644 index 00000000..48e53f08 --- /dev/null +++ b/Assets/Dojo/Runtime/ModelInstance.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c88eb655135047b8b5f175b0d77b362 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet.meta b/Assets/Dojo/Runtime/Starknet.meta new file mode 100644 index 00000000..16058ffc --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57353194ecb5d4b72958ef41f789b739 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/Account.cs b/Assets/Dojo/Runtime/Starknet/Account.cs new file mode 100644 index 00000000..d849ad6d --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Account.cs @@ -0,0 +1,153 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using bottlenoselabs.C2CS.Runtime; +using dojo_bindings; +using Debug = UnityEngine.Debug; + +namespace Dojo.Starknet +{ + public class Account + { +#if UNITY_WEBGL && !UNITY_EDITOR + private TaskCompletionSource account = new(); +#else + private unsafe dojo.Account* account; +#endif + + public FieldElement Address { get; } + public SigningKey Signer { get; } + +#if UNITY_WEBGL && !UNITY_EDITOR + private async void createAccount(JsonRpcClient provider, SigningKey privateKey, FieldElement address) + { + account.SetResult(await StarknetInterop.NewAccountAsync(provider.client, privateKey, address)); + } + + public Account(JsonRpcClient provider, SigningKey privateKey, FieldElement address) + { + createAccount(provider, privateKey, address); + Address = address; + Signer = privateKey; + } +#else + public unsafe Account(JsonRpcClient provider, SigningKey privateKey, FieldElement address) + { + var resultAccount = dojo.account_new(provider.client, privateKey.Inner.Inner, + CString.FromString(address.Hex())); + if (resultAccount.tag == dojo.ResultAccount_Tag.ErrAccount) + { + throw new Exception(resultAccount.err.message); + } + + account = resultAccount._ok; + Address = address; + Signer = privateKey; + } +#endif + + +#if UNITY_WEBGL && !UNITY_EDITOR + public Account(IntPtr account, SigningKey signingKey) { + this.account.SetResult(account); + Address = new FieldElement(StarknetInterop.AccountAddress(account)); + Signer = signingKey; + } +#else + private unsafe Account(dojo.Account* account, SigningKey signingKey) + { + this.account = account; + Address = new FieldElement(dojo.account_address(account)); + Signer = signingKey; + } +#endif + + unsafe ~Account() + { +#if UNITY_WEBGL && !UNITY_EDITOR +#else + dojo.account_free(account); +#endif + } + +#if UNITY_WEBGL && !UNITY_EDITOR + public async Task Nonce() + { + return await StarknetInterop.AccountNonceAsync(await account.Task); + } +#else + public unsafe FieldElement NonceSync() + { + var result = dojo.account_nonce(account); + if (result.tag == dojo.ResultFieldElement_Tag.ErrFieldElement) + { + throw new Exception(result.err.message); + } + + return new FieldElement(result.ok); + } + + public async Task Nonce() + { + return await Task.Run(() => Nonce()); + } +#endif + +#if UNITY_WEBGL && !UNITY_EDITOR + // webgl js interop starknet bindings + public async Task ExecuteRaw(dojo.Call[] calls) + { + var res = await StarknetInterop.AccountExecuteRawAsync(await account.Task, calls); + + return res; + } +#else + private unsafe FieldElement ExecuteRawSync(dojo.Call[] calls) + { + dojo.Call* callsPtr; + fixed (dojo.Call* ptr = &calls[0]) + { + callsPtr = ptr; + } + + var result = dojo.account_execute_raw(account, callsPtr, (nuint)calls.Length); + if (result.tag == dojo.ResultFieldElement_Tag.ErrFieldElement) + { + throw new Exception(result.err.message); + } + + return new FieldElement(result.ok); + } + + public async Task ExecuteRaw(dojo.Call[] calls) + { + return await Task.Run(() => ExecuteRawSync(calls)); + } +#endif + +#if !UNITY_WEBGL || UNITY_EDITOR + // This will synchroneously wait for the burner to be deployed. + // Implemented for C bindings that arent async. + private unsafe Account DeployBurnerSync(JsonRpcClient provider, SigningKey signingKey) + { + var result = dojo.account_deploy_burner(provider.client, account, signingKey.Inner.Inner); + if (result.tag == dojo.ResultAccount_Tag.ErrAccount) + { + throw new Exception(result.err.message); + } + + return new Account(result._ok, signingKey); + } +#endif + + // Deploy a burner and return the account once it is deployed. + public async Task DeployBurner(JsonRpcClient provider, SigningKey signingKey) + { +#if UNITY_WEBGL && !UNITY_EDITOR + return new Account(await StarknetInterop.AccountDeployBurnerAsync(await account.Task, signingKey), signingKey); +#else + return await Task.Run(() => DeployBurnerSync(provider, signingKey)); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/Account.cs.meta b/Assets/Dojo/Runtime/Starknet/Account.cs.meta new file mode 100644 index 00000000..af93a76a --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Account.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9d6d2695217b4eca995e809d34c4184c +timeCreated: 1701892948 \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/BurnerManager.cs b/Assets/Dojo/Runtime/Starknet/BurnerManager.cs new file mode 100644 index 00000000..fa6765e1 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/BurnerManager.cs @@ -0,0 +1,110 @@ +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using dojo_bindings; +using Newtonsoft.Json; +using UnityEngine; +using UnityEngine.UIElements; +using Debug = UnityEngine.Debug; + +namespace Dojo.Starknet +{ + public class BurnerManager + { + private JsonRpcClient provider; + private Account masterAccount; + private int currentBurnerIndex = 0; + public Account CurrentBurner + { + get + { + if (Burners.Count == 0) return null; + return Burners[currentBurnerIndex]; + } + } + public List Burners { get; } = new(); + public bool UseStorage { get; set; } + + public BurnerManager(JsonRpcClient provider, Account masterAccount, bool useStorage = true) + { + this.provider = provider; + this.masterAccount = masterAccount; + UseStorage = useStorage; + + if (UseStorage) + { + TryLoadFromStorage(); + } + } + + public async Task DeployBurner(SigningKey signingKey = null) + { + if (signingKey == null) + { + signingKey = new SigningKey(); + } + + Burners.Add(await masterAccount.DeployBurner(provider, signingKey)); + currentBurnerIndex = Burners.Count - 1; + + + if (UseStorage) + { + Save(); + } + + return CurrentBurner; + } + + + // Load the burners from disk. + // This will be called automatically if useStorage is set to true. + public void TryLoadFromStorage() + { + + // Load all burners + var burnersData = PlayerPrefs.GetString($"burnermanagers.{masterAccount.Address.Hex()}.burners"); + if (!string.IsNullOrEmpty(burnersData)) + { + var burners = JsonConvert.DeserializeObject>>(burnersData); + foreach (var burnerData in burners) + { + var address = new FieldElement(burnerData["address"]); + var privateKey = burnerData["privateKey"]; + Burners.Add(new Account(provider, new SigningKey(privateKey), address)); + } + } + + // Load the current burner + var currentBurnerIndex = PlayerPrefs.GetInt($"burnermanagers.{masterAccount.Address.Hex()}.current", -1); + if (currentBurnerIndex >= 0 && currentBurnerIndex < Burners.Count) + { + this.currentBurnerIndex = currentBurnerIndex; + } + } + + // Save the burners to disk. + // This will be called automatically if useStorage is set to true. + public void Save() + { + // Save the current burner + if (CurrentBurner != null) + { + PlayerPrefs.SetInt($"burnermanagers.{masterAccount.Address.Hex()}.current", currentBurnerIndex); + } + + // Save all burners + var burnersData = JsonConvert.SerializeObject(Burners.Select(burner => new + { + address = burner.Address.Hex(), + privateKey = burner.Signer.Inner.Hex() + })); + + PlayerPrefs.SetString($"burnermanagers.{masterAccount.Address.Hex()}.burners", burnersData); + + PlayerPrefs.Save(); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/BurnerManager.cs.meta b/Assets/Dojo/Runtime/Starknet/BurnerManager.cs.meta new file mode 100644 index 00000000..10e34268 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/BurnerManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30a9fe3957b9d4eb29e933eaf97b3a51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/ByteArray.cs b/Assets/Dojo/Runtime/Starknet/ByteArray.cs new file mode 100644 index 00000000..8177c21b --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/ByteArray.cs @@ -0,0 +1,76 @@ +using System; +using System.Linq; +using bottlenoselabs.C2CS.Runtime; +using dojo_bindings; + +namespace Dojo.Starknet +{ + unsafe public class ByteArray + { + public string Inner { get; } + + public ByteArray(string inner) + { + Inner = inner; + } + + public ByteArray(FieldElement[] felts) + { + Inner = Deserialize(felts); + } + + public FieldElement[] Serialize() + { + return Serialize(Inner); + } + + public static string Deserialize(FieldElement[] felts) + { +#if UNITY_WEBGL && !UNITY_EDITOR + return StarknetInterop.DeserializeByteArray(felts); +#else + dojo.FieldElement[] inners = felts.Select(felt => felt.Inner).ToArray(); + fixed (dojo.FieldElement* ptr = inners) + { + var res = dojo.bytearray_deserialize(ptr, (UIntPtr)inners.Length); + if (res.tag == dojo.Resultc_char_Tag.Errc_char) + { + throw new Exception(res.err.message); + } + + return res.ok; + } +#endif + } + + public static FieldElement[] Serialize(string str) + { +#if UNITY_WEBGL && !UNITY_EDITOR + return StarknetInterop.SerializeByteArray(str); +#else + var res = dojo.bytearray_serialize(new CString(str)); + if (res.tag == dojo.ResultCArrayFieldElement_Tag.ErrCArrayFieldElement) + { + throw new Exception(res.err.message); + } + + return res.ok.ToArray().Select(felt => new FieldElement(felt)).ToArray(); +#endif + } + + public static implicit operator string(ByteArray inner) + { + return inner.Inner; + } + + public static implicit operator ByteArray(string inner) + { + return new ByteArray(inner); + } + + public override string ToString() + { + return Inner; + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/ByteArray.cs.meta b/Assets/Dojo/Runtime/Starknet/ByteArray.cs.meta new file mode 100644 index 00000000..9d72c2b3 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/ByteArray.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2a5c062d72aa847cf88abc86438ba5ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/Enum.cs b/Assets/Dojo/Runtime/Starknet/Enum.cs new file mode 100644 index 00000000..7d75dc34 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Enum.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace Dojo.Starknet +{ + // The interface that all Starknet enums generated from the dojo-bindgen implement + public interface Enum + { + // A static dictionary to keep track of the indices of each Enum implementing the Enum interface + // The first dictionary is indexed by the Enum type, and the second dictionary is indexed by the Enum variant name + // The value is the index of the Enum variant + // This makes getting a Starknet enum variant index O(1) if we already cached the indices + private static Dictionary> TypeIndices = new Dictionary>(); + + // Get the index of the enum variant + // This is needed as Starknet enums are represented as a Record in C# + // Each enum variant is a nested class of the enum type, implementing the Enum itself. + public static int GetIndex(Enum value) + { + var type = value.GetType(); + if (!TypeIndices.ContainsKey(type.BaseType)) + { + TypeIndices[type.BaseType] = type.BaseType + .GetNestedTypes(BindingFlags.Public) + .OrderBy(t => t.MetadataToken) + .Select((type, index) => new { type, index }) + .ToDictionary(t => t.type.Name, t => t.index); + } + + + return TypeIndices[type.BaseType][type.Name]; + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/Enum.cs.meta b/Assets/Dojo/Runtime/Starknet/Enum.cs.meta new file mode 100644 index 00000000..8f9f969f --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Enum.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70dbed3ddf18042eba185c6104d1ad1d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/FieldElement.cs b/Assets/Dojo/Runtime/Starknet/FieldElement.cs new file mode 100644 index 00000000..2daca336 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/FieldElement.cs @@ -0,0 +1,129 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Numerics; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using dojo_bindings; +using Newtonsoft.Json; +using UnityEngine; + +namespace Dojo.Starknet +{ + class FieldElementConverter : JsonConverter { + public override bool CanConvert(Type objectType) + { + return objectType == typeof(FieldElement); + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + var fieldElement = (FieldElement)value; + writer.WriteValue(fieldElement.Hex()); + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + var hex = (string)reader.Value; + return new FieldElement(hex); + } + } + [Serializable] + [JsonConverter(typeof(FieldElementConverter))] + public class FieldElement : ISerializationCallbackReceiver + { + private dojo.FieldElement inner; + public dojo.FieldElement Inner => inner; + // Serialized as a hex string. + [SerializeField] private string hex; + + public static BigInteger StarkField = BigInteger.Parse("3618502788666131213697322783095070105623107215331596699973092056135872020481"); + + // These constructors are pretty slow as they involve a lot of copying. + // TODO: benchmark and optimize + public FieldElement(string input) + { + BigInteger value; + + if (input.StartsWith("0x")) + { + if (!BigInteger.TryParse("0" + input.Substring(2), NumberStyles.HexNumber, null, out value)) + { + throw new ArgumentException("Invalid hex string.", nameof(input)); + } + } + else + { + if (!BigInteger.TryParse(input, out value)) + { + throw new ArgumentException("Invalid decimal string.", nameof(input)); + } + } + + inner = new FieldElement(value).inner; + } + + public FieldElement(dojo.FieldElement fieldElement) + { + // We don't want to refer to the same memory as the original field element. + // As we might want to free it - potentially slower + // TODO: benchmark copies? + fieldElement.data.CopyTo(inner.data); + } + + public FieldElement(Span bytes) + { + if (bytes.Length != 32) + { + throw new ArgumentException("Byte array must be 32 bytes.", nameof(bytes)); + } + + bytes.CopyTo(inner.data); + } + + // This handles BigIntegers as well as primitive types + public FieldElement(BigInteger bigInteger) + { + if (bigInteger.Sign < 0) { + bigInteger = StarkField - bigInteger; + } + + var bytes = bigInteger.ToByteArray(false, true); + if (bytes.Length > 32) + { + throw new ArgumentException("BigInteger must be 32 bytes or less.", nameof(bigInteger)); + } + + unsafe + { + fixed (byte* ptr = &inner._data[0]) + { + // we need to account bytes that are less than 32 bytes + // and add leading zeros + var offset = 32 - bytes.Length; + Marshal.Copy(bytes, 0, (IntPtr)ptr + offset, bytes.Length); + } + } + } + + // This convert the enum to a uint64 and uses the BigInteger constructor + public FieldElement(Enum @enum) : this(Convert.ToUInt64(@enum)) + { + } + + public string Hex() + { + return "0x" + BitConverter.ToString(inner.data.ToArray()).Replace("-", "").ToLower(); + } + + public void OnAfterDeserialize() + { + inner = new FieldElement(hex).inner; + } + + public void OnBeforeSerialize() + { + hex = Hex(); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/FieldElement.cs.meta b/Assets/Dojo/Runtime/Starknet/FieldElement.cs.meta new file mode 100644 index 00000000..1804577a --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/FieldElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fec08a0fbfcff4b8ab7c20a0e7766b93 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/Helpers.meta b/Assets/Dojo/Runtime/Starknet/Helpers.meta new file mode 100644 index 00000000..216644dc --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Helpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fca358df00aec498ea038070d7d51212 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/Helpers/ExecutionHelper.cs b/Assets/Dojo/Runtime/Starknet/Helpers/ExecutionHelper.cs new file mode 100644 index 00000000..040627a0 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Helpers/ExecutionHelper.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Dojo.Starknet; +using dojo_bindings; + +namespace Starknet { + public struct Call { + public FieldElement contractAddress; + public string selector; + public FieldElement[] calldata; + + public Call(FieldElement contractAddress, string selector, params FieldElement[] calldata) { + this.contractAddress = contractAddress; + this.selector = selector; + this.calldata = calldata; + } + } + + // A helper class for constructing and executing Starknet transactions. + public class ExecutionHelper { + public Account account { get; } + private List calls; + + public ExecutionHelper(Account account) { + this.account = account; + calls = new List(); + } + + public ExecutionHelper AddCall(Call call) { + calls.Add(call); + return this; + } + + public ExecutionHelper AddCall(FieldElement contractAddress, string selector, params FieldElement[] calldata) { + var call = new Call(contractAddress, selector, calldata); + return AddCall(call); + } + + public async Task Execute() { + return await account.ExecuteRaw(calls.Select(call => new dojo.Call { + to = call.contractAddress.Inner, + selector = call.selector, + calldata = call.calldata.Select(field => field.Inner).ToArray() + }).ToArray()); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/Helpers/ExecutionHelper.cs.meta b/Assets/Dojo/Runtime/Starknet/Helpers/ExecutionHelper.cs.meta new file mode 100644 index 00000000..b9cb8c9d --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Helpers/ExecutionHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 121bbc4a0d0f648789c913e301225419 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/JsonRpcClient.cs b/Assets/Dojo/Runtime/Starknet/JsonRpcClient.cs new file mode 100644 index 00000000..c5940652 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/JsonRpcClient.cs @@ -0,0 +1,98 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using bottlenoselabs.C2CS.Runtime; +using dojo_bindings; + +namespace Dojo.Starknet +{ + public class JsonRpcClient + { +#if UNITY_WEBGL && !UNITY_EDITOR + public IntPtr client; +#else + public unsafe dojo.Provider* client; +#endif + +#if UNITY_WEBGL && !UNITY_EDITOR + public JsonRpcClient(string rpcUrl) { + client = StarknetInterop.NewProvider(new CString(rpcUrl)); + } +#else + public unsafe JsonRpcClient(string rpcUrl) + { + var result = dojo.provider_new(CString.FromString(rpcUrl)); + if (result.tag == dojo.ResultProvider_Tag.ErrProvider) + { + throw new Exception(result.err.message); + } + + client = result._ok; + } +#endif + +#if UNITY_WEBGL && !UNITY_EDITOR +#else + unsafe ~JsonRpcClient() + { + dojo.provider_free(client); + } +#endif +#if UNITY_WEBGL && !UNITY_EDITOR +#else + // Wait for the transaction to be confirmed. Synchronously. + // This doesn't guarantee that the torii client has updated its state + // if an entity is updated. + private unsafe void WaitForTransactionSync(FieldElement transactionHash) + { + var result = dojo.wait_for_transaction(client, transactionHash.Inner); + if (result.tag == dojo.Resultbool_Tag.Errbool) + { + throw new Exception(result.err.message); + } + } +#endif + + // Wait for the transaction to be confirmed. Asynchronously. + // This doesn't guarantee that the torii client has updated its state + // if an entity is updated. + public async Task WaitForTransaction(FieldElement transactionHash) + { +#if UNITY_WEBGL && !UNITY_EDITOR + await StarknetInterop.WaitForTransactionAsync(client, transactionHash); +#else + await Task.Run(() => WaitForTransactionSync(transactionHash)); +#endif + } + + +#if UNITY_WEBGL && !UNITY_EDITOR +#else + private unsafe FieldElement[] CallSync(dojo.Call call, dojo.BlockId blockId) + { + var result = dojo.starknet_call(client, call, blockId); + if (result.tag == dojo.ResultCArrayFieldElement_Tag.ErrCArrayFieldElement) + { + throw new Exception(result.err.message); + } + + var arr = result.ok.ToArray().Select(f => new FieldElement(f)).ToArray(); + dojo.carray_free(result._ok.data, result._ok.data_len); + + return arr; + } +#endif + + // Wait for the transaction to be confirmed. Asynchronously. + // This doesn't guarantee that the torii client has updated its state + // if an entity is updated. + public async Task Call(dojo.Call call, dojo.BlockId blockId) + { +#if UNITY_WEBGL && !UNITY_EDITOR + return await StarknetInterop.CallAsync(client, call, blockId); +#else + return await Task.Run(() => CallSync(call, blockId)); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/JsonRpcClient.cs.meta b/Assets/Dojo/Runtime/Starknet/JsonRpcClient.cs.meta new file mode 100644 index 00000000..3032327a --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/JsonRpcClient.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7eacd5a60b914bd2bf5336616e72f351 +timeCreated: 1702074309 \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/Signature.cs b/Assets/Dojo/Runtime/Starknet/Signature.cs new file mode 100644 index 00000000..5d43ba62 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Signature.cs @@ -0,0 +1,88 @@ +using dojo_bindings; +using bottlenoselabs.C2CS.Runtime; + +namespace Dojo.Starknet +{ + public class Signature + { + public dojo.Signature Inner { get; } + + // Create a signature from a compact hex string. + public Signature(string compactHex) + { + if (compactHex.Length != 128) + { + throw new System.ArgumentException("Compact hex string must be 128 characters.", nameof(compactHex)); + } + + var r = new FieldElement("0x" + compactHex.Substring(0, 64)); + var s = new FieldElement("0x" + compactHex.Substring(64, 64)); + + Inner = new dojo.Signature + { + r = r.Inner, + s = s.Inner + }; + } + + public Signature(FieldElement r, FieldElement s) + { + Inner = new dojo.Signature + { + r = r.Inner, + s = s.Inner + }; + } + + public Signature(dojo.Signature signature) + { + Inner = signature; + } + + public FieldElement R() + { + return new FieldElement(Inner.r); + } + + public FieldElement S() + { + return new FieldElement(Inner.s); + } + +#if UNITY_WEBGL && !UNITY_EDITOR + // webgl js interop starknet bindings + public bool Verify(FieldElement verifying_key, FieldElement hash) { + return StarknetInterop.Verify(new CString(verifying_key.Hex()), new CString(hash.Hex()), new CString(R().Hex()), new CString(S().Hex())); + } +#else + // dojo.c starknet-rs bindings + public bool Verify(FieldElement verifying_key, FieldElement hash) + { + var result = dojo.verifying_key_verify(verifying_key.Inner, hash.Inner, Inner); + if (result.tag == dojo.Resultbool_Tag.Errbool) + { + throw new System.Exception(result.err.message); + } + + return result.ok; + } +#endif + + public bool Verify(VerifyingKey verifying_key, FieldElement hash) + { + return Verify(verifying_key.Inner, hash); + } + + // Return the signature as a compact hex string. + public string ToCompactHex() + { + return (R().Hex() + S().Hex()).Replace("0x", ""); + } + + // Return the felts of the signature. + public FieldElement[] ToFeltArray() + { + return new FieldElement[] { R(), S() }; + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/Signature.cs.meta b/Assets/Dojo/Runtime/Starknet/Signature.cs.meta new file mode 100644 index 00000000..9548525b --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/Signature.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6317a7230ff264528b75cc5ba09477d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/SigningKey.cs b/Assets/Dojo/Runtime/Starknet/SigningKey.cs new file mode 100644 index 00000000..ecac3326 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/SigningKey.cs @@ -0,0 +1,73 @@ +using System; +using bottlenoselabs.C2CS.Runtime; +using dojo_bindings; +using JetBrains.Annotations; + +namespace Dojo.Starknet +{ + public class SigningKey + { + // The inner FieldElement for the private key. + public FieldElement Inner + { + get; + } + // Return the public key corresponding to the private key. + public VerifyingKey PublicKey + { + get + { +#if UNITY_WEBGL && !UNITY_EDITOR + return new VerifyingKey(StarknetInterop.NewVerifyingKey(new CString(Inner.Hex()))); +#else + return new VerifyingKey(dojo.verifying_key_new(Inner.Inner)); +#endif + } + } + + public SigningKey() + { +#if UNITY_WEBGL && !UNITY_EDITOR + Inner = new FieldElement(StarknetInterop.NewSigningKey()); +#else + Inner = new FieldElement(dojo.signing_key_new()); +#endif + } + + public SigningKey(string privateKey) + { + Inner = new FieldElement(privateKey); + } + + public SigningKey(dojo.FieldElement privateKey) + { + Inner = new FieldElement(privateKey); + } + + public SigningKey(FieldElement privateKey) + { + Inner = privateKey; + } + + // Sign a message. +#if UNITY_WEBGL && !UNITY_EDITOR + // webgl js interop starknet bindings + public Signature Sign(FieldElement message) + { + var signature = StarknetInterop.Sign(new CString(Inner.Hex()), new CString(message.Hex())); + return new Signature(signature); + } +#else + public Signature Sign(FieldElement message) + { + var result = dojo.signing_key_sign(Inner.Inner, message.Inner); + if (result.tag == dojo.ResultSignature_Tag.ErrSignature) + { + throw new Exception(result.err.message); + } + + return new Signature(result.ok); + } +#endif + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/SigningKey.cs.meta b/Assets/Dojo/Runtime/Starknet/SigningKey.cs.meta new file mode 100644 index 00000000..a4cacb55 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/SigningKey.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 88058aa4528240fd9e7b71055a5abd7d +timeCreated: 1702074662 \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/StarknetInterop.cs b/Assets/Dojo/Runtime/Starknet/StarknetInterop.cs new file mode 100644 index 00000000..ba4fdd33 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/StarknetInterop.cs @@ -0,0 +1,240 @@ +using System; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using AOT; +using bottlenoselabs.C2CS.Runtime; +using Newtonsoft.Json; +using Debug = UnityEngine.Debug; +using dojo_bindings; +using System.Text.RegularExpressions; + +namespace Dojo.Starknet +{ + public class StarknetInterop + { + [DllImport("__Internal")] + public static extern IntPtr NewProvider(CString nodeUrl); + + [DllImport("__Internal")] + public static extern IntPtr NewAccount(IntPtr provider, CString privateKey, CString address, Action cb); + + public class NewAccountHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(IntPtr result) + { + Tcs.SetResult(result); + } + } + + public static Task NewAccountAsync(IntPtr provider, SigningKey privateKey, FieldElement address) + { + NewAccountHelper.Tcs = new TaskCompletionSource(); + NewAccount(provider, new CString(privateKey.Inner.Hex()), new CString(address.Hex()), NewAccountHelper.Callback); + return NewAccountHelper.Tcs.Task; + } + + [DllImport("__Internal")] + public static extern string AccountAddress(IntPtr account); + + [DllImport("__Internal")] + public static extern string AccountChainId(IntPtr account); + + [DllImport("__Internal")] + public static extern void AccountNonce(IntPtr account, Action cb); + + public class AccountNonceHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string result) + { + Tcs.SetResult(new FieldElement(result)); + } + } + + public static Task AccountNonceAsync(IntPtr account) + { + AccountNonceHelper.Tcs = new TaskCompletionSource(); + AccountNonce(account, AccountNonceHelper.Callback); + return AccountNonceHelper.Tcs.Task; + } + + [DllImport("__Internal")] + public static extern void AccountExecuteRaw(IntPtr account, CString calls, Action cb); + + public class AccountExecuteRawHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string result) + { + Tcs.SetResult(new FieldElement(result)); + } + } + + struct SerializedCall + { + public SerializedCall(FieldElement to, string selector, FieldElement[] calldata) + { + this.to = to.Hex(); + this.selector = selector; + this.calldata = calldata.Select(f => f.Hex()).ToArray(); + } + + // hex string of address + public string to; + // the unhashed selector + public string selector; + // array of hex strings + public string[] calldata; + } + + class SerializedBlockId + { + public static object Serialize(dojo.BlockId blockId) + { + return blockId.tag switch + { + dojo.BlockId_Tag.Hash => new BlockIdHash { Hash = new FieldElement(blockId.hash).Hex() }, + dojo.BlockId_Tag.Number => new BlockIdNumber { Number = blockId.number.ToString() }, + dojo.BlockId_Tag.BlockTag_ => new BlockIdTag + { + BlockTag = blockId.block_tag switch + { + dojo.BlockTag.Latest => "Latest", + dojo.BlockTag.Pending => "Pending", + _ => throw new Exception("Unknown block tag") + } + }, + _ => throw new Exception("Unknown block id type") + }; + } + + public struct BlockIdHash + { + public string Hash; + } + + public struct BlockIdNumber + { + public string Number; + } + + public struct BlockIdTag + { + public string BlockTag; + } + } + + public static Task AccountExecuteRawAsync(IntPtr account, dojo.Call[] calls) + { + AccountExecuteRawHelper.Tcs = new TaskCompletionSource(); + AccountExecuteRaw(account, new CString(JsonConvert.SerializeObject(calls.Select(call => new SerializedCall(new FieldElement(call.to), call.selector, call.calldata.ToArray().Select(f => new FieldElement(f)).ToArray())).ToArray())), AccountExecuteRawHelper.Callback); + return AccountExecuteRawHelper.Tcs.Task; + } + + [DllImport("__Internal")] + public static extern void AccountDeployBurner(IntPtr account, CString privateKey, Action cb); + + public class AccountDeployBurnerHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(IntPtr result) + { + Tcs.SetResult(result); + } + } + + public static Task AccountDeployBurnerAsync(IntPtr account, SigningKey signingKey) + { + AccountDeployBurnerHelper.Tcs = new TaskCompletionSource(); + AccountDeployBurner(account, new CString(signingKey.Inner.Hex()), AccountDeployBurnerHelper.Callback); + return AccountDeployBurnerHelper.Tcs.Task; + } + + [DllImport("__Internal")] + public static extern void Call(IntPtr provider, CString call, CString blockId, Action cb); + + public class CallHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string result) + { + Tcs.SetResult(JsonConvert.DeserializeObject(result).Select(f => new FieldElement(f)).ToArray()); + } + } + + public static Task CallAsync(IntPtr provider, dojo.Call call, dojo.BlockId blockId) + { + WaitForTransactionHelper.Tcs = new TaskCompletionSource(); + var serializedCall = new SerializedCall(new FieldElement(call.to), call.selector, call.calldata.ToArray().Select(f => new FieldElement(f)).ToArray()); + object serializedBlockId = SerializedBlockId.Serialize(blockId); + + Call(provider, new CString(JsonConvert.SerializeObject(serializedCall)), new CString(JsonConvert.SerializeObject(serializedBlockId)), CallHelper.Callback); + return CallHelper.Tcs.Task; + } + + [DllImport("__Internal")] + public static extern void WaitForTransaction(IntPtr provider, CString transactionHash, Action cb); + + public class WaitForTransactionHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(bool result) + { + Tcs.SetResult(result); + } + } + + public static Task WaitForTransactionAsync(IntPtr provider, FieldElement transactionHash) + { + WaitForTransactionHelper.Tcs = new TaskCompletionSource(); + WaitForTransaction(provider, new CString(transactionHash.Hex()), WaitForTransactionHelper.Callback); + return WaitForTransactionHelper.Tcs.Task; + } + + [DllImport("__Internal")] + public static extern string NewSigningKey(); + + [DllImport("__Internal")] + public static extern string Sign(CString privateKey, CString hash); + + [DllImport("__Internal")] + public static extern string NewVerifyingKey(CString privateKey); + + [DllImport("__Internal")] + public static extern bool Verify(CString publicKey, CString hash, CString r, CString s); + + [DllImport("__Internal")] + private static extern string SerializeByteArray(CString byteArray); + + public static FieldElement[] SerializeByteArray(string byteArray) + { + return JsonConvert.DeserializeObject(SerializeByteArray(new CString(byteArray))).Select(f => new FieldElement(f)).ToArray(); + } + + [DllImport("__Internal")] + private static extern string DeserializeByteArray(CString felts); + + public static string DeserializeByteArray(FieldElement[] felts) + { + return DeserializeByteArray(new CString(JsonConvert.SerializeObject(felts.Select(f => f.Hex()).ToArray()))); + } + + [DllImport("__Internal")] + public static extern string PoseidonHash(CString str); + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/StarknetInterop.cs.meta b/Assets/Dojo/Runtime/Starknet/StarknetInterop.cs.meta new file mode 100644 index 00000000..78881954 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/StarknetInterop.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc69fa48bde9d444689116dff1193482 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/TypedData.cs b/Assets/Dojo/Runtime/Starknet/TypedData.cs new file mode 100644 index 00000000..36756a1f --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/TypedData.cs @@ -0,0 +1,290 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Reflection; +using bottlenoselabs.C2CS.Runtime; +using Dojo.Torii; +using dojo_bindings; +using Newtonsoft.Json; + +namespace Dojo.Starknet +{ + public class Domain + { + public string name; + public string version; + public string chainId; + public string revision = "1"; + + public Domain(string name, string version, string chainId) + { + this.name = name; + this.version = version; + this.chainId = chainId; + } + } + + public class TypedData + { + public Dictionary types; + public string primaryType; + public Domain domain; + public Dictionary message; + + public TypedData(Dictionary types, string primaryType, Domain domain, Dictionary message) + { + this.types = types; + this.primaryType = primaryType; + this.domain = domain; + this.message = message; + } + + public struct TypedDataType + { + public string name; + public string type; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string contains; + + public TypedDataType(string name, string type, string contains = null) + { + this.name = name; + this.type = type; + this.contains = contains; + } + } + + public TypedData(Model model) + { + types = new Dictionary + { + // starknet domain type + { + "StarknetDomain", + new TypedDataType[] { + new TypedDataType("name", "shortstring"), + new TypedDataType("version", "shortstring"), + new TypedDataType("chainId", "shortstring"), + new TypedDataType("revision", "shortstring") + } + }, + // primary type + { + "OffchainMessage", + new TypedDataType[] { + // model name + new TypedDataType("model", "shortstring"), + // model type + new TypedDataType(model.Name, "Model") + } + } + }; + + // model members types + types.Add("Model", getMembersTypes(ref types, model.Members)); + + primaryType = "OffchainMessage"; + + // wip + domain = new Domain("Dojo", "1", "1"); + message = new Dictionary + { + // model name + { "model", model.Name } + }; + + // model members + var members = new Dictionary(); + foreach (var member in model.Members) + { + members.Add(member.Key, mapMember(member.Value)); + } + + message.Add(model.Name, members); + } + + object mapMember(object member) + { + return member switch + { + Model.Enum enum_ => new Dictionary + { + { enum_.option, mapMember(enum_.value) } + }, + Model.Struct struct_ => struct_.members.Select(child => new KeyValuePair(child.Key, mapMember(child.Value))).ToDictionary(k => k.Key, v => v.Value), + object[] tuple => tuple.Select(mapMember).ToArray(), + List array => array.Select(mapMember).ToList(), + _ => member + }; + } + + TypedDataType[] getMembersTypes(ref Dictionary types, Dictionary members) + { + var result = new List(); + + foreach (var member in members) + { + switch (member.Value) + { + case string _: + result.Add(new TypedDataType(member.Key, "string")); + break; + case FieldElement _: + result.Add(new TypedDataType(member.Key, "felt")); + break; + case byte: + result.Add(new TypedDataType(member.Key, "u8")); + break; + case ushort: + result.Add(new TypedDataType(member.Key, "u16")); + break; + case uint: + result.Add(new TypedDataType(member.Key, "u32")); + break; + case ulong: + result.Add(new TypedDataType(member.Key, "u64")); + break; + case BigInteger: + result.Add(new TypedDataType(member.Key, "u128")); + break; + case bool: + result.Add(new TypedDataType(member.Key, "bool")); + break; + // Enum + // (variantName, variantValue) + case Model.Enum enum_: + var enumMembers = getMembersTypes(ref types, new Dictionary + { + // for now we only include our selected option + // and its value + { enum_.option, enum_.value }, + // TOOD: maybe include all other enum options + // and their types? + }); + types.TryAdd(enum_.name, enumMembers); + result.Add(new TypedDataType(member.Key, "enum", enum_.name)); + break; + case Model.Struct struct_: + var structMembers = getMembersTypes(ref types, struct_.members); + // add the struct members to the types. it might already be added from + // other members + types.TryAdd(struct_.name, structMembers); + result.Add(new TypedDataType(member.Key, struct_.name)); + break; + // tuples are arrays + case object[] tuple: + var tupleMembers = tuple.Select((v, i) => new KeyValuePair(i.ToString(), v)).ToDictionary(k => k.Key, v => v.Value); + var tupleMembersTypes = getMembersTypes(ref types, tupleMembers); + var formattedTupleName = $"({string.Join(",", tupleMembersTypes.Select(t => t.type))})"; + + result.Add(new TypedDataType(member.Key, formattedTupleName)); + break; + // should be encoded as TypeObject* for arrays + case List array: + TypedDataType inner = getMembersTypes(ref types, new Dictionary + { + { "inner", array[0] } + }).First(); + + result.Add(new TypedDataType(member.Key, $"{inner.type}*")); + break; + } + + } + + return result.ToArray(); + } + + public FieldElement encode(FieldElement address) + { +#if UNITY_WEBGL && !UNITY_EDITOR + return new FieldElement(ToriiWasmInterop.EncodeTypedData(new CString(JsonConvert.SerializeObject(this)), new CString(address.Hex()))); +#else + var result = dojo.typed_data_encode(new CString(JsonConvert.SerializeObject(this)), address.Inner); + if (result.tag == dojo.ResultFieldElement_Tag.ErrFieldElement) + { + throw new System.Exception(result.err.message); + } + + return new FieldElement(result.ok); +#endif + } + + static object mapModelInstanceMember(object member) { + var type = member.GetType(); + + // enums + if (member is Enum) { + object value; + if (type.GetProperty("value") is PropertyInfo prop) { + value = prop.GetValue(member); + } else { + value = ValueTuple.Create(); + } + + // format name to include generic types, like Option + var name = type.BaseType.Name.Split('`')[0]; + if (type.GenericTypeArguments.Length > 0) { + name += "<" + string.Join(",", type.GenericTypeArguments.Select(t => t.Name)) + ">"; + } + + return new Model.Enum(name, type.Name, mapModelInstanceMember(value)); + // tuple -> array + } else if (type.FullName.StartsWith(typeof(ValueTuple).FullName)) { + // get all fields of the tuple + // and cast them to object[] array + var fields = type.GetFields(); + var values = new object[fields.Length]; + for (var i = 0; i < fields.Length; i++) { + values[i] = mapModelInstanceMember(fields[i].GetValue(member)); + } + + return values; + } + // array -> List + else if (type.IsArray) { + var array = (Array)member; + var list = new List(); + for (var i = 0; i < array.Length; i++) { + list.Add(mapModelInstanceMember(array.GetValue(i))); + } + + return list; + } + // struct + else if (type.IsValueType && !type.IsPrimitive && !type.IsEnum) { + var fields = type.GetFields(); + var dict = new Dictionary(); + foreach (var field in fields) { + dict.Add(field.Name, mapModelInstanceMember(field.GetValue(member))); + } + + return new Model.Struct(type.Name, dict); + } + + return member; + } + + public static TypedData From(T model) where T : ModelInstance + { + var fields = model.GetType().GetFields(); + var members = new Dictionary(); + + // map all fields of the model instance + foreach (var field in fields) { + // Check if the field has the ModelField attribute + var attribute = field.GetCustomAttributes(typeof(ModelField), false); + if (attribute.Length == 0) + { + continue; + } + + var modelField = (ModelField)attribute[0]; + members.Add(modelField.Name, mapModelInstanceMember(field.GetValue(model))); + } + + return new TypedData(new Model(model.GetType().Name, members)); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/TypedData.cs.meta b/Assets/Dojo/Runtime/Starknet/TypedData.cs.meta new file mode 100644 index 00000000..fc8a8a73 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/TypedData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45ec95435755c406d879713a5daf9a06 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Starknet/VerifyingKey.cs b/Assets/Dojo/Runtime/Starknet/VerifyingKey.cs new file mode 100644 index 00000000..649b4eef --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/VerifyingKey.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using bottlenoselabs.C2CS.Runtime; +using dojo_bindings; +using Newtonsoft.Json; +using Debug = UnityEngine.Debug; + +namespace Dojo.Starknet +{ + // Wraps a FieldElement and provides helper methods for verifying signatures. + public class VerifyingKey + { + public FieldElement Inner { get; } + + public VerifyingKey(string publicKey) + { + Inner = new FieldElement(publicKey); + } + + public VerifyingKey(dojo.FieldElement publicKey) + { + Inner = new FieldElement(publicKey); + } + + public VerifyingKey(FieldElement publicKey) + { + Inner = publicKey; + } + +#if UNITY_WEBGL && !UNITY_EDITOR + // webgl js interop starknet bindings + public bool Verify(FieldElement message, Signature signature) + { + return StarknetInterop.Verify(new CString(Inner.Hex()), new CString(message.Hex()), new CString(signature.R().Hex()), new CString(signature.S().Hex())); + } +#else + // dojo.c starknet-rs bindings + public bool Verify(FieldElement message, Signature signature) + { + var result = dojo.verifying_key_verify(Inner.Inner, message.Inner, signature.Inner); + if (result.tag == dojo.Resultbool_Tag.Errbool) + { + throw new Exception(result.err.message); + } + + return result.ok; + } +#endif + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Starknet/VerifyingKey.cs.meta b/Assets/Dojo/Runtime/Starknet/VerifyingKey.cs.meta new file mode 100644 index 00000000..48306a44 --- /dev/null +++ b/Assets/Dojo/Runtime/Starknet/VerifyingKey.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4cdb96afefa244b29fd978135ac2949d +timeCreated: 1702074930 \ No newline at end of file diff --git a/Assets/Dojo/Runtime/SynchronizationMaster.cs b/Assets/Dojo/Runtime/SynchronizationMaster.cs new file mode 100644 index 00000000..925e1bea --- /dev/null +++ b/Assets/Dojo/Runtime/SynchronizationMaster.cs @@ -0,0 +1,178 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Dojo.Starknet; +using Dojo.Torii; +using dojo_bindings; +using Newtonsoft.Json; +using UnityEngine; +using UnityEngine.Events; + +namespace Dojo +{ + public class SynchronizationMaster : MonoBehaviour + { + public WorldManager worldManager; + + // Maximum number of entities to synchronize + public uint limit = 100; + + // Handle entities that get synchronized + private ModelInstance[] _models; + // Returns all of the model definitions + private ModelInstance[] models => _models ??= LoadModels(); + + public UnityEvent> OnSynchronized; + public UnityEvent OnEntitySpawned; + public UnityEvent OnEventMessage; + + // Awake is called when the script instance is being loaded. + void Awake() + { + // We don't want our model definitions to be active. + // Only used as templates for the actual entities to use. + foreach (var model in models) + { + model.enabled = false; + } + } + + // Fetch all entities from the dojo world and spawn them. + public async Task SynchronizeEntities() + { +#if UNITY_WEBGL && !UNITY_EDITOR + var entities = await worldManager.wasmClient.Entities(worldManager.dojoConfig.query); +#else + var entities = await Task.Run(() => worldManager.toriiClient.Entities(worldManager.dojoConfig.query)); +#endif + + var entityGameObjects = new List(); + foreach (var entity in entities) + { + entityGameObjects.Add(SpawnEntity(entity.HashedKeys, entity.Models.Values.ToArray())); + } + + OnSynchronized?.Invoke(entityGameObjects); + return entities.Count; + } + + // Spawn an Entity game object from a dojo.Entity + private GameObject SpawnEntity(FieldElement hashedKeys, Model[] entityModels) + { + // Add the entity to the world. + var entityGameObject = worldManager.AddEntity(hashedKeys.Hex()); + // Initialize each one of the entity models + foreach (var entityModel in entityModels) + { + string[] parts = entityModel.Name.Split('-'); + string @namespace = parts[0]; + string name = parts[1]; + + // Check if we have a model definition for this entity model + var model = models.FirstOrDefault(m => m.GetType().Name == $"{@namespace}_{name}"); + if (model == null) + { + Debug.LogWarning($"Model {entityModel.Name} not found"); + continue; + } + + // Add the model component to the entity + var component = (ModelInstance)entityGameObject.AddComponent(model.GetType()); + component.Initialize(entityModel); + } + + OnEntitySpawned?.Invoke(entityGameObject); + return entityGameObject; + } + + // Handles spawning / updating entities as they are updated from the dojo world + private void HandleEntityUpdate(FieldElement hashedKeys, Model[] entityModels) + { + // Get the entity game object + var entity = GameObject.Find(hashedKeys.Hex()); + if (entity == null) + { + entity = SpawnEntity(hashedKeys, entityModels); + // We don't need to update the entity models + return; + } + + // Update each one of the entity models + foreach (var entityModel in entityModels) + { + string[] parts = entityModel.Name.Split('-'); + string @namespace = parts[0]; + string name = parts[1]; + + var component = entity.GetComponent(name); + if (component == null) + { + // TODO: decouple? + var model = models.FirstOrDefault(m => m.GetType().Name == $"{@namespace}_{name}"); + if (model == null) + { + Debug.LogWarning($"Model {entityModel.Name} not found"); + continue; + } + + // we dont need to initialize the component + // because it'll get updated + component = (ModelInstance)entity.AddComponent(model.GetType()); + } + + // update component with new model data + ((ModelInstance)component).OnUpdate(entityModel); + } + } + + private void HandleEventMessage(FieldElement hashedKeys, Model[] entityModels) + { + foreach (var entityModel in entityModels) + { + var model = models.FirstOrDefault(m => m.GetType().Name == entityModel.Name); + if (model == null) + { + Debug.LogWarning($"Model {entityModel.Name} not found"); + continue; + } + + model.OnUpdate(entityModel); + OnEventMessage?.Invoke(model); + } + } + + // Register our entity callbacks + public void RegisterEntityCallbacks() + { + ToriiEvents.Instance.OnEntityUpdated += HandleEntityUpdate; + } + + // Register event message callbacks + public void RegisterEventMessageCallbacks() + { + ToriiEvents.Instance.OnEventMessageUpdated += HandleEventMessage; + } + + private ModelInstance[] LoadModels() + { + List models = new(); + + Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); + + foreach (Assembly assembly in assemblies) + { + var modelTypes = assembly.GetTypes() + .Where(t => typeof(ModelInstance).IsAssignableFrom(t) && !t.IsAbstract); + + foreach (Type modelType in modelTypes) + { + models.Add((ModelInstance)gameObject.AddComponent(modelType)); + } + } + + return models.ToArray(); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/SynchronizationMaster.cs.meta b/Assets/Dojo/Runtime/SynchronizationMaster.cs.meta new file mode 100644 index 00000000..bcb73c0a --- /dev/null +++ b/Assets/Dojo/Runtime/SynchronizationMaster.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03336b1725e0144688810398fccab79e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Torii.meta b/Assets/Dojo/Runtime/Torii.meta new file mode 100644 index 00000000..0ed1002d --- /dev/null +++ b/Assets/Dojo/Runtime/Torii.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 170ffd1e7df754c8782b5ee1790e9bb2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Torii/Entity.cs b/Assets/Dojo/Runtime/Torii/Entity.cs new file mode 100644 index 00000000..dfad17f3 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/Entity.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Dojo.Starknet; +using dojo_bindings; + +namespace Dojo.Torii +{ + // A managed type for Entity + // Frees the underlying dojo.Entity when the object is garbage collected + public class Entity + { + public Dictionary Models { get; } + public FieldElement HashedKeys { get; } + public Entity(FieldElement hashedKeys, Dictionary models) + { + HashedKeys = hashedKeys; + Models = models; + } + + public Entity(dojo.Entity entity) + { + HashedKeys = new FieldElement(entity.hashed_keys); + Models = new Dictionary(entity.models.ToArray().Select(m => new KeyValuePair(m.name, new Model(m)))); + + } + + // freeing the entity is naive. if we copy the entity we will double free + // and seg fault. + // ~Entity() + // { + // dojo.entity_free(_entity); + // } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/Entity.cs.meta b/Assets/Dojo/Runtime/Torii/Entity.cs.meta new file mode 100644 index 00000000..22e7338b --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/Entity.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ab298086a6634622993040ba33b87937 +timeCreated: 1701892820 \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/Model.cs b/Assets/Dojo/Runtime/Torii/Model.cs new file mode 100644 index 00000000..cf8081e2 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/Model.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Runtime.InteropServices; +using Dojo.Starknet; +using dojo_bindings; +using JetBrains.Annotations; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using UnityEngine; + +namespace Dojo.Torii +{ + public class Model + { + public struct Enum + { + public string name; + public string option; + public object value; + + public Enum(string name, string option, object value) + { + this.name = name; + this.option = option; + this.value = value; + } + } + + public struct Struct + { + public string name; + public Dictionary members; + + public Struct(string name, Dictionary members) + { + this.name = name; + this.members = members; + } + } + + public string Name { get; } + public Dictionary Members { get; } + + public Model(string name, Dictionary members) + { + Name = name; + + Members = members.ToDictionary(k => k.Key, v => HandleWasmValue(v.Value)); + } + + public Model(string name, Dictionary members) + { + Name = name; + Members = members; + } + + public Model(dojo.Struct model) + { + Name = model.name; + Members = new Dictionary(model.children.ToArray().Select(m => new KeyValuePair(m.name, HandleCValue(m.ty)))); + } + + private object HandleCValue(dojo.Ty ty) + { + return ty.tag switch + { + dojo.Ty_Tag.Struct_ => HandleCStruct(ty.struct_), + dojo.Ty_Tag.Enum_ => HandleCEnum(ty.enum_), + dojo.Ty_Tag.Tuple_ => ty.tuple.ToArray().Select(m => HandleCValue(m)).ToArray(), + dojo.Ty_Tag.Array_ => ty.array.ToArray().Select(m => HandleCValue(m)).ToList(), + dojo.Ty_Tag.Primitive_ => ty.primitive.tag switch + { + dojo.Primitive_Tag.Bool => Convert.ToBoolean(ty.primitive.bool_.Value), + dojo.Primitive_Tag.I8 => ty.primitive.i8, + dojo.Primitive_Tag.I16 => ty.primitive.i16, + dojo.Primitive_Tag.I32 => ty.primitive.i32, + dojo.Primitive_Tag.I64 => ty.primitive.i64, + dojo.Primitive_Tag.I128 => ConvertTwosComplementToBigInteger(ty.primitive.i128.ToArray()), + dojo.Primitive_Tag.U8 => ty.primitive.u8, + dojo.Primitive_Tag.U16 => ty.primitive.u16, + dojo.Primitive_Tag.U32 => ty.primitive.u32, + dojo.Primitive_Tag.U64 => ty.primitive.u64, + dojo.Primitive_Tag.U128 => ConvertTwosComplementToBigInteger(ty.primitive.u128.ToArray()), + dojo.Primitive_Tag.U256 => new Struct("U256", new Dictionary(){ + {"high", new BigInteger(MemoryMarshal.Cast(ty.primitive.u256).Slice(16, 16).ToArray())}, + {"low", new BigInteger(MemoryMarshal.Cast(ty.primitive.u256).Slice(0, 16).ToArray())} + }), + dojo.Primitive_Tag.USize => ty.primitive.u_size, + dojo.Primitive_Tag.Felt252 => new FieldElement(ty.primitive.felt252), + dojo.Primitive_Tag.ClassHash => new FieldElement(ty.primitive.class_hash), + dojo.Primitive_Tag.ContractAddress => new FieldElement(ty.primitive.contract_address), + _ => throw new Exception("Unknown primitive type: " + ty.primitive.tag) + }, + dojo.Ty_Tag.ByteArray => ty.byte_array, + _ => throw new Exception("Unknown type: " + ty.tag) + }; + } + + private object HandleWasmValue(WasmValue value) + { + Debug.Log($"value: {JsonConvert.SerializeObject(value)}"); + return value.type switch + { + // struct + "struct" => HandleJSStruct(value.type_name, value.value.ToObject>()), + // enum + "enum" => HandleJSEnum(value.type_name, value.value.ToObject()), + // tuple + "tuple" => value.value.ToObject().Select(m => HandleWasmValue(m.ToObject())).ToArray(), + // array + "array" => value.value.ToObject().Select(m => HandleWasmValue(m.ToObject())).ToList(), + "bytearray" => value.value.ToObject(), + "primitive" => value.type_name switch + { + // primitives + "bool" => value.value.ToObject(), + "i8" => value.value.ToObject(), + "i16" => value.value.ToObject(), + "i32" => value.value.ToObject(), + "i64" => ConvertTwosComplementToLong(hexStringToByteArray(value.value.ToObject())), + "i128" => ConvertTwosComplementToBigInteger(hexStringToByteArray(value.value.ToObject())), + "u8" => value.value.ToObject(), + "u16" => value.value.ToObject(), + "u32" => value.value.ToObject(), + "u64" => (long)new BigInteger(hexStringToByteArray(value.value.ToObject()).Reverse().ToArray()), + // NOTE: UNTESTED + // NOTE: slow? + // use BigInteger parse instead maybe but seems a bit + // uninconvenient to use + "u128" => new BigInteger(hexStringToByteArray(value.value.ToObject()).Reverse().ToArray()), + // convert a 64 character hex string to a BigInteger + // IMPLEMNET + "u256" => new Struct("U256", new Dictionary(){ + {"high", new BigInteger(hexStringToByteArray(value.value.ToObject().Substring(2, 32)).Reverse().ToArray())}, + {"low", new BigInteger(hexStringToByteArray(value.value.ToObject().Substring(34, 32)).Reverse().ToArray())} + }), + "usize" => value.value.ToObject(), + // these should be fine + "Felt252" => new FieldElement(value.value.ToObject()), + "ClassHash" => new FieldElement(value.value.ToObject()), + "ContractAddress" => new FieldElement(value.value.ToObject()), + _ => throw new Exception("Unknown primitive type: " + value.type_name) + }, + _ => throw new Exception("Unknown type: " + value.type) + }; + } + + private byte[] hexStringToByteArray(string hex) + { + // Remove "0x" prefix if present + hex = hex.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? hex[2..] : hex; + + // Ensure even number of characters + if (hex.Length % 2 != 0) + hex = "0" + hex; + + byte[] bytes = new byte[hex.Length / 2]; + + for (int i = 0; i < bytes.Length; i++) + { + string byteValue = hex.Substring(i * 2, 2); + bytes[i] = Convert.ToByte(byteValue, 16); + } + + return bytes; + } + + private Struct HandleCStruct(dojo.Struct str) + { + return new Struct(str.name, str.children.ToArray().Select(m => new KeyValuePair(m.name, HandleCValue(m.ty))).ToDictionary(k => k.Key, v => v.Value)); + } + + private Enum HandleCEnum(dojo.Enum en) + { + var option = en.options[en.option]; + + // maybe we should inherit the key? + return new Enum(en.name, option.name, HandleCValue(option.ty)); + } + + private Struct HandleJSStruct(string name, Dictionary str) + { + return new Struct(name, str.Select(m => new KeyValuePair(m.Key, HandleWasmValue(m.Value))).ToDictionary(k => k.Key, v => v.Value)); + } + + private Enum HandleJSEnum(string name, WasmEnum en) + { + return new Enum(name, en.option, HandleWasmValue(en.value)); + } + + private long ConvertTwosComplementToLong(byte[] bytes) + { + var reversed = bytes.Reverse().ToArray(); + var unsigned = new BigInteger(reversed); + + // Check if the highest bit is set (negative number) + if ((unsigned & (BigInteger.One << 63)) != 0) + { + // Convert from two's complement + unsigned -= BigInteger.One << 64; + } + + return (long)unsigned; + } + + private BigInteger ConvertTwosComplementToBigInteger(byte[] bytes) + { + var reversed = bytes.Reverse().ToArray(); + var unsigned = new BigInteger(reversed); + + // Check if the highest bit is set (negative number) + if ((unsigned & (BigInteger.One << 127)) != 0) + { + // Convert from two's complement + unsigned -= BigInteger.One << 128; + } + + return unsigned; + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/Model.cs.meta b/Assets/Dojo/Runtime/Torii/Model.cs.meta new file mode 100644 index 00000000..10b91faa --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/Model.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b814f37e245f449f98116f60af089fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Torii/Query.cs b/Assets/Dojo/Runtime/Torii/Query.cs new file mode 100644 index 00000000..06925076 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/Query.cs @@ -0,0 +1,303 @@ +using System; +using System.Linq; +using bottlenoselabs.C2CS.Runtime; +using Dojo.Starknet; +using dojo_bindings; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using UnityEngine; + +namespace Dojo.Torii +{ +#nullable enable + + [Serializable] + public class Query + { + public uint limit; + public uint offset; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Clause? clause; + public bool dont_include_hashed_keys; + + public Query(uint limit, uint offset, Clause? clause = null, bool dont_include_hashed_keys = false) + { + this.limit = limit; + this.offset = offset; + this.clause = clause; + this.dont_include_hashed_keys = dont_include_hashed_keys; + } + + public dojo.Query ToNative() + { + var nativeQuery = new dojo.Query + { + limit = limit, + offset = offset, + clause = new dojo.COptionClause { tag = dojo.COptionClause_Tag.NoneClause }, + dont_include_hashed_keys = dont_include_hashed_keys + }; + + if (clause.HasValue) + { + nativeQuery.clause = new dojo.COptionClause + { + tag = dojo.COptionClause_Tag.SomeClause, + some = clause.Value.ToNative() + }; + } + + return nativeQuery; + } + } + + [Serializable] + public struct Clause + { + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public KeysClause? Keys; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public MemberClause? Member; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompositeClause? Composite; + + public static implicit operator Clause(KeysClause keysClause) + { + return new Clause { Keys = keysClause }; + } + + public static implicit operator Clause(MemberClause memberClause) + { + return new Clause { Member = memberClause }; + } + + public static implicit operator Clause(CompositeClause compositeClause) + { + return new Clause { Composite = compositeClause }; + } + + public dojo.Clause ToNative() + { + if (Keys.HasValue) + return new dojo.Clause { tag = dojo.Clause_Tag.Keys, keys = Keys.Value.ToNative() }; + if (Member.HasValue) + return new dojo.Clause { tag = dojo.Clause_Tag.CMember, c_member = Member.Value.ToNative() }; + if (Composite.HasValue) + return new dojo.Clause { tag = dojo.Clause_Tag.Composite, composite = Composite.Value.ToNative() }; + + throw new InvalidOperationException("Clause must have one non-null value"); + } + } + + [Serializable] + public struct EntityKeysClause + { + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FieldElement[]? HashedKeys; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public KeysClause? Keys; + + public EntityKeysClause(object type) : this() + { + if (type is FieldElement[] hashedKeys) + HashedKeys = hashedKeys; + else if (type is KeysClause keys) + Keys = keys; + else + throw new ArgumentException("Invalid entity keys clause type"); + } + + public dojo.EntityKeysClause ToNative() + { + if (HashedKeys != null) + return new dojo.EntityKeysClause + { + tag = dojo.EntityKeysClause_Tag.HashedKeys, + hashed_keys = HashedKeys.Select(k => k.Inner).ToArray() + }; + if (Keys.HasValue) + return new dojo.EntityKeysClause + { + tag = dojo.EntityKeysClause_Tag.EntityKeys, + entity_keys = Keys.Value.ToNative() + }; + + throw new InvalidOperationException("EntityKeysClause must have one non-null value"); + } + } + + [Serializable] + public struct KeysClause + { + public FieldElement?[] keys; + [JsonConverter(typeof(StringEnumConverter))] + public dojo.PatternMatching pattern_matching; + public string[] models; + + public KeysClause(FieldElement?[] keys, dojo.PatternMatching pattern_matching, string[] models) + { + this.keys = keys; + this.pattern_matching = pattern_matching; + this.models = models; + } + + public dojo.KeysClause ToNative() + { + return new dojo.KeysClause + { + keys = keys.Select(k => k is null ? + new dojo.COptionFieldElement { tag = dojo.COptionFieldElement_Tag.NoneFieldElement } + : new dojo.COptionFieldElement { tag = dojo.COptionFieldElement_Tag.SomeFieldElement, some = k.Inner }).ToArray(), + pattern_matching = pattern_matching, + models = models + }; + } + } + + [Serializable] + public struct MemberClause + { + public string model; + public string member; + [JsonConverter(typeof(StringEnumConverter))] + public dojo.ComparisonOperator @operator; + public MemberValue value; + + public MemberClause(string model, string member, dojo.ComparisonOperator @operator, MemberValue value) + { + this.model = model; + this.member = member; + this.@operator = @operator; + this.value = value; + } + + public dojo.MemberClause ToNative() + { + return new dojo.MemberClause + { + model = model, + member = member, + operator_ = @operator, + value = value.ToNative() + }; + } + } + + [Serializable] + public struct CompositeClause + { + [JsonConverter(typeof(StringEnumConverter))] + public dojo.LogicalOperator @operator; + public Clause[] clauses; + + public CompositeClause(dojo.LogicalOperator @operator, Clause[] clauses) + { + this.@operator = @operator; + this.clauses = clauses; + } + + public dojo.CompositeClause ToNative() + { + return new dojo.CompositeClause + { + operator_ = @operator, + clauses = clauses.Select(c => c.ToNative()).ToArray() + }; + } + } + + + [Serializable] + public struct MemberValue + { + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? String; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Primitive? Primitive; + + public dojo.MemberValue ToNative() + { + if (String != null) + return new dojo.MemberValue { tag = dojo.MemberValue_Tag.String, @string = String }; + if (Primitive.HasValue) + return new dojo.MemberValue { tag = dojo.MemberValue_Tag.Primitive, primitive = Primitive.Value.ToNative() }; + + throw new InvalidOperationException("MemberValue must have one non-null value"); + } + } + + [Serializable] + public struct Primitive + { + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public sbyte? I8; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public short? I16; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? I32; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public long? I64; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FieldElement? I128; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public byte? U8; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ushort? U16; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public uint? U32; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ulong? U64; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FieldElement? U128; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? U256; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public uint? USize; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool? Bool; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FieldElement? Felt252; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FieldElement? ClassHash; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FieldElement? ContractAddress; + + public dojo.Primitive ToNative() + { + if (I8.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.I8, i8 = I8.Value }; + if (I16.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.I16, i16 = I16.Value }; + if (I32.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.I32, i32 = I32.Value }; + if (I64.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.I64, i64 = I64.Value }; + if (I128 != null) + return new dojo.Primitive { tag = dojo.Primitive_Tag.I128, i128 = I128.Inner.data }; + if (U8.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.U8, u8 = U8.Value }; + if (U16.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.U16, u16 = U16.Value }; + if (U32.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.U32, u32 = U32.Value }; + if (U64.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.U64, u64 = U64.Value }; + if (U128 != null) + return new dojo.Primitive { tag = dojo.Primitive_Tag.U128, u128 = U128.Inner.data }; + if (U256 != null) + throw new NotImplementedException("U256 conversion not implemented"); + if (USize.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.USize, u_size = USize.Value }; + if (Bool.HasValue) + return new dojo.Primitive { tag = dojo.Primitive_Tag.Bool, bool_ = Bool.Value }; + if (Felt252 != null) + return new dojo.Primitive { tag = dojo.Primitive_Tag.Felt252, felt252 = Felt252.Inner }; + if (ClassHash != null) + return new dojo.Primitive { tag = dojo.Primitive_Tag.ClassHash, class_hash = ClassHash.Inner }; + if (ContractAddress != null) + return new dojo.Primitive { tag = dojo.Primitive_Tag.ContractAddress, contract_address = ContractAddress.Inner }; + + throw new InvalidOperationException("Primitive must have one non-null value"); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/Query.cs.meta b/Assets/Dojo/Runtime/Torii/Query.cs.meta new file mode 100644 index 00000000..9637f5e5 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/Query.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fc551dbdbd6e4edc99d0b5e70f85bd2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Torii/ToriiClient.cs b/Assets/Dojo/Runtime/Torii/ToriiClient.cs new file mode 100644 index 00000000..3792feee --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiClient.cs @@ -0,0 +1,256 @@ +using System; +using System.Collections.Generic; +using bottlenoselabs.C2CS.Runtime; +using UnityEngine; +using dojo_bindings; +using Dojo.Starknet; +using Newtonsoft.Json; +using System.Linq; +namespace Dojo.Torii +{ + public unsafe class ToriiClient + { + private dojo.FnPtr_FieldElement_CArrayStruct_Void.@delegate onEntityStateUpdate; + private dojo.FnPtr_FieldElement_CArrayStruct_Void.@delegate onEventMessagesUpdate; + private dojo.ToriiClient* client; + private dojo.Subscription* entitySubscription; + private dojo.Subscription* eventMessagesSubscription; + + public ToriiClient(string toriiUrl, string rpcUrl, string relayUrl, FieldElement worldAddress, bool dispatchEventsToMainThread = true) + { + CString ctoriiUrl = CString.FromString(toriiUrl); + CString crpcUrl = CString.FromString(rpcUrl); + CString crelayUrl = CString.FromString(relayUrl); + + var result = dojo.client_new(ctoriiUrl, crpcUrl, crelayUrl, worldAddress.Inner); + if (result.tag == dojo.ResultToriiClient_Tag.ErrToriiClient) + { + throw new Exception(result.err.message); + } + + client = result._ok; + dojo.client_set_logger(client, new dojo.FnPtr_CString_Void((msg) => Debug.Log(msg))); + + RegisterEntityStateUpdateEvent(new EntityKeysClause[] { }, dispatchEventsToMainThread); + RegisterEventMessageUpdateEvent(new EntityKeysClause[] { }, dispatchEventsToMainThread); + } + + // We assume the torii client won't be copied around. + // So we can free the underlying c client when the managed client is garbage collected. + ~ToriiClient() + { + dojo.subscription_cancel(entitySubscription); + dojo.subscription_cancel(eventMessagesSubscription); + + // dojo.client_free(client); + } + + public dojo.WorldMetadata WorldMetadata() + { + // TODO: implement a managed type for WorldMetadata too + dojo.WorldMetadata worldMetadata = dojo.client_metadata(client); + + return worldMetadata; + } + + // NOT USED? potentially deprecated + // [CanBeNull] + // public Model Model(dojo.KeysClause query) + // { + // dojo.ResultCOptionTy result = dojo.client_model(client, &query); + // if (result.tag == dojo.ResultCOptionTy_Tag.ErrCOptionTy) + // { + // throw new Exception(result.err.message); + // } + + // // can be None - nullable + // if (result.ok.tag == dojo.COptionTy_Tag.NoneTy) + // { + // return null; + // } + + // // we instantiate a new managed Ty object + // // which will free the underlying c ty when it is garbage collected + // return new Ty(result.ok._some.); + // } + + public List Entities(Query query) + { + var nativeQuery = query.ToNative(); + + dojo.ResultCArrayEntity result = dojo.client_entities(client, &nativeQuery); + if (result.tag == dojo.ResultCArrayEntity_Tag.ErrCArrayEntity) + { + throw new Exception(result.err.message); + } + + var entities = new List(); + for (var i = 0; i < (int)result._ok.data_len; i++) + { + entities.Add(new Entity(result._ok.data[i])); + } + + dojo.carray_free(result._ok.data, result._ok.data_len); + return entities; + } + + public List EventMessages(Query query, bool historical = false) + { + var nativeQuery = query.ToNative(); + + dojo.ResultCArrayEntity result = dojo.client_event_messages(client, &nativeQuery, historical); + if (result.tag == dojo.ResultCArrayEntity_Tag.ErrCArrayEntity) + { + throw new Exception(result.err.message); + } + + var entities = new List(); + for (var i = 0; i < (int)result._ok.data_len; i++) + { + entities.Add(new Entity(result._ok.data[i])); + } + + dojo.carray_free(result._ok.data, result._ok.data_len); + return entities; + } + + private void RegisterEntityStateUpdateEvent(EntityKeysClause[] clauses, bool dispatchToMainThread = true) + { + onEntityStateUpdate = (key, models) => + { + var mappedModels = new Model[(int)models.data_len]; + for (var i = 0; i < (int)models.data_len; i++) + { + mappedModels[i] = new Model(models.data[i]); + // cleanup model + // dojo.model_free(&models.data[i]); + } + + // only run this when in unity play mode + // we need our unity main thread dispatcher to run this on the main thread + if (dispatchToMainThread) + { + UnityMainThreadDispatcher.Instance().Enqueue(() => ToriiEvents.Instance.EntityUpdated(new FieldElement(key), mappedModels)); + } + else + { + ToriiEvents.Instance.EntityUpdated(new FieldElement(key), mappedModels); + } + + // cleanup + dojo.carray_free(models.data, models.data_len); + // TODO: free field element + }; + + + dojo.EntityKeysClause* clausesPtr = (dojo.EntityKeysClause*)0; + if (clauses.Length > 0) + { + var mappedClauses = clauses.Select(c => c.ToNative()).ToArray(); + fixed (dojo.EntityKeysClause* ptr = &mappedClauses[0]) + { + clausesPtr = ptr; + } + } + + + dojo.ResultSubscription res = dojo.client_on_entity_state_update(client, clausesPtr, (UIntPtr)clauses.Length, new dojo.FnPtr_FieldElement_CArrayStruct_Void(onEntityStateUpdate)); + if (res.tag == dojo.ResultSubscription_Tag.ErrSubscription) + { + throw new Exception(res.err.message); + } + + entitySubscription = res._ok; + } + + public void UpdateEntitySubscription(EntityKeysClause[] clauses) + { + var mappedClauses = clauses.Select(c => c.ToNative()).ToArray(); + dojo.EntityKeysClause* clausesPtr; + fixed (dojo.EntityKeysClause* ptr = &mappedClauses[0]) + { + clausesPtr = ptr; + } + + dojo.client_update_entity_subscription(client, entitySubscription, clausesPtr, (UIntPtr)clauses.Length); + } + + private void RegisterEventMessageUpdateEvent(EntityKeysClause[] clauses, bool historical = false, bool dispatchToMainThread = true) + { + onEventMessagesUpdate = (key, models) => + { + var mappedModels = new Model[(int)models.data_len]; + for (var i = 0; i < (int)models.data_len; i++) + { + mappedModels[i] = new Model(models.data[i]); + // cleanup model + // dojo.model_free(&models.data[i]); + } + + // only run this when in unity play mode + // we need our unity main thread dispatcher to run this on the main thread + if (dispatchToMainThread) + { + UnityMainThreadDispatcher.Instance().Enqueue(() => ToriiEvents.Instance.EventMessageUpdated(new FieldElement(key), mappedModels)); + } + else + { + ToriiEvents.Instance.EventMessageUpdated(new FieldElement(key), mappedModels); + } + + // cleanup + dojo.carray_free(models.data, models.data_len); + // TODO: free field element + }; + + + dojo.EntityKeysClause* clausesPtr = (dojo.EntityKeysClause*)0; + if (clauses.Length > 0) + { + var mappedClauses = clauses.Select(c => c.ToNative()).ToArray(); + fixed (dojo.EntityKeysClause* ptr = &mappedClauses[0]) + { + clausesPtr = ptr; + } + } + + dojo.ResultSubscription res = dojo.client_on_event_message_update(client, clausesPtr, (UIntPtr)clauses.Length, historical, new dojo.FnPtr_FieldElement_CArrayStruct_Void(onEventMessagesUpdate)); + if (res.tag == dojo.ResultSubscription_Tag.ErrSubscription) + { + throw new Exception(res.err.message); + } + + eventMessagesSubscription = res._ok; + } + + public void UpdateEventMessageSubscription(EntityKeysClause[] clauses, bool historical = false) + { + var mappedClauses = clauses.Select(c => c.ToNative()).ToArray(); + dojo.EntityKeysClause* clausesPtr; + fixed (dojo.EntityKeysClause* ptr = &mappedClauses[0]) + { + clausesPtr = ptr; + } + + dojo.client_update_event_message_subscription(client, eventMessagesSubscription, clausesPtr, (UIntPtr)clauses.Length, historical); + } + + public Span PublishMessage(TypedData typedData, FieldElement[] signature) + { + var mappedSignature = signature.Select(s => s.Inner).ToArray(); + dojo.FieldElement* signaturePtr; + fixed (dojo.FieldElement* ptr = &mappedSignature[0]) + { + signaturePtr = ptr; + } + + var result = dojo.client_publish_message(client, new CString(JsonConvert.SerializeObject(typedData)), signaturePtr, (UIntPtr)signature.Length); + if (result.tag == dojo.ResultCArrayu8_Tag.ErrCArrayu8) + { + throw new Exception(result.err.message); + } + + return result.ok; + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/ToriiClient.cs.meta b/Assets/Dojo/Runtime/Torii/ToriiClient.cs.meta new file mode 100644 index 00000000..0e8f9c95 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91e0e9dc49b4c4e17b4b1197264ed4bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Torii/ToriiEvents.cs b/Assets/Dojo/Runtime/Torii/ToriiEvents.cs new file mode 100644 index 00000000..5334b7fe --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiEvents.cs @@ -0,0 +1,48 @@ +using System; +using Dojo.Starknet; +using dojo_bindings; +using UnityEngine; + +namespace Dojo.Torii +{ + public class ToriiEvents + { + private static ToriiEvents instance; + + public static ToriiEvents Instance + { + get + { + if (instance == null) + { + instance = new ToriiEvents(); + } + + return instance; + } + } + + public delegate void OnSyncModelUpdateDelegate(); + public delegate void OnEntityStateUpdateDelegate(FieldElement key, Model[] models); + public delegate void OnEventMessageUpdateDelegate(FieldElement key, Model[] models); + + public event OnEntityStateUpdateDelegate OnEntityUpdated; + public event OnEventMessageUpdateDelegate OnEventMessageUpdated; + public event OnSyncModelUpdateDelegate OnSyncModelUpdated; + + public void EventMessageUpdated(FieldElement key, Model[] models) + { + OnEventMessageUpdated?.Invoke(key, models); + } + + public void EntityUpdated(FieldElement key, Model[] models) + { + OnEntityUpdated?.Invoke(key, models); + } + + public void SyncModelUpdated() + { + OnSyncModelUpdated?.Invoke(); + } + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/ToriiEvents.cs.meta b/Assets/Dojo/Runtime/Torii/ToriiEvents.cs.meta new file mode 100644 index 00000000..b8ea0a60 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiEvents.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 642cb7614a6b4abaa32ebc4c95bf1336 +timeCreated: 1702573728 \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/ToriiWasmClient.cs b/Assets/Dojo/Runtime/Torii/ToriiWasmClient.cs new file mode 100644 index 00000000..df0c122d --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiWasmClient.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AOT; +using bottlenoselabs.C2CS.Runtime; +using Dojo.Starknet; +using dojo_bindings; +using Newtonsoft.Json; +using UnityEngine; + +namespace Dojo.Torii +{ + public class ToriiWasmClient + { + private string toriiUrl; + private string rpcUrl; + private string relayUrl; + private FieldElement world; + public IntPtr clientPtr; + + IntPtr entitySubscription; + IntPtr eventMessageSubscription; + + public ToriiWasmClient(string toriiUrl, string rpcUrl, string relayUrl, FieldElement world) + { + this.toriiUrl = toriiUrl; + this.rpcUrl = rpcUrl; + this.relayUrl = relayUrl; + this.world = world; + } + + private static class CreateClientHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(IntPtr clientPtr) + { + Tcs.SetResult(clientPtr); + } + } + + public async Task CreateClient() + { + CreateClientHelper.Tcs = new TaskCompletionSource(); + ToriiWasmInterop.CreateClient(new CString(rpcUrl), new CString(toriiUrl), new CString(relayUrl), new CString(world.Hex()), CreateClientHelper.Callback); + clientPtr = await CreateClientHelper.Tcs.Task; + + entitySubscription = await RegisterEntityStateUpdateEvent(new KeysClause[] { }); + eventMessageSubscription = await RegisterEventMessageUpdateEvent(new KeysClause[] { }); + } + + private static class GetEntitiesHelper + { + public static TaskCompletionSource> Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string entities) + { + var parsedEntities = JsonConvert.DeserializeObject>>>(entities); + var entityList = new List(); + + foreach (var entity in parsedEntities) + { + var models = new Dictionary(); + foreach (var model in entity.Value) + { + models.Add(model.Key, new Model( + model.Key, + model.Value.ToDictionary( + m => m.Key, + m => m.Value + ) + )); + } + + entityList.Add(new Entity(new FieldElement(entity.Key), models)); + } + + Tcs.SetResult(entityList); + } + } + + public Task> Entities(Query query) + { + GetEntitiesHelper.Tcs = new TaskCompletionSource>(); + ToriiWasmInterop.GetEntities(clientPtr, new CString(JsonConvert.SerializeObject(query)), GetEntitiesHelper.Callback); + return GetEntitiesHelper.Tcs.Task; + } + + public Task> EventMessages(Query query) + { + GetEntitiesHelper.Tcs = new TaskCompletionSource>(); + ToriiWasmInterop.GetEventMessages(clientPtr, new CString(JsonConvert.SerializeObject(query)), GetEntitiesHelper.Callback); + return GetEntitiesHelper.Tcs.Task; + } + + private static class OnEntityUpdatedHelper + { + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string hashed_keys, string models) + { + var parsedModels = JsonConvert.DeserializeObject>>(models).Select(m => new Model( + m.Key, + m.Value + )).ToArray(); + + ToriiEvents.Instance.EntityUpdated(new FieldElement(hashed_keys), parsedModels); + } + } + + private static class SubscriptionHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(IntPtr subPtr) + { + Tcs.SetResult(subPtr); + } + } + + public async Task RegisterEntityStateUpdateEvent(KeysClause[] clauses) + { + SubscriptionHelper.Tcs = new TaskCompletionSource(); + ToriiWasmInterop.OnEntityUpdated(clientPtr, new CString(JsonConvert.SerializeObject(clauses)), OnEntityUpdatedHelper.Callback, SubscriptionHelper.Callback); + return await SubscriptionHelper.Tcs.Task; + } + + public void UpdateEntitySubscription(KeysClause[] clauses) + { + ToriiWasmInterop.UpdateEntitySubscription(clientPtr, entitySubscription, new CString(JsonConvert.SerializeObject(clauses))); + } + + private static class OnEventMessageUpdatedHelper + { + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string hashed_keys, string models) + { + var parsedModels = JsonConvert.DeserializeObject>>(models).Select(m => new Model( + m.Key, + m.Value + )).ToArray(); + + ToriiEvents.Instance.EventMessageUpdated(new FieldElement(hashed_keys), parsedModels); + } + } + + public async Task RegisterEventMessageUpdateEvent(KeysClause[] clauses) + { + SubscriptionHelper.Tcs = new TaskCompletionSource(); + ToriiWasmInterop.OnEventMessageUpdated(clientPtr, new CString(JsonConvert.SerializeObject(clauses)), OnEventMessageUpdatedHelper.Callback, SubscriptionHelper.Callback); + return await SubscriptionHelper.Tcs.Task; + } + + public void UpdateEventMessageSubscription(KeysClause[] clauses) + { + ToriiWasmInterop.UpdateEventMessageSubscription(clientPtr, eventMessageSubscription, new CString(JsonConvert.SerializeObject(clauses))); + } + + private static class PublishMessageHelper + { + public static TaskCompletionSource Tcs; + + [MonoPInvokeCallback(typeof(Action))] + public static void Callback(string messageId) + { + Tcs.SetResult(JsonConvert.DeserializeObject(messageId)); + } + } + + public Task PublishMessage(TypedData typedData, FieldElement[] signature) + { + PublishMessageHelper.Tcs = new TaskCompletionSource(); + ToriiWasmInterop.PublishMessage(clientPtr, new CString(JsonConvert.SerializeObject(typedData)), new CString(JsonConvert.SerializeObject(signature)), PublishMessageHelper.Callback); + return PublishMessageHelper.Tcs.Task; + } + + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/ToriiWasmClient.cs.meta b/Assets/Dojo/Runtime/Torii/ToriiWasmClient.cs.meta new file mode 100644 index 00000000..742cdca0 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiWasmClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 36dd8a29682074310a17ed3141123c34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/Torii/ToriiWasmInterop.cs b/Assets/Dojo/Runtime/Torii/ToriiWasmInterop.cs new file mode 100644 index 00000000..c2c5e59d --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiWasmInterop.cs @@ -0,0 +1,83 @@ +using UnityEngine; +using System; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using bottlenoselabs.C2CS.Runtime; +using AOT; +using System.Collections.Generic; +using dojo_bindings; +using Dojo.Starknet; +using Newtonsoft.Json; +using System.Linq; +using Newtonsoft.Json.Linq; + + +namespace Dojo.Torii +{ + [Serializable] + public struct WasmValue + { + public string type; + public string type_name; + public JToken value; + public bool key; + } + + [Serializable] + public struct WasmEnum + { + public string option; + public WasmValue value; + } + + public class ToriiWasmInterop : MonoBehaviour + { + // Creates a new client and returns the pointer to it + [DllImport("__Internal")] + public static extern void CreateClient(CString rpcUrl, CString toriiUrl, CString relayUrl, CString worldAddress, Action cb); + + // Returns a dictionary of all of the entities + [DllImport("__Internal")] + public static extern void GetEntities(IntPtr clientPtr, CString query, Action cb); + + [DllImport("__Internal")] + public static extern void GetEventMessages(IntPtr clientPtr, CString query, Action cb); + + // Get the value of a model for a specific set of keys + [DllImport("__Internal")] + public static extern string GetModelValue(IntPtr clientPtr, CString model, CString keys); + + // Calls the callback at [callbackObjectName].[callbackMethodName] on entity updated + [DllImport("__Internal")] + public static extern void OnEntityUpdated(IntPtr clientPtr, CString clauses, Action cb, Action subCb); + + [DllImport("__Internal")] + public static extern void UpdateEntitySubscription(IntPtr clientPtr, IntPtr subPtr, CString clauses); + + // Calls the callback at [callbackObjectName].[callbackMethodName] on event mnessage updated + [DllImport("__Internal")] + public static extern void OnEventMessageUpdated(IntPtr clientPtr, CString clauses, Action cb, Action subCb); + + [DllImport("__Internal")] + public static extern void UpdateEventMessageSubscription(IntPtr clientPtr, IntPtr subPtr, CString clauses); + + // Add models to sync + [DllImport("__Internal")] + public static extern void AddModelsToSync(IntPtr clientPtr, CString models); + + // Remove models to sync + [DllImport("__Internal")] + public static extern void RemoveModelsToSync(IntPtr clientPtr, CString models); + + // Calls the callback at [callbackObjectName].[callbackMethodName] on model change + [DllImport("__Internal")] + public static extern void OnSyncModelChange(IntPtr clientPtr, CString model, CString callbackObjectName, CString callbackMethodName); + + [DllImport("__Internal")] + public static extern string EncodeTypedData(CString typedData, CString address); + + + [DllImport("__Internal")] + public static extern void PublishMessage(IntPtr clientPtr, CString typedData, CString signature, Action cb); + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/Torii/ToriiWasmInterop.cs.meta b/Assets/Dojo/Runtime/Torii/ToriiWasmInterop.cs.meta new file mode 100644 index 00000000..f939db06 --- /dev/null +++ b/Assets/Dojo/Runtime/Torii/ToriiWasmInterop.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2d95e0060dd634843b30e3347384dd00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/UnityMainThreadDispatcher.cs b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.cs new file mode 100644 index 00000000..d853913f --- /dev/null +++ b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.cs @@ -0,0 +1,121 @@ +/* +Copyright 2015 Pim de Witte All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; +using System.Threading.Tasks; + +namespace Dojo { + /// Author: Pim de Witte (pimdewitte.com) and contributors, https://github.com/PimDeWitte/UnityMainThreadDispatcher + /// + /// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for + /// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling + /// + public class UnityMainThreadDispatcher : MonoBehaviour { + + private static readonly Queue _executionQueue = new Queue(); + + public void Update() { + lock(_executionQueue) { + while (_executionQueue.Count > 0) { + _executionQueue.Dequeue().Invoke(); + } + } + } + + /// + /// Locks the queue and adds the IEnumerator to the queue + /// + /// IEnumerator function that will be executed from the main thread. + public void Enqueue(IEnumerator action) { + lock (_executionQueue) { + _executionQueue.Enqueue (() => { + StartCoroutine (action); + }); + } + } + + /// + /// Locks the queue and adds the Action to the queue + /// + /// function that will be executed from the main thread. + public void Enqueue(Action action) + { + Enqueue(ActionWrapper(action)); + } + + /// + /// Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes + /// + /// function that will be executed from the main thread. + /// A Task that can be awaited until the action completes + public Task EnqueueAsync(Action action) + { + var tcs = new TaskCompletionSource(); + + void WrappedAction() { + try + { + action(); + tcs.TrySetResult(true); + } catch (Exception ex) + { + tcs.TrySetException(ex); + } + } + + Enqueue(ActionWrapper(WrappedAction)); + return tcs.Task; + } + + + IEnumerator ActionWrapper(Action a) + { + a(); + yield return null; + } + + + private static UnityMainThreadDispatcher _instance = null; + + public static bool Exists() { + return _instance != null; + } + + public static UnityMainThreadDispatcher Instance() { + if (!Exists ()) { + throw new Exception ("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); + } + return _instance; + } + + + void Awake() { + if (_instance == null) { + _instance = this; + DontDestroyOnLoad(this.gameObject); + } + } + + void OnDestroy() { + _instance = null; + } + + + } +} \ No newline at end of file diff --git a/Assets/Dojo/Runtime/UnityMainThreadDispatcher.cs.meta b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.cs.meta new file mode 100644 index 00000000..114f810d --- /dev/null +++ b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e64d6ffea92654f2985ae6e815d40ad7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/UnityMainThreadDispatcher.prefab b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.prefab new file mode 100644 index 00000000..6c12637e --- /dev/null +++ b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.prefab @@ -0,0 +1,50 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &184210 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 22414968} + - component: {fileID: 6342550579897674515} + m_Layer: 0 + m_Name: UnityMainThreadDispatcher + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &22414968 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 184210} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -50, y: -50} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0, y: 0} +--- !u!114 &6342550579897674515 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 184210} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e64d6ffea92654f2985ae6e815d40ad7, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Dojo/Runtime/UnityMainThreadDispatcher.prefab.meta b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.prefab.meta new file mode 100644 index 00000000..803ed892 --- /dev/null +++ b/Assets/Dojo/Runtime/UnityMainThreadDispatcher.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c3c54c612cab04d86ab0ee8c4125943d +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/WorldManager.cs b/Assets/Dojo/Runtime/WorldManager.cs new file mode 100644 index 00000000..e258569d --- /dev/null +++ b/Assets/Dojo/Runtime/WorldManager.cs @@ -0,0 +1,126 @@ +using System.Linq; +using dojo_bindings; +using UnityEngine; +using Dojo.Torii; +using System; +using Dojo.Starknet; +using System.Threading.Tasks; + +namespace Dojo +{ + public class WorldManager : MonoBehaviour + { + public SynchronizationMaster synchronizationMaster; + public ToriiClient toriiClient; + public ToriiWasmClient wasmClient; + [SerializeField] public WorldManagerData dojoConfig; + + async void Awake() + { +#if UNITY_WEBGL && !UNITY_EDITOR + wasmClient = new ToriiWasmClient(dojoConfig.toriiUrl, dojoConfig.rpcUrl, + dojoConfig.relayWebrtcUrl, dojoConfig.worldAddress); + await wasmClient.CreateClient(); +#else + toriiClient = new ToriiClient(dojoConfig.toriiUrl, dojoConfig.rpcUrl, + dojoConfig.relayUrl, dojoConfig.worldAddress); +#endif + + /* fetch entities from the world + TODO: maybe do in the start function of the SynchronizationMaster? + problem is when to start the subscription service + */ + await synchronizationMaster.SynchronizeEntities(); + + // listen for entity updates + synchronizationMaster.RegisterEntityCallbacks(); + synchronizationMaster.RegisterEventMessageCallbacks(); + } + + // #if UNITY_WEBGL && !UNITY_EDITOR + // // internal callback to be called for when the client is created + // // on the wasm sdk. + // public void OnClientCreated(float clientPtr) + // { + // toriiClient.wasmClientPtr = (IntPtr)clientPtr; + // // we dont start the subscription service + // // because wasm already does it. + + // // fetch entities from the world + // // TODO: maybe do in the start function of the SynchronizationMaster? + // // problem is when to start the subscription service + // synchronizationMaster.SynchronizeEntities(); + + // // listen for entity updates + // synchronizationMaster.RegisterEntityCallbacks(); + // } + // #endif + + /* Get a child entity from the WorldManager game object. + Name is usually the hashed_keys of the entity as a hex string. + */ + public GameObject Entity(string name) + { + var entity = transform.Find(name); + if (entity == null) + { + Debug.LogError($"Entity {name} not found"); + return null; + } + + return entity.gameObject; + } + + // Return all children entities. + public GameObject[] Entities() + { + return transform.Cast().Select(t => t.gameObject).ToArray(); + } + + // Return all children entities. + // That have the specified component. + public GameObject[] Entities() where T : Component + { + return transform.Cast() + .Select(t => t.gameObject) + .Where(g => g.GetComponent() != null) + .ToArray(); + } + + // Add a new entity game object as a child of the WorldManager game object. + public GameObject AddEntity(string key) + { + // check if entity already exists + var entity = transform.Find(key)?.gameObject; + if (entity != null) + { + Debug.LogWarning($"Entity {key} already exists"); + return entity.gameObject; + } + + entity = new GameObject(key); + entity.transform.parent = transform; + + return entity; + } + + // Remove an entity game object from the WorldManager game object. + public void RemoveEntity(string key) + { + var entity = transform.Find(key); + if (entity != null) + { + Destroy(entity.gameObject); + } + } + + public async Task Publish(TypedData typedData, FieldElement[] signature) + { +#if UNITY_WEBGL && !UNITY_EDITOR + return await wasmClient.PublishMessage(typedData, signature); +#else + return await Task.Run(() => toriiClient.PublishMessage(typedData, signature).ToArray()); +#endif + } + } +} diff --git a/Assets/Dojo/Runtime/WorldManager.cs.meta b/Assets/Dojo/Runtime/WorldManager.cs.meta new file mode 100644 index 00000000..5b925751 --- /dev/null +++ b/Assets/Dojo/Runtime/WorldManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85bbcaeafdf5e41c6a2f48ff65820b7d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/bindings.meta b/Assets/Dojo/Runtime/bindings.meta new file mode 100644 index 00000000..304582e0 --- /dev/null +++ b/Assets/Dojo/Runtime/bindings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e737eb36a634e4749adbb89b50c74761 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/bindings/client.meta b/Assets/Dojo/Runtime/bindings/client.meta new file mode 100644 index 00000000..8216d0b3 --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5fd9914df07a4811bb84c0520a694cc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs b/Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs new file mode 100644 index 00000000..0720567a --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs @@ -0,0 +1,27 @@ +// To disable generating this file set `isEnabledGenerateAssemblyAttributes` to `false` in the config file for generating C# code. +// +// This code was generated by the following tool on 2024-11-04 18:42:12 GMT-05:00: +// https://github.com/bottlenoselabs/c2cs (v0.0.0.0) +// +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +// +// ReSharper disable All + +#region Template +#nullable enable +#pragma warning disable CS1591 +#pragma warning disable CS8981 +using bottlenoselabs.C2CS.Runtime; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Linq; +#endregion + +#if NET7_0_OR_GREATER +[assembly: DisableRuntimeMarshalling] +#endif + +[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)] diff --git a/Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs.meta b/Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs.meta new file mode 100644 index 00000000..bc2da10c --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9233e4708d16d4b64972ed5e59ec9cac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs b/Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs new file mode 100644 index 00000000..5c9782fe --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs @@ -0,0 +1,790 @@ + +// To disable generating this file set `isEnabledGeneratingRuntimeCode` to `false` in the config file for generating C# code. + +// +// This code was generated by the following tool on 2024-11-04 18:42:12 GMT-05:00: +// https://github.com/bottlenoselabs/c2cs (v0.0.0.0) +// +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +// +// ReSharper disable All + +#region Template +#nullable enable +#pragma warning disable CS1591 +#pragma warning disable CS8981 +using bottlenoselabs.C2CS.Runtime; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Linq; +#endregion + +namespace bottlenoselabs.C2CS.Runtime +{ + + /// + /// Specifies a C `const` for a parameter or return value. + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue)] + public sealed class CConstAttribute : Attribute + { + // marker + } + + /// + /// Specifies a C node with a specific kind for a C# type. + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Enum | AttributeTargets.Field)] + public sealed class CNodeAttribute : Attribute + { + /// + /// Gets or sets the C node kind. + /// + public string Kind { get; set; } = string.Empty; + } + + /// + /// A boolean value type with the same memory layout as a in both managed and unmanaged contexts; + /// equivalent to a standard bool found in C/C++/ObjC where 0 is false and any other value is + /// true. + /// + [StructLayout(LayoutKind.Sequential)] + public readonly struct CBool : IEquatable + { + public readonly byte Value; + + private CBool(bool value) + { + Value = Convert.ToByte(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static implicit operator CBool(bool value) + { + return FromBoolean(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static CBool FromBoolean(bool value) + { + return new CBool(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static implicit operator bool(CBool value) + { + return ToBoolean(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static bool ToBoolean(CBool value) + { + return Convert.ToBoolean(value.Value); + } + + /// + public override string ToString() + { + return ToBoolean(this).ToString(); + } + + /// + public override bool Equals(object? obj) + { + return obj is CBool b && Equals(b); + } + + /// + public bool Equals(CBool other) + { + return Value == other.Value; + } + + /// + public override int GetHashCode() + { + return Value.GetHashCode(); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool operator ==(CBool left, CBool right) + { + return left.Value == right.Value; + } + + /// + /// Returns a value that indicates whether two specified structures are not equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are not equal; otherwise, false. + public static bool operator !=(CBool left, CBool right) + { + return !(left == right); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool Equals(CBool left, CBool right) + { + return left.Value == right.Value; + } + } + + /// + /// A value type with the same memory layout as a in a managed context and char in + /// an unmanaged context. + /// + [StructLayout(LayoutKind.Sequential)] + public readonly struct CChar : IEquatable, IEquatable + { + public readonly byte Value; + + private CChar(byte value) + { + Value = Convert.ToByte(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static implicit operator CChar(byte value) + { + return FromByte(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static CChar FromByte(byte value) + { + return new CChar(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static implicit operator byte(CChar value) + { + return ToByte(value); + } + + /// + /// Converts the specified to a . + /// + /// The value. + /// A . + public static byte ToByte(CChar value) + { + return value.Value; + } + + /// + public override string ToString() + { + return Value.ToString(CultureInfo.InvariantCulture); + } + + /// + public override bool Equals(object? obj) + { + return obj is CChar value && Equals(value); + } + + /// + public bool Equals(byte other) + { + return Value == other; + } + + /// + public bool Equals(CChar other) + { + return Value == other.Value; + } + + /// + public override int GetHashCode() + { + return Value.GetHashCode(); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool operator ==(CChar left, CChar right) + { + return left.Value == right.Value; + } + + /// + /// Returns a value that indicates whether two specified structures are not equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are not equal; otherwise, false. + public static bool operator !=(CChar left, CChar right) + { + return !(left == right); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool Equals(CChar left, CChar right) + { + return left.Value == right.Value; + } + } + + /// + /// A pointer value type of bytes that represent a string; the C type `char*`. + /// + [StructLayout(LayoutKind.Sequential)] + public readonly unsafe struct CString : IEquatable, IDisposable + { + public readonly nint Pointer; + + /// + /// Gets a value indicating whether this is a null pointer. + /// + public bool IsNull => Pointer == 0; + + /// + /// Initializes a new instance of the struct. + /// + /// The pointer value. + public CString(byte* value) + { + Pointer = (nint)value; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The pointer value. + public CString(nint value) + { + Pointer = value; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public CString(string s) + { + Pointer = FromString(s).Pointer; + } + + /// + /// Attempts to free the memory pointed by the . + /// + public void Dispose() + { + Marshal.FreeHGlobal(Pointer); + } + + /// + /// Performs an explicit conversion from an to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static explicit operator CString(nint value) + { + return FromIntPtr(value); + } + + /// + /// Performs an explicit conversion from an to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static CString FromIntPtr(nint value) + { + return new CString(value); + } + + /// + /// Performs an implicit conversion from a byte pointer to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static implicit operator CString(byte* value) + { + return From(value); + } + + /// + /// Performs an implicit conversion from a byte pointer to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static CString From(byte* value) + { + return new CString((nint)value); + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The pointer. + /// + /// The resulting . + /// + public static implicit operator nint(CString value) + { + return value.Pointer; + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The pointer. + /// + /// The resulting . + /// + public static nint ToIntPtr(CString value) + { + return value.Pointer; + } + + /// + /// Performs an explicit conversion from a to a . + /// + /// The . + /// + /// The resulting . + /// + public static explicit operator string(CString value) + { + return ToString(value); + } + + /// + /// Converts a C style string (ANSI or UTF-8) of type `char` (one dimensional byte array + /// terminated by a 0x0) to a UTF-16 by allocating and copying. + /// + /// A pointer to the C string. + /// A equivalent of . + public static string ToString(CString value) + { + if (value.IsNull) + { + return string.Empty; + } + + // calls ASM/C/C++ functions to calculate length and then "FastAllocate" the string with the GC + // https://mattwarren.org/2016/05/31/Strings-and-the-CLR-a-Special-Relationship/ + var result = Marshal.PtrToStringAnsi(value.Pointer); + + if (string.IsNullOrEmpty(result)) + { + return string.Empty; + } + + return result; + } + + /// + /// Performs an explicit conversion from a to a . + /// + /// The . + /// + /// The resulting . + /// + public static explicit operator CString(string s) + { + return FromString(s); + } + + /// + /// Converts a UTF-16 to a C style string (one dimensional byte array terminated by a + /// 0x0) by allocating and copying. + /// + /// The . + /// A C string pointer. + public static CString FromString(string str) + { + var pointer = Marshal.StringToHGlobalAnsi(str); + return new CString(pointer); + } + + /// + public override string ToString() + { + return ToString(this); + } + + /// + public override bool Equals(object? obj) + { + return obj is CString value && Equals(value); + } + + /// + public bool Equals(CString other) + { + return Pointer == other.Pointer; + } + + /// + public override int GetHashCode() + { + return Pointer.GetHashCode(); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool operator ==(CString left, CString right) + { + return left.Pointer == right.Pointer; + } + + /// + /// Returns a value that indicates whether two specified structures are not equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are not equal; otherwise, false. + public static bool operator !=(CString left, CString right) + { + return !(left == right); + } + } + + /// + /// Utility methods for interoperability with C style strings in C#. + /// + public static unsafe class CStrings + { + /// + /// Converts an array of strings to an array of C strings of type `char` (multi-dimensional array of one + /// dimensional byte arrays each terminated by a 0x0) by allocating and copying if not already cached. + /// + /// + /// Calls . + /// + /// The strings. + /// An array pointer of C string pointers. You are responsible for freeing the returned pointer. + public static CString* CStringArray(ReadOnlySpan values) + { + var pointerSize = IntPtr.Size; + var result = (CString*)Marshal.AllocHGlobal(pointerSize * values.Length); + for (var i = 0; i < values.Length; ++i) + { + var @string = values[i]; + var cString = CString.FromString(@string); + result[i] = cString; + } + + return result; + } + + /// + /// Converts an array of strings to an array of C strings of type `wchar_t` (multi-dimensional array of one + /// dimensional ushort arrays each terminated by a 0x0) by allocating and copying if not already cached. + /// + /// + /// Calls . + /// + /// The strings. + /// An array pointer of C string pointers. You are responsible for freeing the returned pointer. + public static CStringWide* CStringWideArray(ReadOnlySpan values) + { + var pointerSize = IntPtr.Size; + var result = (CStringWide*)Marshal.AllocHGlobal(pointerSize * values.Length); + for (var i = 0; i < values.Length; ++i) + { + var @string = values[i]; + var cString = CStringWide.FromString(@string); + result[i] = cString; + } + + return result; + } + } + + /// + /// A pointer value type that represents a wide string; C type `wchar_t*`. + /// + [StructLayout(LayoutKind.Sequential)] + public readonly unsafe struct CStringWide : IEquatable + { + public readonly nint Pointer; + + /// + /// Gets a value indicating whether this is a null pointer. + /// + public bool IsNull => Pointer == 0; + + /// + /// Initializes a new instance of the struct. + /// + /// The pointer value. + public CStringWide(byte* value) + { + Pointer = (nint)value; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The pointer value. + public CStringWide(nint value) + { + Pointer = value; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public CStringWide(string s) + { + Pointer = FromString(s).Pointer; + } + + /// + /// Performs an explicit conversion from a to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static explicit operator CStringWide(nint value) + { + return FromIntPtr(value); + } + + /// + /// Performs an explicit conversion from a to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static CStringWide FromIntPtr(nint value) + { + return new CStringWide(value); + } + + /// + /// Performs an implicit conversion from a byte pointer to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static implicit operator CStringWide(byte* value) + { + return From(value); + } + + /// + /// Performs an implicit conversion from a byte pointer to a . + /// + /// The pointer value. + /// + /// The resulting . + /// + public static CStringWide From(byte* value) + { + return new CStringWide((nint)value); + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The pointer. + /// + /// The resulting . + /// + public static implicit operator nint(CStringWide value) + { + return value.Pointer; + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The pointer. + /// + /// The resulting . + /// + public static nint ToIntPtr(CStringWide value) + { + return value.Pointer; + } + + /// + /// Performs an explicit conversion from a to a . + /// + /// The . + /// + /// The resulting . + /// + public static explicit operator string(CStringWide value) + { + return ToString(value); + } + + /// + /// Converts a C style string (unicode) of type `wchar_t` (one dimensional ushort array + /// terminated by a 0x0) to a UTF-16 by allocating and copying. + /// + /// A pointer to the C string. + /// A equivalent of . + public static string ToString(CStringWide value) + { + if (value.IsNull) + { + return string.Empty; + } + + // calls ASM/C/C++ functions to calculate length and then "FastAllocate" the string with the GC + // https://mattwarren.org/2016/05/31/Strings-and-the-CLR-a-Special-Relationship/ + var result = Marshal.PtrToStringUni(value.Pointer); + + if (string.IsNullOrEmpty(result)) + { + return string.Empty; + } + + return result; + } + + /// + /// Performs an explicit conversion from a to a . + /// + /// The . + /// + /// The resulting . + /// + public static explicit operator CStringWide(string s) + { + return FromString(s); + } + + /// + /// Converts a C string pointer (one dimensional byte array terminated by a + /// 0x0) for a specified by allocating and copying if not already cached. + /// + /// The . + /// A C string pointer. + public static CStringWide FromString(string str) + { + var pointer = Marshal.StringToHGlobalUni(str); + return new CStringWide(pointer); + } + + /// + public override string ToString() + { + return ToString(this); + } + + /// + public override bool Equals(object? obj) + { + return obj is CStringWide value && Equals(value); + } + + /// + public bool Equals(CStringWide other) + { + return Pointer == other.Pointer; + } + + /// + public override int GetHashCode() + { + return Pointer.GetHashCode(); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool operator ==(CStringWide left, CStringWide right) + { + return left.Pointer == right.Pointer; + } + + /// + /// Returns a value that indicates whether two specified structures are not equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are not equal; otherwise, false. + public static bool operator !=(CStringWide left, CStringWide right) + { + return !(left == right); + } + + /// + /// Returns a value that indicates whether two specified structures are equal. + /// + /// The first to compare. + /// The second to compare. + /// true if and are equal; otherwise, false. + public static bool Equals(CStringWide left, CStringWide right) + { + return left.Pointer == right.Pointer; + } + } +} diff --git a/Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs.meta b/Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs.meta new file mode 100644 index 00000000..8f8aca17 --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d614dd06d58f455992af3473838d86e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Runtime/bindings/client/dojo.gen.cs b/Assets/Dojo/Runtime/bindings/client/dojo.gen.cs new file mode 100644 index 00000000..4e05830f --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client/dojo.gen.cs @@ -0,0 +1,3131 @@ + +// +// This code was generated by the following tool on 2024-11-04 18:42:12 GMT-05:00: +// https://github.com/bottlenoselabs/c2cs (v0.0.0.0) +// +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +// +// ReSharper disable All + +#region Template +#nullable enable +#pragma warning disable CS1591 +#pragma warning disable CS8981 +using bottlenoselabs.C2CS.Runtime; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Linq; +#endregion + +namespace dojo_bindings +{ + + public static unsafe partial class dojo + { + private const string LibraryName = "libdojo_c"; + + #region API + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_address", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement account_address(Account* account); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_chain_id", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement account_chain_id(Account* account); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_deploy_burner", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultAccount account_deploy_burner(Provider* provider, Account* master_account, FieldElement signing_key); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_execute_raw", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultFieldElement account_execute_raw(Account* account, Call* calldata, UIntPtr calldata_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void account_free(Account* account); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_new", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultAccount account_new(Provider* rpc, FieldElement private_key, CString address); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_nonce", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultFieldElement account_nonce(Account* account); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "account_set_block_id", CallingConvention = CallingConvention.Cdecl)] + public static extern void account_set_block_id(Account* account, BlockId block_id); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "bytearray_deserialize", CallingConvention = CallingConvention.Cdecl)] + public static extern Resultc_char bytearray_deserialize(FieldElement* felts, UIntPtr felts_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "bytearray_serialize", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultCArrayFieldElement bytearray_serialize(CString str); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "cairo_short_string_to_felt", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultFieldElement cairo_short_string_to_felt(CString str); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "carray_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void carray_free(void* data, UIntPtr data_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_entities", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultCArrayEntity client_entities(ToriiClient* client, Query* query); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_event_messages", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultCArrayEntity client_event_messages(ToriiClient* client, Query* query, CBool historical); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void client_free(ToriiClient* t); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_metadata", CallingConvention = CallingConvention.Cdecl)] + public static extern WorldMetadata client_metadata(ToriiClient* client); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_new", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultToriiClient client_new(CString torii_url, CString rpc_url, CString libp2p_relay_url, FieldElement world); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_on_entity_state_update", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultSubscription client_on_entity_state_update(ToriiClient* client, EntityKeysClause* clauses, UIntPtr clauses_len, FnPtr_FieldElement_CArrayStruct_Void callback); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_on_event_message_update", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultSubscription client_on_event_message_update(ToriiClient* client, EntityKeysClause* clauses, UIntPtr clauses_len, CBool historical, FnPtr_FieldElement_CArrayStruct_Void callback); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_on_starknet_event", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultSubscription client_on_starknet_event(ToriiClient* client, EntityKeysClause* clauses, UIntPtr clauses_len, FnPtr_Event_Void callback); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_publish_message", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultCArrayu8 client_publish_message(ToriiClient* client, CString message, FieldElement* signature_felts, UIntPtr signature_felts_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_set_logger", CallingConvention = CallingConvention.Cdecl)] + public static extern void client_set_logger(ToriiClient* client, FnPtr_CString_Void logger); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_update_entity_subscription", CallingConvention = CallingConvention.Cdecl)] + public static extern Resultbool client_update_entity_subscription(ToriiClient* client, Subscription* subscription, EntityKeysClause* clauses, UIntPtr clauses_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "client_update_event_message_subscription", CallingConvention = CallingConvention.Cdecl)] + public static extern Resultbool client_update_event_message_subscription(ToriiClient* client, Subscription* subscription, EntityKeysClause* clauses, UIntPtr clauses_len, CBool historical); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "entity_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void entity_free(Entity* entity); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "error_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void error_free(Error* error); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "get_selector_from_name", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultFieldElement get_selector_from_name(CString name); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "get_selector_from_tag", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement get_selector_from_tag(CString tag); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "hash_get_contract_address", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement hash_get_contract_address(FieldElement class_hash, FieldElement salt, FieldElement* constructor_calldata, UIntPtr constructor_calldata_len, FieldElement deployer_address); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "model_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void model_free(Struct* model); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "on_indexer_update", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultSubscription on_indexer_update(ToriiClient* client, FieldElement* contract_address, FnPtr_IndexerUpdate_Void callback); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "parse_cairo_short_string", CallingConvention = CallingConvention.Cdecl)] + public static extern Resultc_char parse_cairo_short_string(FieldElement felt); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "poseidon_hash", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement poseidon_hash(FieldElement* felts, UIntPtr felts_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "provider_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void provider_free(Provider* rpc); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "provider_new", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultProvider provider_new(CString rpc_url); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "signing_key_new", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement signing_key_new(); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "signing_key_sign", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultSignature signing_key_sign(FieldElement private_key, FieldElement hash); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "starknet_call", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultCArrayFieldElement starknet_call(Provider* provider, Call call, BlockId block_id); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "starknet_keccak", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement starknet_keccak(byte* bytes, UIntPtr bytes_len); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "string_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void string_free(CString @string); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "subscription_cancel", CallingConvention = CallingConvention.Cdecl)] + public static extern void subscription_cancel(Subscription* subscription); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "ty_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void ty_free(Ty* ty); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "typed_data_encode", CallingConvention = CallingConvention.Cdecl)] + public static extern ResultFieldElement typed_data_encode(CString typed_data, FieldElement address); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "verifying_key_new", CallingConvention = CallingConvention.Cdecl)] + public static extern FieldElement verifying_key_new(FieldElement signing_key); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "verifying_key_verify", CallingConvention = CallingConvention.Cdecl)] + public static extern Resultbool verifying_key_verify(FieldElement verifying_key, FieldElement hash, Signature signature); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "wait_for_transaction", CallingConvention = CallingConvention.Cdecl)] + public static extern Resultbool wait_for_transaction(Provider* rpc, FieldElement txn_hash); + + [CNode(Kind = "Function")] + [DllImport(LibraryName, EntryPoint = "world_metadata_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void world_metadata_free(WorldMetadata* metadata); + + #endregion + + #region Types + + [CNode(Kind = "FunctionPointer")] + [StructLayout(LayoutKind.Sequential)] + public struct FnPtr_CString_Void + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public unsafe delegate void @delegate(CString param); + + public IntPtr Pointer; + + public FnPtr_CString_Void(@delegate d) + { + Pointer = Marshal.GetFunctionPointerForDelegate(d); + } + } + + [CNode(Kind = "FunctionPointer")] + [StructLayout(LayoutKind.Sequential)] + public struct FnPtr_Event_Void + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public unsafe delegate void @delegate(Event param); + + public IntPtr Pointer; + + public FnPtr_Event_Void(@delegate d) + { + Pointer = Marshal.GetFunctionPointerForDelegate(d); + } + } + + [CNode(Kind = "FunctionPointer")] + [StructLayout(LayoutKind.Sequential)] + public struct FnPtr_FieldElement_CArrayStruct_Void + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public unsafe delegate void @delegate(FieldElement param, CArrayStruct param2); + + public IntPtr Pointer; + + public FnPtr_FieldElement_CArrayStruct_Void(@delegate d) + { + Pointer = Marshal.GetFunctionPointerForDelegate(d); + } + } + + [CNode(Kind = "FunctionPointer")] + [StructLayout(LayoutKind.Sequential)] + public struct FnPtr_IndexerUpdate_Void + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public unsafe delegate void @delegate(IndexerUpdate param); + + public IntPtr Pointer; + + public FnPtr_IndexerUpdate_Void(@delegate d) + { + Pointer = Marshal.GetFunctionPointerForDelegate(d); + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct BlockId + { + [FieldOffset(0)] // size = 4 + public BlockId_Tag tag; + + [FieldOffset(8)] // size = 32 + public FieldElement hash; + + [FieldOffset(8)] // size = 8 + public ulong number; + + [FieldOffset(8)] // size = 4 + public BlockTag block_tag; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] + public struct BlockId_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 32 + public FieldElement hash; + + [FieldOffset(0)] // size = 8 + public ulong number; + + [FieldOffset(0)] // size = 4 + public BlockTag block_tag; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct BlockId_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 32 + public FieldElement hash; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct BlockId_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public ulong number; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 4, Pack = 4)] + public struct BlockId_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2 + { + [FieldOffset(0)] // size = 4 + public BlockTag block_tag; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayCHashItemFieldElementModelMetadata + { + [FieldOffset(0)] // size = 8 + public CHashItemFieldElementModelMetadata* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayCOptionFieldElement + { + [FieldOffset(0)] // size = 8 + public COptionFieldElement* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayClause + { + [FieldOffset(0)] // size = 8 + public Clause* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayEntity + { + [FieldOffset(0)] // size = 8 + public Entity* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayEnumOption + { + [FieldOffset(0)] // size = 8 + public EnumOption* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayFieldElement + { + [FieldOffset(0)] // size = 8 + public FieldElement* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayMember + { + [FieldOffset(0)] // size = 8 + public Member* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayStruct + { + [FieldOffset(0)] // size = 8 + public Struct* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayTy + { + [FieldOffset(0)] // size = 8 + public Ty* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayc_char + { + [FieldOffset(0)] // size = 8 + public CString* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct CArrayu8 + { + [FieldOffset(0)] // size = 8 + public byte* data; + + [FieldOffset(8)] // size = 8 + public UIntPtr data_len; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 184, Pack = 8)] + public struct CHashItemFieldElementModelMetadata + { + [FieldOffset(0)] // size = 32 + public FieldElement key; + + [FieldOffset(32)] // size = 152 + public ModelMetadata value; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 88, Pack = 8)] + public struct COptionClause + { + [FieldOffset(0)] // size = 4 + public COptionClause_Tag tag; + + [FieldOffset(8)] // size = 80 + public Clause some; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 80, Pack = 8)] + public struct COptionClause_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 80 + public Clause some; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 80, Pack = 8)] + public struct COptionClause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 80 + public Clause some; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 36, Pack = 4)] + public struct COptionFieldElement + { + [FieldOffset(0)] // size = 4 + public COptionFieldElement_Tag tag; + + [FieldOffset(4)] // size = 32 + public FieldElement some; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct COptionFieldElement_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 32 + public FieldElement some; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct COptionFieldElement_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 32 + public FieldElement some; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 56, Pack = 8)] + public struct Call + { + [FieldOffset(0)] // size = 32 + public FieldElement to; + + [FieldOffset(32)] // size = 8 + public CString selector_; + + public string selector + { + get + { + return CString.ToString(selector_); + } + set + { + selector_ = CString.FromString(value); + } + } + + [FieldOffset(40)] // size = 16 + public CArrayFieldElement _calldata; + + public Span calldata + { + get + { + fixed (Call* @this = &this) + { + var span = new Span(@this->_calldata.data, (int)@this->_calldata.data_len); + return span; + } + } + + set + { + + _calldata = new CArrayFieldElement(); + _calldata.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _calldata.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 80, Pack = 8)] + public struct Clause + { + [FieldOffset(0)] // size = 4 + public Clause_Tag tag; + + [FieldOffset(8)] // size = 40 + public KeysClause keys; + + [FieldOffset(8)] // size = 72 + public MemberClause c_member; + + [FieldOffset(8)] // size = 24 + public CompositeClause composite; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 72, Pack = 8)] + public struct Clause_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 40 + public KeysClause keys; + + [FieldOffset(0)] // size = 72 + public MemberClause c_member; + + [FieldOffset(0)] // size = 24 + public CompositeClause composite; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct Clause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 40 + public KeysClause keys; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 72, Pack = 8)] + public struct Clause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 72 + public MemberClause c_member; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct Clause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2 + { + [FieldOffset(0)] // size = 24 + public CompositeClause composite; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct CompositeClause + { + [FieldOffset(0)] // size = 4 + public LogicalOperator operator_; + + [FieldOffset(8)] // size = 16 + public CArrayClause _clauses; + + public Span clauses + { + get + { + fixed (CompositeClause* @this = &this) + { + var span = new Span(@this->_clauses.data, (int)@this->_clauses.data_len); + return span; + } + } + + set + { + + _clauses = new CArrayClause(); + _clauses.data_len = (UIntPtr)value.Length; + fixed (Clause* ptr = value) + { + _clauses.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 48, Pack = 8)] + public struct Entity + { + [FieldOffset(0)] // size = 32 + public FieldElement hashed_keys; + + [FieldOffset(32)] // size = 16 + public CArrayStruct _models; + + public Span models + { + get + { + fixed (Entity* @this = &this) + { + var span = new Span(@this->_models.data, (int)@this->_models.data_len); + return span; + } + } + + set + { + + _models = new CArrayStruct(); + _models.data_len = (UIntPtr)value.Length; + fixed (Struct* ptr = value) + { + _models.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 48, Pack = 8)] + public struct EntityKeysClause + { + [FieldOffset(0)] // size = 4 + public EntityKeysClause_Tag tag; + + [FieldOffset(8)] // size = 16 + public CArrayFieldElement _hashed_keys; + + public Span hashed_keys + { + get + { + fixed (EntityKeysClause* @this = &this) + { + var span = new Span(@this->_hashed_keys.data, (int)@this->_hashed_keys.data_len); + return span; + } + } + + set + { + + _hashed_keys = new CArrayFieldElement(); + _hashed_keys.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _hashed_keys.data = ptr; + } + } + } + + [FieldOffset(8)] // size = 40 + public KeysClause entity_keys; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct EntityKeysClause_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 16 + public CArrayFieldElement _hashed_keys; + + public Span hashed_keys + { + get + { + fixed (EntityKeysClause_ANONYMOUS_FIELD1* @this = &this) + { + var span = new Span(@this->_hashed_keys.data, (int)@this->_hashed_keys.data_len); + return span; + } + } + + set + { + + _hashed_keys = new CArrayFieldElement(); + _hashed_keys.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _hashed_keys.data = ptr; + } + } + } + + [FieldOffset(0)] // size = 40 + public KeysClause entity_keys; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct EntityKeysClause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 16 + public CArrayFieldElement _hashed_keys; + + public Span hashed_keys + { + get + { + fixed (EntityKeysClause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0* @this = &this) + { + var span = new Span(@this->_hashed_keys.data, (int)@this->_hashed_keys.data_len); + return span; + } + } + + set + { + + _hashed_keys = new CArrayFieldElement(); + _hashed_keys.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _hashed_keys.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct EntityKeysClause_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 40 + public KeysClause entity_keys; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] + public struct Enum + { + [FieldOffset(0)] // size = 8 + public CString name_; + + public string name + { + get + { + return CString.ToString(name_); + } + set + { + name_ = CString.FromString(value); + } + } + + [FieldOffset(8)] // size = 1 + public byte option; + + [FieldOffset(16)] // size = 16 + public CArrayEnumOption _options; + + public Span options + { + get + { + fixed (Enum* @this = &this) + { + var span = new Span(@this->_options.data, (int)@this->_options.data_len); + return span; + } + } + + set + { + + _options = new CArrayEnumOption(); + _options.data_len = (UIntPtr)value.Length; + fixed (EnumOption* ptr = value) + { + _options.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct EnumOption + { + [FieldOffset(0)] // size = 8 + public CString name_; + + public string name + { + get + { + return CString.ToString(name_); + } + set + { + name_ = CString.FromString(value); + } + } + + [FieldOffset(8)] // size = 8 + public Ty* _ty; + + public Ty ty + { + get + { + return *_ty; + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Error + { + [FieldOffset(0)] // size = 8 + public CString message_; + + public string message + { + get + { + return CString.ToString(message_); + } + set + { + message_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 64, Pack = 8)] + public struct Event + { + [FieldOffset(0)] // size = 16 + public CArrayFieldElement _keys; + + public Span keys + { + get + { + fixed (Event* @this = &this) + { + var span = new Span(@this->_keys.data, (int)@this->_keys.data_len); + return span; + } + } + + set + { + + _keys = new CArrayFieldElement(); + _keys.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _keys.data = ptr; + } + } + } + + [FieldOffset(16)] // size = 16 + public CArrayFieldElement _data; + + public Span data + { + get + { + fixed (Event* @this = &this) + { + var span = new Span(@this->_data.data, (int)@this->_data.data_len); + return span; + } + } + + set + { + + _data = new CArrayFieldElement(); + _data.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _data.data = ptr; + } + } + } + + [FieldOffset(32)] // size = 32 + public FieldElement transaction_hash; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct FieldElement + { + [FieldOffset(0)] // size = 32 + public fixed byte _data[32]; // uint8_t[32] + + public Span data + { + get + { + fixed (FieldElement* @this = &this) + { + var pointer = &@this->_data[0]; + var span = new Span(pointer, 32); + return span; + } + } + + set + { + fixed (FieldElement* @this = &this) + { + var pointer = &@this->_data[0]; + var span = new Span(pointer, 32); + value.CopyTo(span); + } + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 56, Pack = 8)] + public struct IndexerUpdate + { + [FieldOffset(0)] // size = 8 + public long head; + + [FieldOffset(8)] // size = 8 + public long tps; + + [FieldOffset(16)] // size = 8 + public long last_block_timestamp; + + [FieldOffset(24)] // size = 32 + public FieldElement contract_address; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct KeysClause + { + [FieldOffset(0)] // size = 16 + public CArrayCOptionFieldElement _keys; + + public Span keys + { + get + { + fixed (KeysClause* @this = &this) + { + var span = new Span(@this->_keys.data, (int)@this->_keys.data_len); + return span; + } + } + + set + { + + _keys = new CArrayCOptionFieldElement(); + _keys.data_len = (UIntPtr)value.Length; + fixed (COptionFieldElement* ptr = value) + { + _keys.data = ptr; + } + } + } + + [FieldOffset(16)] // size = 4 + public PatternMatching pattern_matching; + + [FieldOffset(24)] // size = 16 + public CArrayc_char _models; + + public Span models + { + get + { + fixed (KeysClause* @this = &this) + { + var span = new Span(@this->_models.data, (int)@this->_models.data_len); + return span.ToArray().Select(str => CString.ToString(str)).ToArray(); + } + } + + set + { + var strings = value.ToArray().Select(str => CString.FromString(str)).ToArray(); + _models = new CArrayc_char(); + _models.data_len = (UIntPtr)value.Length; + fixed (CString* ptr = strings) + { + _models.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct Member + { + [FieldOffset(0)] // size = 8 + public CString name_; + + public string name + { + get + { + return CString.ToString(name_); + } + set + { + name_ = CString.FromString(value); + } + } + + [FieldOffset(8)] // size = 8 + public Ty* _ty; + + public Ty ty + { + get + { + return *_ty; + } + } + + [FieldOffset(16)] // size = 1 + public CBool key; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 72, Pack = 8)] + public struct MemberClause + { + [FieldOffset(0)] // size = 8 + public CString model_; + + public string model + { + get + { + return CString.ToString(model_); + } + set + { + model_ = CString.FromString(value); + } + } + + [FieldOffset(8)] // size = 8 + public CString member_; + + public string member + { + get + { + return CString.ToString(member_); + } + set + { + member_ = CString.FromString(value); + } + } + + [FieldOffset(16)] // size = 4 + public ComparisonOperator operator_; + + [FieldOffset(24)] // size = 48 + public MemberValue value; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 48, Pack = 8)] + public struct MemberValue + { + [FieldOffset(0)] // size = 4 + public MemberValue_Tag tag; + + [FieldOffset(8)] // size = 40 + public Primitive primitive; + + [FieldOffset(8)] // size = 8 + public CString @string_; + + public string @string + { + get + { + return CString.ToString(@string_); + } + set + { + @string_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct MemberValue_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 40 + public Primitive primitive; + + [FieldOffset(0)] // size = 8 + public CString @string_; + + public string @string + { + get + { + return CString.ToString(@string_); + } + set + { + @string_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct MemberValue_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 40 + public Primitive primitive; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct MemberValue_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public CString @string_; + + public string @string + { + get + { + return CString.ToString(@string_); + } + set + { + @string_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 152, Pack = 8)] + public struct ModelMetadata + { + [FieldOffset(0)] // size = 48 + public Ty schema; + + [FieldOffset(48)] // size = 8 + public CString namespace__; + + public string namespace_ + { + get + { + return CString.ToString(namespace__); + } + set + { + namespace__ = CString.FromString(value); + } + } + + [FieldOffset(56)] // size = 8 + public CString name_; + + public string name + { + get + { + return CString.ToString(name_); + } + set + { + name_ = CString.FromString(value); + } + } + + [FieldOffset(64)] // size = 4 + public uint packed_size; + + [FieldOffset(68)] // size = 4 + public uint unpacked_size; + + [FieldOffset(72)] // size = 32 + public FieldElement class_hash; + + [FieldOffset(104)] // size = 32 + public FieldElement contract_address; + + [FieldOffset(136)] // size = 16 + public CArrayFieldElement _layout; + + public Span layout + { + get + { + fixed (ModelMetadata* @this = &this) + { + var span = new Span(@this->_layout.data, (int)@this->_layout.data_len); + return span; + } + } + + set + { + + _layout = new CArrayFieldElement(); + _layout.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _layout.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct Primitive + { + [FieldOffset(0)] // size = 4 + public Primitive_Tag tag; + + [FieldOffset(8)] // size = 1 + public sbyte i8; + + [FieldOffset(8)] // size = 2 + public short i16; + + [FieldOffset(8)] // size = 4 + public int i32; + + [FieldOffset(8)] // size = 8 + public long i64; + + [FieldOffset(8)] // size = 16 + public fixed byte _i128[16]; // uint8_t[16] + + public Span i128 + { + get + { + fixed (Primitive* @this = &this) + { + var pointer = &@this->_i128[0]; + var span = new Span(pointer, 16); + return span; + } + } + + set + { + fixed (Primitive* @this = &this) + { + var pointer = &@this->_i128[0]; + var span = new Span(pointer, 16); + value.CopyTo(span); + } + } + } + + [FieldOffset(8)] // size = 1 + public byte u8; + + [FieldOffset(8)] // size = 2 + public ushort u16; + + [FieldOffset(8)] // size = 4 + public uint u32; + + [FieldOffset(8)] // size = 8 + public ulong u64; + + [FieldOffset(8)] // size = 16 + public fixed byte _u128[16]; // uint8_t[16] + + public Span u128 + { + get + { + fixed (Primitive* @this = &this) + { + var pointer = &@this->_u128[0]; + var span = new Span(pointer, 16); + return span; + } + } + + set + { + fixed (Primitive* @this = &this) + { + var pointer = &@this->_u128[0]; + var span = new Span(pointer, 16); + value.CopyTo(span); + } + } + } + + [FieldOffset(8)] // size = 32 + public fixed byte _u256[32]; // uint64_t[4] + + public Span u256 + { + get + { + fixed (Primitive* @this = &this) + { + var pointer = &@this->_u256[0]; + var span = new Span(pointer, 4); + return span; + } + } + + set + { + fixed (Primitive* @this = &this) + { + var pointer = &@this->_u256[0]; + var span = new Span(pointer, 4); + value.CopyTo(span); + } + } + } + + [FieldOffset(8)] // size = 4 + public uint u_size; + + [FieldOffset(8)] // size = 1 + public CBool bool_; + + [FieldOffset(8)] // size = 32 + public FieldElement felt252; + + [FieldOffset(8)] // size = 32 + public FieldElement class_hash; + + [FieldOffset(8)] // size = 32 + public FieldElement contract_address; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] + public struct Primitive_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 1 + public sbyte i8; + + [FieldOffset(0)] // size = 2 + public short i16; + + [FieldOffset(0)] // size = 4 + public int i32; + + [FieldOffset(0)] // size = 8 + public long i64; + + [FieldOffset(0)] // size = 16 + public fixed byte _i128[16]; // uint8_t[16] + + public Span i128 + { + get + { + fixed (Primitive_ANONYMOUS_FIELD1* @this = &this) + { + var pointer = &@this->_i128[0]; + var span = new Span(pointer, 16); + return span; + } + } + + set + { + fixed (Primitive_ANONYMOUS_FIELD1* @this = &this) + { + var pointer = &@this->_i128[0]; + var span = new Span(pointer, 16); + value.CopyTo(span); + } + } + } + + [FieldOffset(0)] // size = 1 + public byte u8; + + [FieldOffset(0)] // size = 2 + public ushort u16; + + [FieldOffset(0)] // size = 4 + public uint u32; + + [FieldOffset(0)] // size = 8 + public ulong u64; + + [FieldOffset(0)] // size = 16 + public fixed byte _u128[16]; // uint8_t[16] + + public Span u128 + { + get + { + fixed (Primitive_ANONYMOUS_FIELD1* @this = &this) + { + var pointer = &@this->_u128[0]; + var span = new Span(pointer, 16); + return span; + } + } + + set + { + fixed (Primitive_ANONYMOUS_FIELD1* @this = &this) + { + var pointer = &@this->_u128[0]; + var span = new Span(pointer, 16); + value.CopyTo(span); + } + } + } + + [FieldOffset(0)] // size = 32 + public fixed byte _u256[32]; // uint64_t[4] + + public Span u256 + { + get + { + fixed (Primitive_ANONYMOUS_FIELD1* @this = &this) + { + var pointer = &@this->_u256[0]; + var span = new Span(pointer, 4); + return span; + } + } + + set + { + fixed (Primitive_ANONYMOUS_FIELD1* @this = &this) + { + var pointer = &@this->_u256[0]; + var span = new Span(pointer, 4); + value.CopyTo(span); + } + } + } + + [FieldOffset(0)] // size = 4 + public uint u_size; + + [FieldOffset(0)] // size = 1 + public CBool bool_; + + [FieldOffset(0)] // size = 32 + public FieldElement felt252; + + [FieldOffset(0)] // size = 32 + public FieldElement class_hash; + + [FieldOffset(0)] // size = 32 + public FieldElement contract_address; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 1, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 1 + public sbyte i8; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 2, Pack = 2)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 2 + public short i16; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD10 + { + [FieldOffset(0)] // size = 32 + public fixed byte _u256[32]; // uint64_t[4] + + public Span u256 + { + get + { + fixed (Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD10* @this = &this) + { + var pointer = &@this->_u256[0]; + var span = new Span(pointer, 4); + return span; + } + } + + set + { + fixed (Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD10* @this = &this) + { + var pointer = &@this->_u256[0]; + var span = new Span(pointer, 4); + value.CopyTo(span); + } + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 4, Pack = 4)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD11 + { + [FieldOffset(0)] // size = 4 + public uint u_size; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 1, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD12 + { + [FieldOffset(0)] // size = 1 + public CBool bool_; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD13 + { + [FieldOffset(0)] // size = 32 + public FieldElement felt252; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD14 + { + [FieldOffset(0)] // size = 32 + public FieldElement class_hash; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD15 + { + [FieldOffset(0)] // size = 32 + public FieldElement contract_address; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 4, Pack = 4)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2 + { + [FieldOffset(0)] // size = 4 + public int i32; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD3 + { + [FieldOffset(0)] // size = 8 + public long i64; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD4 + { + [FieldOffset(0)] // size = 16 + public fixed byte _i128[16]; // uint8_t[16] + + public Span i128 + { + get + { + fixed (Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD4* @this = &this) + { + var pointer = &@this->_i128[0]; + var span = new Span(pointer, 16); + return span; + } + } + + set + { + fixed (Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD4* @this = &this) + { + var pointer = &@this->_i128[0]; + var span = new Span(pointer, 16); + value.CopyTo(span); + } + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 1, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD5 + { + [FieldOffset(0)] // size = 1 + public byte u8; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 2, Pack = 2)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD6 + { + [FieldOffset(0)] // size = 2 + public ushort u16; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 4, Pack = 4)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD7 + { + [FieldOffset(0)] // size = 4 + public uint u32; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD8 + { + [FieldOffset(0)] // size = 8 + public ulong u64; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 1)] + public struct Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD9 + { + [FieldOffset(0)] // size = 16 + public fixed byte _u128[16]; // uint8_t[16] + + public Span u128 + { + get + { + fixed (Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD9* @this = &this) + { + var pointer = &@this->_u128[0]; + var span = new Span(pointer, 16); + return span; + } + } + + set + { + fixed (Primitive_ANONYMOUS_FIELD1_ANONYMOUS_FIELD9* @this = &this) + { + var pointer = &@this->_u128[0]; + var span = new Span(pointer, 16); + value.CopyTo(span); + } + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 104, Pack = 8)] + public struct Query + { + [FieldOffset(0)] // size = 4 + public uint limit; + + [FieldOffset(4)] // size = 4 + public uint offset; + + [FieldOffset(8)] // size = 88 + public COptionClause clause; + + [FieldOffset(96)] // size = 1 + public CBool dont_include_hashed_keys; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultAccount + { + [FieldOffset(0)] // size = 4 + public ResultAccount_Tag tag; + + [FieldOffset(8)] // size = 8 + public Account* _ok; + + public Account ok + { + get + { + return *_ok; + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultAccount_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Account* _ok; + + public Account ok + { + get + { + return *_ok; + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultAccount_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 8 + public Account* _ok; + + public Account ok + { + get + { + return *_ok; + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultAccount_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct ResultCArrayEntity + { + [FieldOffset(0)] // size = 4 + public ResultCArrayEntity_Tag tag; + + [FieldOffset(8)] // size = 16 + public CArrayEntity _ok; + + public Span ok + { + get + { + fixed (ResultCArrayEntity* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayEntity(); + _ok.data_len = (UIntPtr)value.Length; + fixed (Entity* ptr = value) + { + _ok.data = ptr; + } + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultCArrayEntity_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 16 + public CArrayEntity _ok; + + public Span ok + { + get + { + fixed (ResultCArrayEntity_ANONYMOUS_FIELD1* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayEntity(); + _ok.data_len = (UIntPtr)value.Length; + fixed (Entity* ptr = value) + { + _ok.data = ptr; + } + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultCArrayEntity_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 16 + public CArrayEntity _ok; + + public Span ok + { + get + { + fixed (ResultCArrayEntity_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayEntity(); + _ok.data_len = (UIntPtr)value.Length; + fixed (Entity* ptr = value) + { + _ok.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultCArrayEntity_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct ResultCArrayFieldElement + { + [FieldOffset(0)] // size = 4 + public ResultCArrayFieldElement_Tag tag; + + [FieldOffset(8)] // size = 16 + public CArrayFieldElement _ok; + + public Span ok + { + get + { + fixed (ResultCArrayFieldElement* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayFieldElement(); + _ok.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _ok.data = ptr; + } + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultCArrayFieldElement_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 16 + public CArrayFieldElement _ok; + + public Span ok + { + get + { + fixed (ResultCArrayFieldElement_ANONYMOUS_FIELD1* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayFieldElement(); + _ok.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _ok.data = ptr; + } + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultCArrayFieldElement_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 16 + public CArrayFieldElement _ok; + + public Span ok + { + get + { + fixed (ResultCArrayFieldElement_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayFieldElement(); + _ok.data_len = (UIntPtr)value.Length; + fixed (FieldElement* ptr = value) + { + _ok.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultCArrayFieldElement_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct ResultCArrayu8 + { + [FieldOffset(0)] // size = 4 + public ResultCArrayu8_Tag tag; + + [FieldOffset(8)] // size = 16 + public CArrayu8 _ok; + + public Span ok + { + get + { + fixed (ResultCArrayu8* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayu8(); + _ok.data_len = (UIntPtr)value.Length; + fixed (byte* ptr = value) + { + _ok.data = ptr; + } + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultCArrayu8_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 16 + public CArrayu8 _ok; + + public Span ok + { + get + { + fixed (ResultCArrayu8_ANONYMOUS_FIELD1* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayu8(); + _ok.data_len = (UIntPtr)value.Length; + fixed (byte* ptr = value) + { + _ok.data = ptr; + } + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultCArrayu8_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 16 + public CArrayu8 _ok; + + public Span ok + { + get + { + fixed (ResultCArrayu8_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0* @this = &this) + { + var span = new Span(@this->_ok.data, (int)@this->_ok.data_len); + return span; + } + } + + set + { + + _ok = new CArrayu8(); + _ok.data_len = (UIntPtr)value.Length; + fixed (byte* ptr = value) + { + _ok.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultCArrayu8_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct ResultFieldElement + { + [FieldOffset(0)] // size = 4 + public ResultFieldElement_Tag tag; + + [FieldOffset(8)] // size = 32 + public FieldElement ok; + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] + public struct ResultFieldElement_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 32 + public FieldElement ok; + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 1)] + public struct ResultFieldElement_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 32 + public FieldElement ok; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultFieldElement_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultProvider + { + [FieldOffset(0)] // size = 4 + public ResultProvider_Tag tag; + + [FieldOffset(8)] // size = 8 + public Provider* _ok; + + public Provider ok + { + get + { + return *_ok; + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultProvider_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Provider* _ok; + + public Provider ok + { + get + { + return *_ok; + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultProvider_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 8 + public Provider* _ok; + + public Provider ok + { + get + { + return *_ok; + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultProvider_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 72, Pack = 8)] + public struct ResultSignature + { + [FieldOffset(0)] // size = 4 + public ResultSignature_Tag tag; + + [FieldOffset(8)] // size = 64 + public Signature ok; + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 64, Pack = 8)] + public struct ResultSignature_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 64 + public Signature ok; + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 64, Pack = 1)] + public struct ResultSignature_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 64 + public Signature ok; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultSignature_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultSubscription + { + [FieldOffset(0)] // size = 4 + public ResultSubscription_Tag tag; + + [FieldOffset(8)] // size = 8 + public Subscription* _ok; + + public Subscription ok + { + get + { + return *_ok; + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultSubscription_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Subscription* _ok; + + public Subscription ok + { + get + { + return *_ok; + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultSubscription_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 8 + public Subscription* _ok; + + public Subscription ok + { + get + { + return *_ok; + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultSubscription_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct ResultToriiClient + { + [FieldOffset(0)] // size = 4 + public ResultToriiClient_Tag tag; + + [FieldOffset(8)] // size = 8 + public ToriiClient* _ok; + + public ToriiClient ok + { + get + { + return *_ok; + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultToriiClient_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public ToriiClient* _ok; + + public ToriiClient ok + { + get + { + return *_ok; + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultToriiClient_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 8 + public ToriiClient* _ok; + + public ToriiClient ok + { + get + { + return *_ok; + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct ResultToriiClient_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct Resultbool + { + [FieldOffset(0)] // size = 4 + public Resultbool_Tag tag; + + [FieldOffset(8)] // size = 1 + public CBool ok; + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Resultbool_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 1 + public CBool ok; + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 1, Pack = 1)] + public struct Resultbool_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 1 + public CBool ok; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Resultbool_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct Resultc_char + { + [FieldOffset(0)] // size = 4 + public Resultc_char_Tag tag; + + [FieldOffset(8)] // size = 8 + public CString ok_; + + public string ok + { + get + { + return CString.ToString(ok_); + } + set + { + ok_ = CString.FromString(value); + } + } + + [FieldOffset(8)] // size = 8 + public Error err; + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Resultc_char_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public CString ok_; + + public string ok + { + get + { + return CString.ToString(ok_); + } + set + { + ok_ = CString.FromString(value); + } + } + + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Resultc_char_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 8 + public CString ok_; + + public string ok + { + get + { + return CString.ToString(ok_); + } + set + { + ok_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Resultc_char_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 8 + public Error err; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 64, Pack = 1)] + public struct Signature + { + [FieldOffset(0)] // size = 32 + public FieldElement r; + + [FieldOffset(32)] // size = 32 + public FieldElement s; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] + public struct Struct + { + [FieldOffset(0)] // size = 8 + public CString name_; + + public string name + { + get + { + return CString.ToString(name_); + } + set + { + name_ = CString.FromString(value); + } + } + + [FieldOffset(8)] // size = 16 + public CArrayMember _children; + + public Span children + { + get + { + fixed (Struct* @this = &this) + { + var span = new Span(@this->_children.data, (int)@this->_children.data_len); + return span; + } + } + + set + { + + _children = new CArrayMember(); + _children.data_len = (UIntPtr)value.Length; + fixed (Member* ptr = value) + { + _children.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 48, Pack = 8)] + public struct Ty + { + [FieldOffset(0)] // size = 4 + public Ty_Tag tag; + + [FieldOffset(8)] + public Struct struct_; + + [FieldOffset(8)] // size = 40 + public Primitive primitive; + + [FieldOffset(8)] // size = 32 + public Enum enum_; + + [FieldOffset(8)] // size = 16 + public CArrayTy _tuple; + + public Span tuple + { + get + { + fixed (Ty* @this = &this) + { + var span = new Span(@this->_tuple.data, (int)@this->_tuple.data_len); + return span; + } + } + + set + { + + _tuple = new CArrayTy(); + _tuple.data_len = (UIntPtr)value.Length; + fixed (Ty* ptr = value) + { + _tuple.data = ptr; + } + } + } + + [FieldOffset(8)] // size = 16 + public CArrayTy _array; + + public Span array + { + get + { + fixed (Ty* @this = &this) + { + var span = new Span(@this->_array.data, (int)@this->_array.data_len); + return span; + } + } + + set + { + + _array = new CArrayTy(); + _array.data_len = (UIntPtr)value.Length; + fixed (Ty* ptr = value) + { + _array.data = ptr; + } + } + } + + [FieldOffset(8)] // size = 8 + public CString byte_array_; + + public string byte_array + { + get + { + return CString.ToString(byte_array_); + } + set + { + byte_array_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Union")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct Ty_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 40 + public Primitive primitive; + + [FieldOffset(0)] // size = 32 + public Enum enum_; + + [FieldOffset(0)] // size = 16 + public CArrayTy _tuple; + + public Span tuple + { + get + { + fixed (Ty_ANONYMOUS_FIELD1* @this = &this) + { + var span = new Span(@this->_tuple.data, (int)@this->_tuple.data_len); + return span; + } + } + + set + { + + _tuple = new CArrayTy(); + _tuple.data_len = (UIntPtr)value.Length; + fixed (Ty* ptr = value) + { + _tuple.data = ptr; + } + } + } + + [FieldOffset(0)] // size = 16 + public CArrayTy _array; + + public Span array + { + get + { + fixed (Ty_ANONYMOUS_FIELD1* @this = &this) + { + var span = new Span(@this->_array.data, (int)@this->_array.data_len); + return span; + } + } + + set + { + + _array = new CArrayTy(); + _array.data_len = (UIntPtr)value.Length; + fixed (Ty* ptr = value) + { + _array.data = ptr; + } + } + } + + [FieldOffset(0)] // size = 8 + public CString byte_array_; + + public string byte_array + { + get + { + return CString.ToString(byte_array_); + } + set + { + byte_array_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)] + public struct Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD0 + { + [FieldOffset(0)] // size = 40 + public Primitive primitive; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] + public struct Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD1 + { + [FieldOffset(0)] // size = 32 + public Enum enum_; + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2 + { + [FieldOffset(0)] // size = 16 + public CArrayTy _tuple; + + public Span tuple + { + get + { + fixed (Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2* @this = &this) + { + var span = new Span(@this->_tuple.data, (int)@this->_tuple.data_len); + return span; + } + } + + set + { + + _tuple = new CArrayTy(); + _tuple.data_len = (UIntPtr)value.Length; + fixed (Ty* ptr = value) + { + _tuple.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] + public struct Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD3 + { + [FieldOffset(0)] // size = 16 + public CArrayTy _array; + + public Span array + { + get + { + fixed (Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD3* @this = &this) + { + var span = new Span(@this->_array.data, (int)@this->_array.data_len); + return span; + } + } + + set + { + + _array = new CArrayTy(); + _array.data_len = (UIntPtr)value.Length; + fixed (Ty* ptr = value) + { + _array.data = ptr; + } + } + } + + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 8)] + public struct Ty_ANONYMOUS_FIELD1_ANONYMOUS_FIELD4 + { + [FieldOffset(0)] // size = 8 + public CString byte_array_; + + public string byte_array + { + get + { + return CString.ToString(byte_array_); + } + set + { + byte_array_ = CString.FromString(value); + } + } + } + + [CNode(Kind = "Struct")] + [StructLayout(LayoutKind.Explicit, Size = 48, Pack = 8)] + public struct WorldMetadata + { + [FieldOffset(0)] // size = 32 + public FieldElement world_address; + + [FieldOffset(32)] // size = 16 + public CArrayCHashItemFieldElementModelMetadata _models; + + public Span models + { + get + { + fixed (WorldMetadata* @this = &this) + { + var span = new Span(@this->_models.data, (int)@this->_models.data_len); + return span; + } + } + + set + { + + _models = new CArrayCHashItemFieldElementModelMetadata(); + _models.data_len = (UIntPtr)value.Length; + fixed (CHashItemFieldElementModelMetadata* ptr = value) + { + _models.data = ptr; + } + } + } + + } + + [CNode(Kind = "Enum")] + public enum BlockId_Tag : int + { + Hash = 0, + Number = 1, + BlockTag_ = 2 + } + + [CNode(Kind = "Enum")] + public enum BlockTag : int + { + Latest = 0, + Pending = 1 + } + + [CNode(Kind = "Enum")] + public enum COptionClause_Tag : int + { + SomeClause = 0, + NoneClause = 1 + } + + [CNode(Kind = "Enum")] + public enum COptionFieldElement_Tag : int + { + SomeFieldElement = 0, + NoneFieldElement = 1 + } + + [CNode(Kind = "Enum")] + public enum Clause_Tag : int + { + Keys = 0, + CMember = 1, + Composite = 2 + } + + [CNode(Kind = "Enum")] + public enum ComparisonOperator : int + { + Eq = 0, + Neq = 1, + Gt = 2, + Gte = 3, + Lt = 4, + Lte = 5 + } + + [CNode(Kind = "Enum")] + public enum EntityKeysClause_Tag : int + { + HashedKeys = 0, + EntityKeys = 1 + } + + [CNode(Kind = "Enum")] + public enum LogicalOperator : int + { + And = 0, + Or = 1 + } + + [CNode(Kind = "Enum")] + public enum MemberValue_Tag : int + { + String = 0, + Primitive = 1 + } + + [CNode(Kind = "Enum")] + public enum PatternMatching : int + { + FixedLen = 0, + VariableLen = 1 + } + + [CNode(Kind = "Enum")] + public enum Primitive_Tag : int + { + I8 = 0, + I16 = 1, + I32 = 2, + I64 = 3, + I128 = 4, + U8 = 5, + U16 = 6, + U32 = 7, + U64 = 8, + U128 = 9, + U256 = 10, + USize = 11, + Bool = 12, + Felt252 = 13, + ClassHash = 14, + ContractAddress = 15 + } + + [CNode(Kind = "Enum")] + public enum ResultAccount_Tag : int + { + OkAccount = 0, + ErrAccount = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultCArrayEntity_Tag : int + { + OkCArrayEntity = 0, + ErrCArrayEntity = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultCArrayFieldElement_Tag : int + { + OkCArrayFieldElement = 0, + ErrCArrayFieldElement = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultCArrayu8_Tag : int + { + OkCArrayu8 = 0, + ErrCArrayu8 = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultFieldElement_Tag : int + { + OkFieldElement = 0, + ErrFieldElement = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultProvider_Tag : int + { + OkProvider = 0, + ErrProvider = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultSignature_Tag : int + { + OkSignature = 0, + ErrSignature = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultSubscription_Tag : int + { + OkSubscription = 0, + ErrSubscription = 1 + } + + [CNode(Kind = "Enum")] + public enum ResultToriiClient_Tag : int + { + OkToriiClient = 0, + ErrToriiClient = 1 + } + + [CNode(Kind = "Enum")] + public enum Resultbool_Tag : int + { + Okbool = 0, + Errbool = 1 + } + + [CNode(Kind = "Enum")] + public enum Resultc_char_Tag : int + { + Okc_char = 0, + Errc_char = 1 + } + + [CNode(Kind = "Enum")] + public enum Ty_Tag : int + { + Primitive_ = 0, + Struct_ = 1, + Enum_ = 2, + Tuple_ = 3, + Array_ = 4, + ByteArray = 5 + } + + [CNode(Kind = "OpaqueType")] + [StructLayout(LayoutKind.Sequential)] + public struct Account + { + } + + [CNode(Kind = "OpaqueType")] + [StructLayout(LayoutKind.Sequential)] + public struct Provider + { + } + + [CNode(Kind = "OpaqueType")] + [StructLayout(LayoutKind.Sequential)] + public struct Subscription + { + } + + [CNode(Kind = "OpaqueType")] + [StructLayout(LayoutKind.Sequential)] + public struct ToriiClient + { + } + + #endregion + } + +} diff --git a/Assets/Dojo/Runtime/bindings/client/dojo.gen.cs.meta b/Assets/Dojo/Runtime/bindings/client/dojo.gen.cs.meta new file mode 100644 index 00000000..e54a24b7 --- /dev/null +++ b/Assets/Dojo/Runtime/bindings/client/dojo.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45de9f924acb84ff2a96d02c261538e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Tests.meta b/Assets/Dojo/Tests.meta new file mode 100644 index 00000000..fa53f2c7 --- /dev/null +++ b/Assets/Dojo/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c0a2c1428dbf4814b4cf269abc35661 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Tests/Runtime.meta b/Assets/Dojo/Tests/Runtime.meta new file mode 100644 index 00000000..6453b3cc --- /dev/null +++ b/Assets/Dojo/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f23454e95b9b44809807856d112b37c2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Tests/Runtime/DojoRuntimeTests.asmdef b/Assets/Dojo/Tests/Runtime/DojoRuntimeTests.asmdef new file mode 100644 index 00000000..5053db7e --- /dev/null +++ b/Assets/Dojo/Tests/Runtime/DojoRuntimeTests.asmdef @@ -0,0 +1,22 @@ +{ + "name": "DojoRuntimeTests", + "rootNamespace": "", + "references": [ + "GUID:1cfdd07e9f0f54188b58166d8196b85c", + "GUID:27619889b8ba8c24980f49ee34dbb44a", + "GUID:0acc523941302664db1f4e527237feb3" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": true, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Dojo/Tests/Runtime/DojoRuntimeTests.asmdef.meta b/Assets/Dojo/Tests/Runtime/DojoRuntimeTests.asmdef.meta new file mode 100644 index 00000000..da4ea7ad --- /dev/null +++ b/Assets/Dojo/Tests/Runtime/DojoRuntimeTests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 32e5d5389fb954cc29019acbcb8f738f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Dojo/Tests/Runtime/DojoTests.cs b/Assets/Dojo/Tests/Runtime/DojoTests.cs new file mode 100644 index 00000000..b2055969 --- /dev/null +++ b/Assets/Dojo/Tests/Runtime/DojoTests.cs @@ -0,0 +1,223 @@ +using System; +using System.Linq; +using bottlenoselabs.C2CS.Runtime; +using dojo_bindings; +using NUnit.Framework; +using Dojo.Torii; +using Dojo.Starknet; +using UnityEditor.VersionControl; +using System.Diagnostics; +using UnityEngine; +using Debug = UnityEngine.Debug; +using UnityEngine.SceneManagement; +using UnityEngine.UIElements; + +public class Tests +{ + private readonly string toriiUrl = "http://0.0.0.0:8080"; + private readonly string rpcUrl = "http://0.0.0.0:5050"; + private readonly string relayUrl = "/ip4/127.0.0.1/tcp/9090"; + // private readonly string playerKey = "0x028cd7ee02d7f6ec9810e75b930e8e607793b302445abbdee0ac88143f18da20"; + private readonly FieldElement playerAddress = new FieldElement("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03"); + private readonly FieldElement worldAddress = new FieldElement("0x07efebb0c2d4cc285d48a97a7174def3be7fdd6b7bd29cca758fa2e17e03ef30"); + private readonly FieldElement actionsAddress = new FieldElement("0x5c70a663d6b48d8e4c6aaa9572e3735a732ac3765700d470463e670587852af"); + + private ToriiClient client; + private JsonRpcClient provider; + private Account account; + + // our callbacks will mutate these variables + // we can use this to check that the callback was called + // when our account spawns + private bool modelEntityUpdated = false; + private bool entityUpdated = false; + private bool eventMessageUpdated = false; + + [SetUp] + public void SetupTorii() + { + client = new ToriiClient(toriiUrl, rpcUrl, relayUrl, worldAddress, false); + + if (client == null) throw new Exception("client is null"); + } + + [SetUp] + public void SetupAccount() + { + provider = new JsonRpcClient(rpcUrl); + + var signer = new SigningKey("0x1800000000300000180000000000030000000000003006001800006600"); + + account = new Account(provider, signer, playerAddress); + } + + [Test] + public void TestAccountAddress() + { + var address = account.Address; + + Assert.That(address, Is.EqualTo(playerAddress)); + } + + // [Test] + // public void TestAccountChainId() + // { + // // var chainId = account.ChainId(); + + // // check chainid? + // } + + // [Test] + // public void TestAccountSetBlockId() + // { + // var blockId = new dojo.BlockId + // { + // tag = dojo.BlockId_Tag.BlockTag_, + // block_tag = dojo.BlockTag.Pending + // }; + + // account.SetBlockId(blockId); + // } + + [Test, Order(3)] + public async void TestAccountExecuteRaw() + { + dojo.Call call = new dojo.Call() + { + to = actionsAddress.Inner, + selector = "spawn" + }; + + var txnHash = await account.ExecuteRaw(new[] { call }); + + await provider.WaitForTransaction(txnHash); + + // We wait until our callback is called to mark our + var start = DateTime.Now; + // entity as updated. We timeout after 5 seconds. + while (!(entityUpdated && modelEntityUpdated) && DateTime.Now - start < TimeSpan.FromSeconds(5)) + { + } + + + if (entityUpdated != modelEntityUpdated) + { + Debug.LogWarning("Entity update status mismatch. One of the callbacks was not called."); + Debug.LogWarning($"entityUpdated ({entityUpdated}) != modelEntityUpdated ({modelEntityUpdated})"); + } + Assert.That(entityUpdated || modelEntityUpdated, Is.True); + + // Move to check for event message update + call = new dojo.Call() + { + to = actionsAddress.Inner, + selector = "move", + calldata = new dojo.FieldElement[] { new FieldElement(0).Inner } + }; + + txnHash = await account.ExecuteRaw(new[] { call }); + + await provider.WaitForTransaction(txnHash); + + // We wait until our callback is called to mark our + // entity as updated. We timeout after 5 seconds. + start = DateTime.Now; + // entity as updated. We timeout after 5 seconds. + while (!eventMessageUpdated && DateTime.Now - start < TimeSpan.FromSeconds(5)) + { + } + + Assert.That(eventMessageUpdated, Is.True); + } + + [Test] + public void TestWorldMetadata() + { + var worldMetadata = client.WorldMetadata(); + + // models should correspond to Moves and Position + var movesExists = false; + var positionExists = false; + foreach (var cHashItemCCharModelMetadata in worldMetadata.models) + { + var modelMetadata = cHashItemCCharModelMetadata.value; + switch (modelMetadata.name) + { + case "": + + case "Moves": + movesExists = true; + + Assert.That(modelMetadata.schema.tag, Is.EqualTo(dojo.Ty_Tag.Struct_)); + Assert.That(modelMetadata.schema.struct_.children[0].name, Is.EqualTo("player")); + Assert.That(modelMetadata.schema.struct_.children[1].name, Is.EqualTo("remaining")); + Assert.That(modelMetadata.schema.struct_.children[2].name, Is.EqualTo("last_direction")); + + // maybe worth verifying the field types? + + break; + case "Position": + positionExists = true; + + Assert.That(modelMetadata.schema.tag, Is.EqualTo(dojo.Ty_Tag.Struct_)); + Assert.That(modelMetadata.schema.struct_.children[0].name, Is.EqualTo("player")); + Assert.That(modelMetadata.schema.struct_.children[1].name, Is.EqualTo("vec")); + + // maybe worth verifying the field types? + + break; + } + } + + Assert.That(worldMetadata.world_address, Is.EqualTo(worldAddress.Inner)); + Assert.That(movesExists, Is.True); + Assert.That(positionExists, Is.True); + } + + [Test, Order(1)] + public void TestEntities() + { + var query = new Query(5, 0); + + var entities = client.Entities(query); + Assert.That(entities.Count, Is.GreaterThanOrEqualTo(1)); + } + + // Deprecated? + // [Test] + // public void TestModel() + // { + // var query = new dojo.KeysClause + // { + // model = "Moves", + // keys = new[] { playerKey } + // }; + + // var model = client.Model(query); + + // Assert.That(model.struct_.name, Is.EqualTo("Moves")); + // Assert.That(model.struct_.children[0].name, Is.EqualTo("player")); + // } + + [Test, Order(2)] + public void TestOnEntityStateUpdate() + { + ToriiEvents.OnEntityStateUpdateDelegate callback = (key, models) => + { + if (models.Length == 0) return; + entityUpdated = models[0].Members["player"] == playerAddress; + }; + ToriiEvents.Instance.OnEntityUpdated += callback; + } + + [Test, Order(2)] + public void TestOnEventMessageUpdate() + { + ToriiEvents.OnEventMessageUpdateDelegate callback = (key, models) => + { + if (models.Length == 0) return; + eventMessageUpdated = models[0].Members["player"] == playerAddress; + }; + ToriiEvents.Instance.OnEventMessageUpdated += callback; + } +} \ No newline at end of file diff --git a/Assets/Dojo/Tests/Runtime/DojoTests.cs.meta b/Assets/Dojo/Tests/Runtime/DojoTests.cs.meta new file mode 100644 index 00000000..7888e62e --- /dev/null +++ b/Assets/Dojo/Tests/Runtime/DojoTests.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7d3c3d153da442a7a7144ee6ce27b941 +timeCreated: 1701893385 \ No newline at end of file diff --git a/Assets/Scenes/Forest.unity b/Assets/Scenes/Forest.unity index f30b43e1..328b13a4 100644 --- a/Assets/Scenes/Forest.unity +++ b/Assets/Scenes/Forest.unity @@ -76709,6 +76709,103 @@ Transform: type: 3} m_PrefabInstance: {fileID: 959617412} m_PrefabAsset: {fileID: 0} +--- !u!1001 &963724778 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 184210, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_Name + value: UnityMainThreadDispatcher + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchoredPosition.x + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchoredPosition.y + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} --- !u!1001 &966790546 PrefabInstance: m_ObjectHideFlags: 0 @@ -83105,6 +83202,11 @@ PrefabInstance: value: objectReference: {fileID: 11400000, guid: b345018373c2141dda9d01eb80d61222, type: 2} + - target: {fileID: 114833591496082952, guid: f8a1d1084ca0ab244baa90accde134b6, + type: 3} + propertyPath: dojoSpawnAndMoveExecuter + value: + objectReference: {fileID: 1140016769} - target: {fileID: 212754941309248394, guid: f8a1d1084ca0ab244baa90accde134b6, type: 3} propertyPath: m_SortingOrder @@ -92570,6 +92672,205 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1138161981} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1140016764 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: relayUrl + value: /ip4/127.0.0.1/tcp/9090 + objectReference: {fileID: 0} + - target: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: worldAddress + value: 0x28f5999ae62fec17c09c52a800e244961dba05251f5aaf923afabd9c9804d1a + objectReference: {fileID: 0} + - target: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: relayWebrtcUrl + value: /ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/uEiCAoeHQh49fCHDolECesXO0CPR7fpz0sv0PWVaIahzT4g + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: models.Array.size + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: models.Array.data[0] + value: + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: models.Array.data[1] + value: + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEventMessage.m_PersistentCalls.m_Calls.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 11500000, guid: 043ae0b8f2d5246499b92dea35147ab6, + type: 3} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEventMessage.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_Name + value: WorldManager + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + insertIndex: -1 + addedObject: {fileID: 1140016767} + - targetCorrespondingSourceObject: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + insertIndex: -1 + addedObject: {fileID: 1140016769} + m_SourcePrefab: {fileID: 100100000, guid: d2e25933f4d69473a8994ee7470b2610, type: 3} +--- !u!1 &1140016765 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + m_PrefabInstance: {fileID: 1140016764} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1140016766 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + m_PrefabInstance: {fileID: 1140016764} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140016765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 85bbcaeafdf5e41c6a2f48ff65820b7d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1140016767 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140016765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c4fd9ad215c314bb1944a6d6b467f464, type: 3} + m_Name: + m_EditorClassIdentifier: + contractAddress: 0x058b83bea84766c5725c12e239c1ec9e1fde679ddf709b772fe7a8fdfd3cda27 +--- !u!114 &1140016769 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140016765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c4903969972cd43ea95e8c1fc824e0bb, type: 3} + m_Name: + m_EditorClassIdentifier: + worldManager: {fileID: 1140016766} + dojoConfig: {fileID: 11400000, guid: 1d6a5fa48aab79f0084b213f6fc768c5, type: 2} + gameManagerData: {fileID: 11400000, guid: 22f53d4a93d2d44199b824f3780fe0ad, type: 2} + actions: {fileID: 1140016767} --- !u!1 &1145074930 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6358416819729956247, guid: d5abc895c284ea44aaf79bc56af78601, @@ -125702,7 +126003,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -4, y: -24, z: 0} @@ -125807,7 +126108,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -9, y: -23, z: 0} @@ -125822,7 +126123,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -8, y: -23, z: 0} @@ -126047,7 +126348,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -7, y: -22, z: 0} @@ -126467,7 +126768,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -13, y: -19, z: 0} @@ -126602,7 +126903,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -15, y: -18, z: 0} @@ -126767,7 +127068,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -17, y: -17, z: 0} @@ -126887,7 +127188,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -23, y: -16, z: 0} @@ -126962,7 +127263,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -18, y: -16, z: 0} @@ -127052,7 +127353,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -12, y: -16, z: 0} @@ -127097,7 +127398,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -24, y: -15, z: 0} @@ -127247,7 +127548,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -14, y: -15, z: 0} @@ -127277,7 +127578,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -12, y: -15, z: 0} @@ -127292,7 +127593,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -11, y: -15, z: 0} @@ -127457,7 +127758,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -16, y: -14, z: 0} @@ -127502,7 +127803,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -13, y: -14, z: 0} @@ -127577,7 +127878,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -26, y: -13, z: 0} @@ -127742,7 +128043,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -15, y: -13, z: 0} @@ -127757,7 +128058,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -14, y: -13, z: 0} @@ -127772,7 +128073,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -13, y: -13, z: 0} @@ -127832,7 +128133,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -27, y: -12, z: 0} @@ -127922,7 +128223,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -21, y: -12, z: 0} @@ -128042,7 +128343,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -13, y: -12, z: 0} @@ -128162,7 +128463,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -24, y: -11, z: 0} @@ -128372,7 +128673,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -29, y: -10, z: 0} @@ -128402,7 +128703,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -27, y: -10, z: 0} @@ -128432,7 +128733,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -25, y: -10, z: 0} @@ -128462,7 +128763,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -23, y: -10, z: 0} @@ -128552,7 +128853,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -17, y: -10, z: 0} @@ -128687,7 +128988,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -28, y: -9, z: 0} @@ -128747,7 +129048,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -24, y: -9, z: 0} @@ -128987,7 +129288,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -28, y: -8, z: 0} @@ -129212,7 +129513,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -32, y: -7, z: 0} @@ -129257,7 +129558,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -29, y: -7, z: 0} @@ -129452,7 +129753,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -50, y: -6, z: 0} @@ -129602,7 +129903,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -36, y: -6, z: 0} @@ -129677,7 +129978,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -31, y: -6, z: 0} @@ -129857,7 +130158,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -19, y: -6, z: 0} @@ -129977,7 +130278,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -40, y: -5, z: 0} @@ -130037,7 +130338,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -36, y: -5, z: 0} @@ -130052,7 +130353,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -35, y: -5, z: 0} @@ -130202,7 +130503,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -25, y: -5, z: 0} @@ -130277,7 +130578,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -49, y: -4, z: 0} @@ -130397,7 +130698,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -37, y: -4, z: 0} @@ -130427,7 +130728,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -35, y: -4, z: 0} @@ -130622,7 +130923,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -22, y: -4, z: 0} @@ -130757,7 +131058,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -38, y: -3, z: 0} @@ -130787,7 +131088,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -36, y: -3, z: 0} @@ -130862,7 +131163,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -31, y: -3, z: 0} @@ -130877,7 +131178,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -30, y: -3, z: 0} @@ -130997,7 +131298,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -22, y: -3, z: 0} @@ -131027,7 +131328,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -49, y: -2, z: 0} @@ -131222,7 +131523,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -32, y: -2, z: 0} @@ -131462,7 +131763,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -42, y: -1, z: 0} @@ -131852,7 +132153,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -28, y: 0, z: 0} @@ -131882,7 +132183,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -26, y: 0, z: 0} @@ -131912,7 +132213,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -24, y: 0, z: 0} @@ -131957,7 +132258,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -21, y: 0, z: 0} @@ -132017,7 +132318,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -28, y: 1, z: 0} @@ -132242,7 +132543,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -25, y: 2, z: 0} @@ -132347,7 +132648,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -30, y: 3, z: 0} @@ -132422,7 +132723,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -25, y: 3, z: 0} @@ -132617,7 +132918,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -23, y: 4, z: 0} @@ -132662,7 +132963,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -20, y: 4, z: 0} @@ -132737,7 +133038,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -26, y: 5, z: 0} @@ -132902,7 +133203,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -26, y: 6, z: 0} @@ -133007,7 +133308,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -19, y: 6, z: 0} @@ -133097,7 +133398,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -24, y: 7, z: 0} @@ -133142,7 +133443,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -21, y: 7, z: 0} @@ -133217,7 +133518,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -28, y: 8, z: 0} @@ -133232,7 +133533,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -27, y: 8, z: 0} @@ -133337,7 +133638,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -20, y: 8, z: 0} @@ -133472,7 +133773,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -23, y: 9, z: 0} @@ -133487,7 +133788,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -22, y: 9, z: 0} @@ -133562,7 +133863,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -17, y: 9, z: 0} @@ -133622,7 +133923,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -25, y: 10, z: 0} @@ -133697,7 +133998,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -20, y: 10, z: 0} @@ -133712,7 +134013,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -19, y: 10, z: 0} @@ -133772,7 +134073,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -26, y: 11, z: 0} @@ -133907,7 +134208,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -17, y: 11, z: 0} @@ -133982,7 +134283,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -23, y: 12, z: 0} @@ -134027,7 +134328,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -20, y: 12, z: 0} @@ -134357,7 +134658,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -16, y: 14, z: 0} @@ -134372,7 +134673,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -24, y: 15, z: 0} @@ -134492,7 +134793,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -16, y: 15, z: 0} @@ -134537,7 +134838,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -22, y: 16, z: 0} @@ -134582,7 +134883,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -19, y: 16, z: 0} @@ -134627,7 +134928,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3.0000002 + m_AnimationSpeed: 3 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -16, y: 16, z: 0} @@ -134717,7 +135018,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -18, y: 20, z: 0} @@ -134852,7 +135153,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -23, y: 22, z: 0} @@ -134927,7 +135228,7 @@ Tilemap: - {fileID: 21300104, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300110, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - {fileID: 21300116, guid: aaa735c5fdc695d4691e911ab4338879, type: 3} - m_AnimationSpeed: 3 + m_AnimationSpeed: 3.0000002 m_AnimationTimeOffset: 0 m_Flags: 0 - first: {x: -18, y: 22, z: 0} @@ -239300,3 +239601,5 @@ SceneRoots: - {fileID: 400464115} - {fileID: 1602895920} - {fileID: 1862593183} + - {fileID: 1140016764} + - {fileID: 963724778} diff --git a/Assets/Scripts/DojoSpawnAndMoveExecuter.cs b/Assets/Scripts/DojoSpawnAndMoveExecuter.cs new file mode 100644 index 00000000..634d0f09 --- /dev/null +++ b/Assets/Scripts/DojoSpawnAndMoveExecuter.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Dojo; +using Dojo.Starknet; +using UnityEngine; + +public class DojoSpawnAndMoveExecuter : MonoBehaviour +{ + [SerializeField] WorldManager worldManager; + [SerializeField] WorldManagerData dojoConfig; + [SerializeField] GameManagerData gameManagerData; + + public BurnerManager burnerManager; + public Actions actions; + private Dictionary spawnedAccounts = new(); + + public JsonRpcClient provider; + public Account masterAccount; + + private Vector2Int currentPosition; + + public Action currentPositionChange; + + void Awake() + { + provider = new JsonRpcClient(dojoConfig.rpcUrl); + masterAccount = new Account(provider, new SigningKey(gameManagerData.masterPrivateKey), new FieldElement(gameManagerData.masterAddress)); + burnerManager = new BurnerManager(provider, masterAccount); + + worldManager.synchronizationMaster.OnEntitySpawned.AddListener(InitEntity); + } + + public async void SpawnCharacter() + { + var burner = await burnerManager.DeployBurner(); + spawnedAccounts[burner.Address] = null; + var txHash = await actions.spawn(burner); + } + + public async void Move(Direction direction) + { + await actions.move(burnerManager.CurrentBurner ?? masterAccount, direction); + } + + private void InitEntity(GameObject entity) + { + if (!entity.TryGetComponent(out dojo_starter_Position position)) return; + if (position.player.Hex().Equals(burnerManager.CurrentBurner.Address.Hex())) + { + this.currentPosition = new Vector2Int((int)position.vec.x, (int)position.vec.y); + currentPositionChange.Invoke(currentPosition); + } + + } +} diff --git a/Assets/Scripts/DojoSpawnAndMoveExecuter.cs.meta b/Assets/Scripts/DojoSpawnAndMoveExecuter.cs.meta new file mode 100644 index 00000000..13eb5c72 --- /dev/null +++ b/Assets/Scripts/DojoSpawnAndMoveExecuter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4903969972cd43ea95e8c1fc824e0bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 56d01120..64741541 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -63,6 +63,8 @@ public class PlayerController : MonoBehaviour /// public static Vector3 lastHouseEntered = Vector3.zero; + [SerializeField] DojoSpawnAndMoveExecuter dojoSpawnAndMoveExecuter; + /// /// Called when the script is instantiated. /// Initializes the singleton instance and ensures the GameObject isn't destroyed when loading new scenes. @@ -82,15 +84,24 @@ private void Awake() } DontDestroyOnLoad(gameObject); - - } - + dojoSpawnAndMoveExecuter.currentPositionChange += Handle_positionChange; + + } + + private void Handle_positionChange(Vector2Int pos) + { + transform.position = new Vector3(pos.x, pos.y, transform.position.z); + } + /// /// Called when the script starts execution. /// Initializes the FixedJoystick component based on the platform. /// void Start() { + + dojoSpawnAndMoveExecuter.SpawnCharacter(); + joystick = GameObject.FindGameObjectWithTag("Joystick").GetComponent(); #if UNITY_STANDALONE_WIN @@ -134,6 +145,23 @@ void Update() } } + if (Input.GetKeyDown(KeyCode.W)) + { + dojoSpawnAndMoveExecuter.Move(new Direction.Down()); + } + else if (Input.GetKeyDown(KeyCode.A)) + { + dojoSpawnAndMoveExecuter.Move(new Direction.Left()); + } + else if (Input.GetKeyDown(KeyCode.S)) + { + dojoSpawnAndMoveExecuter.Move(new Direction.Up()); + } + else if (Input.GetKeyDown(KeyCode.D)) + { + dojoSpawnAndMoveExecuter.Move(new Direction.Right()); + } + transform.position = new Vector3(Mathf.Clamp(transform.position.x, bottomLeftLimit.x, topRightLimit.x), Mathf.Clamp(transform.position.y, bottomLeftLimit.y, topRightLimit.y), transform.position.z); } diff --git a/Assets/Spawn And Move.meta b/Assets/Spawn And Move.meta new file mode 100644 index 00000000..e3085c21 --- /dev/null +++ b/Assets/Spawn And Move.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77f05577af439454291599ea893dffc1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/.DS_Store b/Assets/Spawn And Move/.DS_Store new file mode 100644 index 00000000..ae988fd7 Binary files /dev/null and b/Assets/Spawn And Move/.DS_Store differ diff --git a/Assets/Spawn And Move/CameraFollow.cs b/Assets/Spawn And Move/CameraFollow.cs new file mode 100644 index 00000000..5d94fd7e --- /dev/null +++ b/Assets/Spawn And Move/CameraFollow.cs @@ -0,0 +1,54 @@ +using Dojo; +using UnityEngine; + +public class CameraFollow : MonoBehaviour +{ + public WorldManager worldManager; + public float height = 10.0f; // height of the camera above the center point + public float damping = 1.0f; // damping factor to smooth camera movement + public float speed = 10.0f; // speed of camera movement + + + void Update() + { + // all entities with the position model, + // we only want to consider those for "follow" + var entities = worldManager.Entities(); + + if (entities.Length > 0) + { + Vector3 centerPoint = GetCenterPoint(entities); + Vector3 offset = new Vector3(0, height, -height); + Vector3 desiredPosition = centerPoint + offset; + Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, damping * Time.deltaTime); + transform.position = smoothedPosition; + + transform.LookAt(centerPoint); + } + + // Camera control with mouse + if (Input.GetMouseButton(1)) + { + float mouseX = Input.GetAxis("Mouse X"); + float mouseY = Input.GetAxis("Mouse Y"); + + transform.RotateAround(GetCenterPoint(entities), Vector3.up, mouseX * speed); + transform.RotateAround(GetCenterPoint(entities), transform.right, -mouseY * speed); + } + } + + Vector3 GetCenterPoint(GameObject[] entities) + { + if (entities.Length == 1) + { + return entities[0].transform.position; + } + + var bounds = new Bounds(entities[0].transform.position, Vector3.zero); + for (int i = 0; i < entities.Length; i++) + { + bounds.Encapsulate(entities[i].transform.position); + } + return bounds.center; + } +} \ No newline at end of file diff --git a/Assets/Spawn And Move/CameraFollow.cs.meta b/Assets/Spawn And Move/CameraFollow.cs.meta new file mode 100644 index 00000000..903bead2 --- /dev/null +++ b/Assets/Spawn And Move/CameraFollow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9601f4ab467894a87a34f22f6b453eb8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/ChatManager.cs b/Assets/Spawn And Move/ChatManager.cs new file mode 100644 index 00000000..b1bdc46c --- /dev/null +++ b/Assets/Spawn And Move/ChatManager.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using Dojo; +using Dojo.Starknet; +using Dojo.Torii; +using dojo_bindings; +using Newtonsoft.Json; +using UnityEngine; +using UnityEngine.UI; + +public class ChatManager : MonoBehaviour +{ + public bool chatOpen = false; + public FieldElement channel = new FieldElement(0); + + public dojoExample.GameManager gameManager; + public WorldManager worldManager; + + private Transform chatScrollView; + private TMPro.TMP_InputField chatInput; + + // Start is called before the first frame update + async void Start() + { + chatInput = GetComponentInChildren(true); + chatInput.gameObject.SetActive(false); + + chatScrollView = transform.Find("Scroll View/Viewport/Content"); + } + + // Update is called once per frame + void Update() + { + if (Input.GetKeyUp(KeyCode.T)) + { + chatInput.gameObject.SetActive(true); + chatInput.GetComponent().ActivateInputField(); + chatOpen = true; + } + + // chat interactions below + if (!chatOpen) return; + // if we press enter, send message + if (Input.GetKeyUp(KeyCode.Return)) + { + SendMessage(chatInput.text); + chatInput.gameObject.SetActive(false); + chatInput.text = ""; + chatOpen = false; + } + + // if press esc. close chat + if (Input.GetKeyUp(KeyCode.Escape)) + { + chatInput.gameObject.SetActive(false); + chatInput.text = ""; + chatOpen = false; + } + } + + async void SendMessage(string message) + { + var account = gameManager.burnerManager.CurrentBurner ?? gameManager.masterAccount; + // random salt for the message + var randomBytes = new byte[28]; + RandomNumberGenerator.Fill(randomBytes); + + // copy to a 32 byte array + var salt = new byte[32]; + randomBytes.CopyTo(salt, 0); + + salt = salt.Reverse().ToArray(); + + var typed_data = TypedData.From(new ns_Message + { + identity = account.Address, + message = message, + channel = channel, + salt = new FieldElement(salt), + }); + + Debug.Log(JsonConvert.SerializeObject(typed_data)); + + FieldElement messageHash = typed_data.encode(account.Address); + Signature signature = account.Signer.Sign(messageHash); + + await worldManager.Publish(typed_data, signature.ToFeltArray()); + } +} diff --git a/Assets/Spawn And Move/ChatManager.cs.meta b/Assets/Spawn And Move/ChatManager.cs.meta new file mode 100644 index 00000000..9c51f50c --- /dev/null +++ b/Assets/Spawn And Move/ChatManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4245acacf3c4f4b789faaee65493eedf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Contracts.meta b/Assets/Spawn And Move/Contracts.meta new file mode 100644 index 00000000..08ca0075 --- /dev/null +++ b/Assets/Spawn And Move/Contracts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a34f1e1d36964110b7f3df17dbde841 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Contracts/ns-actions.gen.cs b/Assets/Spawn And Move/Contracts/ns-actions.gen.cs new file mode 100644 index 00000000..22bdb384 --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-actions.gen.cs @@ -0,0 +1,177 @@ +// Generated by dojo-bindgen on Tue, 5 Nov 2024 17:50:16 +0000. Do not modify this file manually. +using System; +using System.Threading.Tasks; +using Dojo; +using Dojo.Starknet; +using UnityEngine; +using dojo_bindings; +using System.Collections.Generic; +using System.Linq; +using Enum = Dojo.Starknet.Enum; + +// System definitions for `ns-actions` contract +public class Actions : MonoBehaviour { + // The address of this contract + public string contractAddress; + + + // Call the `spawn` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task spawn(Account account) { + List calldata = new List(); + + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "spawn", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `move` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task move(Account account, Direction direction) { + List calldata = new List(); + calldata.Add(new FieldElement(Enum.GetIndex(direction)).Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "move", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `set_player_config` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task set_player_config(Account account, string name) { + List calldata = new List(); + calldata.AddRange(ByteArray.Serialize(name).Select(f => f.Inner)); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "set_player_config", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `reset_player_config` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task reset_player_config(Account account) { + List calldata = new List(); + + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "reset_player_config", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `set_player_server_profile` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task set_player_server_profile(Account account, uint server_id, string name) { + List calldata = new List(); + calldata.Add(new FieldElement(server_id).Inner); + calldata.AddRange(ByteArray.Serialize(name).Select(f => f.Inner)); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "set_player_server_profile", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `set_models` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task set_models(Account account, FieldElement seed, uint n_models) { + List calldata = new List(); + calldata.Add(seed.Inner); + calldata.Add(new FieldElement(n_models).Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "set_models", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `enter_dungeon` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task enter_dungeon(Account account, FieldElement dungeon_address) { + List calldata = new List(); + calldata.Add(dungeon_address.Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "enter_dungeon", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `set_test` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task set_test(Account account, ns_Test test) { + List calldata = new List(); + calldata.Add(new FieldElement(test.ok).Inner); + calldata.Add(new FieldElement(test.x).Inner); + calldata.Add(new FieldElement(test.y).Inner); + calldata.Add(new FieldElement(test.z).Inner); + calldata.Add(new FieldElement(test.a.high).Inner); + calldata.Add(new FieldElement(test.a.low).Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "set_test", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `upgrade` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task upgrade(Account account, FieldElement new_class_hash) { + List calldata = new List(); + calldata.Add(new_class_hash.Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "upgrade", + calldata = calldata.ToArray() + } + }); + } + +} + \ No newline at end of file diff --git a/Assets/Spawn And Move/Contracts/ns-actions.gen.cs.meta b/Assets/Spawn And Move/Contracts/ns-actions.gen.cs.meta new file mode 100644 index 00000000..6feb110e --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-actions.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4fd9ad215c314bb1944a6d6b467f464 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Contracts/ns-dungeon.gen.cs b/Assets/Spawn And Move/Contracts/ns-dungeon.gen.cs new file mode 100644 index 00000000..5c4fb432 --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-dungeon.gen.cs @@ -0,0 +1,51 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using System.Threading.Tasks; +using Dojo; +using Dojo.Starknet; +using UnityEngine; +using dojo_bindings; +using System.Collections.Generic; +using System.Linq; +using Enum = Dojo.Starknet.Enum; + +// System definitions for `ns-dungeon` contract +public class Dungeon : MonoBehaviour { + // The address of this contract + public string contractAddress; + + + // Call the `enter` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task enter(Account account) { + List calldata = new List(); + + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "enter", + calldata = calldata.ToArray() + } + }); + } + + + + // Call the `upgrade` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task upgrade(Account account, FieldElement new_class_hash) { + List calldata = new List(); + calldata.Add(new_class_hash.Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "upgrade", + calldata = calldata.ToArray() + } + }); + } + +} + \ No newline at end of file diff --git a/Assets/Spawn And Move/Contracts/ns-dungeon.gen.cs.meta b/Assets/Spawn And Move/Contracts/ns-dungeon.gen.cs.meta new file mode 100644 index 00000000..9ecab7a9 --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-dungeon.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1a69951e43d840fe80e0a266dc125c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Contracts/ns-mock_token.gen.cs b/Assets/Spawn And Move/Contracts/ns-mock_token.gen.cs new file mode 100644 index 00000000..b7cb3ca1 --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-mock_token.gen.cs @@ -0,0 +1,34 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using System.Threading.Tasks; +using Dojo; +using Dojo.Starknet; +using UnityEngine; +using dojo_bindings; +using System.Collections.Generic; +using System.Linq; +using Enum = Dojo.Starknet.Enum; + +// System definitions for `ns-mock_token` contract +public class Mock_token : MonoBehaviour { + // The address of this contract + public string contractAddress; + + + // Call the `upgrade` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task upgrade(Account account, FieldElement new_class_hash) { + List calldata = new List(); + calldata.Add(new_class_hash.Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "upgrade", + calldata = calldata.ToArray() + } + }); + } + +} + \ No newline at end of file diff --git a/Assets/Spawn And Move/Contracts/ns-mock_token.gen.cs.meta b/Assets/Spawn And Move/Contracts/ns-mock_token.gen.cs.meta new file mode 100644 index 00000000..f0fa1a1d --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-mock_token.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f5cdb1324add48b281a8e49a0807d14 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Contracts/ns-others.gen.cs b/Assets/Spawn And Move/Contracts/ns-others.gen.cs new file mode 100644 index 00000000..ea2e66db --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-others.gen.cs @@ -0,0 +1,34 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using System.Threading.Tasks; +using Dojo; +using Dojo.Starknet; +using UnityEngine; +using dojo_bindings; +using System.Collections.Generic; +using System.Linq; +using Enum = Dojo.Starknet.Enum; + +// System definitions for `ns-others` contract +public class Others : MonoBehaviour { + // The address of this contract + public string contractAddress; + + + // Call the `upgrade` system with the specified Account and calldata + // Returns the transaction hash. Use `WaitForTransaction` to wait for the transaction to be confirmed. + public async Task upgrade(Account account, FieldElement new_class_hash) { + List calldata = new List(); + calldata.Add(new_class_hash.Inner); + + return await account.ExecuteRaw(new dojo.Call[] { + new dojo.Call{ + to = new FieldElement(contractAddress).Inner, + selector = "upgrade", + calldata = calldata.ToArray() + } + }); + } + +} + \ No newline at end of file diff --git a/Assets/Spawn And Move/Contracts/ns-others.gen.cs.meta b/Assets/Spawn And Move/Contracts/ns-others.gen.cs.meta new file mode 100644 index 00000000..f891c3f9 --- /dev/null +++ b/Assets/Spawn And Move/Contracts/ns-others.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1e407e50a7e04802a83bf8e856174e7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/GameManager.cs b/Assets/Spawn And Move/GameManager.cs new file mode 100644 index 00000000..01b23758 --- /dev/null +++ b/Assets/Spawn And Move/GameManager.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using bottlenoselabs.C2CS.Runtime; +using Dojo; +using Dojo.Starknet; +using dojo_bindings; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; +using Object = System.Object; +using Random = UnityEngine.Random; + +// Fix to use Records in Unity ref. https://stackoverflow.com/a/73100830 +using System.ComponentModel; +namespace System.Runtime.CompilerServices +{ + [EditorBrowsable(EditorBrowsableState.Never)] + internal class IsExternalInit{} +} +namespace dojoExample +{ + public class GameManager : MonoBehaviour + { + [SerializeField] WorldManager worldManager; + [SerializeField] ChatManager chatManager; + + [SerializeField] WorldManagerData dojoConfig; + [SerializeField] GameManagerData gameManagerData; + + public BurnerManager burnerManager; + private Dictionary spawnedAccounts = new(); + public Actions actions; + + public JsonRpcClient provider; + public Account masterAccount; + + + void Start() + { + provider = new JsonRpcClient(dojoConfig.rpcUrl); + masterAccount = new Account(provider, new SigningKey(gameManagerData.masterPrivateKey), new FieldElement(gameManagerData.masterAddress)); + burnerManager = new BurnerManager(provider, masterAccount); + + worldManager.synchronizationMaster.OnEntitySpawned.AddListener(InitEntity); + foreach (var entity in worldManager.Entities()) + { + InitEntity(entity); + } + } + + async void Update() + { + // dont register inputs if our chat is open + if (chatManager.chatOpen) return; + + if (Input.GetKeyUp(KeyCode.E)) + { + spawnedAccounts[masterAccount.Address] = null; + var txHash = await actions.spawn(masterAccount); + } + + if (Input.GetKeyUp(KeyCode.Space)) + { + var burner = await burnerManager.DeployBurner(); + spawnedAccounts[burner.Address] = null; + var txHash = await actions.spawn(burner); + } + + if (Input.GetMouseButtonUp(0)) + { + var ray = Camera.main.ScreenPointToRay(Input.mousePosition); + var hit = Physics.Raycast(ray, out var hitInfo); + if (hit && hitInfo.transform.parent != null) + { + var entity = hitInfo.transform.parent; + dojo_starter_Position position; + entity.TryGetComponent(out position); + + if (position && spawnedAccounts.ContainsValue(entity.name)) + { + var previousBurner = burnerManager.CurrentBurner; + if (previousBurner != null) + { + worldManager.Entity(spawnedAccounts[previousBurner.Address]) + .GetComponent().textTag.color = Color.black; + } + + var burner = spawnedAccounts.First(b => b.Value == entity.name); + var burnerAddress = burner.Key; + var burnerInstance = burnerManager.Burners.First(b => b.Address == burnerAddress); + + position.textTag.color = Color.blue; + } + } + } + + if (Input.GetKeyDown(KeyCode.W)) + { + // coordinates are different between dojo world and unity + Move(new Direction.Down()); + } + else if (Input.GetKeyDown(KeyCode.A)) + { + Move(new Direction.Left()); + } + else if (Input.GetKeyDown(KeyCode.S)) + { + Move(new Direction.Up()); + } + else if (Input.GetKeyDown(KeyCode.D)) + { + Move(new Direction.Right()); + } + } + + private async void Move(Direction direction) + { + await actions.move(burnerManager.CurrentBurner ?? masterAccount, direction); + } + + private void InitEntity(GameObject entity) + { + // check if entity has position component + if (!entity.TryGetComponent(out dojo_starter_Position position)) return; + + var capsule = GameObject.CreatePrimitive(PrimitiveType.Capsule); + // change color of capsule to a random color + capsule.GetComponent().material.color = Random.ColorHSV(); + capsule.transform.parent = entity.transform; + + foreach (var account in spawnedAccounts) + { + if (account.Value == null) + { + spawnedAccounts[account.Key] = entity.name; + break; + } + } + } + } + +} + diff --git a/Assets/Spawn And Move/GameManager.cs.meta b/Assets/Spawn And Move/GameManager.cs.meta new file mode 100644 index 00000000..55b2cd14 --- /dev/null +++ b/Assets/Spawn And Move/GameManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 607a463b8a907498380786d00fd65442 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/GameManagerData.asset b/Assets/Spawn And Move/GameManagerData.asset new file mode 100644 index 00000000..888d64f4 --- /dev/null +++ b/Assets/Spawn And Move/GameManagerData.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 383d2b450adbb055b96dab4340377ead, type: 3} + m_Name: GameManagerData + m_EditorClassIdentifier: + masterPrivateKey: 0xc5b2fcab997346f3ea1c00b002ecf6f382c5f9c9659a3894eb783c5320f912 + masterAddress: 0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec diff --git a/Assets/Spawn And Move/GameManagerData.asset.meta b/Assets/Spawn And Move/GameManagerData.asset.meta new file mode 100644 index 00000000..66cea923 --- /dev/null +++ b/Assets/Spawn And Move/GameManagerData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22f53d4a93d2d44199b824f3780fe0ad +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/GameManagerData.cs b/Assets/Spawn And Move/GameManagerData.cs new file mode 100644 index 00000000..0123f48f --- /dev/null +++ b/Assets/Spawn And Move/GameManagerData.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +[CreateAssetMenu(fileName = "GameManagerData", menuName = "ScriptableObjects/GameManagerData", order = 2)] +public class GameManagerData : ScriptableObject +{ + public string masterPrivateKey; + public string masterAddress; +} diff --git a/Assets/Spawn And Move/GameManagerData.cs.meta b/Assets/Spawn And Move/GameManagerData.cs.meta new file mode 100644 index 00000000..65556783 --- /dev/null +++ b/Assets/Spawn And Move/GameManagerData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 383d2b450adbb055b96dab4340377ead +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models.meta b/Assets/Spawn And Move/Models.meta new file mode 100644 index 00000000..f6eef832 --- /dev/null +++ b/Assets/Spawn And Move/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3528cb466956f47c9bcf2e3b6cd8e965 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/dojo_starter_Moves.gen.cs b/Assets/Spawn And Move/Models/dojo_starter_Moves.gen.cs new file mode 100644 index 00000000..853e54ab --- /dev/null +++ b/Assets/Spawn And Move/Models/dojo_starter_Moves.gen.cs @@ -0,0 +1,47 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; + +// Type definition for `dojo_examples::models::MovesValue` struct +[Serializable] +public struct MovesValue { + public byte remaining; + public Direction last_direction; +} + +// Type definition for `dojo_examples::models::Direction` enum +public abstract record Direction() : Enum { + public record None() : Direction; + public record Left() : Direction; + public record Right() : Direction; + public record Up() : Direction; + public record Down() : Direction; +} + + +// Model definition for `dojo_examples::models::Moves` model +public class dojo_starter_Moves : ModelInstance { + [ModelField("player")] + public FieldElement player; + + [ModelField("remaining")] + public byte remaining; + + [ModelField("last_direction")] + public Direction last_direction; + + // Start is called before the first frame update + void Start() { + } + + // Update is called once per frame + void Update() { + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/dojo_starter_Moves.gen.cs.meta b/Assets/Spawn And Move/Models/dojo_starter_Moves.gen.cs.meta new file mode 100644 index 00000000..ee17477e --- /dev/null +++ b/Assets/Spawn And Move/Models/dojo_starter_Moves.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 234c19253773c4135bf618c0ace5796d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/dojo_starter_Position.gen.cs b/Assets/Spawn And Move/Models/dojo_starter_Position.gen.cs new file mode 100644 index 00000000..83092197 --- /dev/null +++ b/Assets/Spawn And Move/Models/dojo_starter_Position.gen.cs @@ -0,0 +1,61 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; +using UnityEngine; + +// Type definition for `dojo_examples::models::PositionValue` struct +[Serializable] +public struct PositionValue { + public Vec2 vec; +} + +// Type definition for `dojo_examples::models::Vec2` struct +[Serializable] +public struct Vec2 { + public uint x; + public uint y; +} + + +// Model definition for `dojo_examples::models::Position` model +public class dojo_starter_Position : ModelInstance { + [ModelField("player")] + public FieldElement player; + + [ModelField("vec")] + public Vec2 vec; + + // component fields + public TextMesh textTag; + public string shortPlayerAddress; + + void Start() + { + var target = new Vector3(vec.x, 0, vec.y); + gameObject.transform.position = target; + } + + void Update() + { + // our curent position is gameObject.transform.position + // move towards the target position + var step = 3.0f * Time.deltaTime; + // scale down our positions + Vector3 oldPosition = gameObject.transform.position; + var target = new Vector3(vec.x, oldPosition.y, vec.y); + gameObject.transform.position = Vector3.MoveTowards(gameObject.transform.position, target, step); + + // if we are close enough to the target position, snap to it + if (Vector3.Distance(gameObject.transform.position, target) < 0.001f) + { + gameObject.transform.position = target; + } + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/dojo_starter_Position.gen.cs.meta b/Assets/Spawn And Move/Models/dojo_starter_Position.gen.cs.meta new file mode 100644 index 00000000..696bbb65 --- /dev/null +++ b/Assets/Spawn And Move/Models/dojo_starter_Position.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45c0a1fb0e691417d9a26e42e6984340 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/ns-Message.gen.cs b/Assets/Spawn And Move/Models/ns-Message.gen.cs new file mode 100644 index 00000000..94c8c25f --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-Message.gen.cs @@ -0,0 +1,39 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; + +// Type definition for `core::option::Option::` enum +public abstract record Option() : Enum { + public record Some(A value) : Option; + public record None() : Option; +} + +// Model definition for `dojo_examples::models::Message` model +public class ns_Message : ModelInstance { + [ModelField("identity")] + public FieldElement identity; + + [ModelField("channel")] + public FieldElement channel; + + [ModelField("message")] + public string message; + + [ModelField("salt")] + public FieldElement salt; + + // Start is called before the first frame update + void Start() { + } + + // Update is called once per frame + void Update() { + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/ns-Message.gen.cs.meta b/Assets/Spawn And Move/Models/ns-Message.gen.cs.meta new file mode 100644 index 00000000..c8853e1f --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-Message.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18d933e97f7b2440d9c030315b902cf7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/ns-MockToken.gen.cs b/Assets/Spawn And Move/Models/ns-MockToken.gen.cs new file mode 100644 index 00000000..a971e192 --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-MockToken.gen.cs @@ -0,0 +1,28 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; +using BigInteger = System.Numerics.BigInteger; + +// Model definition for `dojo_examples::models::MockToken` model +public class ns_MockToken : ModelInstance { + [ModelField("account")] + public FieldElement account; + + [ModelField("amount")] + public BigInteger amount; + + // Start is called before the first frame update + void Start() { + } + + // Update is called once per frame + void Update() { + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/ns-MockToken.gen.cs.meta b/Assets/Spawn And Move/Models/ns-MockToken.gen.cs.meta new file mode 100644 index 00000000..ab85d1a8 --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-MockToken.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 355646c4df0cc4696b6d57b91c6cc1a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/ns-PlayerConfig.gen.cs b/Assets/Spawn And Move/Models/ns-PlayerConfig.gen.cs new file mode 100644 index 00000000..94c05205 --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-PlayerConfig.gen.cs @@ -0,0 +1,50 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; + +// Type definition for `dojo_examples::models::PlayerConfigValue` struct +[Serializable] +public struct PlayerConfigValue { + public string name; + public PlayerItem[] items; + public Option favorite_item; +} + +// Type definition for `dojo_examples::models::PlayerItem` struct +[Serializable] +public struct PlayerItem { + public uint item_id; + public uint quantity; + public int score; +} + + +// Model definition for `dojo_examples::models::PlayerConfig` model +public class ns_PlayerConfig : ModelInstance { + [ModelField("player")] + public FieldElement player; + + [ModelField("name")] + public string name; + + [ModelField("items")] + public PlayerItem[] items; + + [ModelField("favorite_item")] + public Option favorite_item; + + // Start is called before the first frame update + void Start() { + } + + // Update is called once per frame + void Update() { + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/ns-PlayerConfig.gen.cs.meta b/Assets/Spawn And Move/Models/ns-PlayerConfig.gen.cs.meta new file mode 100644 index 00000000..5b059961 --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-PlayerConfig.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95bc3be73555741d4bbdb0d4f0ba7c21 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/ns-ServerProfile.gen.cs b/Assets/Spawn And Move/Models/ns-ServerProfile.gen.cs new file mode 100644 index 00000000..2fe24567 --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-ServerProfile.gen.cs @@ -0,0 +1,37 @@ +// Generated by dojo-bindgen on Mon, 4 Nov 2024 23:36:28 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; + +// Type definition for `dojo_examples::models::ServerProfileValue` struct +[Serializable] +public struct ServerProfileValue { + public string name; +} + + +// Model definition for `dojo_examples::models::ServerProfile` model +public class ns_ServerProfile : ModelInstance { + [ModelField("player")] + public FieldElement player; + + [ModelField("server_id")] + public uint server_id; + + [ModelField("name")] + public string name; + + // Start is called before the first frame update + void Start() { + } + + // Update is called once per frame + void Update() { + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/ns-ServerProfile.gen.cs.meta b/Assets/Spawn And Move/Models/ns-ServerProfile.gen.cs.meta new file mode 100644 index 00000000..1f27ee97 --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-ServerProfile.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5abe444062e6f408f9c1bb3d38113765 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Models/ns-Test.gen.cs b/Assets/Spawn And Move/Models/ns-Test.gen.cs new file mode 100644 index 00000000..c52c362a --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-Test.gen.cs @@ -0,0 +1,52 @@ +// Generated by dojo-bindgen on Tue, 5 Nov 2024 17:50:16 +0000. Do not modify this file manually. +using System; +using Dojo; +using Dojo.Starknet; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using Enum = Dojo.Starknet.Enum; +using BigInteger = System.Numerics.BigInteger; +using UnityEngine; +using Newtonsoft.Json; + +// Type definition for `core::integer::u256` struct +[Serializable] +public struct U256 { + public BigInteger low; + public BigInteger high; +} + + +// Model definition for `dojo_examples::models::Test` model +public class ns_Test : ModelInstance { + [ModelField("ok")] + public uint ok; + + [ModelField("x")] + public long x; + + [ModelField("y")] + public BigInteger y; + + [ModelField("z")] + public BigInteger z; + + [ModelField("a")] + public U256 a; + + // Start is called before the first frame update + void Start() { + Debug.Log($"ok: {ok}"); + Debug.Log($"x: {x}"); + Debug.Log($"y: {y}"); + Debug.Log($"z: {z}"); + Debug.Log($"a: {JsonConvert.SerializeObject(a)}"); + } + + // Update is called once per frame + void Update() { + } +} + + \ No newline at end of file diff --git a/Assets/Spawn And Move/Models/ns-Test.gen.cs.meta b/Assets/Spawn And Move/Models/ns-Test.gen.cs.meta new file mode 100644 index 00000000..5cb63a9d --- /dev/null +++ b/Assets/Spawn And Move/Models/ns-Test.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19be8c27493a84425a322ec031b0fffe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Scenes.meta b/Assets/Spawn And Move/Scenes.meta new file mode 100644 index 00000000..309228bd --- /dev/null +++ b/Assets/Spawn And Move/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 196f7cf3de88d42c695e90b623202ead +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Scenes/SampleScene.meta b/Assets/Spawn And Move/Scenes/SampleScene.meta new file mode 100644 index 00000000..3ed78423 --- /dev/null +++ b/Assets/Spawn And Move/Scenes/SampleScene.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4344ed9b4430848a68e700fe9357af07 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Scenes/SampleScene.unity b/Assets/Spawn And Move/Scenes/SampleScene.unity new file mode 100644 index 00000000..41edb65f --- /dev/null +++ b/Assets/Spawn And Move/Scenes/SampleScene.unity @@ -0,0 +1,2067 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 705507994} + m_IndirectSpecularColor: {r: 0.44657886, g: 0.49641275, b: 0.5748176, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &36216327 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 184210, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_Name + value: UnityMainThreadDispatcher + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchoredPosition.x + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_AnchoredPosition.y + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3} +--- !u!1 &216707119 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 216707120} + - component: {fileID: 216707122} + - component: {fileID: 216707121} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &216707120 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 216707119} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1621275504} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &216707121 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 216707119} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &216707122 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 216707119} + m_CullTransparentMesh: 1 +--- !u!1 &420577426 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 420577427} + - component: {fileID: 420577430} + - component: {fileID: 420577429} + - component: {fileID: 420577428} + m_Layer: 5 + m_Name: Scroll View + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &420577427 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420577426} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 543268536} + - {fileID: 1031934510} + m_Father: {fileID: 1082089484} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9.759944, y: 0} + m_SizeDelta: {x: 19.520113, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &420577428 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420577426} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 1436812977} + m_Horizontal: 0 + m_Vertical: 1 + m_MovementType: 1 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 1 + m_Viewport: {fileID: 543268536} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 1031934511} + m_HorizontalScrollbarVisibility: 2 + m_VerticalScrollbarVisibility: 2 + m_HorizontalScrollbarSpacing: -3 + m_VerticalScrollbarSpacing: -3 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &420577429 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420577426} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &420577430 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420577426} + m_CullTransparentMesh: 1 +--- !u!1 &421222451 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 421222452} + - component: {fileID: 421222455} + - component: {fileID: 421222454} + - component: {fileID: 421222453} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &421222452 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 421222451} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 951569879} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &421222453 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 421222451} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &421222454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 421222451} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Enter text... + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 2150773298 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 0 + m_fontSizeMax: 0 + m_fontStyle: 2 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_enableExtraPadding: 1 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &421222455 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 421222451} + m_CullTransparentMesh: 1 +--- !u!1 &462311468 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 462311472} + - component: {fileID: 462311471} + - component: {fileID: 462311470} + - component: {fileID: 462311469} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &462311469 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462311468} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &462311470 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462311468} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &462311471 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462311468} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &462311472 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462311468} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1082089484} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &543268535 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 543268536} + - component: {fileID: 543268539} + - component: {fileID: 543268538} + - component: {fileID: 543268537} + m_Layer: 5 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &543268536 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 543268535} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1436812977} + m_Father: {fileID: 420577427} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!114 &543268537 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 543268535} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 +--- !u!114 &543268538 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 543268535} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &543268539 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 543268535} + m_CullTransparentMesh: 1 +--- !u!1 &691548659 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + m_PrefabInstance: {fileID: 1014796538906876319} + m_PrefabAsset: {fileID: 0} +--- !u!1 &705507993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 705507995} + - component: {fileID: 705507994} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &705507994 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.802082 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 1 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &705507995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &922574854 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 922574857} + - component: {fileID: 922574856} + - component: {fileID: 922574855} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &922574855 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 922574854} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &922574856 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 922574854} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &922574857 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 922574854} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &951569878 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 951569879} + - component: {fileID: 951569880} + m_Layer: 5 + m_Name: Text Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &951569879 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 951569878} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 421222452} + - {fileID: 1467797445} + m_Father: {fileID: 1909232410} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.4999962} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &951569880 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 951569878} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: {x: -8, y: -5, z: -8, w: -5} + m_Softness: {x: 0, y: 0} +--- !u!1 &963194225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963194228} + - component: {fileID: 963194227} + - component: {fileID: 963194226} + - component: {fileID: 963194229} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &963194226 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 +--- !u!20 &963194227 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &963194228 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + serializedVersion: 2 + m_LocalRotation: {x: 0.5697441, y: -0, z: -0, w: 0.82182217} + m_LocalPosition: {x: 0, y: 15.93, z: -6.8} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 69.465, y: 0, z: 0} +--- !u!114 &963194229 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9601f4ab467894a87a34f22f6b453eb8, type: 3} + m_Name: + m_EditorClassIdentifier: + worldManager: {fileID: 2019443015} + height: 10 + damping: 1 + speed: 10 +--- !u!1 &1031934509 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1031934510} + - component: {fileID: 1031934513} + - component: {fileID: 1031934512} + - component: {fileID: 1031934511} + m_Layer: 5 + m_Name: Scrollbar Vertical + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1031934510 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031934509} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1621275504} + m_Father: {fileID: 420577427} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: -17} + m_Pivot: {x: 1, y: 1} +--- !u!114 &1031934511 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031934509} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 0} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 216707121} + m_HandleRect: {fileID: 216707120} + m_Direction: 2 + m_Value: 0 + m_Size: 1 + m_NumberOfSteps: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1031934512 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031934509} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1031934513 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031934509} + m_CullTransparentMesh: 1 +--- !u!1 &1082089483 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1082089484} + - component: {fileID: 1082089485} + m_Layer: 5 + m_Name: Chat + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1082089484 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1082089483} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 420577427} + - {fileID: 1909232410} + m_Father: {fileID: 462311472} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 148.1, y: -148.85} + m_SizeDelta: {x: 296.2, y: 297.7} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1082089485 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1082089483} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4245acacf3c4f4b789faaee65493eedf, type: 3} + m_Name: + m_EditorClassIdentifier: + chatOpen: 0 + channel: + hex: 0x0000000000000000000000000000000000000000000000000000000000000000 + gameManager: {fileID: 2019443018} + worldManager: {fileID: 2019443015} +--- !u!1 &1436812976 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1436812977} + - component: {fileID: 1436812979} + - component: {fileID: 1436812978} + - component: {fileID: 1436812980} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1436812977 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436812976} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 543268536} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 5, y: 0} + m_SizeDelta: {x: -5, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!114 &1436812978 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436812976} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 20 + m_fontSizeBase: 20 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1436812979 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436812976} + m_CullTransparentMesh: 1 +--- !u!114 &1436812980 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436812976} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!1 &1467797444 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1467797445} + - component: {fileID: 1467797447} + - component: {fileID: 1467797446} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1467797445 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1467797444} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 951569879} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1467797446 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1467797444} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u200B" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 0 + m_fontSizeMax: 0 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_enableExtraPadding: 1 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1467797447 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1467797444} + m_CullTransparentMesh: 1 +--- !u!1 &1603019347 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1603019351} + - component: {fileID: 1603019350} + - component: {fileID: 1603019349} + - component: {fileID: 1603019348} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!64 &1603019348 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603019347} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &1603019349 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603019347} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1603019350 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603019347} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1603019351 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603019347} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.059959, y: -1, z: -0.089834} + m_LocalScale: {x: 579.44196, y: 1, z: 204.42252} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1621275503 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1621275504} + m_Layer: 5 + m_Name: Sliding Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1621275504 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1621275503} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 216707120} + m_Father: {fileID: 1031934510} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: -20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1909232409 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1909232410} + - component: {fileID: 1909232413} + - component: {fileID: 1909232412} + - component: {fileID: 1909232411} + m_Layer: 5 + m_Name: InputField (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1909232410 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1909232409} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 951569879} + m_Father: {fileID: 1082089484} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: -15.499954} + m_SizeDelta: {x: 0, y: 30.199997} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1909232411 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1909232409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2da0c512f12947e489f739169773d7ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1909232412} + m_TextViewport: {fileID: 951569879} + m_TextComponent: {fileID: 1467797446} + m_Placeholder: {fileID: 421222454} + m_VerticalScrollbar: {fileID: 0} + m_VerticalScrollbarEventHandler: {fileID: 0} + m_LayoutGroup: {fileID: 0} + m_ScrollSensitivity: 1 + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_HideSoftKeyboard: 0 + m_CharacterValidation: 0 + m_RegexValue: + m_GlobalPointSize: 14 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnSubmit: + m_PersistentCalls: + m_Calls: [] + m_OnSelect: + m_PersistentCalls: + m_Calls: [] + m_OnDeselect: + m_PersistentCalls: + m_Calls: [] + m_OnTextSelection: + m_PersistentCalls: + m_Calls: [] + m_OnEndTextSelection: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_OnTouchScreenKeyboardStatusChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_RichText: 1 + m_GlobalFontAsset: {fileID: 0} + m_OnFocusSelectAll: 1 + m_ResetOnDeActivation: 1 + m_RestoreOriginalTextOnEscape: 1 + m_isRichTextEditingAllowed: 0 + m_LineLimit: 0 + m_InputValidator: {fileID: 0} +--- !u!114 &1909232412 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1909232409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1909232413 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1909232409} + m_CullTransparentMesh: 1 +--- !u!114 &2019443015 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + m_PrefabInstance: {fileID: 1014796538906876319} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 691548659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 85bbcaeafdf5e41c6a2f48ff65820b7d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &2019443018 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 691548659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 607a463b8a907498380786d00fd65442, type: 3} + m_Name: + m_EditorClassIdentifier: + worldManager: {fileID: 2019443015} + chatManager: {fileID: 1082089485} + dojoConfig: {fileID: 11400000, guid: 1d6a5fa48aab79f0084b213f6fc768c5, type: 2} + gameManagerData: {fileID: 11400000, guid: 22f53d4a93d2d44199b824f3780fe0ad, type: 2} + actions: {fileID: 2019443024} +--- !u!114 &2019443024 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 691548659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c4fd9ad215c314bb1944a6d6b467f464, type: 3} + m_Name: + m_EditorClassIdentifier: + contractAddress: 0x058b83bea84766c5725c12e239c1ec9e1fde679ddf709b772fe7a8fdfd3cda27 +--- !u!1001 &1014796538906876319 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: relayUrl + value: /ip4/127.0.0.1/tcp/9090 + objectReference: {fileID: 0} + - target: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: worldAddress + value: 0x28f5999ae62fec17c09c52a800e244961dba05251f5aaf923afabd9c9804d1a + objectReference: {fileID: 0} + - target: {fileID: 1648136030876143075, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: relayWebrtcUrl + value: /ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/uEiCAoeHQh49fCHDolECesXO0CPR7fpz0sv0PWVaIahzT4g + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3269270482660702203, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: models.Array.size + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: models.Array.data[0] + value: + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: models.Array.data[1] + value: + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEventMessage.m_PersistentCalls.m_Calls.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 11500000, guid: 043ae0b8f2d5246499b92dea35147ab6, + type: 3} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEventMessage.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 4477060482053654553, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: OnEntitySpawned.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + propertyPath: m_Name + value: WorldManager + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + insertIndex: -1 + addedObject: {fileID: 2019443018} + - targetCorrespondingSourceObject: {fileID: 4900589733936057544, guid: d2e25933f4d69473a8994ee7470b2610, + type: 3} + insertIndex: -1 + addedObject: {fileID: 2019443024} + m_SourcePrefab: {fileID: 100100000, guid: d2e25933f4d69473a8994ee7470b2610, type: 3} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 963194228} + - {fileID: 705507995} + - {fileID: 1014796538906876319} + - {fileID: 36216327} + - {fileID: 1603019351} + - {fileID: 462311472} + - {fileID: 922574857} diff --git a/Assets/Spawn And Move/Scenes/SampleScene.unity.meta b/Assets/Spawn And Move/Scenes/SampleScene.unity.meta new file mode 100644 index 00000000..952bd1e9 --- /dev/null +++ b/Assets/Spawn And Move/Scenes/SampleScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9fc0d4010bbf28b4594072e72b8655ab +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Scenes/SampleScene/LightingData.asset b/Assets/Spawn And Move/Scenes/SampleScene/LightingData.asset new file mode 100644 index 00000000..e9ce5cae Binary files /dev/null and b/Assets/Spawn And Move/Scenes/SampleScene/LightingData.asset differ diff --git a/Assets/Spawn And Move/Scenes/SampleScene/LightingData.asset.meta b/Assets/Spawn And Move/Scenes/SampleScene/LightingData.asset.meta new file mode 100644 index 00000000..a80ae344 --- /dev/null +++ b/Assets/Spawn And Move/Scenes/SampleScene/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e15ea2b431a5c4deeabf331619dd69e4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Spawn And Move/Scenes/SampleScene/ReflectionProbe-0.exr b/Assets/Spawn And Move/Scenes/SampleScene/ReflectionProbe-0.exr new file mode 100644 index 00000000..ecbe33c3 Binary files /dev/null and b/Assets/Spawn And Move/Scenes/SampleScene/ReflectionProbe-0.exr differ diff --git a/Assets/Spawn And Move/Scenes/SampleScene/ReflectionProbe-0.exr.meta b/Assets/Spawn And Move/Scenes/SampleScene/ReflectionProbe-0.exr.meta new file mode 100644 index 00000000..79df4c90 --- /dev/null +++ b/Assets/Spawn And Move/Scenes/SampleScene/ReflectionProbe-0.exr.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: ac8c51176350b4a4092854b908c441fe +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 79fce987..7ecc6375 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -114,7 +114,7 @@ "url": "https://packages.unity.com" }, "com.unity.services.core": { - "version": "1.12.5", + "version": "1.12.0", "depth": 1, "source": "registry", "dependencies": { diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index d971767b..2e7bb8a6 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2022.3.28f1 -m_EditorVersionWithRevision: 2022.3.28f1 (6bae5ce6b222) +m_EditorVersion: 2022.3.15f1 +m_EditorVersionWithRevision: 2022.3.15f1 (b58023a2b463)