mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-12-05 00:06:02 +00:00
parent
afeccc1b9a
commit
01ba44fab6
@ -19,6 +19,15 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
return RoomFactory.GetInstance(DsRoom, DsUser, Index);
|
return RoomFactory.GetInstance(DsRoom, DsUser, Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取大厅(-1号房)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
internal static Room GetHall()
|
||||||
|
{
|
||||||
|
return GetRoom(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取Skill实例,默认返回PassiveSkill
|
/// 获取Skill实例,默认返回PassiveSkill
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -16,15 +16,7 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
public User? RoomMaster { get; set; }
|
public User? RoomMaster { get; set; }
|
||||||
public RoomType RoomType { get; set; }
|
public RoomType RoomType { get; set; }
|
||||||
public RoomState RoomState { get; set; }
|
public RoomState RoomState { get; set; }
|
||||||
public bool HasPass
|
public bool HasPass => Password.Trim() != "";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (RoomType == RoomType.MixHasPass || RoomType == RoomType.TeamHasPass)
|
|
||||||
return true;
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public string Password { get; set; } = "";
|
public string Password { get; set; } = "";
|
||||||
public GameStatistics? Statistics { get; set; } = null;
|
public GameStatistics? Statistics { get; set; } = null;
|
||||||
|
|
||||||
@ -41,6 +33,16 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
RoomState = (RoomState)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomState]);
|
RoomState = (RoomState)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomState]);
|
||||||
Password = (string)DrRoom[RoomQuery.Column_Password];
|
Password = (string)DrRoom[RoomQuery.Column_Password];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Id = 0;
|
||||||
|
Roomid = "-1";
|
||||||
|
CreateTime = DateTime.MinValue;
|
||||||
|
RoomMaster = null;
|
||||||
|
RoomType = RoomType.None;
|
||||||
|
RoomState = RoomState.Created;
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Room other)
|
public bool Equals(Room other)
|
||||||
|
|||||||
@ -1,12 +1,37 @@
|
|||||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class RoomEventArgs
|
public class RoomEventArgs
|
||||||
{
|
{
|
||||||
public string RoomID { get; set; } = "";
|
public string RoomID { get; set; } = "";
|
||||||
|
public long RoomMaster { get; set; } = 0;
|
||||||
|
public RoomType RoomType { get; set; } = RoomType.None;
|
||||||
|
public RoomState RoomState { get; set; } = RoomState.Created;
|
||||||
|
public bool HasPassword => Password.Trim() != "";
|
||||||
|
public string Password { get; set; } = "";
|
||||||
|
|
||||||
public RoomEventArgs(string RoomID = "")
|
public RoomEventArgs(string RoomType, string Password)
|
||||||
{
|
{
|
||||||
this.RoomID = RoomID;
|
this.RoomType = RoomType switch
|
||||||
|
{
|
||||||
|
GameMode.GameMode_Mix => Constant.RoomType.Mix,
|
||||||
|
GameMode.GameMode_Team => Constant.RoomType.Team,
|
||||||
|
GameMode.GameMode_MixHasPass => Constant.RoomType.MixHasPass,
|
||||||
|
GameMode.GameMode_TeamHasPass => Constant.RoomType.TeamHasPass,
|
||||||
|
_ => Constant.RoomType.None
|
||||||
|
};
|
||||||
|
this.Password = Password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoomEventArgs(Room Room)
|
||||||
|
{
|
||||||
|
RoomID = Room.Roomid;
|
||||||
|
RoomMaster = Room.RoomMaster != null ? Room.RoomMaster.Id : 0;
|
||||||
|
RoomType = Room.RoomType;
|
||||||
|
RoomState = Room.RoomState;
|
||||||
|
Password = Room.Password;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
|||||||
{
|
{
|
||||||
// Static Variable
|
// Static Variable
|
||||||
public static Empty EntityInstance { get; } = new();
|
public static Empty EntityInstance { get; } = new();
|
||||||
|
public static Room HallInstance { get; } = Api.Utility.Factory.GetHall();
|
||||||
public static Encoding DefaultEncoding { get; } = Encoding.Unicode;
|
public static Encoding DefaultEncoding { get; } = Encoding.Unicode;
|
||||||
|
|
||||||
// Const
|
// Const
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
public enum RoomType
|
public enum RoomType
|
||||||
{
|
{
|
||||||
|
None,
|
||||||
Mix,
|
Mix,
|
||||||
Team,
|
Team,
|
||||||
MixHasPass,
|
MixHasPass,
|
||||||
@ -66,7 +67,8 @@
|
|||||||
CheckReg,
|
CheckReg,
|
||||||
CreateRoom,
|
CreateRoom,
|
||||||
UpdateRoom,
|
UpdateRoom,
|
||||||
ChangeRoomSetting
|
ChangeRoomSetting,
|
||||||
|
MatchRoom
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DataRequestType
|
public enum DataRequestType
|
||||||
|
|||||||
@ -17,15 +17,13 @@ namespace Milimoe.FunGame.Core.Library.Server
|
|||||||
_Server = Server;
|
_Server = Server;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Room> GetRoomList()
|
public Room? this[string RoomID] => GetRoom(RoomID);
|
||||||
{
|
|
||||||
return _List.Values.Cast<Room>().ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<string> GetRoomIDList()
|
public Hashtable GetHashTable => _List;
|
||||||
{
|
|
||||||
return _List.Keys.Cast<string>().ToList();
|
public List<Room> GetRoomList => _List.Values.Cast<Room>().ToList();
|
||||||
}
|
|
||||||
|
public List<string> GetRoomIDList => _List.Keys.Cast<string>().ToList();
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user