mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-04-22 03:59:36 +08:00
添加UpdateRoom
This commit is contained in:
parent
4c9b729463
commit
2f5cdbd32b
@ -32,23 +32,23 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="FunGame.Core">
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net7.0\FunGame.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\FunGame\bin\Debug\net7.0-windows\FunGame.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data">
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net6.0\MySql.Data.dll</HintPath>
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net7.0\MySql.Data.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\FunGame\bin\Debug\net7.0-windows\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration.ConfigurationManager">
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net6.0\System.Configuration.ConfigurationManager.dll</HintPath>
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net7.0\System.Configuration.ConfigurationManager.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Permissions">
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net6.0\System.Security.Permissions.dll</HintPath>
|
||||
<HintPath>..\..\FunGame\bin\Server\Debug\net7.0\System.Security.Permissions.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
@ -313,12 +313,20 @@ namespace Milimoe.FunGame.Server.Model
|
||||
return Send(socket, type, false, msg);
|
||||
|
||||
case SocketMessageType.UpdateRoom:
|
||||
List<Room> list = new();
|
||||
if (Config.RoomList != null)
|
||||
Config.RoomList = new(Server);
|
||||
DataSet DsRoom = SQLHelper.ExecuteDataSet(RoomQuery.Select_Rooms, out SQLResult TestResult);
|
||||
if (TestResult == SQLResult.Success)
|
||||
{
|
||||
list = Config.RoomList.GetList();
|
||||
for (int i = 0; i < DsRoom.Tables[0].Rows.Count; )
|
||||
{
|
||||
DataRow row = DsRoom.Tables[0].Rows[0];
|
||||
DataSet DsUser = SQLHelper.ExecuteDataSet(UserQuery.Select_DuplicateUsername((string)row[RoomQuery.Column_RoomMasterName]), out TestResult);
|
||||
Room room = Factory.GetInstance<Room>(DsRoom, DsUser);
|
||||
Config.RoomList.AddRoom(room);
|
||||
DsRoom.Tables[0].Rows.Remove(row);
|
||||
}
|
||||
}
|
||||
return Send(socket, type, list);
|
||||
return Send(socket, type, Config.RoomList.GetList());
|
||||
|
||||
case SocketMessageType.CreateRoom:
|
||||
break;
|
||||
|
@ -15,6 +15,10 @@ namespace Milimoe.FunGame.Server.Utility
|
||||
public override string Script { get; set; } = "";
|
||||
public override CommandType CommandType { get; set; } = CommandType.Text;
|
||||
public override SQLResult Result => _Result;
|
||||
public override bool Success
|
||||
{
|
||||
get => Result == SQLResult.Success;
|
||||
}
|
||||
public override SQLServerInfo ServerInfo => _ServerInfo ?? SQLServerInfo.Create();
|
||||
public override int UpdateRows => _UpdateRows;
|
||||
public override DataSet DataSet => _DataSet;
|
||||
@ -110,15 +114,16 @@ namespace Milimoe.FunGame.Server.Utility
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建单次使用的SQLHelper(执行完毕会自动Close连接)
|
||||
/// 创建SQLHelper
|
||||
/// </summary>
|
||||
/// <param name="IsOneTime">是否是单次使用(执行完毕会自动Close连接)</param>
|
||||
/// <param name="script">存储过程名称或者script语句</param>
|
||||
/// <param name="type">存储过程, 文本, 等等</param>
|
||||
/// <param name="parameters">执行命令所用参数的集合</param>
|
||||
public MySQLHelper(string script = "", CommandType type = CommandType.Text, params MySqlParameter[] parameters)
|
||||
public MySQLHelper(string script = "", bool IsOneTime = true, CommandType type = CommandType.Text, params MySqlParameter[] parameters)
|
||||
{
|
||||
_IsOneTime = true;
|
||||
Script = script;
|
||||
_IsOneTime = IsOneTime;
|
||||
CommandType = type;
|
||||
Parameters = parameters;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user