@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,186 @@
|
|
|
1
|
+
const Path = require('path');
|
|
2
|
+
const Fs = require('fs');
|
|
3
|
+
|
|
4
|
+
function capitalize(str) {
|
|
5
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// 生成Layer类模板
|
|
9
|
+
function generateLayerTemplate(bundleName, featureName,subDir) {
|
|
10
|
+
const className = `${capitalize(bundleName)}${capitalize(featureName)}Layer`;
|
|
11
|
+
return `import FWLayer from '${subDir?'../':''}../../../../../framework/layer/FWLayer';
|
|
12
|
+
|
|
13
|
+
const { ccclass, property } = cc._decorator;
|
|
14
|
+
|
|
15
|
+
@ccclass
|
|
16
|
+
export default class ${className} extends FWLayer {
|
|
17
|
+
public onLoad(): void {
|
|
18
|
+
super.onLoad();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public start(): void {
|
|
22
|
+
super.start();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public onEnable(): void {
|
|
26
|
+
super.onEnable();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public onDisable(): void {
|
|
30
|
+
super.onDisable();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public onDestroy(): void {
|
|
34
|
+
super.onDestroy();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 生成LayerController类模板
|
|
41
|
+
function generateControllerTemplate(bundleName, featureName,subDir) {
|
|
42
|
+
const className = `${capitalize(bundleName)}${capitalize(featureName)}LayerController`;
|
|
43
|
+
const layerClassName = `${capitalize(bundleName)}${capitalize(featureName)}Layer`;
|
|
44
|
+
return `import { FWSystemDefine } from '${subDir?'../':''}../../../../../framework/define/FWSystemDefine';
|
|
45
|
+
import { FWLayerController } from '${subDir?'../':''}../../../../../framework/controller/FWLayerController';
|
|
46
|
+
import ${layerClassName} from '../${subDir ? `../`:''}layer/${subDir ? `${subDir}/` : ''}${layerClassName}';
|
|
47
|
+
|
|
48
|
+
export class ${className} extends FWLayerController {
|
|
49
|
+
public renderOrder: number;
|
|
50
|
+
public layer: ${layerClassName};
|
|
51
|
+
public layerType: FWSystemDefine.FWLayerType;
|
|
52
|
+
public get layerAssetProperty(): FW.AssetProperty {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
public get autoRelease(): boolean {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
public get isRepeatOpen(): boolean {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
messages: {
|
|
68
|
+
'create-layer'() {
|
|
69
|
+
Editor.Panel.open('layer-generator');
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
'generate-files'(event, params) {
|
|
73
|
+
try{
|
|
74
|
+
const { bundleName, featureName ,subDir} = params;
|
|
75
|
+
const assetsPath = Path.join(Editor.Project.path, 'assets');
|
|
76
|
+
const bundleRootPath = Path.join(assetsPath, 'bundle');
|
|
77
|
+
// 递归查找bundle
|
|
78
|
+
function findBundlePath(dirPath) {
|
|
79
|
+
const items = Fs.readdirSync(dirPath);
|
|
80
|
+
for (const item of items) {
|
|
81
|
+
const fullPath = Path.join(dirPath, item);
|
|
82
|
+
const stats = Fs.statSync(fullPath);
|
|
83
|
+
|
|
84
|
+
if (stats.isDirectory()) {
|
|
85
|
+
// 检查是否是同名文件夹
|
|
86
|
+
if (Path.basename(fullPath) === bundleName) {
|
|
87
|
+
// 检查是否配置为bundle
|
|
88
|
+
const metaPath = `${fullPath}.meta`;
|
|
89
|
+
if (Fs.existsSync(metaPath)) {
|
|
90
|
+
try {
|
|
91
|
+
const metaContent = Fs.readFileSync(metaPath, 'utf8');
|
|
92
|
+
if (metaContent.includes('"isBundle": true')) {
|
|
93
|
+
return fullPath;
|
|
94
|
+
}
|
|
95
|
+
} catch (err) {
|
|
96
|
+
// 读取meta文件失败,继续搜索
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// 递归搜索子目录
|
|
102
|
+
const foundPath = findBundlePath(fullPath);
|
|
103
|
+
if (foundPath) {
|
|
104
|
+
return foundPath;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const bundlePath = findBundlePath(bundleRootPath);
|
|
112
|
+
|
|
113
|
+
if (!bundlePath) {
|
|
114
|
+
Editor.error(`Cannot find bundle "${bundleName}" or it is not configured as a bundle!`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
const layerDir = Path.join(bundlePath, `script/layer${subDir? `/${subDir}` : ''}`);
|
|
120
|
+
const controllerDir = Path.join(bundlePath, `script/controller${subDir? `/${subDir}` : ''}`);
|
|
121
|
+
const prefabDir = Path.join(bundlePath, `res/prefab/layer${subDir? `/${subDir}` : ''}`);
|
|
122
|
+
// 创建必要的目录
|
|
123
|
+
const dirs = [
|
|
124
|
+
layerDir,
|
|
125
|
+
controllerDir,
|
|
126
|
+
// prefabDir
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
dirs.forEach(dir => {
|
|
130
|
+
if (!Fs.existsSync(dir)) {
|
|
131
|
+
Fs.mkdirSync(dir, { recursive: true });
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// 生成Layer类文件
|
|
136
|
+
const layerPath = Path.join( layerDir, `${capitalize(bundleName)}${capitalize(featureName)}Layer.ts`);
|
|
137
|
+
Fs.writeFileSync(layerPath, generateLayerTemplate(bundleName, featureName,subDir));
|
|
138
|
+
|
|
139
|
+
// 生成Controller类文件
|
|
140
|
+
const controllerPath = Path.join( controllerDir, `${capitalize(bundleName)}${capitalize(featureName)}LayerController.ts`);
|
|
141
|
+
Fs.writeFileSync(controllerPath, generateControllerTemplate(bundleName, featureName,subDir));
|
|
142
|
+
|
|
143
|
+
// 创建预制体路径
|
|
144
|
+
// const prefabPath = Path.join( prefabDir, `${capitalize(bundleName)}${capitalize(featureName)}Layer.prefab`);
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
this.refreshAssetDB(layerDir);
|
|
149
|
+
this.refreshAssetDB(controllerDir);
|
|
150
|
+
}
|
|
151
|
+
catch(err){
|
|
152
|
+
Editor.error("生成Layer失败:",err);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
// // 在场景中创建节点
|
|
157
|
+
// Editor.Scene.callSceneScript('layer-generator', 'create-node', {
|
|
158
|
+
// name: `${capitalize(bundleName)}${capitalize(featureName)}Layer`,
|
|
159
|
+
// prefabPath: prefabPath,
|
|
160
|
+
// scriptName: `${capitalize(bundleName)}${capitalize(featureName)}Layer`
|
|
161
|
+
// }, (err, nodeUuid) => {
|
|
162
|
+
// if (err) {
|
|
163
|
+
// Editor.error('创建Layer失败:', err);
|
|
164
|
+
// return;
|
|
165
|
+
// }
|
|
166
|
+
// Editor.success('Layer files generated successfully!');
|
|
167
|
+
// });
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
refreshAssetDB(outputBase) {
|
|
174
|
+
const relativePath = Path.relative(Editor.Project.path, outputBase);
|
|
175
|
+
|
|
176
|
+
const url = 'db://' + relativePath.replace(/\\/g, '/');
|
|
177
|
+
|
|
178
|
+
Editor.assetdb.refresh(url, (err) => {
|
|
179
|
+
if (err) {
|
|
180
|
+
Editor.error(`刷新资源失败: ${err}`);
|
|
181
|
+
} else {
|
|
182
|
+
Editor.log(`已刷新目录: ${url}`);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "layer-generator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "自动生成Layer相关文件的CocosCreator插件",
|
|
5
|
+
"main": "main.js",
|
|
6
|
+
"author": "ives",
|
|
7
|
+
"editor": "2.4.9",
|
|
8
|
+
"panel": {
|
|
9
|
+
"main": "panel/index.js",
|
|
10
|
+
"type": "dockable",
|
|
11
|
+
"title": "Layer生成器",
|
|
12
|
+
"width": 400,
|
|
13
|
+
"height": 300
|
|
14
|
+
},
|
|
15
|
+
"main-menu": {
|
|
16
|
+
"i18n:MAIN_MENU.package.title/FWLayer生成器/创建Layer": {
|
|
17
|
+
"message": "layer-generator:create-layer"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.layout.vertical {
|
|
2
|
+
padding: 10px;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.layout.horizontal {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 10px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.layout.horizontal.end-justified {
|
|
16
|
+
justify-content: flex-end;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.label {
|
|
20
|
+
width: 80px;
|
|
21
|
+
text-align: left;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
input {
|
|
26
|
+
flex: 1;
|
|
27
|
+
min-width: 150px;
|
|
28
|
+
height: 20px;
|
|
29
|
+
padding: 2px 4px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
button {
|
|
33
|
+
margin-top: 10px;
|
|
34
|
+
padding: 6px 12px;
|
|
35
|
+
min-width: 80px;
|
|
36
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="layout vertical">
|
|
2
|
+
<div class="layout horizontal center">
|
|
3
|
+
<div class="label">bundle名字:</div>
|
|
4
|
+
<input type="text" id="bundleName">
|
|
5
|
+
</div>
|
|
6
|
+
<div class="layout horizontal center">
|
|
7
|
+
<div class="label">模块名字:</div>
|
|
8
|
+
<input type="text" id="featureName">
|
|
9
|
+
</div>
|
|
10
|
+
<div class="layout horizontal center">
|
|
11
|
+
<div class="label">子目录(可选):</div>
|
|
12
|
+
<input type="text" id="subDir">
|
|
13
|
+
</div>
|
|
14
|
+
<div class="layout horizontal center end-justified">
|
|
15
|
+
<button id="generate" class="button">Generate</button>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const Fs = require('fs');
|
|
2
|
+
const Path = require('path');
|
|
3
|
+
|
|
4
|
+
Editor.Panel.extend({
|
|
5
|
+
style: Fs.readFileSync(Path.join(__dirname, 'index.css'), 'utf-8'),
|
|
6
|
+
template: Fs.readFileSync(Path.join(__dirname, 'index.html'), 'utf-8'),
|
|
7
|
+
|
|
8
|
+
ready() {
|
|
9
|
+
this.$btn = this.shadowRoot.querySelector('#generate');
|
|
10
|
+
this.$bundleName = this.shadowRoot.querySelector('#bundleName');
|
|
11
|
+
this.$featureName = this.shadowRoot.querySelector('#featureName');
|
|
12
|
+
this.$subDir = this.shadowRoot.querySelector('#subDir');
|
|
13
|
+
|
|
14
|
+
this.$btn.addEventListener('click', () => {
|
|
15
|
+
const bundleName = this.$bundleName.value.trim();
|
|
16
|
+
const featureName = this.$featureName.value.trim();
|
|
17
|
+
const subDir = this.$subDir.value.trim();
|
|
18
|
+
if (!bundleName || !featureName) {
|
|
19
|
+
Editor.warn('Bundle name and feature name are required!');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
Editor.Ipc.sendToMain('layer-generator:generate-files', {
|
|
23
|
+
bundleName,
|
|
24
|
+
featureName,
|
|
25
|
+
subDir
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Vue.component("cc-mask",{
|
|
3
|
+
template:
|
|
4
|
+
'\n <ui-prop\n v-prop="target.type"\n :multi-values="multi" \n ></ui-prop>\n'+
|
|
5
|
+
' <ui-prop\n v-prop="target.inverted"\n :multi-values="multi" \n ></ui-prop>\n'+
|
|
6
|
+
' <cc-array-prop :target.sync="target.polygon" v-show="isPolygon()"></cc-array-prop>\n' +
|
|
7
|
+
' <ui-prop min="3"\n v-show="isEllipseType()"\n v-prop="target.segements"\n :multi-values="multi" \n ></ui-prop>\n'+
|
|
8
|
+
' <ui-prop\n v-show="isImageStencilType()"\n v-prop="target.alphaThreshold"\n :multi-values="multi" \n ></ui-prop>\n'+
|
|
9
|
+
' <ui-prop\n v-show="isImageStencilType()"\n v-prop="target.spriteFrame"\n :multi-values="multi" \n ></ui-prop>\n'+
|
|
10
|
+
' <div class="horizontal layout end-justified" style="padding:5px 0;margin-bottom:5px;"\n v-show="target.spriteFrame.value.uuid && isImageStencilType()"\n >\n'+
|
|
11
|
+
' <ui-button\n v-on:confirm="onAppImageSizeClick"\n >Resize to Target</ui-button>\n'+
|
|
12
|
+
' <div>\n ',
|
|
13
|
+
props:{
|
|
14
|
+
target:{twoWay:!0,type:Object},
|
|
15
|
+
multi:{type:Boolean}},
|
|
16
|
+
methods:{
|
|
17
|
+
isRectType(){return this.target.type.value===cc.Mask.Type.RECT},
|
|
18
|
+
isEllipseType(){return this.target.type.value===cc.Mask.Type.ELLIPSE},
|
|
19
|
+
isImageStencilType(){return this.target.type.value===cc.Mask.Type.IMAGE_STENCIL},
|
|
20
|
+
isPolygon() {return this.target.type.value===cc.FWMask.Type.POLYGON},
|
|
21
|
+
onAppImageSizeClick(e){
|
|
22
|
+
var t={id:this.target.uuid.value,path:"_resizeToTarget",type:"Boolean",isSubProp:!1,value:!0};
|
|
23
|
+
Editor.Ipc.sendToPanel("scene","scene:set-property",t)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
package/FWMask/main.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// api: https://docs.cocos.com/creator/manual/zh/extension/api/editor-framework/renderer/gizmo.html
|
|
4
|
+
class PointsPolygonGizmo extends Editor.Gizmo {
|
|
5
|
+
init() {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
selectedIdx = -1;
|
|
9
|
+
timeout = -1;
|
|
10
|
+
|
|
11
|
+
onCreateMoveCallbacks() {
|
|
12
|
+
|
|
13
|
+
let start_vertex;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
|
|
17
|
+
start: (x, y, event, i, type) => {
|
|
18
|
+
if(type == "line") {
|
|
19
|
+
let target = this.target;
|
|
20
|
+
let nextPoint = i == target.polygon.length-1 ? target.polygon[0] : target.polygon[i+1];
|
|
21
|
+
let p = cc.v2((target.polygon[i].x + nextPoint.x)/2, (target.polygon[i].y + nextPoint.y)/2);
|
|
22
|
+
target.polygon.splice(i+1, 0, p);
|
|
23
|
+
return ;
|
|
24
|
+
}
|
|
25
|
+
if(this.selectedIdx === i) {
|
|
26
|
+
if(this.target.polygon.length <= 3) return ;
|
|
27
|
+
this.target.polygon.splice(i, 1);
|
|
28
|
+
this.target.polygon = this.target.polygon;
|
|
29
|
+
return ;
|
|
30
|
+
}
|
|
31
|
+
this.selectedIdx = i;
|
|
32
|
+
clearTimeout(this.timeout);
|
|
33
|
+
this.timeout = setTimeout(() => {
|
|
34
|
+
this.selectedIdx = -1;
|
|
35
|
+
}, 500);
|
|
36
|
+
start_vertex = null;
|
|
37
|
+
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
update: (dx, dy, event, i, type) => {
|
|
42
|
+
if(type == "line") return ;
|
|
43
|
+
let target = this.target;
|
|
44
|
+
if (!start_vertex) {
|
|
45
|
+
start_vertex = target.polygon[i].clone();
|
|
46
|
+
}
|
|
47
|
+
let pos = cc.v2(dx, dy);
|
|
48
|
+
pos = this.transformPos(pos, target.node, true);
|
|
49
|
+
target.polygon[i].x = start_vertex.x + pos.x / this._view.scale;
|
|
50
|
+
target.polygon[i].y = start_vertex.y + pos.y / this._view.scale;
|
|
51
|
+
target.polygon = target.polygon;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
end: (updated, event) => {
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
transformPos(pos, node, invert) {
|
|
61
|
+
|
|
62
|
+
let _mat4_temp = cc.mat4();
|
|
63
|
+
let matrixm = node._worldMatrix.m;
|
|
64
|
+
if(invert) {
|
|
65
|
+
cc.Mat4.invert(_mat4_temp, node._worldMatrix)
|
|
66
|
+
matrixm = _mat4_temp.m;
|
|
67
|
+
}
|
|
68
|
+
let a = matrixm[0], b = matrixm[1], c = matrixm[4], d = matrixm[5];
|
|
69
|
+
|
|
70
|
+
let v = cc.v2(pos);
|
|
71
|
+
let x = v.x, y = v.y;
|
|
72
|
+
v.x = x * a + y * c;
|
|
73
|
+
v.y = x * b + y * d;
|
|
74
|
+
return v;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onCreateRoot() {
|
|
78
|
+
|
|
79
|
+
this._tool = this._root.group();
|
|
80
|
+
let target = this.target;
|
|
81
|
+
const circles = [];
|
|
82
|
+
const lines = [];
|
|
83
|
+
this._tool.plot = (points, position) => {
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
this._tool.move(position.x, position.y);
|
|
88
|
+
circles.forEach(v => v.radius(0));
|
|
89
|
+
lines.forEach(v => v.plot(0, 0, 0, 0));
|
|
90
|
+
|
|
91
|
+
for(let i=0; i<points.length; i++) {
|
|
92
|
+
let v = this.transformPos(points[i], target.node);
|
|
93
|
+
v = Editor.GizmosUtils.snapPixelWihVec2(v.mul(this._view.scale));
|
|
94
|
+
let line = lines[i]
|
|
95
|
+
if(!line) {
|
|
96
|
+
line = lines[i] = this._tool.line()
|
|
97
|
+
.stroke({ color: 'rgba(0,80,255,0.8)' });
|
|
98
|
+
|
|
99
|
+
this.registerMoveSvg(line, [i, "line"]);
|
|
100
|
+
}
|
|
101
|
+
let nextPoint = i== points.length-1 ? points[0] : points[i+1];
|
|
102
|
+
|
|
103
|
+
let n = this.transformPos(nextPoint, target.node);
|
|
104
|
+
n = Editor.GizmosUtils.snapPixelWihVec2(n.mul(this._view.scale))
|
|
105
|
+
line.plot(v.x, -v.y, n.x, -n.y).stroke({ width: 4 * this._view.scale });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
for(let i=0; i<points.length; i++) {
|
|
109
|
+
let v = this.transformPos(points[i], target.node);
|
|
110
|
+
v = Editor.GizmosUtils.snapPixelWihVec2(v.mul(this._view.scale));
|
|
111
|
+
|
|
112
|
+
let circle = circles[i];
|
|
113
|
+
if(!circle) {
|
|
114
|
+
circle = circles[i] = this._tool.circle()
|
|
115
|
+
.fill({ color: 'rgba(0,128,255,0.9)' })
|
|
116
|
+
.style('pointer-events', 'fill')
|
|
117
|
+
.style('cursor', 'move');
|
|
118
|
+
this.registerMoveSvg(circle, [i, "circle"], { cursor: 'pointer' });
|
|
119
|
+
}
|
|
120
|
+
circle.center(v.x, -v.y).radius(6 * this._view.scale);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
onUpdate() {
|
|
127
|
+
|
|
128
|
+
let target = this.target;
|
|
129
|
+
|
|
130
|
+
let node = this.node;
|
|
131
|
+
|
|
132
|
+
// // 获取节点世界坐标
|
|
133
|
+
let position = node.convertToWorldSpaceAR(cc.v2(0, 0));
|
|
134
|
+
|
|
135
|
+
position = this.worldToPixel(position);
|
|
136
|
+
|
|
137
|
+
position = Editor.GizmosUtils.snapPixelWihVec2(position);
|
|
138
|
+
|
|
139
|
+
this._tool.plot(target.polygon, position);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
visible () {
|
|
143
|
+
if(this.target.editing !== undefined) return this.target.editing;
|
|
144
|
+
return this.target._type === cc.FWMask.Type.POLYGON;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
module.exports = PointsPolygonGizmo;
|
|
149
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
### 1.2.0.20210527
|
|
2
|
+
|
|
3
|
+
1. 升级压缩引擎 pngquant 至 2.15.1 版本
|
|
4
|
+
2. 代码优化
|
|
5
|
+
3. 设置面板优化
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 1.1.0.20201201
|
|
10
|
+
|
|
11
|
+
1. 添加[排除指定文件夹]和[排除指定文件]功能(配置面板)
|
|
12
|
+
2. 项目结构优化
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 1.0.2.20200807
|
|
17
|
+
|
|
18
|
+
1. 添加[微信小游戏子包]以及[远程资源]的支持
|
|
19
|
+
2. 代码优化
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### 1.0.1.20200802
|
|
24
|
+
|
|
25
|
+
1. 支持 Cocos Creator 2.4.x
|
|
26
|
+
2. 代码优化
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### 1.0.0.20200714
|
|
31
|
+
|
|
32
|
+
1. 首次发布
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 陈皮皮
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# 自动压缩 PNG 资源
|
|
2
|
+
|
|
3
|
+
## 介绍
|
|
4
|
+
|
|
5
|
+
[Cocos Creator 编辑器插件]
|
|
6
|
+
|
|
7
|
+
**项目构建完成之后自动压缩 PNG 资源。**
|
|
8
|
+
|
|
9
|
+
- 压缩引擎:[pngquant 2.15.1](https://pngquant.org/)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## 开源
|
|
14
|
+
|
|
15
|
+
本扩展项目完全开源,仓库地址:[https://gitee.com/ifaswind/ccc-png-auto-compress](https://gitee.com/ifaswind/ccc-png-auto-compress)
|
|
16
|
+
|
|
17
|
+
如果你觉得这个项目还不错,请不要忘记点 [](https://gitee.com/ifaswind/ccc-png-auto-compress/stargazers)!
|
|
18
|
+
|
|
19
|
+
*如有使用上的问题,可以在 Gitee 仓库中提 Issue 或者添加我的微信 `im_chenpipi` 并留言。*
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## 截图
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## 运行环境
|
|
32
|
+
|
|
33
|
+
平台:Windows、macOS
|
|
34
|
+
|
|
35
|
+
引擎:Cocos Creator 2.x
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## 下载 & 安装
|
|
40
|
+
|
|
41
|
+
### 扩展商店安装
|
|
42
|
+
|
|
43
|
+
本扩展已上架 Cocos 商店,点击 Cocos Creator 编辑器顶部菜单栏中的 *扩展 -> 扩展商店* 即可打开扩展商店。
|
|
44
|
+
|
|
45
|
+
在上方搜索栏中输入“**自动压缩 PNG 资源**”并搜索就可以找到本插件,点进去直接安装即可(建议安装到全局)。
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### 自行下载安装
|
|
52
|
+
|
|
53
|
+
在[此处](https://gitee.com/ifaswind/ccc-png-auto-compress/releases)或仓库发行版处下载最新的扩展压缩包。
|
|
54
|
+
|
|
55
|
+
下载完成后将压缩包解压:
|
|
56
|
+
|
|
57
|
+
- Windows:解压到 `C:\Users\${你的用户名}\.CocosCreator\packages\` 目录下
|
|
58
|
+
- macOS:解压到 `~/.CocosCreator/packages/` 目录下
|
|
59
|
+
|
|
60
|
+
以 Windows 为例,扩展的 `main.js` 文件在我的电脑上的完整目录为 `C:\Users\Shaun\.CocosCreator\packages\ccc-png-auto-compress\main.js`。
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## 使用说明
|
|
65
|
+
|
|
66
|
+
**该插件默认禁用,需自行启用!**
|
|
67
|
+
|
|
68
|
+
点击编辑器顶部菜单栏中的 *扩展 -> 自动压缩 PNG 资源 -> 设置* 即可打开扩展的配置面板。
|
|
69
|
+
|
|
70
|
+
配置面板中有以下属性:
|
|
71
|
+
|
|
72
|
+
- 最低质量
|
|
73
|
+
- 最高质量
|
|
74
|
+
- 速度
|
|
75
|
+
- 需要排除的文件夹
|
|
76
|
+
- 需要排除的文件
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### 注意事项
|
|
81
|
+
|
|
82
|
+
💡 如果 Spine Skeleton 或 DragonBones 的纹理在压缩后出现透明度丢失的情况,可以参考以下两种解决方案(二选一):
|
|
83
|
+
|
|
84
|
+
- 自行勾选 Spine Skeleton 或 DragonBones 纹理的 Premultiply Alpha(预乘)属性
|
|
85
|
+
- 在本扩展的配置面板中排除 Spine Skeleton 或 DragonBones 的纹理,不进行压缩
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# 公众号
|
|
94
|
+
|
|
95
|
+
## 菜鸟小栈
|
|
96
|
+
|
|
97
|
+
😺 我是陈皮皮,一个还在不断学习的游戏开发者,一个热爱分享的 Cocos Star Writer。
|
|
98
|
+
|
|
99
|
+
🎨 这是我的个人公众号,专注但不仅限于游戏开发和前端技术分享。
|
|
100
|
+
|
|
101
|
+
💖 每一篇原创都非常用心,你的关注就是我原创的动力!
|
|
102
|
+
|
|
103
|
+
> Input and output.
|
|
104
|
+
|
|
105
|
+

|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## 游戏开发交流群
|
|
110
|
+
|
|
111
|
+
皮皮创建了一个**游戏开发交流群**,供小伙伴们交流开发经验、问题求助和摸鱼(划掉)。
|
|
112
|
+
|
|
113
|
+
感兴趣的小伙伴可以添加我微信 `im_chenpipi` 并留言 `加群`。
|