332 lines
12 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
EventConfig = EventConfig or {}
--- Action Tick的频率
EventConfig.TickFrequency = 24.
EventEnum = {
--- DefaultEvent
DSStartUp = 1001, -- 服务器启动
PlayerLogin = 1003, -- 玩家加入房间 PlayerKey
PlayerExit = 1004, -- 玩家离开房间 PlayerKey
--- GameState
GameStateChange = 2001, -- 游戏模式改变 CustomEnum.EGameState
WaitPlayerJoin = 2002, -- 等待玩家加入
GamePlay = 2003, -- 游戏开始
GameEnd = 2004, -- 游戏结束
RoundBegining = 2005, -- 回合开始
RoundEnd = 2006, -- 回合结束
RoundReadyFinish = 2007, -- 回合准备阶段结束
--- PlayerEvent
PlayerDeathInfo = 3001, -- 死亡信息 VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue uint, uint, int, int, bool, float, float
PlayerInjuryInfo = 3002, -- 受伤信息 VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue uint, uint, int, int, bool, float, float
PlayerPossessed = 3003, -- 玩家受控 PlayerKey
PlayerBeginPlay = 3004, -- 玩家受控 PlayerPawn
UpdatePlayerStartList = 10001, -- 通知出生点控制器进行更新出生点指针
AchievementSettlement = 10006, -- 成就事件游戏结算
UpdatePlayerScoreData = 20002, -- 玩家得分信息更新 通过UGCGameSystem.GameState.PlayerScoreDatas 获取玩家得分信息
AddTip = 20005, -- 添加提提示 TipStr TipType
GameWillBegin = 20010, -- 游戏即将开始
UpdatePlayerRank = 20101, -- 玩家排行榜信息更新
--- Game DiagramsBattlefield Event
LoadMap = 50006, -- 关卡加载 MapConifg.MapType
SelectMapCallBack = 50007, -- 地图选择服务器的回调 bSucceed, MapType
SelectDefaultWeaponCallBack = 50008, -- 默认武器选择回调 bSucceed, WeaponID
RandomSelectVoteMap = 50009,
PlayerIsAliveIsChange = 60002, -- 玩家存活列表改变
--- Game LineOfDefense
PlaceMode = 70001, -- 启用放置模式
LineOfDefenseMode = 70002, -- 启用防线模式
PlaceItemTypeIsChange = 71001, -- 客户端选择放置的Item类型改变 ItemType
PlaceModeChange = 71002, -- 放置模式改变 EPlaceMode
UpdatePlaceValue = 71003, -- 更新放置值 PlaceValue, PlaceMaxValue
UpdatePlacedItemCount = 71004, -- 更新放置数量 PlacedItemCount
ImportPlacementCallBack = 71005, -- 导入代码回调 EPlaceDecodeCallback
PlayerEnterLineOfDefense = 71006, -- 玩家进入防线 PlayerKey
RunMapTest = 71007, -- 服务器开启跑图测试
RerunNowRound = 71008, -- 重跑当前回合的跑图测试
BackToPlaceMode = 71009, -- 回退到放置模式
SaveRunMap = 71010, -- 保存地图 Name:string
UpdatePlaceModeSavedMapList = 71011, -- 放置模式下更新保存的地图 {{MapName = str, MapCode = str, LikeNum = uint, BrickNum = uint}, ...}
UpdatePlayMap = 71012, -- 游玩的地图更新 MapIndex
UnlockCallBack = 71013, -- 解锁回调 UnlockSucceed EUnlockType
IncrementCallBack = 71013, -- 增量回调 IncrementSucceed EUnlockType
UpdateLastPlayMapInfo = 71014, -- 上一位防守方玩法信息更新
UpdateDefender = 71015, -- 更新守方 PlayerKey
PlayerWeaponCombinationUpdate = 72001, -- 玩家可选的武器配置列表更新 [PlayerKey] = CombinationType
PlayerSelectedWeaponIndexUpdate = 72002, -- 玩家选择的武器配置索引更新 [PlayerKey] = Index
}
--- 模式编辑器的默认事件映射
EventConfig.GameModeEditEventMap = {
["DSStartUp"] = EventEnum.DSStartUp,
["PlayerLogin"] = EventEnum.PlayerLogin,
["PlayerExit"] = EventEnum.PlayerExit,
}
--- 事件包含的的参数名
EventConfig.EventParam = {
--[[
Template
[EventEnum.] = {"PlayerKey",},
]]
[EventEnum.DSStartUp] = {},
[EventEnum.PlaceMode] = {},
[EventEnum.LineOfDefenseMode] = {},
[EventEnum.PlayerLogin] = {"PlayerPawn", "PlayerKey"},
[EventEnum.PlayerExit] = {"PlayerPawn", "PlayerKey"},
[EventEnum.GameStateChange] = {"GameState"},
[EventEnum.WaitPlayerJoin] = {},
[EventEnum.GamePlay] = {},
[EventEnum.GameEnd] = {},
[EventEnum.RoundBegining] = {},
[EventEnum.RoundEnd] = {},
[EventEnum.PlayerLogin] = {"PlayerKey",},
[EventEnum.PlayerExit] = {"PlayerKey",},
[EventEnum.PlayerDeathInfo] = {"VictimKey", "CauserKey", "WeaponID", "DamageType", "IsHeadShotDamage", "Distance", "DamageValue"},
[EventEnum.PlayerInjuryInfo] = {"VictimKey", "CauserKey", "WeaponID", "DamageType", "IsHeadShotDamage", "Distance", "DamageValue"},
[EventEnum.PlayerPossessed] = {"PlayerKey",},
[EventEnum.RunMapTest] = {},
}
EventConfig.ActionType = {
---Player
PlayerLogin = 1001,
PlayerExit = 1002,
PlayerDeadUpdateInfo = 1003,
PlayerRespawn = 1004,
PlayerAddEnergy = 1005,
PlayerPossessed = 1006,
EnableInfBullets = 1007,
---GameState
WaitPlayerJoin = 2001,
GamePlay = 2002,
GameEnd = 2003,
RoundBegining = 2004,
RoundEnd = 2005,
RespiratoryRegurgitation= 3001, -- 呼吸回血
TestPlaceMap = 10001,
}
--- Action 配置游戏模式的默认参数该参数会被传入参数可被覆盖传入参数有效才会覆盖不填则使用Action中的默认参数或被传入参数覆盖
EventConfig.ActionInfo = {
-- Player
[EventConfig.ActionType.PlayerLogin] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerLogin",
ActionParam = {
PlayerKey = -1,
},
},
[EventConfig.ActionType.PlayerExit] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerExit",
ActionParam = {
PlayerKey = -1,
-- 玩家不足以支持游戏时触发的游戏结束事件
EndEvent = EventEnum.GameEnd,
},
},
[EventConfig.ActionType.PlayerRespawn] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerRespawn",
ActionParam = {
PlayerKey = -1,
-- 复活等待的时间
DelayTime = 3.,
},
},
[EventConfig.ActionType.PlayerDeadUpdateInfo] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerDeadUpdateInfo",
ActionParam = {
DeadPlayerKey = -1,
KillerPlayerKey = -1,
WeaponID = -1,
},
},
[EventConfig.ActionType.PlayerPossessed] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerPossessed",
ActionParam = {
},
},
[EventConfig.ActionType.EnableInfBullets] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_EnableInfBullets",
ActionParam = {
},
},
-- GameState
[EventConfig.ActionType.WaitPlayerJoin] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_WaitingPlayer",
ActionParam = {
-- 等待玩家加入的时长
WaitTime = GlobalConfigs.GameSetting.WaitTime,
-- 等待结束触发的事件
WaitFinishEvent = EventEnum.RoundBegining,
-- 等待结束玩家不足时触发的事件
WaitFailureEvent = EventEnum.GameEnd,
-- 至少等待时长
AtLeastWaitingTime = 5,
-- 游戏即将开始提示的时间
GameWillBeginWaitTime = 5,
},
},
[EventConfig.ActionType.GamePlay] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_Play",
ActionParam = {
-- 游戏游玩时长
GameTime = GlobalConfigs.GameSetting.GameTime,
-- 游戏结束事件
GameEndEvent = EventEnum.GameEnd,
},
},
[EventConfig.ActionType.GameEnd] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_GameEnd",
ActionParam = {
-- 延迟关闭DS时间
DelayOffDS = 30.;
},
},
[EventConfig.ActionType.PlayerAddEnergy] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerAddEnergy",
ActionParam = {
},
},
[EventConfig.ActionType.TestPlaceMap] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_TestPlaceMap",
ActionParam = {
},
},
[EventConfig.ActionType.RoundBegining] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_RoundBegining",
ActionParam = {
GameTime = GlobalConfigs.GameModeSetting.RoundTime;
PreparationTime = GlobalConfigs.GameModeSetting.RoundReadyTime;
GameEndEvent = EventEnum.RoundEnd;
},
},
[EventConfig.ActionType.RoundEnd] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_RoundEnd",
ActionParam = {
GameTime = 8;
GameEndEvent = EventEnum.GameEnd;
NewRoundEvent = EventEnum.RoundBegining;
},
},
[EventConfig.ActionType.RespiratoryRegurgitation] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_RespiratoryRegurgitation",
ActionParam = {
},
},
}
--- 事件绑定Action 参数映射 [EventParamName] = "ActionParamName"
EventConfig.EventAttach = {
[EventEnum.DSStartUp] = {
[EventConfig.ActionType.RespiratoryRegurgitation] = {},
},
[EventEnum.PlaceMode] = {
},
[EventEnum.LineOfDefenseMode] = {
[EventConfig.ActionType.WaitPlayerJoin] = {},
[EventConfig.ActionType.EnableInfBullets] = {},
},
[EventEnum.GamePlay] = {
[EventConfig.ActionType.GamePlay] = {},
},
[EventEnum.GameEnd] = {
[EventConfig.ActionType.GameEnd] = {},
},
[EventEnum.PlayerLogin] = {
[EventConfig.ActionType.PlayerLogin] = {
["PlayerKey"] = "PlayerKey"
}
},
[EventEnum.PlayerExit] = {
[EventConfig.ActionType.PlayerExit] = {
["PlayerKey"] = "PlayerKey"
}
},
[EventEnum.PlayerDeathInfo] = {
[EventConfig.ActionType.PlayerRespawn] = {
["VictimKey"] = "PlayerKey"
},
[EventConfig.ActionType.PlayerDeadUpdateInfo] = {
["VictimKey"] = "DeadPlayerKey",
["CauserKey"] = "KillerPlayerKey",
["WeaponID"] = "WeaponID",
}
},
[EventEnum.PlayerPossessed] = {
[EventConfig.ActionType.PlayerPossessed] = {
["PlayerKey"] = "PlayerKey"
}
},
[EventEnum.RunMapTest] = {
[EventConfig.ActionType.TestPlaceMap] = {},
},
[EventEnum.RoundBegining] = {
[EventConfig.ActionType.RoundBegining] = {};
},
[EventEnum.RoundEnd] = {
[EventConfig.ActionType.RoundEnd] = {};
},
}
function EventConfig.CheckEventAttach(EventType)
return (
EventConfig.EventParam[EventType] ~= nil
and table.getCount(EventConfig.EventAttach[EventType]) > 0
)
end