@ives_xxz/packages 1.0.0
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/AddComponent/main.js +32 -0
- package/AddComponent/package.json +26 -0
- package/AddComponent/panel/index.js +233 -0
- package/AddComponent/readme.md +38 -0
- package/AddComponent/scene-accessor.js +109 -0
- package/AddComponent/template-auto-dock.js +73 -0
- package/BitmapFontTools/i18n/en.js +1 -0
- package/BitmapFontTools/i18n/zh.js +1 -0
- package/BitmapFontTools/main.js +1 -0
- package/BitmapFontTools/package-lock.json +83 -0
- package/BitmapFontTools/package.json +37 -0
- package/BitmapFontTools/panel/font.css +1 -0
- package/BitmapFontTools/panel/font.js +58 -0
- package/BitmapFontTools/panel/font_panel.js +1 -0
- package/BitmapFontTools/panel/ttf.css +1 -0
- package/BitmapFontTools/panel/ttf.js +68 -0
- package/BitmapFontTools/panel/ttf_panel.js +1 -0
- package/FWAssetsFinder/main.js +9 -0
- package/FWAssetsFinder/package.json +20 -0
- package/FWAssetsFinder/panel/index.css +2 -0
- package/FWAssetsFinder/panel/index.html +52 -0
- package/FWAssetsFinder/panel/index.js +265 -0
- package/FWAssetsFinder/panel/less.css +71 -0
- package/FWAssetsFinder/panel/scene.js +194 -0
- package/FWExcelGenerator/main.js +367 -0
- package/FWExcelGenerator/package-lock.json +109 -0
- package/FWExcelGenerator/package.json +23 -0
- package/FWExcelGenerator/panel/index.js +648 -0
- package/FWLayerGenerator/main.js +186 -0
- package/FWLayerGenerator/package.json +21 -0
- package/FWLayerGenerator/panel/index.css +36 -0
- package/FWLayerGenerator/panel/index.html +17 -0
- package/FWLayerGenerator/panel/index.js +29 -0
- package/FWMask/inspector.js +26 -0
- package/FWMask/main.js +16 -0
- package/FWMask/package.json +6 -0
- package/FWPolygonPoints/main.js +149 -0
- package/FWPolygonPoints/package.json +9 -0
- package/PNG Auto Compress/CHANGELOG.md +32 -0
- package/PNG Auto Compress/LICENSE +21 -0
- package/PNG Auto Compress/README.md +113 -0
- package/PNG Auto Compress/config-manager.js +72 -0
- package/PNG Auto Compress/i18n/en.js +14 -0
- package/PNG Auto Compress/i18n/zh.js +14 -0
- package/PNG Auto Compress/images/setting.png +0 -0
- package/PNG Auto Compress/jsconfig.json +1 -0
- package/PNG Auto Compress/main.js +377 -0
- package/PNG Auto Compress/package.json +41 -0
- package/PNG Auto Compress/panel.setting/index.css +13 -0
- package/PNG Auto Compress/panel.setting/index.html +51 -0
- package/PNG Auto Compress/panel.setting/index.js +124 -0
- package/PNG Auto Compress/pngquant/macos/COPYRIGHT +687 -0
- package/PNG Auto Compress/pngquant/macos/README.md +78 -0
- package/PNG Auto Compress/pngquant/macos/pngquant +0 -0
- package/PNG Auto Compress/pngquant/macos/pngquant-compat +0 -0
- package/PNG Auto Compress/pngquant/windows/COPYRIGHT +687 -0
- package/PNG Auto Compress/pngquant/windows/Drag PNG here to reduce palette automatically.bat +11 -0
- package/PNG Auto Compress/pngquant/windows/Drag PNG here to reduce palette to 256.bat +10 -0
- package/PNG Auto Compress/pngquant/windows/README.txt +78 -0
- package/PNG Auto Compress/pngquant/windows/pngquant.exe +0 -0
- package/PNG Auto Compress/typings/cocos/editor.d.ts +1053 -0
- package/PNG Auto Compress/utils/file-utils.js +67 -0
- package/Quick Finder/CHANGELOG.md +100 -0
- package/Quick Finder/LICENSE +21 -0
- package/Quick Finder/README.en.md +141 -0
- package/Quick Finder/README.md +149 -0
- package/Quick Finder/i18n/en.js +42 -0
- package/Quick Finder/i18n/zh.js +42 -0
- package/Quick Finder/images/assets/animation-clip.png +0 -0
- package/Quick Finder/images/assets/asset.png +0 -0
- package/Quick Finder/images/assets/atlas.png +0 -0
- package/Quick Finder/images/assets/audio-clip.png +0 -0
- package/Quick Finder/images/assets/auto-atlas.png +0 -0
- package/Quick Finder/images/assets/bitmap-font.png +0 -0
- package/Quick Finder/images/assets/buffer.png +0 -0
- package/Quick Finder/images/assets/coffeescript.png +0 -0
- package/Quick Finder/images/assets/component.png +0 -0
- package/Quick Finder/images/assets/css.png +0 -0
- package/Quick Finder/images/assets/dragonbones-atlas.png +0 -0
- package/Quick Finder/images/assets/folder.png +0 -0
- package/Quick Finder/images/assets/html.png +0 -0
- package/Quick Finder/images/assets/javascript.png +0 -0
- package/Quick Finder/images/assets/json.png +0 -0
- package/Quick Finder/images/assets/label-atlas.png +0 -0
- package/Quick Finder/images/assets/markdown.png +0 -0
- package/Quick Finder/images/assets/material.png +0 -0
- package/Quick Finder/images/assets/mesh.png +0 -0
- package/Quick Finder/images/assets/mount.png +0 -0
- package/Quick Finder/images/assets/node.png +0 -0
- package/Quick Finder/images/assets/particle.png +0 -0
- package/Quick Finder/images/assets/physics-material.png +0 -0
- package/Quick Finder/images/assets/prefab.png +0 -0
- package/Quick Finder/images/assets/raw-asset.png +0 -0
- package/Quick Finder/images/assets/scene.png +0 -0
- package/Quick Finder/images/assets/shader.png +0 -0
- package/Quick Finder/images/assets/skeleton.png +0 -0
- package/Quick Finder/images/assets/spine.png +0 -0
- package/Quick Finder/images/assets/sprite-animation.png +0 -0
- package/Quick Finder/images/assets/sprite-atlas.png +0 -0
- package/Quick Finder/images/assets/sprite-frame.png +0 -0
- package/Quick Finder/images/assets/text.png +0 -0
- package/Quick Finder/images/assets/tiled-map.png +0 -0
- package/Quick Finder/images/assets/ttf-font.png +0 -0
- package/Quick Finder/images/assets/typescript.png +0 -0
- package/Quick Finder/images/search.png +0 -0
- package/Quick Finder/images/settings.png +0 -0
- package/Quick Finder/images/update.png +0 -0
- package/Quick Finder/images/version.png +0 -0
- package/Quick Finder/jsconfig.json +17 -0
- package/Quick Finder/lib/node-fetch.js +1649 -0
- package/Quick Finder/lib/vue.global.prod.js +7 -0
- package/Quick Finder/package.json +45 -0
- package/Quick Finder/src/common/config-manager.js +122 -0
- package/Quick Finder/src/eazax/browser-util.js +61 -0
- package/Quick Finder/src/eazax/color-util.js +37 -0
- package/Quick Finder/src/eazax/css/cocos-class.css +202 -0
- package/Quick Finder/src/eazax/css/cocos-tag.css +197 -0
- package/Quick Finder/src/eazax/css/eazax-colors.css +18 -0
- package/Quick Finder/src/eazax/editor-main-kit.js +53 -0
- package/Quick Finder/src/eazax/editor-main-util.js +112 -0
- package/Quick Finder/src/eazax/editor-renderer-kit.js +26 -0
- package/Quick Finder/src/eazax/file-util.js +158 -0
- package/Quick Finder/src/eazax/i18n.js +36 -0
- package/Quick Finder/src/eazax/main-event.js +81 -0
- package/Quick Finder/src/eazax/package-util.js +47 -0
- package/Quick Finder/src/eazax/renderer-event.js +80 -0
- package/Quick Finder/src/eazax/updater.js +92 -0
- package/Quick Finder/src/eazax/version-util.js +61 -0
- package/Quick Finder/src/eazax/window-util.js +80 -0
- package/Quick Finder/src/main/finder.js +101 -0
- package/Quick Finder/src/main/index.js +155 -0
- package/Quick Finder/src/main/opener.js +95 -0
- package/Quick Finder/src/main/panel-manager.js +159 -0
- package/Quick Finder/src/renderer/search/index.css +222 -0
- package/Quick Finder/src/renderer/search/index.html +46 -0
- package/Quick Finder/src/renderer/search/index.js +348 -0
- package/Quick Finder/src/renderer/settings/index.css +101 -0
- package/Quick Finder/src/renderer/settings/index.html +86 -0
- package/Quick Finder/src/renderer/settings/index.js +219 -0
- package/Quick Finder/typings/cocos/editor.d.ts +1053 -0
- package/Quick Finder/typings/vue.d.ts +1 -0
- package/README.md +93 -0
- package/package.json +12 -0
- package/unpack plist/main.js +253 -0
- package/unpack plist/package.json +13 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/CHANGELOG.md +30 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/LICENSE +21 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/README.en.md +111 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/README.md +115 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/i18n/en.js +55 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/i18n/zh.js +55 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/images/search.png +0 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/images/settings.png +0 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/images/update.png +0 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/images/version.png +0 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/jsconfig.json +17 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/lib/node-fetch.js +1649 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/lib/vue.global.prod.js +7 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/package.json +44 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/common/config-manager.js +104 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/browser-util.js +61 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/color-util.js +37 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/css/cocos-class.css +201 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/css/cocos-tag.css +197 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/css/eazax-colors.css +18 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/editor-main-kit.js +53 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/editor-main-util.js +147 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/editor-renderer-kit.js +26 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/file-util.js +158 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/i18n.js +36 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/main-event.js +81 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/package-util.js +47 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/renderer-event.js +80 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/updater.js +92 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/version-util.js +61 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/eazax/window-util.js +80 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/editor-api.js +90 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/finder.js +248 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/index.js +155 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/object-util.js +70 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/panel-manager.js +86 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/parser.js +161 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/main/printer.js +108 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/renderer/settings/index.css +61 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/renderer/settings/index.html +90 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/renderer/settings/index.js +191 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/typings/cocos/editor.d.ts +1053 -0
- package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/typings/vue.d.ts +1 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const { print } = require("../eazax/editor-main-util");
|
|
2
|
+
const FileUtil = require("../eazax/file-util");
|
|
3
|
+
const { containsProperty } = require("./object-util");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 解析器
|
|
7
|
+
*/
|
|
8
|
+
const Parser = {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 节点树缓存
|
|
12
|
+
* @type {{ [key: string]: object }}
|
|
13
|
+
*/
|
|
14
|
+
caches: Object.create(null),
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 获取节点树
|
|
18
|
+
* @param {string} path 路径
|
|
19
|
+
* @returns {Promise<object>}
|
|
20
|
+
*/
|
|
21
|
+
async getNodeTree(path) {
|
|
22
|
+
if (!Parser.caches[path]) {
|
|
23
|
+
const file = await FileUtil.readFile(path);
|
|
24
|
+
let data = null;
|
|
25
|
+
try {
|
|
26
|
+
data = JSON.parse(file);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
print('warn', '文件解析失败', path);
|
|
29
|
+
print('warn', error);
|
|
30
|
+
}
|
|
31
|
+
if (!data) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
Parser.caches[path] = Parser.convert(data);
|
|
35
|
+
}
|
|
36
|
+
return Parser.caches[path];
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 更新缓存
|
|
41
|
+
* @param {string} path 路径
|
|
42
|
+
*/
|
|
43
|
+
async updateCache(path) {
|
|
44
|
+
Parser.caches[path] = null;
|
|
45
|
+
await Parser.getNodeTree(path);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 将资源解析为节点树
|
|
50
|
+
* @param {object} source 源数据
|
|
51
|
+
* @returns {object}
|
|
52
|
+
*/
|
|
53
|
+
convert(source) {
|
|
54
|
+
const tree = Object.create(null),
|
|
55
|
+
type = source[0]['__type__'];
|
|
56
|
+
if (type === 'cc.SceneAsset') {
|
|
57
|
+
// 场景资源
|
|
58
|
+
const sceneId = source[0]['scene']['__id__'],
|
|
59
|
+
children = source[sceneId]['_children'];
|
|
60
|
+
tree.type = 'cc.Scene'; // 类型
|
|
61
|
+
tree.id = sceneId; // ID
|
|
62
|
+
// 场景下可以有多个一级节点
|
|
63
|
+
tree.children = [];
|
|
64
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
65
|
+
const nodeId = children[i]['__id__'];
|
|
66
|
+
Parser.convertNode(source, nodeId, tree);
|
|
67
|
+
}
|
|
68
|
+
} else if (type === 'cc.Prefab') {
|
|
69
|
+
// 预制体资源
|
|
70
|
+
const uuid = source[source.length - 1]['asset']['__uuid__'];
|
|
71
|
+
tree.type = 'cc.Prefab'; // 类型
|
|
72
|
+
tree.uuid = uuid; // uuid
|
|
73
|
+
// 预制体本身就是一个节点
|
|
74
|
+
tree.children = [];
|
|
75
|
+
const nodeId = source[0]['data']['__id__'];
|
|
76
|
+
Parser.convertNode(source, nodeId, tree);
|
|
77
|
+
}
|
|
78
|
+
return tree;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 解析节点
|
|
83
|
+
* @param {object} source 源数据
|
|
84
|
+
* @param {number} nodeId 节点 ID
|
|
85
|
+
* @param {object} parent 父节点
|
|
86
|
+
*/
|
|
87
|
+
convertNode(source, nodeId, parent) {
|
|
88
|
+
const srcNode = source[nodeId],
|
|
89
|
+
node = Object.create(null);
|
|
90
|
+
// 基本信息
|
|
91
|
+
node.name = srcNode['_name'];
|
|
92
|
+
node.id = nodeId;
|
|
93
|
+
node.type = srcNode['__type__'];
|
|
94
|
+
|
|
95
|
+
// 路径
|
|
96
|
+
const parentPath = parent.path || null;
|
|
97
|
+
node.path = parentPath ? `${parentPath}/${node.name}` : node.name;
|
|
98
|
+
|
|
99
|
+
// 预制体引用
|
|
100
|
+
const srcPrefab = srcNode['_prefab'];
|
|
101
|
+
if (srcPrefab) {
|
|
102
|
+
const id = srcPrefab['__id__'];
|
|
103
|
+
node.prefab = Parser.extractValidInfo(source[id]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 组件
|
|
107
|
+
node.components = [];
|
|
108
|
+
const srcComponents = srcNode['_components'];
|
|
109
|
+
if (srcComponents && srcComponents.length > 0) {
|
|
110
|
+
for (let i = 0, l = srcComponents.length; i < l; i++) {
|
|
111
|
+
const compId = srcComponents[i]['__id__'],
|
|
112
|
+
component = Parser.extractValidInfo(source[compId]);
|
|
113
|
+
node.components.push(component);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// 子节点
|
|
118
|
+
node.children = [];
|
|
119
|
+
const srcChildren = srcNode['_children'];
|
|
120
|
+
if (srcChildren && srcChildren.length > 0) {
|
|
121
|
+
for (let i = 0, l = srcChildren.length; i < l; i++) {
|
|
122
|
+
const nodeId = srcChildren[i]['__id__'];
|
|
123
|
+
Parser.convertNode(source, nodeId, node);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 保存到父节点
|
|
128
|
+
parent.children.push(node);
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 提取有效信息(含有 uuid)
|
|
133
|
+
* @param {object} source 源数据
|
|
134
|
+
* @returns {{ __type__: string, _name: string, fileId?: string }}
|
|
135
|
+
*/
|
|
136
|
+
extractValidInfo(source) {
|
|
137
|
+
const result = Object.create(null);
|
|
138
|
+
|
|
139
|
+
// 记录有用的属性
|
|
140
|
+
const keys = ['__type__', '_name', 'fileId'];
|
|
141
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
142
|
+
const key = keys[i];
|
|
143
|
+
if (source[key] !== undefined) {
|
|
144
|
+
result[key] = source[key];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 记录包含 uuid 的属性
|
|
149
|
+
for (const key in source) {
|
|
150
|
+
const contains = containsProperty(source[key], '__uuid__');
|
|
151
|
+
if (contains) {
|
|
152
|
+
result[key] = source[key];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return result;
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
module.exports = Parser;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const { translate, print, pureWithoutTitle } = require('../eazax/editor-main-util');
|
|
2
|
+
const ConfigManager = require('../common/config-manager');
|
|
3
|
+
|
|
4
|
+
/** 图标表 */
|
|
5
|
+
const ICON_MAP = {
|
|
6
|
+
'scene': '🔥',
|
|
7
|
+
'prefab': '💠',
|
|
8
|
+
'node': '🎲',
|
|
9
|
+
'component': '🧩',
|
|
10
|
+
'property': '📄',
|
|
11
|
+
'asset': '📦',
|
|
12
|
+
'asset-info': '📋',
|
|
13
|
+
'node-refs': '📙',
|
|
14
|
+
'asset-refs': '📗',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 打印机
|
|
19
|
+
*/
|
|
20
|
+
const Printer = {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 打印结果至控制台
|
|
24
|
+
* @param {object} result
|
|
25
|
+
*/
|
|
26
|
+
printResult(result) {
|
|
27
|
+
if (!result) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const { printDetails, printFolding } = ConfigManager.get();
|
|
31
|
+
// 标志位
|
|
32
|
+
const nodeRefs = [], assetRefs = [];
|
|
33
|
+
let nodeRefsCount = 0, assetRefsCount = 0;
|
|
34
|
+
// 遍历引用信息
|
|
35
|
+
for (let refs = result.refs, i = 0, l = refs.length; i < l; i++) {
|
|
36
|
+
const ref = refs[i],
|
|
37
|
+
type = ref.type,
|
|
38
|
+
url = ref.url.replace('db://', '').replace('.meta', '');
|
|
39
|
+
if (type === 'scene' || type === 'prefab') {
|
|
40
|
+
// 场景或预制体
|
|
41
|
+
nodeRefs.push(` ${ICON_MAP[type]} [${translate(type)}] ${url}`);
|
|
42
|
+
// 节点引用
|
|
43
|
+
for (let details = ref.refs, j = 0, l = details.length; j < l; j++) {
|
|
44
|
+
nodeRefsCount++;
|
|
45
|
+
// 详情
|
|
46
|
+
if (printDetails) {
|
|
47
|
+
const detail = details[j];
|
|
48
|
+
let item = ` ${ICON_MAP['node']} [${translate('node')}] ${detail.node}`;
|
|
49
|
+
if (detail.component) {
|
|
50
|
+
item += ` → ${ICON_MAP['component']} [${translate('component')}] ${detail.component}`;
|
|
51
|
+
}
|
|
52
|
+
if (detail.property) {
|
|
53
|
+
item += ` → ${ICON_MAP['property']} [${translate('property')}] ${detail.property}`;
|
|
54
|
+
}
|
|
55
|
+
nodeRefs.push(item);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
// 资源引用
|
|
60
|
+
assetRefsCount++;
|
|
61
|
+
assetRefs.push(` ${ICON_MAP['asset']} [${translate(type)}] ${url}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// 组装文本
|
|
65
|
+
const texts = [];
|
|
66
|
+
// 分割线
|
|
67
|
+
texts.push(`${'- - '.repeat(36)}`);
|
|
68
|
+
// 基础信息
|
|
69
|
+
texts.push(`${ICON_MAP['asset-info']} ${translate('asset-info')}`);
|
|
70
|
+
texts.push(` - ${translate('asset-type')}${result.type}`);
|
|
71
|
+
texts.push(` - ${translate('asset-uuid')}${result.uuid}`);
|
|
72
|
+
texts.push(` - ${translate('asset-url')}${result.url}`);
|
|
73
|
+
texts.push(` - ${translate('asset-path')}${result.path}`);
|
|
74
|
+
// 分割线
|
|
75
|
+
texts.push(`${'- - '.repeat(36)}`);
|
|
76
|
+
// 节点引用
|
|
77
|
+
if (nodeRefs.length > 0) {
|
|
78
|
+
texts.push(`${ICON_MAP['node-refs']} ${translate('node-refs')} x ${nodeRefsCount}`);
|
|
79
|
+
for (let i = 0, l = nodeRefs.length; i < l; i++) {
|
|
80
|
+
texts.push(nodeRefs[i]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// 资源引用
|
|
84
|
+
if (assetRefs.length > 0) {
|
|
85
|
+
texts.push(`${ICON_MAP['asset-refs']} ${translate('asset-refs')} x ${assetRefsCount}`);
|
|
86
|
+
for (let i = 0, l = assetRefs.length; i < l; i++) {
|
|
87
|
+
texts.push(assetRefs[i]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// 结尾分割线
|
|
91
|
+
texts.push(`${'- - '.repeat(36)}`);
|
|
92
|
+
// 打印到控制台
|
|
93
|
+
if (printFolding) {
|
|
94
|
+
// 单行打印
|
|
95
|
+
texts.unshift(`🗂 ${translate('result')} >>>`);
|
|
96
|
+
print('log', texts.join('\n'));
|
|
97
|
+
} else {
|
|
98
|
+
// 逐行打印
|
|
99
|
+
print('log', translate('result'));
|
|
100
|
+
for (let i = 0, l = texts.length; i < l; i++) {
|
|
101
|
+
pureWithoutTitle(` ${texts[i]}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
module.exports = Printer;
|
package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/renderer/settings/index.css
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0 12px;
|
|
8
|
+
background-color: #454545;
|
|
9
|
+
color: #bdbdbd;
|
|
10
|
+
user-select: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#app {
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* 标题 */
|
|
19
|
+
.title {
|
|
20
|
+
font-size: 20px;
|
|
21
|
+
font-weight: 800;
|
|
22
|
+
padding: 10px 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* 属性容器 */
|
|
26
|
+
.properties {
|
|
27
|
+
overflow: visible;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* 应用按钮 */
|
|
31
|
+
.apply-btn {
|
|
32
|
+
min-width: 20px;
|
|
33
|
+
height: 33px;
|
|
34
|
+
background-image: linear-gradient(#4281b6, #4281b6);
|
|
35
|
+
border: 1px solid #171717;
|
|
36
|
+
border-radius: 3px;
|
|
37
|
+
color: #fff;
|
|
38
|
+
font-size: 16px;
|
|
39
|
+
font-weight: 800;
|
|
40
|
+
text-align: center;
|
|
41
|
+
outline: none;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.apply-btn:hover {
|
|
47
|
+
background-image: none;
|
|
48
|
+
background-color: #4c87b6;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.apply-btn:active {
|
|
52
|
+
background-image: none;
|
|
53
|
+
background-color: #2e6da2;
|
|
54
|
+
border-color: #fd942b;
|
|
55
|
+
color: #cdcdcd;
|
|
56
|
+
box-shadow: 1px 1px 10px #262626 inset;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[v-cloak] {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<!-- 样式 -->
|
|
7
|
+
<link rel="stylesheet" type="text/css" href="../../eazax/css/cocos-tag.css">
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="../../eazax/css/cocos-class.css">
|
|
9
|
+
<link rel="stylesheet" type="text/css" href="index.css">
|
|
10
|
+
<!-- 脚本 -->
|
|
11
|
+
<script type="text/javascript" src="../../../lib/vue.global.prod.js" defer></script>
|
|
12
|
+
<script type="text/javascript" src="index.js" defer></script>
|
|
13
|
+
</head>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
<div id="app" v-cloak>
|
|
17
|
+
<!-- 标题 -->
|
|
18
|
+
<div class="title">{{ t('settings') }}</div>
|
|
19
|
+
<!-- 配置 -->
|
|
20
|
+
<div class="properties">
|
|
21
|
+
<!-- 选择快捷键 -->
|
|
22
|
+
<div class="property">
|
|
23
|
+
<div class="label">
|
|
24
|
+
<span class="text">{{ t('select-key') }}</span>
|
|
25
|
+
<span class="tooltip">{{ t('select-key-tooltip') }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="content">
|
|
28
|
+
<select v-model="selectKey">
|
|
29
|
+
<option v-for="item in presets" :key="item.key" :value="item.key">{{ item.name }}</option>
|
|
30
|
+
</select>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<!-- 自定义快捷键 -->
|
|
34
|
+
<div class="property">
|
|
35
|
+
<div class="label">
|
|
36
|
+
<span class="text">{{ t('custom-key') }}</span>
|
|
37
|
+
<span class="tooltip">{{ t('custom-key-tooltip') }}</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="content">
|
|
40
|
+
<input v-model="customKey" :placeholder="t('custom-key-placeholder')" />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<!-- 展示详情 -->
|
|
44
|
+
<div class="property">
|
|
45
|
+
<div class="label">
|
|
46
|
+
<span class="text">{{ t('print-details') }}</span>
|
|
47
|
+
<span class="tooltip">{{ t('print-details-tooltip') }}</span>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="content">
|
|
50
|
+
<input type="checkbox" v-model="printDetails" />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<!-- 折叠结果 -->
|
|
54
|
+
<div class="property">
|
|
55
|
+
<div class="label">
|
|
56
|
+
<span class="text">{{ t('print-folding') }}</span>
|
|
57
|
+
<span class="tooltip">{{ t('print-folding-tooltip') }}</span>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="content">
|
|
60
|
+
<input type="checkbox" v-model="printFolding" />
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<!-- 自动检查更新 -->
|
|
64
|
+
<div class="property">
|
|
65
|
+
<div class="label">
|
|
66
|
+
<span class="text">{{ t('auto-check-update') }}</span>
|
|
67
|
+
<span class="tooltip">{{ t('auto-check-update-tooltip') }}</span>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="content">
|
|
70
|
+
<input type="checkbox" v-model="autoCheckUpdate" />
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- 快捷键参考 -->
|
|
74
|
+
<div class="tip">
|
|
75
|
+
<span>{{ t('reference') }}</span>
|
|
76
|
+
<a href="https://www.electronjs.org/docs/api/accelerator" target="_blank">{{ t('accelerator') }}</a>
|
|
77
|
+
</div>
|
|
78
|
+
<!-- Git 仓库 -->
|
|
79
|
+
<div class="tip">
|
|
80
|
+
<span>{{ t('repository') }}</span>
|
|
81
|
+
<a :href="repositoryUrl" target="_blank">{{ packageName }}</a>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="line"></div>
|
|
84
|
+
<!-- 应用按钮 -->
|
|
85
|
+
<button class="apply-btn" @click="onApplyBtnClick">{{ t('apply') }}</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</body>
|
|
89
|
+
|
|
90
|
+
</html>
|
package//345/274/225/347/224/250/346/237/245/346/211/276/345/231/250/src/renderer/settings/index.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const { shell } = require('electron');
|
|
2
|
+
const { getUrlParam } = require('../../eazax/browser-util');
|
|
3
|
+
const I18n = require('../../eazax/i18n');
|
|
4
|
+
const RendererEvent = require('../../eazax/renderer-event');
|
|
5
|
+
const PackageUtil = require('../../eazax/package-util');
|
|
6
|
+
const EditorRendererKit = require('../../eazax/editor-renderer-kit');
|
|
7
|
+
const ConfigManager = require('../../common/config-manager');
|
|
8
|
+
|
|
9
|
+
// 导入 Vue 工具函数
|
|
10
|
+
const { ref, watch, onMounted, onBeforeUnmount, createApp } = Vue;
|
|
11
|
+
|
|
12
|
+
/** 当前语言 */
|
|
13
|
+
const LANG = getUrlParam('lang');
|
|
14
|
+
|
|
15
|
+
// 构建 Vue 应用
|
|
16
|
+
const App = {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 设置
|
|
20
|
+
* @param {*} props
|
|
21
|
+
* @param {*} context
|
|
22
|
+
*/
|
|
23
|
+
setup(props, context) {
|
|
24
|
+
|
|
25
|
+
// 预设快捷键
|
|
26
|
+
const presets = ref([
|
|
27
|
+
{ key: '', name: t('none') },
|
|
28
|
+
{ key: 'custom', name: t('custom-key') },
|
|
29
|
+
{ key: 'F1', name: 'F1' },
|
|
30
|
+
{ key: 'F3', name: 'F3' },
|
|
31
|
+
{ key: 'F4', name: 'F4' },
|
|
32
|
+
{ key: 'F5', name: 'F5' },
|
|
33
|
+
{ key: 'F6', name: 'F6' },
|
|
34
|
+
{ key: 'CmdOrCtrl+F', name: 'Cmd/Ctrl + F' },
|
|
35
|
+
{ key: 'CmdOrCtrl+B', name: 'Cmd/Ctrl + B' },
|
|
36
|
+
{ key: 'CmdOrCtrl+Shift+F', name: 'Cmd/Ctrl + Shift + F' },
|
|
37
|
+
]);
|
|
38
|
+
// 选择
|
|
39
|
+
const selectKey = ref('');
|
|
40
|
+
// 自定义
|
|
41
|
+
const customKey = ref('');
|
|
42
|
+
// 打印详情
|
|
43
|
+
const printDetails = ref(true);
|
|
44
|
+
// 单行打印
|
|
45
|
+
const printFolding = ref(true);
|
|
46
|
+
// 自动检查更新
|
|
47
|
+
const autoCheckUpdate = ref(false);
|
|
48
|
+
|
|
49
|
+
// 仓库地址
|
|
50
|
+
const repositoryUrl = PackageUtil.repository;
|
|
51
|
+
// 包名
|
|
52
|
+
const packageName = PackageUtil.name;
|
|
53
|
+
|
|
54
|
+
// 监听选择快捷键
|
|
55
|
+
watch(selectKey, (value) => {
|
|
56
|
+
if (value !== 'custom') {
|
|
57
|
+
customKey.value = '';
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// 监听自定义
|
|
62
|
+
watch(customKey, (value) => {
|
|
63
|
+
if (value !== '' && selectKey.value !== 'custom') {
|
|
64
|
+
selectKey.value = 'custom';
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 获取配置
|
|
70
|
+
*/
|
|
71
|
+
function getConfig() {
|
|
72
|
+
const config = ConfigManager.get();
|
|
73
|
+
if (!config) return;
|
|
74
|
+
// 配置
|
|
75
|
+
printDetails.value = config.printDetails;
|
|
76
|
+
printFolding.value = config.printFolding;
|
|
77
|
+
autoCheckUpdate.value = config.autoCheckUpdate;
|
|
78
|
+
// 快捷键
|
|
79
|
+
const hotkey = config.hotkey;
|
|
80
|
+
if (!hotkey || hotkey === '') {
|
|
81
|
+
selectKey.value = '';
|
|
82
|
+
customKey.value = '';
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// 预设快捷键
|
|
86
|
+
for (let i = 0, l = presets.value.length; i < l; i++) {
|
|
87
|
+
if (presets.value[i].key === hotkey) {
|
|
88
|
+
selectKey.value = hotkey;
|
|
89
|
+
customKey.value = '';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// 自定义快捷键
|
|
94
|
+
selectKey.value = 'custom';
|
|
95
|
+
customKey.value = hotkey;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 保存配置
|
|
100
|
+
*/
|
|
101
|
+
function setConfig() {
|
|
102
|
+
const config = {
|
|
103
|
+
hotkey: null,
|
|
104
|
+
printDetails: printDetails.value,
|
|
105
|
+
printFolding: printFolding.value,
|
|
106
|
+
autoCheckUpdate: autoCheckUpdate.value,
|
|
107
|
+
};
|
|
108
|
+
if (selectKey.value === 'custom') {
|
|
109
|
+
// 自定义输入是否有效
|
|
110
|
+
if (customKey.value === '') {
|
|
111
|
+
EditorRendererKit.print('warn', t('custom-key-error'));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// 不可以使用双引号(避免 json 值中出现双引号而解析错误,导致插件加载失败)
|
|
115
|
+
if (customKey.value.includes('"')) {
|
|
116
|
+
customKey.value = customKey.value.replace(/\"/g, '');
|
|
117
|
+
EditorRendererKit.print('warn', t('quote-error'));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
config.hotkey = customKey.value;
|
|
121
|
+
} else {
|
|
122
|
+
config.hotkey = selectKey.value;
|
|
123
|
+
}
|
|
124
|
+
// 保存到本地
|
|
125
|
+
ConfigManager.set(config);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 应用按钮点击回调
|
|
130
|
+
* @param {*} event
|
|
131
|
+
*/
|
|
132
|
+
function onApplyBtnClick(event) {
|
|
133
|
+
// 保存配置
|
|
134
|
+
setConfig();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 翻译
|
|
139
|
+
* @param {string} key
|
|
140
|
+
*/
|
|
141
|
+
function t(key) {
|
|
142
|
+
return I18n.get(LANG, key);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 生命周期:挂载后
|
|
147
|
+
*/
|
|
148
|
+
onMounted(() => {
|
|
149
|
+
// 获取配置
|
|
150
|
+
getConfig();
|
|
151
|
+
// 覆盖 a 标签点击回调(使用默认浏览器打开网页)
|
|
152
|
+
const links = document.querySelectorAll('a[href]');
|
|
153
|
+
links.forEach((link) => {
|
|
154
|
+
link.addEventListener('click', (event) => {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
const url = link.getAttribute('href');
|
|
157
|
+
shell.openExternal(url);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
// (主进程)检查更新
|
|
161
|
+
RendererEvent.send('check-update', false);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 生命周期:卸载前
|
|
166
|
+
*/
|
|
167
|
+
onBeforeUnmount(() => {
|
|
168
|
+
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
presets,
|
|
173
|
+
selectKey,
|
|
174
|
+
customKey,
|
|
175
|
+
printDetails,
|
|
176
|
+
printFolding,
|
|
177
|
+
autoCheckUpdate,
|
|
178
|
+
repositoryUrl,
|
|
179
|
+
packageName,
|
|
180
|
+
onApplyBtnClick,
|
|
181
|
+
t,
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// 创建实例
|
|
189
|
+
const app = createApp(App);
|
|
190
|
+
// 挂载
|
|
191
|
+
app.mount('#app');
|