Commit f6f03468 authored by 邱旭's avatar 邱旭

换了点皮

parent 0d01fd3d
......@@ -3,6 +3,14 @@
<component name="ChangeListManager">
<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$/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>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -75,7 +83,7 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<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="org.elm.workspace.PROJECT_DISCOVERY" value="true" />
<property name="settings.editor.selected.configurable" value="vcs.Git" />
......@@ -84,10 +92,10 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/scripts" />
<recent name="$PROJECT_DIR$/lotties" />
<recent name="$PROJECT_DIR$/resource/BonusTime" />
<recent name="$PROJECT_DIR$/src/lotties" />
<recent name="$PROJECT_DIR$/scripts" />
<recent name="$PROJECT_DIR$/libs" />
</key>
<key name="MoveFile.RECENT_KEYS">
......@@ -95,7 +103,7 @@
<recent name="$PROJECT_DIR$/lotties" />
</key>
</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">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
......@@ -155,11 +163,11 @@
</list>
<recent_temporary>
<list>
<item itemvalue="npm.build" />
<item itemvalue="npm.flushRes" />
<item itemvalue="npm.dev" />
<item itemvalue="npm.handleLotS" />
<item itemvalue="npm.buildTS" />
<item itemvalue="npm.build" />
</list>
</recent_temporary>
</component>
......@@ -196,14 +204,7 @@
<workItem from="1617871191619" duration="121000" />
<workItem from="1617890665920" duration="181000" />
<workItem from="1617960804439" duration="639000" />
<workItem from="1618193237335" duration="14585000" />
</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>
<workItem from="1618193237335" duration="17390000" />
</task>
<task id="LOCAL-00045" summary="m">
<created>1614064323435</created>
......@@ -541,7 +542,14 @@
<option name="project" value="LOCAL" />
<updated>1618213267192</updated>
</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 />
</component>
<component name="TypeScriptGeneratedFilesManager">
......
......@@ -7,7 +7,7 @@
"openId": "openId",
"isFirstLogin": true,
"loginAddPower": 0,
"isNewUser": false,
"isNewUser": true,
"inviteId": "",
"isFollow": true
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -15,16 +15,18 @@
"mock-webpack-plugin": "^2.0.0",
"path": "^0.12.7",
"progress": "^2.0.0",
"psd": "^3.2.0",
"ts-loader": "^4.0.0",
"typescript": "^4.1.3",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.0",
"webpack-merge": "^4.1.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"psd": "^3.2.0"
"webpack-merge": "^4.1.2"
},
"dependencies": {
"pack_textures": "^1.1.5"
},
"dependencies": {},
"scripts": {
"psd": "node scripts/psdH.js && node scripts/flushRes",
"createModule": "node scripts/createModule",
......
......@@ -6,7 +6,7 @@ var fs = require("fs");
// fs.readFileSync("./output.js")
// )
// 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);
// fs.writeFileSync(endPath + "output." + version + ".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');
var del = require('del');
const join = require('path').join;
// var packTextures = require("pack_textures")
//写入图集的文件夹
var outPath = "./released/resource/";
//读取散图的文件夹
......@@ -16,11 +18,9 @@ files.forEach(function (file) {
let fPath = join(readPath, file);
//只处理文件夹
if (fs.statSync(fPath).isDirectory()) {
//判断文件夹内是否有图片
if (!judgeHasImage(fPath)) return;
var cli = getTmCmd(fPath, outPath + file + "/", file);
//如果文件夹不存在
if (!fs.existsSync(outPath + file)) {
fs.mkdirSync(outPath + file);
......@@ -35,85 +35,43 @@ files.forEach(function (file) {
}
}
//执行合图指令
exec(cli, { encoding: 'utf8' }, function (err, stdout, stderr) {
if (err) {
console.log(err);
return;
}
// console.log('stdout:' + stdout);
// console.log('stderr:' + stderr);
console.log('生成图集:' + file);
var pathname = outPath + file + "/" + file + ".json";
//有中文命名时处理
var data = iconv.decode(fs.readFileSync(pathname), "utf-8");//GBK,window版本只能GBK,TexturePacker版本问题,mac改成utf-8
// console.log(data)
//反序列化
data = JSON.parse(data); //eval(data)
//重写数据
var obj = {};
var frames = data.frames;
var frameKeys = Object.keys(frames);
for (var i = 0; i < frameKeys.length; i++) {
const name = frameKeys[i];
const data = frames[name];
if (!data.frame) continue;
const sourceSize = data.trimmed !== false && data.sourceSize
? data.sourceSize : data.frame;
obj[name] = {
"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,
// packTextures(
// fPath,
// outPath + file + "/" + file,
// 4096,
// 4096,
// false,
// 2,
// 2,
// true,
// true
// )
//全局命令装过,就直接用命令行
exec(
'packTextures' + //基础指令
' -i ' + fPath + //要合图集的文件夹路径
' -o ' + outPath + file + "/" + file + //输出路径及名字
' --mw ' + 4096 + //最大宽度
' --mh ' + 4096 +//最大高度
' -p ' + false + //长宽是否2的指数,canvas下没必要,false
' --sp ' + 2 + //图片间隔
' --bp ' + 2 + //边界间隔
' -r ' + true + //是否允许图片旋转
' -t ' + true //是否允许裁切图片边缘透明像素
, { encoding: 'utf8' }, (e) => {
if (e) {
console.log(e)
return
}
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) {
var files = fs.readdirSync(path);
......@@ -128,4 +86,4 @@ function judgeHasImage(path) {
}
}
return false;
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -271,7 +271,7 @@ export class PlayScene extends Scene {
this.musicBtn = this.addChild(new MusicBtn());
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 }
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