修改MainUI,添加Gaming接口 (#25)

* 添加Gaming接口

* 修改MainUI,预留了Gaming的相关接口

* Fix: ConnectEventArgs的参数不正确

* 新的AddonController构造方法

* 完善MainUI:添加了房间类型、模组、地图选择框

---------

Co-authored-by: yeziuku <yezi@wrss.org>
This commit is contained in:
milimoe 2023-12-11 01:11:03 +08:00 committed by GitHub
parent 54ca623c7f
commit 21ffa8dfa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 473 additions and 264 deletions

View File

@ -9,7 +9,7 @@ using Milimoe.FunGame.Desktop.UI;
namespace Milimoe.FunGame.Desktop.Controller namespace Milimoe.FunGame.Desktop.Controller
{ {
public class MainController(Main main) public class MainController(Main Main)
{ {
private readonly Session Usercfg = RunTime.Session; private readonly Session Usercfg = RunTime.Session;
private readonly DataRequest ChatRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_Chat); private readonly DataRequest ChatRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_Chat);
@ -19,6 +19,8 @@ namespace Milimoe.FunGame.Desktop.Controller
private readonly DataRequest UpdateRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_UpdateRoom); private readonly DataRequest UpdateRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_UpdateRoom);
private readonly DataRequest IntoRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_IntoRoom); private readonly DataRequest IntoRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_IntoRoom);
private readonly DataRequest QuitRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_QuitRoom); private readonly DataRequest QuitRoomRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_QuitRoom);
private readonly DataRequest SetReadyRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_Ready);
private readonly DataRequest CancelReadyRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_CancelReady);
private readonly DataRequest StartGameRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_StartGame); private readonly DataRequest StartGameRequest = RunTime.NewLongRunningDataRequest(DataRequestType.Main_StartGame);
#region #region
@ -31,6 +33,8 @@ namespace Milimoe.FunGame.Desktop.Controller
UpdateRoomRequest.Dispose(); UpdateRoomRequest.Dispose();
IntoRoomRequest.Dispose(); IntoRoomRequest.Dispose();
QuitRoomRequest.Dispose(); QuitRoomRequest.Dispose();
SetReadyRequest.Dispose();
CancelReadyRequest.Dispose();
StartGameRequest.Dispose(); StartGameRequest.Dispose();
} }
@ -53,7 +57,7 @@ namespace Milimoe.FunGame.Desktop.Controller
if (key == Usercfg.LoginKey) if (key == Usercfg.LoginKey)
{ {
Usercfg.LoginKey = Guid.Empty; Usercfg.LoginKey = Guid.Empty;
main.UpdateUI(MainInvokeType.LogOut, msg ?? ""); Main.UpdateUI(MainInvokeType.LogOut, msg ?? "");
return true; return true;
} }
} }
@ -62,8 +66,8 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.ShowMessage(ShowMessageType.Error, "无法登出您的账号,请联系服务器管理员。", "登出失败", 5); Main.ShowMessage(ShowMessageType.Error, "无法登出您的账号,请联系服务器管理员。", "登出失败", 5);
main.GetMessage(e.GetErrorInfo()); Main.GetMessage(e.GetErrorInfo());
} }
return false; return false;
} }
@ -82,7 +86,7 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
return false; return false;
} }
} }
@ -98,13 +102,13 @@ namespace Milimoe.FunGame.Desktop.Controller
if (UpdateRoomRequest.Result == RequestResult.Success) if (UpdateRoomRequest.Result == RequestResult.Success)
{ {
list = UpdateRoomRequest.GetResult<List<Room>>("rooms") ?? new(); list = UpdateRoomRequest.GetResult<List<Room>>("rooms") ?? new();
main.UpdateUI(MainInvokeType.UpdateRoom, list); Main.UpdateUI(MainInvokeType.UpdateRoom, list);
} }
else throw new CanNotIntoRoomException(); else throw new CanNotIntoRoomException();
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
} }
return result; return result;
@ -120,7 +124,7 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
return 0; return 0;
} }
} }
@ -131,28 +135,26 @@ namespace Milimoe.FunGame.Desktop.Controller
{ {
bool result = true; bool result = true;
DataRequest request = RunTime.NewDataRequest(DataRequestType.Main_Ready); SetReadyRequest.AddRequestData("roomid", roomid);
request.AddRequestData("roomid", roomid); await SetReadyRequest.SendRequestAsync();
await request.SendRequestAsync(); if (SetReadyRequest.Result == RequestResult.Success)
if (request.Result == RequestResult.Success)
{ {
result = request.GetResult<bool>("result"); result = SetReadyRequest.GetResult<bool>("result");
if (result) if (result)
{ {
Config.FunGame_isInRoom = true; Config.FunGame_isInRoom = true;
main.GetMessage("[ " + Usercfg.LoginUser.Username + " ] 准备完毕。"); Main.GetMessage("[ " + Usercfg.LoginUser.Username + " ] 准备完毕。");
} }
List<User> ReadyPlayerList = request.GetResult<List<User>>("ready") ?? new(); List<User> ReadyPlayerList = SetReadyRequest.GetResult<List<User>>("ready") ?? new();
if (ReadyPlayerList.Count > 0) main.GetMessage("已准备的玩家:" + string.Join(", ", ReadyPlayerList.Select(u => u.Username))); if (ReadyPlayerList.Count > 0) Main.GetMessage("已准备的玩家:" + string.Join(", ", ReadyPlayerList.Select(u => u.Username)));
List<User> NotReadyPlayerList = request.GetResult<List<User>>("notready") ?? new(); List<User> NotReadyPlayerList = SetReadyRequest.GetResult<List<User>>("notready") ?? new();
if (NotReadyPlayerList.Count > 0) main.GetMessage("仍未准备的玩家:" + string.Join(", ", NotReadyPlayerList.Select(u => u.Username))); if (NotReadyPlayerList.Count > 0) Main.GetMessage("仍未准备的玩家:" + string.Join(", ", NotReadyPlayerList.Select(u => u.Username)));
} }
request.Dispose();
return result; return result;
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
return false; return false;
} }
} }
@ -163,28 +165,26 @@ namespace Milimoe.FunGame.Desktop.Controller
{ {
bool result = true; bool result = true;
DataRequest request = RunTime.NewDataRequest(DataRequestType.Main_CancelReady); CancelReadyRequest.AddRequestData("roomid", roomid);
request.AddRequestData("roomid", roomid); await CancelReadyRequest.SendRequestAsync();
await request.SendRequestAsync(); if (CancelReadyRequest.Result == RequestResult.Success)
if (request.Result == RequestResult.Success)
{ {
result = request.GetResult<bool>("result"); result = CancelReadyRequest.GetResult<bool>("result");
if (result) if (result)
{ {
Config.FunGame_isInRoom = false; Config.FunGame_isInRoom = false;
main.GetMessage("[ " + Usercfg.LoginUser.Username + " ] 已取消准备。"); Main.GetMessage("[ " + Usercfg.LoginUser.Username + " ] 已取消准备。");
} }
List<User> ReadyPlayerList = request.GetResult<List<User>>("ready") ?? new(); List<User> ReadyPlayerList = CancelReadyRequest.GetResult<List<User>>("ready") ?? new();
if (ReadyPlayerList.Count > 0) main.GetMessage("已准备的玩家:" + string.Join(", ", ReadyPlayerList.Select(u => u.Username))); if (ReadyPlayerList.Count > 0) Main.GetMessage("已准备的玩家:" + string.Join(", ", ReadyPlayerList.Select(u => u.Username)));
List<User> NotReadyPlayerList = request.GetResult<List<User>>("notready") ?? new(); List<User> NotReadyPlayerList = CancelReadyRequest.GetResult<List<User>>("notready") ?? new();
if (NotReadyPlayerList.Count > 0) main.GetMessage("仍未准备的玩家:" + string.Join(", ", NotReadyPlayerList.Select(u => u.Username))); if (NotReadyPlayerList.Count > 0) Main.GetMessage("仍未准备的玩家:" + string.Join(", ", NotReadyPlayerList.Select(u => u.Username)));
} }
request.Dispose();
return result; return result;
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
return false; return false;
} }
} }
@ -211,12 +211,12 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
return result; return result;
} }
} }
public async Task<Room> CreateRoomAsync(string RoomType, string GameMode, string GameMap, string Password = "") public async Task<Room> CreateRoomAsync(RoomType RoomType, string GameMode, string GameMap, bool IsRank, string Password = "")
{ {
Room room = General.HallInstance; Room room = General.HallInstance;
@ -227,6 +227,7 @@ namespace Milimoe.FunGame.Desktop.Controller
CreateRoomRequest.AddRequestData("gamemap", GameMap); CreateRoomRequest.AddRequestData("gamemap", GameMap);
CreateRoomRequest.AddRequestData("master", Usercfg.LoginUser); CreateRoomRequest.AddRequestData("master", Usercfg.LoginUser);
CreateRoomRequest.AddRequestData("password", Password); CreateRoomRequest.AddRequestData("password", Password);
CreateRoomRequest.AddRequestData("isrank", IsRank);
await CreateRoomRequest.SendRequestAsync(); await CreateRoomRequest.SendRequestAsync();
if (CreateRoomRequest.Result == RequestResult.Success) if (CreateRoomRequest.Result == RequestResult.Success)
{ {
@ -235,13 +236,13 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
} }
return room; return room;
} }
public async Task<bool> MatchRoomAsync(string RoomType, bool isCancel = false) public async Task<bool> MatchRoomAsync(RoomType RoomType, bool isCancel = false)
{ {
bool result = false; bool result = false;
@ -258,7 +259,7 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
} }
return result; return result;
@ -278,7 +279,7 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
return false; return false;
} }
} }
@ -297,7 +298,7 @@ namespace Milimoe.FunGame.Desktop.Controller
} }
catch (Exception e) catch (Exception e)
{ {
main.GetMessage(e.GetErrorInfo(), TimeType.None); Main.GetMessage(e.GetErrorInfo(), TimeType.None);
} }
return false; return false;

View File

