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AG,QAAQ,CAAC;wBACrC,YAAY,GAAG,QAAQ,CAAC;qBAC3B;iBACJ;aACJ;YAED,IAAI,mBAAmB,EAAE;gBACrB,IAAI,WAAW,KAAK,yBAAW,CAAC,aAAa,IAAI,WAAW,KAAK,yBAAW,CAAC,WAAW,EAAE;oBACtF,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;iBACvC;qBAAM;oBACH,eAAe,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;iBAC7C;aACJ;SACJ;QAED,IAAI,eAAe,CAAC,MAAM,EAAE;YACxB,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SAC/C;QACD,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/C,IAAI,SAAS,CAAC,MAAM,EAAE;YAClB,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAC/B;QAED,IAAI,OAAO;YAAE,OAAO;IACxB,CAAC;IA3DqB,4BAAc,iBA2DnC,CAAA;IAED,SAAgB,IAAI;QAChB,IAAI,OAAO;YAAE,OAAO;QACpB,OAAO,GAAG,IAAI,CAAC;QACf,KAAK,IAAI,QAAQ,IAAI,gBAAgB,EAAE;YACnC,QAAQ,CAAC,IAAI,EAAE,CAAC;SACnB;QACD,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACzB,UAAU;QACV,2BAA2B;IAC/B,CAAC;IATe,kBAAI,OASnB,CAAA;AACL,CAAC,EArFgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAqF7B","file":"","sourceRoot":"/","sourcesContent":["import { DeepReadonly } from \"simba-utils\";\nimport { Disposable } from \"simba-eventkit\";\nimport { Action, TriggerType, ModifyVariableAction, OperandType, VariableOperator, EmitEventAction, ActionType, PlayAudioAction, Actions } from \"./model/ActionModel\";\nimport { EditorEvents } from \"./EditorEvents\";\nimport { GameRecord } from \"./game-data/GameRecord\";\nimport { Random } from \"simba-random\";\nimport { AudioManager } from \"../common/gameplay/managers/AudioManager\";\n\nconst runningExecutors = new Set<Executor>();\n\nlet _affectRecord = true;\n\ninterface Executor {\n    execute(): Promise<void>;\n    stop(): void;\n}\n\nabstract class ActionExecutor<T extends Action> implements Executor {\n    private _timerHandle: any;\n    protected _action: DeepReadonly<T>;\n    nextExecutor?: ActionExecutor<any>;\n    private _disposable?: Disposable;\n\n    constructor(action: DeepReadonly<T>) {\n        this._action = action;\n    }\n\n    protected sleep = (t: number) => {\n        return new Promise<void>((resolve) => {\n            this._timerHandle = setTimeout(() => {\n                this._timerHandle = undefined;\n                resolve();\n            }, t * 1000);\n        });\n    }\n\n    abstract onExec(): Promise<boolean>;\n\n    execute = async (): Promise<void> => {\n        runningExecutors.add(this);\n        if (this._action.trigger === TriggerType.Click) { // wait for click events\n            // await new Promise((resolve) => {\n            //     this._disposable = ClickEvent.once(() => {\n            //         resolve();\n            //     })\n            // });\n        }\n        if (this._action.trigger === TriggerType.Event) {\n            if (!this._action.triggerEvent) return;\n            return new Promise((resolve) => {\n                this._disposable = EditorEvents.emitter.once(this._action.triggerEvent!, async () => {\n                    let result = await this.executeInternal();\n                    resolve();\n                    return result;\n                });\n            });\n        } else {\n            return this.executeInternal();\n        }\n    }\n\n    private executeInternal = async () => {\n        if (this._action.delay) {\n            await this.sleep(this._action.delay);\n        }\n        let finished = true;\n        if (this.nextExecutor && this.nextExecutor._action.trigger === TriggerType.PreviousStart) {\n            [finished] = await Promise.all([this.onExec(), this.nextExecutor.execute()]);\n        } else {\n            finished = await this.onExec();\n            if (this.nextExecutor) {\n                await this.nextExecutor.execute();\n            }\n        }\n        if (finished) {\n            runningExecutors.delete(this);\n        }\n    }\n\n    abstract onStop(): void;\n\n    stop = () => {\n        this.onStop();\n        if (this._disposable) this._disposable.dispose();\n        if (this._timerHandle) clearTimeout(this._timerHandle);\n    }\n}\n\nclass ModifyVariableExecutor extends ActionExecutor<ModifyVariableAction> {\n    onExec(): Promise<boolean> {\n        if (!_affectRecord) return Promise.resolve(true);\n        try {\n            let action = this._action;\n            let varValue = GameRecord.getVariableValue(action.target);\n            let value: string | number = action.oprand.value;\n            if (action.oprand.type === OperandType.Const) {\n                if (typeof varValue === \"number\") {\n                    value = Number.parseFloat(value);\n                }\n            } else if (action.oprand.type === OperandType.Random) {\n                let arr = value.split(\"-\");\n                let min = Number.parseFloat(arr[0]);\n                let max = Number.parseFloat(arr[1]);\n                value = Random.range(min, max);\n            } else if (action.oprand.type === OperandType.Variable) {\n                value = GameRecord.getVariableValue(value);\n            }\n            switch (action.operator) {\n                case VariableOperator.Assign:\n\n                    break;\n                case VariableOperator.Plus:\n                    varValue += (value as any);\n                    break;\n                case VariableOperator.Minus:\n                    (varValue as number) -= (value as number);\n                    break;\n                case VariableOperator.Multiply:\n                    (varValue as number) *= (value as number);\n                    break;\n                case VariableOperator.Divide:\n                    (varValue as number) /= (value as number);\n                    break;\n                case VariableOperator.Modulo:\n                    (varValue as number) %= (value as number);\n                    break;\n            }\n            GameRecord.setVariableValue(action.target, varValue);\n        } catch (e) {\n            console.error(e);\n        }\n        return Promise.resolve(true);\n    }\n\n    onStop(): void {\n    }\n}\n\nclass PlayAudioExecutor extends ActionExecutor<PlayAudioAction> {\n    private audioId?: number;\n\n    async onExec(): Promise<boolean> {\n        let action = this._action;\n        if (action.audioType === \"effect\") {\n            if (action.stopPreviousSound) {\n                AudioManager.stopAllEffect();\n            }\n            if (action.loopCount <= 0) {\n                this.audioId = await AudioManager.playEffect(action.filePath, 0);\n                return false;\n            } else {\n                AudioManager.playEffect(action.filePath, action.loopCount);\n            }\n        } else {\n            if (!action.filePath) {\n                AudioManager.stopMusic();\n            } else {\n                AudioManager.playMusic(action.filePath);\n            }\n            if (_affectRecord) {\n                GameRecord.recordVariables.bgm = action.filePath;\n            }\n        }\n\n        return true;\n    }\n\n    onStop(): void {\n        if (this.audioId !== undefined) {\n            AudioManager.stopEffect(this.audioId);\n        }\n    }\n}\n\nclass EmitEventExecutor extends ActionExecutor<EmitEventAction> {\n    async onExec(): Promise<boolean> {\n        if (this._action.emitEvent) {\n            await Promise.all(EditorEvents.emitter.emit(this._action.emitEvent, this._action.param));\n        }\n        return Promise.resolve(true);\n    }\n\n    onStop(): void {\n    }\n\n}\n\nexport namespace ActionManager {\n    function getExecutor(action: Action) {\n        if (action.type === ActionType.ModifyVariable) {\n            return new ModifyVariableExecutor(action);\n        } else if (action.type === ActionType.PlayAudio) {\n            return new PlayAudioExecutor(action);\n        } else if (action.type === ActionType.EmitEvent) {\n            return new EmitEventExecutor(action);\n        }\n        return undefined;\n    }\n\n    let stopped = false;\n    let prevActions: DeepReadonly<Actions>;\n    export async function executeActions(actionData: DeepReadonly<Actions>, filter?: (action: DeepReadonly<Action>) => boolean, affectRecord = true) {\n        // if (prevActions === actionData) {\n        //     throw new Error(\"Action already executed.\");\n        // }\n        // prevActions = actionData;\n        _affectRecord = affectRecord;\n        if (!stopped) {\n            stop();\n        }\n        stopped = false;\n\n        let firstActionExecutor: Executor | undefined;\n        let triggerType: TriggerType = TriggerType.PreviousStart;\n        let executors: Executor[] = [];\n        let noWaitExecutors: Executor[] = [];\n        if (actionData.actions) {\n            let currExecutor: ActionExecutor<any> | undefined;\n            for (let i = 0; i < actionData.actions.length; i++) {\n                if (i > 0 && actionData.actions[i].trigger === TriggerType.Event) {\n                    if (firstActionExecutor) {\n                        executors.push(firstActionExecutor);\n                        firstActionExecutor = undefined;\n                    }\n                }\n                let action = actionData.actions[i];\n                if (filter && !filter(action)) {\n                    continue;\n                }\n                let executor = getExecutor(action);\n                if (executor) {\n                    if (!firstActionExecutor) {\n                        firstActionExecutor = executor;\n                        triggerType = action.trigger;\n                        currExecutor = executor;\n                    } else if (currExecutor) {\n                        currExecutor.nextExecutor = executor;\n                        currExecutor = executor;\n                    }\n                }\n            }\n\n            if (firstActionExecutor) {\n                if (triggerType === TriggerType.PreviousStart || triggerType === TriggerType.PreviousEnd) {\n                    executors.push(firstActionExecutor);\n                } else {\n                    noWaitExecutors.push(firstActionExecutor);\n                }\n            }\n        }\n\n        if (noWaitExecutors.length) {\n            noWaitExecutors.forEach((v) => v.execute());\n        }\n        let promises = executors.map(v => v.execute());\n        if (executors.length) {\n            await Promise.all(promises);\n        }\n\n        if (stopped) return;\n    }\n\n    export function stop() {\n        if (stopped) return;\n        stopped = true;\n        for (let executor of runningExecutors) {\n            executor.stop();\n        }\n        runningExecutors.clear();\n        //add line\n        // prevActions = undefined;\n    }\n}"]}