From d3ac188fa0b1b9309c62d3ff5eff7ed5b780a0d5 Mon Sep 17 00:00:00 2001 From: milimoe <110188673+milimoe@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:52:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E7=B3=BB=E7=BB=9F=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9B=E6=B7=BB=E5=8A=A0=E5=87=86=E5=A4=87=E5=92=8C?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=87=86=E5=A4=87=E5=8A=9F=E8=83=BD=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 房间列表添加显示房间名称 * 添加了准备和取消准备 * 释放DataRequest * 修复准备提示文本问题 * 添加了房间相关命令的使用限制 * 添加了玩家是否在房间中的标记 * set button to correct enable * fix ready&cancelready bug * 开始游戏/提醒玩家准备/提醒房主开始游戏 --- FunGame.Desktop/Controller/MainController.cs | 87 +++++++ .../Controller/RunTimeController.cs | 9 +- .../Library/{Config => Other}/Config.cs | 9 + .../Library/{Config => Other}/Constant.cs | 19 +- FunGame.Desktop/UI/Main/Main.cs | 239 +++++++++++++----- 5 files changed, 298 insertions(+), 65 deletions(-) rename FunGame.Desktop/Library/{Config => Other}/Config.cs (92%) rename FunGame.Desktop/Library/{Config => Other}/Constant.cs (81%) diff --git a/FunGame.Desktop/Controller/MainController.cs b/FunGame.Desktop/Controller/MainController.cs index 0ea552a..e64eca3 100644 --- a/FunGame.Desktop/Controller/MainController.cs +++ b/FunGame.Desktop/Controller/MainController.cs @@ -20,6 +20,7 @@ namespace Milimoe.FunGame.Desktop.Controller private readonly DataRequest UpdateRoomRequest; private readonly DataRequest IntoRoomRequest; private readonly DataRequest QuitRoomRequest; + private readonly DataRequest StartGameRequest; public MainController(Main main) { @@ -31,6 +32,7 @@ namespace Milimoe.FunGame.Desktop.Controller UpdateRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_UpdateRoom); IntoRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_IntoRoom); QuitRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_QuitRoom); + StartGameRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_StartGame); } #region 公开方法 @@ -43,6 +45,7 @@ namespace Milimoe.FunGame.Desktop.Controller UpdateRoomRequest.Dispose(); IntoRoomRequest.Dispose(); QuitRoomRequest.Dispose(); + StartGameRequest.Dispose(); } public async Task LogOutAsync() @@ -135,6 +138,70 @@ namespace Milimoe.FunGame.Desktop.Controller return 0; } } + + public async Task SetReadyAsync(string roomid) + { + try + { + bool result = true; + + DataRequest request = RunTime.NewDataRequest(DataRequestType.Main_Ready); + request.AddRequestData("roomid", roomid); + await request.SendRequestAsync(); + if (request.Result == RequestResult.Success) + { + result = request.GetResult("result"); + if (result) + { + Config.FunGame_isInRoom = true; + Main.GetMessage("[ " + Usercfg.LoginUser.Username + " ] 准备完毕。"); + } + List ReadyPlayerList = request.GetResult>("ready") ?? new(); + if (ReadyPlayerList.Count > 0) Main.GetMessage("已准备的玩家:" + string.Join(", ", ReadyPlayerList.Select(u => u.Username))); + List NotReadyPlayerList = request.GetResult>("notready") ?? new(); + if (NotReadyPlayerList.Count > 0) Main.GetMessage("仍未准备的玩家:" + string.Join(", ", NotReadyPlayerList.Select(u => u.Username))); + } + request.Dispose(); + return result; + } + catch (Exception e) + { + Main.GetMessage(e.GetErrorInfo(), TimeType.None); + return false; + } + } + + public async Task CancelReadyAsync(string roomid) + { + try + { + bool result = true; + + DataRequest request = RunTime.NewDataRequest(DataRequestType.Main_CancelReady); + request.AddRequestData("roomid", roomid); + await request.SendRequestAsync(); + if (request.Result == RequestResult.Success) + { + result = request.GetResult("result"); + if (result) + { + Config.FunGame_isInRoom = false; + Main.GetMessage("[ " + Usercfg.LoginUser.Username + " ] 已取消准备。"); + } + List ReadyPlayerList = request.GetResult>("ready") ?? new(); + if (ReadyPlayerList.Count > 0) Main.GetMessage("已准备的玩家:" + string.Join(", ", ReadyPlayerList.Select(u => u.Username))); + List NotReadyPlayerList = request.GetResult>("notready") ?? new(); + if (NotReadyPlayerList.Count > 0) Main.GetMessage("仍未准备的玩家:" + string.Join(", ", NotReadyPlayerList.Select(u => u.Username))); + } + request.Dispose(); + return result; + } + catch (Exception e) + { + Main.GetMessage(e.GetErrorInfo(), TimeType.None); + return false; + } + } public async Task QuitRoomAsync(string roomid, bool isMaster) { @@ -227,6 +294,26 @@ namespace Milimoe.FunGame.Desktop.Controller return false; } } + + public async Task StartGameAsync(string roomid, bool isMaster) + { + try + { + StartGameRequest.AddRequestData("roomid", roomid); + StartGameRequest.AddRequestData("isMaster", isMaster); + await StartGameRequest.SendRequestAsync(); + if (StartGameRequest.Result == RequestResult.Success) + { + return true; + } + } + catch (Exception e) + { + Main.GetMessage(e.GetErrorInfo(), TimeType.None); + } + + return false; + } #endregion } diff --git a/FunGame.Desktop/Controller/RunTimeController.cs b/FunGame.Desktop/Controller/RunTimeController.cs index ead27c0..67c5bc8 100644 --- a/FunGame.Desktop/Controller/RunTimeController.cs +++ b/FunGame.Desktop/Controller/RunTimeController.cs @@ -149,12 +149,15 @@ namespace Milimoe.FunGame.Desktop.Controller protected override void SocketHandler_System(SocketObject ServerMessage) { - // 收到系统消息,直接发送弹窗 + // 收到系统消息,可输出消息或弹窗 string msg = ""; - ShowMessageType type = ShowMessageType.General; + ShowMessageType type = ShowMessageType.None; + int autoclose = 60; if (ServerMessage.Parameters.Length > 0) msg = ServerMessage.GetParam(0) ?? ""; if (ServerMessage.Parameters.Length > 1) type = ServerMessage.GetParam(1); - Main.ShowMessage(type, msg, "系统消息", 60); + if (ServerMessage.Parameters.Length > 2) autoclose = ServerMessage.GetParam(2); + if (type == ShowMessageType.None) Main.GetMessage(msg); + else Main.ShowMessage(type, msg, "系统消息", autoclose); } protected override void SocketHandler_HeartBeat(SocketObject ServerMessage) diff --git a/FunGame.Desktop/Library/Config/Config.cs b/FunGame.Desktop/Library/Other/Config.cs similarity index 92% rename from FunGame.Desktop/Library/Config/Config.cs rename to FunGame.Desktop/Library/Other/Config.cs index 06778f9..f1cc35c 100644 --- a/FunGame.Desktop/Library/Config/Config.cs +++ b/FunGame.Desktop/Library/Other/Config.cs @@ -57,6 +57,15 @@ namespace Milimoe.FunGame.Desktop.Library get => RunTime.Config.FunGame_isAutoRetry; set => RunTime.Config.FunGame_isAutoRetry = value; } + + /// + /// 是否在房间中 + /// + public static bool FunGame_isInRoom + { + get => RunTime.Config.FunGame_isInRoom; + set => RunTime.Config.FunGame_isInRoom = value; + } /// /// 当前游戏模式 diff --git a/FunGame.Desktop/Library/Config/Constant.cs b/FunGame.Desktop/Library/Other/Constant.cs similarity index 81% rename from FunGame.Desktop/Library/Config/Constant.cs rename to FunGame.Desktop/Library/Other/Constant.cs index b7048de..73cbd74 100644 --- a/FunGame.Desktop/Library/Config/Constant.cs +++ b/FunGame.Desktop/Library/Other/Constant.cs @@ -28,7 +28,9 @@ namespace Milimoe.FunGame.Desktop.Library public const string FunGame_Retry = "重新连接"; public const string FunGame_AutoRetryOn = "开启自动重连"; public const string FunGame_AutoRetryOff = "关闭自动重连"; - public static readonly object[] PresetOnineItems = + public const string FunGame_Ready = "准备就绪"; + public const string FunGame_CancelReady = "取消准备"; + public static readonly object[] PresetOnlineItems = { FunGame_PresetMessage, FunGame_SignIn, @@ -38,11 +40,23 @@ namespace Milimoe.FunGame.Desktop.Library FunGame_ClearGameInfo, FunGame_CreateMix, FunGame_CreateTeam, - FunGame_StartGame, FunGame_Disconnect, FunGame_AutoRetryOn, FunGame_AutoRetryOff }; + public static readonly object[] PresetInRoomItems = + { + FunGame_PresetMessage, + FunGame_SignIn, + FunGame_ShowCredits, + FunGame_ShowStock, + FunGame_ShowStore, + FunGame_ClearGameInfo, + FunGame_Ready, + FunGame_CancelReady, + FunGame_StartGame, + FunGame_Disconnect + }; public static readonly object[] PresetNoLoginItems = { FunGame_PresetMessage, @@ -63,6 +77,7 @@ namespace Milimoe.FunGame.Desktop.Library public enum ShowMessageType { + None, General, Tip, Warning, diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index 2f90ef9..6abf0f5 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -101,23 +101,25 @@ namespace Milimoe.FunGame.Desktop.UI { case MainInvokeType.SetGreen: Config.FunGame_isRetrying = false; - SetServerStatusLight((int)LightType.Green); - SetButtonEnableIfLogon(true, ClientState.Online); + SetServerStatusLight(LightType.Green); + if (Usercfg.InRoom.Roomid != "-1") SetButtonEnableIfLogon(true, ClientState.InRoom); + else SetButtonEnableIfLogon(true, ClientState.Online); Config.FunGame_isConnected = true; CurrentRetryTimes = 0; break; case MainInvokeType.SetGreenAndPing: Config.FunGame_isRetrying = false; - SetServerStatusLight((int)LightType.Green, ping: NetworkUtility.GetServerPing(RunTime.Session.Server_IP)); - SetButtonEnableIfLogon(true, ClientState.Online); + SetServerStatusLight(LightType.Green, ping: NetworkUtility.GetServerPing(RunTime.Session.Server_IP)); + if (Usercfg.InRoom.Roomid != "-1") SetButtonEnableIfLogon(true, ClientState.InRoom); + else SetButtonEnableIfLogon(true, ClientState.Online); Config.FunGame_isConnected = true; CurrentRetryTimes = 0; break; - + case MainInvokeType.SetYellow: Config.FunGame_isRetrying = false; - SetServerStatusLight((int)LightType.Yellow); + SetServerStatusLight(LightType.Yellow); SetButtonEnableIfLogon(false, ClientState.WaitConnect); Config.FunGame_isConnected = true; CurrentRetryTimes = 0; @@ -125,7 +127,7 @@ namespace Milimoe.FunGame.Desktop.UI case MainInvokeType.WaitConnectAndSetYellow: Config.FunGame_isRetrying = false; - SetServerStatusLight((int)LightType.Yellow); + SetServerStatusLight(LightType.Yellow); SetButtonEnableIfLogon(false, ClientState.WaitConnect); Config.FunGame_isConnected = true; CurrentRetryTimes = 0; @@ -138,14 +140,14 @@ namespace Milimoe.FunGame.Desktop.UI case MainInvokeType.WaitLoginAndSetYellow: Config.FunGame_isRetrying = false; - SetServerStatusLight((int)LightType.Yellow, true); + SetServerStatusLight(LightType.Yellow, true); SetButtonEnableIfLogon(false, ClientState.WaitLogin); Config.FunGame_isConnected = true; CurrentRetryTimes = 0; break; case MainInvokeType.SetRed: - SetServerStatusLight((int)LightType.Red); + SetServerStatusLight(LightType.Red); SetButtonEnableIfLogon(false, ClientState.WaitConnect); Config.FunGame_isConnected = false; break; @@ -155,7 +157,7 @@ namespace Milimoe.FunGame.Desktop.UI RoomList.Items.Clear(); Config.FunGame_isRetrying = false; Config.FunGame_isConnected = false; - SetServerStatusLight((int)LightType.Red); + SetServerStatusLight(LightType.Red); SetButtonEnableIfLogon(false, ClientState.WaitConnect); LogoutAccount(); MainController?.MainController_Disposed(); @@ -170,7 +172,7 @@ namespace Milimoe.FunGame.Desktop.UI Config.FunGame_isAutoConnect = false; Config.FunGame_isAutoLogin = false; Config.FunGame_isConnected = false; - SetServerStatusLight((int)LightType.Yellow); + SetServerStatusLight(LightType.Yellow); SetButtonEnableIfLogon(false, ClientState.WaitConnect); LogoutAccount(); MainController?.MainController_Disposed(); @@ -182,7 +184,7 @@ namespace Milimoe.FunGame.Desktop.UI case MainInvokeType.LogOut: Config.FunGame_isRetrying = false; Config.FunGame_isAutoLogin = false; - SetServerStatusLight((int)LightType.Yellow, true); + SetServerStatusLight(LightType.Yellow, true); SetButtonEnableIfLogon(false, ClientState.WaitLogin); LogoutAccount(); if (objs != null && objs.Length > 0) @@ -211,10 +213,19 @@ namespace Milimoe.FunGame.Desktop.UI { RoomList.Items.Clear(); Rooms.Clear(); - Rooms.AddRooms((List)objs[0]); - foreach (string roomid in Rooms.ListRoomID) + List list = (List)objs[0]; + Rooms.AddRooms(list); + foreach (Room r in list) { - if (roomid != "-1") RoomList.Items.Add(roomid); + if (r.Roomid != "-1") + { + string item = r.Roomid; + if (r.Name.Trim() != "") + { + item += " [ " + r.Name + " ]"; + } + RoomList.Items.Add(item); + } } } break; @@ -432,6 +443,8 @@ namespace Milimoe.FunGame.Desktop.UI RoomSetting.Visible = true; NowRoomID.Visible = true; CopyRoomID.Visible = true; + // 禁用和激活按钮,并切换预设快捷消息 + SetButtonEnableIfLogon(true, ClientState.InRoom); } /// @@ -444,10 +457,6 @@ namespace Milimoe.FunGame.Desktop.UI { switch (status) { - case ClientState.Online: - PresetText.Items.Clear(); - PresetText.Items.AddRange(Constant.PresetOnineItems); - break; case ClientState.WaitConnect: PresetText.Items.Clear(); PresetText.Items.AddRange(Constant.PresetNoConnectItems); @@ -456,11 +465,16 @@ namespace Milimoe.FunGame.Desktop.UI PresetText.Items.Clear(); PresetText.Items.AddRange(Constant.PresetNoLoginItems); break; + case ClientState.Online: + PresetText.Items.Clear(); + PresetText.Items.AddRange(Constant.PresetOnlineItems); + break; + case ClientState.InRoom: + PresetText.Items.Clear(); + PresetText.Items.AddRange(Constant.PresetInRoomItems); + break; } this.PresetText.SelectedIndex = 0; - CheckMix.Enabled = isLogon; - CheckTeam.Enabled = isLogon; - CheckHasPass.Enabled = isLogon; StartMatch.Enabled = isLogon; AccountSetting.Enabled = isLogon; Stock.Enabled = isLogon; @@ -471,6 +485,9 @@ namespace Milimoe.FunGame.Desktop.UI RoomBox.Enabled = isLogon; CreateRoom.Enabled = isLogon; RefreshRoomList.Enabled = isLogon; + CheckMix.Enabled = isLogon; + CheckTeam.Enabled = isLogon; + CheckHasPass.Enabled = isLogon; } } @@ -810,19 +827,19 @@ namespace Milimoe.FunGame.Desktop.UI /// /// /// - private void SetServerStatusLight(int light, bool waitlogin = false, int ping = 0) + private void SetServerStatusLight(LightType light, bool waitlogin = false, int ping = 0) { switch (light) { - case (int)LightType.Green: + case LightType.Green: Connection.Text = "服务器连接成功"; this.Light.Image = Properties.Resources.green; break; - case (int)LightType.Yellow: + case LightType.Yellow: Connection.Text = waitlogin ? "等待登录账号" : "等待连接服务器"; this.Light.Image = Properties.Resources.yellow; break; - case (int)LightType.Red: + case LightType.Red: default: Connection.Text = "服务器连接失败"; this.Light.Image = Properties.Resources.red; @@ -1335,8 +1352,6 @@ namespace Milimoe.FunGame.Desktop.UI /// private void SucceedCreateRoomEvent(object sender, RoomEventArgs e) { - SetRoomid(e.Room); - InRoom(); WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 创建" + e.RoomTypeString + "房间"); WritelnGameInfo(">> 创建" + e.RoomTypeString + "房间成功!房间号: " + e.RoomID); ShowMessage(ShowMessageType.General, "创建" + e.RoomTypeString + "房间成功!\n房间号是 -> [ " + e.RoomID + " ]", "创建成功"); @@ -1384,12 +1399,65 @@ namespace Milimoe.FunGame.Desktop.UI GameInfo.Clear(); break; case Constant.FunGame_CreateMix: - TaskUtility.NewTask(() => CreateRoom_Handler(GameMode.Mix)); + if (Usercfg.InRoom.Roomid == "-1") + { + TaskUtility.NewTask(() => CreateRoom_Handler(GameMode.Mix)); + } + else WritelnGameInfo(">> 先退出当前房间才可以创建房间。"); break; case Constant.FunGame_CreateTeam: - TaskUtility.NewTask(() => CreateRoom_Handler(GameMode.Team)); + if (Usercfg.InRoom.Roomid == "-1") + { + TaskUtility.NewTask(() => CreateRoom_Handler(GameMode.Team)); + } + else WritelnGameInfo(">> 先退出当前房间才可以创建房间。"); + break; + case Constant.FunGame_Ready: + case ".r": + case ".ready": + if (MainController != null) + { + if (Usercfg.InRoom.Roomid != "-1") + { + TaskUtility.NewTask(async () => + { + if (await MainController.SetReadyAsync(Usercfg.InRoom.Roomid)) + { + await InvokeController_SendTalk(" [ " + Usercfg.LoginUser.Username + " ] 已准备。"); + } + }); + } + else WritelnGameInfo(">> 不在房间中无法使用此命令。"); + } + break; + case Constant.FunGame_CancelReady: + case ".cr": + case ".ready -c": + case ".cancelready": + if (MainController != null) + { + if (Usercfg.InRoom.Roomid != "-1") + { + TaskUtility.NewTask(async () => + { + if (await MainController.CancelReadyAsync(Usercfg.InRoom.Roomid)) + { + await InvokeController_SendTalk(" [ " + Usercfg.LoginUser.Username + " ] 已取消准备。"); + } + }); + } + else WritelnGameInfo(">> 不在房间中无法使用此命令。"); + } break; case Constant.FunGame_StartGame: + if (MainController != null) + { + if (Usercfg.InRoom.Roomid != "-1") + { + TaskUtility.NewTask(async () => await InvokeController_StartGame(Usercfg.InRoom.Roomid, Usercfg.InRoom.RoomMaster?.Id == Usercfg.LoginUser.Id)); + } + else WritelnGameInfo(">> 不在房间中无法使用此命令。"); + } break; case Constant.FunGame_AutoRetryOn: WritelnGameInfo(">> 自动重连开启"); @@ -1438,38 +1506,41 @@ namespace Milimoe.FunGame.Desktop.UI } break; case Constant.FunGame_ConnectTo: - string msg = ShowInputMessage("请输入服务器IP地址和端口号,如: 127.0.0.1:22222。", "连接指定服务器"); - if (msg.Equals("")) return true; - string[] addr = msg.Split(':'); - string ip; - int port; - if (addr.Length < 2) + if (!Config.FunGame_isConnected) { - ip = addr[0]; - port = 22222; + string msg = ShowInputMessage("请输入服务器IP地址和端口号,如: 127.0.0.1:22222。", "连接指定服务器"); + if (msg.Equals("")) return true; + string[] addr = msg.Split(':'); + string ip; + int port; + if (addr.Length < 2) + { + ip = addr[0]; + port = 22222; + } + else if (addr.Length < 3) + { + ip = addr[0]; + port = Convert.ToInt32(addr[1]); + } + else + { + ShowMessage(ShowMessageType.Error, "格式错误!\n这不是一个服务器地址。"); + return true; + } + ErrorIPAddressType ErrorType = NetworkUtility.IsServerAddress(ip, port); + if (ErrorType == ErrorIPAddressType.None) + { + RunTime.Session.Server_IP = ip; + RunTime.Session.Server_Port = port; + CurrentRetryTimes = -1; + Config.FunGame_isAutoRetry = true; + InvokeController_Connect(); + } + else if (ErrorType == ErrorIPAddressType.IsNotIP) ShowMessage(ShowMessageType.Error, "这不是一个IP地址!"); + else if (ErrorType == ErrorIPAddressType.IsNotPort) ShowMessage(ShowMessageType.Error, "这不是一个端口号!\n正确范围:1~65535"); + else ShowMessage(ShowMessageType.Error, "格式错误!\n这不是一个服务器地址。"); } - else if (addr.Length < 3) - { - ip = addr[0]; - port = Convert.ToInt32(addr[1]); - } - else - { - ShowMessage(ShowMessageType.Error, "格式错误!\n这不是一个服务器地址。"); - return true; - } - ErrorIPAddressType ErrorType = NetworkUtility.IsServerAddress(ip, port); - if (ErrorType == ErrorIPAddressType.None) - { - RunTime.Session.Server_IP = ip; - RunTime.Session.Server_Port = port; - CurrentRetryTimes = -1; - Config.FunGame_isAutoRetry = true; - InvokeController_Connect(); - } - else if (ErrorType == ErrorIPAddressType.IsNotIP) ShowMessage(ShowMessageType.Error, "这不是一个IP地址!"); - else if (ErrorType == ErrorIPAddressType.IsNotPort) ShowMessage(ShowMessageType.Error, "这不是一个端口号!\n正确范围:1~65535"); - else ShowMessage(ShowMessageType.Error, "格式错误!\n这不是一个服务器地址。"); break; default: break; @@ -1725,6 +1796,8 @@ namespace Milimoe.FunGame.Desktop.UI { OnSucceedQuitRoomEvent(this, EventArgs); RunTime.PluginLoader?.OnSucceedQuitRoomEvent(this, EventArgs); + // 禁用和激活按钮,并切换预设快捷消息 + SetButtonEnableIfLogon(true, ClientState.Online); } else { @@ -1741,6 +1814,8 @@ namespace Milimoe.FunGame.Desktop.UI RunTime.PluginLoader?.OnFailedQuitRoomEvent(this, EventArgs); OnAfterQuitRoomEvent(this, EventArgs); RunTime.PluginLoader?.OnAfterQuitRoomEvent(this, EventArgs); + // 禁用和激活按钮,并切换预设快捷消息 + SetButtonEnableIfLogon(true, ClientState.Online); } return result; @@ -1796,6 +1871,50 @@ namespace Milimoe.FunGame.Desktop.UI return result; } + /// + /// 开始游戏/提醒玩家准备/提醒房主开始游戏 + /// + /// + /// + /// + public async Task InvokeController_StartGame(string roomid, bool isMaster) + { + GeneralEventArgs EventArgs = new(); + bool result = false; + + try + { + OnBeforeStartGameEvent(this, EventArgs); + RunTime.PluginLoader?.OnBeforeStartGameEvent(this, EventArgs); + if (EventArgs.Cancel) return result; + + result = MainController is not null && await MainController.StartGameAsync(roomid, isMaster); + + if (result) + { + OnSucceedStartGameEvent(this, EventArgs); + RunTime.PluginLoader?.OnSucceedStartGameEvent(this, EventArgs); + } + else + { + OnFailedStartGameEvent(this, EventArgs); + RunTime.PluginLoader?.OnFailedStartGameEvent(this, EventArgs); + } + OnAfterStartGameEvent(this, EventArgs); + RunTime.PluginLoader?.OnAfterStartGameEvent(this, EventArgs); + } + catch (Exception e) + { + GetMessage(e.GetErrorInfo(), TimeType.None); + OnFailedStartGameEvent(this, EventArgs); + RunTime.PluginLoader?.OnFailedStartGameEvent(this, EventArgs); + OnAfterStartGameEvent(this, EventArgs); + RunTime.PluginLoader?.OnAfterStartGameEvent(this, EventArgs); + } + + return result; + } + #endregion } } \ No newline at end of file