@cc-component/cc-ex-component 1.1.5 → 1.1.7
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/assets/core/BaseReference.ts +40 -0
- package/assets/{video/Interface.ts.meta → core/BaseReference.ts.meta} +1 -1
- package/assets/core/BaseViewModelData.ts +12 -0
- package/assets/{video/VideoComponent.ts.meta → core/BaseViewModelData.ts.meta} +1 -1
- package/assets/core/ReferenceComponent.ts +317 -0
- package/assets/core/ViewModel.ts +542 -0
- package/assets/core/ViewModel.ts.meta +9 -0
- package/assets/ex/EXButton.ts +191 -0
- package/assets/ex/EXButton.ts.meta +9 -0
- package/assets/ex/{BaseEx.ts → ExCommon.ts} +6 -4
- package/assets/ex/ExTool.ts +116 -0
- package/assets/ex/ExTool.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/custom-grid-flow-layout.ts +105 -0
- package/assets/{video/IVideo.ts.meta → lib/collectView/lib-ext/custom-grid-flow-layout.ts.meta} +1 -1
- package/assets/lib/collectView/lib-ext/horizontal-center-layout.ts +84 -0
- package/assets/lib/collectView/lib-ext/horizontal-center-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/yx-card-page-layout.ts +132 -0
- package/assets/lib/collectView/lib-ext/yx-card-page-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/yx-carousel-layout.ts +156 -0
- package/assets/lib/collectView/lib-ext/yx-carousel-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/yx-cover-layout.ts +405 -0
- package/assets/lib/collectView/lib-ext/yx-cover-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/yx-masonry-flow-layout.ts +194 -0
- package/assets/lib/collectView/lib-ext/yx-masonry-flow-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/yx-page-view.ts +232 -0
- package/assets/lib/collectView/lib-ext/yx-page-view.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext/yx-table-view.ts +159 -0
- package/assets/lib/collectView/lib-ext/yx-table-view.ts.meta +9 -0
- package/assets/lib/collectView/lib-ext.meta +9 -0
- package/assets/lib/collectView/lib_collect/yx-collection-view.ts +1549 -0
- package/assets/lib/collectView/lib_collect/yx-collection-view.ts.meta +9 -0
- package/assets/lib/collectView/lib_collect/yx-compact-flow-layout.ts +364 -0
- package/assets/lib/collectView/lib_collect/yx-compact-flow-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib_collect/yx-flow-layout.ts +909 -0
- package/assets/lib/collectView/lib_collect/yx-flow-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib_collect/yx-table-layout.ts +352 -0
- package/assets/lib/collectView/lib_collect/yx-table-layout.ts.meta +9 -0
- package/assets/lib/collectView/lib_collect.meta +9 -0
- package/assets/{video/list.meta → lib/collectView.meta} +9 -9
- package/assets/lib/tableView/IListView.ts +17 -0
- package/assets/lib/tableView/IListView.ts.meta +9 -0
- package/assets/lib/tableView/ListView.ts +197 -0
- package/assets/lib/tableView/ListView.ts.meta +9 -0
- package/assets/lib/tableView/ListViewPage.ts +1048 -0
- package/assets/lib/tableView/ListViewPage.ts.meta +9 -0
- package/assets/lib/tableView/ListViewPageLoop.ts +922 -0
- package/assets/lib/tableView/ListViewPageLoop.ts.meta +1 -0
- package/assets/lib/tableView/TableView.ts +82 -0
- package/assets/lib/tableView/TableView.ts.meta +9 -0
- package/assets/lib/tableView.meta +9 -0
- package/assets/{video.meta → lib.meta} +1 -1
- package/assets/platform/Interface.ts +15 -10
- package/assets/platform/android/AndroidModule.ts +12 -0
- package/assets/platform/android/AndroidModule.ts.meta +9 -0
- package/assets/platform/android/AndroidSDK.ts +12 -2
- package/assets/platform/base/EditorSDK.ts +12 -11
- package/assets/platform/base/PlatfprmModule.ts +44 -29
- package/assets/platform/base/SDKBase.ts +3 -3
- package/assets/platform/base/TTSDK.ts +22 -11
- package/assets/platform/base/WXSDK.ts +16 -17
- package/assets/platform/wx/MiniSDK.ts +41 -3
- package/assets/platform/wx/wxmini.d.ts +2 -2
- package/index.ts +1 -3
- package/package.json +1 -1
- package/assets/core/ReferenceCollector.ts +0 -172
- package/assets/video/IVideo.ts +0 -73
- package/assets/video/Interface.ts +0 -25
- package/assets/video/VideoComponent.prefab +0 -614
- package/assets/video/VideoComponent.prefab.meta +0 -13
- package/assets/video/VideoComponent.ts +0 -33
- package/assets/video/VideoManager.ts +0 -399
- package/assets/video/VideoManager.ts.meta +0 -9
- package/assets/video/VideoModule.ts +0 -137
- package/assets/video/VideoModule.ts.meta +0 -9
- package/assets/video/VideoPlayTT.ts +0 -338
- package/assets/video/VideoPlayTT.ts.meta +0 -9
- package/assets/video/VideoPlayWX.ts +0 -274
- package/assets/video/VideoPlayWX.ts.meta +0 -9
- package/assets/video/VideoPlayWeb.ts +0 -228
- package/assets/video/VideoPlayWeb.ts.meta +0 -9
- /package/assets/core/{ReferenceCollector.ts.meta → ReferenceComponent.ts.meta} +0 -0
- /package/assets/ex/{BaseEx.ts.meta → ExCommon.ts.meta} +0 -0
|
@@ -521,11 +521,11 @@ declare namespace wx {
|
|
|
521
521
|
/** 监听激励视频错误事件*/
|
|
522
522
|
onError(callback: (res: { errMsg: string, errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 }) => void): void;
|
|
523
523
|
/** 取消监听激励视频错误事件*/
|
|
524
|
-
offError(callback: () => void): void;
|
|
524
|
+
offError(callback: (res) => void): void;
|
|
525
525
|
/** 监听用户点击 关闭广告 按钮的事件*/
|
|
526
526
|
onClose(callback: (res: { isEnded: boolean }) => void);
|
|
527
527
|
/** 取消监听用户点击 关闭广告 按钮的事件*/
|
|
528
|
-
offClose(callback: () => void);
|
|
528
|
+
offClose(callback: (res) => void);
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
/**
|
package/index.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// 负责导出assets下的模块,如: export { default } from './assets/xxx.ts'
|
|
2
|
-
export { } from './assets/ex/
|
|
2
|
+
export { } from './assets/ex/ExCommon';
|
|
3
3
|
export { } from './assets/video/Interface';
|
|
4
|
-
export { ReferenceCollector } from './assets/core/ReferenceCollector';
|
|
5
|
-
|
|
6
4
|
export { } from './assets/platform/Interface';
|
|
7
5
|
|
package/package.json
CHANGED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { _decorator, Component, js, Node } from "cc";
|
|
2
|
-
import { EDITOR_NOT_IN_PREVIEW } from "cc/env";
|
|
3
|
-
|
|
4
|
-
const { ccclass, property, executeInEditMode, executionOrder, disallowMultiple } = _decorator;
|
|
5
|
-
|
|
6
|
-
@ccclass("CollectorNodeData")
|
|
7
|
-
class CollectorNodeData {
|
|
8
|
-
@property({ readonly: true })
|
|
9
|
-
public key = "";
|
|
10
|
-
@property({ type: Node, readonly: true })
|
|
11
|
-
public node: Node = null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@ccclass("ReferenceCollector")
|
|
15
|
-
@disallowMultiple
|
|
16
|
-
@executeInEditMode(true)
|
|
17
|
-
@executionOrder(-100)
|
|
18
|
-
export class ReferenceCollector extends Component {
|
|
19
|
-
|
|
20
|
-
@property
|
|
21
|
-
private _refresh = false;
|
|
22
|
-
@property({ displayName: "复制属性" })
|
|
23
|
-
private get refresh() { return this._refresh; }
|
|
24
|
-
private set refresh(val: boolean) {
|
|
25
|
-
if (EDITOR_NOT_IN_PREVIEW) {
|
|
26
|
-
this.initNodeList();
|
|
27
|
-
this.genCode();
|
|
28
|
-
}
|
|
29
|
-
this._refresh = false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@property({ type: CollectorNodeData, readonly: true })
|
|
33
|
-
private _nodes: CollectorNodeData[] = [];
|
|
34
|
-
@property({ type: CollectorNodeData, tooltip: "自动引用节点(名字以$开头的)", readonly: true })
|
|
35
|
-
private get nodes() { return this._nodes; }
|
|
36
|
-
private set nodes(val: CollectorNodeData[]) { this._nodes = val; }
|
|
37
|
-
|
|
38
|
-
private _isInitNodeMap = false;
|
|
39
|
-
private _nodeMap: Map<string, Node> = new Map();
|
|
40
|
-
|
|
41
|
-
protected onLoad(): void {
|
|
42
|
-
if (EDITOR_NOT_IN_PREVIEW) {//处理编辑器逻辑
|
|
43
|
-
this.initNodeList();
|
|
44
|
-
} else {//处理运行时逻辑
|
|
45
|
-
this.initNodeMap();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private initNodeMap() {
|
|
50
|
-
if (this._isInitNodeMap) return;
|
|
51
|
-
this._isInitNodeMap = true;
|
|
52
|
-
this._nodeMap.clear();
|
|
53
|
-
for (const collectorNodeData of this.nodes) {
|
|
54
|
-
let key = collectorNodeData.key.trim();
|
|
55
|
-
if (!this._nodeMap.has(key)) {
|
|
56
|
-
this._nodeMap.set(key, collectorNodeData.node);
|
|
57
|
-
} else {
|
|
58
|
-
console.error("[MLogger Error]", this.node.name, "引用的节点名字重复 Key=" + key);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public getNode(key: string) {
|
|
64
|
-
if (this._nodeMap.size == 0) this.initNodeMap();
|
|
65
|
-
return this._nodeMap.get(key);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public get(key: string, type: typeof Node): Node;
|
|
69
|
-
public get<T extends Component>(key: string, type: new (...args: any[]) => T): T;
|
|
70
|
-
public get(key: string, type: any): any {
|
|
71
|
-
if (this._nodeMap.size == 0) this.initNodeMap();
|
|
72
|
-
let node = this._nodeMap.get(key);
|
|
73
|
-
if (node?.isValid) {
|
|
74
|
-
if (type as any === Node) {
|
|
75
|
-
return node;
|
|
76
|
-
} else {
|
|
77
|
-
return node.getComponent(type);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
//#region 编辑器逻辑
|
|
84
|
-
|
|
85
|
-
/** 收集名字以$开头的节点 */
|
|
86
|
-
private _tag = "$";
|
|
87
|
-
|
|
88
|
-
private initNodeList() {
|
|
89
|
-
if (!EDITOR_NOT_IN_PREVIEW) return;
|
|
90
|
-
this.nodes.length = 0;
|
|
91
|
-
let nodes = this.getValidNode(this.node);
|
|
92
|
-
for (const node of nodes) {
|
|
93
|
-
let refData = new CollectorNodeData();
|
|
94
|
-
let name = node.name.replace(this._tag, "").trim();
|
|
95
|
-
refData.key = name;
|
|
96
|
-
refData.node = node;
|
|
97
|
-
this.nodes.push(refData);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/** 获取符合需求的节点 */
|
|
103
|
-
private getValidNode(root: Node) {
|
|
104
|
-
if (!EDITOR_NOT_IN_PREVIEW) return;
|
|
105
|
-
let arr: Node[] = [];
|
|
106
|
-
let checkArr: Node[] = [];
|
|
107
|
-
checkArr.push(root);
|
|
108
|
-
while (checkArr.length > 0) {
|
|
109
|
-
let v = checkArr.shift();
|
|
110
|
-
let rc = v.getComponent(ReferenceCollector);
|
|
111
|
-
if (rc && rc != this) continue;
|
|
112
|
-
arr.push(...v.children.filter(v => this.isNodeValid(v)));
|
|
113
|
-
checkArr.push(...v.children);
|
|
114
|
-
}
|
|
115
|
-
return arr;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
private isNodeValid(node: Node) {
|
|
119
|
-
if (!EDITOR_NOT_IN_PREVIEW) return;
|
|
120
|
-
if (node.name.startsWith(this._tag)) return true;
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/** 生成引用节点的获取代码 并复制到剪切板 */
|
|
125
|
-
private genCode() {
|
|
126
|
-
if (!EDITOR_NOT_IN_PREVIEW) return;
|
|
127
|
-
let text = "";
|
|
128
|
-
//生成get属性
|
|
129
|
-
this.nodes.forEach(data => {
|
|
130
|
-
let key = data.key;
|
|
131
|
-
if (text) text += "\n";
|
|
132
|
-
let name = key[0].toLowerCase() + key.substring(1);
|
|
133
|
-
let line = `private get ${name}() { return this.rc.get("${key}", ${this.getPropertyType(data.node)}); }`;
|
|
134
|
-
text += line;
|
|
135
|
-
});
|
|
136
|
-
Editor.Clipboard.write("text", text);
|
|
137
|
-
console.log("已复制到剪切板");
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** 获取属性类型名字 */
|
|
141
|
-
private getPropertyType(node: Node) {
|
|
142
|
-
if (!EDITOR_NOT_IN_PREVIEW) return;
|
|
143
|
-
|
|
144
|
-
//自定义脚本
|
|
145
|
-
let comp = node.getComponent('MComponent');
|
|
146
|
-
if (comp) return js.getClassName(comp);
|
|
147
|
-
//自定义组件
|
|
148
|
-
if (node.getComponent("Switch")) return "Switch";
|
|
149
|
-
if (node.getComponent("MSlider")) return "MSlider";
|
|
150
|
-
if (node.getComponent("MToggle")) return "MToggle";
|
|
151
|
-
if (node.getComponent("MButton")) return "MButton";
|
|
152
|
-
if (node.getComponent("Dropdown")) return "Dropdown";
|
|
153
|
-
//UI组件
|
|
154
|
-
if (node.getComponent("cc.EditBox")) return "EditBox";
|
|
155
|
-
if (node.getComponent("cc.Toggle")) return "Toggle";
|
|
156
|
-
if (node.getComponent("cc.Slider")) return "Slider";
|
|
157
|
-
if (node.getComponent("cc.Button")) return "Button";
|
|
158
|
-
if (node.getComponent("cc.ProgressBar")) return "ProgressBar";
|
|
159
|
-
if (node.getComponent("cc.ScrollView")) return "ScrollView";
|
|
160
|
-
if (node.getComponent("cc.PageView")) return "PageView";
|
|
161
|
-
if (node.getComponent("cc.Animation")) return "Animation";
|
|
162
|
-
//渲染组件
|
|
163
|
-
if (node.getComponent("cc.Sprite")) return "Sprite";
|
|
164
|
-
if (node.getComponent("cc.Label")) return "Label";
|
|
165
|
-
if (node.getComponent("cc.RichText")) return "RichText";
|
|
166
|
-
if (node.getComponent("cc.ParticleSystem2D")) return "ParticleSystem2D";
|
|
167
|
-
if (node.getComponent("sp.Skeleton")) return "sp.Skeleton";
|
|
168
|
-
|
|
169
|
-
return "Node";
|
|
170
|
-
}
|
|
171
|
-
//#endregion
|
|
172
|
-
}
|
package/assets/video/IVideo.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Component, Node } from "cc";
|
|
2
|
-
|
|
3
|
-
export interface InitParam {
|
|
4
|
-
node: Node,
|
|
5
|
-
cover: Node,
|
|
6
|
-
bg: Node,
|
|
7
|
-
bundle: string,
|
|
8
|
-
dir: string,
|
|
9
|
-
cover_dir: string,
|
|
10
|
-
remote_url: string,
|
|
11
|
-
proCall?: (pro: number) => void
|
|
12
|
-
}
|
|
13
|
-
export interface IVideoData {
|
|
14
|
-
/**视频文件名称 */
|
|
15
|
-
name: string,
|
|
16
|
-
/**开始时间*/
|
|
17
|
-
start_time?: number,
|
|
18
|
-
/**结束时间 */
|
|
19
|
-
end_time?: number
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface IVideoParam {
|
|
23
|
-
/**本次播放或者加载,是否指定目标大小*/
|
|
24
|
-
isTargetSize?: boolean,
|
|
25
|
-
/**是否是 时间段 视频,备注:多个小视频合成一个大视频 */
|
|
26
|
-
isPlayTime?: boolean,
|
|
27
|
-
/**循环播放 */
|
|
28
|
-
isLoop?: boolean,
|
|
29
|
-
/**封面图片 */
|
|
30
|
-
coverImage?: string,
|
|
31
|
-
/**全屏并且-保持原比例 */
|
|
32
|
-
isVideoFit?: boolean,
|
|
33
|
-
/**视频封面 */
|
|
34
|
-
onRead?: Function,
|
|
35
|
-
/**播放完成 */
|
|
36
|
-
onFinish?: Function,
|
|
37
|
-
/**可不设置
|
|
38
|
-
* 是本地视频还是远程,
|
|
39
|
-
* 小游戏会设置为:远程视频,
|
|
40
|
-
* 安卓和ios原生端会可不设置,根据url 判断是远程还是本地视频 */
|
|
41
|
-
isLocal?: boolean,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// export interface IVideoParam {
|
|
46
|
-
// isPlayTime?: boolean,
|
|
47
|
-
// isLoop?: boolean,
|
|
48
|
-
// finish?: Function,
|
|
49
|
-
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
export class BaseVideo extends Component {
|
|
53
|
-
initVideo(initParam: { bundle: string, dir: string }) { }
|
|
54
|
-
loadVideo(name: string, param?: IVideoParam) { }
|
|
55
|
-
play(isloop?: boolean) { }
|
|
56
|
-
async pause() { }
|
|
57
|
-
stop() { }
|
|
58
|
-
resume() { }
|
|
59
|
-
seek(time: number) { }
|
|
60
|
-
destroyVideo() { }
|
|
61
|
-
setSize(param: { x: number, y: number, width: number, height: number }) { }
|
|
62
|
-
autoSize() { }
|
|
63
|
-
onTimeUpdate: (data: { position: number, duration: number }) => void;
|
|
64
|
-
onError: Function
|
|
65
|
-
onVideoEnd: Function
|
|
66
|
-
onRead: Function
|
|
67
|
-
getisPause(): boolean {
|
|
68
|
-
return false
|
|
69
|
-
}
|
|
70
|
-
// getDuration(): number;
|
|
71
|
-
// isPlaying: boolean;
|
|
72
|
-
// isLocal:boolean;
|
|
73
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IVideoData, IVideoParam } from "./IVideo";
|
|
2
|
-
declare global {
|
|
3
|
-
namespace VideoModule {
|
|
4
|
-
/**开启日志打印 */
|
|
5
|
-
function Debug(enabled: boolean);
|
|
6
|
-
/**提前加载视频 */
|
|
7
|
-
function LoadVideo(url: string, param: IVideoParam)
|
|
8
|
-
/**播放单个视频 */
|
|
9
|
-
function PlayVideo(video: IVideoData, param: IVideoParam)
|
|
10
|
-
/** 播放多个视频*/
|
|
11
|
-
function PlayVideoMore(video_list: IVideoData[], param: IVideoParam)
|
|
12
|
-
/**暂停 */
|
|
13
|
-
function Pause()
|
|
14
|
-
/**继续 */
|
|
15
|
-
function Resume()
|
|
16
|
-
/**停止视频 */
|
|
17
|
-
function StopVideoTask()
|
|
18
|
-
/**视频设置到指定大小 */
|
|
19
|
-
function SetSize(param: { x: number, y: number, width: number, height: number })
|
|
20
|
-
/**节点位置适配-自动适配 */
|
|
21
|
-
function AutoSize()
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
// // 必须在 game.init() 之前设置!
|
|
25
|
-
//macro.ENABLE_TRANSPARENT_CANVAS = true;
|