mirror of
https://github.com/project-redbud/FunGame-Desktop.git
synced 2025-04-22 13:09:35 +08:00
parent
841ab3b3d1
commit
2cdf40f556
@ -1,10 +1,11 @@
|
|||||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||||
|
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using Milimoe.FunGame.Desktop.Model;
|
|
||||||
using Milimoe.FunGame.Desktop.UI;
|
|
||||||
using Milimoe.FunGame.Core.Library.Exception;
|
using Milimoe.FunGame.Core.Library.Exception;
|
||||||
using Milimoe.FunGame.Desktop.Library;
|
using Milimoe.FunGame.Desktop.Library;
|
||||||
|
using Milimoe.FunGame.Desktop.Model;
|
||||||
|
using Milimoe.FunGame.Desktop.UI;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Controller
|
namespace Milimoe.FunGame.Desktop.Controller
|
||||||
{
|
{
|
||||||
@ -33,9 +34,11 @@ namespace Milimoe.FunGame.Desktop.Controller
|
|||||||
GeneralEventArgs EventArgs = new();
|
GeneralEventArgs EventArgs = new();
|
||||||
if (Main.OnBeforeLogoutEvent(EventArgs) == EventResult.Fail) return result;
|
if (Main.OnBeforeLogoutEvent(EventArgs) == EventResult.Fail) return result;
|
||||||
|
|
||||||
if (Config.FunGame_Roomid != "-1")
|
if (Usercfg.LoginUser is null) return result;
|
||||||
|
|
||||||
|
if (Usercfg.InRoom.Roomid != "-1")
|
||||||
{
|
{
|
||||||
await MainModel.QuitRoom(Config.FunGame_Roomid);
|
await MainModel.QuitRoom(Usercfg.InRoom.Roomid);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = await MainModel.LogOut();
|
result = await MainModel.LogOut();
|
||||||
@ -57,16 +60,16 @@ namespace Milimoe.FunGame.Desktop.Controller
|
|||||||
return await MainModel.UpdateRoom();
|
return await MainModel.UpdateRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> IntoRoom(string roomid)
|
public async Task<bool> IntoRoom(Room room)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RoomEventArgs EventArgs = new(roomid);
|
RoomEventArgs EventArgs = new(room);
|
||||||
if (Main.OnBeforeIntoRoomEvent(EventArgs) == EventResult.Fail) return result;
|
if (Main.OnBeforeIntoRoomEvent(EventArgs) == EventResult.Fail) return result;
|
||||||
|
|
||||||
result = await MainModel.IntoRoom(roomid);
|
result = await MainModel.IntoRoom(room);
|
||||||
|
|
||||||
if (result) Main.OnSucceedIntoRoomEvent(EventArgs);
|
if (result) Main.OnSucceedIntoRoomEvent(EventArgs);
|
||||||
else Main.OnFailedIntoRoomEvent(EventArgs);
|
else Main.OnFailedIntoRoomEvent(EventArgs);
|
||||||
@ -80,13 +83,14 @@ namespace Milimoe.FunGame.Desktop.Controller
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> QuitRoom(string roomid)
|
public async Task<bool> QuitRoom(Room room)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
string roomid = room.Roomid;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RoomEventArgs EventArgs = new(roomid);
|
RoomEventArgs EventArgs = new(room);
|
||||||
if (Main.OnBeforeQuitRoomEvent(EventArgs) == EventResult.Fail) return result;
|
if (Main.OnBeforeQuitRoomEvent(EventArgs) == EventResult.Fail) return result;
|
||||||
|
|
||||||
result = await MainModel.QuitRoom(roomid);
|
result = await MainModel.QuitRoom(roomid);
|
||||||
@ -109,7 +113,7 @@ namespace Milimoe.FunGame.Desktop.Controller
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RoomEventArgs EventArgs = new();
|
RoomEventArgs EventArgs = new(RoomType, Password);
|
||||||
if (Main.OnBeforeCreateRoomEvent(EventArgs) == EventResult.Fail) return result;
|
if (Main.OnBeforeCreateRoomEvent(EventArgs) == EventResult.Fail) return result;
|
||||||
|
|
||||||
result = await MainModel.CreateRoom(RoomType, Password);
|
result = await MainModel.CreateRoom(RoomType, Password);
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
public static bool Match_Mix { get; set; } = false; // 混战模式选项
|
public static bool Match_Mix { get; set; } = false; // 混战模式选项
|
||||||
public static bool Match_Team { get; set; } = false; // 团队模式选项
|
public static bool Match_Team { get; set; } = false; // 团队模式选项
|
||||||
public static bool Match_HasPass { get; set; } = false; // 密码房间选项
|
public static bool Match_HasPass { get; set; } = false; // 密码房间选项
|
||||||
public static string FunGame_Roomid { get; set; } = "-1"; // 房间号
|
|
||||||
public static string FunGame_ServerName { get; set; } = ""; // 服务器名称
|
public static string FunGame_ServerName { get; set; } = ""; // 服务器名称
|
||||||
public static string FunGame_Notice { get; set; } = ""; // 公告
|
public static string FunGame_Notice { get; set; } = ""; // 公告
|
||||||
public static string FunGame_AutoLoginUser { get; set; } = ""; // 自动登录的账号
|
public static string FunGame_AutoLoginUser { get; set; } = ""; // 自动登录的账号
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Milimoe.FunGame.Core.Entity;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Library
|
namespace Milimoe.FunGame.Desktop.Library
|
||||||
{
|
{
|
||||||
@ -9,5 +10,6 @@ namespace Milimoe.FunGame.Desktop.Library
|
|||||||
*/
|
*/
|
||||||
public static User? LoginUser { get; set; } = null; // 已登录的用户
|
public static User? LoginUser { get; set; } = null; // 已登录的用户
|
||||||
public static string LoginUserName { get; set; } = ""; // 已登录用户名
|
public static string LoginUserName { get; set; } = ""; // 已登录用户名
|
||||||
|
public static Room InRoom { get; set; } = General.HallInstance; // 所处的房间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
using System.Collections;
|
||||||
|
using System.Data;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
@ -6,8 +8,6 @@ using Milimoe.FunGame.Core.Library.Exception;
|
|||||||
using Milimoe.FunGame.Desktop.Library;
|
using Milimoe.FunGame.Desktop.Library;
|
||||||
using Milimoe.FunGame.Desktop.Library.Component;
|
using Milimoe.FunGame.Desktop.Library.Component;
|
||||||
using Milimoe.FunGame.Desktop.UI;
|
using Milimoe.FunGame.Desktop.UI;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Model
|
namespace Milimoe.FunGame.Desktop.Model
|
||||||
{
|
{
|
||||||
@ -53,21 +53,21 @@ namespace Milimoe.FunGame.Desktop.Model
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> IntoRoom(string roomid)
|
public async Task<bool> IntoRoom(Room room)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetWorking();
|
SetWorking();
|
||||||
if (RunTime.Socket?.Send(SocketMessageType.IntoRoom, roomid) == SocketResult.Success)
|
if (RunTime.Socket?.Send(SocketMessageType.IntoRoom, room.Roomid) == SocketResult.Success)
|
||||||
{
|
{
|
||||||
roomid = await Task.Factory.StartNew(SocketHandler_IntoRoom);
|
string roomid = await Task.Factory.StartNew(SocketHandler_IntoRoom);
|
||||||
if (roomid.Trim() != "" && roomid == "-1")
|
if (roomid.Trim() != "" && roomid == "-1")
|
||||||
{
|
{
|
||||||
Main.GetMessage($"已连接至公共聊天室。");
|
Main.GetMessage($"已连接至公共聊天室。");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Config.FunGame_Roomid = roomid;
|
Usercfg.InRoom = room;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ namespace Milimoe.FunGame.Desktop.Model
|
|||||||
SetWorking();
|
SetWorking();
|
||||||
if (RunTime.Socket?.Send(SocketMessageType.UpdateRoom) == SocketResult.Success)
|
if (RunTime.Socket?.Send(SocketMessageType.UpdateRoom) == SocketResult.Success)
|
||||||
{
|
{
|
||||||
List<string> list = await Task.Factory.StartNew(SocketHandler_UpdateRoom);
|
Hashtable list = await Task.Factory.StartNew(SocketHandler_UpdateRoom);
|
||||||
Main.UpdateUI(MainInvokeType.UpdateRoom, list);
|
Main.UpdateUI(MainInvokeType.UpdateRoom, list);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ namespace Milimoe.FunGame.Desktop.Model
|
|||||||
result = await Task.Factory.StartNew(SocketHandler_QuitRoom);
|
result = await Task.Factory.StartNew(SocketHandler_QuitRoom);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Config.FunGame_Roomid = "-1";
|
Usercfg.InRoom = General.HallInstance;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,20 +283,30 @@ namespace Milimoe.FunGame.Desktop.Model
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> SocketHandler_UpdateRoom()
|
private Hashtable SocketHandler_UpdateRoom()
|
||||||
{
|
{
|
||||||
List<string>? list = null;
|
Hashtable table = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WaitForWorkDone();
|
WaitForWorkDone();
|
||||||
if (Work.Length > 0) list = Work.GetParam<List<string>>(0);
|
DataSet? DsRoom = new(), DsUser = new();
|
||||||
|
if (Work.Length > 0) DsRoom = Work.GetParam<DataSet>(0);
|
||||||
|
if (Work.Length > 1) DsUser = Work.GetParam<DataSet>(1);
|
||||||
|
if (DsRoom != null && DsUser != null)
|
||||||
|
{
|
||||||
|
List<Room> list = Core.Api.Utility.Factory.GetList<Room>(DsRoom, DsUser);
|
||||||
|
table.Add(General.HallInstance.Roomid, General.HallInstance);
|
||||||
|
foreach (Room room in list)
|
||||||
|
{
|
||||||
|
table.Add(room.Roomid, room);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Main.GetMessage(e.GetErrorInfo());
|
Main.GetMessage(e.GetErrorInfo());
|
||||||
}
|
}
|
||||||
list ??= new List<string>();
|
return table;
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Milimoe.FunGame.Core.Api.Utility;
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
using Milimoe.FunGame.Core.Entity;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
@ -8,7 +9,6 @@ using Milimoe.FunGame.Desktop.Controller;
|
|||||||
using Milimoe.FunGame.Desktop.Library;
|
using Milimoe.FunGame.Desktop.Library;
|
||||||
using Milimoe.FunGame.Desktop.Library.Base;
|
using Milimoe.FunGame.Desktop.Library.Base;
|
||||||
using Milimoe.FunGame.Desktop.Library.Component;
|
using Milimoe.FunGame.Desktop.Library.Component;
|
||||||
using Milimoe.FunGame.Desktop.Model;
|
|
||||||
using Milimoe.FunGame.Desktop.Utility;
|
using Milimoe.FunGame.Desktop.Utility;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.UI
|
namespace Milimoe.FunGame.Desktop.UI
|
||||||
@ -29,6 +29,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
*/
|
*/
|
||||||
private Task? MatchFunGame = null; // 匹配线程
|
private Task? MatchFunGame = null; // 匹配线程
|
||||||
private MainController? MainController = null;
|
private MainController? MainController = null;
|
||||||
|
private Hashtable Rooms = new();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 委托【即将删除】
|
* 委托【即将删除】
|
||||||
@ -48,7 +49,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
RunTime.Main = this;
|
RunTime.Main = this;
|
||||||
SetButtonEnableIfLogon(false, ClientState.WaitConnect);
|
SetButtonEnableIfLogon(false, ClientState.WaitConnect);
|
||||||
SetRoomid("-1"); // 房间号初始化
|
SetRoomid(Usercfg.InRoom); // 房间号初始化
|
||||||
ShowFunGameInfo(); // 显示FunGame信息
|
ShowFunGameInfo(); // 显示FunGame信息
|
||||||
GetFunGameConfig(); // 获取FunGame配置
|
GetFunGameConfig(); // 获取FunGame配置
|
||||||
// 创建RunTime
|
// 创建RunTime
|
||||||
@ -205,8 +206,11 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
if (objs != null && objs.Length > 0)
|
if (objs != null && objs.Length > 0)
|
||||||
{
|
{
|
||||||
RoomList.Items.Clear();
|
RoomList.Items.Clear();
|
||||||
List<string> list = (List<string>)objs[0];
|
Rooms = (Hashtable)objs[0];
|
||||||
RoomList.Items.AddRange(list.ToArray());
|
foreach (string roomid in Rooms.Keys)
|
||||||
|
{
|
||||||
|
if (roomid != "-1") RoomList.Items.Add(roomid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -315,14 +319,14 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// 设置房间号和显示信息
|
/// 设置房间号和显示信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomid"></param>
|
/// <param name="roomid"></param>
|
||||||
private void SetRoomid(string roomid)
|
private void SetRoomid(Room room)
|
||||||
{
|
{
|
||||||
Config.FunGame_Roomid = roomid;
|
Usercfg.InRoom = room;
|
||||||
if (!roomid.Equals("-1"))
|
if (room.Roomid != "-1")
|
||||||
{
|
{
|
||||||
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 加入房间");
|
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 加入房间");
|
||||||
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已加入房间 -> [ " + Config.FunGame_Roomid + " ]");
|
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已加入房间 -> [ " + room.Roomid + " ]");
|
||||||
Room.Text = "[ 当前房间 ]\n" + Convert.ToString(Config.FunGame_Roomid);
|
Room.Text = "[ 当前房间 ]\n" + Convert.ToString(room.Roomid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Room.Text = "暂未进入房间";
|
Room.Text = "暂未进入房间";
|
||||||
@ -383,7 +387,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
// 显示:匹配、创建房间
|
// 显示:匹配、创建房间
|
||||||
// 隐藏:退出房间、房间设定
|
// 隐藏:退出房间、房间设定
|
||||||
SetRoomid("-1");
|
SetRoomid(Usercfg.InRoom);
|
||||||
QuitRoom.Visible = false;
|
QuitRoom.Visible = false;
|
||||||
StartMatch.Visible = true;
|
StartMatch.Visible = true;
|
||||||
RoomSetting.Visible = false;
|
RoomSetting.Visible = false;
|
||||||
@ -478,17 +482,19 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
await MainController.UpdateRoom();
|
await MainController.UpdateRoom();
|
||||||
if (CheckRoomIDExist(roomid))
|
if (CheckRoomIDExist(roomid))
|
||||||
{
|
{
|
||||||
if (Config.FunGame_Roomid.Equals("-1"))
|
if (Usercfg.InRoom.Roomid == "-1")
|
||||||
{
|
{
|
||||||
if (ShowMessage.YesNoMessage("已找到房间 -> [ " + roomid + " ]\n是否加入?", "已找到房间") == MessageResult.Yes)
|
if (ShowMessage.YesNoMessage("已找到房间 -> [ " + roomid + " ]\n是否加入?", "已找到房间") == MessageResult.Yes)
|
||||||
{
|
{
|
||||||
if (MainController != null && await MainController.IntoRoom(roomid))
|
Room r = GetRoom(roomid);
|
||||||
|
if (MainController != null && await MainController.IntoRoom(r))
|
||||||
{
|
{
|
||||||
SetRoomid(roomid);
|
SetRoomid(r);
|
||||||
InRoom();
|
InRoom();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -552,7 +558,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 匹配成功");
|
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 匹配成功");
|
||||||
WritelnGameInfo(">> 房间号: " + roomid);
|
WritelnGameInfo(">> 房间号: " + roomid);
|
||||||
SetRoomid(roomid);
|
SetRoomid(GetRoom(roomid));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -709,17 +715,20 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task CreateRoom_Handler(string RoomType, string Password = "")
|
private async Task CreateRoom_Handler(string RoomType, string Password = "")
|
||||||
{
|
{
|
||||||
if (Config.FunGame_Roomid != "-1")
|
if (Usercfg.InRoom.Roomid != "-1")
|
||||||
{
|
{
|
||||||
ShowMessage.WarningMessage("已在房间中,无法创建房间。");
|
ShowMessage.WarningMessage("已在房间中,无法创建房间。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MainController != null)
|
if (MainController != null)
|
||||||
{
|
{
|
||||||
string roomid = (await MainController.CreateRoom(RoomType)).Trim();
|
string roomid = (await MainController.CreateRoom(RoomType, Password)).Trim();
|
||||||
if (roomid != "" && roomid != "-1" && await MainController.IntoRoom(roomid))
|
if (roomid != "" && roomid != "-1")
|
||||||
{
|
{
|
||||||
SetRoomid(roomid);
|
await MainController.UpdateRoom();
|
||||||
|
Room r = GetRoom(roomid);
|
||||||
|
await MainController.IntoRoom(r);
|
||||||
|
SetRoomid(r);
|
||||||
InRoom();
|
InRoom();
|
||||||
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 创建" + RoomType + "房间");
|
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 创建" + RoomType + "房间");
|
||||||
WritelnGameInfo(">> 创建" + RoomType + "房间成功!房间号: " + roomid);
|
WritelnGameInfo(">> 创建" + RoomType + "房间成功!房间号: " + roomid);
|
||||||
@ -759,10 +768,10 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
if (MainController != null)
|
if (MainController != null)
|
||||||
{
|
{
|
||||||
// 接入-1号房间聊天室
|
|
||||||
await MainController.IntoRoom("-1");
|
|
||||||
// 获取在线的房间列表
|
// 获取在线的房间列表
|
||||||
await MainController.UpdateRoom();
|
await MainController.UpdateRoom();
|
||||||
|
// 接入-1号房间聊天室
|
||||||
|
await MainController.IntoRoom((Room)Rooms["-1"]!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,9 +834,14 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退出游戏时处理
|
/// 退出游戏时处理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ExitFunGame()
|
private async Task ExitFunGame()
|
||||||
{
|
{
|
||||||
|
if (ShowMessage.OKCancelMessage("你确定关闭游戏?", "退出") == (int)MessageResult.OK)
|
||||||
|
{
|
||||||
|
if (MainController != null) await MainController.LogOut();
|
||||||
|
RunTime.Connector?.Close();
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -839,14 +853,9 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Exit_Click(object sender, EventArgs e)
|
private async void Exit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ShowMessage.OKCancelMessage("你确定关闭游戏?", "退出") == (int)MessageResult.OK)
|
await ExitFunGame();
|
||||||
{
|
|
||||||
_ = MainController?.LogOut();
|
|
||||||
RunTime.Connector?.Close();
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -937,7 +946,6 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await CreateRoom_Handler(roomtype, password);
|
await CreateRoom_Handler(roomtype, password);
|
||||||
_ = MainController?.UpdateRoom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -949,8 +957,8 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
if (MainController != null)
|
if (MainController != null)
|
||||||
{
|
{
|
||||||
string roomid = Config.FunGame_Roomid;
|
string roomid = Usercfg.InRoom.Roomid;
|
||||||
if (await MainController.QuitRoom(roomid))
|
if (await MainController.QuitRoom(Usercfg.InRoom))
|
||||||
{
|
{
|
||||||
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 离开房间");
|
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 离开房间");
|
||||||
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已离开房间 -> [ " + roomid + " ]");
|
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已离开房间 -> [ " + roomid + " ]");
|
||||||
@ -1256,16 +1264,17 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomid"></param>
|
/// <param name="roomid"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool CheckRoomIDExist(string roomid)
|
private bool CheckRoomIDExist(string roomid) => Rooms.ContainsKey(roomid);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取房间对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roomid">房间号</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private Room GetRoom(string roomid)
|
||||||
{
|
{
|
||||||
foreach (string BoxText in RoomList.Items)
|
Room? r = (Room?)Rooms[roomid];
|
||||||
{
|
return r ?? General.HallInstance;
|
||||||
if (roomid.Equals(BoxText))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user