ActionModel.ts
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
export const enum ActionType {
// TransitionIn = -2,
// TransitionOut = -1,
// TweenAnimation = 0,
// EffectAnimation = 1,
ModifyVariable = 2,
PlayAudio = 3,
EmitEvent = 4,
// TextAnimation = 5,
Custom = 10
}
export const enum TriggerType {
PreviousStart,
PreviousEnd,
Click,
Event
}
export interface ActionBase {
name: string;
type: ActionType;
trigger: TriggerType;
triggerEvent?: string;
delay: number;
}
export const enum VariableOperator {
Assign = 1,
Plus = 2,
Minus = 3,
Multiply = 4,
Divide = 5,
Modulo = 6
}
export const enum OperandType {
Variable = 1,
Const = 2,
Random = 3
}
export interface ModifyVariableAction extends ActionBase {
type: ActionType.ModifyVariable;
target: string;
operator: VariableOperator;
oprand: { type: OperandType, value: string }
}
export interface PlayMusicAction extends ActionBase {
type: ActionType.PlayAudio;
audioType: "music";
filePath: string;
}
export interface PlaySoundEffectAction extends ActionBase {
type: ActionType.PlayAudio
audioType: "effect";
loopCount: number;
stopPreviousSound: boolean;
volume: number;
filePath: string;
}
export type PlayAudioAction = PlayMusicAction | PlaySoundEffectAction;
export interface EmitEventAction extends ActionBase {
type: ActionType.EmitEvent;
emitEvent: string;
param: string;
}
export type Action = ModifyVariableAction | PlayAudioAction | EmitEventAction;
export interface Actions {
actions: Action[];
}