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
...@@ -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