Commit f6f03468 authored by 邱旭's avatar 邱旭

换了点皮

parent 0d01fd3d
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="0d3cb18d-e144-41a0-bc8b-4877c2e1fef1" name="默认的" comment="换了点皮"> <list default="true" id="0d3cb18d-e144-41a0-bc8b-4877c2e1fef1" name="默认的" comment="换了点皮">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/miniTb/mine.getAppData.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/miniTb/mine.getAppData.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/output.js" beforeDir="false" afterPath="$PROJECT_DIR$/output.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/output.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/output.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/copyJs.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/copyJs.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/textureMerge.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/textureMerge.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ResJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ResJson.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/PlayScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/PlayScene.ts" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -75,7 +83,7 @@ ...@@ -75,7 +83,7 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/lotties" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/scripts" />
<property name="nodejs_package_manager_path" value="npm" /> <property name="nodejs_package_manager_path" value="npm" />
<property name="org.elm.workspace.PROJECT_DISCOVERY" value="true" /> <property name="org.elm.workspace.PROJECT_DISCOVERY" value="true" />
<property name="settings.editor.selected.configurable" value="vcs.Git" /> <property name="settings.editor.selected.configurable" value="vcs.Git" />
...@@ -84,10 +92,10 @@ ...@@ -84,10 +92,10 @@
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/scripts" />
<recent name="$PROJECT_DIR$/lotties" /> <recent name="$PROJECT_DIR$/lotties" />
<recent name="$PROJECT_DIR$/resource/BonusTime" /> <recent name="$PROJECT_DIR$/resource/BonusTime" />
<recent name="$PROJECT_DIR$/src/lotties" /> <recent name="$PROJECT_DIR$/src/lotties" />
<recent name="$PROJECT_DIR$/scripts" />
<recent name="$PROJECT_DIR$/libs" /> <recent name="$PROJECT_DIR$/libs" />
</key> </key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
...@@ -95,7 +103,7 @@ ...@@ -95,7 +103,7 @@
<recent name="$PROJECT_DIR$/lotties" /> <recent name="$PROJECT_DIR$/lotties" />
</key> </key>
</component> </component>
<component name="RunManager" selected="npm.flushRes"> <component name="RunManager" selected="npm.build">
<configuration name="build" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="build" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
...@@ -155,11 +163,11 @@ ...@@ -155,11 +163,11 @@
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="npm.build" />
<item itemvalue="npm.flushRes" /> <item itemvalue="npm.flushRes" />
<item itemvalue="npm.dev" /> <item itemvalue="npm.dev" />
<item itemvalue="npm.handleLotS" /> <item itemvalue="npm.handleLotS" />
<item itemvalue="npm.buildTS" /> <item itemvalue="npm.buildTS" />
<item itemvalue="npm.build" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
...@@ -196,14 +204,7 @@ ...@@ -196,14 +204,7 @@
<workItem from="1617871191619" duration="121000" /> <workItem from="1617871191619" duration="121000" />
<workItem from="1617890665920" duration="181000" /> <workItem from="1617890665920" duration="181000" />
<workItem from="1617960804439" duration="639000" /> <workItem from="1617960804439" duration="639000" />
<workItem from="1618193237335" duration="14585000" /> <workItem from="1618193237335" duration="17390000" />
</task>
<task id="LOCAL-00044" summary="m">
<created>1614051416478</created>
<option name="number" value="00044" />
<option name="presentableId" value="LOCAL-00044" />
<option name="project" value="LOCAL" />
<updated>1614051416478</updated>
</task> </task>
<task id="LOCAL-00045" summary="m"> <task id="LOCAL-00045" summary="m">
<created>1614064323435</created> <created>1614064323435</created>
...@@ -541,7 +542,14 @@ ...@@ -541,7 +542,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1618213267192</updated> <updated>1618213267192</updated>
</task> </task>
<option name="localTasksCounter" value="93" /> <task id="LOCAL-00093" summary="换了点皮">
<created>1618213394771</created>
<option name="number" value="00093" />
<option name="presentableId" value="LOCAL-00093" />
<option name="project" value="LOCAL" />
<updated>1618213394771</updated>
</task>
<option name="localTasksCounter" value="94" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"openId": "openId", "openId": "openId",
"isFirstLogin": true, "isFirstLogin": true,
"loginAddPower": 0, "loginAddPower": 0,
"isNewUser": false, "isNewUser": true,
"inviteId": "", "inviteId": "",
"isFollow": true "isFollow": true
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -15,16 +15,18 @@ ...@@ -15,16 +15,18 @@
"mock-webpack-plugin": "^2.0.0", "mock-webpack-plugin": "^2.0.0",
"path": "^0.12.7", "path": "^0.12.7",
"progress": "^2.0.0", "progress": "^2.0.0",
"psd": "^3.2.0",
"ts-loader": "^4.0.0", "ts-loader": "^4.0.0",
"typescript": "^4.1.3", "typescript": "^4.1.3",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0", "webpack": "^4.1.0",
"webpack-cli": "^3.1.1", "webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.0", "webpack-dev-server": "^3.1.0",
"webpack-merge": "^4.1.2", "webpack-merge": "^4.1.2"
"uglifyjs-webpack-plugin": "^2.1.2", },
"psd": "^3.2.0" "dependencies": {
"pack_textures": "^1.1.5"
}, },
"dependencies": {},
"scripts": { "scripts": {
"psd": "node scripts/psdH.js && node scripts/flushRes", "psd": "node scripts/psdH.js && node scripts/flushRes",
"createModule": "node scripts/createModule", "createModule": "node scripts/createModule",
......
...@@ -6,7 +6,7 @@ var fs = require("fs"); ...@@ -6,7 +6,7 @@ var fs = require("fs");
// fs.readFileSync("./output.js") // fs.readFileSync("./output.js")
// ) // )
// var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/'; // var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/';
var endPath = '/Users/qiuxu/Documents/兑吧/项目/斐乐消消乐/taobao_mini/fila-xxl-front/fila/client/pages/index/'; var endPath = '/Users/qiuxu/Documents/兑吧/项目/斐乐儿童消消乐/taobao_mini/fila-xxl-front/fila/client/pages/index/';
var version = Math.round(new Date().getTime() / 1000); var version = Math.round(new Date().getTime() / 1000);
// fs.writeFileSync(endPath + "output." + version + ".js", fs.readFileSync("./released/output.js")); // fs.writeFileSync(endPath + "output." + version + ".js", fs.readFileSync("./released/output.js"));
fs.writeFileSync(endPath + "output.js", fs.readFileSync("./released/output.js")); fs.writeFileSync(endPath + "output.js", fs.readFileSync("./released/output.js"));
......
...@@ -5,6 +5,8 @@ var iconv = require('iconv-lite'); ...@@ -5,6 +5,8 @@ var iconv = require('iconv-lite');
var del = require('del'); var del = require('del');
const join = require('path').join; const join = require('path').join;
// var packTextures = require("pack_textures")
//写入图集的文件夹 //写入图集的文件夹
var outPath = "./released/resource/"; var outPath = "./released/resource/";
//读取散图的文件夹 //读取散图的文件夹
...@@ -16,11 +18,9 @@ files.forEach(function (file) { ...@@ -16,11 +18,9 @@ files.forEach(function (file) {
let fPath = join(readPath, file); let fPath = join(readPath, file);
//只处理文件夹 //只处理文件夹
if (fs.statSync(fPath).isDirectory()) { if (fs.statSync(fPath).isDirectory()) {
//判断文件夹内是否有图片 //判断文件夹内是否有图片
if (!judgeHasImage(fPath)) return; if (!judgeHasImage(fPath)) return;
var cli = getTmCmd(fPath, outPath + file + "/", file);
//如果文件夹不存在 //如果文件夹不存在
if (!fs.existsSync(outPath + file)) { if (!fs.existsSync(outPath + file)) {
fs.mkdirSync(outPath + file); fs.mkdirSync(outPath + file);
...@@ -35,85 +35,43 @@ files.forEach(function (file) { ...@@ -35,85 +35,43 @@ files.forEach(function (file) {
} }
} }
//执行合图指令 // packTextures(
exec(cli, { encoding: 'utf8' }, function (err, stdout, stderr) { // fPath,
if (err) { // outPath + file + "/" + file,
console.log(err); // 4096,
return; // 4096,
} // false,
// console.log('stdout:' + stdout); // 2,
// console.log('stderr:' + stderr); // 2,
console.log('生成图集:' + file); // true,
// true
var pathname = outPath + file + "/" + file + ".json"; // )
//有中文命名时处理 //全局命令装过,就直接用命令行
var data = iconv.decode(fs.readFileSync(pathname), "utf-8");//GBK,window版本只能GBK,TexturePacker版本问题,mac改成utf-8 exec(
// console.log(data) 'packTextures' + //基础指令
//反序列化 ' -i ' + fPath + //要合图集的文件夹路径
data = JSON.parse(data); //eval(data) ' -o ' + outPath + file + "/" + file + //输出路径及名字
//重写数据 ' --mw ' + 4096 + //最大宽度
var obj = {}; ' --mh ' + 4096 +//最大高度
var frames = data.frames; ' -p ' + false + //长宽是否2的指数,canvas下没必要,false
var frameKeys = Object.keys(frames); ' --sp ' + 2 + //图片间隔
for (var i = 0; i < frameKeys.length; i++) { ' --bp ' + 2 + //边界间隔
const name = frameKeys[i]; ' -r ' + true + //是否允许图片旋转
const data = frames[name]; ' -t ' + true //是否允许裁切图片边缘透明像素
if (!data.frame) continue; , { encoding: 'utf8' }, (e) => {
const sourceSize = data.trimmed !== false && data.sourceSize if (e) {
? data.sourceSize : data.frame; console.log(e)
obj[name] = { return
"x": data.frame.x,
"y": data.frame.y,
"w": data.frame.w,
"h": data.frame.h,
"ox": data.trimmed ? data.spriteSourceSize.x : 0,
"oy": data.trimmed ? data.spriteSourceSize.y : 0,
"sw": sourceSize.w,
"sh": sourceSize.h,
"ro": data.rotated,
} }
console.log("生成图集:" + file)
} }
//序列化,不格式化,节省内存 )
fs.writeFileSync(pathname, JSON.stringify(obj, "", "\t"));
})
} }
}) })
//不同版本参数可能不同,具体情况具体分析
function getTmCmd(src, outPath, name) {
var cli =
'TexturePacker ' + //基础指令
src + //要合图集的文件夹路径
' --format json' + //图集数据格式
' --max-size 4096' + //最大尺寸
' --allow-free-size' +//允许使用最小尺寸输出,webgl最好别设置,现在小程序只有canvas模式,所以用最小尺寸导出吧
' --shape-padding 2' + //图片间隔
' --border-padding 2' + //边界间隔
' --enable-rotation' + //旋转 diable-rotation
' --opt RGBA8888' + //图片像素格式
' --trim' + //裁切透明像素 no-trim
' --sheet ' + outPath + name + '.png' + //图片名字
' --data ' + outPath + name + '.json'; //数据名字
return cli
}
/**
* 对文件使用utf8编码
* @param {string} pathname
*/
function applyUtf8(pathname) {
fs.writeFile(pathname, iconv.decode(fs.readFileSync(pathname), "utf-8"), {
encoding: "UTF8"
}, function (err) {
if (err) {
throw err;
}
});
}
/** /**
* 判断文件夹内是否有图片 * 判断文件夹内是否有图片
* @param {*} path * @param {*} path
*/ */
function judgeHasImage(path) { function judgeHasImage(path) {
var files = fs.readdirSync(path); var files = fs.readdirSync(path);
...@@ -128,4 +86,4 @@ function judgeHasImage(path) { ...@@ -128,4 +86,4 @@ function judgeHasImage(path) {
} }
} }
return false; return false;
} }
\ No newline at end of file
This diff is collapsed.
...@@ -271,7 +271,7 @@ export class PlayScene extends Scene { ...@@ -271,7 +271,7 @@ export class PlayScene extends Scene {
this.musicBtn = this.addChild(new MusicBtn()); this.musicBtn = this.addChild(new MusicBtn());
this.musicBtn.position.set(616, 120); this.musicBtn.position.set(616, 120);
this.addChild(FYGE.Sprite.fromFrame("闪闪.png")).position.set(288, -layers.stageOffsetY + 252); this.addChild(FYGE.Sprite.fromFrame("闪闪.png")).position.set(288, 252);
} }
data: { chapter: number } data: { chapter: number }
start(data: { chapter: number }) { start(data: { chapter: number }) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment