當前位置: 首頁>>代碼示例>>C#>>正文


C# Room.GetRoomUserManager方法代碼示例

本文整理匯總了C#中Yupi.Game.Rooms.Room.GetRoomUserManager方法的典型用法代碼示例。如果您正苦於以下問題:C# Room.GetRoomUserManager方法的具體用法?C# Room.GetRoomUserManager怎麽用?C# Room.GetRoomUserManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Yupi.Game.Rooms.Room的用法示例。


在下文中一共展示了Room.GetRoomUserManager方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UnloadRoom

        /// <summary>
        ///     Unloads the room.
        /// </summary>
        /// <param name="room">The room.</param>
        /// <param name="reason">The reason.</param>
        internal void UnloadRoom(Room room, string reason)
        {
            if (room?.RoomData == null || room.Disposed)
                return;

            room.Disposed = true;

            if (Yupi.GetGame().GetNavigator().PrivateCategories.Contains(room.RoomData.Category))
                ((PublicCategory) Yupi.GetGame().GetNavigator().PrivateCategories[room.RoomData.Category]).UsersNow -=
                    room.UserCount;

            room.RoomData.UsersNow = 0;

            string state = "open";

            if (room.RoomData.State == 1)
                state = "locked";
            else if (room.RoomData.State > 1)
                state = "password";

            uint roomId = room.RoomId;

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery("UPDATE rooms_data SET " +
                                      "caption = @roomcaption," +
                                      "description = @description," +
                                      "password = @password," +
                                      "category = @category," +
                                      "state = @state," +
                                      "tags = @tags," +
                                      "users_now = @usersnow," +
                                      "users_max = @usersmax," +
                                      "allow_pets = @allowpets," +
                                      "allow_pets_eat = @allowpetseat," +
                                      "allow_walkthrough = @allowwalk," +
                                      "hidewall = @hidewall," +
                                      "floorthick = @floorthick," +
                                      "wallthick = @wallthick," +
                                      "mute_settings = @whocanmute," +
                                      "kick_settings = @kicksettings," +
                                      "ban_settings = @bansettings," +
                                      "walls_height = @wallheight," +
                                      "chat_type = @chat_t," +
                                      "chat_balloon = @chat_b," +
                                      "chat_speed = @chat_s," +
                                      "chat_max_distance = @chat_m," +
                                      "chat_flood_protection = @chat_f," +
                                      "trade_state = @tradestate " +
                                      "WHERE id = " + roomId);

                queryReactor.AddParameter("usersnow", room.RoomData.UsersNow);
                queryReactor.AddParameter("roomcaption", room.RoomData.Name);
                queryReactor.AddParameter("usersmax", room.RoomData.UsersMax);
                queryReactor.AddParameter("allowpets", Yupi.BoolToEnum(room.RoomData.AllowPets));
                queryReactor.AddParameter("allowpetseat", Yupi.BoolToEnum(room.RoomData.AllowPetsEating));
                queryReactor.AddParameter("allowwalk", Yupi.BoolToEnum(room.RoomData.AllowWalkThrough));
                queryReactor.AddParameter("hidewall", Yupi.BoolToEnum(room.RoomData.HideWall));
                queryReactor.AddParameter("floorthick", room.RoomData.FloorThickness);
                queryReactor.AddParameter("wallthick", room.RoomData.WallThickness);
                queryReactor.AddParameter("whocanmute", room.RoomData.WhoCanMute);
                queryReactor.AddParameter("kicksettings", room.RoomData.WhoCanKick);
                queryReactor.AddParameter("bansettings", room.RoomData.WhoCanBan);
                queryReactor.AddParameter("wallheight", room.RoomData.WallHeight);
                queryReactor.AddParameter("tradestate", room.RoomData.TradeState);
                queryReactor.AddParameter("category", room.RoomData.Category);
                queryReactor.AddParameter("state", state);
                queryReactor.AddParameter("description", room.RoomData.Description);
                queryReactor.AddParameter("password", room.RoomData.PassWord);
                queryReactor.AddParameter("tags", string.Join(",", room.RoomData.Tags));
                queryReactor.AddParameter("chat_t", room.RoomData.ChatType);
                queryReactor.AddParameter("chat_b", room.RoomData.ChatBalloon);
                queryReactor.AddParameter("chat_s", room.RoomData.ChatSpeed);
                queryReactor.AddParameter("chat_m", room.RoomData.ChatMaxDistance);
                queryReactor.AddParameter("chat_f", room.RoomData.ChatFloodProtection);

                queryReactor.RunQuery();
            }

            if (room.GetRoomUserManager() != null && room.GetRoomUserManager().UserList != null)
            {
                foreach (RoomUser current in room.GetRoomUserManager().UserList.Values.Where(current => current != null))
                {
                    if (current.IsPet)
                    {
                        if (current.PetData == null)
                            continue;

                        using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                        {
                            queryReactor.SetQuery("UPDATE pets_data SET [email protected], [email protected], [email protected] WHERE [email protected] LIMIT 1");
                            queryReactor.AddParameter("x", current.X);
                            queryReactor.AddParameter("y", current.Y);
                            queryReactor.AddParameter("z", current.Z);
                            queryReactor.AddParameter("id", current.PetData.PetId);
//.........這裏部分代碼省略.........
開發者ID:AngelRmz,項目名稱:Yupi,代碼行數:101,代碼來源:RoomManager.cs

示例2: UnloadRoom

        /// <summary>
        ///     Unloads the room.
        /// </summary>
        /// <param name="room">The room.</param>
        /// <param name="reason">The reason.</param>
        internal void UnloadRoom(Room room, string reason)
        {
            if (room?.RoomData == null || room.Disposed)
                return;

            room.Disposed = true;

            if (Yupi.GetGame().GetNavigator().PrivateCategories.Contains(room.RoomData.Category))
                ((PublicCategory) Yupi.GetGame().GetNavigator().PrivateCategories[room.RoomData.Category]).UsersNow -= room.UserCount;

            room.RoomData.UsersNow = 0;
            string state = "open";

            if (room.RoomData.State == 1)
                state = "locked";
            else if (room.RoomData.State > 1)
                state = "password";

            uint roomId = room.RoomId;

            try
            {
                using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    queryReactor.SetQuery(
                        "UPDATE rooms_data SET caption = @caption, description = @description, password = @password, category = " +
                        room.RoomData.Category + ", state = '" + state +
                        "', tags = @tags, users_now = '0', users_max = " +
                        room.RoomData.UsersMax + ", allow_pets = '" + Yupi.BoolToEnum(room.RoomData.AllowPets) +
                        "', allow_pets_eat = '" +
                        Yupi.BoolToEnum(room.RoomData.AllowPetsEating) + "', allow_walkthrough = '" +
                        Yupi.BoolToEnum(room.RoomData.AllowWalkThrough) +
                        "', hidewall = '" + Yupi.BoolToEnum(room.RoomData.HideWall) + "', floorthick = " +
                        room.RoomData.FloorThickness +
                        ", wallthick = " + room.RoomData.WallThickness + ", mute_settings='" + room.RoomData.WhoCanMute +
                        "', kick_settings='" + room.RoomData.WhoCanKick + "',ban_settings='" + room.RoomData.WhoCanBan +
                        "', walls_height = '" + room.RoomData.WallHeight +
                        "', chat_type = @chat_t,chat_balloon = @chat_b,chat_speed = @chat_s,chat_max_distance = @chat_m,chat_flood_protection = @chat_f, trade_state = '" +
                        room.RoomData.TradeState + "' WHERE id = " + roomId);
                    queryReactor.AddParameter("caption", room.RoomData.Name);
                    queryReactor.AddParameter("description", room.RoomData.Description);
                    queryReactor.AddParameter("password", room.RoomData.PassWord);
                    queryReactor.AddParameter("tags", string.Join(",", room.RoomData.Tags));
                    queryReactor.AddParameter("chat_t", room.RoomData.ChatType);
                    queryReactor.AddParameter("chat_b", room.RoomData.ChatBalloon);
                    queryReactor.AddParameter("chat_s", room.RoomData.ChatSpeed);
                    queryReactor.AddParameter("chat_m", room.RoomData.ChatMaxDistance);
                    queryReactor.AddParameter("chat_f", room.RoomData.ChatFloodProtection);
                    queryReactor.RunQuery();
                }
            }
            catch (Exception e)
            {
                ServerLogManager.LogException(e.ToString());
            }

            if (room.GetRoomUserManager() != null && room.GetRoomUserManager().UserList != null)
            {
                using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    foreach (RoomUser current in room.GetRoomUserManager().UserList.Values.Where(current => current != null))
                    {
                        if (current.IsPet)
                        {
                            if (current.PetData == null)
                                continue;

                            queryReactor.SetQuery("UPDATE pets_data SET [email protected], [email protected], [email protected] WHERE [email protected] LIMIT 1");
                            queryReactor.AddParameter("x", current.X);
                            queryReactor.AddParameter("y", current.Y);
                            queryReactor.AddParameter("z", current.Z);
                            queryReactor.AddParameter("id", current.PetData.PetId);
                            queryReactor.RunQuery();

                            if (current.BotAi == null)
                                continue;

                            current.BotAi.Dispose();
                        }
                        else if (current.IsBot)
                        {
                            if (current.BotData == null)
                                continue;

                            queryReactor.SetQuery("UPDATE bots_data SET [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] WHERE [email protected] LIMIT 1");
                            queryReactor.AddParameter("name", current.BotData.Name);
                            queryReactor.AddParameter("motto", current.BotData.Motto);
                            queryReactor.AddParameter("look", current.BotData.Look);
                            queryReactor.AddParameter("rotation", current.BotData.Rot);
                            queryReactor.AddParameter("dance", current.BotData.DanceId);
                            queryReactor.AddParameter("x", current.X);
                            queryReactor.AddParameter("y", current.Y);
                            queryReactor.AddParameter("z", current.Z);
                            queryReactor.AddParameter("id", current.BotData.BotId);
                            queryReactor.RunQuery();
//.........這裏部分代碼省略.........
開發者ID:ImNotSatan,項目名稱:Yupi,代碼行數:101,代碼來源:RoomManager.cs

示例3: PlantMonsterplant

        internal void PlantMonsterplant(RoomItem mopla, Room room)
        {
            int rarity = 0, internalRarity;

            if (room == null || mopla == null)
                return;

            if ((mopla.GetBaseItem().InteractionType != Interaction.Moplaseed) &&
                (mopla.GetBaseItem().InteractionType != Interaction.RareMoplaSeed))
                return;

            if (string.IsNullOrEmpty(mopla.ExtraData) || mopla.ExtraData == "0")
                rarity = 1;

            if (!string.IsNullOrEmpty(mopla.ExtraData) && mopla.ExtraData != "0")
                rarity = int.TryParse(mopla.ExtraData, out internalRarity) ? internalRarity : 1;

            int getX = mopla.X;
            int getY = mopla.Y;

            room.GetRoomItemHandler().RemoveFurniture(Session, mopla.Id, false);

            Pet pet = CatalogManager.CreatePet(Session.GetHabbo().Id, "Monsterplant", "pet_monster", "0", "0", rarity);

            Response.Init(LibraryParser.OutgoingRequest("SendMonsterplantIdMessageComposer"));
            Response.AppendInteger(pet.PetId);
            SendResponse();

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(string.Concat("UPDATE pets_data SET room_id = '", room.RoomId, "', x = '", getX, "', y = '", getY, "' WHERE id = '", pet.PetId, "'"));

            pet.PlacedInRoom = true;
            pet.RoomId = room.RoomId;

            RoomBot bot = new RoomBot(pet.PetId, pet.OwnerId, pet.RoomId, AiType.Pet, "freeroam", pet.Name, "", pet.Look, getX, getY, 0.0, 4, null, null, "", 0, "");

            room.GetRoomUserManager().DeployBot(bot, pet);

            if (pet.DbState != DatabaseUpdateState.NeedsInsert)
                pet.DbState = DatabaseUpdateState.NeedsUpdate;

            using (IQueryAdapter queryreactor2 = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                queryreactor2.RunFastQuery($"DELETE FROM items_rooms WHERE id = {mopla.Id}");
                room.GetRoomUserManager().SavePets(queryreactor2);
            }
        }
開發者ID:AngelRmz,項目名稱:Yupi,代碼行數:47,代碼來源:Rooms.cs


注:本文中的Yupi.Game.Rooms.Room.GetRoomUserManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。