当前位置: 首页>>代码示例>>C#>>正文


C# RoomUser.SetPos方法代码示例

本文整理汇总了C#中RoomUser.SetPos方法的典型用法代码示例。如果您正苦于以下问题:C# RoomUser.SetPos方法的具体用法?C# RoomUser.SetPos怎么用?C# RoomUser.SetPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RoomUser的用法示例。


在下文中一共展示了RoomUser.SetPos方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnUserAdd

        /// <summary>
        ///     Handles the <see cref="E:UserAdd" /> event.
        /// </summary>
        /// <param name="user"></param>
        private void OnUserAdd(RoomUser user)
        {
            try
            {
                if (user?.GetClient() == null || user.GetClient().GetHabbo() == null)
                    return;

                GameClient client = user.GetClient();

                if (client?.GetHabbo() == null || _userRoom == null)
                    return;

                if (!user.IsSpectator)
                {
                    DynamicRoomModel model = _userRoom.GetGameMap().Model;
                    if (model == null) return;
                    user.SetPos(model.DoorX, model.DoorY, model.DoorZ);
                    user.SetRot(model.DoorOrientation, false);

                    user.AddStatus(_userRoom.CheckRights(client, true) ? "flatctrl 4" : "flatctrl 1", string.Empty);

                    user.CurrentItemEffect = ItemEffectType.None;

                    if (!user.IsBot && client.GetHabbo().IsTeleporting)
                    {
                        client.GetHabbo().IsTeleporting = false;
                        client.GetHabbo().TeleportingRoomId = 0;

                        RoomItem item = _userRoom.GetRoomItemHandler().GetItem(client.GetHabbo().TeleporterId);

                        if (item != null)
                        {
                            item.ExtraData = "2";
                            item.UpdateState(false, true);
                            user.SetPos(item.X, item.Y, item.Z);
                            user.SetRot(item.Rot, false);
                            item.InteractingUser2 = client.GetHabbo().Id;
                            item.ExtraData = "0";
                            item.UpdateState(false, true);
                        }
                    }
                    if (!user.IsBot && client.GetHabbo().IsHopping)
                    {
                        client.GetHabbo().IsHopping = false;
                        client.GetHabbo().HopperId = 0;

                        RoomItem item2 = _userRoom.GetRoomItemHandler().GetItem(client.GetHabbo().HopperId);

                        if (item2 != null)
                        {
                            item2.ExtraData = "1";
                            item2.UpdateState(false, true);
                            user.SetPos(item2.X, item2.Y, item2.Z);
                            user.SetRot(item2.Rot, false);
                            user.AllowOverride = false;
                            item2.InteractingUser2 = client.GetHabbo().Id;
                            item2.ExtraData = "2";
                            item2.UpdateState(false, true);
                        }
                    }
                    if (!user.IsSpectator)
                    {
                        ServerMessage serverMessage =
                            new ServerMessage(LibraryParser.OutgoingRequest("SetRoomUserMessageComposer"));
                        serverMessage.AppendInteger(1);
                        user.Serialize(serverMessage, _userRoom.GetGameMap().GotPublicPool);
                        _userRoom.SendMessage(serverMessage);
                    }
                    if (!user.IsBot)
                    {
                        ServerMessage serverMessage2 = new ServerMessage();
                        serverMessage2.Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
                        serverMessage2.AppendInteger(user.VirtualId);
                        serverMessage2.AppendString(client.GetHabbo().Look);
                        serverMessage2.AppendString(client.GetHabbo().Gender.ToLower());
                        serverMessage2.AppendString(client.GetHabbo().Motto);
                        serverMessage2.AppendInteger(client.GetHabbo().AchievementPoints);
                        _userRoom.SendMessage(serverMessage2);
                    }
                    if (_userRoom.RoomData.Owner != client.GetHabbo().UserName)
                    {
                        Yupi.GetGame()
                            .GetAchievementManager()
                            .ProgressUserAchievement(client, "ACH_RoomEntry", 1);
                    }
                }
                if (client.GetHabbo().GetMessenger() != null)
                    client.GetHabbo().GetMessenger().OnStatusChanged(true);
                client.GetMessageHandler().OnRoomUserAdd();

                //if (client.GetHabbo().HasFuse("fuse_mod")) client.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(102);
                //if (client.GetHabbo().Rank == Convert.ToUInt32(Yupi.GetDbConfig().DbData["ambassador.minrank"])) client.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(178);

                if (OnUserEnter != null)
                    OnUserEnter(user, null);
                if (_userRoom.GotMusicController() && _userRoom.GotMusicController())
//.........这里部分代码省略.........
开发者ID:bblackv,项目名称:Yupi,代码行数:101,代码来源:RoomUserManager.cs

示例2: DeployBot

        /// <summary>
        ///     Deploys the bot.
        /// </summary>
        /// <param name="bot">The bot.</param>
        /// <param name="petData">The pet data.</param>
        /// <returns>RoomUser.</returns>
        internal RoomUser DeployBot(RoomBot bot, Pet petData)
        {
            int virtualId = _primaryPrivateUserId++;

            RoomUser roomUser = new RoomUser(0u, _userRoom.RoomId, virtualId, _userRoom, false);

            int num = _secondaryPrivateUserId++;

            roomUser.InternalRoomId = num;
            UserList.TryAdd(num, roomUser);
            OnUserAdd(roomUser);

            DynamicRoomModel model = _userRoom.GetGameMap().Model;
            Point coord = new Point(bot.X, bot.Y);

            if ((bot.X > 0) && (bot.Y >= 0) && (bot.X < model.MapSizeX) && (bot.Y < model.MapSizeY))
            {
                _userRoom.GetGameMap().AddUserToMap(roomUser, coord);
                roomUser.SetPos(bot.X, bot.Y, bot.Z);
                roomUser.SetRot(bot.Rot, false);
            }
            else
            {
                bot.X = model.DoorX;
                bot.Y = model.DoorY;
                roomUser.SetPos(model.DoorX, model.DoorY, model.DoorZ);
                roomUser.SetRot(model.DoorOrientation, false);
            }

            bot.RoomUser = roomUser;
            roomUser.BotData = bot;

            roomUser.BotAi = bot.GenerateBotAi(roomUser.VirtualId, (int) bot.BotId);

            if (roomUser.IsPet)
            {
                roomUser.BotAi.Init(bot.BotId, roomUser.VirtualId, _userRoom.RoomId, roomUser, _userRoom);
                roomUser.PetData = petData;
                roomUser.PetData.VirtualId = roomUser.VirtualId;
            }
            else
                roomUser.BotAi.Init(bot.BotId, roomUser.VirtualId, _userRoom.RoomId, roomUser, _userRoom);

            UpdateUserStatus(roomUser, false);
            roomUser.UpdateNeeded = true;

            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SetRoomUserMessageComposer"));

            serverMessage.AppendInteger(1);
            roomUser.Serialize(serverMessage, _userRoom.GetGameMap().GotPublicPool);

            _userRoom.SendMessage(serverMessage);

            roomUser.BotAi.OnSelfEnterRoom();

            if (roomUser.IsPet)
            {
                if (_pets.Contains(roomUser.PetData.PetId))
                    _pets[roomUser.PetData.PetId] = roomUser;
                else
                    _pets.Add(roomUser.PetData.PetId, roomUser);

                PetCount++;
            }

            roomUser.BotAi.Modified();

            if (roomUser.BotData.AiType != AiType.Generic)
                return roomUser;

            if (_bots.Contains(roomUser.BotData.BotId))
                _bots[roomUser.BotData.BotId] = roomUser;
            else
                _bots.Add(roomUser.BotData.BotId, roomUser);

            serverMessage.Init(LibraryParser.OutgoingRequest("DanceStatusMessageComposer"));
            serverMessage.AppendInteger(roomUser.VirtualId);
            serverMessage.AppendInteger(roomUser.BotData.DanceId);
            _userRoom.SendMessage(serverMessage);
            PetCount++;

            return roomUser;
        }
开发者ID:bblackv,项目名称:Yupi,代码行数:89,代码来源:RoomUserManager.cs

示例3: DeployBot

        internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
        {
            RoomUser BotUser = new RoomUser(0, room.RoomId, primaryPrivateUserID++, room, false);
            int PersonalID = secondaryPrivateUserID++;
            BotUser.InternalRoomID = PersonalID;
            //this.UserList[PersonalID] = BotUser;
            userlist.Add(PersonalID, BotUser);
            DynamicRoomModel Model = room.GetGameMap().Model;

            if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY)
            {
                BotUser.SetPos(Bot.X, Bot.Y, Bot.Z);
                BotUser.SetRot(Bot.Rot, false);
            }
            else
            {
                Bot.X = Model.DoorX;
                Bot.Y = Model.DoorY;

                BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
                BotUser.SetRot(Model.DoorOrientation, false);
            }

            BotUser.BotData = Bot;
            BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId);

            if (BotUser.IsPet)
            {

                BotUser.BotAI.Init((int)Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
                BotUser.PetData = PetData;
                BotUser.PetData.VirtualId = BotUser.VirtualId;
            }
            else
            {
                BotUser.BotAI.Init(-1, BotUser.VirtualId, room.RoomId, BotUser, room);
            }

            UpdateUserStatus(BotUser, false);
            BotUser.UpdateNeeded = true;

            ServerMessage EnterMessage = new ServerMessage(28);
            EnterMessage.AppendInt32(1);
            BotUser.Serialize(EnterMessage, room.GetGameMap().gotPublicPool);
            room.SendMessage(EnterMessage);

            BotUser.BotAI.OnSelfEnterRoom();

            if (BotUser.BotData.AiType == AIType.Guide)
                room.guideBotIsCalled = true;
            if (BotUser.IsPet)
            {
                if (pets.ContainsKey(BotUser.PetData.PetId)) //Pet allready placed
                    pets[BotUser.PetData.PetId] = BotUser;
                else
                    pets.Add(BotUser.PetData.PetId, BotUser);

                petCount++;
            }

            return BotUser;
        }
开发者ID:habb0,项目名称:PiciEmulator,代码行数:62,代码来源:RoomUserManager.cs

示例4: DeployBot

 internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
 {
     int virtualId = this.primaryPrivateUserID++;
     RoomUser roomUser = new RoomUser(0u, this.room.RoomId, virtualId, this.room, false);
     int num = this.secondaryPrivateUserID++;
     roomUser.InternalRoomID = num;
     this.userlist.Add(num, roomUser);
     DynamicRoomModel model = this.room.GetGameMap().Model;
     Point coord = new Point(Bot.X, Bot.Y);
     if (Bot.X > 0 && Bot.Y > 0 && Bot.X < model.MapSizeX && Bot.Y < model.MapSizeY)
     {
         this.room.GetGameMap().AddUserToMap(roomUser, coord);
         roomUser.SetPos(Bot.X, Bot.Y, Bot.Z);
         roomUser.SetRot(Bot.Rot, false);
     }
     else
     {
         Bot.X = model.DoorX;
         Bot.Y = model.DoorY;
         roomUser.SetPos(model.DoorX, model.DoorY, model.DoorZ);
         roomUser.SetRot(model.DoorOrientation, false);
     }
     roomUser.BotData = Bot;
     checked
     {
         roomUser.BotAI = Bot.GenerateBotAI(roomUser.VirtualId, (int)Bot.BotId);
         if (roomUser.IsPet)
         {
             roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
             roomUser.PetData = PetData;
             roomUser.PetData.VirtualId = roomUser.VirtualId;
         }
         else
         {
             roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
         }
         this.UpdateUserStatus(roomUser, false);
         roomUser.UpdateNeeded = true;
         ServerMessage serverMessage = new ServerMessage(Outgoing.SetRoomUserMessageComposer);
         serverMessage.AppendInt32(1);
         roomUser.Serialize(serverMessage, this.room.GetGameMap().gotPublicPool);
         this.room.SendMessage(serverMessage);
         roomUser.BotAI.OnSelfEnterRoom();
         if (roomUser.IsPet)
         {
             if (this.pets.Contains(roomUser.PetData.PetId))
             {
                 this.pets[roomUser.PetData.PetId] = roomUser;
             }
             else
             {
                 this.pets.Add(roomUser.PetData.PetId, roomUser);
             }
             this.petCount++;
         }
         if (roomUser.BotData.AiType == AIType.Generic)
         {
             if (this.bots.Contains(roomUser.BotData.BotId))
             {
                 this.bots[roomUser.BotData.BotId] = roomUser;
             }
             else
             {
                 this.bots.Add(roomUser.BotData.BotId, roomUser);
             }
             serverMessage.Init(Outgoing.DanceStatusMessageComposer);
             serverMessage.AppendInt32(roomUser.VirtualId);
             serverMessage.AppendInt32(roomUser.BotData.DanceId);
             this.room.SendMessage(serverMessage);
             this.petCount++;
         }
         return roomUser;
     }
 }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:74,代码来源:RoomUserManager.cs

示例5: DeployBot

        internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
        {
            int num2;
            this.primaryPrivateUserID = (num2 = this.primaryPrivateUserID) + 1;
            RoomUser BotUser = new RoomUser(0, this.room.RoomId, num2, this.room, false);
            this.secondaryPrivateUserID = (num2 = this.secondaryPrivateUserID) + 1;
            int key = num2;
            BotUser.InternalRoomID = key;
            this.userlist.Add(key, BotUser);
            DynamicRoomModel Model = this.room.GetGameMap().Model;
            Point myPoint = new Point(Bot.X,Bot.Y);
            if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY)
            {
                room.GetGameMap().AddUserToMap(BotUser, myPoint);
                BotUser.SetPos(Bot.X, Bot.Y, Bot.Z);
                BotUser.SetRot(Bot.Rot, false);
            }
            else
            {
                Bot.X = Model.DoorX;
                Bot.Y = Model.DoorY;

                BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
                BotUser.SetRot(Model.DoorOrientation, false);
            }

            BotUser.BotData = Bot;
            BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId,(int)Bot.BotId);

            if (BotUser.IsPet)
            {

                BotUser.BotAI.Init(Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
                BotUser.PetData = PetData;
                BotUser.PetData.VirtualId = BotUser.VirtualId;
            }
            else
            {
                BotUser.BotAI.Init(Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
            }

            this.UpdateUserStatus(BotUser, false);
            BotUser.UpdateNeeded = true;

            ServerMessage EnterMessage = new ServerMessage(Outgoing.PlaceBot);
            EnterMessage.AppendInt32(1);
            BotUser.Serialize(EnterMessage, room.GetGameMap().gotPublicPool);
            room.SendMessage(EnterMessage);

            BotUser.BotAI.OnSelfEnterRoom();

            if (BotUser.IsPet)
            {
                if (pets.ContainsKey(BotUser.PetData.PetId)) //Pet allready placed
                    pets[BotUser.PetData.PetId] = BotUser;
                else
                    pets.Add(BotUser.PetData.PetId, BotUser);

                petCount++;
            }
            if (BotUser.BotData.AiType == AIType.Generic)
            {
                if (bots.ContainsKey(BotUser.BotData.BotId))
                    bots[BotUser.BotData.BotId] = BotUser;
                else
                {
                    bots.Add(BotUser.BotData.BotId, BotUser);
                }

                EnterMessage.Init(Outgoing.Dance);
                EnterMessage.AppendInt32(BotUser.VirtualId);
                EnterMessage.AppendInt32(BotUser.BotData.DanceId);
                room.SendMessage(EnterMessage);
                petCount++;
            }

            return BotUser;
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:78,代码来源:RoomUserManager.cs

示例6: DeployBot

        internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
        {
            DynamicRoomModel Model = room.GetGameMap().Model;

            RoomUser BotUser = new RoomUser(0, string.Empty, room.RoomId, primaryPrivateUserID++, room, false);
            BotUser.InternalRoomID = ++secondaryPrivateUserID;
            //this.UserList[PersonalID] = BotUser;
            userlist.Add(BotUser.InternalRoomID, BotUser);

            if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY)
            {
                BotUser.SetPos(Bot.X, Bot.Y, Bot.Z);
                BotUser.SetRot(Bot.Rot, false);
            }
            else
            {
                Bot.X = Model.DoorX;
                Bot.Y = Model.DoorY;

                BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
                BotUser.SetRot(Model.DoorOrientation, false);
            }

            BotUser.BotData = Bot;
            BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId);

            if (BotUser.IsPet)
            {
                BotUser.BotAI.Init((int)Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
                BotUser.PetData = PetData;
                BotUser.PetData.virtualID = BotUser.VirtualId;
            }
            else
            {
                BotUser.BotAI.Init(Bot.ownerID > 0 ? (int)Bot.BotId : -1, BotUser.VirtualId, room.RoomId, BotUser, room);
            }

            UpdateUserStatus(BotUser, false);
            BotUser.UpdateNeeded = true;

            ServerMessage EnterMessage = PacketHandelingManager.GetRecycledItem(OutputCode.UsersMessageEvent);
            EnterMessage.AddInt32(1);
            BotUser.Serialize(EnterMessage);
            room.SendMessage(EnterMessage);

            BotUser.BotAI.OnSelfEnterRoom();

            if (BotUser.IsPet)
            {
                if (pets.ContainsKey(BotUser.PetData.petID)) //Pet allready placed
                    pets[BotUser.PetData.petID] = BotUser;
                else
                    pets.Add(BotUser.PetData.petID, BotUser);

                petCount++;
            }

            return BotUser;
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:59,代码来源:RoomUserManager.cs


注:本文中的RoomUser.SetPos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。