model-action 2.0.0 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/Action.d.ts.map +1 -1
- package/dist/modules/Action.js +1 -0
- package/dist/modules/Action.js.map +1 -1
- package/dist/modules/Animation.d.ts +59 -0
- package/dist/modules/Animation.d.ts.map +1 -0
- package/dist/modules/Animation.js +117 -0
- package/dist/modules/Animation.js.map +1 -0
- package/dist/modules/CameraView.d.ts +37 -0
- package/dist/modules/CameraView.d.ts.map +1 -0
- package/dist/modules/CameraView.js +110 -0
- package/dist/modules/CameraView.js.map +1 -0
- package/dist/modules/Effect.d.ts +37 -0
- package/dist/modules/Effect.d.ts.map +1 -0
- package/dist/modules/Effect.js +72 -0
- package/dist/modules/Effect.js.map +1 -0
- package/dist/modules/GameMode.d.ts +17 -0
- package/dist/modules/GameMode.d.ts.map +1 -0
- package/dist/modules/GameMode.js +36 -0
- package/dist/modules/GameMode.js.map +1 -0
- package/dist/modules/Init.d.ts +28 -0
- package/dist/modules/Init.d.ts.map +1 -0
- package/dist/modules/Init.js +81 -0
- package/dist/modules/Init.js.map +1 -0
- package/dist/modules/Path.d.ts +79 -0
- package/dist/modules/Path.d.ts.map +1 -0
- package/dist/modules/Path.js +157 -0
- package/dist/modules/Path.js.map +1 -0
- package/dist/peer-stream.d.ts +123 -0
- package/dist/peer-stream.d.ts.map +1 -0
- package/dist/peer-stream.js +852 -0
- package/dist/peer-stream.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +7 -2
- package/src/modules/Action.ts +1 -0
- package/src/modules/Animation.ts +171 -0
- package/src/modules/{Camera.ts → CameraView.ts} +2 -2
- package/src/modules/Effect.ts +127 -0
- package/src/modules/GameMode.ts +60 -0
- package/src/modules/Init.ts +104 -0
- package/src/modules/{Track.ts → Path.ts} +28 -21
- package/src/peer-stream.js +938 -0
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 路径方法
|
|
6
6
|
*/
|
|
7
7
|
import { Action, SendParam } from "./Action";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// 路径的用途
|
|
11
|
+
type PathPublicUsedType = 'Normal' | 'Person' | 'Car'
|
|
12
|
+
|
|
13
|
+
type PathActionType = 'getRoadNet' | 'remove' | 'add' | 'show' | 'hide' | 'updateMovingParam' | 'start' | 'stop' | 'restart' | 'beginEdit' | 'endEdit'
|
|
11
14
|
|
|
12
15
|
// 路径模块类型
|
|
13
16
|
export type PathModuleType = 'Edit' | 'PathTracer'
|
|
@@ -49,9 +52,10 @@ export interface PathEditParam {
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
// 轨迹添加的 data 结构
|
|
52
|
-
interface
|
|
55
|
+
interface PathAddData {
|
|
53
56
|
action: 'add';
|
|
54
57
|
pathId: string; // 自定义轨迹ID
|
|
58
|
+
pathPublicUsedType?: PathPublicUsedType; // 路径的用途,默认 Normal
|
|
55
59
|
pathDrawBaseType: PathDrawBaseType; // 绘制方式
|
|
56
60
|
roadNetId?: string; // 路网ID,BaseOnRoadNet时需要
|
|
57
61
|
rolerMoveParam?: RolerMoveParam; // 沿路径移动的信息
|
|
@@ -59,35 +63,38 @@ interface TrackAddData {
|
|
|
59
63
|
points: PathPoint[]; // 路径点数组
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
type
|
|
66
|
+
type PathType = SendParam & {
|
|
63
67
|
cmd: "path";
|
|
64
68
|
data: {
|
|
65
|
-
action:
|
|
69
|
+
action: PathActionType;
|
|
66
70
|
[key: string]: any;
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
export class
|
|
74
|
+
export class PathAction extends Action {
|
|
71
75
|
/**
|
|
72
76
|
* 请求三维绘制路径
|
|
73
77
|
* @param pathId 自定义轨迹ID,后面删除的时候用,如果之前有编辑路径,这里就使用编辑路径的时候传入的路径 pathId
|
|
74
78
|
* @param pathDrawBaseType 绘制方式:BaseOnRoadNet 基于路网,使用C++寻路;BaseOnPathEditInfo 基于编辑路径生成的点画路径,不基于路网
|
|
75
79
|
* @param points 路径点数组
|
|
80
|
+
* @param pathPublicUsedType 路径的用途,默认 Normal
|
|
76
81
|
* @param roadNetId 路网的ID,pathDrawBaseType = BaseOnRoadNet的时候,需要传值,如果场景就一个路网,也可以不用传
|
|
77
82
|
* @param rolerMoveParam 沿路径移动的信息
|
|
78
83
|
* @param pathStyle 路径样式
|
|
79
84
|
*/
|
|
80
|
-
static
|
|
85
|
+
static pathAdd(
|
|
81
86
|
pathId: string,
|
|
82
87
|
pathDrawBaseType: PathDrawBaseType,
|
|
83
88
|
points: PathPoint[],
|
|
89
|
+
pathPublicUsedType?: PathPublicUsedType,
|
|
84
90
|
roadNetId?: string,
|
|
85
91
|
rolerMoveParam?: RolerMoveParam,
|
|
86
92
|
pathStyle?: PathStyle
|
|
87
93
|
) {
|
|
88
|
-
const data:
|
|
94
|
+
const data: PathAddData = {
|
|
89
95
|
action: "add",
|
|
90
96
|
pathId,
|
|
97
|
+
pathPublicUsedType: pathPublicUsedType || 'Normal',
|
|
91
98
|
pathDrawBaseType,
|
|
92
99
|
points,
|
|
93
100
|
};
|
|
@@ -107,7 +114,7 @@ export class TrackAction extends Action {
|
|
|
107
114
|
data.pathStyle = pathStyle;
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
const param:
|
|
117
|
+
const param: PathType = {
|
|
111
118
|
cmd: "path",
|
|
112
119
|
data
|
|
113
120
|
};
|
|
@@ -120,7 +127,7 @@ export class TrackAction extends Action {
|
|
|
120
127
|
* @param pathId 自定义轨迹ID,同前面,自定义的ID
|
|
121
128
|
* @param module 显隐、删除哪一部分:Edit 编辑的部分 | PathTracer 根据设备点动态生成的路径部分,如果不传,则整个显隐或者删除
|
|
122
129
|
*/
|
|
123
|
-
static
|
|
130
|
+
static pathShowHideRemove(
|
|
124
131
|
action: 'show' | 'hide' | 'remove',
|
|
125
132
|
pathId: string,
|
|
126
133
|
module?: PathModuleType
|
|
@@ -139,7 +146,7 @@ export class TrackAction extends Action {
|
|
|
139
146
|
data.module = module;
|
|
140
147
|
}
|
|
141
148
|
|
|
142
|
-
const param:
|
|
149
|
+
const param: PathType = {
|
|
143
150
|
cmd: "path",
|
|
144
151
|
data
|
|
145
152
|
};
|
|
@@ -157,7 +164,7 @@ export class TrackAction extends Action {
|
|
|
157
164
|
* @param pathId 自定义轨迹ID
|
|
158
165
|
* @param rolerMoveParam 沿路径移动的参数
|
|
159
166
|
*/
|
|
160
|
-
static
|
|
167
|
+
static pathUpdateMovingParam(
|
|
161
168
|
pathId: string,
|
|
162
169
|
rolerMoveParam: RolerMoveParam
|
|
163
170
|
) {
|
|
@@ -171,7 +178,7 @@ export class TrackAction extends Action {
|
|
|
171
178
|
rolerMoveParam
|
|
172
179
|
};
|
|
173
180
|
|
|
174
|
-
const param:
|
|
181
|
+
const param: PathType = {
|
|
175
182
|
cmd: "path",
|
|
176
183
|
data
|
|
177
184
|
};
|
|
@@ -184,19 +191,19 @@ export class TrackAction extends Action {
|
|
|
184
191
|
* @param pathId 自定义轨迹ID
|
|
185
192
|
* @param rolerMoveParam 沿路径移动的参数
|
|
186
193
|
*/
|
|
187
|
-
static
|
|
194
|
+
static pathMove(action: 'start', pathId: string, rolerMoveParam: RolerMoveParam): void;
|
|
188
195
|
/**
|
|
189
196
|
* 在生成的路径上面移动 - 停止或重启
|
|
190
197
|
* @param action 操作类型:stop 停止移动 | restart 重启移动
|
|
191
198
|
*/
|
|
192
|
-
static
|
|
199
|
+
static pathMove(action: 'stop' | 'restart'): void;
|
|
193
200
|
/**
|
|
194
201
|
* 在生成的路径上面移动
|
|
195
202
|
* @param action 操作类型:start 开始移动 | stop 停止移动 | restart 重启移动
|
|
196
203
|
* @param pathId 自定义轨迹ID(仅 start 时需要)
|
|
197
204
|
* @param rolerMoveParam 沿路径移动的参数(仅 start 时需要)
|
|
198
205
|
*/
|
|
199
|
-
static
|
|
206
|
+
static pathMove(
|
|
200
207
|
action: 'start' | 'stop' | 'restart',
|
|
201
208
|
pathId?: string,
|
|
202
209
|
rolerMoveParam?: RolerMoveParam
|
|
@@ -219,7 +226,7 @@ export class TrackAction extends Action {
|
|
|
219
226
|
}
|
|
220
227
|
// stop 和 restart 不需要 pathId 和 rolerMoveParam
|
|
221
228
|
|
|
222
|
-
const param:
|
|
229
|
+
const param: PathType = {
|
|
223
230
|
cmd: "path",
|
|
224
231
|
data
|
|
225
232
|
};
|
|
@@ -238,7 +245,7 @@ export class TrackAction extends Action {
|
|
|
238
245
|
* @param pathName 路径名称,前端配置界面提供数据,非必须
|
|
239
246
|
* @param pathEditParam 路径编辑参数,前端配置界面提供数据
|
|
240
247
|
*/
|
|
241
|
-
static
|
|
248
|
+
static pathBeginEdit(
|
|
242
249
|
pathId?: string,
|
|
243
250
|
pathName?: string,
|
|
244
251
|
pathEditParam?: PathEditParam
|
|
@@ -267,7 +274,7 @@ export class TrackAction extends Action {
|
|
|
267
274
|
data.pathEditParam = pathEditParam;
|
|
268
275
|
}
|
|
269
276
|
|
|
270
|
-
const param:
|
|
277
|
+
const param: PathType = {
|
|
271
278
|
cmd: "path",
|
|
272
279
|
data
|
|
273
280
|
};
|
|
@@ -277,14 +284,14 @@ export class TrackAction extends Action {
|
|
|
277
284
|
/**
|
|
278
285
|
* 停止路径编辑
|
|
279
286
|
*/
|
|
280
|
-
static
|
|
287
|
+
static pathEndEdit() {
|
|
281
288
|
const data: {
|
|
282
289
|
action: 'endEdit';
|
|
283
290
|
} = {
|
|
284
291
|
action: 'endEdit'
|
|
285
292
|
};
|
|
286
293
|
|
|
287
|
-
const param:
|
|
294
|
+
const param: PathType = {
|
|
288
295
|
cmd: "path",
|
|
289
296
|
data
|
|
290
297
|
};
|