mirror of
https://github.com/project-redbud/FunGame-Desktop.git
synced 2025-04-21 12:39:34 +08:00
更名
This commit is contained in:
parent
ab2f2c6c3d
commit
ef922ef4a2
@ -129,7 +129,7 @@ namespace Milimoe.FunGame.Desktop.Controller
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Core.Api.Utility.TaskUtility.StartAndAwaitTask(async () => await LoginController.LoginAccountAsync(Username, Password, AutoKey));
|
Core.Api.Utility.TaskUtility.NewTask(async () => await LoginController.LoginAccountAsync(Username, Password, AutoKey));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ namespace Milimoe.FunGame.Desktop.Library.Component
|
|||||||
}
|
}
|
||||||
if (AutoClose > 0)
|
if (AutoClose > 0)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
string msg = MsgText.Text;
|
string msg = MsgText.Text;
|
||||||
int s = AutoClose;
|
int s = AutoClose;
|
||||||
|
@ -19,7 +19,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
|
|
||||||
private void FindPassword_Click(object sender, EventArgs e)
|
private void FindPassword_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (RunTime.Socket != null)
|
if (RunTime.Socket != null)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
GoToLogin.Enabled = false;
|
GoToLogin.Enabled = false;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
result = await Login_Handler();
|
result = await Login_Handler();
|
||||||
}).OnCompleted(() =>
|
}).OnCompleted(() =>
|
||||||
|
@ -56,7 +56,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
// 创建RunTime
|
// 创建RunTime
|
||||||
RunTime.Controller = new RunTimeController(this);
|
RunTime.Controller = new RunTimeController(this);
|
||||||
// 窗口句柄创建后,进行委托
|
// 窗口句柄创建后,进行委托
|
||||||
TaskUtility.StartAndAwaitTask(() =>
|
TaskUtility.NewTask(() =>
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -724,7 +724,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
if (isLeave) TalkText_Leave(); // 回车不离开焦点
|
if (isLeave) TalkText_Leave(); // 回车不离开焦点
|
||||||
if (MainController != null && Usercfg.LoginUser.Id != 0 && !SwitchTalkMessage(text))
|
if (MainController != null && Usercfg.LoginUser.Id != 0 && !SwitchTalkMessage(text))
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (!await InvokeController_SendTalk(" [ " + Usercfg.LoginUserName + " ] 说: " + text))
|
if (!await InvokeController_SendTalk(" [ " + Usercfg.LoginUserName + " ] 说: " + text))
|
||||||
{
|
{
|
||||||
@ -866,7 +866,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
private void ExitFunGame()
|
private void ExitFunGame()
|
||||||
{
|
{
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
TaskUtility.StartAndAwaitTask(() =>
|
TaskUtility.NewTask(() =>
|
||||||
{
|
{
|
||||||
if (ShowMessage(ShowMessageType.OKCancel, "你确定关闭游戏?", "退出") == MessageResult.OK)
|
if (ShowMessage(ShowMessageType.OKCancel, "你确定关闭游戏?", "退出") == MessageResult.OK)
|
||||||
{
|
{
|
||||||
@ -893,7 +893,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Exit_Click(object sender, EventArgs e)
|
private void Exit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(ExitFunGame);
|
TaskUtility.NewTask(ExitFunGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -960,7 +960,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
ShowMessage(ShowMessageType.Warning, "请勾选你要创建的房间类型!");
|
ShowMessage(ShowMessageType.Warning, "请勾选你要创建的房间类型!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TaskUtility.StartAndAwaitTask(() => CreateRoom_Handler(Config.FunGame_GameMode, password));
|
TaskUtility.NewTask(() => CreateRoom_Handler(Config.FunGame_GameMode, password));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -973,7 +973,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
string roomid = Usercfg.InRoom.Roomid;
|
string roomid = Usercfg.InRoom.Roomid;
|
||||||
bool isMaster = Usercfg.InRoom.RoomMaster?.Id == Usercfg.LoginUser.Id;
|
bool isMaster = Usercfg.InRoom.RoomMaster?.Id == Usercfg.LoginUser.Id;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (await InvokeController_QuitRoom(Usercfg.InRoom, isMaster))
|
if (await InvokeController_QuitRoom(Usercfg.InRoom, isMaster))
|
||||||
{
|
{
|
||||||
@ -1017,7 +1017,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.StartAndAwaitTask(async () => await JoinRoom(false, RoomText.Text));
|
TaskUtility.NewTask(async () => await JoinRoom(false, RoomText.Text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1027,7 +1027,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Logout_Click(object sender, EventArgs e)
|
private void Logout_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (ShowMessage(ShowMessageType.OKCancel, "你确定要退出登录吗?", "退出登录") == MessageResult.OK)
|
if (ShowMessage(ShowMessageType.OKCancel, "你确定要退出登录吗?", "退出登录") == MessageResult.OK)
|
||||||
{
|
{
|
||||||
@ -1069,7 +1069,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
if (RoomList.SelectedItem != null)
|
if (RoomList.SelectedItem != null)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(async () => await JoinRoom(true, RoomList.SelectedItem.ToString() ?? ""));
|
TaskUtility.NewTask(async () => await JoinRoom(true, RoomList.SelectedItem.ToString() ?? ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1141,7 +1141,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
if (e.KeyCode.Equals(Keys.Enter))
|
if (e.KeyCode.Equals(Keys.Enter))
|
||||||
{
|
{
|
||||||
// 按下回车加入房间
|
// 按下回车加入房间
|
||||||
TaskUtility.StartAndAwaitTask(async () => await JoinRoom(false, RoomText.Text));
|
TaskUtility.NewTask(async () => await JoinRoom(false, RoomText.Text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,7 +1219,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void RefreshRoomList_Click(object sender, EventArgs e)
|
private void RefreshRoomList_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (MainController != null)
|
if (MainController != null)
|
||||||
{
|
{
|
||||||
@ -1284,7 +1284,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private void SucceedLoginEvent(object sender, GeneralEventArgs e)
|
private void SucceedLoginEvent(object sender, GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
TaskUtility.StartAndAwaitTask(SucceedLoginEvent_Handler);
|
TaskUtility.NewTask(SucceedLoginEvent_Handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1374,10 +1374,10 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
GameInfo.Clear();
|
GameInfo.Clear();
|
||||||
break;
|
break;
|
||||||
case Constant.FunGame_CreateMix:
|
case Constant.FunGame_CreateMix:
|
||||||
TaskUtility.StartAndAwaitTask(() => CreateRoom_Handler(GameMode.Mix));
|
TaskUtility.NewTask(() => CreateRoom_Handler(GameMode.Mix));
|
||||||
break;
|
break;
|
||||||
case Constant.FunGame_CreateTeam:
|
case Constant.FunGame_CreateTeam:
|
||||||
TaskUtility.StartAndAwaitTask(() => CreateRoom_Handler(GameMode.Team));
|
TaskUtility.NewTask(() => CreateRoom_Handler(GameMode.Team));
|
||||||
break;
|
break;
|
||||||
case Constant.FunGame_StartGame:
|
case Constant.FunGame_StartGame:
|
||||||
break;
|
break;
|
||||||
@ -1412,7 +1412,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
// 先退出登录再断开连接
|
// 先退出登录再断开连接
|
||||||
bool SuccessLogOut = false;
|
bool SuccessLogOut = false;
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (await LogOut()) SuccessLogOut = true;
|
if (await LogOut()) SuccessLogOut = true;
|
||||||
}).OnCompleted(() =>
|
}).OnCompleted(() =>
|
||||||
@ -1481,7 +1481,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
|
|
||||||
ConnectResult result = ConnectResult.CanNotConnect;
|
ConnectResult result = ConnectResult.CanNotConnect;
|
||||||
|
|
||||||
TaskUtility.StartAndAwaitTask(() =>
|
TaskUtility.NewTask(() =>
|
||||||
{
|
{
|
||||||
OnBeforeConnectEvent(this, EventArgs);
|
OnBeforeConnectEvent(this, EventArgs);
|
||||||
RunTime.PluginLoader?.OnBeforeConnectEvent(this, EventArgs);
|
RunTime.PluginLoader?.OnBeforeConnectEvent(this, EventArgs);
|
||||||
@ -1522,48 +1522,42 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
public void InvokeController_Disconnect()
|
public void InvokeController_Disconnect()
|
||||||
{
|
{
|
||||||
GeneralEventArgs EventArgs = new();
|
GeneralEventArgs EventArgs = new();
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
try
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
bool result = false;
|
OnBeforeDisconnectEvent(this, EventArgs);
|
||||||
|
RunTime.PluginLoader?.OnBeforeDisconnectEvent(this, EventArgs);
|
||||||
|
if (EventArgs.Cancel) return;
|
||||||
|
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
if (Usercfg.LoginUser.Id != 0)
|
||||||
{
|
{
|
||||||
OnBeforeDisconnectEvent(this, EventArgs);
|
await LogOut();
|
||||||
if (EventArgs.Cancel) return;
|
}
|
||||||
RunTime.PluginLoader?.OnBeforeDisconnectEvent(this, EventArgs);
|
|
||||||
if (EventArgs.Cancel) return;
|
|
||||||
|
|
||||||
if (Usercfg.LoginUser.Id != 0)
|
result = RunTime.Controller?.Disconnect() ?? false;
|
||||||
{
|
}).OnCompleted(() =>
|
||||||
await LogOut();
|
{
|
||||||
}
|
if (result)
|
||||||
|
|
||||||
result = RunTime.Controller?.Disconnect() ?? false;
|
|
||||||
}).OnCompleted(() =>
|
|
||||||
{
|
{
|
||||||
if (result)
|
OnSucceedDisconnectEvent(this, EventArgs);
|
||||||
{
|
RunTime.PluginLoader?.OnSucceedDisconnectEvent(this, EventArgs);
|
||||||
OnSucceedDisconnectEvent(this, EventArgs);
|
}
|
||||||
RunTime.PluginLoader?.OnSucceedDisconnectEvent(this, EventArgs);
|
else
|
||||||
}
|
{
|
||||||
else
|
OnFailedDisconnectEvent(this, EventArgs);
|
||||||
{
|
RunTime.PluginLoader?.OnFailedDisconnectEvent(this, EventArgs);
|
||||||
OnFailedDisconnectEvent(this, EventArgs);
|
}
|
||||||
RunTime.PluginLoader?.OnFailedDisconnectEvent(this, EventArgs);
|
OnAfterDisconnectEvent(this, EventArgs);
|
||||||
}
|
RunTime.PluginLoader?.OnAfterDisconnectEvent(this, EventArgs);
|
||||||
OnAfterDisconnectEvent(this, EventArgs);
|
}).OnError(e =>
|
||||||
RunTime.PluginLoader?.OnAfterDisconnectEvent(this, EventArgs);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
GetMessage(e.GetErrorInfo(), TimeType.None);
|
GetMessage(e.GetErrorInfo(), TimeType.None);
|
||||||
OnFailedDisconnectEvent(this, EventArgs);
|
OnFailedDisconnectEvent(this, EventArgs);
|
||||||
RunTime.PluginLoader?.OnFailedDisconnectEvent(this, EventArgs);
|
RunTime.PluginLoader?.OnFailedDisconnectEvent(this, EventArgs);
|
||||||
OnAfterDisconnectEvent(this, EventArgs);
|
OnAfterDisconnectEvent(this, EventArgs);
|
||||||
RunTime.PluginLoader?.OnAfterDisconnectEvent(this, EventArgs);
|
RunTime.PluginLoader?.OnAfterDisconnectEvent(this, EventArgs);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1668,7 +1662,6 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnBeforeCreateRoomEvent(this, EventArgs);
|
OnBeforeCreateRoomEvent(this, EventArgs);
|
||||||
if (EventArgs.Cancel) return room;
|
|
||||||
RunTime.PluginLoader?.OnBeforeCreateRoomEvent(this, EventArgs);
|
RunTime.PluginLoader?.OnBeforeCreateRoomEvent(this, EventArgs);
|
||||||
if (EventArgs.Cancel) return room;
|
if (EventArgs.Cancel) return room;
|
||||||
|
|
||||||
|
@ -115,14 +115,14 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
{
|
{
|
||||||
string username = ((RegisterEventArgs)e).Username;
|
string username = ((RegisterEventArgs)e).Username;
|
||||||
string password = ((RegisterEventArgs)e).Password;
|
string password = ((RegisterEventArgs)e).Password;
|
||||||
TaskUtility.StartAndAwaitTask(async () => await LoginController.LoginAccountAsync(username, password, encrypt: false));
|
TaskUtility.NewTask(async () => await LoginController.LoginAccountAsync(username, password, encrypt: false));
|
||||||
RunTime.Login?.Close();
|
RunTime.Login?.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegButton_Click(object sender, EventArgs e)
|
private void RegButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
RegButton.Enabled = false;
|
RegButton.Enabled = false;
|
||||||
TaskUtility.StartAndAwaitTask(async () =>
|
TaskUtility.NewTask(async () =>
|
||||||
{
|
{
|
||||||
if (!await Reg_Handler()) RegButton.Enabled = true;
|
if (!await Reg_Handler()) RegButton.Enabled = true;
|
||||||
else Close();
|
else Close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user