mirror of
https://github.com/project-redbud/FunGame-Desktop.git
synced 2025-04-21 04:29:34 +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_ShowStock = "查看库存";
|
||||
public const string FunGame_ShowStore = "游戏商店";
|
||||
public const string FunGame_ClearGameInfo = "清空消息队列";
|
||||
public const string FunGame_CreateMix = "创建游戏 混战";
|
||||
public const string FunGame_CreateTeam = "创建游戏 团队";
|
||||
public const string FunGame_StartGame = "开始游戏";
|
||||
@ -42,6 +43,7 @@ namespace Milimoe.FunGame.Desktop.Library
|
||||
FunGame_ShowCredits,
|
||||
FunGame_ShowStock,
|
||||
FunGame_ShowStore,
|
||||
FunGame_ClearGameInfo,
|
||||
FunGame_CreateMix,
|
||||
FunGame_CreateTeam,
|
||||
FunGame_StartGame,
|
||||
|
@ -87,7 +87,7 @@ namespace Milimoe.FunGame.Desktop.Model
|
||||
SetWorking();
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
@ -283,9 +283,9 @@ namespace Milimoe.FunGame.Desktop.Model
|
||||
return result;
|
||||
}
|
||||
|
||||
private Hashtable SocketHandler_UpdateRoom()
|
||||
private List<Room> SocketHandler_UpdateRoom()
|
||||
{
|
||||
Hashtable table = new();
|
||||
List<Room> list = new();
|
||||
try
|
||||
{
|
||||
WaitForWorkDone();
|
||||
@ -294,19 +294,14 @@ namespace Milimoe.FunGame.Desktop.Model
|
||||
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);
|
||||
}
|
||||
list = Core.Api.Utility.Factory.GetList<Room>(DsRoom, DsUser);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.GetMessage(e.GetErrorInfo());
|
||||
}
|
||||
return table;
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
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.Exception;
|
||||
@ -29,7 +29,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
||||
*/
|
||||
private Task? MatchFunGame = 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)
|
||||
{
|
||||
RoomList.Items.Clear();
|
||||
Rooms = (Hashtable)objs[0];
|
||||
foreach (string roomid in Rooms.Keys)
|
||||
Rooms.Clear();
|
||||
Rooms.AddRooms((List<Room>)objs[0]);
|
||||
foreach (string roomid in Rooms.ListRoomID)
|
||||
{
|
||||
if (roomid != "-1") RoomList.Items.Add(roomid);
|
||||
}
|
||||
@ -1264,7 +1265,7 @@ namespace Milimoe.FunGame.Desktop.UI
|
||||
/// </summary>
|
||||
/// <param name="roomid"></param>
|
||||
/// <returns></returns>
|
||||
private bool CheckRoomIDExist(string roomid) => Rooms.ContainsKey(roomid);
|
||||
private bool CheckRoomIDExist(string roomid) => Rooms.IsExist(roomid);
|
||||
|
||||
/// <summary>
|
||||
/// 获取房间对象
|
||||
@ -1293,6 +1294,9 @@ namespace Milimoe.FunGame.Desktop.UI
|
||||
break;
|
||||
case Constant.FunGame_ShowStore:
|
||||
break;
|
||||
case Constant.FunGame_ClearGameInfo:
|
||||
GameInfo.Clear();
|
||||
break;
|
||||
case Constant.FunGame_CreateMix:
|
||||
await CreateRoom_Handler(GameMode.GameMode_Mix);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user