Commit c9998dbe authored by haiyoucuv's avatar haiyoucuv

wareHouse

parent eaac9f93
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="31be0130-d27d-4740-b668-956a8050e1bf" name="Default Changelist" comment=""> <list default="true" id="31be0130-d27d-4740-b668-956a8050e1bf" name="Default Changelist" 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$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/WareHousePanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/WareHousePanel.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/panels/WareHousePanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/WareHousePanel.ts" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -113,7 +114,7 @@ ...@@ -113,7 +114,7 @@
<workItem from="1591321317628" duration="18063000" /> <workItem from="1591321317628" duration="18063000" />
<workItem from="1591438071338" duration="597000" /> <workItem from="1591438071338" duration="597000" />
<workItem from="1591581198126" duration="7855000" /> <workItem from="1591581198126" duration="7855000" />
<workItem from="1591594488054" duration="395000" /> <workItem from="1591594488054" duration="2684000" />
</task> </task>
<task id="LOCAL-00001" summary="1"> <task id="LOCAL-00001" summary="1">
<created>1591003912929</created> <created>1591003912929</created>
...@@ -213,7 +214,14 @@ ...@@ -213,7 +214,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1591587981483</updated> <updated>1591587981483</updated>
</task> </task>
<option name="localTasksCounter" value="15" /> <task id="LOCAL-00015" summary="wareHouse">
<created>1591594902967</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1591594902967</updated>
</task>
<option name="localTasksCounter" value="16" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
...@@ -236,12 +244,12 @@ ...@@ -236,12 +244,12 @@
<screen x="37" y="23" width="1643" height="1027" /> <screen x="37" y="23" width="1643" height="1027" />
</state> </state>
<state x="671" y="259" key="#com.intellij.ide.util.MemberChooser/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591344864454" /> <state x="671" y="259" key="#com.intellij.ide.util.MemberChooser/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591344864454" />
<state x="467" y="108" key="CommitChangelistDialog2" timestamp="1591587980954"> <state x="467" y="108" key="CommitChangelistDialog2" timestamp="1591594902601">
<screen x="37" y="23" width="1643" height="1027" /> <screen x="37" y="23" width="1643" height="1027" />
</state> </state>
<state x="466" y="108" key="CommitChangelistDialog2/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591003912498" /> <state x="466" y="108" key="CommitChangelistDialog2/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591003912498" />
<state x="2182" y="-102" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189619717" /> <state x="2182" y="-102" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189619717" />
<state x="467" y="108" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591587980954" /> <state x="467" y="108" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591594902601" />
<state width="293" height="907" key="GridCell.Tab.0.bottom" timestamp="1591594033795"> <state width="293" height="907" key="GridCell.Tab.0.bottom" timestamp="1591594033795">
<screen x="37" y="23" width="1643" height="1027" /> <screen x="37" y="23" width="1643" height="1027" />
</state> </state>
...@@ -292,11 +300,11 @@ ...@@ -292,11 +300,11 @@
<screen x="35" y="23" width="1645" height="1027" /> <screen x="35" y="23" width="1645" height="1027" />
</state> </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="586" y="314" key="refactoring.ChangeSignatureDialog/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1590980819551" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591585460380"> <state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591596914891">
<screen x="37" y="23" width="1643" height="1027" /> <screen x="37" y="23" width="1643" height="1027" />
</state> </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="1591066027960" /> <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="2248" y="61" width="783" height="775" key="search.everywhere.popup/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591582557074" /> <state x="2248" y="61" width="783" height="775" key="search.everywhere.popup/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591582557074" />
<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="1591585460380" /> <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="1591596914891" />
</component> </component>
</project> </project>
\ No newline at end of file
{ {
"name": "tbgame", "name": "tbgame",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.html", "main": "index.html",
"devDependencies": { "devDependencies": {
"ali-oss": "^4.11.4", "ali-oss": "^4.11.4",
"chalk": "^2.3.0", "chalk": "^2.3.0",
"co": "^4.6.0", "co": "^4.6.0",
"del": "^2.2.1", "del": "^2.2.1",
"fs": "0.0.2", "fs": "0.0.2",
"imagemin": "^7.0.1", "imagemin": "^7.0.1",
"imagemin-mozjpeg": "^8.0.0", "imagemin-mozjpeg": "^8.0.0",
"imagemin-pngquant": "^8.0.0", "imagemin-pngquant": "^8.0.0",
"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",
"ts-loader": "^4.0.0", "ts-loader": "^4.0.0",
"tslint": "^5.9.1", "tslint": "^5.9.1",
"typescript": "^2.7.2", "typescript": "^2.7.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" "uglifyjs-webpack-plugin": "^2.1.2"
}, },
"dependencies": {}, "dependencies": {},
"scripts": { "scripts": {
"flushRes": "node scripts/flushRes", "flushRes": "node scripts/flushRes",
"handleRes": "node scripts/delRel && node scripts/copyRes && node scripts/createTm && node scripts/textureMerge && node scripts/delTm && node scripts/imageMin", "handleRes": "node scripts/delRel && node scripts/copyRes && node scripts/createTm && node scripts/textureMerge && node scripts/delTm && node scripts/imageMin",
"upload": "node scripts/upload", "upload": "node scripts/upload",
"build": "npm run handleRes && node scripts/mergeJson && npm run upload && npm run buildTS", "build": "npm run handleRes && node scripts/mergeJson && npm run upload && npm run buildTS",
"watch": "webpack --watch", "watch": "webpack --watch",
"dev": "webpack-dev-server --open --config webpack.dev.js --host 0.0.0.0", "dev": "webpack-dev-server --open --config webpack.dev.js --host 0.0.0.0",
"buildTS": "webpack --config webpack.prod.js && node scripts/mergeJs", "buildTS": "webpack --config webpack.prod.js && node scripts/mergeJs",
"copyJs": "node scripts/copyJs" "copyJs": "node scripts/copyJs"
}, },
"author": "MrKwon", "author": "MrKwon",
"license": "ISC" "license": "ISC"
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ import Sprite = FYGE.Sprite; ...@@ -4,7 +4,7 @@ import Sprite = FYGE.Sprite;
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
import Tween = FYGE.Tween; import Tween = FYGE.Tween;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import { Container, TextField } from "fyge"; import { Container, ScrollPage, TextField } from "fyge";
import { PLANT_TYPE, s_PlantData } from "../const/staticData"; import { PLANT_TYPE, s_PlantData } from "../const/staticData";
export default class WareHousePanel extends Panel { export default class WareHousePanel extends Panel {
...@@ -12,7 +12,8 @@ export default class WareHousePanel extends Panel { ...@@ -12,7 +12,8 @@ export default class WareHousePanel extends Panel {
return ["wareHouse"]; return ["wareHouse"];
} }
closeBtn: Sprite; private closeBtn: Sprite;
private items = {};
initUi() { initUi() {
this.addChild(Tool.getSprite("comm_bg.png")) this.addChild(Tool.getSprite("comm_bg.png"))
...@@ -24,14 +25,29 @@ export default class WareHousePanel extends Panel { ...@@ -24,14 +25,29 @@ export default class WareHousePanel extends Panel {
this.closeBtn = this.addChild(Tool.getSprite('closeBtn.png')); this.closeBtn = this.addChild(Tool.getSprite('closeBtn.png'));
this.closeBtn.position.set(670, -50); this.closeBtn.position.set(670, -50);
this.addChild(new WareHouseItem(PLANT_TYPE.Cashew)); const scroll = this.addChild(new ScrollPage(666, 765, 1064, true));
scroll.position.set(43, 210);
const pos = [
[0, 0],
[354, 0],
[0, 368],
[354, 368],
[0, 736],
[354, 736],
];
let i = 0;
for (let k in s_PlantData) {
this.items[k] = scroll.view.addChild(new WareHouseItem(k));
this.items[k].position.set(pos[i][0], pos[i][1]);
i++;
}
} }
public showAni() { public showAni() {
if (this.isShowing) return; if (this.isShowing) return;
this.isShowing = true; this.isShowing = true;
this.y = this.height; this.y = this.height;
const _y = 1624 - this.height - layers.stageOffsetY + 50 + 50; const _y = 1624 - this.height - layers.stageOffsetY + 50 + 100;
Tween.get(this) Tween.get(this)
.to({y: _y}, 500, Ease.quartOut) .to({y: _y}, 500, Ease.quartOut)
.call(() => { .call(() => {
...@@ -64,33 +80,35 @@ class WareHouseItem extends Container { ...@@ -64,33 +80,35 @@ class WareHouseItem extends Container {
public set count(count: number) { public set count(count: number) {
this._count = count; this._count = count;
this.countLabel && (this.countLabel.text = `数量:${this._count}`); this.countLabel.text = `数量:${this._count}`;
} }
private _type: PLANT_TYPE; private _type: PLANT_TYPE | string;
public get type(): PLANT_TYPE { public get type(): PLANT_TYPE | string {
return this._type; return this._type;
} }
public set type(type: PLANT_TYPE) { public set type(type: PLANT_TYPE | string) {
this._type = type; this._type = type;
} }
constructor(type: PLANT_TYPE) { constructor(type: PLANT_TYPE | string) {
super(); super();
this.count = 0;
this.addChild(Tool.getSprite('wareHouse_item_bg.png')); this.addChild(Tool.getSprite('wareHouse_item_bg.png'));
const plantIcon = this.addChild(Tool.getSprite(`wareHouse_${s_PlantData[type].name}.png`)); const plantIcon = this.addChild(Tool.getSprite(`wareHouse_${s_PlantData[type].name}.png`));
plantIcon.position.set((this.width - plantIcon.width) / 2, 35);
plantIcon.position.set((this.width - plantIcon.width) / 2, 35);
const nameLabel = this.addChild(Tool.getText(s_PlantData[type].name, 28, '#a65310')); const nameLabel = this.addChild(Tool.getText(s_PlantData[type].name, 28, '#a65310'));
nameLabel.position.set((this.width - nameLabel.textWidth) / 2, 212);
nameLabel.position.set((this.width - nameLabel.textWidth) / 2, 212);
this.countLabel = this.addChild(Tool.getText('数量:0', 22, '#9a9a9a')); this.countLabel = this.addChild(Tool.getText('数量:0', 22, '#9a9a9a'));
this.countLabel.position.set(111, 258); this.countLabel.position.set(111, 258);
this.count = 0;
this.type = type;
} }
} }
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