Commit aebab240 authored by haiyoucuv's avatar haiyoucuv

exchangePanel

parent 1e485e75
......@@ -2,56 +2,21 @@
<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/qiaqiaHome.getStorages.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/mock/miniTb/qiaqia2.getExchangeGoodsList.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/const/GEVENT.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/index.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/libs/fyge.min.js" beforeDir="false" afterPath="$PROJECT_DIR$/libs/fyge.min.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/libs/fyge.min.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/libs/fyge.min.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/miniTb/qiaqiaHome.getGameInfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/miniTb/qiaqiaHome.getGameInfo.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/output.js" beforeDir="false" afterPath="$PROJECT_DIR$/output.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/CASHEWNUT_1/CASHEWNUT_1.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/CASHEWNUT_2/CASHEWNUT_2.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/CASHEWNUT_3/CASHEWNUT_3.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/CHESTNUT_1/CHESTNUT_1.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/CHESTNUT_2/CHESTNUT_2.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/CHESTNUT_3/CHESTNUT_3.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/MELON_1/MELON_1.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/MELON_2/MELON_2.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/MELON_3/MELON_3.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PEANUT_1/PEANUT_1.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PEANUT_2/PEANUT_2.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PEANUT_3/PEANUT_3.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PECAN_1/PECAN_1.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PECAN_2/PECAN_2.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PECAN_3/PECAN_3.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PISTACHIONUT_1/PISTACHIONUT_1.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PISTACHIONUT_2/PISTACHIONUT_2.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/PISTACHIONUT_3/PISTACHIONUT_3.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/common/common.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/exRecordPanel/exRecordPanel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/exSuccessPanel/exSuccessPanel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/exchangePanel/exchangePanel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/gameScene/gameScene.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/loadingScene/loadingScene.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/panel/panel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/released/resource/res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/rulePanel/rulePanel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/shopPanel/shopPanel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/taskPanel/taskPanel.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/taskPanel/taskPanel.png" beforeDir="false" afterPath="$PROJECT_DIR$/released/resource/taskPanel/taskPanel.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/released/resource/wareHouse/wareHouse.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/copyJs.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/copyJs.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/mergeJson.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/mergeJson.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/textureMerge.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/textureMerge.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/upload.js" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/upload.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/gameScene/种植框_山核桃.png" beforeDir="false" afterPath="$PROJECT_DIR$/resource/gameScene/种植框_核桃.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/resource/res.json" 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/const/staticData.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/const/staticData.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/ExchangePanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/ExchangePanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/ShopPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/ShopPanel.ts" 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/parts/UI/UILayer.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/UI/UILayer.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/UI/UserInfoGroup.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/UI/UserInfoGroup.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scenes/LoadingScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scenes/LoadingScene.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils.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" />
......@@ -106,7 +71,7 @@
<recent name="$PROJECT_DIR$/resource/taskPanel" />
</key>
</component>
<component name="RunManager" selected="npm.build">
<component name="RunManager" selected="npm.handleRes">
<configuration name="build" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
......@@ -147,22 +112,17 @@
<envs />
<method v="2" />
</configuration>
<configuration name="test" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="test" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="npm.build" />
<item itemvalue="npm.buildTS" />
<item itemvalue="npm.flushRes" />
<item itemvalue="npm.handleRes" />
<item itemvalue="npm.test" />
</list>
<recent_temporary>
<list>
<item itemvalue="npm.flushRes" />
<item itemvalue="npm.build" />
<item itemvalue="npm.handleRes" />
<item itemvalue="npm.buildTS" />
</list>
</recent_temporary>
......@@ -191,7 +151,7 @@
<workItem from="1591594488054" duration="16883000" />
<workItem from="1591667441623" duration="25180000" />
<workItem from="1591753635902" duration="11045000" />
<workItem from="1591771023496" duration="10281000" />
<workItem from="1591771023496" duration="19811000" />
</task>
<task id="LOCAL-00001" summary="1">
<created>1591003912929</created>
......@@ -424,7 +384,14 @@
<option name="project" value="LOCAL" />
<updated>1591770920260</updated>
</task>
<option name="localTasksCounter" value="34" />
<task id="LOCAL-00034" summary="res">
<created>1591785686213</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1591785686213</updated>
</task>
<option name="localTasksCounter" value="35" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -461,46 +428,52 @@
<MESSAGE value="初始化土地信息,更新土地信息" />
<MESSAGE value="浇水" />
<MESSAGE value="任务弹窗" />
<option name="LAST_COMMIT_MESSAGE" value="任务弹窗" />
<MESSAGE value="res" />
<option name="LAST_COMMIT_MESSAGE" value="res" />
</component>
<component name="WindowStateProjectService">
<state x="323" y="198" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1591790199346">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="323" y="198" key="#com.intellij.execution.impl.EditConfigurationsDialog/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591790199346" />
<state x="671" y="259" key="#com.intellij.ide.util.MemberChooser" timestamp="1591344864454">
<screen x="37" y="23" width="1643" height="1027" />
</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="467" y="108" key="CommitChangelistDialog2" timestamp="1591770918975">
<state x="467" y="108" key="CommitChangelistDialog2" timestamp="1591785684954">
<screen x="37" y="23" width="1643" 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 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="1591770918975" />
<state width="304" height="784" key="GridCell.Tab.0.bottom" timestamp="1591779342175">
<state x="467" y="108" key="CommitChangelistDialog2/37.23.1643.1027@37.23.1643.1027" timestamp="1591785684954" />
<state width="304" height="907" key="GridCell.Tab.0.bottom" timestamp="1591790184080">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<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="469" height="697" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591778250578" />
<state width="304" height="784" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591779342175" />
<state width="304" height="907" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591790184080" />
<state width="311" height="907" key="GridCell.Tab.0.bottom/37.23.1643.1027@37.23.1643.1027" timestamp="1591713871414" />
<state width="304" height="784" key="GridCell.Tab.0.center" timestamp="1591779342174">
<state width="304" height="907" key="GridCell.Tab.0.center" timestamp="1591790184079">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<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="469" height="697" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591778250577" />
<state width="304" height="784" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591779342174" />
<state width="304" height="907" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591790184079" />
<state width="311" height="907" key="GridCell.Tab.0.center/37.23.1643.1027@37.23.1643.1027" timestamp="1591713871413" />
<state width="304" height="784" key="GridCell.Tab.0.left" timestamp="1591779342174">
<state width="304" height="907" key="GridCell.Tab.0.left" timestamp="1591790184078">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<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="469" height="697" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591778250577" />
<state width="304" height="784" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591779342174" />
<state width="304" height="907" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591790184078" />
<state width="311" height="907" key="GridCell.Tab.0.left/37.23.1643.1027@37.23.1643.1027" timestamp="1591713871412" />
<state width="304" height="784" key="GridCell.Tab.0.right" timestamp="1591779342174">
<state width="304" height="907" key="GridCell.Tab.0.right" timestamp="1591790184079">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<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="469" height="697" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591778250577" />
<state width="304" height="784" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591779342174" />
<state width="304" height="907" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591790184079" />
<state width="311" height="907" key="GridCell.Tab.0.right/37.23.1643.1027@37.23.1643.1027" timestamp="1591713871413" />
<state x="446" y="278" key="IDE.errors.dialog" timestamp="1591150813027">
<screen x="37" y="23" width="1643" height="1027" />
......@@ -532,12 +505,12 @@
<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="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591780279349">
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591794090580">
<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="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="1591778463158" />
<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="1591779513139" />
<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="1591794090580" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/37.23.1643.1027@37.23.1643.1027" timestamp="1591780279349" />
</component>
</project>
\ No newline at end of file
{
"code": "000000",
"data": [
{
"image": "https://source.unsplash.com/user/erondu/100x100",
"ename": "111111",
"amount": 20,
"exchangeInfo": [
{
"name": "核桃",
"storage": 110,
"type": "PECAN",
"value": 10
}
],
"restStock": 1000,
"isLimitStock": true,
"name": "权益奖品",
"startTime": 1591682068000,
"_id": "5edf3a16f344891ad1f6adab",
"endTime": 1591682068000,
"type": 1
},
{
"image": "https://source.unsplash.com/user/erondu/100x100",
"ename": "111111",
"amount": 20,
"exchangeInfo": [
{
"name": "核桃",
"storage": 0,
"type": "CHESTNUT",
"value": 10
},
{
"name": "核桃",
"storage": 5,
"type": "PECAN",
"value": 10
},
{
"name": "核桃",
"storage": 1,
"type": "PEANUT",
"value": 10
},
{
"name": "核桃",
"storage": 11,
"type": "MELON",
"value": 10
},
{
"name": "核桃",
"storage": 10,
"type": "PISTACHIONUT",
"value": 10
},
{
"name": "核桃",
"storage": 0,
"type": "CASHEWNUT",
"value": 10
}
],
"restStock": 1000,
"isLimitStock": true,
"name": "权益奖品",
"startTime": 1591682068000,
"_id": "5edf3a16f344891ad1f6adab",
"endTime": 1591682068000,
"type": 1
},
{
"image": "https://source.unsplash.com/user/erondu/100x100",
"ename": "111111",
"amount": 20,
"exchangeInfo": [
{
"name": "核桃",
"storage": 10,
"type": "PECAN",
"value": 10
}
],
"restStock": 1000,
"isLimitStock": true,
"name": "权益奖品",
"startTime": 1591682068000,
"_id": "5edf3a16f344891ad1f6adab",
"endTime": 1591682068000,
"type": 1
}
],
"success": true
}
......@@ -10,7 +10,7 @@
"plant": true,
"level": 3,
"plantType": "PEANUT",
"waterTime": 1591790173326,
"waterTime": 1591891173326,
"totalTime": 300000000,
"waterRestCount": 0
},
......@@ -19,7 +19,7 @@
"plant": true,
"level": 1,
"plantType": "CASHEWNUT",
"waterTime": 0,
"waterTime": 1591891173326,
"totalTime": 3000,
"waterRestCount": 0
},
......@@ -28,7 +28,7 @@
"plant": true,
"level": 1,
"plantType": "PECAN",
"waterTime": 1591780173326,
"waterTime": 1591891173326,
"totalTime": 300000000,
"waterRestCount": 0
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -89,7 +89,7 @@
"name": "exchangePanel"
},
{
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_time_bg.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,袋子.png,进度_bg.png,进度_fill.png",
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_time_bg.png,种植框_开心果.png,种植框_板栗.png,种植框_核桃.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,袋子.png,进度_bg.png,进度_fill.png",
"name": "gameScene"
},
{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -31,6 +31,8 @@ export enum TbNetName {
baseInfo = 'qiaqia2.getActivityBaseInfoById',
shopList = 'qiaqia2.getExchangeGoodsList',
taskList = 'qiaqia2.getTaskList',
wareHouse = 'qiaqiaHome.getStorages',
......
export enum G_EVENT {
GET_WAREHOUSE = 'getWareHouse',
GET_SHOPLIST = 'getShopList'
}
......@@ -41,7 +41,7 @@ export const s_PlantData = {
},
PECAN: {
key: PLANT_TYPE.PECAN,
name: '核桃',
name: '核桃',
time: 2,
},
PEANUT: {
......
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import { s_PlantData } from "../const/staticData";
import Sprite = FYGE.Sprite;
import Graphics = FYGE.Graphics;
import Texture = FYGE.Texture;
import MouseEvent = FYGE.MouseEvent;
import Container = FYGE.Container;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
export class ExchangePanel extends Panel {
get groupNames() {
......@@ -20,29 +24,95 @@ export class ExchangePanel extends Panel {
this.closeBtn.height = this.closeBtn.width = 44;
console.log('ExchangePanel', this.data);
const nameLabel = this.addChild(Tool.getText(this.data.prizeName, 26, '#ffffff'));
nameLabel.position.set((this.width - nameLabel.textWidth) / 2, 710);
const nameLabel = this.addChild(Tool.getText(this.data.name, 26, '#ffffff'));
nameLabel.position.set((this.width - nameLabel.textWidth) / 2, 700);
const prizeImg = this.addChild(new Sprite());
prizeImg.texture = Texture.fromUrl(this.data.prizeImg);
// prizeImg.texture.addEventListener('update', () => {
prizeImg.texture = Texture.fromUrl(this.data.image);
prizeImg.position.set((this.width - 143) / 2, 523);
prizeImg.width = prizeImg.height = 143;
// });
const imgMask = this.addChild(new Graphics());
imgMask.position.set((this.width - 143) / 2, 523);
imgMask.drawCircle(71.5, 71.5, 71.5);
prizeImg.mask = imgMask;
this.btn = this.addChild(
Tool.getSprite(
this.data.count > 0
? 'exchange_btn_en.png'
: 'exchange_btn_dis.png'
)
);
let enough = true;
'exchange_btn_en.png';
for (let i = 0; i < this.data.exchangeInfo.length; i++) {
let d = this.data.exchangeInfo[i];
if (d.value > d.storage) {
enough = false;
'exchange_btn_dis.png';
break;
}
}
this.btn = this.addChild(Tool.getSprite(enough ? 'exchange_btn_en.png' : 'exchange_btn_dis.png'));
enough && this.btn.addEventListener(MouseEvent.CLICK, () => {
console.log('兑换');
/// TODO
});
this.btn.position.set((this.width - this.btn.width) / 2, 876);
this.setExchangeInfo();
let introduction = this.addChild(Tool.getText(`商品介绍:${this.data.name}`, 20, '#dbd2ca'));
introduction.textWidth = 470;
introduction.lineType = TEXT_lINETYPE.MULTI;
introduction.textAlign = TEXT_ALIGN.LEFT;
introduction.position.set(139, 980);
if (this.data.type == 1) {
// let sDate = new Date(this.data.startTime);
let eDate = new Date(this.data.endTime);
// let sLabel = `${sDate.getFullYear()}/${sDate.getMonth() + 1}/${sDate.getDate()}`;
let eLabel = `${eDate.getFullYear()}/${eDate.getMonth() + 1}/${eDate.getDate()} ${eDate.getHours()}:${eDate.getMinutes()}`;
let date = this.addChild(Tool.getText(`${eLabel}合成截止`, 20, '#dbd2ca'));
date.position.set(137, introduction.y + introduction.textHeight + 5);
}
if (this.data.isLimitStock) {
// 库存剩余label
}
}
private setExchangeInfo() {
// {
// "name": "核桃",
// "storage": 0,
// "type": "PECAN",
// "value": 10
// }
// @ts-ignore
const exchangeInfo = this.data.exchangeInfo;
let exchangeInfoRoot = new Container();
exchangeInfo.forEach((v, index) => {
let n = exchangeInfoRoot.addChild(new Container())
let img = n.addChild(Tool.getSprite(`种植框_${s_PlantData[v.type].name}.png`));
let textNode = n.addChild(new Container());
let leftText = textNode.addChild(Tool.getText(`${v.storage}`, 22, v.storage >= v.value ? '#ffffff' : '#ff0000'));
textNode.addChild(Tool.getText(`/${v.value}`, 22, '#ffffff'))
.position.set(leftText.x + leftText.textWidth, leftText.y);
if (textNode.width > img.width) {
img.x = (textNode.width - img.width);
} else {
textNode.x = (img.width - textNode.width) / 2;
}
textNode.y = 60;
n.position.set(75 * index, 0);
if (index >= exchangeInfo.length - 1) return;
exchangeInfoRoot.addChild(Tool.getText('+', 26, '#ffffff'))
.position.set(n.x + 55, 10);
});
this.addChild(exchangeInfoRoot);
exchangeInfoRoot.position.set((this.width - exchangeInfoRoot.width) / 2, 763);
}
start(data) {
......
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import { layers } from "../../module/views/layers";
import PanelCtrl from "../../module/ctrls/panelCtrl";
import { ExchangePanel } from "./ExchangePanel";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../const/GEVENT";
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
import Container = FYGE.Container;
import IScrollListItem = FYGE.IScrollListItem;
......@@ -11,8 +16,7 @@ import Graphics = FYGE.Graphics;
import TextField = FYGE.TextField;
import Ease = FYGE.Ease;
import MouseEvent = FYGE.MouseEvent;
import PanelCtrl from "../../module/ctrls/panelCtrl";
import { ExchangePanel } from "./ExchangePanel";
import { s_PlantData } from "../const/staticData";
export default class ShopPanel extends Panel {
get groupNames() {
......@@ -34,39 +38,6 @@ export default class ShopPanel extends Panel {
this.scroll = this.addChild(new ScrollList(ShopItem, 635, 227, 635, 830));
this.scroll.position.set((this.width - this.scroll.width) / 2, 210);
this.scroll.updateData([
{
prizeName: '恰恰免单',
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
count: 0,
},
{
prizeName: '恰恰-50元加价卷',
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
count: 1000,
},
{
prizeName: '恰恰-100元加价卷',
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
count: 10000,
},
{
prizeName: '恰恰-1折卷',
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
count: 10000,
},
{
prizeName: '恰恰-5折卷',
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
count: 5000,
},
{
prizeName: '恰恰-9折卷',
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
count: 1000,
},
]);
}
public showAni() {
......@@ -94,14 +65,29 @@ export default class ShopPanel extends Panel {
start(data) {
super.start();
GDispatcher.dispatchEvent(G_EVENT.GET_SHOPLIST);
}
shopList() {
sendTbNet(TbNetName.shopList, {
activityId: activityId
}, (success, res) => {
if (!success) return;
this.scroll.updateData(res.data);
});
}
initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
super.initEvents();
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.addEventListener(G_EVENT.GET_SHOPLIST, this.shopList, this);
}
removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
super.removeEvents();
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.removeEventListener(G_EVENT.GET_SHOPLIST, this.shopList, this);
}
}
......@@ -120,16 +106,62 @@ class ShopItem extends Container implements IScrollListItem {
if (!data) return;
this.data = data;
this.itemName.text = data.prizeName;
this.itemImg.texture = Texture.fromUrl(data.prizeImg);
this.itemNum.text = (data.count <= 0) ? '来晚一步,抢光了' : `剩余${data.count}份`;
this.itemName.text = data.name;
this.itemImg.texture = Texture.fromUrl(data.image);
if (data.isLimitStock) {
this.itemNum.text = (data.restStock <= 0) ? '来晚一步,抢光了' : `剩余${data.restStock}份`;
this.itemNum.position.set((this.width - this.itemNum.textWidth) / 2, 176);
this.itemMask.visible = (data.count <= 0);
} else {
this.itemNum.text = '';
}
this.itemMask.visible = (data.isLimitStock && data.restStock <= 0);
this.removeAllEventListener();
(data.count > 0) && this.addEventListener(MouseEvent.CLICK, () => {
(!data.isLimitStock || (data.isLimitStock && data.restStock > 0)) && this.addEventListener(MouseEvent.CLICK, () => {
PanelCtrl.instance.show(ExchangePanel, this.data);
});
this.setExchangeInfo();
}
private setExchangeInfo() {
// {
// "name": "核桃",
// "storage": 0,
// "type": "PECAN",
// "value": 10
// }
// @ts-ignore
const exchangeInfo = this.data.exchangeInfo;
let exchangeInfoRoot = new Container();
exchangeInfo.forEach((v, index) => {
let n = exchangeInfoRoot.addChild(new Container())
let img = n.addChild(Tool.getSprite(`种植框_${s_PlantData[v.type].name}.png`));
let textNode = n.addChild(new Container());
let leftText = textNode.addChild(Tool.getText(`${v.storage}`, 22, v.storage >= v.value ? '#8b572b' : '#ff0000'));
textNode.addChild(Tool.getText(`/${v.value}`, 22, '#8b572b'))
.position.set(leftText.x + leftText.textWidth, leftText.y);
if (textNode.width > img.width) {
img.x = (textNode.width - img.width);
} else {
textNode.x = (img.width - textNode.width) / 2;
}
textNode.y = 60;
n.position.set(75 * index, 0);
if (index >= exchangeInfo.length - 1) return;
exchangeInfoRoot.addChild(Tool.getText('+', 26, '#8b572b'))
.position.set(n.x + 55, 10);
});
this.addChild(exchangeInfoRoot);
exchangeInfoRoot.position.set(180, 60);
}
constructor() {
......@@ -138,6 +170,8 @@ class ShopItem extends Container implements IScrollListItem {
this.itemImg = this.addChild(new Sprite());
this.itemImg.position.set(35, 26);
this.itemImg.width = 116;
this.itemImg.height = 116;
const mask = this.addChild(new Graphics());
mask.drawCircle(92, 83, 58);
......
......@@ -7,6 +7,8 @@ import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import { GDispatcher } from "../Main";
import { G_EVENT } from "../const/GEVENT";
export default class WareHousePanel extends Panel {
get groupNames() {
......@@ -38,21 +40,16 @@ export default class WareHousePanel extends Panel {
[354, 736],
];
sendTbNet(TbNetName.wareHouse, {
activityId: activityId
}, (success, res) => {
let ds = res.data.storages;
let i = 0;
for (let k in s_PlantData) {
this.items[k] = scroll.view.addChild(new WareHouseItem(k));
this.items[k].count = ds[k];
this.items[k].position.set(pos[i][0], pos[i][1]);
i++;
}
});
}
public showAni() {
showAni() {
if (this.isShowing) return;
this.isShowing = true;
this.y = 1624 - layers.stageOffsetY + 100;
......@@ -64,12 +61,23 @@ export default class WareHousePanel extends Panel {
});
}
public hideAni() {
public getWareHouse() {
sendTbNet(TbNetName.wareHouse, {
activityId: activityId
}, (success, res) => {
let ds = res.data.storages;
for (let k in s_PlantData) {
this.items[k].count = ds[k];
}
});
}
hideAni() {
return Tween.get(this)
.to({y: 1624 - layers.stageOffsetY + 100}, 500, Ease.quartOut);
}
public hidePanel() {
hidePanel() {
this.hideAni().call(() => {
super.hidePanel();
});
......@@ -77,19 +85,23 @@ export default class WareHousePanel extends Panel {
start(data) {
super.start();
GDispatcher.dispatchEvent(G_EVENT.GET_WAREHOUSE);
}
initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.addEventListener(G_EVENT.GET_WAREHOUSE, this.getWareHouse, this);
}
removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.removeEventListener(G_EVENT.GET_WAREHOUSE, this.getWareHouse, this);
}
}
class WareHouseItem extends Container {
class WareHouseItem
extends Container {
private countLabel: TextField;
private _count: number = 0;
......
......@@ -27,9 +27,6 @@ export class UILayer extends Container {
private wareHouseBtn: Sprite; // 仓库按钮
private storeBtn: Sprite; // 商店按钮
// 广告按钮
private adBtn: Sprite; // 广告按钮
constructor() {
super();
......@@ -45,13 +42,13 @@ export class UILayer extends Container {
}
public initEvents() {
[this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn, this.adBtn].forEach((v) => {
[this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn].forEach((v) => {
v.addEventListener(MouseEvent.CLICK, this.touchBtn, this);
});
}
public removeEvents() {
[this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn, this.adBtn].forEach((v) => {
[this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn].forEach((v) => {
v.removeEventListener(MouseEvent.CLICK, this.touchBtn, this);
});
}
......@@ -80,9 +77,6 @@ export class UILayer extends Container {
PanelCtrl.instance.show(RulePanel);
// PanelCtrl.instance.show(ExRecordPanel);
break;
case this.adBtn:
console.log('点击了广告');
break;
}
}
......@@ -121,11 +115,6 @@ export class UILayer extends Container {
this.ruleBtn.name = '规则';
topGroup.y = getAdjustTopHeight(topGroup, 117 / 1624);
// 广告按钮
this.adBtn = this.addChild(Tool.getSprite('广告.png'));
this.adBtn.position.set(30, (1624 - this.adBtn.height) / 2);
this.adBtn.name = '广告';
}
}
......@@ -4,9 +4,8 @@ import GameLayer from "../parts/Game/GameLayer";
import { UILayer } from "../parts/UI/UILayer";
import { Land } from "../parts/Game/Land";
import MouseEvent = FYGE.MouseEvent;
import FrameAni = FYGE.FrameAni;
import { RES } from "../../module/RES";
import { gameResource } from "../const/staticData";
import Sprite = FYGE.Sprite;
export class GameScene extends Scene {
......@@ -20,6 +19,9 @@ export class GameScene extends Scene {
// UI层
private uiLayer: UILayer;
// 广告按钮
private adBtn: Sprite; // 广告按钮
initUi() {
// 背景图
this.addChild(Tool.getSprite('game_bg.jpg'))
......@@ -36,6 +38,12 @@ export class GameScene extends Scene {
// 游戏层
this.gameLayer = this.addChild(GameLayer.ins);
// 广告按钮
this.adBtn = this.addChild(Tool.getSprite('广告.png'));
this.adBtn.position.set(30, (1624 - this.adBtn.height) / 2);
this.adBtn.name = '广告';
}
start() {
......@@ -43,12 +51,18 @@ export class GameScene extends Scene {
}
private ad(){
console.log('点击了广告');
}
initEvents() {
super.initEvents();
this.gameLayer.initEvent();
this.uiLayer.initEvents();
this.adBtn.addEventListener(MouseEvent.CLICK, this.ad, this);
}
removeEvents() {
......@@ -56,6 +70,8 @@ export class GameScene extends Scene {
this.gameLayer.removeEvent();
this.uiLayer.removeEvents();
this.adBtn.removeEventListener(MouseEvent.CLICK, this.ad, this);
}
......
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