コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
ファイル: App.cs プロジェクト: alloverse/alloui-csharp
        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());
                }
            }
        }