Exemplo n.º 1
0
 public void SpawnEntity(EntitySpecification spec)
 {
     Debug.Assert(this.avatarId != null);
     this.InteractRequest(this.avatarId, "place", new List <object> {
         "spawn_entity", spec
     }, null);
 }
Exemplo n.º 2
0
        public void Spawn()
        {
            Debug.Assert(Superview != null && Superview.IsAwake);
            Layout();
            EntitySpecification spec = Specification();

            app.client.InteractRequest(
                Superview.Entity.id,
                "place",
                new List <object> {
                "spawn_entity", spec
            },
                null
                );
        }
Exemplo n.º 3
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);
                }
            }
        }
Exemplo n.º 4
0
        /// Override this to describe how your view is represented in the world
        public virtual EntitySpecification Specification()
        {
            EntitySpecification spec = new EntitySpecification();

            spec.components.ui = new Component.UI(ViewId);

            spec.components.transform.matrix = Bounds.Pose;

            if (Superview != null && Superview.IsAwake)
            {
                spec.components.relationships = new Component.Relationships(Superview.Entity.id);
            }
            if (IsGrabbable || IsPointable)
            {
                spec.components.collider = new Component.BoxCollider(Bounds.Size.Width, Bounds.Size.Height, Bounds.Size.Depth);
            }
            if (IsGrabbable)
            {
                spec.components.grabbable = new Component.Grabbable();
            }
            return(spec);
        }
Exemplo n.º 5
0
        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());
                }
            }
        }