stopEvent 停止事件
stopEvent
类型: MethodDeclaration
所属类: CommandFunctionList
定义位置: command.ts
描述
停止事件
参数
参数名 | 类型 | 描述 | 默认值 |
---|---|---|---|
\{type, actor, skill, state, equipment, item, light, element, eventId, eventType\} | `{ | ||
type: 'current' | 'global' | 'scene' | 'actor' | 'skill' | 'state' | 'equipment' | 'item' | 'light' | 'element' | |||
actor?: ActorGetter | |||
skill?: SkillGetter | |||
state?: StateGetter | |||
equipment?: EquipmentGetter | |||
item?: ItemGetter | |||
light?: LightGetter | |||
element?: ElementGetter | |||
eventId?: string | |||
eventType?: string | |||
}` | - | - |
返回值
类型: CommandFunction \| Array<CommandFunction>
源代码
位置: 第 3718 行
protected stopEvent({type, actor, skill, state, equipment, item, light, element, eventId, eventType}: {
type: 'current' | 'global' | 'scene' | 'actor' | 'skill' | 'state' | 'equipment' | 'item' | 'light' | 'element'
actor?: ActorGetter
skill?: SkillGetter
state?: StateGetter
equipment?: EquipmentGetter
item?: ItemGetter
light?: LightGetter
element?: ElementGetter
eventId?: string
eventType?: string
}): CommandFunction | Array<CommandFunction> {
// 补丁:2025-2-27
if (type === undefined) {
type = 'current'
}
switch (type) {
case 'current':
return () => (CurrentEvent.finish(), false)
case 'global':
return () => {
const commands = EventManager.guidMap[eventId!]
const fn = !commands ? Command.skip : () => {
EventManager.stopEvents(commands)
return true
}
// 编译时不能确定事件已加载,因此使用运行时编译
return (CommandList[CommandIndex - 1] = fn)()
}
case 'scene': {
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(Scene.binding?.updaters, type)
return true
}
}
case 'actor': {
const getActor = Command.compileActor(actor!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getActor()?.updaters, type)
return true
}
}
case 'skill': {
const getSkill = Command.compileSkill(skill!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getSkill()?.parent?.actor.updaters, type)
return true
}
}
case 'state': {
const getState = Command.compileState(state!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getState()?.updaters, type)
return true
}
}
case 'equipment': {
const getEquipment = Command.compileEquipment(equipment!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getEquipment()?.parent?.actor.updaters, type)
return true
}
}
case 'item': {
const getItem = Command.compileItem(item!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getItem()?.parent?.actor.updaters, type)
return true
}
}
case 'light': {
const getLight = Command.compileLight(light!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getLight()?.updaters, type)
return true
}
}
case 'element': {
const getElement = Command.compileElement(element!)
const type = Enum.getValue(eventType!) || eventType!
return () => {
Command.stopActiveEventsByType(getElement()?.updaters, type)
return true
}
}
}
}
文档生成时间:2025/7/7 12:07:06