Commit c95af6bd authored by haiyoucuv's avatar haiyoucuv

1

parent 02e2d983
......@@ -2,18 +2,19 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="31be0130-d27d-4740-b668-956a8050e1bf" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/mock/miniTb/rule.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/mock/config.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/gameScene/gameScene.json" beforeDir="false" afterPath="$PROJECT_DIR$/released/resource/gameScene/gameScene.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/gameScene/gameScene.png" beforeDir="false" afterPath="$PROJECT_DIR$/released/resource/gameScene/gameScene.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/released/resource/res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/resource/res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/textureMerge.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/textureMerge.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ResJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ResJson.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TaoBaoNet.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaoBaoNet.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/RulePanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/RulePanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/UnlockPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/GameLayer.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/GameLayer.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/Land.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/Land.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/GameEle.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/MoveAni.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/UI/UILayer.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/UI/UILayer.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/Option.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/Option.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/PlantList.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/PlantList.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scenes/GameScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scenes/GameScene.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -40,7 +41,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$/src/panels" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/scenes" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
......@@ -49,6 +50,7 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/scenes" />
<recent name="$PROJECT_DIR$/src/panels" />
</key>
</component>
......@@ -85,9 +87,9 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="npm.dev" />
<item itemvalue="npm.handleRes" />
<item itemvalue="npm.flushRes" />
<item itemvalue="npm.dev" />
</list>
</recent_temporary>
</component>
......@@ -103,7 +105,8 @@
<updated>1590749938444</updated>
<workItem from="1590749939792" duration="84000" />
<workItem from="1590976087296" duration="15316000" />
<workItem from="1590996860067" duration="12763000" />
<workItem from="1590996860067" duration="14333000" />
<workItem from="1591062735465" duration="10090000" />
</task>
<task id="LOCAL-00001" summary="1">
<created>1591003912929</created>
......@@ -127,33 +130,39 @@
<screen x="35" y="23" width="1645" height="1027" />
</state>
<state x="466" y="108" key="CommitChangelistDialog2/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591003912498" />
<state width="255" height="543" key="GridCell.Tab.0.bottom" timestamp="1591005691603">
<screen x="35" y="23" width="1645" height="1027" />
<state width="295" height="907" key="GridCell.Tab.0.bottom" timestamp="1591067986444">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="255" height="543" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591005691603" />
<state width="255" height="543" key="GridCell.Tab.0.center" timestamp="1591005691600">
<screen x="35" y="23" width="1645" height="1027" />
<state width="499" height="907" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953118" />
<state width="295" height="907" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591067986444" />
<state width="295" height="907" key="GridCell.Tab.0.center" timestamp="1591067986444">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="255" height="543" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591005691600" />
<state width="255" height="543" key="GridCell.Tab.0.left" timestamp="1591005691596">
<screen x="35" y="23" width="1645" height="1027" />
<state width="499" height="907" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953116" />
<state width="295" height="907" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591067986444" />
<state width="295" height="907" key="GridCell.Tab.0.left" timestamp="1591067986440">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="255" height="543" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591005691596" />
<state width="255" height="543" key="GridCell.Tab.0.right" timestamp="1591005691603">
<screen x="35" y="23" width="1645" height="1027" />
<state width="499" height="907" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953114" />
<state width="295" height="907" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591067986440" />
<state width="295" height="907" key="GridCell.Tab.0.right" timestamp="1591067986444">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="255" height="543" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591005691603" />
<state x="614" y="245" key="RollbackChangesDialog" timestamp="1590993046653">
<screen x="35" y="23" width="1645" height="1027" />
<state width="499" height="907" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953118" />
<state width="295" height="907" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591067986444" />
<state x="615" y="245" key="RollbackChangesDialog" timestamp="1591077661188">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="614" y="245" key="RollbackChangesDialog/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1590993046653" />
<state x="615" y="245" key="RollbackChangesDialog/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591077661188" />
<state x="586" y="314" key="refactoring.ChangeSignatureDialog" timestamp="1590980819551">
<screen x="35" y="23" width="1645" height="1027" />
</state>
<state x="586" y="314" key="refactoring.ChangeSignatureDialog/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1590980819551" />
<state x="522" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591014302210">
<screen x="35" y="23" width="1645" height="1027" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591070100242">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="522" y="250" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591014302210" />
<state x="522" y="250" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591066027960" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591070100242" />
</component>
</project>
\ No newline at end of file
{
"btn_浠撳簱.png": {
"x": 1964,
"y": 2,
"x": 312,
"y": 407,
"w": 121,
"h": 133,
"ox": 0,
......@@ -11,8 +11,8 @@
"ro": false
},
"btn_鍏戞崲璁板綍.png": {
"x": 2960,
"y": 2,
"x": 413,
"y": 710,
"w": 100,
"h": 104,
"ox": 0,
......@@ -22,8 +22,8 @@
"ro": false
},
"btn_鍟嗗簵.png": {
"x": 2208,
"y": 2,
"x": 433,
"y": 542,
"w": 119,
"h": 133,
"ox": 0,
......@@ -33,8 +33,8 @@
"ro": false
},
"btn_瑙勫垯.png": {
"x": 2765,
"y": 2,
"x": 312,
"y": 710,
"w": 99,
"h": 107,
"ox": 0,
......@@ -44,8 +44,8 @@
"ro": false
},
"btn_棰嗘按婊�.png": {
"x": 2087,
"y": 2,
"x": 312,
"y": 542,
"w": 119,
"h": 133,
"ox": 0,
......@@ -55,19 +55,19 @@
"ro": false
},
"game_get.png": {
"x": 3246,
"y": 97,
"x": 470,
"y": 816,
"w": 82,
"h": 93,
"ox": 0,
"oy": 0,
"sw": 82,
"sh": 93,
"ro": true
"ro": false
},
"game_plant.png": {
"x": 3154,
"y": 2,
"x": 378,
"y": 819,
"w": 90,
"h": 101,
"ox": 0,
......@@ -77,8 +77,8 @@
"ro": false
},
"game_water.png": {
"x": 3062,
"y": 2,
"x": 286,
"y": 843,
"w": 90,
"h": 101,
"ox": 0,
......@@ -88,8 +88,8 @@
"ro": false
},
"骞垮憡.png": {
"x": 1828,
"y": 2,
"x": 181,
"y": 843,
"w": 103,
"h": 156,
"ox": 0,
......@@ -99,19 +99,19 @@
"ro": false
},
"鐢ㄦ埛_bg.png": {
"x": 2329,
"y": 2,
"x": 181,
"y": 407,
"w": 434,
"h": 129,
"ox": 0,
"oy": 0,
"sw": 434,
"sh": 129,
"ro": false
"ro": true
},
"鐢ㄦ埛_澶村儚.png": {
"x": 3246,
"y": 2,
"x": 378,
"y": 922,
"w": 93,
"h": 93,
"ox": 0,
......@@ -121,18 +121,18 @@
"ro": false
},
"鐢ㄦ埛_姘�.png": {
"x": 2024,
"y": 137,
"x": 286,
"y": 946,
"w": 39,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 39,
"sh": 48,
"ro": true
"ro": false
},
"鐢癬鍒濆.png": {
"x": 812,
"x": 343,
"y": 2,
"w": 403,
"h": 177,
......@@ -140,10 +140,10 @@
"oy": 0,
"sw": 403,
"sh": 177,
"ro": false
"ro": true
},
"鐢癬绉嶆.png": {
"x": 407,
"x": 164,
"y": 2,
"w": 403,
"h": 177,
......@@ -151,21 +151,21 @@
"oy": 0,
"sw": 403,
"sh": 177,
"ro": false
"ro": true
},
"鐢癬閫夋嫨.png": {
"x": 2,
"y": 2,
"y": 613,
"w": 403,
"h": 177,
"ox": 0,
"oy": 0,
"sw": 403,
"sh": 177,
"ro": false
"ro": true
},
"绉嶆妗哶bg.png": {
"x": 1217,
"x": 2,
"y": 2,
"w": 609,
"h": 160,
......@@ -173,11 +173,11 @@
"oy": 0,
"sw": 609,
"sh": 160,
"ro": false
"ro": true
},
"绉嶆妗哶left.png": {
"x": 1828,
"y": 160,
"x": 510,
"y": 677,
"w": 19,
"h": 34,
"ox": 0,
......@@ -187,8 +187,8 @@
"ro": true
},
"绉嶆妗哶right.png": {
"x": 1864,
"y": 160,
"x": 435,
"y": 516,
"w": 18,
"h": 34,
"ox": 0,
......@@ -198,30 +198,30 @@
"ro": true
},
"绉嶆妗哶灞辨牳妗�.png": {
"x": 2119,
"y": 137,
"x": 473,
"y": 959,
"w": 35,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 35,
"sh": 44,
"ro": true
"ro": false
},
"绉嶆妗哶寮€蹇冩灉.png": {
"x": 1933,
"y": 143,
"x": 473,
"y": 911,
"w": 35,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 35,
"sh": 46,
"ro": true
"ro": false
},
"绉嶆妗哶鏉挎牀.png": {
"x": 1981,
"y": 137,
"x": 327,
"y": 974,
"w": 42,
"h": 41,
"ox": 0,
......@@ -231,30 +231,30 @@
"ro": true
},
"绉嶆妗哶鐡滃瓙.png": {
"x": 2414,
"y": 133,
"x": 522,
"y": 143,
"w": 26,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 26,
"sh": 48,
"ro": true
"ro": false
},
"绉嶆妗哶鑵版灉.png": {
"x": 2074,
"y": 137,
"x": 510,
"y": 911,
"w": 38,
"h": 43,
"ox": 0,
"oy": 0,
"sw": 38,
"sh": 43,
"ro": true
"ro": false
},
"绉嶆妗哶鑺辩敓.png": {
"x": 2363,
"y": 133,
"x": 327,
"y": 946,
"w": 26,
"h": 49,
"ox": 0,
......@@ -264,8 +264,8 @@
"ro": true
},
"绉嶆妗哶琚嬪瓙.png": {
"x": 2866,
"y": 2,
"x": 435,
"y": 407,
"w": 107,
"h": 92,
"ox": 0,
......@@ -275,8 +275,8 @@
"ro": true
},
"杩涘害_bg.png": {
"x": 2165,
"y": 137,
"x": 312,
"y": 677,
"w": 196,
"h": 31,
"ox": 0,
......@@ -286,7 +286,7 @@
"ro": false
},
"杩涘害_fill.png": {
"x": 1933,
"x": 522,
"y": 2,
"w": 139,
"h": 29,
......
{
"loading_per_bg.png": {
"x": 2,
"y": 312,
"w": 539,
"h": 81,
"ox": 0,
"oy": 0,
"sw": 539,
"sh": 81,
"ro": false
},
"loading_per_fill.png": {
"x": 2,
"y": 395,
"w": 510,
"h": 55,
"ox": 0,
"oy": 0,
"sw": 510,
"sh": 55,
"ro": false
},
"loading_title.png": {
"x": 2,
"y": 2,
"w": 444,
"h": 304,
"ox": 0,
"oy": 0,
"sw": 444,
"sh": 304,
"ro": false
},
"loading_缁冲瓙.png": {
"x": 448,
"y": 2,
"w": 308,
"h": 306,
"ox": 0,
"oy": 0,
"sw": 308,
"sh": 306,
"ro": true
}
}
\ No newline at end of file
......@@ -10,6 +10,11 @@
"name": "gameScene",
"atlas": "gameScene.json"
},
{
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene",
"atlas": "loadingScene.json"
},
{
"keys": "rule_bg.png",
"name": "rulePanel",
......
......@@ -8,6 +8,10 @@
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,game_get.png,game_plant.png,game_water.png,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,种植框_袋子.png,进度_bg.png,进度_fill.png",
"name": "gameScene"
},
{
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene"
},
{
"keys": "rule_bg.png",
"name": "rulePanel"
......
var fs = require("fs");
var exec = require('child_process').exec;
var iconv = require('iconv-lite');
......@@ -12,119 +11,118 @@ var readPath = "./released/tm/";
var files = fs.readdirSync(readPath);
files.forEach(function (file) {
//路径
let fPath = join(readPath, file);
//只处理文件夹
if (fs.statSync(fPath).isDirectory()) {
//路径
let fPath = join(readPath, file);
//只处理文件夹
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)) {
fs.mkdirSync(outPath + file);
}
else {
//图集文件存在就删除
if (fs.existsSync(outPath + file + "/" + file + ".json")) {
del(outPath + file + "/" + file + ".json")
}
if (fs.existsSync(outPath + file + "/" + file + ".png")) {
del(outPath + file + "/" + file + ".png")
}
}
var cli = getTmCmd(fPath, outPath + file + "/", file);
//如果文件夹不存在
if (!fs.existsSync(outPath + file)) {
fs.mkdirSync(outPath + file);
} else {
//图集文件存在就删除
if (fs.existsSync(outPath + file + "/" + file + ".json")) {
del(outPath + file + "/" + file + ".json")
}
if (fs.existsSync(outPath + file + "/" + file + ".png")) {
del(outPath + file + "/" + file + ".png")
}
}
//执行合图指令
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);
//执行合图指令
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), "GBK");
//反序列化
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,
}
}
//序列化,不格式化,节省内存
fs.writeFileSync(pathname, JSON.stringify(obj, "", "\t"));
})
}
var pathname = outPath + file + "/" + file + ".json";
//有中文命名时处理
var data = iconv.decode(fs.readFileSync(pathname), "GBK");
//反序列化
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,
}
}
//序列化,不格式化,节省内存
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
var cli =
'TexturePacker ' + //基础指令
src + //要合图集的文件夹路径
' --format json' + //图集数据格式
' --max-size 1024' + //最大尺寸
' --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
* @param {string} pathname
*/
function applyUtf8(pathname) {
fs.writeFile(pathname, iconv.decode(fs.readFileSync(pathname), "GBK"), {
encoding: "UTF8"
}, function (err) {
if (err) {
throw err;
}
});
fs.writeFile(pathname, iconv.decode(fs.readFileSync(pathname), "GBK"), {
encoding: "UTF8"
}, function (err) {
if (err) {
throw err;
}
});
}
/**
* 判断文件夹内是否有图片
* @param {*} path
* @param {*} path
*/
function judgeHasImage(path) {
var files = fs.readdirSync(path);
for (var i = 0; i < files.length; i++) {
var itm = files[i]
var stat = fs.statSync(path + "/" + itm);
if (stat.isDirectory()) {
//递归读取文件
if (judgeHasImage(path + "/" + itm + "/")) return true;
} else {
if (itm.substr(-4) == ".jpg" || itm.substr(-4) == ".png") return true;
var files = fs.readdirSync(path);
for (var i = 0; i < files.length; i++) {
var itm = files[i]
var stat = fs.statSync(path + "/" + itm);
if (stat.isDirectory()) {
//递归读取文件
if (judgeHasImage(path + "/" + itm + "/")) return true;
} else {
if (itm.substr(-4) == ".jpg" || itm.substr(-4) == ".png") return true;
}
}
}
return false;
}
\ No newline at end of file
return false;
}
import { Tool } from "./Tools";
import { layers, destroyLayers } from "../module/views/layers";
import { RES } from "../module/RES";
import { changeScene, showWaiting, destroyAllCtrls } from "../module/ctrls";
import { changeScene, destroyAllCtrls } from "../module/ctrls";
import { ResJson } from "./ResJson";
import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet";
import { GameScene } from "./scenes/GameScene";
import { destroyNetData } from "./TaoBaoNet";
import { LoadingScene } from "./scenes/LoadingScene";
/**
* 全局事件,为了和小程序交互
......@@ -76,11 +74,8 @@ export class Main {
// if (document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
//打开开始场景
// 请求规则
sendTbNet(TbNetName.rule, {}, () => {
});
changeScene(GameScene);
changeScene(LoadingScene);
// changeScene(GameScene);
//测试
// sendTbNet(TbNetName.aaa, {}, (s, res) => {
// console.log(res)
......
......@@ -8,6 +8,10 @@ export const ResJson = {
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,game_get.png,game_plant.png,game_water.png,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,种植框_袋子.png,进度_bg.png,进度_fill.png",
"name": "gameScene"
},
{
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene"
},
{
"keys": "rule_bg.png",
"name": "rulePanel"
......
......@@ -69,6 +69,7 @@ let fc;
* @param netName
* @param parameter
* @param callback
* @param hideMsg
*/
export function sendTbNet(netName: TbNetName, parameter: any, callback: Function, hideMsg: boolean = false) {
//网络超时
......@@ -89,6 +90,16 @@ export function sendTbNet(netName: TbNetName, parameter: any, callback: Function
if (!hideMsg && !data.success) showToast(data.message || "网络异常")
//回调
callback(data.success, data);
// 打印一下
console.log(
`%cNAME : ${netName} \n`
+ `STATE : ${data.success} \n`
+ `DATA : `
, `${data.success ? 'color:green' : 'color:red`'}`
, data
);
}, () => {
});
return;
......
import Container = FYGE.Container;
import { Land } from "./Land";
import PlantList from "./PlantList";
import FrameAni = FYGE.FrameAni;
/**
* GameLayer
......
......@@ -29,8 +29,8 @@ export default class Option extends Sprite {
.call(() => {
const _y = this.y;
Tween.get(this, {loop: true})
.to({y: _y - 6}, 1000, Ease.quadInOut)
.to({y: _y}, 1000, Ease.quadInOut);
.to({y: _y - 6}, 800, Ease.quadInOut)
.to({y: _y}, 800, Ease.quadInOut);
});
}
......
......@@ -11,6 +11,7 @@ import { RES } from "../../../module/RES";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import GameLayer from "./GameLayer";
import MouseEvent = FYGE.MouseEvent;
export default class PlantList extends Container {
......@@ -145,7 +146,18 @@ class ListPlant extends Container implements IScrollListItem {
this.img = this.addChild(new Sprite());
this.addEventListener(FYGE.MouseEvent.CLICK, () => {
this.anchorX = this.width / 2;
this.anchorY = this.height / 2;
this.addEventListener(MouseEvent.MOUSE_DOWN, () => {
Tween.get(this).to({scaleX: 0.9, scaleY: 0.9}, 150, Ease.quadInOut);
});
this.addEventListener(MouseEvent.MOUSE_UP, () => {
Tween.get(this).to({scaleX: 1, scaleY: 1}, 150, Ease.quadInOut);
});
this.addEventListener(MouseEvent.CLICK, () => {
const bindId = GameLayer.ins.plantList.bindId;
console.log(`点到了: ${this.key} ${s_PlantData[this.key].name}, 土地Id: ${bindId}`);
});
......
......@@ -3,7 +3,6 @@ import { Tool } from "../Tools";
import GameLayer from "../parts/Game/GameLayer";
import { UILayer } from "../parts/UI/UILayer";
import MouseEvent = FYGE.MouseEvent;
import OptionPool, { OPTION_TYPE } from "../const/OptionPool";
import { Land } from "../parts/Game/Land";
export class GameScene extends Scene {
......@@ -19,6 +18,7 @@ export class GameScene extends Scene {
private uiLayer: UILayer;
initUi() {
// 背景图
this.addChild(Tool.getSprite('game_bg.jpg'))
.addEventListener(MouseEvent.CLICK, () => {
console.log('点击了BG');
......
import { Scene } from "../../module/views/Scene";
import { Tool } from "../Tools";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import Container = FYGE.Container;
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import { getAdjustTopHeight } from "../const/myLab";
import Graphics = FYGE.Graphics;
import SceneCtrl from "../../module/ctrls/sceneCtrl";
import { GameScene } from "./GameScene";
export class LoadingScene extends Scene {
get groupNames() {
return ['loadingScene'];
}
private top: Container;
private title: Sprite;
private progressBar: Container;
private progressMask: Graphics;
private progressFill: Sprite;
initUi() {
this.addChild(Tool.getSprite('loading_bg.jpg'));
// title
this.top = this.addChild(new Container());
const line = this.top.addChild(Tool.getSprite('loading_绳子.png'));
line.position.set(211, -12);
this.title = this.top.addChild(Tool.getSprite('loading_title.png'));
this.title.position.set(156, 141);
this.title.anchor.set(this.title.width / 2, this.title.height / 2);
this.top.y = getAdjustTopHeight(this.top, 0);
// progressBar
this.progressBar = this.addChild(new Container());
this.progressBar.addChild(Tool.getSprite('loading_per_bg.png'));
this.progressBar.position.set(108, 1291);
// fill
this.progressFill = this.progressBar.addChild(Tool.getSprite('loading_per_fill.png'));
this.progressFill.position.set(-500, 10);
// mask
this.progressMask = this.progressBar.addChild(new Graphics());
this.progressMask.drawCircle(38, 38, 28);
this.progressMask.drawCircle(492, 38, 28);
this.progressMask.drawRect(38, 10, 464, 56);
this.progressFill.mask = this.progressMask;
}
start() {
super.start();
// 请求规则
sendTbNet(TbNetName.rule, {}, () => {
});
this.titleEffect().call(() => {
this.startLoading().call(() => {
SceneCtrl.instance.change(GameScene);
});
});
}
private startLoading() {
return Tween.get(this.progressFill)
.to({x: 10}, 2000, Ease.quadInOut);
}
private titleEffect() {
const _y = this.top.y;
return Tween.get(this.top)
.set({y: _y - 445})
.to({y: _y}, 300, Ease.quadOut)
.to({y: _y - 12}, 50, Ease.quadIn)
.call(() => {
Tween.get(this.title)
.to({rotation: 5}, 50)
.to({rotation: -5}, 50)
.to({rotation: 0}, 50);
});
}
initEvents() {
super.initEvents();
}
removeEvents() {
super.removeEvents();
}
}
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