407 lines
17 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, -- 玩家排行榜信息更新
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, -- 切换两队伍的出生点
-- MiniGame
MiniGameLoad = 80000, -- 小玩法加载
MiniGameStart = 80001, -- 小玩法开始 MiniGameType
MiniGameEnd = 80002, -- 小玩法结束 PlayerAddScore : {PlayerKey = AddScore, }
NewMiniGame = 80003, -- 新的玩法开始
SelectMiniGameCallBack = 80004, -- 玩家选择玩法的服务器回调 IsSucceed, InMiniGameType, InPlayerKey
UpdateBlockFloorCollision = 80005, -- 更新阻挡地板状态 IsBlock
UpdatePlayerSelectMiniMapType = 80006, -- 玩家选择的地图类型 PlayerKey:MapType
ShootingTargetAddScore = 81001, -- 玩家击靶得分 PlayerKey, AddScore
UpdateShootingTargetScore = 81002, -- 所有玩家当前击靶得分 {[PlayerKey] = Score}
UpdatePlayerIsReady = 81003, -- 小玩法玩家准备 {[PlayerKey] = IsReady}
PlayerDropMiniGameKillBox = 81004, -- 玩家掉落到陷阱 PlayerKey
UpdateMiniGameAllPlayerScore= 81005, -- 玩家小玩法内部得分,用于通用的客户端得分界面 {PlayerKey = Score, }
UpdatePlayerSpawnPoint = 81006, -- 更新玩家出生点
StickOverlapPlayer = 81007, -- 玩家被棍棒击中 PlayerKey
PlayerPickStar = 81008, -- 玩家拾取星星
UpdatePlayerColorIndex = 81009, -- 更新玩家颜色索引 PlayerKey = ColorIndex
UpdateColorScore = 81010, -- 更新颜色数量 ColorIndex = Num
PierceBalloon = 81011, -- 刺破波波车后面的气球 StabPlayer, PuncturedPlayer
OverlapCheckPoint = 81012, -- 玩家通过检查点 PlayerKey, PointIndex, IsDestination
BreakingIceCubes = 81013, -- 玩家击靶得分 PlayerKey, TargetID
ResponseGamePlayerSelect = 81014, -- 玩家选择索引 PlayerKey, ID
ResponseGameReadyState = 81015, -- 玩家选择索引 InShowServerTime, InIsPic, TargetIndex, TargetColorIndex, InSelectParams
ResponseGameDifficultyUpgrade = 81016, -- 难度升级
ResponseGameSelectCallBack = 81017, -- 玩家选择后的回调 IsRight, PlayerKey
PlayerPickNote = 81018, -- 玩家拾取音符
PlayerPickUpOrPutDownJigsaw = 81019, -- 玩家放下或拾取拼图
PlayerUpdateCountingNum = 81020, -- 更新计数玩法中的玩家计数 PlayerKey, Level, CountingNum
UpdateShapeInfo = 81021, -- 计数玩法中更新回合玩法数据 Level, InStartAddCountTime, InStopAddCountTime, ShapeInfos
AddShapeMoveInfo = 81022, -- 计数玩法中增加形状的移动操作 MoveInfos table:{{ID:int, TargetPos:Vector2D}, ...}
ClientSyncCountingNum = 81023, -- 所有玩家的计数{PlayerKey = CountingNum, ... }
PlayerStepThroughFloor = 81024, -- 玩家踩破地板 PlayerKey
AddMiniGameScore = 85000, -- 通用增加小玩法得分函数 PlayerKey, AddScore
AddMiniGameScoreList = 85001, -- 通用增加小玩法得分函数 AddScoreList: {PlayerKey = Score, ..}
MiniGameEndNotify = 85002, -- 小玩法结束通知
SetSceneCameraControl = 90001, -- 设置为场景摄像机控制 bool
}
--- 模式编辑器的默认事件映射
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.PlayerDeathInfo] = {"VictimKey", "CauserKey", "WeaponID", "DamageType", "IsHeadShotDamage", "Distance", "DamageValue", "Assister"},
[EventEnum.PlayerInjuryInfo] = {"VictimKey", "CauserKey", "WeaponID", "DamageType", "IsHeadShotDamage", "Distance", "DamageValue"},
[EventEnum.PlayerPossessed] = {"PlayerKey",},
[EventEnum.MiniGameLoad] = {},
[EventEnum.MiniGameStart] = {"MiniGameType"},
[EventEnum.MiniGameEnd] = {"PlayerAddScore",},
}
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,
MiniGameLoad = 3000,
MiniGameStart = 3001,
MiniGameEnd = 3002,
}
--- Action 配置游戏模式的默认参数该参数会被传入参数可被覆盖传入参数有效才会覆盖不填则使用Action中的默认参数或被传入参数覆盖
EventConfig.ActionInfo = {
-- Player
[EventConfig.ActionType.PlayerLogin] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerLogin",
ActionDefaultParam = {
PlayerKey = -1,
},
},
[EventConfig.ActionType.PlayerExit] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerExit",
ActionDefaultParam = {
PlayerKey = -1,
-- 玩家不足以支持游戏时触发的游戏结束事件
EndEvent = EventEnum.GameEnd,
},
},
[EventConfig.ActionType.PlayerRespawn] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerRespawn",
ActionDefaultParam = {
PlayerKey = -1,
-- 复活等待的时间
DelayTime = 3.,
},
},
[EventConfig.ActionType.PlayerDeadUpdateInfo] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerDeadUpdateInfo",
ActionDefaultParam = {
DeadPlayerKey = -1,
KillerPlayerKey = -1,
AssisterPlayerKey = -1;
WeaponID = -1,
},
},
[EventConfig.ActionType.PlayerPossessed] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerPossessed",
ActionDefaultParam = {
},
},
[EventConfig.ActionType.EnableInfBullets] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_EnableInfBullets",
ActionDefaultParam = {
},
},
-- GameState
[EventConfig.ActionType.WaitPlayerJoin] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_WaitingPlayer",
ActionDefaultParam = {
-- 等待玩家加入的时长
WaitTime = GlobalConfigs.GameModeSetting.MaxWaitPlayerJoinTime,
-- 提前开始游戏的最少队伍人数
WaitTeamPlayerNum = GlobalConfigs.GameModeSetting.MaxPlayerNum,
-- 等待结束触发的事件
--WaitFinishEvent = EventEnum.RoundBegining,
WaitFinishEvent = EventEnum.MiniGameLoad,
-- 等待结束玩家不足时触发的事件
WaitFailureEvent = EventEnum.GameEnd,
---- 至少等待时长
--AtLeastWaitingTime = 2,
-- 游戏即将开始提示的时间
GameWillBeginWaitTime = 3,
},
},
[EventConfig.ActionType.GamePlay] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_Play",
ActionDefaultParam = {
-- 游戏游玩时长
GameTime = GlobalConfigs.GameSetting.GameTime,
-- 游戏结束事件
GameEndEvent = EventEnum.GameEnd,
},
},
[EventConfig.ActionType.GameEnd] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_GameEnd",
ActionDefaultParam = {
-- 延迟关闭DS时间
DelayOffDS = 30.;
},
},
[EventConfig.ActionType.PlayerAddEnergy] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_PlayerAddEnergy",
ActionDefaultParam = {
},
},
[EventConfig.ActionType.RoundBegining] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_RoundBegining",
ActionDefaultParam = {
GameTime = GlobalConfigs.GameModeSetting.RoundTime;
PreparationTime = GlobalConfigs.GameModeSetting.RoundReadyTime;
GameEndEvent = EventEnum.RoundEnd;
},
},
[EventConfig.ActionType.RoundEnd] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_RoundEnd",
ActionDefaultParam = {
GameTime = 8;
GameEndEvent = EventEnum.GameEnd;
NewRoundEvent = EventEnum.RoundBegining;
},
},
[EventConfig.ActionType.MiniGameLoad] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_MiniGameLoad",
ActionDefaultParam = {
WaitFinishEvent = EventEnum.MiniGameStart;
},
},
[EventConfig.ActionType.MiniGameStart] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_MiniGameStart",
ActionDefaultParam = {
PreparationTime = GlobalConfigs.GameModeSetting.RoundReadyTime;
GameEndEvent = EventEnum.MiniGameEnd;
},
},
[EventConfig.ActionType.MiniGameEnd] = {
ActionPath = "Script.Global.EventManager.EventAction.EventAction_MiniGameEnd",
ActionDefaultParam = {
GameTime = 12;
GameEndEvent = EventEnum.GameEnd;
NewRoundEvent = EventEnum.MiniGameLoad;
},
},
}
--- 事件绑定Action 调用Key的事件会触发Value里的所有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] = {};
},
[EventEnum.MiniGameLoad] = {
[EventConfig.ActionType.MiniGameLoad] = {};
},
[EventEnum.MiniGameStart] = {
[EventConfig.ActionType.MiniGameStart] = {};
},
[EventEnum.MiniGameEnd] = {
[EventConfig.ActionType.MiniGameEnd] = {};
},
}
function EventConfig.CheckEventAttach(EventType)
return (
EventConfig.EventParam[EventType] ~= nil
and table.getCount(EventConfig.EventAttach[EventType]) > 0
)
end