@cc-component/cc-ex-component 1.0.2 → 1.0.4

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.
@@ -0,0 +1,614 @@
1
+ [
2
+ {
3
+ "__type__": "cc.Prefab",
4
+ "_name": "VideoComponent",
5
+ "_objFlags": 0,
6
+ "__editorExtras__": {},
7
+ "_native": "",
8
+ "data": {
9
+ "__id__": 1
10
+ },
11
+ "optimizationPolicy": 0,
12
+ "persistent": false
13
+ },
14
+ {
15
+ "__type__": "cc.Node",
16
+ "_name": "VideoComponent",
17
+ "_objFlags": 0,
18
+ "__editorExtras__": {},
19
+ "_parent": null,
20
+ "_children": [
21
+ {
22
+ "__id__": 2
23
+ },
24
+ {
25
+ "__id__": 10
26
+ },
27
+ {
28
+ "__id__": 16
29
+ }
30
+ ],
31
+ "_active": true,
32
+ "_components": [
33
+ {
34
+ "__id__": 22
35
+ },
36
+ {
37
+ "__id__": 24
38
+ },
39
+ {
40
+ "__id__": 26
41
+ }
42
+ ],
43
+ "_prefab": {
44
+ "__id__": 28
45
+ },
46
+ "_lpos": {
47
+ "__type__": "cc.Vec3",
48
+ "x": -540,
49
+ "y": 960,
50
+ "z": 0
51
+ },
52
+ "_lrot": {
53
+ "__type__": "cc.Quat",
54
+ "x": 0,
55
+ "y": 0,
56
+ "z": 0,
57
+ "w": 1
58
+ },
59
+ "_lscale": {
60
+ "__type__": "cc.Vec3",
61
+ "x": 1,
62
+ "y": 1,
63
+ "z": 1
64
+ },
65
+ "_mobility": 0,
66
+ "_layer": 33554432,
67
+ "_euler": {
68
+ "__type__": "cc.Vec3",
69
+ "x": 0,
70
+ "y": 0,
71
+ "z": 0
72
+ },
73
+ "_id": ""
74
+ },
75
+ {
76
+ "__type__": "cc.Node",
77
+ "_name": "bg",
78
+ "_objFlags": 0,
79
+ "__editorExtras__": {},
80
+ "_parent": {
81
+ "__id__": 1
82
+ },
83
+ "_children": [],
84
+ "_active": false,
85
+ "_components": [
86
+ {
87
+ "__id__": 3
88
+ },
89
+ {
90
+ "__id__": 5
91
+ },
92
+ {
93
+ "__id__": 7
94
+ }
95
+ ],
96
+ "_prefab": {
97
+ "__id__": 9
98
+ },
99
+ "_lpos": {
100
+ "__type__": "cc.Vec3",
101
+ "x": 540,
102
+ "y": -960,
103
+ "z": 0
104
+ },
105
+ "_lrot": {
106
+ "__type__": "cc.Quat",
107
+ "x": 0,
108
+ "y": 0,
109
+ "z": 0,
110
+ "w": 1
111
+ },
112
+ "_lscale": {
113
+ "__type__": "cc.Vec3",
114
+ "x": 1,
115
+ "y": 1,
116
+ "z": 1
117
+ },
118
+ "_mobility": 0,
119
+ "_layer": 33554432,
120
+ "_euler": {
121
+ "__type__": "cc.Vec3",
122
+ "x": 0,
123
+ "y": 0,
124
+ "z": 0
125
+ },
126
+ "_id": ""
127
+ },
128
+ {
129
+ "__type__": "cc.UITransform",
130
+ "_name": "",
131
+ "_objFlags": 0,
132
+ "__editorExtras__": {},
133
+ "node": {
134
+ "__id__": 2
135
+ },
136
+ "_enabled": true,
137
+ "__prefab": {
138
+ "__id__": 4
139
+ },
140
+ "_contentSize": {
141
+ "__type__": "cc.Size",
142
+ "width": 1080,
143
+ "height": 1920
144
+ },
145
+ "_anchorPoint": {
146
+ "__type__": "cc.Vec2",
147
+ "x": 0.5,
148
+ "y": 0.5
149
+ },
150
+ "_id": ""
151
+ },
152
+ {
153
+ "__type__": "cc.CompPrefabInfo",
154
+ "fileId": "63uT22wfRFLokXRa6V395J"
155
+ },
156
+ {
157
+ "__type__": "cc.Sprite",
158
+ "_name": "",
159
+ "_objFlags": 0,
160
+ "__editorExtras__": {},
161
+ "node": {
162
+ "__id__": 2
163
+ },
164
+ "_enabled": true,
165
+ "__prefab": {
166
+ "__id__": 6
167
+ },
168
+ "_customMaterial": null,
169
+ "_srcBlendFactor": 2,
170
+ "_dstBlendFactor": 4,
171
+ "_color": {
172
+ "__type__": "cc.Color",
173
+ "r": 0,
174
+ "g": 0,
175
+ "b": 0,
176
+ "a": 255
177
+ },
178
+ "_spriteFrame": {
179
+ "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
180
+ "__expectedType__": "cc.SpriteFrame"
181
+ },
182
+ "_type": 1,
183
+ "_fillType": 0,
184
+ "_sizeMode": 0,
185
+ "_fillCenter": {
186
+ "__type__": "cc.Vec2",
187
+ "x": 0,
188
+ "y": 0
189
+ },
190
+ "_fillStart": 0,
191
+ "_fillRange": 0,
192
+ "_isTrimmedMode": true,
193
+ "_useGrayscale": false,
194
+ "_atlas": null,
195
+ "_id": ""
196
+ },
197
+ {
198
+ "__type__": "cc.CompPrefabInfo",
199
+ "fileId": "82UZemhUVJRbyuWOZlK7yP"
200
+ },
201
+ {
202
+ "__type__": "cc.Widget",
203
+ "_name": "",
204
+ "_objFlags": 0,
205
+ "__editorExtras__": {},
206
+ "node": {
207
+ "__id__": 2
208
+ },
209
+ "_enabled": true,
210
+ "__prefab": {
211
+ "__id__": 8
212
+ },
213
+ "_alignFlags": 45,
214
+ "_target": null,
215
+ "_left": 0,
216
+ "_right": 0,
217
+ "_top": 0,
218
+ "_bottom": 0,
219
+ "_horizontalCenter": 0,
220
+ "_verticalCenter": 0,
221
+ "_isAbsLeft": true,
222
+ "_isAbsRight": true,
223
+ "_isAbsTop": true,
224
+ "_isAbsBottom": true,
225
+ "_isAbsHorizontalCenter": true,
226
+ "_isAbsVerticalCenter": true,
227
+ "_originalWidth": 20,
228
+ "_originalHeight": 20,
229
+ "_alignMode": 2,
230
+ "_lockFlags": 0,
231
+ "_id": ""
232
+ },
233
+ {
234
+ "__type__": "cc.CompPrefabInfo",
235
+ "fileId": "76Xa8jIdBLYpFyOT7cScof"
236
+ },
237
+ {
238
+ "__type__": "cc.PrefabInfo",
239
+ "root": {
240
+ "__id__": 1
241
+ },
242
+ "asset": {
243
+ "__id__": 0
244
+ },
245
+ "fileId": "b0bZxyLrlOJ5IoV3C627Oc",
246
+ "instance": null,
247
+ "targetOverrides": null,
248
+ "nestedPrefabInstanceRoots": null
249
+ },
250
+ {
251
+ "__type__": "cc.Node",
252
+ "_name": "video",
253
+ "_objFlags": 0,
254
+ "__editorExtras__": {},
255
+ "_parent": {
256
+ "__id__": 1
257
+ },
258
+ "_children": [],
259
+ "_active": true,
260
+ "_components": [
261
+ {
262
+ "__id__": 11
263
+ },
264
+ {
265
+ "__id__": 13
266
+ }
267
+ ],
268
+ "_prefab": {
269
+ "__id__": 15
270
+ },
271
+ "_lpos": {
272
+ "__type__": "cc.Vec3",
273
+ "x": 0,
274
+ "y": 0,
275
+ "z": 0
276
+ },
277
+ "_lrot": {
278
+ "__type__": "cc.Quat",
279
+ "x": 0,
280
+ "y": 0,
281
+ "z": 0,
282
+ "w": 1
283
+ },
284
+ "_lscale": {
285
+ "__type__": "cc.Vec3",
286
+ "x": 1,
287
+ "y": 1,
288
+ "z": 1
289
+ },
290
+ "_mobility": 0,
291
+ "_layer": 33554432,
292
+ "_euler": {
293
+ "__type__": "cc.Vec3",
294
+ "x": 0,
295
+ "y": 0,
296
+ "z": 0
297
+ },
298
+ "_id": ""
299
+ },
300
+ {
301
+ "__type__": "cc.UITransform",
302
+ "_name": "",
303
+ "_objFlags": 0,
304
+ "__editorExtras__": {},
305
+ "node": {
306
+ "__id__": 10
307
+ },
308
+ "_enabled": true,
309
+ "__prefab": {
310
+ "__id__": 12
311
+ },
312
+ "_contentSize": {
313
+ "__type__": "cc.Size",
314
+ "width": 1080,
315
+ "height": 1920
316
+ },
317
+ "_anchorPoint": {
318
+ "__type__": "cc.Vec2",
319
+ "x": 0,
320
+ "y": 1
321
+ },
322
+ "_id": ""
323
+ },
324
+ {
325
+ "__type__": "cc.CompPrefabInfo",
326
+ "fileId": "dcYCCpHGBJ1J8Jgao6N7OZ"
327
+ },
328
+ {
329
+ "__type__": "cc.Sprite",
330
+ "_name": "",
331
+ "_objFlags": 0,
332
+ "__editorExtras__": {},
333
+ "node": {
334
+ "__id__": 10
335
+ },
336
+ "_enabled": true,
337
+ "__prefab": {
338
+ "__id__": 14
339
+ },
340
+ "_customMaterial": null,
341
+ "_srcBlendFactor": 2,
342
+ "_dstBlendFactor": 4,
343
+ "_color": {
344
+ "__type__": "cc.Color",
345
+ "r": 255,
346
+ "g": 255,
347
+ "b": 255,
348
+ "a": 255
349
+ },
350
+ "_spriteFrame": null,
351
+ "_type": 0,
352
+ "_fillType": 0,
353
+ "_sizeMode": 0,
354
+ "_fillCenter": {
355
+ "__type__": "cc.Vec2",
356
+ "x": 0,
357
+ "y": 0
358
+ },
359
+ "_fillStart": 0,
360
+ "_fillRange": 0,
361
+ "_isTrimmedMode": true,
362
+ "_useGrayscale": false,
363
+ "_atlas": null,
364
+ "_id": ""
365
+ },
366
+ {
367
+ "__type__": "cc.CompPrefabInfo",
368
+ "fileId": "daT0PUUTxMnIMbDyfaNvxd"
369
+ },
370
+ {
371
+ "__type__": "cc.PrefabInfo",
372
+ "root": {
373
+ "__id__": 1
374
+ },
375
+ "asset": {
376
+ "__id__": 0
377
+ },
378
+ "fileId": "6bX8usjMhHvY3Fh/UH943G",
379
+ "instance": null,
380
+ "targetOverrides": null,
381
+ "nestedPrefabInstanceRoots": null
382
+ },
383
+ {
384
+ "__type__": "cc.Node",
385
+ "_name": "cover",
386
+ "_objFlags": 0,
387
+ "__editorExtras__": {},
388
+ "_parent": {
389
+ "__id__": 1
390
+ },
391
+ "_children": [],
392
+ "_active": true,
393
+ "_components": [
394
+ {
395
+ "__id__": 17
396
+ },
397
+ {
398
+ "__id__": 19
399
+ }
400
+ ],
401
+ "_prefab": {
402
+ "__id__": 21
403
+ },
404
+ "_lpos": {
405
+ "__type__": "cc.Vec3",
406
+ "x": 0,
407
+ "y": 0,
408
+ "z": 0
409
+ },
410
+ "_lrot": {
411
+ "__type__": "cc.Quat",
412
+ "x": 0,
413
+ "y": 0,
414
+ "z": 0,
415
+ "w": 1
416
+ },
417
+ "_lscale": {
418
+ "__type__": "cc.Vec3",
419
+ "x": 1,
420
+ "y": 1,
421
+ "z": 1
422
+ },
423
+ "_mobility": 0,
424
+ "_layer": 33554432,
425
+ "_euler": {
426
+ "__type__": "cc.Vec3",
427
+ "x": 0,
428
+ "y": 0,
429
+ "z": 0
430
+ },
431
+ "_id": ""
432
+ },
433
+ {
434
+ "__type__": "cc.UITransform",
435
+ "_name": "",
436
+ "_objFlags": 0,
437
+ "__editorExtras__": {},
438
+ "node": {
439
+ "__id__": 16
440
+ },
441
+ "_enabled": true,
442
+ "__prefab": {
443
+ "__id__": 18
444
+ },
445
+ "_contentSize": {
446
+ "__type__": "cc.Size",
447
+ "width": 1080,
448
+ "height": 1920
449
+ },
450
+ "_anchorPoint": {
451
+ "__type__": "cc.Vec2",
452
+ "x": 0,
453
+ "y": 1
454
+ },
455
+ "_id": ""
456
+ },
457
+ {
458
+ "__type__": "cc.CompPrefabInfo",
459
+ "fileId": "cdzL70DRdFgK1i9YQXzkOP"
460
+ },
461
+ {
462
+ "__type__": "cc.Sprite",
463
+ "_name": "",
464
+ "_objFlags": 0,
465
+ "__editorExtras__": {},
466
+ "node": {
467
+ "__id__": 16
468
+ },
469
+ "_enabled": true,
470
+ "__prefab": {
471
+ "__id__": 20
472
+ },
473
+ "_customMaterial": null,
474
+ "_srcBlendFactor": 2,
475
+ "_dstBlendFactor": 4,
476
+ "_color": {
477
+ "__type__": "cc.Color",
478
+ "r": 255,
479
+ "g": 255,
480
+ "b": 255,
481
+ "a": 255
482
+ },
483
+ "_spriteFrame": null,
484
+ "_type": 0,
485
+ "_fillType": 0,
486
+ "_sizeMode": 0,
487
+ "_fillCenter": {
488
+ "__type__": "cc.Vec2",
489
+ "x": 0,
490
+ "y": 0
491
+ },
492
+ "_fillStart": 0,
493
+ "_fillRange": 0,
494
+ "_isTrimmedMode": true,
495
+ "_useGrayscale": false,
496
+ "_atlas": null,
497
+ "_id": ""
498
+ },
499
+ {
500
+ "__type__": "cc.CompPrefabInfo",
501
+ "fileId": "5cLV26+j1K46aUKhIv5m74"
502
+ },
503
+ {
504
+ "__type__": "cc.PrefabInfo",
505
+ "root": {
506
+ "__id__": 1
507
+ },
508
+ "asset": {
509
+ "__id__": 0
510
+ },
511
+ "fileId": "819dgJmL5DzYxcEuP5n0q5",
512
+ "instance": null,
513
+ "targetOverrides": null,
514
+ "nestedPrefabInstanceRoots": null
515
+ },
516
+ {
517
+ "__type__": "cc.UITransform",
518
+ "_name": "",
519
+ "_objFlags": 0,
520
+ "__editorExtras__": {},
521
+ "node": {
522
+ "__id__": 1
523
+ },
524
+ "_enabled": true,
525
+ "__prefab": {
526
+ "__id__": 23
527
+ },
528
+ "_contentSize": {
529
+ "__type__": "cc.Size",
530
+ "width": 1080,
531
+ "height": 1920
532
+ },
533
+ "_anchorPoint": {
534
+ "__type__": "cc.Vec2",
535
+ "x": 0,
536
+ "y": 1
537
+ },
538
+ "_id": ""
539
+ },
540
+ {
541
+ "__type__": "cc.CompPrefabInfo",
542
+ "fileId": "f3QKjBbXJLpagHWSmbjf6E"
543
+ },
544
+ {
545
+ "__type__": "cc.Widget",
546
+ "_name": "",
547
+ "_objFlags": 0,
548
+ "__editorExtras__": {},
549
+ "node": {
550
+ "__id__": 1
551
+ },
552
+ "_enabled": true,
553
+ "__prefab": {
554
+ "__id__": 25
555
+ },
556
+ "_alignFlags": 45,
557
+ "_target": null,
558
+ "_left": 0,
559
+ "_right": 0,
560
+ "_top": 0,
561
+ "_bottom": 0,
562
+ "_horizontalCenter": 0,
563
+ "_verticalCenter": 0,
564
+ "_isAbsLeft": true,
565
+ "_isAbsRight": true,
566
+ "_isAbsTop": true,
567
+ "_isAbsBottom": true,
568
+ "_isAbsHorizontalCenter": true,
569
+ "_isAbsVerticalCenter": true,
570
+ "_originalWidth": 100,
571
+ "_originalHeight": 100,
572
+ "_alignMode": 2,
573
+ "_lockFlags": 0,
574
+ "_id": ""
575
+ },
576
+ {
577
+ "__type__": "cc.CompPrefabInfo",
578
+ "fileId": "1bwHO2bOtHaJFkkqtdxWg6"
579
+ },
580
+ {
581
+ "__type__": "5a96a+aVINBfKGnVbVNbpVi",
582
+ "_name": "",
583
+ "_objFlags": 0,
584
+ "__editorExtras__": {},
585
+ "node": {
586
+ "__id__": 1
587
+ },
588
+ "_enabled": true,
589
+ "__prefab": {
590
+ "__id__": 27
591
+ },
592
+ "bundle_name": "video",
593
+ "video_dir": "video_dir",
594
+ "cover_dir": "cover_dir",
595
+ "remote_url": "https://hcy-cdn-domestic.wyx.cn/online/comeback/",
596
+ "_id": ""
597
+ },
598
+ {
599
+ "__type__": "cc.CompPrefabInfo",
600
+ "fileId": "7bvByrjpFFn4qkjParDk9C"
601
+ },
602
+ {
603
+ "__type__": "cc.PrefabInfo",
604
+ "root": {
605
+ "__id__": 1
606
+ },
607
+ "asset": {
608
+ "__id__": 0
609
+ },
610
+ "fileId": "8fZcmqGzRMPJ7W25xdeI5K",
611
+ "instance": null,
612
+ "targetOverrides": null
613
+ }
614
+ ]
@@ -0,0 +1,13 @@
1
+ {
2
+ "ver": "1.1.50",
3
+ "importer": "prefab",
4
+ "imported": true,
5
+ "uuid": "5c337353-2e9b-4dc7-9ccc-e30c4414b554",
6
+ "files": [
7
+ ".json"
8
+ ],
9
+ "subMetas": {},
10
+ "userData": {
11
+ "syncNodeName": "VideoComponent"
12
+ }
13
+ }
@@ -0,0 +1,33 @@
1
+ import { _decorator, Component, Node } from 'cc';
2
+ import { VideoModule } from './VideoModule';
3
+ import { Camera } from 'cc';
4
+ import { director } from 'cc';
5
+ import { Color } from 'cc';
6
+ const { ccclass, property } = _decorator;
7
+ @ccclass('VideoComponent')
8
+ export class VideoComponent extends Component {
9
+ @property({ displayName: '备注:' })
10
+ des: string = '项目设置-宏配置-ENABLE_TRANSPARENT_CANVAS,开启透明画布'
11
+ @property({ displayName: '视频bundle' })
12
+ bundle_name: string = 'resources'
13
+ @property({ displayName: '封面目录' })
14
+ video_dir: string = 'video_dir'
15
+ @property({ displayName: '封面目录' })
16
+ cover_dir: string = 'cover_dir'
17
+ @property({ displayName: '远程地址根目录', tooltip: '视频远程地址全路径示例: https://hcy-cdn-domestic.wyx.cn/online/comeback/xxx.mp4' })
18
+ remote_url: string = 'https://hcy-cdn-domestic.wyx.cn/online/comeback/'
19
+ protected onLoad(): void {
20
+ //const camera = director.getScene().getComponentsInChildren(Camera)[0]
21
+ // camera.clearColor = new Color(0, 0, 0, 0)
22
+ VideoModule.initVideo({
23
+ node: this.node.getChildByPath('video'),
24
+ cover: this.node.getChildByName('cover'),
25
+ bg: this.node.getChildByName('bg'),
26
+ bundle: this.bundle_name,
27
+ dir: this.video_dir,
28
+ cover_dir: this.cover_dir,
29
+ remote_url: this.remote_url
30
+ })
31
+
32
+ }
33
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "4.0.24",
3
+ "importer": "typescript",
4
+ "imported": true,
5
+ "uuid": "5a96af9a-5483-417c-a1a7-55b54d6e9562",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }