mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
25 lines
781 B
TypeScript
25 lines
781 B
TypeScript
import { ContextAction, ContextActionOptionsInterface } from "./contextaction";
|
|
import { Unit } from "./unit";
|
|
|
|
export class ContextActionSet {
|
|
#contextActions: {[key: string]: ContextAction} = {};
|
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
addContextAction(unit: Unit, id: string, label: string, description: string, callback: CallableFunction, hideContextAfterExecution: boolean = true, options?:ContextActionOptionsInterface) {
|
|
options = options || {};
|
|
|
|
if (!(id in this.#contextActions)) {
|
|
this.#contextActions[id] = new ContextAction(id, label, description, callback, hideContextAfterExecution, options);
|
|
}
|
|
this.#contextActions[id].addUnit(unit);
|
|
}
|
|
|
|
getContextActions() {
|
|
return this.#contextActions;
|
|
}
|
|
|
|
|
|
} |