Пример #1
0
        public void Dance(int DanceId, bool Broadcast = true)
        {
            Unidle();

            if (mDanceId == DanceId)
            {
                return;
            }

            mDanceId = DanceId;

            if (Broadcast)
            {
                mInstance.BroadcastMessage(RoomUserDanceComposer.Compose(Id, DanceId));
            }
        }
Пример #2
0
        public void SendObjects(Session Session)
        {
            Session.SendData(RoomItemHeightmapComposer.Compose(Model.Heightmap.ToString()));
            Session.SendData(RoomRelativeHeightmapComposer.Compose(RelativeHeightmap));

            List <RoomActor> ActorObjects = new List <RoomActor>();

            Dictionary <uint, int> DancingActors  = new Dictionary <uint, int>();
            Dictionary <uint, int> CarryingActors = new Dictionary <uint, int>();
            Dictionary <uint, int> EffectActors   = new Dictionary <uint, int>();
            List <uint>            SleepingActors = new List <uint>();

            lock (mActorSyncRoot)
            {
                foreach (RoomActor Actor in mActors.Values)
                {
                    ActorObjects.Add(Actor);

                    if (Actor.DanceId > 0)
                    {
                        DancingActors.Add(Actor.Id, Actor.DanceId);
                    }

                    if (Actor.CarryItemId > 0)
                    {
                        CarryingActors.Add(Actor.Id, Actor.CarryItemId);
                    }

                    if (Actor.AvatarEffectId > 0)
                    {
                        EffectActors.Add(Actor.Id, Actor.AvatarEffectId);
                    }

                    if (Actor.IsSleeping)
                    {
                        SleepingActors.Add(Actor.Id);
                    }
                }
            }

            Session.SendData(RoomUserObjectListComposer.Compose(ActorObjects));
            Session.SendData(RoomStaticObjectsComposer.Compose(mStaticObjects));
            Session.SendData(RoomFloorObjectsComposer.Compose(GetFloorItems()));
            Session.SendData(RoomWallObjectsComposer.Compose(GetWallItems()));
            Session.SendData(RoomUserStatusListComposer.Compose(ActorObjects));

            foreach (KeyValuePair <uint, int> DancingActor in DancingActors)
            {
                Session.SendData(RoomUserDanceComposer.Compose(DancingActor.Key, DancingActor.Value));
            }

            foreach (KeyValuePair <uint, int> CarryingActor in CarryingActors)
            {
                Session.SendData(RoomUserCarryComposer.Compose(CarryingActor.Key, CarryingActor.Value));
            }

            foreach (KeyValuePair <uint, int> EffectActor in EffectActors)
            {
                Session.SendData(RoomUserEffectComposer.Compose(EffectActor.Key, EffectActor.Value));
            }

            foreach (uint SleepingActor in SleepingActors)
            {
                Session.SendData(RoomUserSleepComposer.Compose(SleepingActor, true));
            }
        }