Example #1
0
        private void SendAvatarDataToAll(AvatarData avatar)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();

            objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
            objupdate.RegionData.TimeDilation = 0;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0]           = _avatarTemplate;
            objupdate.ObjectData[0].ID        = avatar.LocalID;
            objupdate.ObjectData[0].FullID    = avatar.NetInfo.User.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + avatar.NetInfo.User.FirstName + "\nLastName STRING RW SV " + avatar.NetInfo.User.LastName + " \0");

            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);

            SendInfo send = new SendInfo();

            send.Incr    = true;
            send.NetInfo = avatar.NetInfo;
            send.Packet  = objupdate;
            send.SentTo  = 1;            //to all clients
            this._updateSender.SendList.Enqueue(send);
        }
Example #2
0
        public void AddNewAvatar(AvatarData avatar)
        {
            lock (this.RootNode)
            {
                avatar.SceneName = "Avatar" + this._objectCount.ToString("00000");
                this._objectCount++;
                this.RootNode.AddChild(avatar);
            }
            avatar.UpdateFlag = 128;

            //add to new clients list?
        }
 //public AgentInventory Inventory;
 public AgentProfile()
 {
     Name = new AgentName();
     Avatar = new AvatarData();
 }
Example #4
0
        public void Update()
        {
            // run physics engine to update positions etc since last frame

            // process command list
            lock (this.Commands)             //do we want to stop new commands being added while we process?
            {
                while (this.Commands.Count > 0)
                {
                    UpdateCommand command = this.Commands.Dequeue();
                    switch (command.CommandType)
                    {
                    case 1:
                        break;

                    default:
                        break;
                    }
                }
            }

            // check to see if any new avatars have joined since last frame
            //if so send data to clients.
            lock (this.RootNode)
            {
                for (int i = 0; i < this.RootNode.ChildrenCount; i++)
                {
                    //for now we will limit avatars to being a child of the rootnode
                    if (this.RootNode.GetChild(i).SceneType == 1)                    //check it is a avatar node
                    {
                        AvatarData avatar     = (AvatarData)this.RootNode.GetChild(i);
                        int        updatemask = avatar.UpdateFlag & (128);
                        if (updatemask == 128)                        //is a new avatar?
                        {
                            this.SendAvatarDataToAll(avatar);

                            //should send a avatar appearance to other clients except the avatar's owner

                            //and send complete scene update to the new avatar's owner
                            this.SendCompleteSceneTo(avatar);

                            //reset new avatar flag
                            //avatar.UpdateFlag -= 128;
                        }
                    }
                }
            }

            //send updates to clients
            lock (this.RootNode)
            {
                for (int i = 0; i < this.RootNode.ChildrenCount; i++)
                {
                    if (this.RootNode.GetChild(i).SceneType == 1)                    //check it is a avatar node
                    {
                        AvatarData avatar     = (AvatarData)this.RootNode.GetChild(i);
                        int        updatemask = avatar.UpdateFlag & (1);
                        if (updatemask == 1)
                        {
                            //avatar has changed velocity
                            //check what avatars are in range and add to their update lists
                            //but for now we will say all avatars are in range
                            for (int n = 0; n < this.RootNode.ChildrenCount; n++)
                            {
                                if (this.RootNode.GetChild(n).SceneType == 1)                                //check it is a avatar node
                                {
                                    AvatarData avatar2 = (AvatarData)this.RootNode.GetChild(i);
                                    int        newmask = avatar2.UpdateFlag & (128);
                                    if (newmask != 128)                                    //is a new avatar?
                                    {
                                        //no its not so let add to its updatelist
                                        avatar2.TerseUpdateList.Add(this.CreateTerseBlock(avatar));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            //now reset all update flags
            lock (this.RootNode)
            {
                for (int i = 0; i < this.RootNode.ChildrenCount; i++)
                {
                    this.RootNode.GetChild(i).UpdateFlag = 0;
                }
            }
        }
Example #5
0
 public void SendAvatarAppearanceToAllExcept(AvatarData avatar)
 {
 }
Example #6
0
 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock(AvatarData avatar)
 {
     return(null);
 }
Example #7
0
 public void SendCompleteSceneTo(AvatarData avatar)
 {
 }
        //public AgentInventory Inventory;

        public AgentProfile()
        {
            Name   = new AgentName();
            Avatar = new AvatarData();
        }
Example #9
0
        private void SendAvatarDataToAll(AvatarData avatar)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
            objupdate.RegionData.TimeDilation = 0;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0] = _avatarTemplate;
            objupdate.ObjectData[0].ID = avatar.LocalID;
            objupdate.ObjectData[0].FullID = avatar.NetInfo.User.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + avatar.NetInfo.User.FirstName + "\nLastName STRING RW SV " + avatar.NetInfo.User.LastName + " \0");

            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);

            SendInfo send = new SendInfo();
            send.Incr = true;
            send.NetInfo = avatar.NetInfo;
            send.Packet = objupdate;
            send.SentTo = 1; //to all clients
            this._updateSender.SendList.Enqueue(send);
        }
Example #10
0
 public void SendCompleteSceneTo(AvatarData avatar)
 {
 }
Example #11
0
 public void SendAvatarAppearanceToAllExcept(AvatarData avatar)
 {
 }
Example #12
0
 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock(AvatarData avatar)
 {
     return(null);
 }
Example #13
0
        public void AddNewAvatar(AvatarData avatar)
        {
            lock(this.RootNode)
            {
                avatar.SceneName = "Avatar" + this._objectCount.ToString("00000");
                this._objectCount++;
                this.RootNode.AddChild(avatar);
            }
            avatar.UpdateFlag = 128;

            //add to new clients list?
        }