@ -28,11 +28,13 @@ namespace Milimoe.FunGame.Desktop.Controller
{ {
try try
{ {
RunTime.PluginLoader = PluginLoader.LoadPlugins( // 构建AddonController
new Action<string>(WritelnSystemInfo), Hashtable delegates = [];
new Func<DataRequestType, DataRequest>(NewDataRequest), delegates.Add("WriteLine", new Action<string>(WritelnSystemInfo));
new Func<DataRequestType, DataRequest>(NewLongRunningDataRequest), delegates.Add("Error", new Action<Exception>(Error));
RunTime.Session, RunTime.Config); delegates.Add("NewDataRequest", new Func<DataRequestType, DataRequest>(NewDataRequest));
delegates.Add("NewLongRunningDataRequest", new Func<DataRequestType, DataRequest>(NewLongRunningDataRequest));
RunTime.PluginLoader = PluginLoader.LoadPlugins( delegates, RunTime.Session, RunTime.Config);
foreach (string name in RunTime.PluginLoader.Plugins.Keys) foreach (string name in RunTime.PluginLoader.Plugins.Keys)
{ {
Main.GetMessage("[ Plugin ] Loaded: " + name); Main.GetMessage("[ Plugin ] Loaded: " + name);
@ -48,11 +50,13 @@ namespace Milimoe.FunGame.Desktop.Controller
{ {
try try
{ {
RunTime.GameModeLoader = GameModeLoader.LoadGameModes( // 构建AddonController
new Action<string>(WritelnSystemInfo), Hashtable delegates = [];
new Func<DataRequestType, DataRequest>(NewDataRequest), delegates.Add("WriteLine", new Action<string>(WritelnSystemInfo));
new Func<DataRequestType, DataRequest>(NewLongRunningDataRequest), delegates.Add("Error", new Action<Exception>(Error));
RunTime.Session, RunTime.Config); delegates.Add("NewDataRequest", new Func<DataRequestType, DataRequest>(NewDataRequest));
delegates.Add("NewLongRunningDataRequest", new Func<DataRequestType, DataRequest>(NewLongRunningDataRequest));
RunTime.GameModeLoader = GameModeLoader.LoadGameModes(Constant.FunGameType, delegates, RunTime.Session, RunTime.Config);
foreach (string name in RunTime.GameModeLoader.Modes.Keys) foreach (string name in RunTime.GameModeLoader.Modes.Keys)
{ {
Main.GetMessage("[ GameMode ] Loaded: " + name); Main.GetMessage("[ GameMode ] Loaded: " + name);
@ -88,7 +92,7 @@ namespace Milimoe.FunGame.Desktop.Controller
string[] gamemodes = []; string[] gamemodes = [];
if (RunTime.GameModeLoader != null) if (RunTime.GameModeLoader != null)
{ {
gamemodes = RunTime.GameModeLoader.Modes.Keys.ToArray(); gamemodes = [.. RunTime.GameModeLoader.Modes.Keys];
} }
ConnectArgs.Add(gamemodes); // 服务器检查是否拥有需要的模组 ConnectArgs.Add(gamemodes); // 服务器检查是否拥有需要的模组
ConnectArgs.Add(FunGameInfo.FunGame_DebugMode); // 是否开启了debug模式 ConnectArgs.Add(FunGameInfo.FunGame_DebugMode); // 是否开启了debug模式
@ -270,7 +274,7 @@ namespace Milimoe.FunGame.Desktop.Controller
protected override void SocketHandler_EndGame(SocketObject ServerMessage) protected override void SocketHandler_EndGame(SocketObject ServerMessage)
{ {
Room room = General.HallInstance; Room room = General.HallInstance;
List<User> users = new(); List<User> users = [];
if (ServerMessage.Length > 0) room = ServerMessage.GetParam<Room>(0) ?? General.HallInstance; if (ServerMessage.Length > 0) room = ServerMessage.GetParam<Room>(0) ?? General.HallInstance;
if (ServerMessage.Length > 1) users = ServerMessage.GetParam<List<User>>(1) ?? users; if (ServerMessage.Length > 1) users = ServerMessage.GetParam<List<User>>(1) ?? users;
Main.UpdateUI(MainInvokeType.EndGame, room, users); Main.UpdateUI(MainInvokeType.EndGame, room, users);
@ -278,7 +282,11 @@ namespace Milimoe.FunGame.Desktop.Controller
protected override void SocketHandler_Gaming(SocketObject ServerMessage) protected override void SocketHandler_Gaming(SocketObject ServerMessage)
{ {
GamingType gamingtype = GamingType.None;
Hashtable data = [];
if (ServerMessage.Length > 0) gamingtype = ServerMessage.GetParam<GamingType>(0);
if (ServerMessage.Length > 1) data = ServerMessage.GetParam<Hashtable>(1) ?? data;
RunTime.Gaming?.GamingHandler(gamingtype, data);
} }
} }
} }

View File

@ -1,4 +1,5 @@
using Milimoe.FunGame.Desktop.Model; using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Desktop.Model;
namespace Milimoe.FunGame.Desktop.Library namespace Milimoe.FunGame.Desktop.Library
{ {
@ -70,7 +71,7 @@ namespace Milimoe.FunGame.Desktop.Library
/// <summary> /// <summary>
/// 当前游戏模式 /// 当前游戏模式
/// </summary> /// </summary>
public static string FunGame_RoomType public static RoomType FunGame_RoomType
{ {
get => RunTime.Config.FunGame_RoomType; get => RunTime.Config.FunGame_RoomType;
set => RunTime.Config.FunGame_RoomType = value; set => RunTime.Config.FunGame_RoomType = value;

View File

@ -1,4 +1,8 @@
using Milimoe.FunGame.Core.Library.Constant; using System.Collections.Generic;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Desktop.Model;
namespace Milimoe.FunGame.Desktop.Library namespace Milimoe.FunGame.Desktop.Library
{ {
@ -7,7 +11,7 @@ namespace Milimoe.FunGame.Desktop.Library
/** /**
* Game Configs * Game Configs
*/ */
public static int FunGameType { get; } = (int)FunGameInfo.FunGame.FunGame_Desktop; public static FunGameInfo.FunGame FunGameType => FunGameInfo.FunGame.FunGame_Desktop;
/** /**
* FunGame Configs * FunGame Configs
@ -73,5 +77,53 @@ namespace Milimoe.FunGame.Desktop.Library
FunGame_AutoRetryOn, FunGame_AutoRetryOn,
FunGame_AutoRetryOff FunGame_AutoRetryOff
}; };
public static readonly object[] AllComboItem = ["全部"];
public static object[] SupportedRoomType()
{
List<string> objs = [];
objs.Add(RoomSet.GetTypeString(RoomType.All));
objs.Add(RoomSet.GetTypeString(RoomType.Mix));
objs.Add(RoomSet.GetTypeString(RoomType.Team));
objs.Add(RoomSet.GetTypeString(RoomType.Solo));
objs.Add(RoomSet.GetTypeString(RoomType.FastAuto));
objs.Add(RoomSet.GetTypeString(RoomType.Custom));
return objs.ToArray();
}
public static object[] SupportedGameMode(RoomType type)
{
if (RunTime.GameModeLoader != null)
{
IEnumerable<object> list;
if (type == RoomType.All)
{
list = RunTime.GameModeLoader.Modes.Values.Select(mod => mod.Name).Distinct();
}
else
{
list = RunTime.GameModeLoader.Modes.Values.Where(mod => mod.RoomType == type).Select(mod => mod.Name).Distinct();
}
if (list.Any()) return AllComboItem.Union(list).ToArray();
}
return ["- 缺少模组 -"];
}
public static object[] SupportedGameMap()
{
List<string> list = [];
if (RunTime.GameModeLoader != null)
{
foreach (GameMode mod in RunTime.GameModeLoader.Modes.Values)
{
list.AddRange(mod.Maps.Distinct());
}
}
if (list.Count != 0) return AllComboItem.Union(list).ToArray();
return ["- 缺少地图 -"];
}
public static object[] SupportedGameMap(GameMode mod)
{
IEnumerable<object> list = mod.Maps.Where(map => mod.Maps.Contains(map)).Distinct();
if (list.Any()) return AllComboItem.Union(list).ToArray();
return ["- 缺少地图 -"];
}
} }
} }

View File

@ -11,6 +11,7 @@ namespace Milimoe.FunGame.Desktop.Model
public static Core.Model.RoomList RoomList { get; } = new(); public static Core.Model.RoomList RoomList { get; } = new();
public static Core.Model.Session Session { get; } = new(); public static Core.Model.Session Session { get; } = new();
public static Core.Model.FunGameConfig Config { get; } = new(); public static Core.Model.FunGameConfig Config { get; } = new();
public static Core.Model.Gaming? Gaming { get; set; } = null;
public static Core.Api.Utility.PluginLoader? PluginLoader { get; set; } = null; public static Core.Api.Utility.PluginLoader? PluginLoader { get; set; } = null;
public static Core.Api.Utility.GameModeLoader? GameModeLoader { get; set; } = null; public static Core.Api.Utility.GameModeLoader? GameModeLoader { get; set; } = null;
public static Core.Library.Common.Network.Socket? Socket { get; set; } = null; public static Core.Library.Common.Network.Socket? Socket { get; set; } = null;

View File

@ -40,8 +40,6 @@ namespace Milimoe.FunGame.Desktop.UI
SendTalkText = new Button(); SendTalkText = new Button();
TalkText = new TextBox(); TalkText = new TextBox();
StartMatch = new Button(); StartMatch = new Button();
CheckMix = new CheckBox();
CheckTeam = new CheckBox();
RoomSetting = new Button(); RoomSetting = new Button();
Login = new Button(); Login = new Button();
NowAccount = new Label(); NowAccount = new Label();
@ -69,6 +67,10 @@ namespace Milimoe.FunGame.Desktop.UI
Store = new Button(); Store = new Button();
Copyright = new LinkLabel(); Copyright = new LinkLabel();
StopMatch = new Button(); StopMatch = new Button();
CheckIsRank = new CheckBox();
ComboRoomType = new ComboBox();
ComboGameMode = new ComboBox();
ComboGameMap = new ComboBox();
RoomBox.SuspendLayout(); RoomBox.SuspendLayout();
Notice.SuspendLayout(); Notice.SuspendLayout();
InfoBox.SuspendLayout(); InfoBox.SuspendLayout();
@ -78,11 +80,11 @@ namespace Milimoe.FunGame.Desktop.UI
// Title // Title
// //
Title.BackColor = Color.Transparent; Title.BackColor = Color.Transparent;
Title.Font = new Font("LanaPixel", 26.25F, FontStyle.Bold, GraphicsUnit.Point); Title.Font = new Font("LanaPixel", 26.25F, FontStyle.Bold);
Title.Location = new Point(3, 3); Title.Location = new Point(3, 3);
Title.Size = new Size(689, 47); Title.Size = new Size(689, 47);
Title.TabIndex = 96; Title.TabIndex = 96;
Title.Text = "FunGame By Milimoe"; Title.Text = "FunGame";
Title.TextAlign = ContentAlignment.MiddleLeft; Title.TextAlign = ContentAlignment.MiddleLeft;
// //
// Exit // Exit
@ -95,7 +97,7 @@ namespace Milimoe.FunGame.Desktop.UI
Exit.FlatAppearance.MouseDownBackColor = Color.FromArgb(255, 128, 128); Exit.FlatAppearance.MouseDownBackColor = Color.FromArgb(255, 128, 128);
Exit.FlatAppearance.MouseOverBackColor = Color.FromArgb(255, 192, 192); Exit.FlatAppearance.MouseOverBackColor = Color.FromArgb(255, 192, 192);
Exit.FlatStyle = FlatStyle.Flat; Exit.FlatStyle = FlatStyle.Flat;
Exit.Font = new Font("LanaPixel", 36F, FontStyle.Bold, GraphicsUnit.Point); Exit.Font = new Font("LanaPixel", 36F, FontStyle.Bold);
Exit.ForeColor = Color.Red; Exit.ForeColor = Color.Red;
Exit.Location = new Point(750, 3); Exit.Location = new Point(750, 3);
Exit.Name = "Exit"; Exit.Name = "Exit";
@ -117,7 +119,7 @@ namespace Milimoe.FunGame.Desktop.UI
MinForm.FlatAppearance.MouseDownBackColor = Color.Gray; MinForm.FlatAppearance.MouseDownBackColor = Color.Gray;
MinForm.FlatAppearance.MouseOverBackColor = Color.DarkGray; MinForm.FlatAppearance.MouseOverBackColor = Color.DarkGray;
MinForm.FlatStyle = FlatStyle.Flat; MinForm.FlatStyle = FlatStyle.Flat;
MinForm.Font = new Font("LanaPixel", 36F, FontStyle.Bold, GraphicsUnit.Point); MinForm.Font = new Font("LanaPixel", 36F, FontStyle.Bold);
MinForm.ForeColor = Color.Red; MinForm.ForeColor = Color.Red;
MinForm.Location = new Point(698, 3); MinForm.Location = new Point(698, 3);
MinForm.Name = "MinForm"; MinForm.Name = "MinForm";
@ -130,7 +132,7 @@ namespace Milimoe.FunGame.Desktop.UI
// Connection // Connection
// //
Connection.BackColor = Color.Transparent; Connection.BackColor = Color.Transparent;
Connection.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); Connection.Font = new Font("LanaPixel", 12F);
Connection.Location = new Point(649, 424); Connection.Location = new Point(649, 424);
Connection.Margin = new Padding(3); Connection.Margin = new Padding(3);
Connection.Name = "Connection"; Connection.Name = "Connection";
@ -158,7 +160,7 @@ namespace Milimoe.FunGame.Desktop.UI
SendTalkText.FlatAppearance.MouseDownBackColor = Color.Teal; SendTalkText.FlatAppearance.MouseDownBackColor = Color.Teal;
SendTalkText.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 192, 192); SendTalkText.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 192, 192);
SendTalkText.FlatStyle = FlatStyle.Flat; SendTalkText.FlatStyle = FlatStyle.Flat;
SendTalkText.Font = new Font("LanaPixel", 11.25F, FontStyle.Regular, GraphicsUnit.Point); SendTalkText.Font = new Font("LanaPixel", 11.25F);
SendTalkText.Location = new Point(608, 421); SendTalkText.Location = new Point(608, 421);
SendTalkText.Name = "SendTalkText"; SendTalkText.Name = "SendTalkText";
SendTalkText.Size = new Size(51, 27); SendTalkText.Size = new Size(51, 27);
@ -170,7 +172,7 @@ namespace Milimoe.FunGame.Desktop.UI
// TalkText // TalkText
// //
TalkText.AllowDrop = true; TalkText.AllowDrop = true;
TalkText.Font = new Font("LanaPixel", 12.75F, FontStyle.Regular, GraphicsUnit.Point); TalkText.Font = new Font("LanaPixel", 12.75F);
TalkText.ForeColor = Color.DarkGray; TalkText.ForeColor = Color.DarkGray;
TalkText.Location = new Point(317, 422); TalkText.Location = new Point(317, 422);
TalkText.Name = "TalkText"; TalkText.Name = "TalkText";
@ -185,8 +187,8 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// StartMatch // StartMatch
// //
StartMatch.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); StartMatch.Font = new Font("LanaPixel", 12F);
StartMatch.Location = new Point(665, 184); StartMatch.Location = new Point(665, 214);
StartMatch.Name = "StartMatch"; StartMatch.Name = "StartMatch";
StartMatch.Size = new Size(132, 35); StartMatch.Size = new Size(132, 35);
StartMatch.TabIndex = 9; StartMatch.TabIndex = 9;
@ -194,36 +196,10 @@ namespace Milimoe.FunGame.Desktop.UI
StartMatch.UseVisualStyleBackColor = true; StartMatch.UseVisualStyleBackColor = true;
StartMatch.Click += StartMatch_Click; StartMatch.Click += StartMatch_Click;
// //
// CheckMix
//
CheckMix.BackColor = Color.Transparent;
CheckMix.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point);
CheckMix.Location = new Point(675, 94);
CheckMix.Name = "CheckMix";
CheckMix.Size = new Size(123, 24);
CheckMix.TabIndex = 7;
CheckMix.Text = "混战模式房间";
CheckMix.TextAlign = ContentAlignment.BottomLeft;
CheckMix.UseVisualStyleBackColor = false;
CheckMix.CheckedChanged += CheckGameMode_CheckedChanged;
//
// CheckTeam
//
CheckTeam.BackColor = Color.Transparent;
CheckTeam.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point);
CheckTeam.Location = new Point(675, 124);
CheckTeam.Name = "CheckTeam";
CheckTeam.Size = new Size(123, 24);
CheckTeam.TabIndex = 8;
CheckTeam.Text = "团队模式房间";
CheckTeam.TextAlign = ContentAlignment.BottomLeft;
CheckTeam.UseVisualStyleBackColor = false;
CheckTeam.CheckedChanged += CheckGameMode_CheckedChanged;
//
// RoomSetting // RoomSetting
// //
RoomSetting.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); RoomSetting.Font = new Font("LanaPixel", 12F);
RoomSetting.Location = new Point(665, 225); RoomSetting.Location = new Point(665, 254);
RoomSetting.Name = "RoomSetting"; RoomSetting.Name = "RoomSetting";
RoomSetting.Size = new Size(132, 35); RoomSetting.Size = new Size(132, 35);
RoomSetting.TabIndex = 11; RoomSetting.TabIndex = 11;
@ -234,7 +210,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// Login // Login
// //
Login.Font = new Font("LanaPixel", 15.75F, FontStyle.Regular, GraphicsUnit.Point); Login.Font = new Font("LanaPixel", 15.75F);
Login.Location = new Point(665, 380); Login.Location = new Point(665, 380);
Login.Name = "Login"; Login.Name = "Login";
Login.Size = new Size(132, 39); Login.Size = new Size(132, 39);
@ -246,18 +222,18 @@ namespace Milimoe.FunGame.Desktop.UI
// NowAccount // NowAccount
// //
NowAccount.BackColor = Color.Transparent; NowAccount.BackColor = Color.Transparent;
NowAccount.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); NowAccount.Font = new Font("LanaPixel", 12F);
NowAccount.Location = new Point(659, 352); NowAccount.Location = new Point(551, 9);
NowAccount.Name = "NowAccount"; NowAccount.Name = "NowAccount";
NowAccount.Size = new Size(141, 25); NowAccount.Size = new Size(141, 41);
NowAccount.TabIndex = 91; NowAccount.TabIndex = 91;
NowAccount.Text = "请登录账号"; NowAccount.Text = "请登录账号";
NowAccount.TextAlign = ContentAlignment.MiddleCenter; NowAccount.TextAlign = ContentAlignment.MiddleCenter;
// //
// AccountSetting // AccountSetting
// //
AccountSetting.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); AccountSetting.Font = new Font("LanaPixel", 12F);
AccountSetting.Location = new Point(665, 317); AccountSetting.Location = new Point(665, 342);
AccountSetting.Name = "AccountSetting"; AccountSetting.Name = "AccountSetting";
AccountSetting.Size = new Size(65, 32); AccountSetting.Size = new Size(65, 32);
AccountSetting.TabIndex = 12; AccountSetting.TabIndex = 12;
@ -266,8 +242,8 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// About // About
// //
About.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); About.Font = new Font("LanaPixel", 12F);
About.Location = new Point(732, 317); About.Location = new Point(733, 341);
About.Name = "About"; About.Name = "About";
About.Size = new Size(65, 32); About.Size = new Size(65, 32);
About.TabIndex = 13; About.TabIndex = 13;
@ -277,8 +253,8 @@ namespace Milimoe.FunGame.Desktop.UI
// Room // Room
// //
Room.BackColor = Color.Transparent; Room.BackColor = Color.Transparent;
Room.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); Room.Font = new Font("LanaPixel", 12F);
Room.Location = new Point(665, 263); Room.Location = new Point(665, 293);
Room.Name = "Room"; Room.Name = "Room";
Room.Size = new Size(132, 45); Room.Size = new Size(132, 45);
Room.TabIndex = 90; Room.TabIndex = 90;
@ -288,7 +264,7 @@ namespace Milimoe.FunGame.Desktop.UI
// RoomText // RoomText
// //
RoomText.AllowDrop = true; RoomText.AllowDrop = true;
RoomText.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); RoomText.Font = new Font("LanaPixel", 12F);
RoomText.ForeColor = Color.DarkGray; RoomText.ForeColor = Color.DarkGray;
RoomText.Location = new Point(6, 226); RoomText.Location = new Point(6, 226);
RoomText.Name = "RoomText"; RoomText.Name = "RoomText";
@ -305,7 +281,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
PresetText.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; PresetText.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
PresetText.DropDownStyle = ComboBoxStyle.DropDownList; PresetText.DropDownStyle = ComboBoxStyle.DropDownList;
PresetText.Font = new Font("LanaPixel", 11.25F, FontStyle.Regular, GraphicsUnit.Point); PresetText.Font = new Font("LanaPixel", 11.25F);
PresetText.FormattingEnabled = true; PresetText.FormattingEnabled = true;
PresetText.Items.AddRange(new object[] { "- 快捷消息 -" }); PresetText.Items.AddRange(new object[] { "- 快捷消息 -" });
PresetText.Location = new Point(195, 422); PresetText.Location = new Point(195, 422);
@ -323,7 +299,7 @@ namespace Milimoe.FunGame.Desktop.UI
RoomBox.Controls.Add(RoomList); RoomBox.Controls.Add(RoomList);
RoomBox.Controls.Add(RoomText); RoomBox.Controls.Add(RoomText);
RoomBox.Controls.Add(QueryRoom); RoomBox.Controls.Add(QueryRoom);
RoomBox.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); RoomBox.Font = new Font("LanaPixel", 12F);
RoomBox.Location = new Point(3, 56); RoomBox.Location = new Point(3, 56);
RoomBox.Name = "RoomBox"; RoomBox.Name = "RoomBox";
RoomBox.Size = new Size(186, 258); RoomBox.Size = new Size(186, 258);
@ -334,7 +310,7 @@ namespace Milimoe.FunGame.Desktop.UI
// NowRoomID // NowRoomID
// //
NowRoomID.AllowDrop = true; NowRoomID.AllowDrop = true;
NowRoomID.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); NowRoomID.Font = new Font("LanaPixel", 12F);
NowRoomID.ForeColor = Color.DarkGray; NowRoomID.ForeColor = Color.DarkGray;
NowRoomID.Location = new Point(6, 226); NowRoomID.Location = new Point(6, 226);
NowRoomID.Name = "NowRoomID"; NowRoomID.Name = "NowRoomID";
@ -347,7 +323,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// CopyRoomID // CopyRoomID
// //
CopyRoomID.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); CopyRoomID.Font = new Font("LanaPixel", 12F);
CopyRoomID.Location = new Point(126, 225); CopyRoomID.Location = new Point(126, 225);
CopyRoomID.Name = "CopyRoomID"; CopyRoomID.Name = "CopyRoomID";
CopyRoomID.Size = new Size(51, 27); CopyRoomID.Size = new Size(51, 27);
@ -371,7 +347,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// QueryRoom // QueryRoom
// //
QueryRoom.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); QueryRoom.Font = new Font("LanaPixel", 12F);
QueryRoom.Location = new Point(126, 225); QueryRoom.Location = new Point(126, 225);
QueryRoom.Name = "QueryRoom"; QueryRoom.Name = "QueryRoom";
QueryRoom.Size = new Size(51, 27); QueryRoom.Size = new Size(51, 27);
@ -382,7 +358,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// RefreshRoomList // RefreshRoomList
// //
RefreshRoomList.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); RefreshRoomList.Font = new Font("LanaPixel", 12F);
RefreshRoomList.Image = Properties.Resources.refresh; RefreshRoomList.Image = Properties.Resources.refresh;
RefreshRoomList.Location = new Point(162, 248); RefreshRoomList.Location = new Point(162, 248);
RefreshRoomList.Name = "RefreshRoomList"; RefreshRoomList.Name = "RefreshRoomList";
@ -396,7 +372,7 @@ namespace Milimoe.FunGame.Desktop.UI
Notice.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; Notice.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
Notice.BackColor = Color.Transparent; Notice.BackColor = Color.Transparent;
Notice.Controls.Add(NoticeText); Notice.Controls.Add(NoticeText);
Notice.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); Notice.Font = new Font("LanaPixel", 12F);
Notice.Location = new Point(3, 317); Notice.Location = new Point(3, 317);
Notice.Name = "Notice"; Notice.Name = "Notice";
Notice.Size = new Size(186, 110); Notice.Size = new Size(186, 110);
@ -420,7 +396,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
InfoBox.BackColor = Color.Transparent; InfoBox.BackColor = Color.Transparent;
InfoBox.Controls.Add(TransparentRectControl); InfoBox.Controls.Add(TransparentRectControl);
InfoBox.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); InfoBox.Font = new Font("LanaPixel", 12F);
InfoBox.Location = new Point(195, 56); InfoBox.Location = new Point(195, 56);
InfoBox.Name = "InfoBox"; InfoBox.Name = "InfoBox";
InfoBox.Size = new Size(464, 363); InfoBox.Size = new Size(464, 363);
@ -459,8 +435,8 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// QuitRoom // QuitRoom
// //
QuitRoom.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); QuitRoom.Font = new Font("LanaPixel", 12F);
QuitRoom.Location = new Point(665, 184); QuitRoom.Location = new Point(665, 212);
QuitRoom.Name = "QuitRoom"; QuitRoom.Name = "QuitRoom";
QuitRoom.Size = new Size(132, 35); QuitRoom.Size = new Size(132, 35);
QuitRoom.TabIndex = 9; QuitRoom.TabIndex = 9;
@ -471,8 +447,8 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// CreateRoom // CreateRoom
// //
CreateRoom.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); CreateRoom.Font = new Font("LanaPixel", 12F);
CreateRoom.Location = new Point(665, 225); CreateRoom.Location = new Point(666, 253);
CreateRoom.Name = "CreateRoom"; CreateRoom.Name = "CreateRoom";
CreateRoom.Size = new Size(132, 35); CreateRoom.Size = new Size(132, 35);
CreateRoom.TabIndex = 10; CreateRoom.TabIndex = 10;
@ -482,7 +458,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// Logout // Logout
// //
Logout.Font = new Font("LanaPixel", 15.75F, FontStyle.Regular, GraphicsUnit.Point); Logout.Font = new Font("LanaPixel", 15.75F);
Logout.Location = new Point(665, 380); Logout.Location = new Point(665, 380);
Logout.Name = "Logout"; Logout.Name = "Logout";
Logout.Size = new Size(132, 39); Logout.Size = new Size(132, 39);
@ -495,19 +471,18 @@ namespace Milimoe.FunGame.Desktop.UI
// CheckHasPass // CheckHasPass
// //
CheckHasPass.BackColor = Color.Transparent; CheckHasPass.BackColor = Color.Transparent;
CheckHasPass.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); CheckHasPass.Font = new Font("LanaPixel", 12F);
CheckHasPass.Location = new Point(675, 154); CheckHasPass.Location = new Point(737, 181);
CheckHasPass.Name = "CheckHasPass"; CheckHasPass.Name = "CheckHasPass";
CheckHasPass.Size = new Size(123, 24); CheckHasPass.Size = new Size(60, 24);
CheckHasPass.TabIndex = 9; CheckHasPass.TabIndex = 9;
CheckHasPass.Text = "密码的房间"; CheckHasPass.Text = "密码";
CheckHasPass.TextAlign = ContentAlignment.BottomLeft; CheckHasPass.TextAlign = ContentAlignment.MiddleCenter;
CheckHasPass.UseVisualStyleBackColor = false; CheckHasPass.UseVisualStyleBackColor = false;
CheckHasPass.CheckedChanged += CheckGameMode_CheckedChanged;
// //
// Stock // Stock
// //
Stock.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); Stock.Font = new Font("LanaPixel", 12F);
Stock.Location = new Point(661, 56); Stock.Location = new Point(661, 56);
Stock.Name = "Stock"; Stock.Name = "Stock";
Stock.Size = new Size(65, 32); Stock.Size = new Size(65, 32);
@ -517,7 +492,7 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// Store // Store
// //
Store.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); Store.Font = new Font("LanaPixel", 12F);
Store.Location = new Point(732, 56); Store.Location = new Point(732, 56);
Store.Name = "Store"; Store.Name = "Store";
Store.Size = new Size(65, 32); Store.Size = new Size(65, 32);
@ -530,7 +505,7 @@ namespace Milimoe.FunGame.Desktop.UI
Copyright.ActiveLinkColor = Color.FromArgb(0, 64, 64); Copyright.ActiveLinkColor = Color.FromArgb(0, 64, 64);
Copyright.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; Copyright.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
Copyright.BackColor = Color.Transparent; Copyright.BackColor = Color.Transparent;
Copyright.Font = new Font("LanaPixel", 10.5F, FontStyle.Regular, GraphicsUnit.Point); Copyright.Font = new Font("LanaPixel", 10.5F);
Copyright.LinkArea = new LinkArea(6, 8); Copyright.LinkArea = new LinkArea(6, 8);
Copyright.LinkBehavior = LinkBehavior.AlwaysUnderline; Copyright.LinkBehavior = LinkBehavior.AlwaysUnderline;
Copyright.LinkColor = Color.Teal; Copyright.LinkColor = Color.Teal;
@ -546,8 +521,8 @@ namespace Milimoe.FunGame.Desktop.UI
// //
// StopMatch // StopMatch
// //
StopMatch.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); StopMatch.Font = new Font("LanaPixel", 12F);
StopMatch.Location = new Point(665, 184); StopMatch.Location = new Point(665, 213);
StopMatch.Name = "StopMatch"; StopMatch.Name = "StopMatch";
StopMatch.Size = new Size(132, 35); StopMatch.Size = new Size(132, 35);
StopMatch.TabIndex = 10; StopMatch.TabIndex = 10;
@ -555,8 +530,59 @@ namespace Milimoe.FunGame.Desktop.UI
StopMatch.UseVisualStyleBackColor = true; StopMatch.UseVisualStyleBackColor = true;
StopMatch.Visible = false; StopMatch.Visible = false;
StopMatch.Click += StopMatch_Click; StopMatch.Click += StopMatch_Click;
StopMatch.MouseHover += StopMatch_MouseHover;
StopMatch.MouseLeave += StopMatch_MouseLeave; StopMatch.MouseLeave += StopMatch_MouseLeave;
StopMatch.MouseHover += StopMatch_MouseHover;
//
// CheckIsRank
//
CheckIsRank.BackColor = Color.Transparent;
CheckIsRank.Enabled = false;
CheckIsRank.Font = new Font("LanaPixel", 12F);
CheckIsRank.Location = new Point(671, 181);
CheckIsRank.Name = "CheckIsRank";
CheckIsRank.Size = new Size(60, 24);
CheckIsRank.TabIndex = 98;
CheckIsRank.Text = "排位";
CheckIsRank.TextAlign = ContentAlignment.MiddleCenter;
CheckIsRank.UseVisualStyleBackColor = false;
//
// ComboRoomType
//
ComboRoomType.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
ComboRoomType.DropDownStyle = ComboBoxStyle.DropDownList;
ComboRoomType.Font = new Font("LanaPixel", 11.25F);
ComboRoomType.FormattingEnabled = true;
ComboRoomType.Items.AddRange(new object[] { "- 房间类型 -" });
ComboRoomType.Location = new Point(665, 94);
ComboRoomType.Name = "ComboRoomType";
ComboRoomType.Size = new Size(130, 26);
ComboRoomType.TabIndex = 99;
ComboRoomType.SelectionChangeCommitted += ComboRoomType_SelectionChangeCommitted;
//
// ComboGameMode
//
ComboGameMode.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
ComboGameMode.DropDownStyle = ComboBoxStyle.DropDownList;
ComboGameMode.Font = new Font("LanaPixel", 11.25F);
ComboGameMode.FormattingEnabled = true;
ComboGameMode.Items.AddRange(new object[] { "- 请选择类型 -" });
ComboGameMode.Location = new Point(665, 122);
ComboGameMode.Name = "ComboGameMode";
ComboGameMode.Size = new Size(130, 26);
ComboGameMode.TabIndex = 100;
ComboGameMode.SelectionChangeCommitted += ComboGameMode_SelectionChangeCommitted;
//
// ComboGameMap
//
ComboGameMap.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
ComboGameMap.DropDownStyle = ComboBoxStyle.DropDownList;
ComboGameMap.Font = new Font("LanaPixel", 11.25F);
ComboGameMap.FormattingEnabled = true;
ComboGameMap.Items.AddRange(new object[] { "- 请选择类型 -" });
ComboGameMap.Location = new Point(665, 150);
ComboGameMap.Name = "ComboGameMap";
ComboGameMap.Size = new Size(130, 26);
ComboGameMap.TabIndex = 101;
// //
// Main // Main
// //
@ -564,6 +590,10 @@ namespace Milimoe.FunGame.Desktop.UI
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.back; BackgroundImage = Properties.Resources.back;
ClientSize = new Size(800, 450); ClientSize = new Size(800, 450);
Controls.Add(ComboGameMap);
Controls.Add(ComboGameMode);
Controls.Add(ComboRoomType);
Controls.Add(CheckIsRank);
Controls.Add(RefreshRoomList); Controls.Add(RefreshRoomList);
Controls.Add(StopMatch); Controls.Add(StopMatch);
Controls.Add(Copyright); Controls.Add(Copyright);
@ -585,8 +615,6 @@ namespace Milimoe.FunGame.Desktop.UI
Controls.Add(NowAccount); Controls.Add(NowAccount);
Controls.Add(Login); Controls.Add(Login);
Controls.Add(CheckHasPass); Controls.Add(CheckHasPass);
Controls.Add(CheckTeam);
Controls.Add(CheckMix);
Controls.Add(StartMatch); Controls.Add(StartMatch);
Controls.Add(Light); Controls.Add(Light);
Controls.Add(Connection); Controls.Add(Connection);
@ -602,8 +630,6 @@ namespace Milimoe.FunGame.Desktop.UI
Controls.SetChildIndex(Connection, 0); Controls.SetChildIndex(Connection, 0);
Controls.SetChildIndex(Light, 0); Controls.SetChildIndex(Light, 0);
Controls.SetChildIndex(StartMatch, 0); Controls.SetChildIndex(StartMatch, 0);
Controls.SetChildIndex(CheckMix, 0);
Controls.SetChildIndex(CheckTeam, 0);
Controls.SetChildIndex(CheckHasPass, 0); Controls.SetChildIndex(CheckHasPass, 0);
Controls.SetChildIndex(Login, 0); Controls.SetChildIndex(Login, 0);
Controls.SetChildIndex(NowAccount, 0); Controls.SetChildIndex(NowAccount, 0);
@ -625,6 +651,10 @@ namespace Milimoe.FunGame.Desktop.UI
Controls.SetChildIndex(Copyright, 0); Controls.SetChildIndex(Copyright, 0);
Controls.SetChildIndex(StopMatch, 0); Controls.SetChildIndex(StopMatch, 0);
Controls.SetChildIndex(RefreshRoomList, 0); Controls.SetChildIndex(RefreshRoomList, 0);
Controls.SetChildIndex(CheckIsRank, 0);
Controls.SetChildIndex(ComboRoomType, 0);
Controls.SetChildIndex(ComboGameMode, 0);
Controls.SetChildIndex(ComboGameMap, 0);
RoomBox.ResumeLayout(false); RoomBox.ResumeLayout(false);
RoomBox.PerformLayout(); RoomBox.PerformLayout();
Notice.ResumeLayout(false); Notice.ResumeLayout(false);
@ -641,8 +671,6 @@ namespace Milimoe.FunGame.Desktop.UI
private Label Connection; private Label Connection;
private Label Light; private Label Light;
private Button StartMatch; private Button StartMatch;
private CheckBox CheckMix;
private CheckBox CheckTeam;
private Button RoomSetting; private Button RoomSetting;
private Button Login; private Button Login;
private Label NowAccount; private Label NowAccount;
@ -672,5 +700,9 @@ namespace Milimoe.FunGame.Desktop.UI
private TextBox NowRoomID; private TextBox NowRoomID;
private Button CopyRoomID; private Button CopyRoomID;
private Button RefreshRoomList; private Button RefreshRoomList;
private CheckBox CheckIsRank;
private ComboBox ComboGameMap;
private ComboBox ComboGameMode;
private ComboBox ComboRoomType;
} }
} }

View File

@ -45,7 +45,7 @@ namespace Milimoe.FunGame.Desktop.UI
public void Init() public void Init()
{ {
RunTime.Main = this; RunTime.Main = this;
SetButtonEnableIfLogon(false, ClientState.WaitConnect); SetButtonEnabled(false, ClientState.WaitConnect);
SetRoomid(Usercfg.InRoom); // 房间号初始化 SetRoomid(Usercfg.InRoom); // 房间号初始化
ShowFunGameInfo(); // 显示FunGame信息 ShowFunGameInfo(); // 显示FunGame信息
GetFunGameConfig(); // 获取FunGame配置 GetFunGameConfig(); // 获取FunGame配置
@ -65,6 +65,19 @@ namespace Milimoe.FunGame.Desktop.UI
RunTime.Controller.LoadGameModes(); RunTime.Controller.LoadGameModes();
// 加载插件 // 加载插件
RunTime.Controller.LoadPlugins(); RunTime.Controller.LoadPlugins();
// 设置预设
InvokeUpdateUI(() =>
{
ComboRoomType.Items.Clear();
ComboRoomType.Items.AddRange(Constant.SupportedRoomType());
ComboRoomType.SelectedIndex = 0;
ComboGameMode.Items.Clear();
ComboGameMode.Items.AddRange(Constant.SupportedGameMode(RoomType.All));
ComboGameMode.SelectedIndex = 0;
ComboGameMap.Items.Clear();
ComboGameMap.Items.AddRange(Constant.SupportedGameMap());
ComboGameMap.SelectedIndex = 0;
});
// 自动连接服务器 // 自动连接服务器
if (Config.FunGame_isAutoConnect) InvokeController_Connect(); if (Config.FunGame_isAutoConnect) InvokeController_Connect();
}); });
@ -106,8 +119,8 @@ namespace Milimoe.FunGame.Desktop.UI
case MainInvokeType.SetGreen: case MainInvokeType.SetGreen:
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
SetServerStatusLight(LightType.Green); SetServerStatusLight(LightType.Green);
if (Usercfg.InRoom.Roomid != "-1") SetButtonEnableIfLogon(true, ClientState.InRoom); if (Usercfg.InRoom.Roomid != "-1") SetButtonEnabled(true, ClientState.InRoom);
else SetButtonEnableIfLogon(true, ClientState.Online); else SetButtonEnabled(true, ClientState.Online);
Config.FunGame_isConnected = true; Config.FunGame_isConnected = true;
CurrentRetryTimes = 0; CurrentRetryTimes = 0;
break; break;
@ -115,8 +128,8 @@ namespace Milimoe.FunGame.Desktop.UI
case MainInvokeType.SetGreenAndPing: case MainInvokeType.SetGreenAndPing:
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
SetServerStatusLight(LightType.Green, ping: NetworkUtility.GetServerPing(RunTime.Session.Server_IP)); SetServerStatusLight(LightType.Green, ping: NetworkUtility.GetServerPing(RunTime.Session.Server_IP));
if (Usercfg.InRoom.Roomid != "-1") SetButtonEnableIfLogon(true, ClientState.InRoom); if (Usercfg.InRoom.Roomid != "-1") SetButtonEnabled(true, ClientState.InRoom);
else SetButtonEnableIfLogon(true, ClientState.Online); else SetButtonEnabled(true, ClientState.Online);
Config.FunGame_isConnected = true; Config.FunGame_isConnected = true;
CurrentRetryTimes = 0; CurrentRetryTimes = 0;
break; break;
@ -124,7 +137,7 @@ namespace Milimoe.FunGame.Desktop.UI
case MainInvokeType.SetYellow: case MainInvokeType.SetYellow:
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
SetServerStatusLight(LightType.Yellow); SetServerStatusLight(LightType.Yellow);
SetButtonEnableIfLogon(false, ClientState.WaitConnect); SetButtonEnabled(false, ClientState.WaitConnect);
Config.FunGame_isConnected = true; Config.FunGame_isConnected = true;
CurrentRetryTimes = 0; CurrentRetryTimes = 0;
break; break;
@ -132,7 +145,7 @@ namespace Milimoe.FunGame.Desktop.UI
case MainInvokeType.WaitConnectAndSetYellow: case MainInvokeType.WaitConnectAndSetYellow:
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
SetServerStatusLight(LightType.Yellow); SetServerStatusLight(LightType.Yellow);
SetButtonEnableIfLogon(false, ClientState.WaitConnect); SetButtonEnabled(false, ClientState.WaitConnect);
Config.FunGame_isConnected = true; Config.FunGame_isConnected = true;
CurrentRetryTimes = 0; CurrentRetryTimes = 0;
if (MainController != null && Config.FunGame_isAutoConnect) if (MainController != null && Config.FunGame_isAutoConnect)
@ -145,14 +158,14 @@ namespace Milimoe.FunGame.Desktop.UI
case MainInvokeType.WaitLoginAndSetYellow: case MainInvokeType.WaitLoginAndSetYellow:
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
SetServerStatusLight(LightType.Yellow, true); SetServerStatusLight(LightType.Yellow, true);
SetButtonEnableIfLogon(false, ClientState.WaitLogin); SetButtonEnabled(false, ClientState.WaitLogin);
Config.FunGame_isConnected = true; Config.FunGame_isConnected = true;
CurrentRetryTimes = 0; CurrentRetryTimes = 0;
break; break;
case MainInvokeType.SetRed: case MainInvokeType.SetRed:
SetServerStatusLight(LightType.Red); SetServerStatusLight(LightType.Red);
SetButtonEnableIfLogon(false, ClientState.WaitConnect); SetButtonEnabled(false, ClientState.WaitConnect);
Config.FunGame_isConnected = false; Config.FunGame_isConnected = false;
break; break;
@ -162,7 +175,7 @@ namespace Milimoe.FunGame.Desktop.UI
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
Config.FunGame_isConnected = false; Config.FunGame_isConnected = false;
SetServerStatusLight(LightType.Red); SetServerStatusLight(LightType.Red);
SetButtonEnableIfLogon(false, ClientState.WaitConnect); SetButtonEnabled(false, ClientState.WaitConnect);
LogoutAccount(); LogoutAccount();
MainController?.MainController_Disposed(); MainController?.MainController_Disposed();
CloseConnectedWindows(); CloseConnectedWindows();
@ -177,7 +190,7 @@ namespace Milimoe.FunGame.Desktop.UI
Config.FunGame_isAutoLogin = false; Config.FunGame_isAutoLogin = false;
Config.FunGame_isConnected = false; Config.FunGame_isConnected = false;
SetServerStatusLight(LightType.Yellow); SetServerStatusLight(LightType.Yellow);
SetButtonEnableIfLogon(false, ClientState.WaitConnect); SetButtonEnabled(false, ClientState.WaitConnect);
LogoutAccount(); LogoutAccount();
MainController?.MainController_Disposed(); MainController?.MainController_Disposed();
break; break;
@ -189,7 +202,7 @@ namespace Milimoe.FunGame.Desktop.UI
Config.FunGame_isRetrying = false; Config.FunGame_isRetrying = false;
Config.FunGame_isAutoLogin = false; Config.FunGame_isAutoLogin = false;
SetServerStatusLight(LightType.Yellow, true); SetServerStatusLight(LightType.Yellow, true);
SetButtonEnableIfLogon(false, ClientState.WaitLogin); SetButtonEnabled(false, ClientState.WaitLogin);
LogoutAccount(); LogoutAccount();
if (objs != null && objs.Length > 0) if (objs != null && objs.Length > 0)
{ {
@ -223,11 +236,10 @@ namespace Milimoe.FunGame.Desktop.UI
{ {
if (r.Roomid != "-1") if (r.Roomid != "-1")
{ {
string item = r.Roomid; string item = r.Roomid + " [ ";
if (r.Name.Trim() != "") if (r.IsRank) item += "排位, ";
{ if (r.HasPass) item += "密码, ";
item += " [ " + r.Name + " ]"; item += RoomSet.GetTypeString(r.RoomType) + " ] ";
}
RoomList.Items.Add(item); RoomList.Items.Add(item);
} }
} }
@ -354,7 +366,7 @@ namespace Milimoe.FunGame.Desktop.UI
} }
else else
{ {
INIHelper.Init((FunGameInfo.FunGame)Constant.FunGameType); INIHelper.Init(Constant.FunGameType);
WritelnGameInfo(">> 首次启动,已自动为你创建配置文件。"); WritelnGameInfo(">> 首次启动,已自动为你创建配置文件。");
GetFunGameConfig(); GetFunGameConfig();
} }
@ -466,7 +478,7 @@ namespace Milimoe.FunGame.Desktop.UI
NowRoomID.Visible = true; NowRoomID.Visible = true;
CopyRoomID.Visible = true; CopyRoomID.Visible = true;
// 禁用和激活按钮,并切换预设快捷消息 // 禁用和激活按钮,并切换预设快捷消息
SetButtonEnableIfLogon(true, ClientState.InRoom); SetButtonEnabled(true, ClientState.InRoom);
} }
/// <summary> /// <summary>
@ -486,11 +498,15 @@ namespace Milimoe.FunGame.Desktop.UI
WritelnGameInfo("房间 [ " + room.Roomid + " (" + PlayerCount + "人" + RoomSet.GetTypeString(room.RoomType) + ") ] 的游戏正式开始!"); WritelnGameInfo("房间 [ " + room.Roomid + " (" + PlayerCount + "人" + RoomSet.GetTypeString(room.RoomType) + ") ] 的游戏正式开始!");
if (RunTime.GameModeLoader?.Modes.ContainsKey(room.GameMode) ?? false) if (RunTime.GameModeLoader?.Modes.ContainsKey(room.GameMode) ?? false)
{ {
RunTime.GameModeLoader[room.GameMode].StartUI(); RunTime.Gaming = Core.Model.Gaming.StartGame(RunTime.GameModeLoader[room.GameMode], room, users);
Visible = false; // 隐藏主界面 Visible = false; // 隐藏主界面
} }
else
{
WritelnGameInfo("缺少房间所需模组 [ " + room.GameMode + " ] 无法开始游戏,请检查模组是否正确安装。");
}
}); });
SetButtonEnableIfLogon(false, ClientState.InRoom); SetButtonEnabled(false, ClientState.InRoom);
} }
/// <summary> /// <summary>
@ -501,36 +517,40 @@ namespace Milimoe.FunGame.Desktop.UI
Visible = true; Visible = true;
// test // test
WritelnGameInfo("===== TEST ====="); WritelnGameInfo("===== TEST =====");
SetButtonEnableIfLogon(true, ClientState.InRoom); SetButtonEnabled(true, ClientState.InRoom);
_InGame = false; _InGame = false;
WritelnGameInfo("游戏结束!" + " [ " + users[new Random().Next(users.Count)] + " ] " + "是赢家!"); WritelnGameInfo("游戏结束!" + " [ " + users[new Random().Next(users.Count)] + " ] " + "是赢家!");
RunTime.Controller?.EndGame();
} }
/// <summary> /// <summary>
/// 未登录和离线时,停用按钮 /// 未登录和离线时,停用按钮
/// 登录的时候要激活按钮 /// 登录的时候要激活按钮
/// 在游戏时,锁定部分按钮
/// </summary> /// </summary>
/// <param name="isLogon">是否登录</param> /// <param name="isEnabled">是否登录</param>
/// <param name="status">客户端状态</param> /// <param name="status">客户端状态</param>
private void SetButtonEnableIfLogon(bool isLogon, ClientState status) private void SetButtonEnabled(bool isEnabled, ClientState status)
{ {
if (_InGame) if (_InGame)
{ {
AccountSetting.Enabled = isLogon; AccountSetting.Enabled = isEnabled;
Stock.Enabled = isLogon; Stock.Enabled = isEnabled;
Store.Enabled = isLogon; Store.Enabled = isEnabled;
RoomBox.Enabled = isLogon; RoomBox.Enabled = isEnabled;
RefreshRoomList.Enabled = isLogon; RefreshRoomList.Enabled = isEnabled;
CheckMix.Enabled = isLogon; ComboRoomType.Enabled = isEnabled;
CheckTeam.Enabled = isLogon; ComboGameMode.Enabled = isEnabled;
CheckHasPass.Enabled = isLogon; ComboGameMap.Enabled = isEnabled;
QuitRoom.Enabled = isLogon; CheckIsRank.Enabled = isEnabled;
RoomSetting.Enabled = isLogon; CheckHasPass.Enabled = isEnabled;
PresetText.Enabled = isLogon; QuitRoom.Enabled = isEnabled;
TalkText.Enabled = isLogon; RoomSetting.Enabled = isEnabled;
SendTalkText.Enabled = isLogon; PresetText.Enabled = isEnabled;
Logout.Enabled = isLogon; TalkText.Enabled = isEnabled;
if (!isLogon) return; SendTalkText.Enabled = isEnabled;
Logout.Enabled = isEnabled;
if (!isEnabled) return;
} }
switch (status) switch (status)
{ {
@ -552,30 +572,29 @@ namespace Milimoe.FunGame.Desktop.UI
break; break;
} }
this.PresetText.SelectedIndex = 0; this.PresetText.SelectedIndex = 0;
StartMatch.Enabled = isLogon; StartMatch.Enabled = isEnabled;
AccountSetting.Enabled = isLogon; AccountSetting.Enabled = isEnabled;
Stock.Enabled = isLogon; Stock.Enabled = isEnabled;
Store.Enabled = isLogon; Store.Enabled = isEnabled;
if (!Config.FunGame_isMatching) if (!Config.FunGame_isMatching)
{ {
// 匹配中时不修改部分按钮状态 // 匹配中时不修改部分按钮状态
RoomBox.Enabled = isLogon; RoomBox.Enabled = isEnabled;
CreateRoom.Enabled = isLogon; CreateRoom.Enabled = isEnabled;
RefreshRoomList.Enabled = isLogon; RefreshRoomList.Enabled = isEnabled;
CheckMix.Enabled = isLogon; ComboRoomType.Enabled = isEnabled;
CheckTeam.Enabled = isLogon; ComboGameMode.Enabled = isEnabled;
CheckHasPass.Enabled = isLogon; ComboGameMap.Enabled = isEnabled;
CheckIsRank.Enabled = isEnabled;
CheckHasPass.Enabled = isEnabled;
} }
} }
/// <summary> /// <summary>
/// 加入房间 /// 加入房间
/// </summary> /// </summary>
/// <param name="isDouble"></param>
/// <param name="roomid"></param> /// <param name="roomid"></param>
private async Task<bool> JoinRoom(bool isDouble, string roomid) private async Task<bool> JoinRoom(string roomid)
{
if (!isDouble)
{ {
if (!RoomText.Text.Equals("") && !RoomText.ForeColor.Equals(Color.DarkGray)) if (!RoomText.Text.Equals("") && !RoomText.ForeColor.Equals(Color.DarkGray))
{ {
@ -590,10 +609,19 @@ namespace Milimoe.FunGame.Desktop.UI
return false; return false;
} }
} }
else
/// <summary>
/// 通过双击房间列表的房间号加入房间
/// </summary>
/// <param name="selectedindex"></param>
private async Task<bool> JoinRoom(int selectedindex)
{ {
if (selectedindex != -1 && RunTime.RoomList.Count > selectedindex)
{
string roomid = RunTime.RoomList.ListRoom[selectedindex]?.Roomid ?? "";
return await JoinRoom_Handler(roomid); return await JoinRoom_Handler(roomid);
} }
return false;
} }
/// <summary> /// <summary>
@ -714,15 +742,16 @@ namespace Milimoe.FunGame.Desktop.UI
break; break;
case StartMatchState.Enable: case StartMatchState.Enable:
// 设置匹配过程中的各种按钮是否可用 // 设置匹配过程中的各种按钮是否可用
bool isEnabel = false; bool isEnabled = false;
if (objs != null) isEnabel = (bool)objs[0]; if (objs != null) isEnabled = (bool)objs[0];
CheckMix.Enabled = isEnabel; ComboRoomType.Enabled = isEnabled;
CheckTeam.Enabled = isEnabel; ComboGameMode.Enabled = isEnabled;
CheckHasPass.Enabled = isEnabel; ComboGameMap.Enabled = isEnabled;
CreateRoom.Enabled = isEnabel; CheckHasPass.Enabled = isEnabled;
RoomBox.Enabled = isEnabel; CreateRoom.Enabled = isEnabled;
RefreshRoomList.Enabled = isEnabel; RoomBox.Enabled = isEnabled;
Logout.Enabled = isEnabel; RefreshRoomList.Enabled = isEnabled;
Logout.Enabled = isEnabled;
break; break;
case StartMatchState.Cancel: case StartMatchState.Cancel:
Config.FunGame_isMatching = false; Config.FunGame_isMatching = false;
@ -762,7 +791,7 @@ namespace Milimoe.FunGame.Desktop.UI
} }
Usercfg.LoginUserName = Usercfg.LoginUser.Username; Usercfg.LoginUserName = Usercfg.LoginUser.Username;
} }
NowAccount.Text = "[ID] " + Usercfg.LoginUserName; NowAccount.Text = "[当前登录]" + "\r\n" + Usercfg.LoginUserName;
Login.Visible = false; Login.Visible = false;
Logout.Visible = true; Logout.Visible = true;
UpdateUI(MainInvokeType.SetGreenAndPing); UpdateUI(MainInvokeType.SetGreenAndPing);
@ -847,7 +876,7 @@ namespace Milimoe.FunGame.Desktop.UI
/// <param name="RoomType"></param> /// <param name="RoomType"></param>
/// <param name="Password"></param> /// <param name="Password"></param>
/// <returns></returns> /// <returns></returns>
private async Task CreateRoom_Handler(string RoomType, string GameMode, string GameMap, string Password = "") private async Task CreateRoom_Handler(RoomType RoomType, string GameMode, string GameMap, bool IsRank, string Password = "")
{ {
if (Usercfg.InRoom.Roomid != "-1") if (Usercfg.InRoom.Roomid != "-1")
{ {
@ -860,7 +889,7 @@ namespace Milimoe.FunGame.Desktop.UI
ShowMessage(ShowMessageType.Error, ">> 缺少" + Config.FunGame_RoomType + "所需的模组,无法创建房间。"); ShowMessage(ShowMessageType.Error, ">> 缺少" + Config.FunGame_RoomType + "所需的模组,无法创建房间。");
return; return;
} }
Room room = await InvokeController_CreateRoom(RoomType, GameMode, GameMap, Password); Room room = await InvokeController_CreateRoom(RoomType, GameMode, GameMap, IsRank, Password);
if (MainController is not null && room.Roomid != "-1") if (MainController is not null && room.Roomid != "-1")
{ {
await MainController.UpdateRoomAsync(); await MainController.UpdateRoomAsync();
@ -945,14 +974,16 @@ namespace Milimoe.FunGame.Desktop.UI
/// </summary> /// </summary>
private void ShowFunGameInfo() private void ShowFunGameInfo()
{ {
WritelnGameInfo(FunGameInfo.GetInfo((FunGameInfo.FunGame)Constant.FunGameType)); WritelnGameInfo(FunGameInfo.GetInfo(Constant.FunGameType));
Title.Text = FunGameInfo.FunGame_Desktop + " " + FunGameInfo.FunGame_Version + " " + FunGameInfo.FunGame_VersionPatch;
} }
/// <summary> /// <summary>
/// 关闭所有登录后才能访问的窗口 /// 关闭所有登录后才能访问的窗口
/// </summary> /// </summary>
private static void CloseConnectedWindows() private void CloseConnectedWindows()
{ {
Visible = true;
RunTime.Login?.Close(); RunTime.Login?.Close();
RunTime.Register?.Close(); RunTime.Register?.Close();
RunTime.Store?.Close(); RunTime.Store?.Close();
@ -1008,13 +1039,36 @@ namespace Milimoe.FunGame.Desktop.UI
/// <param name="e"></param> /// <param name="e"></param>
private void StartMatch_Click(object sender, EventArgs e) private void StartMatch_Click(object sender, EventArgs e)
{ {
if (ComboRoomType.SelectedIndex < 0 || ComboGameMode.SelectedIndex < 0 || ComboGameMap.SelectedIndex < 0)
{
ShowMessage(ShowMessageType.Warning, "未正确选择房间类型/游戏模组/游戏地图,请检查!");
return;
}
if (!ComboRoomType.Items.Contains(RoomSet.GetTypeString(Config.FunGame_RoomType)))
{
ShowMessage(ShowMessageType.Error, "无效的房间类型!");
return;
}
string all = Constant.AllComboItem[0].ToString() ?? "全部";
string modname = ComboGameMode.SelectedItem?.ToString() ?? all;
string modmap = ComboGameMap.SelectedItem?.ToString() ?? all;
if (RunTime.GameModeLoader is null || (modname != all && !RunTime.GameModeLoader.Modes.ContainsKey(modname)))
{
ShowMessage(ShowMessageType.Error, ">> 模组未正确加载,无法创建房间。");
return;
}
if (RunTime.GameModeLoader is null || (modmap != all && !RunTime.GameModeLoader.Maps.ContainsKey(modmap)))
{
ShowMessage(ShowMessageType.Error, ">> 地图未正确加载,无法创建房间。");
return;
}
// 开始匹配 // 开始匹配
_MatchSeconds = 0; _MatchSeconds = 0;
SetMatchSecondsText(); SetMatchSecondsText();
WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 开始匹配"); WritelnGameInfo(DateTimeUtility.GetNowShortTime() + " 开始匹配");
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 开始匹配"); WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 开始匹配");
WriteGameInfo(">> 匹配参数:"); WriteGameInfo(">> 匹配参数:");
WritelnGameInfo(Config.FunGame_RoomType); WritelnGameInfo(Config.FunGame_RoomType + " > " + modname + " > " + modmap);
// 显示停止匹配按钮 // 显示停止匹配按钮
StartMatch.Visible = false; StartMatch.Visible = false;
StopMatch.Visible = true; StopMatch.Visible = true;
@ -1032,9 +1086,32 @@ namespace Milimoe.FunGame.Desktop.UI
private void CreateRoom_Click(object sender, EventArgs e) private void CreateRoom_Click(object sender, EventArgs e)
{ {
string password = ""; string password = "";
if (CheckMix.Checked && CheckTeam.Checked) if (Config.FunGame_RoomType == RoomType.All || ComboRoomType.SelectedIndex <= 0 || ComboGameMode.SelectedIndex <= 0 || ComboGameMap.SelectedIndex <= 0)
{ {
ShowMessage(ShowMessageType.Warning, "创建房间不允许同时勾选混战和团队!"); ShowMessage(ShowMessageType.Warning, "创建房间时不允许将房间类型/游戏模组/游戏地图的选项设置为[ 全部 ]。");
return;
}
if (!ComboRoomType.Items.Contains(RoomSet.GetTypeString(Config.FunGame_RoomType)))
{
ShowMessage(ShowMessageType.Error, "无效的房间类型!");
return;
}
string all = Constant.AllComboItem[0].ToString() ?? "全部";
string modname = ComboGameMode.SelectedItem?.ToString() ?? all;
string modmap = ComboGameMap.SelectedItem?.ToString() ?? all;
if (modname == all || modmap == all)
{
ShowMessage(ShowMessageType.Warning, "创建房间时不允许将房间类型/游戏模组/游戏地图的选项设置为[ 全部 ]。");
return;
}
if (RunTime.GameModeLoader is null || (modname != all && !RunTime.GameModeLoader.Modes.ContainsKey(modname)))
{
ShowMessage(ShowMessageType.Error, ">> 模组未正确加载,无法创建房间。");
return;
}
if (RunTime.GameModeLoader is null || (modmap != all && !RunTime.GameModeLoader.Maps.ContainsKey(modmap)))
{
ShowMessage(ShowMessageType.Error, ">> 地图未正确加载,无法创建房间。");
return; return;
} }
if (CheckHasPass.Checked) if (CheckHasPass.Checked)
@ -1046,18 +1123,7 @@ namespace Milimoe.FunGame.Desktop.UI
return; return;
} }
} }
if (Config.FunGame_RoomType.Equals("")) TaskUtility.NewTask(() => CreateRoom_Handler(Config.FunGame_RoomType, modname, modmap, CheckIsRank.Checked, password));
{
ShowMessage(ShowMessageType.Warning, "请勾选你要创建的房间类型!");
return;
}
GameMode? mode = RunTime.GameModeLoader?.Modes.Values.FirstOrDefault() ?? default;
if (mode is null)
{
ShowMessage(ShowMessageType.Error, ">> 缺少" + Config.FunGame_RoomType + "所需的模组,无法创建房间。");
return;
}
TaskUtility.NewTask(() => CreateRoom_Handler(Config.FunGame_RoomType, mode.Name, mode.DefaultMap, password));
} }
/// <summary> /// <summary>
@ -1114,7 +1180,7 @@ namespace Milimoe.FunGame.Desktop.UI
/// <param name="e"></param> /// <param name="e"></param>
private void QueryRoom_Click(object sender, EventArgs e) private void QueryRoom_Click(object sender, EventArgs e)
{ {
TaskUtility.NewTask(async () => await JoinRoom(false, RoomText.Text)); TaskUtility.NewTask(async () => await JoinRoom(RoomText.Text));
} }
/// <summary> /// <summary>
@ -1157,6 +1223,52 @@ namespace Milimoe.FunGame.Desktop.UI
StopMatch_Click(); StopMatch_Click();
} }
/// <summary>
/// 切换RoomType时设置所有相关选项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ComboRoomType_SelectionChangeCommitted(object sender, EventArgs e)
{
if (ComboRoomType.SelectedIndex >= 0)
{
SetRoomTypeString();
ComboGameMode.Items.Clear();
ComboGameMode.Items.AddRange(Constant.SupportedGameMode(Config.FunGame_RoomType));
ComboGameMode.SelectedIndex = 0;
ComboGameMap.Items.Clear();
ComboGameMap.Items.Add("全部");
ComboGameMap.SelectedIndex = 0;
}
}
/// <summary>
/// 切换GameMode时设置GameMap选项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ComboGameMode_SelectionChangeCommitted(object sender, EventArgs e)
{
if (ComboGameMode.SelectedIndex > 0)
{
string modname = ComboGameMode.SelectedItem?.ToString() ?? "";
if (modname != "- 缺少模组 -" && RunTime.GameModeLoader != null && RunTime.GameModeLoader.Modes.ContainsKey(modname))
{
GameMode mod = RunTime.GameModeLoader[modname];
ComboRoomType.SelectedItem = RoomSet.GetTypeString(mod.RoomType);
SetRoomTypeString();
ComboGameMap.Items.Clear();
ComboGameMap.Items.AddRange(Constant.SupportedGameMap(mod));
ComboGameMap.SelectedIndex = 0;
}
}
else
{
ComboGameMap.Items.AddRange(Constant.SupportedGameMap());
ComboGameMap.SelectedIndex = 0;
}
}
/// <summary> /// <summary>
/// 双击房间列表中的项可以加入房间 /// 双击房间列表中的项可以加入房间
/// </summary> /// </summary>
@ -1166,7 +1278,7 @@ namespace Milimoe.FunGame.Desktop.UI
{ {
if (RoomList.SelectedItem != null) if (RoomList.SelectedItem != null)
{ {
TaskUtility.NewTask(async () => await JoinRoom(true, RoomList.SelectedItem.ToString() ?? "")); TaskUtility.NewTask(async () => await JoinRoom(RoomList.SelectedIndex));
} }
} }
@ -1180,25 +1292,6 @@ namespace Milimoe.FunGame.Desktop.UI
SendTalkText_Click(true); SendTalkText_Click(true);
} }
/// <summary>
/// 勾选任意模式选项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CheckGameMode_CheckedChanged(object sender, EventArgs e)
{
bool IsMix = CheckMix.Checked;
bool IsTeam = CheckTeam.Checked;
bool IsHasPass = CheckHasPass.Checked;
if (IsMix && IsTeam && !IsHasPass) Config.FunGame_RoomType = RoomSet.All;
else if (IsMix && IsTeam && IsHasPass) Config.FunGame_RoomType = RoomSet.All;
else if (IsMix && !IsTeam && !IsHasPass) Config.FunGame_RoomType = RoomSet.Mix;
else if (IsMix && !IsTeam && IsHasPass) Config.FunGame_RoomType = RoomSet.Mix;
else if (!IsMix && IsTeam && !IsHasPass) Config.FunGame_RoomType = RoomSet.Team;
else if (!IsMix && IsTeam && IsHasPass) Config.FunGame_RoomType = RoomSet.Team;
else Config.FunGame_RoomType = RoomSet.All;
}
/// <summary> /// <summary>
/// 房间号输入框点击/焦点事件 /// 房间号输入框点击/焦点事件
/// </summary> /// </summary>
@ -1238,7 +1331,7 @@ namespace Milimoe.FunGame.Desktop.UI
if (e.KeyCode.Equals(Keys.Enter)) if (e.KeyCode.Equals(Keys.Enter))
{ {
// 按下回车加入房间 // 按下回车加入房间
TaskUtility.NewTask(async () => await JoinRoom(false, RoomText.Text)); TaskUtility.NewTask(async () => await JoinRoom(RoomText.Text));
} }
} }
@ -1494,8 +1587,8 @@ namespace Milimoe.FunGame.Desktop.UI
if (Usercfg.InRoom.Roomid == "-1") if (Usercfg.InRoom.Roomid == "-1")
{ {
GameMode? mode = RunTime.GameModeLoader?.Modes.Values.FirstOrDefault() ?? default; GameMode? mode = RunTime.GameModeLoader?.Modes.Values.FirstOrDefault() ?? default;
if (mode != null) TaskUtility.NewTask(() => CreateRoom_Handler(RoomSet.Mix, mode.Name, mode.DefaultMap)); if (mode != null) TaskUtility.NewTask(() => CreateRoom_Handler(RoomType.Mix, mode.Name, mode.DefaultMap, false));
else WritelnGameInfo(">> 缺少" + RoomSet.GetTypeString(RoomType.Mix) + "所需的模组,无法创建房间。"); else WritelnGameInfo(">> 缺少" + RoomSet.GetTypeString(RoomType.Mix) + "所需的模组,无法创建房间。此命令使用默认模组创建。");
} }
else WritelnGameInfo(">> 先退出当前房间才可以创建房间。"); else WritelnGameInfo(">> 先退出当前房间才可以创建房间。");
break; break;
@ -1503,8 +1596,8 @@ namespace Milimoe.FunGame.Desktop.UI
if (Usercfg.InRoom.Roomid == "-1") if (Usercfg.InRoom.Roomid == "-1")
{ {
GameMode? mode = RunTime.GameModeLoader?.Modes.Values.FirstOrDefault() ?? default; GameMode? mode = RunTime.GameModeLoader?.Modes.Values.FirstOrDefault() ?? default;
if (mode != null) TaskUtility.NewTask(() => CreateRoom_Handler(RoomSet.Team, mode.Name, mode.DefaultMap)); if (mode != null) TaskUtility.NewTask(() => CreateRoom_Handler(RoomType.Team, mode.Name, mode.DefaultMap, false));
else WritelnGameInfo(">> 缺少" + RoomSet.GetTypeString(RoomType.Team) + "所需的模组,无法创建房间。"); else WritelnGameInfo(">> 缺少" + RoomSet.GetTypeString(RoomType.Team) + "所需的模组,无法创建房间。此命令使用默认模组创建。");
} }
else WritelnGameInfo(">> 先退出当前房间才可以创建房间。"); else WritelnGameInfo(">> 先退出当前房间才可以创建房间。");
break; break;
@ -1644,6 +1737,22 @@ namespace Milimoe.FunGame.Desktop.UI
return false; return false;
} }
/// <summary>
/// 设置当前的房间类型
/// </summary>
private void SetRoomTypeString()
{
Config.FunGame_RoomType = ComboRoomType.SelectedIndex switch
{
1 => RoomType.Mix,
2 => RoomType.Team,
3 => RoomType.Solo,
4 => RoomType.FastAuto,
5 => RoomType.Custom,
_ => RoomType.All,
};
}
#endregion #endregion
#region #region
@ -1660,6 +1769,11 @@ namespace Milimoe.FunGame.Desktop.UI
TaskUtility.NewTask(() => TaskUtility.NewTask(() =>
{ {
if (RunTime.Controller != null)
{
(RunTime.Session.Server_IP, RunTime.Session.Server_Port) = RunTime.Controller.GetServerAddress();
}
(EventArgs.ServerIP, EventArgs.ServerPort) = (RunTime.Session.Server_IP, RunTime.Session.Server_Port);
OnBeforeConnectEvent(this, EventArgs); OnBeforeConnectEvent(this, EventArgs);
RunTime.PluginLoader?.OnBeforeConnectEvent(this, EventArgs); RunTime.PluginLoader?.OnBeforeConnectEvent(this, EventArgs);
if (EventArgs.Cancel) return; if (EventArgs.Cancel) return;
@ -1831,7 +1945,7 @@ namespace Milimoe.FunGame.Desktop.UI
/// </summary> /// </summary>
/// <param name="room"></param> /// <param name="room"></param>
/// <returns></returns> /// <returns></returns>
public async Task<Room> InvokeController_CreateRoom(string RoomType, string GameMode, string GameMap, string Password = "") public async Task<Room> InvokeController_CreateRoom(RoomType RoomType, string GameMode, string GameMap, bool IsRank, string Password = "")
{ {
RoomEventArgs EventArgs = new(RoomType, Password); RoomEventArgs EventArgs = new(RoomType, Password);
Room room = General.HallInstance; Room room = General.HallInstance;
@ -1842,7 +1956,7 @@ namespace Milimoe.FunGame.Desktop.UI
RunTime.PluginLoader?.OnBeforeCreateRoomEvent(this, EventArgs); RunTime.PluginLoader?.OnBeforeCreateRoomEvent(this, EventArgs);
if (EventArgs.Cancel) return room; if (EventArgs.Cancel) return room;
room = MainController is null ? room : await MainController.CreateRoomAsync(RoomType, GameMode, GameMap, Password); room = MainController is null ? room : await MainController.CreateRoomAsync(RoomType, GameMode, GameMap, IsRank, Password);
if (room.Roomid != "-1") if (room.Roomid != "-1")
{ {
@ -1893,7 +2007,7 @@ namespace Milimoe.FunGame.Desktop.UI
OnSucceedQuitRoomEvent(this, EventArgs); OnSucceedQuitRoomEvent(this, EventArgs);
RunTime.PluginLoader?.OnSucceedQuitRoomEvent(this, EventArgs); RunTime.PluginLoader?.OnSucceedQuitRoomEvent(this, EventArgs);
// 禁用和激活按钮,并切换预设快捷消息 // 禁用和激活按钮,并切换预设快捷消息
SetButtonEnableIfLogon(true, ClientState.Online); SetButtonEnabled(true, ClientState.Online);
} }
else else
{ {
@ -1911,7 +2025,7 @@ namespace Milimoe.FunGame.Desktop.UI
OnAfterQuitRoomEvent(this, EventArgs); OnAfterQuitRoomEvent(this, EventArgs);
RunTime.PluginLoader?.OnAfterQuitRoomEvent(this, EventArgs); RunTime.PluginLoader?.OnAfterQuitRoomEvent(this, EventArgs);
// 禁用和激活按钮,并切换预设快捷消息 // 禁用和激活按钮,并切换预设快捷消息
SetButtonEnableIfLogon(true, ClientState.Online); SetButtonEnabled(true, ClientState.Online);
} }
return result; return result;

View File

@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>