mirror of
https://github.com/project-redbud/FunGame-Desktop.git
synced 2025-04-23 13:39:36 +08:00
同步更新RoomList (#5)
This commit is contained in:
parent
b6be24b5b2
commit
70cda7bd43
@ -25,6 +25,7 @@ namespace Milimoe.FunGame.Desktop.Library
|
|||||||
public const string FunGame_ShowCredits = "积分";
|
public const string FunGame_ShowCredits = "积分";
|
||||||
public const string FunGame_ShowStock = "查看库存";
|
public const string FunGame_ShowStock = "查看库存";
|
||||||
public const string FunGame_ShowStore = "游戏商店";
|
public const string FunGame_ShowStore = "游戏商店";
|
||||||
|
public const string FunGame_ClearGameInfo = "清空消息队列";
|
||||||
public const string FunGame_CreateMix = "创建游戏 混战";
|
public const string FunGame_CreateMix = "创建游戏 混战";
|
||||||
public const string FunGame_CreateTeam = "创建游戏 团队";
|
public const string FunGame_CreateTeam = "创建游戏 团队";
|
||||||
public const string FunGame_StartGame = "开始游戏";
|
public const string FunGame_StartGame = "开始游戏";
|
||||||
@ -42,6 +43,7 @@ namespace Milimoe.FunGame.Desktop.Library
|
|||||||
FunGame_ShowCredits,
|
FunGame_ShowCredits,
|
||||||
FunGame_ShowStock,
|
FunGame_ShowStock,
|
||||||
FunGame_ShowStore,
|
FunGame_ShowStore,
|
||||||
|
FunGame_ClearGameInfo,
|
||||||
FunGame_CreateMix,
|
FunGame_CreateMix,
|
||||||
FunGame_CreateTeam,
|
FunGame_CreateTeam,
|
||||||
FunGame_StartGame,
|
FunGame_StartGame,
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
Hashtable list = await Task.Factory.StartNew(SocketHandler_UpdateRoom);
|
List<Room> list = await Task.Factory.StartNew(SocketHandler_UpdateRoom);
|
||||||
Main.UpdateUI(MainInvokeType.UpdateRoom, list);
|
Main.UpdateUI(MainInvokeType.UpdateRoom, list);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -283,9 +283,9 @@ namespace Milimoe.FunGame.Desktop.Model
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable SocketHandler_UpdateRoom()
|
private List<Room> SocketHandler_UpdateRoom()
|
||||||
{
|
{
|
||||||
Hashtable table = new();
|
List<Room> list = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WaitForWorkDone();
|
WaitForWorkDone();
|
||||||
@ -294,19 +294,14 @@ namespace Milimoe.FunGame.Desktop.Model
|
|||||||
if (Work.Length > 1) DsUser = Work.GetParam<DataSet>(1);
|
if (Work.Length > 1) DsUser = Work.GetParam<DataSet>(1);
|
||||||
if (DsRoom != null && DsUser != null)
|
if (DsRoom != null && DsUser != null)
|
||||||
{
|
{
|
||||||
List<Room> list = Core.Api.Utility.Factory.GetList<Room>(DsRoom, DsUser);
|
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());
|
||||||
}
|
}
|
||||||
return table;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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;
|
||||||
|
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using Milimoe.FunGame.Core.Library.Exception;
|
using Milimoe.FunGame.Core.Library.Exception;
|
||||||
@ -29,7 +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();
|
private readonly RoomList Rooms = new();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 委托【即将删除】
|
* 委托【即将删除】
|
||||||
@ -206,8 +206,9 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
if (objs != null && objs.Length > 0)
|
if (objs != null && objs.Length > 0)
|
||||||
{
|
{
|
||||||
RoomList.Items.Clear();
|
RoomList.Items.Clear();
|
||||||
Rooms = (Hashtable)objs[0];
|
Rooms.Clear();
|
||||||
foreach (string roomid in Rooms.Keys)
|
Rooms.AddRooms((List<Room>)objs[0]);
|
||||||
|
foreach (string roomid in Rooms.ListRoomID)
|
||||||
{
|
{
|
||||||
if (roomid != "-1") RoomList.Items.Add(roomid);
|
if (roomid != "-1") RoomList.Items.Add(roomid);
|
||||||
}
|
}
|
||||||
@ -1264,7 +1265,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomid"></param>
|
/// <param name="roomid"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool CheckRoomIDExist(string roomid) => Rooms.ContainsKey(roomid);
|
private bool CheckRoomIDExist(string roomid) => Rooms.IsExist(roomid);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取房间对象
|
/// 获取房间对象
|
||||||
@ -1293,6 +1294,9 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
break;
|
break;
|
||||||
case Constant.FunGame_ShowStore:
|
case Constant.FunGame_ShowStore:
|
||||||
break;
|
break;
|
||||||
|
case Constant.FunGame_ClearGameInfo:
|
||||||
|
GameInfo.Clear();
|
||||||
|
break;
|
||||||
case Constant.FunGame_CreateMix:
|
case Constant.FunGame_CreateMix:
|
||||||
await CreateRoom_Handler(GameMode.GameMode_Mix);
|
await CreateRoom_Handler(GameMode.GameMode_Mix);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user