public void Connect(string url, AlloIdentity identity, EntitySpecification avatarDesc) { Debug.WriteLine($"Spawning with ava {Serialize(avatarDesc)}"); unsafe { IntPtr urlPtr = Marshal.StringToHGlobalAnsi(url); IntPtr identPtr = Marshal.StringToHGlobalAnsi(Serialize(identity)); IntPtr avatarPtr = Marshal.StringToHGlobalAnsi(Serialize(avatarDesc)); bool ok = _AlloClient.alloclient_connect(client, urlPtr, identPtr, avatarPtr); Marshal.FreeHGlobal(urlPtr); Marshal.FreeHGlobal(identPtr); Marshal.FreeHGlobal(avatarPtr); if (!ok) { throw new Exception("Failed to connect to " + url); } } }
public void Connect(string url) { this.rootViews.Add(this.mainView); AlloIdentity identity = new AlloIdentity(); identity.display_name = this.appName; this.mainView.Layout(); EntitySpecification mainViewSpec = this.mainView.Specification(); this.client.Connect(url, identity, mainViewSpec); Debug.WriteLine("Connected"); foreach (View view in this.rootViews) { view.app = this; if (view != this.mainView) { this.client.SpawnEntity(view.Specification()); } } }