318 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, Assister uint, uint, int, int, bool, float, float, uint
PlayerInjuryInfo = 3002, -- 受伤信息 VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue uint, uint, int, int, bool, float, float
PlayerPossessed = 3003, -- 玩家受控 PlayerKey
PlayerBeginPlay = 3004, -- 玩家受控 PlayerPawn
AchievementPlayerKill = 10005, -- 成就事件玩家击杀 KillerPlayerKey, DeadPlayerKey, WeaponID,
AchievementSettlement = 10006, -- 成就事件游戏结算
TrophyOwnerExit = 10007, -- 奖杯拥有者掉线
Broadcast = 20001, -- 广播UI信息 BroadcastType, BroadcastTable, BroadcastPos
UpdatePlayerScoreData = 20002, -- 玩家得分信息更新 通过UGCGameSystem.GameState.PlayerScoreDatas 获取玩家得分信息
SelectWeaponCallBack = 20004, -- 武器选择回调 SelectSucceed
AddTip = 20005, -- 添加提提示 TipStr TipType
ClickSelectWeapon = 20006, -- 点击选择武器信息 EWeaponSelect, InfoID
UpdateTeamPlayerNum = 20007, -- 更新队伍玩家数量 BlueTeamNum, RedTeamNum
SelectTeamCallBack = 20008, -- 选择队伍的回调 SelectSucceed
Winner = 20009, -- 决出获胜者 WinnerPlayerKey
GameWillBegin = 20010, -- 游戏即将开始
PlayerCause = 20011, -- 玩家造成伤害 Damage, IsKill, CauserKey, VictimKey
PlayerOwnedBuffChange = 20012, -- 玩家拥有的Buff已改变
SaveSelectWeaponCallBack = 20013, -- 武器选择保存回调 SaveSucceed
PlayerSaveWeaponChange = 20014, -- 武器选择保存已改变
ButtonSettingCallBack = 20015, -- 保存按键配置回调 ButtonsRender{{TargetWidgetName = string, Pos = {X, Y}, Scale = float}, ...}
UpdatePlayerRank = 20101, -- 玩家排行榜信息更新
--- Trophy Game Event
--TrophyOwnerChange = 30003, -- 奖杯拥有者改变 NewOwnerPlayerKey
--UpdatePlayerWeapon = 30004, -- 玩家武器列表更新
--PlayerUseBuff = 30005, -- 玩家使用Buff
PlayerFirstTimePlaying = 30006, -- 玩家第一次进入游戏
--- Game DiagramsBattlefield Event
PlayerBuyCallBack = 50001, -- 玩家购买回调 bSucceed
PlayerGoldCoinChange = 50002, -- 玩家金币数改变
SelectInitBackPackCallBack = 50003, -- 选择初始背包配置回调
PlayerRewardScoreChange = 50004, -- 玩家悬赏分改变
PlayerAreaChange = 50005, -- 玩家所在区域改变 {[PlayerKey] = uint[1, 8]}
LoadMap = 50006, -- 关卡加载 MapConifg.MapType
SelectMapCallBack = 50007, -- 地图选择服务器的回调 bSucceed, MapType
SelectDefaultWeaponCallBack = 50008, -- 默认武器选择回调 bSucceed, WeaponID
RandomSelectVoteMap = 50009, -- 随机选择玩家投票出的Map {MapType, ..}, Index
--- Game MechanismBattlefield
PlayerGradientGradeChange = 60001, -- 玩家梯度等级改变
--- Game SecretTreasureChasing
HookNumChange = 70001, -- 使用Hook的数量改变 bIsTwo
KeyOwnerChange = 70002, -- 钥匙拥有者改变
ResetKey = 70003, -- 重置钥匙位置
KeyOwnerDead = 70004, -- 钥匙拥有者死亡
TeamHoldsTheKeyTimeUpdate = 70005, -- 队伍维持钥匙的时间改变
PlayerHoldsTheKeyTimeUpdate = 70006, -- 玩家维持钥匙时间改变
PlayerBuyCallBack = 70007, -- 玩家购买回调 bSucceed
PlayerGoldCoinChange = 70008, -- 玩家金币数改变
TeamPlayerAliveChange = 70009, -- 玩家存活信息改变
SwapBornPoint = 70010, -- 切换两队伍的出生点
EnablePlayerSkillListUpdate = 70011, -- 玩家技能限制
}
--- 模式编辑器的默认事件映射
EventConfig.GameModeEditEventMap = {
["DSStartUp"] = EventEnum.DSStartUp,
["PlayerLogin"] = EventEnum.PlayerLogin,
["PlayerExit"] = EventEnum.PlayerExit,
}
--- 事件包含的的参数名
EventConfig.EventParam = {
--[[
Template
[EventEnum.] = {"PlayerKey",},
]]
[EventEnum.DSStartUp] = {},
[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", "Assister"},
[EventEnum.PlayerInjuryInfo] = {"VictimKey", "CauserKey", "WeaponID", "DamageType", "IsHeadShotDamage", "Distance", "DamageValue"},
[EventEnum.PlayerPossessed] = {"PlayerKey",},
}
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,
}
--- 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,
AssisterPlayerKey = -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.GameModeSetting.MaxWaitPlayerJoinTime,
-- 提前开始游戏的最少队伍人数
WaitTeamPlayerNum = GlobalConfigs.GameModeSetting.MaxPlayerNum,
-- 等待结束触发的事件
WaitFinishEvent = EventEnum.RoundBegining,
-- 等待结束玩家不足时触发的事件
WaitFailureEvent = EventEnum.GameEnd,
-- 至少等待时长
AtLeastWaitingTime = 15,
-- 游戏即将开始提示的时间
GameWillBeginWaitTime = 12,
},
},
[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 = 20.;
},
},
[EventConfig.ActionType.PlayerAddEnergy] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerAddEnergy",
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 = 5;
GameEndEvent = EventEnum.GameEnd;
NewRoundEvent = EventEnum.RoundBegining;
},
},
}
--- 事件绑定Action 参数映射 [EventParamName] = "ActionParamName"
EventConfig.EventAttach = {
[EventEnum.DSStartUp] = {
[EventConfig.ActionType.WaitPlayerJoin] = {},
-- [EventConfig.ActionType.PlayerAddEnergy] = {},
[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",
["Assister"] = "AssisterPlayerKey",
["WeaponID"] = "WeaponID",
}
},
[EventEnum.PlayerPossessed] = {
[EventConfig.ActionType.PlayerPossessed] = {
["PlayerKey"] = "PlayerKey"
}
},
[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