本文整理汇总了C#中Yupi.Game.Rooms.Room.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Room.Destroy方法的具体用法?C# Room.Destroy怎么用?C# Room.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yupi.Game.Rooms.Room
的用法示例。
在下文中一共展示了Room.Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnloadRoom
//.........这里部分代码省略.........
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();
current.BotAi?.Dispose();
}
else
{
if (current.GetClient() != null)
{
room.GetRoomUserManager().RemoveUserFromRoom(current.GetClient(), true, false);
current.GetClient().CurrentRoomUserId = -1;
}
}
}
}
}
room.SaveRoomChatlog();
Room junkRoom;
LoadedRooms.TryRemove(room.RoomId, out junkRoom);
Writer.WriteLine(string.Format("Room #{0} was unloaded, reason: " + reason, room.RoomId),
"Yupi.Rooms", ConsoleColor.DarkGray);
room.Destroy();
}
示例2: UnloadRoom
//.........这里部分代码省略.........
"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);
queryReactor.RunQuery();
}
if (current.BotAi == null)
continue;
current.BotAi.Dispose();
}
else if (current.IsBot)
{
if (current.BotData == null)
continue;
using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
{
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();
}
current.BotAi?.Dispose();
}
else
{
if (current.GetClient() != null)
{
room.GetRoomUserManager().RemoveUserFromRoom(current.GetClient(), true, false);
current.GetClient().CurrentRoomUserId = -1;
}
}
}
}
room.SaveRoomChatlog();
Room junkRoom;
LoadedRooms.TryRemove(room.RoomId, out junkRoom);
YupiWriterManager.WriteLine(string.Format("Room #{0} was unloaded, reason: " + reason, room.RoomId),
"Yupi.Rooms", ConsoleColor.DarkGray);
room.Destroy();
}