mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-23 04:29:36 +08:00
添加GameMode, GameMap, GameModeLoader (#62)
* 添加GameMode, GameMap; 优化了Plugin和RoomType等 * 添加GameModeLoader,重构GameMode和GameMap * 添加Gaming事件接口 * 添加IGameModeSupported接口 * 为GameMode添加Implement接口 * 为BeforeConnect添加参数
This commit is contained in:
parent
f4a623878c
commit
543887881a
@ -13,9 +13,9 @@ namespace Milimoe.FunGame.Core.Api.Factory
|
||||
return RoomFactory.Create();
|
||||
}
|
||||
|
||||
public static Room Create(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.All, RoomState RoomState = RoomState.Created, string Password = "")
|
||||
public static Room Create(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.All, string GameMode = "", string GameMap = "", RoomState RoomState = RoomState.Created, string Password = "")
|
||||
{
|
||||
return new Room(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password);
|
||||
return new Room(Id, Roomid, CreateTime, RoomMaster, RoomType, GameMode, GameMap, RoomState, Password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,12 +69,14 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
/// <param name="CreateTime">创建时间</param>
|
||||
/// <param name="RoomMaster">房主</param>
|
||||
/// <param name="RoomType">房间类型</param>
|
||||
/// <param name="GameMode">游戏模组</param>
|
||||
/// <param name="GameMap"></param>
|
||||
/// <param name="RoomState">房间状态</param>
|
||||
/// <param name="Password">房间密码</param>
|
||||
/// <returns></returns>
|
||||
public static Room GetRoom(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.All, RoomState RoomState = RoomState.Created, string Password = "")
|
||||
public static Room GetRoom(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.All, string GameMode = "", string GameMap = "", RoomState RoomState = RoomState.Created, string Password = "")
|
||||
{
|
||||
return RoomFactory.Create(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password);
|
||||
return RoomFactory.Create(Id, Roomid, CreateTime, RoomMaster, RoomType, GameMode, GameMap, RoomState, Password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -93,9 +95,11 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
DateTime CreateTime = (DateTime)DrRoom[RoomQuery.Column_CreateTime];
|
||||
User RoomMaster = User;
|
||||
RoomType RoomType = (RoomType)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomType]);
|
||||
string GameMode = (string)DrRoom[RoomQuery.Column_GameMode];
|
||||
string GameMap = (string)DrRoom[RoomQuery.Column_GameMap];
|
||||
RoomState RoomState = (RoomState)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomState]);
|
||||
string Password = (string)DrRoom[RoomQuery.Column_Password];
|
||||
room = GetRoom(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password);
|
||||
room = GetRoom(Id, Roomid, CreateTime, RoomMaster, RoomType, GameMode, GameMap, RoomState, Password);
|
||||
}
|
||||
return room;
|
||||
}
|
||||
@ -108,10 +112,10 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
/// <returns></returns>
|
||||
public static List<Room> GetRooms(DataSet DsRoom, DataSet DsUser)
|
||||
{
|
||||
List<Room> list = new()
|
||||
{
|
||||
List<Room> list =
|
||||
[
|
||||
General.HallInstance
|
||||
};
|
||||
];
|
||||
if (DsRoom != null && DsRoom.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow DrRoom in DsRoom.Tables[0].Rows)
|
||||
@ -129,9 +133,11 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
}
|
||||
}
|
||||
RoomType RoomType = (RoomType)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomType]);
|
||||
string GameMode = (string)DrRoom[RoomQuery.Column_GameMode];
|
||||
string GameMap = (string)DrRoom[RoomQuery.Column_GameMap];
|
||||
RoomState RoomState = (RoomState)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomState]);
|
||||
string Password = (string)DrRoom[RoomQuery.Column_Password];
|
||||
list.Add(GetRoom(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password));
|
||||
list.Add(GetRoom(Id, Roomid, CreateTime, RoomMaster, RoomType, GameMode, GameMap, RoomState, Password));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
586
Api/Utility/GameModeLoader.cs
Normal file
586
Api/Utility/GameModeLoader.cs
Normal file
@ -0,0 +1,586 @@
|
||||
using Milimoe.FunGame.Core.Library.Common.Addon;
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
using Milimoe.FunGame.Core.Service;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
public class GameModeLoader
|
||||
{
|
||||
public Dictionary<string, GameMode> Modes { get; } = [];
|
||||
public Dictionary<string, GameMap> Maps { get; } = [];
|
||||
|
||||
private GameModeLoader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static GameModeLoader LoadGameModes(params object[] objs)
|
||||
{
|
||||
GameModeLoader loader = new();
|
||||
AddonManager.LoadGameModes(loader.Modes, objs);
|
||||
AddonManager.LoadGameMaps(loader.Maps, objs);
|
||||
return loader;
|
||||
}
|
||||
|
||||
public GameMode this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Modes[name];
|
||||
}
|
||||
set
|
||||
{
|
||||
Modes.TryAdd(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
public GameMap GetGameMap(string name)
|
||||
{
|
||||
return Maps[name];
|
||||
}
|
||||
|
||||
public void OnBeforeConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingConnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingConnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingConnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingConnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeDisonnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingDisconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingDisconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingDisconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingDisconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingReconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingReconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingReconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingReconnectEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingBanCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingBanCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingBanCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingBanCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforePickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingPickCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingPickCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingPickCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingPickCharacterEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingRandomEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingRandomEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingRandomEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingRandomEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingMoveEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingMoveEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingMoveEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingMoveEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingAttackEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingAttackEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingAttackEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingAttackEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingItemEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingItemEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingItemEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingItemEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingMagicEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingMagicEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingMagicEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingMagicEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingBuyEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingBuyEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingBuyEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingBuyEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingSuperSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingSuperSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingSuperSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingSuperSkillEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforePauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingPauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingPauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingPauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingPauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingUnpauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingUnpauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingUnpauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingUnpauseEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingSurrenderEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingSurrenderEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingSurrenderEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingSurrenderEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnBeforeUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnBeforeGamingUpdateInfoEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAfterUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnAfterGamingUpdateInfoEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSucceedUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnSucceedGamingUpdateInfoEvent(sender, e);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnFailedUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Modes.Values, mode =>
|
||||
{
|
||||
mode.OnFailedGamingUpdateInfoEvent(sender, e);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
char c = str[i];
|
||||
if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9') length++;
|
||||
if (c is >= 'A' and <= 'Z' or >= 'a' and <= 'z' or >= '0' and <= '9') length++;
|
||||
else length += 2;
|
||||
}
|
||||
return length;
|
||||
|
@ -4,7 +4,7 @@ using Milimoe.FunGame.Core.Library.Constant;
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// See: <see cref="InterfaceType"/>, <see cref="InterfaceSet"/>, <see cref="InterfaceMethod"/>
|
||||
/// See: <see cref="InterfaceMethod"/>, <see cref="InterfaceType"/>, <see cref="InterfaceSet"/>
|
||||
/// </summary>
|
||||
public class Implement
|
||||
{
|
||||
@ -43,12 +43,13 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
InterfaceType.IClient => InterfaceSet.Type.IClient,
|
||||
InterfaceType.IServer => InterfaceSet.Type.IServer,
|
||||
InterfaceType.IGameModeSupported => InterfaceSet.Type.IGameModeSupported,
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取接口方法名
|
||||
/// 获取接口方法名(支持属性)
|
||||
/// </summary>
|
||||
/// <param name="Method">方法</param>
|
||||
/// <returns></returns>
|
||||
@ -59,34 +60,54 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
InterfaceMethod.RemoteServerIP => InterfaceSet.Method.RemoteServerIP,
|
||||
InterfaceMethod.DBConnection => InterfaceSet.Method.DBConnection,
|
||||
InterfaceMethod.GetServerSettings => InterfaceSet.Method.GetServerSettings,
|
||||
InterfaceMethod.GameModeList => InterfaceSet.Method.GameModeList,
|
||||
InterfaceMethod.GameMapList => InterfaceSet.Method.GameMapList,
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 公开方法:获取FunGame.Implement.DLL中指定方法的返回值
|
||||
/// 公开方法:获取FunGame.Implement.DLL中指定方法(属性)的返回值
|
||||
/// </summary>
|
||||
/// <param name="Interface">接口代号</param>
|
||||
/// <param name="Method">方法代号</param>
|
||||
/// <param name="Method">方法代号(支持属性)</param>
|
||||
/// <param name="IsMethod">是否是方法(如是属性请传入false)</param>
|
||||
/// <returns></returns>
|
||||
public static object? GetFunGameImplValue(InterfaceType Interface, InterfaceMethod Method)
|
||||
public static object? GetFunGameImplValue(InterfaceType Interface, InterfaceMethod Method, bool IsMethod = true)
|
||||
{
|
||||
MethodInfo? MethodInfo;
|
||||
PropertyInfo? PropertyInfo;
|
||||
|
||||
// 反射读取程序集
|
||||
Assembly? Assembly = System.Reflection.Assembly.LoadFile(ReflectionSet.EXEFolderPath + ReflectionSet.FUNGAME_IMPL + ".dll");
|
||||
Type? Type = GetFunGameImplementType(Assembly, Interface); // 通过类名获取命名空间+类名称
|
||||
string MethodName = GetImplementMethodName(Method); // 获取方法名
|
||||
// 通过类名获取命名空间+类名称
|
||||
Type? Type = GetFunGameImplementType(Assembly, Interface);
|
||||
|
||||
if (Assembly != null && Type != null) MethodInfo = Type.GetMethod(MethodName); // 从Type中查找方法名
|
||||
else return null;
|
||||
|
||||
object? Instance = Assembly.CreateInstance(Type.Namespace + "." + Type.Name);
|
||||
if (Instance != null && MethodInfo != null)
|
||||
if (Assembly != null && Type != null)
|
||||
{
|
||||
object? value = MethodInfo.Invoke(Instance, Array.Empty<object>()); // 实例方法的调用
|
||||
if (value != null)
|
||||
return value;
|
||||
else return null;
|
||||
// 创建类对象
|
||||
object? Instance = Assembly.CreateInstance(Type.Namespace + "." + Type.Name);
|
||||
// 获取方法/属性名
|
||||
string MethodName = GetImplementMethodName(Method);
|
||||
if (IsMethod)
|
||||
{
|
||||
// 从Type中查找方法名
|
||||
MethodInfo = Type.GetMethod(MethodName);
|
||||
if (Instance != null && MethodInfo != null)
|
||||
{
|
||||
object? value = MethodInfo.Invoke(Instance, []);
|
||||
if (value != null) return value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PropertyInfo = Type.GetProperty(MethodName);
|
||||
if (Instance != null && PropertyInfo != null)
|
||||
{
|
||||
object? value = PropertyInfo.GetValue(Instance);
|
||||
if (value != null) return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1,12 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
using Milimoe.FunGame.Core.Library.Common.Plugin;
|
||||
using Milimoe.FunGame.Core.Library.Common.Addon;
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
using Milimoe.FunGame.Core.Service;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
public class PluginLoader
|
||||
{
|
||||
public Dictionary<string, BasePlugin> Plugins { get; } = new();
|
||||
public Dictionary<string, Plugin> Plugins { get; } = [];
|
||||
|
||||
private PluginLoader()
|
||||
{
|
||||
@ -20,6 +20,18 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
return loader;
|
||||
}
|
||||
|
||||
public Plugin this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Plugins[name];
|
||||
}
|
||||
set
|
||||
{
|
||||
Plugins.TryAdd(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBeforeConnectEvent(object sender, ConnectEventArgs e)
|
||||
{
|
||||
Parallel.ForEach(Plugins.Values, plugin =>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||
using System.Collections;
|
||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
@ -65,7 +66,8 @@ namespace Milimoe.FunGame.Core.Controller
|
||||
/// <returns></returns>
|
||||
public ConnectResult Connect(string ip, int port)
|
||||
{
|
||||
if (!BeforeConnect(ref ip, ref port))
|
||||
ArrayList ConnectArgs = [];
|
||||
if (!BeforeConnect(ref ip, ref port, ConnectArgs))
|
||||
{
|
||||
return ConnectResult.ConnectFailed;
|
||||
}
|
||||
@ -87,7 +89,7 @@ namespace Milimoe.FunGame.Core.Controller
|
||||
_Socket = Socket.Connect(ip, port);
|
||||
if (_Socket != null && _Socket.Connected)
|
||||
{
|
||||
if (_Socket.Send(SocketMessageType.Connect) == SocketResult.Success)
|
||||
if (_Socket.Send(SocketMessageType.Connect, ConnectArgs.Cast<object>().ToArray()) == SocketResult.Success)
|
||||
{
|
||||
SocketObject[] objs = _Socket.ReceiveArray();
|
||||
foreach (SocketObject obj in objs)
|
||||
@ -122,11 +124,17 @@ namespace Milimoe.FunGame.Core.Controller
|
||||
else _Socket?.Close();
|
||||
}
|
||||
|
||||
object[] ConnectArgs = new object[] { result, msg, servername, notice };
|
||||
ConnectArgs.Clear();
|
||||
ConnectArgs = [ result, msg, servername, notice ];
|
||||
AfterConnect(ConnectArgs);
|
||||
|
||||
// 允许修改数组中的result,强行改变连接的结果
|
||||
return (ConnectResult)ConnectArgs[0];
|
||||
if (ConnectArgs.Count > 0)
|
||||
{
|
||||
result = (ConnectResult?)ConnectArgs[0] ?? result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -160,10 +168,11 @@ namespace Milimoe.FunGame.Core.Controller
|
||||
/// 此方法将在连接服务器前触发<para/>
|
||||
/// 客户端可以重写此方法
|
||||
/// </summary>
|
||||
/// <param name="ip"></param>
|
||||
/// <param name="port"></param>
|
||||
/// <param name="ip">服务器IP</param>
|
||||
/// <param name="port">服务器端口</param>
|
||||
/// <param name="args">重写时可以提供额外的连接参数</param>
|
||||
/// <returns>false:中止连接</returns>
|
||||
public virtual bool BeforeConnect(ref string ip, ref int port)
|
||||
public virtual bool BeforeConnect(ref string ip, ref int port, ArrayList args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -174,7 +183,7 @@ namespace Milimoe.FunGame.Core.Controller
|
||||
/// </summary>
|
||||
/// <param name="ConnectArgs">连接服务器后返回的一些数据,可以使用也可以修改它们</param>
|
||||
/// <returns></returns>
|
||||
public virtual void AfterConnect(object[] ConnectArgs)
|
||||
public virtual void AfterConnect(ArrayList ConnectArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
455
Docs/api.xml
455
Docs/api.xml
@ -235,7 +235,7 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Api.Utility.Factory.GetRoom(System.Int64,System.String,System.Nullable{System.DateTime},Milimoe.FunGame.Core.Entity.User,Milimoe.FunGame.Core.Library.Constant.RoomType,Milimoe.FunGame.Core.Library.Constant.RoomState,System.String)">
|
||||
<member name="M:Milimoe.FunGame.Core.Api.Utility.Factory.GetRoom(System.Int64,System.String,System.Nullable{System.DateTime},Milimoe.FunGame.Core.Entity.User,Milimoe.FunGame.Core.Library.Constant.RoomType,System.String,System.String,Milimoe.FunGame.Core.Library.Constant.RoomState,System.String)">
|
||||
<summary>
|
||||
获取房间实例
|
||||
</summary>
|
||||
@ -244,6 +244,8 @@
|
||||
<param name="CreateTime">创建时间</param>
|
||||
<param name="RoomMaster">房主</param>
|
||||
<param name="RoomType">房间类型</param>
|
||||
<param name="GameMode">游戏模组</param>
|
||||
<param name="GameMap"></param>
|
||||
<param name="RoomState">房间状态</param>
|
||||
<param name="Password">房间密码</param>
|
||||
<returns></returns>
|
||||
@ -561,7 +563,7 @@
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Api.Utility.Implement">
|
||||
<summary>
|
||||
See: <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceType"/>, <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceSet"/>, <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceMethod"/>
|
||||
See: <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceMethod"/>, <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceType"/>, <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceSet"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Api.Utility.Implement.GetFunGameImplementType(System.Reflection.Assembly,Milimoe.FunGame.Core.Library.Constant.InterfaceType)">
|
||||
@ -581,17 +583,18 @@
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Api.Utility.Implement.GetImplementMethodName(Milimoe.FunGame.Core.Library.Constant.InterfaceMethod)">
|
||||
<summary>
|
||||
获取接口方法名
|
||||
获取接口方法名(支持属性)
|
||||
</summary>
|
||||
<param name="Method">方法</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Api.Utility.Implement.GetFunGameImplValue(Milimoe.FunGame.Core.Library.Constant.InterfaceType,Milimoe.FunGame.Core.Library.Constant.InterfaceMethod)">
|
||||
<member name="M:Milimoe.FunGame.Core.Api.Utility.Implement.GetFunGameImplValue(Milimoe.FunGame.Core.Library.Constant.InterfaceType,Milimoe.FunGame.Core.Library.Constant.InterfaceMethod,System.Boolean)">
|
||||
<summary>
|
||||
公开方法:获取FunGame.Implement.DLL中指定方法的返回值
|
||||
公开方法:获取FunGame.Implement.DLL中指定方法(属性)的返回值
|
||||
</summary>
|
||||
<param name="Interface">接口代号</param>
|
||||
<param name="Method">方法代号</param>
|
||||
<param name="Method">方法代号(支持属性)</param>
|
||||
<param name="IsMethod">是否是方法(如是属性请传入false)</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Api.Utility.JsonTool">
|
||||
@ -902,16 +905,17 @@
|
||||
<returns>string:IP地址;int:端口号</returns>
|
||||
<exception cref="T:Milimoe.FunGame.FindServerFailedException"></exception>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Controller.RunTimeController.BeforeConnect(System.String@,System.Int32@)">
|
||||
<member name="M:Milimoe.FunGame.Core.Controller.RunTimeController.BeforeConnect(System.String@,System.Int32@,System.Collections.ArrayList)">
|
||||
<summary>
|
||||
此方法将在连接服务器前触发<para/>
|
||||
客户端可以重写此方法
|
||||
</summary>
|
||||
<param name="ip"></param>
|
||||
<param name="port"></param>
|
||||
<param name="ip">服务器IP</param>
|
||||
<param name="port">服务器端口</param>
|
||||
<param name="args">重写时可以提供额外的连接参数</param>
|
||||
<returns>false:中止连接</returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Controller.RunTimeController.AfterConnect(System.Object[])">
|
||||
<member name="M:Milimoe.FunGame.Core.Controller.RunTimeController.AfterConnect(System.Collections.ArrayList)">
|
||||
<summary>
|
||||
此方法将在连接服务器后触发(Connect结果返回前)<para/>
|
||||
客户端可以重写此方法
|
||||
@ -1110,9 +1114,240 @@
|
||||
窗体继承这些接口便能实现事件,或为插件预留。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Interface.IConnectEvent">
|
||||
<member name="T:Milimoe.FunGame.Core.Interface.IGamingEventHandler">
|
||||
<summary>
|
||||
插件需要实现什么事件就继承什么接口
|
||||
局内事件的接口,与 <see cref="T:Milimoe.FunGame.Core.Library.Common.Addon.GameMode"/> 配套使用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Interface.IClient">
|
||||
<summary>
|
||||
这是最基本的接口,要求客户端实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Interface.IGameModeSupported">
|
||||
<summary>
|
||||
服务端和客户端都应该实现这个接口,用于初始化支持的Mod列表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Common.Addon.ExamplePlugin">
|
||||
<summary>
|
||||
必须继承基类:<see cref="T:Milimoe.FunGame.Core.Library.Common.Addon.Plugin"/><para/>
|
||||
继承事件接口并实现其方法来使插件生效。例如继承:<seealso cref="T:Milimoe.FunGame.Core.Interface.ILoginEvent"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Name">
|
||||
<summary>
|
||||
地图名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Description">
|
||||
<summary>
|
||||
地图描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Version">
|
||||
<summary>
|
||||
地图版本
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Author">
|
||||
<summary>
|
||||
地图作者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Width">
|
||||
<summary>
|
||||
宽度
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Height">
|
||||
<summary>
|
||||
高度
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Size">
|
||||
<summary>
|
||||
格子大小
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.IsLoaded">
|
||||
<summary>
|
||||
加载标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.Load(System.Object[])">
|
||||
<summary>
|
||||
加载地图
|
||||
</summary>
|
||||
<param name="objs"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.AfterLoad">
|
||||
<summary>
|
||||
加载后需要做的事
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMap.BeforeLoad">
|
||||
<summary>
|
||||
允许返回false来阻止加载此地图
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Name">
|
||||
<summary>
|
||||
模组名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Description">
|
||||
<summary>
|
||||
模组描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Version">
|
||||
<summary>
|
||||
模组版本
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Author">
|
||||
<summary>
|
||||
模组作者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Map">
|
||||
<summary>
|
||||
模组所使用的地图
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.IsLoaded">
|
||||
<summary>
|
||||
加载标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Load(System.Object[])">
|
||||
<summary>
|
||||
加载模组
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.AfterLoad">
|
||||
<summary>
|
||||
模组加载后需要做的事
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.BeforeLoad">
|
||||
<summary>
|
||||
允许返回false来阻止加载此模组
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Init(System.Object[])">
|
||||
<summary>
|
||||
传递委托以便让模组调用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.WritelnSystemInfo">
|
||||
<summary>
|
||||
输出系统消息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.NewDataRequest">
|
||||
<summary>
|
||||
基于本地已连接的Socket创建新的数据请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.NewLongRunningDataRequest">
|
||||
<summary>
|
||||
基于本地已连接的Socket创建长时间运行的数据请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Session">
|
||||
<summary>
|
||||
Session对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.Config">
|
||||
<summary>
|
||||
Config对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.BindEvent">
|
||||
<summary>
|
||||
绑定事件。在<see cref="M:Milimoe.FunGame.Core.Library.Common.Addon.GameMode.BeforeLoad"/>后触发
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Name">
|
||||
<summary>
|
||||
插件名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Description">
|
||||
<summary>
|
||||
插件描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Version">
|
||||
<summary>
|
||||
插件版本
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Author">
|
||||
<summary>
|
||||
插件作者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.IsLoaded">
|
||||
<summary>
|
||||
加载标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Load(System.Object[])">
|
||||
<summary>
|
||||
加载插件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.AfterLoad">
|
||||
<summary>
|
||||
插件加载后需要做的事
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.BeforeLoad">
|
||||
<summary>
|
||||
允许返回false来阻止加载此插件
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Init(System.Object[])">
|
||||
<summary>
|
||||
传递委托以便让插件调用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.WritelnSystemInfo">
|
||||
<summary>
|
||||
输出系统消息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.NewDataRequest">
|
||||
<summary>
|
||||
基于本地已连接的Socket创建新的数据请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.NewLongRunningDataRequest">
|
||||
<summary>
|
||||
基于本地已连接的Socket创建长时间运行的数据请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Session">
|
||||
<summary>
|
||||
Session对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.Config">
|
||||
<summary>
|
||||
Config对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.BindEvent">
|
||||
<summary>
|
||||
绑定事件。在<see cref="M:Milimoe.FunGame.Core.Library.Common.Addon.Plugin.BeforeLoad"/>后触发
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Common.Architecture.AsyncAwaiter`1">
|
||||
@ -1332,86 +1567,9 @@
|
||||
<returns>类型的参数</returns>
|
||||
<exception cref="T:Milimoe.FunGame.IndexOutOfArrayLengthException">索引超过数组上限</exception>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Name">
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.InterfaceSet">
|
||||
<summary>
|
||||
插件名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Description">
|
||||
<summary>
|
||||
插件描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Version">
|
||||
<summary>
|
||||
插件版本
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Author">
|
||||
<summary>
|
||||
插件作者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.IsLoaded">
|
||||
<summary>
|
||||
加载标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Load(System.Object[])">
|
||||
<summary>
|
||||
加载插件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.AfterLoad">
|
||||
<summary>
|
||||
插件加载后需要做的事
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.BeforeLoad">
|
||||
<summary>
|
||||
允许返回false来阻止加载此插件
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Init(System.Object[])">
|
||||
<summary>
|
||||
传递委托以便让插件调用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.WritelnSystemInfo">
|
||||
<summary>
|
||||
输出系统消息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.NewDataRequest">
|
||||
<summary>
|
||||
基于本地已连接的Socket创建新的数据请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.NewLongRunningDataRequest">
|
||||
<summary>
|
||||
基于本地已连接的Socket创建长时间运行的数据请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Session">
|
||||
<summary>
|
||||
Session对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.Config">
|
||||
<summary>
|
||||
Config对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.BindEvent">
|
||||
<summary>
|
||||
绑定事件。在<see cref="M:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin.BeforeLoad"/>后触发
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Common.Plugin.Example">
|
||||
<summary>
|
||||
必须继承基类:<see cref="T:Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin"/><para/>
|
||||
继承事件接口并实现其方法来使插件生效。例如继承:<seealso cref="T:Milimoe.FunGame.Core.Interface.ILoginEvent"/>
|
||||
配合 <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceMethod"/> <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceType"/> 使用,也别忘了修改 <see cref="T:Milimoe.FunGame.Core.Api.Utility.Implement"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.SocketSet">
|
||||
@ -1446,7 +1604,7 @@
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.DataRequestSet.Room_GetRoomSettings">
|
||||
Room
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.DataRequestSet.Gaming_Connect">
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.DataRequestSet.Gaming">
|
||||
Gaming
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Constant.DataRequestSet.GetTypeString(Milimoe.FunGame.Core.Library.Constant.DataRequestType)">
|
||||
@ -1456,14 +1614,21 @@
|
||||
<param name="type"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Constant.GameMode.GetTypeString(Milimoe.FunGame.Core.Library.Constant.RoomType)">
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Constant.GamingSet.GetTypeString(Milimoe.FunGame.Core.Library.Constant.GamingType)">
|
||||
<summary>
|
||||
获取Type的等效字符串
|
||||
</summary>
|
||||
<param name="type"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Constant.GameMode.GetRoomType(System.String)">
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Constant.RoomSet.GetTypeString(Milimoe.FunGame.Core.Library.Constant.RoomType)">
|
||||
<summary>
|
||||
获取Type的等效字符串
|
||||
</summary>
|
||||
<param name="type"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Library.Constant.RoomSet.GetRoomType(System.String)">
|
||||
<summary>
|
||||
获取字符串对应的枚举
|
||||
</summary>
|
||||
@ -1476,6 +1641,86 @@
|
||||
<para>目前支持禁用心跳检测功能</para>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.General">
|
||||
<summary>
|
||||
此类保存常用的对象常量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.EntityInstance">
|
||||
<summary>
|
||||
空的实体类 用于object返回
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.UnknownUserInstance">
|
||||
<summary>
|
||||
默认的未知用户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.HallInstance">
|
||||
<summary>
|
||||
大厅(空房间)实例
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.DefaultEncoding">
|
||||
<summary>
|
||||
默认的字符编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.GeneralDateTimeFormat">
|
||||
<summary>
|
||||
默认的时间格式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.DefaultTime">
|
||||
<summary>
|
||||
默认的时间值(1970年8月1日8点0分0秒)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.General.MaxRetryTimes">
|
||||
<summary>
|
||||
最多自动重试连接次数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.General.MaxTask_1C2G">
|
||||
<summary>
|
||||
1C2G推荐的任务数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.General.MaxTask_2C2G">
|
||||
<summary>
|
||||
2C2G推荐的任务数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.General.MaxTask_4C4G">
|
||||
<summary>
|
||||
4C4G推荐的任务数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.General.SocketByteSize">
|
||||
<summary>
|
||||
默认Socket数据包大小
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Library.Constant.General.StreamByteSize">
|
||||
<summary>
|
||||
默认Stream传输大小
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.InterfaceMethod">
|
||||
<summary>
|
||||
配合 <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceType"/> <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceSet"/> 使用,也别忘了修改 <see cref="T:Milimoe.FunGame.Core.Api.Utility.Implement"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.InterfaceType">
|
||||
<summary>
|
||||
配合 <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceMethod"/> <see cref="T:Milimoe.FunGame.Core.Library.Constant.InterfaceSet"/> 使用,也别忘了修改 <see cref="T:Milimoe.FunGame.Core.Api.Utility.Implement"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.RoomType">
|
||||
<summary>
|
||||
配合 <see cref="T:Milimoe.FunGame.Core.Library.Constant.RoomSet"/> 使用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Milimoe.FunGame.Core.Library.Constant.SocketMessageType">
|
||||
<summary>
|
||||
需要同步更新 <see cref="T:Milimoe.FunGame.Core.Library.Constant.SocketSet"/>
|
||||
@ -1524,9 +1769,9 @@
|
||||
是否在房间中
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Model.FunGameConfig.FunGame_GameMode">
|
||||
<member name="P:Milimoe.FunGame.Core.Model.FunGameConfig.FunGame_RoomType">
|
||||
<summary>
|
||||
当前游戏模式
|
||||
当前所处的房间类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Model.FunGameConfig.FunGame_ServerName">
|
||||
@ -1589,7 +1834,7 @@
|
||||
所处的房间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Service.AddonManager.LoadPlugins(System.Collections.Generic.Dictionary{System.String,Milimoe.FunGame.Core.Library.Common.Plugin.BasePlugin},System.Object[])">
|
||||
<member name="M:Milimoe.FunGame.Core.Service.AddonManager.LoadPlugins(System.Collections.Generic.Dictionary{System.String,Milimoe.FunGame.Core.Library.Common.Addon.Plugin},System.Object[])">
|
||||
<summary>
|
||||
从plugins目录加载所有插件
|
||||
</summary>
|
||||
@ -1597,6 +1842,22 @@
|
||||
<param name="objs"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Service.AddonManager.LoadGameModes(System.Collections.Generic.Dictionary{System.String,Milimoe.FunGame.Core.Library.Common.Addon.GameMode},System.Object[])">
|
||||
<summary>
|
||||
从gamemodes目录加载所有模组
|
||||
</summary>
|
||||
<param name="gamemodes"></param>
|
||||
<param name="objs"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Milimoe.FunGame.Core.Service.AddonManager.LoadGameMaps(System.Collections.Generic.Dictionary{System.String,Milimoe.FunGame.Core.Library.Common.Addon.GameMap},System.Object[])">
|
||||
<summary>
|
||||
从gamemaps目录加载所有地图
|
||||
</summary>
|
||||
<param name="gamemaps"></param>
|
||||
<param name="objs"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Milimoe.FunGame.Core.Service.JsonManager.GeneralOptions">
|
||||
<summary>
|
||||
默认的序列化选项
|
||||
|
@ -10,8 +10,11 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
public string Roomid { get; set; } = "-1";
|
||||
public DateTime CreateTime { get; set; } = General.DefaultTime;
|
||||
public User RoomMaster { get; set; } = General.UnknownUserInstance;
|
||||
public RoomType RoomType { get; set; }
|
||||
public RoomType RoomType { get; set; } = RoomType.All;
|
||||
public string GameMode { get; set; } = "";
|
||||
public string GameMap { get; set; } = "";
|
||||
public RoomState RoomState { get; set; }
|
||||
public bool IsRank { get; set; } = false;
|
||||
public bool HasPass => Password.Trim() != "";
|
||||
public string Password { get; set; } = "";
|
||||
public GameStatistics Statistics { get; set; }
|
||||
@ -21,7 +24,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
Statistics = new(this);
|
||||
}
|
||||
|
||||
internal Room(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.All, RoomState RoomState = RoomState.Created, string Password = "")
|
||||
internal Room(long Id = 0, string Roomid = "-1", DateTime? CreateTime = null, User? RoomMaster = null, RoomType RoomType = RoomType.All, string GameMode = "", string GameMap = "", RoomState RoomState = RoomState.Created, string Password = "")
|
||||
{
|
||||
this.Id = Id;
|
||||
this.Roomid = Roomid;
|
||||
|
12
Interface/Base/IAddon.cs
Normal file
12
Interface/Base/IAddon.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
public interface IAddon
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string Version { get; }
|
||||
public string Author { get; }
|
||||
|
||||
public bool Load(params object[] objs);
|
||||
}
|
||||
}
|
7
Interface/Base/IGameMap.cs
Normal file
7
Interface/Base/IGameMap.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
public interface IGameMap : IAddon
|
||||
{
|
||||
|
||||
}
|
||||
}
|
9
Interface/Base/IGameMode.cs
Normal file
9
Interface/Base/IGameMode.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
public interface IGameMode : IAddon, IGamingConnectEventHandler, IGamingDisconnectEventHandler, IGamingReconnectEventHandler, IGamingBanCharacterEventHandler, IGamingPickCharacterEventHandler,
|
||||
IGamingRandomEventHandler, IGamingMoveEventHandler, IGamingAttackEventHandler, IGamingSkillEventHandler, IGamingItemEventHandler, IGamingMagicEventHandler, IGamingBuyEventHandler,
|
||||
IGamingSuperSkillEventHandler, IGamingPauseEventHandler, IGamingUnpauseEventHandler, IGamingSurrenderEventHandler, IGamingUpdateInfoEventHandler
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,14 +1,9 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
public interface IPlugin : IConnectEventHandler, IDisconnectEventHandler, ILoginEventHandler, ILogoutEventHandler, IRegEventHandler, IIntoRoomEventHandler, ISendTalkEventHandler,
|
||||
public interface IPlugin : IAddon, IConnectEventHandler, IDisconnectEventHandler, ILoginEventHandler, ILogoutEventHandler, IRegEventHandler, IIntoRoomEventHandler, ISendTalkEventHandler,
|
||||
ICreateRoomEventHandler, IQuitRoomEventHandler, IChangeRoomSettingEventHandler, IStartMatchEventHandler, IStartGameEventHandler, IChangeProfileEventHandler, IChangeAccountSettingEventHandler,
|
||||
IOpenInventoryEventHandler, ISignInEventHandler, IOpenStoreEventHandler, IBuyItemEventHandler, IShowRankingEventHandler, IUseItemEventHandler, IEndGameEventHandler
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string Version { get; }
|
||||
public string Author { get; }
|
||||
|
||||
public bool Load(params object[] objs);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
|
||||
// 插件需要实现什么事件就继承什么接口
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 插件需要实现什么事件就继承什么接口
|
||||
/// </summary>
|
||||
public interface IConnectEvent
|
||||
{
|
||||
public void BeforeConnectEvent(object sender, ConnectEventArgs e);
|
||||
|
237
Interface/Event/GamingEventHandlers.cs
Normal file
237
Interface/Event/GamingEventHandlers.cs
Normal file
@ -0,0 +1,237 @@
|
||||
using Milimoe.FunGame.Core.Library.Common.Addon;
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 局内事件的接口,与 <see cref="GameMode"/> 配套使用
|
||||
/// </summary>
|
||||
public interface IGamingEventHandler
|
||||
{
|
||||
public delegate void BeforeEventHandler(object sender, GamingEventArgs e);
|
||||
public delegate void AfterEventHandler(object sender, GamingEventArgs e);
|
||||
public delegate void SucceedEventHandler(object sender, GamingEventArgs e);
|
||||
public delegate void FailedEventHandler(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingConnectEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingConnect;
|
||||
public event AfterEventHandler? AfterGamingConnect;
|
||||
public event SucceedEventHandler? SucceedGamingConnect;
|
||||
public event FailedEventHandler? FailedGamingConnect;
|
||||
|
||||
public void OnBeforeGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingDisconnectEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingDisconnect;
|
||||
public event AfterEventHandler? AfterGamingDisconnect;
|
||||
public event SucceedEventHandler? SucceedGamingDisconnect;
|
||||
public event FailedEventHandler? FailedGamingDisconnect;
|
||||
|
||||
public void OnBeforeGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingReconnectEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingReconnect;
|
||||
public event AfterEventHandler? AfterGamingReconnect;
|
||||
public event SucceedEventHandler? SucceedGamingReconnect;
|
||||
public event FailedEventHandler? FailedGamingReconnect;
|
||||
|
||||
public void OnBeforeGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingBanCharacterEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingBanCharacter;
|
||||
public event AfterEventHandler? AfterGamingBanCharacter;
|
||||
public event SucceedEventHandler? SucceedGamingBanCharacter;
|
||||
public event FailedEventHandler? FailedGamingBanCharacter;
|
||||
|
||||
public void OnBeforeGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingPickCharacterEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingPickCharacter;
|
||||
public event AfterEventHandler? AfterGamingPickCharacter;
|
||||
public event SucceedEventHandler? SucceedGamingPickCharacter;
|
||||
public event FailedEventHandler? FailedGamingPickCharacter;
|
||||
|
||||
public void OnBeforeGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingRandomEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingRandom;
|
||||
public event AfterEventHandler? AfterGamingRandom;
|
||||
public event SucceedEventHandler? SucceedGamingRandom;
|
||||
public event FailedEventHandler? FailedGamingRandom;
|
||||
|
||||
public void OnBeforeGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingMoveEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingMove;
|
||||
public event AfterEventHandler? AfterGamingMove;
|
||||
public event SucceedEventHandler? SucceedGamingMove;
|
||||
public event FailedEventHandler? FailedGamingMove;
|
||||
|
||||
public void OnBeforeGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingAttackEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingAttack;
|
||||
public event AfterEventHandler? AfterGamingAttack;
|
||||
public event SucceedEventHandler? SucceedGamingAttack;
|
||||
public event FailedEventHandler? FailedGamingAttack;
|
||||
|
||||
public void OnBeforeGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingSkillEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingSkill;
|
||||
public event AfterEventHandler? AfterGamingSkill;
|
||||
public event SucceedEventHandler? SucceedGamingSkill;
|
||||
public event FailedEventHandler? FailedGamingSkill;
|
||||
|
||||
public void OnBeforeGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingItemEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingItem;
|
||||
public event AfterEventHandler? AfterGamingItem;
|
||||
public event SucceedEventHandler? SucceedGamingItem;
|
||||
public event FailedEventHandler? FailedGamingItem;
|
||||
|
||||
public void OnBeforeGamingItemEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingItemEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingItemEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingItemEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingMagicEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingMagic;
|
||||
public event AfterEventHandler? AfterGamingMagic;
|
||||
public event SucceedEventHandler? SucceedGamingMagic;
|
||||
public event FailedEventHandler? FailedGamingMagic;
|
||||
|
||||
public void OnBeforeGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingBuyEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingBuy;
|
||||
public event AfterEventHandler? AfterGamingBuy;
|
||||
public event SucceedEventHandler? SucceedGamingBuy;
|
||||
public event FailedEventHandler? FailedGamingBuy;
|
||||
|
||||
public void OnBeforeGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingSuperSkillEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingSuperSkill;
|
||||
public event AfterEventHandler? AfterGamingSuperSkill;
|
||||
public event SucceedEventHandler? SucceedGamingSuperSkill;
|
||||
public event FailedEventHandler? FailedGamingSuperSkill;
|
||||
|
||||
public void OnBeforeGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingPauseEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingPause;
|
||||
public event AfterEventHandler? AfterGamingPause;
|
||||
public event SucceedEventHandler? SucceedGamingPause;
|
||||
public event FailedEventHandler? FailedGamingPause;
|
||||
|
||||
public void OnBeforeGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingUnpauseEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingUnpause;
|
||||
public event AfterEventHandler? AfterGamingUnpause;
|
||||
public event SucceedEventHandler? SucceedGamingUnpause;
|
||||
public event FailedEventHandler? FailedGamingUnpause;
|
||||
|
||||
public void OnBeforeGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingSurrenderEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingSurrender;
|
||||
public event AfterEventHandler? AfterGamingSurrender;
|
||||
public event SucceedEventHandler? SucceedGamingSurrender;
|
||||
public event FailedEventHandler? FailedGamingSurrender;
|
||||
|
||||
public void OnBeforeGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingUpdateInfoEventHandler : IGamingEventHandler
|
||||
{
|
||||
public event BeforeEventHandler? BeforeGamingUpdateInfo;
|
||||
public event AfterEventHandler? AfterGamingUpdateInfo;
|
||||
public event SucceedEventHandler? SucceedGamingUpdateInfo;
|
||||
public event FailedEventHandler? FailedGamingUpdateInfo;
|
||||
|
||||
public void OnBeforeGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
public void OnAfterGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
public void OnSucceedGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
public void OnFailedGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
}
|
141
Interface/Event/GamingEvents.cs
Normal file
141
Interface/Event/GamingEvents.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
|
||||
// 模组需要实现什么事件就继承什么接口
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
public interface IGamingConnectEvent
|
||||
{
|
||||
public void BeforeGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingConnectEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingDisconnectEvent
|
||||
{
|
||||
public void BeforeGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingDisconnectEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingReconnectEvent
|
||||
{
|
||||
public void BeforeGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingReconnectEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingBanCharacterEvent
|
||||
{
|
||||
public void BeforeGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingBanCharacterEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingPickCharacterEvent
|
||||
{
|
||||
public void BeforeGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingPickCharacterEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingRandomEvent
|
||||
{
|
||||
public void BeforeGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingRandomEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingMoveEvent
|
||||
{
|
||||
public void BeforeGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingMoveEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingAttackEvent
|
||||
{
|
||||
public void BeforeGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingAttackEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingSkillEvent
|
||||
{
|
||||
public void BeforeGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingSkillEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingItemEvent
|
||||
{
|
||||
public void BeforeGamingItemEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingItemEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingItemEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingItemEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingMagicEvent
|
||||
{
|
||||
public void BeforeGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingMagicEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingBuyEvent
|
||||
{
|
||||
public void BeforeGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingBuyEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingSuperSkillEvent
|
||||
{
|
||||
public void BeforeGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingSuperSkillEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingPauseEvent
|
||||
{
|
||||
public void BeforeGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingPauseEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingUnpauseEvent
|
||||
{
|
||||
public void BeforeGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingUnpauseEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingSurrenderEvent
|
||||
{
|
||||
public void BeforeGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingSurrenderEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
|
||||
public interface IGamingUpdateInfoEvent
|
||||
{
|
||||
public void BeforeGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
public void AfterGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
public void SucceedGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
public void FailedGamingUpdateInfoEvent(object sender, GamingEventArgs e);
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 这是最基本的接口,要求客户端实现
|
||||
/// </summary>
|
||||
public interface IClient
|
||||
{
|
||||
public string FunGameIcon { get; }
|
||||
|
11
Interface/General/IGameModeSupported.cs
Normal file
11
Interface/General/IGameModeSupported.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务端和客户端都应该实现这个接口,用于初始化支持的Mod列表
|
||||
/// </summary>
|
||||
public interface IGameModeSupported
|
||||
{
|
||||
public string[] GameModeList { get; }
|
||||
public string[] GameMapList { get; }
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Plugin
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
{
|
||||
/// <summary>
|
||||
/// 必须继承基类:<see cref="BasePlugin"/><para/>
|
||||
/// 必须继承基类:<see cref="Plugin"/><para/>
|
||||
/// 继承事件接口并实现其方法来使插件生效。例如继承:<seealso cref="ILoginEvent"/>
|
||||
/// </summary>
|
||||
public class Example : BasePlugin, ILoginEvent
|
||||
public class ExamplePlugin : Plugin, ILoginEvent
|
||||
{
|
||||
public override string Name => "FunGame Example Plugin";
|
||||
|
86
Library/Common/Addon/GameMap.cs
Normal file
86
Library/Common/Addon/GameMap.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
{
|
||||
public abstract class GameMap : IGameMap
|
||||
{
|
||||
/// <summary>
|
||||
/// 地图名称
|
||||
/// </summary>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 地图描述
|
||||
/// </summary>
|
||||
public abstract string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 地图版本
|
||||
/// </summary>
|
||||
public abstract string Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 地图作者
|
||||
/// </summary>
|
||||
public abstract string Author { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 宽度
|
||||
/// </summary>
|
||||
public abstract float Width { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 高度
|
||||
/// </summary>
|
||||
public abstract float Height { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 格子大小
|
||||
/// </summary>
|
||||
public abstract float Size { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 加载标记
|
||||
/// </summary>
|
||||
private bool IsLoaded = false;
|
||||
|
||||
/// <summary>
|
||||
/// 加载地图
|
||||
/// </summary>
|
||||
/// <param name="objs"></param>
|
||||
/// <returns></returns>
|
||||
public bool Load(params object[] objs)
|
||||
{
|
||||
if (IsLoaded)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// BeforeLoad可以阻止加载此地图
|
||||
if (BeforeLoad())
|
||||
{
|
||||
// 地图加载后,不允许再次加载此地图
|
||||
IsLoaded = true;
|
||||
// 如果加载后需要执行代码,请重写AfterLoad方法
|
||||
AfterLoad();
|
||||
}
|
||||
return IsLoaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载后需要做的事
|
||||
/// </summary>
|
||||
protected virtual void AfterLoad()
|
||||
{
|
||||
// override
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许返回false来阻止加载此地图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual bool BeforeLoad()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
687
Library/Common/Addon/GameMode.cs
Normal file
687
Library/Common/Addon/GameMode.cs
Normal file
@ -0,0 +1,687 @@
|
||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
{
|
||||
public abstract class GameMode : IGameMode
|
||||
{
|
||||
/// <summary>
|
||||
/// 模组名称
|
||||
/// </summary>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 模组描述
|
||||
/// </summary>
|
||||
public abstract string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 模组版本
|
||||
/// </summary>
|
||||
public abstract string Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 模组作者
|
||||
/// </summary>
|
||||
public abstract string Author { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 模组所使用的地图
|
||||
/// </summary>
|
||||
public abstract string Map { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 加载标记
|
||||
/// </summary>
|
||||
private bool IsLoaded = false;
|
||||
|
||||
/// <summary>
|
||||
/// 加载模组
|
||||
/// </summary>
|
||||
public bool Load(params object[] objs)
|
||||
{
|
||||
if (IsLoaded)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// BeforeLoad可以阻止加载此模组
|
||||
if (BeforeLoad())
|
||||
{
|
||||
// 模组加载后,不允许再次加载此模组
|
||||
IsLoaded = true;
|
||||
// 初始化此模组(传入委托或者Model)
|
||||
Init(objs);
|
||||
// 触发绑定事件
|
||||
BindEvent();
|
||||
// 如果加载后需要执行代码,请重写AfterLoad方法
|
||||
AfterLoad();
|
||||
}
|
||||
return IsLoaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模组加载后需要做的事
|
||||
/// </summary>
|
||||
protected virtual void AfterLoad()
|
||||
{
|
||||
// override
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许返回false来阻止加载此模组
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual bool BeforeLoad()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递委托以便让模组调用
|
||||
/// </summary>
|
||||
private void Init(params object[] objs)
|
||||
{
|
||||
if (objs.Length > 0) WritelnSystemInfo = (Action<string>)objs[0];
|
||||
if (objs.Length > 1) NewDataRequest = (Func<DataRequestType, DataRequest>)objs[1];
|
||||
if (objs.Length > 2) NewLongRunningDataRequest = (Func<DataRequestType, DataRequest>)objs[2];
|
||||
if (objs.Length > 3) Session = (Session)objs[3];
|
||||
if (objs.Length > 4) Config = (FunGameConfig)objs[4];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 输出系统消息
|
||||
/// </summary>
|
||||
protected Action<string> WritelnSystemInfo = new(msg => Console.Write("\r" + msg + "\n\r> "));
|
||||
|
||||
/// <summary>
|
||||
/// 基于本地已连接的Socket创建新的数据请求
|
||||
/// </summary>
|
||||
protected Func<DataRequestType, DataRequest> NewDataRequest = new(type => throw new ConnectFailedException());
|
||||
|
||||
/// <summary>
|
||||
/// 基于本地已连接的Socket创建长时间运行的数据请求
|
||||
/// </summary>
|
||||
protected Func<DataRequestType, DataRequest> NewLongRunningDataRequest = new(type => throw new ConnectFailedException());
|
||||
|
||||
/// <summary>
|
||||
/// Session对象
|
||||
/// </summary>
|
||||
protected Session Session = new();
|
||||
|
||||
/// <summary>
|
||||
/// Config对象
|
||||
/// </summary>
|
||||
protected FunGameConfig Config = new();
|
||||
|
||||
/// <summary>
|
||||
/// 绑定事件。在<see cref="BeforeLoad"/>后触发
|
||||
/// </summary>
|
||||
private void BindEvent()
|
||||
{
|
||||
if (this is IGamingConnectEvent)
|
||||
{
|
||||
IGamingConnectEvent bind = (IGamingConnectEvent)this;
|
||||
BeforeGamingConnect += bind.BeforeGamingConnectEvent;
|
||||
AfterGamingConnect += bind.AfterGamingConnectEvent;
|
||||
SucceedGamingConnect += bind.SucceedGamingConnectEvent;
|
||||
FailedGamingConnect += bind.FailedGamingConnectEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingDisconnectEvent)
|
||||
{
|
||||
IGamingDisconnectEvent bind = (IGamingDisconnectEvent)this;
|
||||
BeforeGamingDisconnect += bind.BeforeGamingDisconnectEvent;
|
||||
AfterGamingDisconnect += bind.AfterGamingDisconnectEvent;
|
||||
SucceedGamingDisconnect += bind.SucceedGamingDisconnectEvent;
|
||||
FailedGamingDisconnect += bind.FailedGamingDisconnectEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingReconnectEvent)
|
||||
{
|
||||
IGamingReconnectEvent bind = (IGamingReconnectEvent)this;
|
||||
BeforeGamingReconnect += bind.BeforeGamingReconnectEvent;
|
||||
AfterGamingReconnect += bind.AfterGamingReconnectEvent;
|
||||
SucceedGamingReconnect += bind.SucceedGamingReconnectEvent;
|
||||
FailedGamingReconnect += bind.FailedGamingReconnectEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingBanCharacterEvent)
|
||||
{
|
||||
IGamingBanCharacterEvent bind = (IGamingBanCharacterEvent)this;
|
||||
BeforeGamingBanCharacter += bind.BeforeGamingBanCharacterEvent;
|
||||
AfterGamingBanCharacter += bind.AfterGamingBanCharacterEvent;
|
||||
SucceedGamingBanCharacter += bind.SucceedGamingBanCharacterEvent;
|
||||
FailedGamingBanCharacter += bind.FailedGamingBanCharacterEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingPickCharacterEvent)
|
||||
{
|
||||
IGamingPickCharacterEvent bind = (IGamingPickCharacterEvent)this;
|
||||
BeforeGamingPickCharacter += bind.BeforeGamingPickCharacterEvent;
|
||||
AfterGamingPickCharacter += bind.AfterGamingPickCharacterEvent;
|
||||
SucceedGamingPickCharacter += bind.SucceedGamingPickCharacterEvent;
|
||||
FailedGamingPickCharacter += bind.FailedGamingPickCharacterEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingRandomEvent)
|
||||
{
|
||||
IGamingRandomEvent bind = (IGamingRandomEvent)this;
|
||||
BeforeGamingRandom += bind.BeforeGamingRandomEvent;
|
||||
AfterGamingRandom += bind.AfterGamingRandomEvent;
|
||||
SucceedGamingRandom += bind.SucceedGamingRandomEvent;
|
||||
FailedGamingRandom += bind.FailedGamingRandomEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingMoveEvent)
|
||||
{
|
||||
IGamingMoveEvent bind = (IGamingMoveEvent)this;
|
||||
BeforeGamingMove += bind.BeforeGamingMoveEvent;
|
||||
AfterGamingMove += bind.AfterGamingMoveEvent;
|
||||
SucceedGamingMove += bind.SucceedGamingMoveEvent;
|
||||
FailedGamingMove += bind.FailedGamingMoveEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingAttackEvent)
|
||||
{
|
||||
IGamingAttackEvent bind = (IGamingAttackEvent)this;
|
||||
BeforeGamingAttack += bind.BeforeGamingAttackEvent;
|
||||
AfterGamingAttack += bind.AfterGamingAttackEvent;
|
||||
SucceedGamingAttack += bind.SucceedGamingAttackEvent;
|
||||
FailedGamingAttack += bind.FailedGamingAttackEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingSkillEvent)
|
||||
{
|
||||
IGamingSkillEvent bind = (IGamingSkillEvent)this;
|
||||
BeforeGamingSkill += bind.BeforeGamingSkillEvent;
|
||||
AfterGamingSkill += bind.AfterGamingSkillEvent;
|
||||
SucceedGamingSkill += bind.SucceedGamingSkillEvent;
|
||||
FailedGamingSkill += bind.FailedGamingSkillEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingItemEvent)
|
||||
{
|
||||
IGamingItemEvent bind = (IGamingItemEvent)this;
|
||||
BeforeGamingItem += bind.BeforeGamingItemEvent;
|
||||
AfterGamingItem += bind.AfterGamingItemEvent;
|
||||
SucceedGamingItem += bind.SucceedGamingItemEvent;
|
||||
FailedGamingItem += bind.FailedGamingItemEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingMagicEvent)
|
||||
{
|
||||
IGamingMagicEvent bind = (IGamingMagicEvent)this;
|
||||
BeforeGamingMagic += bind.BeforeGamingMagicEvent;
|
||||
AfterGamingMagic += bind.AfterGamingMagicEvent;
|
||||
SucceedGamingMagic += bind.SucceedGamingMagicEvent;
|
||||
FailedGamingMagic += bind.FailedGamingMagicEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingBuyEvent)
|
||||
{
|
||||
IGamingBuyEvent bind = (IGamingBuyEvent)this;
|
||||
BeforeGamingBuy += bind.BeforeGamingBuyEvent;
|
||||
AfterGamingBuy += bind.AfterGamingBuyEvent;
|
||||
SucceedGamingBuy += bind.SucceedGamingBuyEvent;
|
||||
FailedGamingBuy += bind.FailedGamingBuyEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingSuperSkillEvent)
|
||||
{
|
||||
IGamingSuperSkillEvent bind = (IGamingSuperSkillEvent)this;
|
||||
BeforeGamingSuperSkill += bind.BeforeGamingSuperSkillEvent;
|
||||
AfterGamingSuperSkill += bind.AfterGamingSuperSkillEvent;
|
||||
SucceedGamingSuperSkill += bind.SucceedGamingSuperSkillEvent;
|
||||
FailedGamingSuperSkill += bind.FailedGamingSuperSkillEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingPauseEvent)
|
||||
{
|
||||
IGamingPauseEvent bind = (IGamingPauseEvent)this;
|
||||
BeforeGamingPause += bind.BeforeGamingPauseEvent;
|
||||
AfterGamingPause += bind.AfterGamingPauseEvent;
|
||||
SucceedGamingPause += bind.SucceedGamingPauseEvent;
|
||||
FailedGamingPause += bind.FailedGamingPauseEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingUnpauseEvent)
|
||||
{
|
||||
IGamingUnpauseEvent bind = (IGamingUnpauseEvent)this;
|
||||
BeforeGamingUnpause += bind.BeforeGamingUnpauseEvent;
|
||||
AfterGamingUnpause += bind.AfterGamingUnpauseEvent;
|
||||
SucceedGamingUnpause += bind.SucceedGamingUnpauseEvent;
|
||||
FailedGamingUnpause += bind.FailedGamingUnpauseEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingSurrenderEvent)
|
||||
{
|
||||
IGamingSurrenderEvent bind = (IGamingSurrenderEvent)this;
|
||||
BeforeGamingSurrender += bind.BeforeGamingSurrenderEvent;
|
||||
AfterGamingSurrender += bind.AfterGamingSurrenderEvent;
|
||||
SucceedGamingSurrender += bind.SucceedGamingSurrenderEvent;
|
||||
FailedGamingSurrender += bind.FailedGamingSurrenderEvent;
|
||||
}
|
||||
|
||||
if (this is IGamingUpdateInfoEvent)
|
||||
{
|
||||
IGamingUpdateInfoEvent bind = (IGamingUpdateInfoEvent)this;
|
||||
BeforeGamingUpdateInfo += bind.BeforeGamingUpdateInfoEvent;
|
||||
AfterGamingUpdateInfo += bind.AfterGamingUpdateInfoEvent;
|
||||
SucceedGamingUpdateInfo += bind.SucceedGamingUpdateInfoEvent;
|
||||
FailedGamingUpdateInfo += bind.FailedGamingUpdateInfoEvent;
|
||||
}
|
||||
}
|
||||
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingConnect;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingConnect;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingConnect;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingConnect;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingDisconnect;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingDisconnect;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingDisconnect;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingDisconnect;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingReconnect;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingReconnect;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingReconnect;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingReconnect;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingBanCharacter;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingBanCharacter;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingBanCharacter;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingBanCharacter;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingPickCharacter;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingPickCharacter;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingPickCharacter;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingPickCharacter;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingRandom;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingRandom;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingRandom;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingRandom;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingMove;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingMove;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingMove;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingMove;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingAttack;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingAttack;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingAttack;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingAttack;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingSkill;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingSkill;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingSkill;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingSkill;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingItem;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingItem;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingItem;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingItem;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingMagic;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingMagic;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingMagic;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingMagic;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingBuy;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingBuy;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingBuy;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingBuy;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingSuperSkill;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingSuperSkill;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingSuperSkill;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingSuperSkill;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingPause;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingPause;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingPause;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingPause;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingUnpause;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingUnpause;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingUnpause;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingUnpause;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingSurrender;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingSurrender;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingSurrender;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingSurrender;
|
||||
public event IGamingEventHandler.BeforeEventHandler? BeforeGamingUpdateInfo;
|
||||
public event IGamingEventHandler.AfterEventHandler? AfterGamingUpdateInfo;
|
||||
public event IGamingEventHandler.SucceedEventHandler? SucceedGamingUpdateInfo;
|
||||
public event IGamingEventHandler.FailedEventHandler? FailedGamingUpdateInfo;
|
||||
|
||||
public void OnBeforeGamingConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingConnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingConnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingConnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingConnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingConnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingDisconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingDisconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingDisconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingDisconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingDisconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingReconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingReconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingReconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingReconnectEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingReconnect?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingBanCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingBanCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingBanCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingBanCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingBanCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingPickCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingPickCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingPickCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingPickCharacterEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingPickCharacter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingRandom?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingRandom?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingRandom?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingRandomEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingRandom?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingMove?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingMove?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingMove?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingMoveEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingMove?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingAttack?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingAttack?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingAttack?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingAttackEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingAttack?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingItem?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingItem?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingItem?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingItemEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingItem?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingMagic?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingMagic?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingMagic?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingMagicEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingMagic?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingBuy?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingBuy?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingBuy?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingBuyEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingBuy?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingSuperSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingSuperSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingSuperSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingSuperSkillEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingSuperSkill?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingPause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingPause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingPause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingPauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingPause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingUnpause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingUnpause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingUnpause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingUnpauseEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingUnpause?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingSurrender?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingSurrender?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingSurrender?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingSurrenderEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingSurrender?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnBeforeGamingUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
BeforeGamingUpdateInfo?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnAfterGamingUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
AfterGamingUpdateInfo?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnSucceedGamingUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
SucceedGamingUpdateInfo?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void OnFailedGamingUpdateInfoEvent(object sender, GamingEventArgs e)
|
||||
{
|
||||
FailedGamingUpdateInfo?.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,9 +4,9 @@ using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Plugin
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
{
|
||||
public abstract class BasePlugin : IPlugin
|
||||
public abstract class Plugin : IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// 插件名称
|
11
Library/Common/Event/GamingEventArgs.cs
Normal file
11
Library/Common/Event/GamingEventArgs.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class GamingEventArgs(Room room, List<User> users, List<Character> characters) : GeneralEventArgs
|
||||
{
|
||||
public Room Room { get; } = room;
|
||||
public List<User> Users { get; } = users;
|
||||
public List<Character> Characters { get; } = characters;
|
||||
}
|
||||
}
|
@ -9,45 +9,47 @@ namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
public Room Room { get; set; } = General.HallInstance;
|
||||
public string RoomID { get; set; } = "";
|
||||
public long RoomMaster { get; set; } = 0;
|
||||
public string RoomTypeString { get; set; } = GameMode.All;
|
||||
public string RoomTypeString { get; set; } = RoomSet.All;
|
||||
public RoomType RoomType { get; set; } = RoomType.All;
|
||||
public string GameMode { get; set; } = "";
|
||||
public string GameMap { get; set; } = "";
|
||||
public RoomState RoomState { get; set; } = RoomState.Created;
|
||||
public bool HasPassword => Password.Trim() != "";
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
public RoomEventArgs(string RoomType, string Password)
|
||||
public RoomEventArgs(string type, string password)
|
||||
{
|
||||
RoomTypeString = RoomType;
|
||||
this.RoomType = RoomType switch
|
||||
RoomTypeString = type;
|
||||
RoomType = type switch
|
||||
{
|
||||
GameMode.Mix => Constant.RoomType.Mix,
|
||||
GameMode.Team => Constant.RoomType.Team,
|
||||
GameMode.MixHasPass => Constant.RoomType.MixHasPass,
|
||||
GameMode.TeamHasPass => Constant.RoomType.TeamHasPass,
|
||||
GameMode.AllHasPass => Constant.RoomType.AllHasPass,
|
||||
_ => Constant.RoomType.All
|
||||
RoomSet.Mix => RoomType.Mix,
|
||||
RoomSet.Team => RoomType.Team,
|
||||
RoomSet.FastAuto => RoomType.FastAuto,
|
||||
RoomSet.Custom => RoomType.Custom,
|
||||
_ => RoomType.All
|
||||
};
|
||||
this.Password = Password;
|
||||
Room = Factory.GetRoom(RoomType: this.RoomType, Password: this.Password);
|
||||
Password = password;
|
||||
Room = Factory.GetRoom(RoomType: RoomType, Password: Password);
|
||||
}
|
||||
|
||||
public RoomEventArgs(Room Room)
|
||||
public RoomEventArgs(Room room)
|
||||
{
|
||||
this.Room = Room;
|
||||
RoomID = Room.Roomid;
|
||||
RoomMaster = Room.RoomMaster != null ? Room.RoomMaster.Id : 0;
|
||||
RoomType = Room.RoomType;
|
||||
RoomTypeString = Room.RoomType switch
|
||||
Room = room;
|
||||
RoomID = room.Roomid;
|
||||
RoomMaster = room.RoomMaster != null ? room.RoomMaster.Id : 0;
|
||||
RoomType = room.RoomType;
|
||||
GameMode = room.GameMode;
|
||||
GameMap = room.GameMap;
|
||||
RoomTypeString = room.RoomType switch
|
||||
{
|
||||
RoomType.Mix => GameMode.Mix,
|
||||
RoomType.Team => GameMode.Team,
|
||||
RoomType.MixHasPass => GameMode.MixHasPass,
|
||||
RoomType.TeamHasPass => GameMode.TeamHasPass,
|
||||
RoomType.AllHasPass => GameMode.AllHasPass,
|
||||
_ => GameMode.All
|
||||
RoomType.Mix => RoomSet.Mix,
|
||||
RoomType.Team => RoomSet.Team,
|
||||
RoomType.FastAuto => RoomSet.FastAuto,
|
||||
RoomType.Custom => RoomSet.Custom,
|
||||
_ => RoomSet.All
|
||||
};
|
||||
RoomState = Room.RoomState;
|
||||
Password = Room.Password;
|
||||
RoomState = room.RoomState;
|
||||
Password = room.Password;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,16 @@
|
||||
*/
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
/// <summary>
|
||||
/// 配合 <see cref="InterfaceMethod"/> <see cref="InterfaceType"/> 使用,也别忘了修改 <see cref="Api.Utility.Implement"/>
|
||||
/// </summary>
|
||||
public class InterfaceSet
|
||||
{
|
||||
public class Type
|
||||
{
|
||||
public const string IClient = "IClientImpl";
|
||||
public const string IServer = "IServerImpl";
|
||||
public const string IGameModeSupported = "IGameModeSupported";
|
||||
}
|
||||
|
||||
public class Method
|
||||
@ -16,6 +20,8 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
public const string RemoteServerIP = "RemoteServerIP";
|
||||
public const string DBConnection = "DBConnection";
|
||||
public const string GetServerSettings = "GetServerSettings";
|
||||
public const string GameModeList = "GameModeList";
|
||||
public const string GameMapList = "GameMapList";
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,23 +118,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
/**
|
||||
* Gaming
|
||||
*/
|
||||
public const string Gaming_Connect = "Gaming::Connect";
|
||||
public const string Gaming_Disconnect = "Gaming::Disconnect";
|
||||
public const string Gaming_Reconnect = "Gaming::Reconnect";
|
||||
public const string Gaming_Ban = "Gaming::Ban";
|
||||
public const string Gaming_Pick = "Gaming::Pick";
|
||||
public const string Gaming_Random = "Gaming::Random";
|
||||
public const string Gaming_Move = "Gaming::Move";
|
||||
public const string Gaming_Attack = "Gaming::Attack";
|
||||
public const string Gaming_Skill = "Gaming::Skill";
|
||||
public const string Gaming_Item = "Gaming::Item";
|
||||
public const string Gaming_Magic = "Gaming::Magic";
|
||||
public const string Gaming_Buy = "Gaming::Buy";
|
||||
public const string Gaming_SuperSkill = "Gaming::SuperSkill";
|
||||
public const string Gaming_Pause = "Gaming::Pause";
|
||||
public const string Gaming_Unpause = "Gaming::Unpause";
|
||||
public const string Gaming_Surrender = "Gaming::Surrender";
|
||||
public const string Gaming_UpdateUserInfo = "Gaming::UpdateUserInfo";
|
||||
public const string Gaming = "Gaming";
|
||||
|
||||
/// <summary>
|
||||
/// 获取Type的等效字符串
|
||||
@ -157,27 +147,62 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
DataRequestType.Room_GetRoomSettings => Room_GetRoomSettings,
|
||||
DataRequestType.Room_GetRoomPlayerCount => Room_GetRoomPlayerCount,
|
||||
DataRequestType.Room_UpdateRoomMaster => Room_UpdateRoomMaster,
|
||||
DataRequestType.Gaming_Connect => Gaming_Connect,
|
||||
DataRequestType.Gaming_Disconnect => Gaming_Disconnect,
|
||||
DataRequestType.Gaming_Reconnect => Gaming_Reconnect,
|
||||
DataRequestType.Gaming_Ban => Gaming_Ban,
|
||||
DataRequestType.Gaming_Pick => Gaming_Pick,
|
||||
DataRequestType.Gaming_Random => Gaming_Random,
|
||||
DataRequestType.Gaming_Move => Gaming_Move,
|
||||
DataRequestType.Gaming_Attack => Gaming_Attack,
|
||||
DataRequestType.Gaming_Skill => Gaming_Skill,
|
||||
DataRequestType.Gaming_Item => Gaming_Item,
|
||||
DataRequestType.Gaming_Magic => Gaming_Magic,
|
||||
DataRequestType.Gaming_Buy => Gaming_Buy,
|
||||
DataRequestType.Gaming_SuperSkill => Gaming_SuperSkill,
|
||||
DataRequestType.Gaming_Pause => Gaming_Pause,
|
||||
DataRequestType.Gaming_Unpause => Gaming_Unpause,
|
||||
DataRequestType.Gaming_Surrender => Gaming_Surrender,
|
||||
DataRequestType.Gaming_UpdateUserInfo => Gaming_UpdateUserInfo,
|
||||
DataRequestType.Gaming => Gaming,
|
||||
_ => UnKnown
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class GamingSet
|
||||
{
|
||||
public const string None = "Gaming::None";
|
||||
public const string Connect = "Gaming::Connect";
|
||||
public const string Disconnect = "Gaming::Disconnect";
|
||||
public const string Reconnect = "Gaming::Reconnect";
|
||||
public const string BanCharacter = "Gaming::BanCharacter";
|
||||
public const string PickCharacter = "Gaming::PickCharacter";
|
||||
public const string Random = "Gaming::Random";
|
||||
public const string Move = "Gaming::Move";
|
||||
public const string Attack = "Gaming::Attack";
|
||||
public const string Skill = "Gaming::Skill";
|
||||
public const string Item = "Gaming::Item";
|
||||
public const string Magic = "Gaming::Magic";
|
||||
public const string Buy = "Gaming::Buy";
|
||||
public const string SuperSkill = "Gaming::SuperSkill";
|
||||
public const string Pause = "Gaming::Pause";
|
||||
public const string Unpause = "Gaming::Unpause";
|
||||
public const string Surrender = "Gaming::Surrender";
|
||||
public const string UpdateInfo = "Gaming::UpdateInfo";
|
||||
|
||||
/// <summary>
|
||||
/// 获取Type的等效字符串
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetTypeString(GamingType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
GamingType.Connect => Connect,
|
||||
GamingType.Disconnect => Disconnect,
|
||||
GamingType.Reconnect => Reconnect,
|
||||
GamingType.BanCharacter => BanCharacter,
|
||||
GamingType.PickCharacter => PickCharacter,
|
||||
GamingType.Random => Random,
|
||||
GamingType.Move => Move,
|
||||
GamingType.Attack => Attack,
|
||||
GamingType.Skill => Skill,
|
||||
GamingType.Item => Item,
|
||||
GamingType.Magic => Magic,
|
||||
GamingType.Buy => Buy,
|
||||
GamingType.SuperSkill => SuperSkill,
|
||||
GamingType.Pause => Pause,
|
||||
GamingType.Unpause => Unpause,
|
||||
GamingType.Surrender => Surrender,
|
||||
GamingType.UpdateInfo => UpdateInfo,
|
||||
_ => None
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class ReflectionSet
|
||||
@ -185,6 +210,8 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
public const string FUNGAME_IMPL = "FunGame.Implement";
|
||||
public static string EXEFolderPath { get; } = Environment.CurrentDirectory.ToString() + "\\"; // 程序目录
|
||||
public static string PluginFolderPath { get; } = Environment.CurrentDirectory.ToString() + "\\plugins\\"; // 插件目录
|
||||
public static string GameModeFolderPath { get; } = Environment.CurrentDirectory.ToString() + "\\gamemods\\"; // 游戏模组目录
|
||||
public static string GameMapFolderPath { get; } = Environment.CurrentDirectory.ToString() + "\\maps\\"; // 游戏地图目录
|
||||
}
|
||||
|
||||
public class FormSet
|
||||
@ -198,14 +225,14 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
public const string UserCenter = "UserCenter";
|
||||
}
|
||||
|
||||
public class GameMode
|
||||
public class RoomSet
|
||||
{
|
||||
public const string All = "所有模式";
|
||||
public const string AllHasPass = "带密码的所有模式";
|
||||
public const string All = "全部";
|
||||
public const string Mix = "混战模式";
|
||||
public const string MixHasPass = "带密码的混战模式";
|
||||
public const string Team = "团队模式";
|
||||
public const string TeamHasPass = "带密码的团队模式";
|
||||
public const string Solo = "对弈模式";
|
||||
public const string FastAuto = "快速自走模式";
|
||||
public const string Custom = "自定义模式";
|
||||
|
||||
/// <summary>
|
||||
/// 获取Type的等效字符串
|
||||
@ -218,9 +245,9 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
RoomType.Mix => Mix,
|
||||
RoomType.Team => Team,
|
||||
RoomType.MixHasPass => MixHasPass,
|
||||
RoomType.TeamHasPass => TeamHasPass,
|
||||
RoomType.AllHasPass => AllHasPass,
|
||||
RoomType.Solo => Solo,
|
||||
RoomType.FastAuto => FastAuto,
|
||||
RoomType.Custom => Custom,
|
||||
_ => All
|
||||
};
|
||||
}
|
||||
@ -236,9 +263,8 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
Mix => RoomType.Mix,
|
||||
Team => RoomType.Team,
|
||||
MixHasPass => RoomType.MixHasPass,
|
||||
TeamHasPass => RoomType.TeamHasPass,
|
||||
AllHasPass => RoomType.AllHasPass,
|
||||
FastAuto => RoomType.FastAuto,
|
||||
Custom => RoomType.Custom,
|
||||
_ => RoomType.All
|
||||
};
|
||||
}
|
||||
|
@ -19,14 +19,14 @@
|
||||
/// </summary>
|
||||
public static bool FunGame_DebugMode { get; set; } = false;
|
||||
|
||||
private const string FunGame_Core = "FunGame Core";
|
||||
private const string FunGame_Core_Api = "FunGame Core Api";
|
||||
private const string FunGame_Console = "FunGame Console";
|
||||
private const string FunGame_Desktop = "FunGame Desktop";
|
||||
private const string FunGame_Server = "FunGame Server Console";
|
||||
public const string FunGame_Core = "FunGame Core";
|
||||
public const string FunGame_Core_Api = "FunGame Core Api";
|
||||
public const string FunGame_Console = "FunGame Console";
|
||||
public const string FunGame_Desktop = "FunGame Desktop";
|
||||
public const string FunGame_Server = "FunGame Server Console";
|
||||
|
||||
private const string FunGame_Version = "v1.0";
|
||||
private const string FunGame_VersionPatch = "";
|
||||
public const string FunGame_Version = "v1.0";
|
||||
public const string FunGame_VersionPatch = "";
|
||||
|
||||
public static string GetInfo(FunGame FunGameType)
|
||||
{
|
||||
@ -41,11 +41,5 @@
|
||||
};
|
||||
return type + " [ 版本: " + FunGame_Version + FunGame_VersionPatch + " ]\n" + (type.Equals(FunGame_Desktop) ? @"©" : "(C)") + "2023 Milimoe. 保留所有权利\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新日志
|
||||
*
|
||||
*
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +1,79 @@
|
||||
using System.Text;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
|
||||
/**
|
||||
* 此文件保存常用的对象常量
|
||||
*/
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
/// <summary>
|
||||
/// 此类保存常用的对象常量
|
||||
/// </summary>
|
||||
public class General
|
||||
{
|
||||
// Static Variable
|
||||
#region Static Variable
|
||||
|
||||
/// <summary>
|
||||
/// 空的实体类 用于object返回
|
||||
/// </summary>
|
||||
public static Empty EntityInstance => new();
|
||||
|
||||
/// <summary>
|
||||
/// 默认的未知用户
|
||||
/// </summary>
|
||||
public static User UnknownUserInstance => new();
|
||||
|
||||
/// <summary>
|
||||
/// 大厅(空房间)实例
|
||||
/// </summary>
|
||||
public static Room HallInstance => new();
|
||||
|
||||
/// <summary>
|
||||
/// 默认的字符编码
|
||||
/// </summary>
|
||||
public static Encoding DefaultEncoding => Encoding.Unicode;
|
||||
|
||||
/// <summary>
|
||||
/// 默认的时间格式
|
||||
/// </summary>
|
||||
public static string GeneralDateTimeFormat => "yyyy-MM-dd HH:mm:ss.fff";
|
||||
|
||||
/// <summary>
|
||||
/// 默认的时间值(1970年8月1日8点0分0秒)
|
||||
/// </summary>
|
||||
public static DateTime DefaultTime => new(1970, 1, 1, 8, 0, 0);
|
||||
|
||||
// Const
|
||||
#endregion
|
||||
|
||||
#region Const
|
||||
|
||||
/// <summary>
|
||||
/// 最多自动重试连接次数
|
||||
/// </summary>
|
||||
public const int MaxRetryTimes = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 1C2G推荐的任务数量
|
||||
/// </summary>
|
||||
public const int MaxTask_1C2G = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 2C2G推荐的任务数量
|
||||
/// </summary>
|
||||
public const int MaxTask_2C2G = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 4C4G推荐的任务数量
|
||||
/// </summary>
|
||||
public const int MaxTask_4C4G = 40;
|
||||
|
||||
/// <summary>
|
||||
/// 默认Socket数据包大小
|
||||
/// </summary>
|
||||
public const int SocketByteSize = 512 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// 默认Stream传输大小
|
||||
/// </summary>
|
||||
public const int StreamByteSize = 2048;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,15 @@
|
||||
*/
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
/// <summary>
|
||||
/// 配合 <see cref="InterfaceType"/> <see cref="InterfaceSet"/> 使用,也别忘了修改 <see cref="Api.Utility.Implement"/>
|
||||
/// </summary>
|
||||
public enum InterfaceMethod
|
||||
{
|
||||
RemoteServerIP,
|
||||
DBConnection,
|
||||
GetServerSettings
|
||||
GetServerSettings,
|
||||
GameModeList,
|
||||
GameMapList
|
||||
}
|
||||
}
|
||||
|
@ -21,20 +21,27 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
Dialog
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配合 <see cref="InterfaceMethod"/> <see cref="InterfaceSet"/> 使用,也别忘了修改 <see cref="Api.Utility.Implement"/>
|
||||
/// </summary>
|
||||
public enum InterfaceType
|
||||
{
|
||||
IClient,
|
||||
IServer
|
||||
IServer,
|
||||
IGameModeSupported
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配合 <see cref="RoomSet"/> 使用
|
||||
/// </summary>
|
||||
public enum RoomType
|
||||
{
|
||||
All,
|
||||
Mix,
|
||||
Team,
|
||||
AllHasPass,
|
||||
MixHasPass,
|
||||
TeamHasPass
|
||||
Solo,
|
||||
FastAuto,
|
||||
Custom
|
||||
}
|
||||
|
||||
public enum MessageButtonType
|
||||
@ -97,24 +104,31 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
Room_GetRoomSettings,
|
||||
Room_GetRoomPlayerCount,
|
||||
Room_UpdateRoomMaster,
|
||||
Gaming_Connect,
|
||||
Gaming_Disconnect,
|
||||
Gaming_Reconnect,
|
||||
Gaming_Ban,
|
||||
Gaming_Pick,
|
||||
Gaming_Random,
|
||||
Gaming_Move,
|
||||
Gaming_Attack,
|
||||
Gaming_Skill,
|
||||
Gaming_Item,
|
||||
Gaming_Magic,
|
||||
Gaming_Buy,
|
||||
Gaming_SuperSkill,
|
||||
Gaming_Pause,
|
||||
Gaming_Unpause,
|
||||
Gaming_Surrender,
|
||||
Gaming_UpdateUserInfo,
|
||||
Gaming_Punish
|
||||
Gaming,
|
||||
}
|
||||
|
||||
public enum GamingType
|
||||
{
|
||||
None,
|
||||
Connect,
|
||||
Disconnect,
|
||||
Reconnect,
|
||||
BanCharacter,
|
||||
PickCharacter,
|
||||
Random,
|
||||
LevelUp,
|
||||
Move,
|
||||
Attack,
|
||||
Skill,
|
||||
Item,
|
||||
Magic,
|
||||
Buy,
|
||||
SuperSkill,
|
||||
Pause,
|
||||
Unpause,
|
||||
Surrender,
|
||||
UpdateInfo,
|
||||
Punish
|
||||
}
|
||||
|
||||
public enum SocketRuntimeType
|
||||
|
@ -9,23 +9,21 @@
|
||||
public const string Column_RoomMaster = "RoomMaster";
|
||||
public const string Column_RoomMasterName = "RoomMasterName";
|
||||
public const string Column_RoomType = "RoomType";
|
||||
public const string Column_GameMode = "GameMode";
|
||||
public const string Column_GameMap = "GameMap";
|
||||
public const string Column_RoomState = "RoomState";
|
||||
public const string Column_HasPass = "HasPass";
|
||||
public const string Column_Password = "Password";
|
||||
public const string Select_Rooms = $"{Command_Select} {TableName}.{Command_All}, {UserQuery.TableName}.{UserQuery.Column_Username} {Command_As} {Column_RoomMasterName} " +
|
||||
$"{Command_From} {TableName} {Command_LeftJoin} {UserQuery.TableName} {Command_On} {UserQuery.TableName}.{UserQuery.Column_UID} = {TableName}.{Column_RoomMaster}";
|
||||
|
||||
public static string Insert_CreateRoom(string RoomID, long RoomMaster, Library.Constant.RoomType RoomType, string Password)
|
||||
public static string Insert_CreateRoom(string RoomID, long RoomMaster, Library.Constant.RoomType RoomType, string GameMode, string GameMap, string Password)
|
||||
{
|
||||
Library.Constant.RoomState RoomState = Library.Constant.RoomState.Created;
|
||||
DateTime NowTime = DateTime.Now;
|
||||
bool HasPass = false;
|
||||
if (Password.Trim() != "")
|
||||
{
|
||||
HasPass = true;
|
||||
}
|
||||
return $"{Command_Insert} {Command_Into} {TableName} ({Column_RoomID}, {Column_CreateTime}, {Column_RoomMaster}, {Column_RoomType}, {Column_RoomState}, {Column_HasPass}, {Column_Password})" +
|
||||
$" {Command_Values} ('{RoomID}', '{NowTime}', {RoomMaster}, {(int)RoomType}, {(int)RoomState}, {(HasPass ? 1 : 0)}, '{Password}')";
|
||||
bool HasPass = Password.Trim() != "";
|
||||
return $"{Command_Insert} {Command_Into} {TableName} ({Column_RoomID}, {Column_CreateTime}, {Column_RoomMaster}, {Column_RoomType}, {Column_GameMode}, {Column_GameMap}, {Column_RoomState}, {Column_HasPass}, {Column_Password})" +
|
||||
$" {Command_Values} ('{RoomID}', '{NowTime}', {RoomMaster}, {(int)RoomType}, '{GameMode}', '{GameMap}', {(int)RoomState}, {(HasPass ? 1 : 0)}, '{Password}')";
|
||||
}
|
||||
|
||||
public static string Delete_Rooms(params string[] roomids)
|
||||
|
@ -40,9 +40,9 @@ namespace Milimoe.FunGame.Core.Model
|
||||
public bool FunGame_isInRoom { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 当前游戏模式
|
||||
/// 当前所处的房间类型
|
||||
/// </summary>
|
||||
public string FunGame_GameMode { get; set; } = GameMode.Mix;
|
||||
public string FunGame_RoomType { get; set; } = RoomSet.All;
|
||||
|
||||
/// <summary>
|
||||
/// 服务器名称
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Reflection;
|
||||
using Milimoe.FunGame.Core.Library.Common.Plugin;
|
||||
using Milimoe.FunGame.Core.Library.Common.Addon;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
@ -11,21 +12,21 @@ namespace Milimoe.FunGame.Core.Service
|
||||
/// <param name="plugins"></param>
|
||||
/// <param name="objs"></param>
|
||||
/// <returns></returns>
|
||||
internal static Dictionary<string, BasePlugin> LoadPlugins(Dictionary<string, BasePlugin> plugins, params object[] objs)
|
||||
internal static Dictionary<string, Plugin> LoadPlugins(Dictionary<string, Plugin> plugins, params object[] objs)
|
||||
{
|
||||
if (!Directory.Exists("plugins")) return plugins;
|
||||
if (!Directory.Exists(ReflectionSet.PluginFolderPath)) return plugins;
|
||||
|
||||
string[] dlls = Directory.GetFiles("plugins", "*.dll");
|
||||
string[] dlls = Directory.GetFiles(ReflectionSet.PluginFolderPath, "*.dll");
|
||||
|
||||
foreach (string dll in dlls)
|
||||
{
|
||||
// 加载目录下所有的DLL
|
||||
Assembly assembly = Assembly.LoadFrom(dll);
|
||||
|
||||
// 遍历DLL中继承了BasePlugin的类型
|
||||
foreach (Type type in assembly.GetTypes().AsEnumerable().Where(type => type.IsSubclassOf(typeof(BasePlugin))))
|
||||
// 遍历DLL中继承了Plugin的类型
|
||||
foreach (Type type in assembly.GetTypes().AsEnumerable().Where(type => type.IsSubclassOf(typeof(Plugin))))
|
||||
{
|
||||
BasePlugin? instance = (BasePlugin?)Activator.CreateInstance(type);
|
||||
Plugin? instance = (Plugin?)Activator.CreateInstance(type);
|
||||
if (instance != null && instance.Load(objs))
|
||||
{
|
||||
plugins.TryAdd(instance.Name, instance);
|
||||
@ -35,5 +36,63 @@ namespace Milimoe.FunGame.Core.Service
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从gamemodes目录加载所有模组
|
||||
/// </summary>
|
||||
/// <param name="gamemodes"></param>
|
||||
/// <param name="objs"></param>
|
||||
/// <returns></returns>
|
||||
internal static Dictionary<string, GameMode> LoadGameModes(Dictionary<string, GameMode> gamemodes, params object[] objs)
|
||||
{
|
||||
if (!Directory.Exists(ReflectionSet.GameModeFolderPath)) return gamemodes;
|
||||
|
||||
string[] dlls = Directory.GetFiles(ReflectionSet.GameModeFolderPath, "*.dll");
|
||||
|
||||
foreach (string dll in dlls)
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFrom(dll);
|
||||
|
||||
foreach (Type type in assembly.GetTypes().AsEnumerable().Where(type => type.IsSubclassOf(typeof(GameMode))))
|
||||
{
|
||||
GameMode? instance = (GameMode?)Activator.CreateInstance(type);
|
||||
if (instance != null && instance.Load(objs))
|
||||
{
|
||||
gamemodes.TryAdd(instance.Name, instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gamemodes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从gamemaps目录加载所有地图
|
||||
/// </summary>
|
||||
/// <param name="gamemaps"></param>
|
||||
/// <param name="objs"></param>
|
||||
/// <returns></returns>
|
||||
internal static Dictionary<string, GameMap> LoadGameMaps(Dictionary<string, GameMap> gamemaps, params object[] objs)
|
||||
{
|
||||
if (!Directory.Exists(ReflectionSet.GameMapFolderPath)) return gamemaps;
|
||||
|
||||
string[] dlls = Directory.GetFiles(ReflectionSet.GameMapFolderPath, "*.dll");
|
||||
|
||||
foreach (string dll in dlls)
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFrom(dll);
|
||||
|
||||
foreach (Type type in assembly.GetTypes().AsEnumerable().Where(type => type.IsSubclassOf(typeof(GameMap))))
|
||||
{
|
||||
GameMap? instance = (GameMap?)Activator.CreateInstance(type);
|
||||
if (instance != null && instance.Load(objs))
|
||||
{
|
||||
gamemaps.TryAdd(instance.Name, instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gamemaps;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user