Commit a1408f0e authored by haiyoucuv's avatar haiyoucuv

1

parent b6518e6f
No preview for this file type
......@@ -3,16 +3,31 @@
<component name="ChangeListManager">
<list default="true" id="9464afa6-0efb-46c2-9cfd-05475acd81df" 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$/egret/libs/tw/manager/NetManager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/libs/tw/manager/NetManager.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/index_scene/ui/仓库.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/升级至成熟.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/喂食.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/待喂养.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/待收取.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/待浇水.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/普通升级.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/svgas/浇水.svga" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/assets/task_panel/浇水.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/default.res.json" beforeDir="false" afterPath="$PROJECT_DIR$/egret/resource/default.res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/default.thm.json" beforeDir="false" afterPath="$PROJECT_DIR$/egret/resource/default.thm.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/skins/IndexUISkin.exml" beforeDir="false" afterPath="$PROJECT_DIR$/egret/resource/skins/IndexUISkin.exml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Main.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/skins/WareHouseSkin.exml" beforeDir="false" afterPath="$PROJECT_DIR$/egret/resource/skins/WareHouseSkin.exml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Panels/SellPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Panels/SellPanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Panels/TaskPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Panels/TaskPanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Panels/WareHousePanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Panels/WareHousePanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Scenes/IndexScene/IndexUI.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Scenes/IndexScene/IndexUI.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Scenes/IndexScene/Objs/Crop.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Scenes/IndexScene/Objs/Crop.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Scenes/IndexScene/Objs/Land.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Scenes/IndexScene/Objs/Land.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/components/ProgressNum.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/components/ProgressNum.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/utils.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/utils.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/mock/config.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/joyousManor/getLandInfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/joyousManor/getLandInfo.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/projectX/queryPrizeInfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/projectX/queryPrizeInfo.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/joyousManor/taskInfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/joyousManor/taskInfo.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -88,7 +103,7 @@
<workItem from="1575511989902" duration="370000" />
<workItem from="1575512375307" duration="22831000" />
<workItem from="1575602130550" duration="39482000" />
<workItem from="1575855730362" duration="41160000" />
<workItem from="1575855730362" duration="52200000" />
</task>
<servers />
</component>
......@@ -116,9 +131,14 @@
<screen x="36" y="23" width="1644" height="1027" />
</state>
<state x="659" y="460" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575620245218" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1575947398722">
<state x="534" y="291" width="648" height="490" key="find.popup" timestamp="1575964266686">
<screen x="36" y="23" width="1644" height="1027" />
</state>
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575947398722" />
<state x="534" y="291" width="648" height="490" key="find.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575964266686" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1575963155968">
<screen x="36" y="23" width="1644" height="1027" />
</state>
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575963155968" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027@36.23.1644.1027" timestamp="1575960048181" />
</component>
</project>
\ No newline at end of file
No preview for this file type
......@@ -2393,6 +2393,21 @@ export class NetManager extends ABNetManager {
this.send(net);
}
/**
* 查询用户拥有的道具
*/
public queryUserSpList(callback: Function) {
const net: INetData = {
name: NetName.QUERY_PRIZE_INFO,
uri: '/projectx/{projectId}/getUserSpList.query',
type: 'get',
dataType: 'json',
param: {},
callback: callback
};
this.send(net);
}
/**
* 查询优惠卷信息
* @param callback
......
No preview for this file type
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"bar","version":5,"files":["../assets/bar/bar_bg.png","../assets/bar/规则.png","../assets/bar/路径 2.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"common","version":5,"files":["../assets/common/closeBtn.png","../assets/common/light1.png","../assets/common/light.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"index_plant","version":5,"files":["../assets/index_scene/planting/篱笆.png","../assets/index_scene/planting/plant_cattle_1.png","../assets/index_scene/planting/plant_cattle_2.png","../assets/index_scene/planting/plant_chicken_1.png","../assets/index_scene/planting/plant_chicken_2.png","../assets/index_scene/planting/plant_corn_1.png","../assets/index_scene/planting/plant_corn_2.png","../assets/index_scene/planting/plant_land_active.png","../assets/index_scene/planting/plant_land_animal.png","../assets/index_scene/planting/plant_land_none.png","../assets/index_scene/planting/plant_land_plant.png","../assets/index_scene/planting/plant_wheat_1.png","../assets/index_scene/planting/plant_wheat_2.png","../assets/index_scene/planting/食槽.png","../assets/index_scene/planting/option/feed.png","../assets/index_scene/planting/option/feeding.png","../assets/index_scene/planting/option/hand.png","../assets/index_scene/planting/option/option_chicken.png","../assets/index_scene/planting/option/option_panel.png","../assets/index_scene/planting/option/option_wheat.png","../assets/index_scene/planting/option/water.png","../assets/index_scene/planting/option/watering.png","../assets/index_scene/planting/plant_cattle_3.png","../assets/index_scene/planting/plant_cattle_4.png","../assets/index_scene/planting/plant_chicken_3.png","../assets/index_scene/planting/plant_chicken_4.png","../assets/index_scene/planting/plant_corn_3.png","../assets/index_scene/planting/plant_wheat_3.png","../assets/index_scene/planting/麦粉.png","../assets/index_scene/planting/鸡蛋.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"index_scene","version":5,"files":["../assets/index_scene/index_bg.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"index_ui","version":5,"files":["../assets/index_scene/ui/兑换记录.png","../assets/index_scene/ui/浇水.png","../assets/index_scene/ui/流水装饰.png","../assets/index_scene/ui/默认头像.png","../assets/index_scene/ui/任务.png","../assets/index_scene/ui/商店.png","../assets/index_scene/ui/饲料.png","../assets/index_scene/ui/头像背景.png","../assets/index_scene/ui/勋章.png","../assets/index_scene/ui/头像面板.png","../assets/index_scene/ui/加速卡.png","../assets/index_scene/ui/仓库_btn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"loading","version":5,"files":["../assets/loading/progress.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"loading_scene","version":5,"files":["../assets/loading/progress.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"sellRecord","version":5,"files":["../assets/warehouse_panel/sellRecord/sellRecord_outline.png","../assets/warehouse_panel/sellRecord/sellRecord_bg.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"sell_panel","version":5,"files":["../assets/warehouse_panel/sell_panel/sellTitle_wheat.png","../assets/warehouse_panel/sell_panel/sellTitle_egg.png","../assets/warehouse_panel/sell_panel/sell_btn_en.png","../assets/warehouse_panel/sell_panel/sell_btn_dis.png","../assets/warehouse_panel/sell_panel/sell_bg.png","../assets/warehouse_panel/sell_panel/out_line.png","../assets/warehouse_panel/sell_panel/+_en.png","../assets/warehouse_panel/sell_panel/+_dis.png","../assets/warehouse_panel/sell_panel/-_en.png","../assets/warehouse_panel/sell_panel/-_dis.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"selled_panel","version":5,"files":["../assets/warehouse_panel/selled/selled_btn.png","../assets/warehouse_panel/selled/selled_bg.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"task_panel","version":5,"files":["../assets/task_panel/task_bg.png","../assets/task_panel/task_item_bg.png","../assets/task_panel/饲料 拷贝.png","../assets/task_panel/task_brn_bg.png","../assets/task_panel/task_toast.png","../assets/task_panel/签到 icon.png","../assets/task_panel/消费 icon.png","../assets/task_panel/生活日 icon.png","../assets/task_panel/分享 icon.png","../assets/task_panel/浇水2.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"warehouse","version":5,"files":["../assets/warehouse_panel/corn_bg.png","../assets/warehouse_panel/egg_bg.png","../assets/warehouse_panel/milk_bg.png","../assets/warehouse_panel/仓库.png","../assets/warehouse_panel/兑换.png","../assets/warehouse_panel/出售.png","../assets/warehouse_panel/出售记录.png","../assets/warehouse_panel/warehouse_none.png","../assets/warehouse_panel/wheat_bg.png"]}
\ No newline at end of file
......@@ -17,7 +17,7 @@
"name": "index_scene"
},
{
"keys": "仓库_png,兑换记录_png,浇水_png,流水装饰_png,默认头像_png,任务_png,商店_png,饲料_png,头像背景_png,勋章_png,头像面板_png,加速卡_png",
"keys": "兑换记录_png,浇水_png,流水装饰_png,默认头像_png,任务_png,商店_png,饲料_png,头像背景_png,勋章_png,头像面板_png,加速卡_png,仓库_btn_png",
"name": "index_ui"
},
{
......@@ -25,11 +25,11 @@
"name": "index_plant"
},
{
"keys": "task_bg_png,task_item_bg_png,浇水2_png,饲料 拷贝_png,task_brn_bg_png,task_toast_png",
"keys": "task_bg_png,task_item_bg_png,饲料 拷贝_png,task_brn_bg_png,task_toast_png,签到 icon_png,消费 icon_png,生活日 icon_png,分享 icon_png,浇水2_png",
"name": "task_panel"
},
{
"keys": "corn_bg_png,egg_bg_png,milk_bg_png,仓库2_png,兑换_png,出售_png,出售记录_png,warehouse_none_png,wheat_bg_png",
"keys": "corn_bg_png,egg_bg_png,milk_bg_png,仓库_png,兑换_png,出售_png,出售记录_png,warehouse_none_png,wheat_bg_png",
"name": "warehouse"
},
{
......@@ -65,11 +65,6 @@
"type": "image",
"name": "index_bg_png"
},
{
"url": "assets/index_scene/ui/仓库.png",
"type": "image",
"name": "仓库_png"
},
{
"url": "assets/index_scene/ui/兑换记录.png",
"type": "image",
......@@ -250,11 +245,6 @@
"type": "image",
"name": "task_item_bg_png"
},
{
"url": "assets/task_panel/浇水.png",
"type": "image",
"name": "浇水2_png"
},
{
"url": "assets/task_panel/饲料 拷贝.png",
"type": "image",
......@@ -368,7 +358,7 @@
{
"url": "assets/warehouse_panel/仓库.png",
"type": "image",
"name": "仓库2_png"
"name": "仓库_png"
},
{
"url": "assets/warehouse_panel/兑换.png",
......@@ -449,6 +439,36 @@
"url": "assets/index_scene/planting/鸡蛋.png",
"type": "image",
"name": "鸡蛋_png"
},
{
"url": "assets/task_panel/签到 icon.png",
"type": "image",
"name": "签到 icon_png"
},
{
"url": "assets/task_panel/消费 icon.png",
"type": "image",
"name": "消费 icon_png"
},
{
"url": "assets/task_panel/生活日 icon.png",
"type": "image",
"name": "生活日 icon_png"
},
{
"url": "assets/task_panel/分享 icon.png",
"type": "image",
"name": "分享 icon_png"
},
{
"url": "assets/index_scene/ui/仓库_btn.png",
"type": "image",
"name": "仓库_btn_png"
},
{
"url": "assets/task_panel/浇水2.png",
"type": "image",
"name": "浇水2_png"
}
]
}
\ No newline at end of file
{
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/IndexUISkin.exml",
"resource/skins/IndexSceneSkin.exml",
"resource/skins/LoadingSceneSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/RulePanelSkin.exml",
"resource/skins/SelledPanelSkin.exml",
"resource/skins/SellPanelSkin.exml",
"resource/skins/SellRecordItemSkin.exml",
"resource/skins/SellRecordSkin.exml",
"resource/skins/TaskToastSkin.exml",
"resource/skins/TaskPanelSkin.exml",
"resource/skins/ToastPanelSkin.exml",
"resource/skins/WareHouseSkin.exml",
"resource/skins/TaskItemSkin.exml",
"resource/skins/Objs/OptionPanelSkin.exml",
"resource/skins/Objs/CropSkin.exml",
"resource/skins/Objs/LandSkin.exml",
"resource/skins/Component/BarSkin.exml",
"resource/skins/Component/ProgressNumSkin.exml",
"resource/skins/Component/TimeProgressBarSkin.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml"
],
"path": "resource/default.thm.json"
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/IndexSceneSkin.exml",
"resource/skins/IndexUISkin.exml",
"resource/skins/LoadingSceneSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/RulePanelSkin.exml",
"resource/skins/SellPanelSkin.exml",
"resource/skins/SellRecordItemSkin.exml",
"resource/skins/SellRecordSkin.exml",
"resource/skins/SelledPanelSkin.exml",
"resource/skins/TaskItemSkin.exml",
"resource/skins/TaskPanelSkin.exml",
"resource/skins/TaskToastSkin.exml",
"resource/skins/ToastPanelSkin.exml",
"resource/skins/WareHouseSkin.exml",
"resource/skins/Component/BarSkin.exml",
"resource/skins/Component/ProgressNumSkin.exml",
"resource/skins/Component/TimeProgressBarSkin.exml",
"resource/skins/Objs/CropSkin.exml",
"resource/skins/Objs/LandSkin.exml",
"resource/skins/Objs/OptionPanelSkin.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml"
],
"path": "resource/default.thm.json"
}
\ No newline at end of file
......@@ -29,7 +29,7 @@
<e:Button id="warehouseBtn" label="" verticalCenter="484.5" horizontalCenter="17.5" anchorOffsetX="53.5" anchorOffsetY="60.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="仓库_png" source.down="仓库_png" source.disabled="仓库_png"/>
<e:Image width="100%" height="100%" source="仓库_btn_png" source.down="仓库_btn_png" source.disabled="仓库_btn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="750" height="715" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image horizontalCenter="0" y="114" source="仓库2_png"/>
<e:Image horizontalCenter="0" y="114" source="仓库_png"/>
<e:Image id="closeBtn" source="closeBtn_png" x="642" y="0"/>
<e:Image id="record_btn" source="出售记录_png" x="318" y="197"/>
<e:Image id="noneImg" source="warehouse_none_png" x="138" y="253" visible="false"/>
......
......@@ -61,6 +61,7 @@ export default class SellPanel extends Panel {
this.key = this.data.key;
this.total = this.data.total;
console.log(this.data);
let d = spData[this.key];
this.infoLabel.text = `一${spData[this.key].numLabel}${spData[this.key].nameLabel}=50个欢趣豆`;
......
......@@ -5,6 +5,31 @@ import { ModuleTypes } from "../types/sceneTypes";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { IndexDispatcher } from "../Scenes/IndexScene/IndexScene";
let taskUi = {
1: {
icon: '签到 icon_png',
btnLabel: '去签到',
label: '每日签到'
},
2: {
icon: '分享 icon_png',
btnLabel: '去分享',
label: '分享给好友'
},
3: {
icon: '消费 icon_png',
btnLabel: '去完成',
label: '访问欢趣派对',
link: 'https://gonghang.activity-1.m.duiba.com.cn/projectx/p0f8b79c7/index.html'
},
4: {
icon: '生活日 icon_png',
btnLabel: '去完成',
label: '访问欢趣市集',
link: 'https://gonghang.activity-1.m.duiba.com.cn/hdtool/index?id=3737984&dbnewopen'
},
};
export default class TaskPanel extends Panel {
public list: eui.List;
......@@ -37,16 +62,16 @@ export default class TaskPanel extends Panel {
}
private getTaskInfo() {
/// TODO 调用接口根据返回数据设置添加显示列表
NetManager.ins.getTaskInfo((success, res) => {
if(!success) {
return;
}
console.log(res);
let data = res.data;
this.list.useVirtualLayout = false;
this.list.itemRenderer = TaskItem;
this.list.dataProvider = new eui.ArrayCollection(data);
});
this.list.useVirtualLayout = false;
this.list.itemRenderer = TaskItem;
this.list.dataProvider = new eui.ArrayCollection([1, 2, 3, 4, 5]);
}
}
......@@ -79,32 +104,35 @@ class TaskItem extends eui.ItemRenderer {
* TODO 如果没有食物奖励则将foodGroup隐藏,并将waterGroup靠前
* TODO 如果没有奖励则隐藏prizeGroup
*/
this.icon.source = taskUi[this.data.id].icon;
this.title.text = taskUi[this.data.id].label;
this.setBtn();
}
// 9a9a9a
// ffffff
private setBtn() {
/// TODO 根据数据设置按钮
/// TODO 如 已完成则btn_label.text = '已领取', 且btn_label.color = 0x9a9a9a,btn_bg.visible = false
/// TODO 如 未完成则根据数据设置btn_label.text, 且btn_label.color = 0xffffff,btn_bg.visible = true
/// TODO 根据需要设置btn监听事件
this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.doTask((success, res) => {
if(!success) {
return;
}
TopLayerCtrl.instance.show(ModuleTypes.TASK_TOAST, {
title: "签到成功",
water: 10,
food: 30,
});
IndexDispatcher.dispatchEvent('getPropInfo');
}, ''); /// TODO !!!!! taskId !!!!!
}, this);
this.btn_label.text = (this.data.status == 0) ? taskUi[this.data.id].btnLabel : '已领取';
this.btn_label.textColor = (this.data.status == 0) ? 0xffffff : 0x9a9a9a;
this.btn_bg.visible = (this.data.status == 0);
if(this.data.status == 0) {
this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.doTask((success, res) => {
if(!success) {
return;
}
TopLayerCtrl.instance.show(ModuleTypes.TASK_TOAST, {
title: "签到成功",
water: 10,
food: 30,
});
IndexDispatcher.dispatchEvent('getPropInfo');
}, this.data.id);
}, this);
}
}
}
......@@ -3,6 +3,7 @@ import TopLayerCtrl from "../ctrls/topLayerCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { showToast } from "../comm/UtilsConst";
import PanelCtrl from "../ctrls/panelCtrl";
export let spData = {
'sp_1': { // 鸡蛋
......@@ -23,20 +24,20 @@ export let spData = {
export default class WareHousePanel extends Panel {
public closeBtn:eui.Image;
public record_btn:eui.Image;
public noneImg:eui.Image;
public cropGroup:eui.Group;
public egg_group:eui.Group;
public egg_bg:eui.Image;
public egg_sell_btn:eui.Image;
public egg_label:eui.Label;
public egg_ex_btn:eui.Image;
public wheat_group:eui.Group;
public wheat_bg:eui.Image;
public wheat_sell_btn:eui.Image;
public wheat_label:eui.Label;
public wheat_ex_btn:eui.Image;
public closeBtn: eui.Image;
public record_btn: eui.Image;
public noneImg: eui.Image;
public cropGroup: eui.Group;
public egg_group: eui.Group;
public egg_bg: eui.Image;
public egg_sell_btn: eui.Image;
public egg_label: eui.Label;
public egg_ex_btn: eui.Image;
public wheat_group: eui.Group;
public wheat_bg: eui.Image;
public wheat_sell_btn: eui.Image;
public wheat_label: eui.Label;
public wheat_ex_btn: eui.Image;
public get skinKey() {
return 'WareHouse'
......@@ -85,26 +86,23 @@ export default class WareHousePanel extends Panel {
private getWareHouseInfo() {
/// TODO 调用接口根据返回数据设置添加显示列表
NetManager.ins.queryPrizeInfo((success, res) => {
NetManager.ins.queryUserSpList((success, res) => {
if(!success) {
return;
}
let data = res.data;
for(let i = 0; i < data.length; i++) {
if(data[i].id.indexOf('food') !== -1) {
data.splice(i, 1);
}
}
for(let v of data) {
this[`${spData[v.id].name}_label`].text = `数量:${v.stock}`;
console.log(spData[v.id].name);
this[`${spData[v.id].name}_sell_btn`].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
TopLayerCtrl.instance.show(ModuleTypes.SELL_PANEL, {key: v.id, total: v.stock}, .4);
console.log(res);
const data = res.data;
for(let k in spData) {
this[`${spData[k].name}_label`].text = `数量:${data[k]}`;
this[`${spData[k].name}_sell_btn`].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
PanelCtrl.instance.btnDelay(this[`${spData[k].name}_sell_btn`]);
TopLayerCtrl.instance.show(ModuleTypes.SELL_PANEL, {key: k, total: data[k]}, .4);
});
this[`${spData[v.id].name}_ex_btn`].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this[`${spData[k].name}_ex_btn`].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
PanelCtrl.instance.btnDelay(this[`${spData[k].name}_ex_btn`]);
showToast('欢趣商店待开放,过段日子再来吧~');
});
}
}, '');
});
}
}
......@@ -5,10 +5,9 @@ import { ModuleTypes } from "../../types/sceneTypes";
import { showToast } from "../../comm/UtilsConst";
import { IndexDispatcher } from "./IndexScene";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import TopLayerCtrl from "../../ctrls/topLayerCtrl";
import { spData } from "../../Panels/WareHousePanel";
import { DataManager } from "../../../libs/tw/manager/DataManager";
let propData = {
export let propData = {
sp_food_1: {name: 'food',},
sp_food_2: {name: 'water',},
};
......@@ -112,20 +111,15 @@ export default class IndexUI extends ComponentBase {
}
private getPropInfo() {
NetManager.ins.queryPrizeInfo((success, res) => {
NetManager.ins.queryUserSpList((success, res) => {
if(!success) {
return;
}
let data = res.data;
for(let i = 0; i < data.length; i++) {
if(data[i].id.indexOf('food') === -1) {
data.splice(i, 1);
}
for(let k in propData){
this[`${propData[k].name}Num`].text = '× ' + data[k];
}
data.forEach(v => {
this[`${propData[v.id].name}Num`].text = ${v.stock}`;
})
}, '');
});
}
destroy() {
......
......@@ -3,6 +3,9 @@ import TimeProgressBar from "../TimeProgressBar";
import { IndexDispatcher, IndexIns, SetGameLayerUpdate } from "../IndexScene";
import { loadSvga } from "../../../comm/loadSvga";
import { NetManager } from "../../../../libs/tw/manager/NetManager";
import { showToast } from "../../../comm/UtilsConst";
import { DataManager } from "../../../../libs/tw/manager/DataManager";
import { NetName } from "../../../../libs/tw/enum/NetName";
enum CROP_TYPE {
NONE = 0, // 啥也没有
......@@ -14,10 +17,10 @@ enum CROP_TYPE {
let petData = {
0: {key: null, optionImg: null}, // 啥也没有
1: {key: 'chicken', svga: 'feed_png', optionSvga: '待喂养', option: '喂食', catherImg: '鸡蛋'}, // 鸡
2: {key: 'wheat', svga: 'water_png', optionSvga: '待浇水', option: '浇水', catherImg: '麦粉'}, // 小麦
3: {key: 'cattle', svga: 'feed_png', optionSvga: '待喂养', option: '喂食'}, // 牛
4: {key: 'corn', svga: 'water_png', optionSvga: '待浇水', option: '浇水'}, // 玉米
1: {key: 'chicken', prop: 'food', svga: 'feed_png', optionSvga: 'ready_feed', option: 'feed', catherImg: '鸡蛋'}, // 鸡
2: {key: 'wheat', prop: 'water', svga: 'water_png', optionSvga: 'ready_water', option: 'water', catherImg: '麦粉'}, // 小麦
3: {key: 'cattle', prop: 'food', svga: 'feed_png', optionSvga: 'ready_feed', option: 'feed'}, // 牛
4: {key: 'corn', prop: 'water', svga: 'water_png', optionSvga: 'ready_water', option: 'water'}, // 玉米
};
enum CROP_STATE {
......@@ -103,8 +106,8 @@ export default class Crop extends eui.Component {
private initUI() {
let {petId, level, canFeed, feedLeftSeconds, canGather} = this.data.data;
this.changePetId(petId);
this.changeState(level);
this.changePetId(petId || 0);
this.changeState(level || 0);
this.addCropSvga().then(() => {
if(this.petId != CROP_TYPE.NONE) {
......@@ -131,7 +134,7 @@ export default class Crop extends eui.Component {
switch(this.option) {
case OPTION.GATHER:
this.touchEnabled = true;
this.addOption('待收取');
this.addOption('ready_get');
break;
case OPTION.FEED:
this.touchEnabled = true;
......@@ -206,27 +209,38 @@ export default class Crop extends eui.Component {
case OPTION.FEED:
SetGameLayerUpdate(false);
this.touchEnabled = false;
NetManager.ins.doFeed((success, res) => {
if(!success) {
SetGameLayerUpdate(true);
return;
}
this.optionMv && this.removeChild(this.optionMv) && (this.optionMv = null);
loadSvga(getSvga(petData[this.petId]['option'])).then(
(mv: egret.MovieClip) => {
mv.x = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -30 : 10;
mv.y = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -30 : -120;
this.addChild(mv);
mv.addEventListener(egret.Event.COMPLETE, () => {
mv.stop();
this.removeChild(mv);
SetGameLayerUpdate(true);
this.changeOption(OPTION.NONE);
IndexDispatcher.dispatchEvent('updateIndex');
}, this);
let feedNum = this.data.data.feedNum;
let haveNum = DataManager.ins.getData(petData[this.petId]['prop']);
console.log(feedNum, haveNum);
if(feedNum < haveNum) {
let msg = ((petData[this.petId]['prop'] == 'food') ? '饲料' : '水壶') + '不够了,快去做任务吧';
showToast(msg);
SetGameLayerUpdate(true);
} else {
NetManager.ins.doFeed((success, res) => {
if(!success) {
let msg = ((petData[this.petId]['prop'] == 'food') ? '饲料' : '水壶') + '不够了,快去做任务吧';
showToast(msg);
SetGameLayerUpdate(true);
return;
}
)
}, this.index);
this.optionMv && this.removeChild(this.optionMv) && (this.optionMv = null);
loadSvga(getSvga(petData[this.petId]['option'])).then(
(mv: egret.MovieClip) => {
mv.x = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -30 : 10;
mv.y = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -30 : -120;
this.addChild(mv);
mv.addEventListener(egret.Event.COMPLETE, () => {
mv.stop();
this.removeChild(mv);
SetGameLayerUpdate(true);
this.changeOption(OPTION.NONE);
IndexDispatcher.dispatchEvent('updateIndex');
}, this);
}
)
}, this.index);
}
break;
case OPTION.PROGRESS:
egret.Tween.removeTweens(this.progressBar);
......@@ -250,14 +264,14 @@ export default class Crop extends eui.Component {
this.optionMv && this.removeChild(this.optionMv) && (this.optionMv = null);
let _name = '';
if((this.petId == 2 && this.state == 3) || this.petId == 1 && this.state == 4) {
_name = '升级至成熟';
_name = 'up2';
} else {
_name = '普通升级';
_name = 'up1';
}
loadSvga(getSvga(_name)).then(
(mv: egret.MovieClip) => {
mv.x = (_name == '升级至成熟') ? 0 : 10;
mv.y = (_name == '升级至成熟') ? -35 : 20;
mv.x = (_name == 'up2') ? 0 : 10;
mv.y = (_name == 'up2') ? -35 : 20;
this.addChild(mv);
mv.addEventListener(egret.Event.COMPLETE, () => {
this.removeChild(mv);
......
......@@ -56,12 +56,14 @@ export default class Land extends eui.Component {
const landData = this.data.data;
/// TODO 根据数据添加Crop 初始化状态
if(landData.petId != 0) {
if(landData.petId) {
if(landData.petId == 1) {
this.changeState(LAND_STATE.ANIMAL);
} else {
this.changeState(LAND_STATE.PLANT);
}
} else {
this.changeState(LAND_STATE.NONE);
}
this.crop && this.crop.updateDate(this.data);
}
......@@ -103,12 +105,14 @@ export default class Land extends eui.Component {
const landData = this.data.data;
/// TODO 根据数据添加Crop 初始化状态
if(landData.petId != 0) {
if(landData.petId) {
if(landData.petId == 1) {
this.changeState(LAND_STATE.ANIMAL);
} else {
this.changeState(LAND_STATE.PLANT);
}
} else {
this.changeState(LAND_STATE.NONE);
}
this.crop = new Crop(this.data);
this.addChildAt(this.crop, 2);
......
......@@ -40,6 +40,9 @@ export class ProgressNum extends eui.Component {
private setHandX(x) {
let aWidth = this.bar.width / (this.total - 1);
if(aWidth == Infinity){
aWidth = this.bar.width;
}
let dx = x % aWidth; // 取余数
x = (~~(x / aWidth) + (dx >= (aWidth / 2) ? 1 : 0)) * aWidth; // 过半吸附
this.hand.x = x;
......@@ -49,14 +52,14 @@ export class ProgressNum extends eui.Component {
this.hand.x = this.bar.width;
}
this.number = ~~(this.hand.x / this.bar.width * (this.total - 1) + 1);
this.number = ~~(this.hand.x / aWidth) + 1 // * (this.total) + 1);
this.setNumber();
IndexDispatcher.dispatchEvent('updateSellValue');
}
private setNumber(){
if(this.total == 0){
private setNumber() {
if(this.total == 0) {
this.number = 0;
}
this.numLabel.text = `${this.number}`;
......
export const getResPath = () => window['resPath'] || '';
export const getSkinPath = (key)=>`resource/skins/${key}Skin.exml`;
export const getSvga = (name)=> `resource/assets/svgas/${name}.svga`;
\ No newline at end of file
export const getSvga = (name)=> getResPath() + `resource/assets/svgas/${name}.svga`;
\ No newline at end of file
......@@ -269,17 +269,15 @@ const config = {
'/hdtool/rank/rankInfo': {
data: './json/rankInfo.json'
},
'/projectx/{projectId}/prize.query': { // 土地信息
'/projectx/{projectId}/getUserSpList.query': { // 任务信息
data: './projectX/getUserSpList.json'
},
'/projectx/{projectId}/prize.query': {
data: './projectX/queryPrizeInfo.json'
},
// '/projectx/{projectId}/join_1/landInfo.do': { // 土地信息
// data: './joyousManor/getLandInfo.json'
// },
// '/projectx/{projectId}/join_1/landInfo.do': { // 土地信息
// data: './joyousManor/getLandInfo.json'
// },
// 欢趣庄园
'/projectx/{projectId}/join_1/landInfo.do': { // 土地信息
......
{
"success": true,
"message": "",
"code": "",
"code": null,
"data": [
{
"canFeed": false,
"canGather": false,
"feedLeftSeconds": 42,
"id": 1,
"petId": 2,
"level": 1,
"canFeed": true,
"feedLeftSeconds": 3,
"canGather": false
"level": 2,
"petId": 1,
"feedNum": 889
},
{
"id": 2,
"petId": 1,
"level": 1,
"canFeed": true,
"feedLeftSeconds": 4,
"canGather": false
"canGather": false,
"feedLeftSeconds": 0,
"id": 2,
"level": 3,
"petId": 2,
"feedNum": 99
},
{
"canFeed": false,
"canGather": false,
"feedLeftSeconds": 0,
"id": 3,
"petId": 2,
"level": 2,
"canFeed": true,
"feedLeftSeconds": 10,
"canGather": true
"level": null,
"petId": null,
"feedNum": 888
},
{
"canFeed": false,
"canGather": false,
"feedLeftSeconds": 38,
"id": 4,
"petId": 1,
"level": 4,
"canFeed": true,
"feedLeftSeconds": 0,
"canGather": true
"level": 2,
"petId": 2,
"feedNum": 30
}
]
],
"message": null,
"success": true
}
\ No newline at end of file
......@@ -12,6 +12,20 @@
},
{
"id": 2,
"type": 0,
"sp1RewardCount": 60,
"sp2RewardCount": 50,
"status": 1
},
{
"id": 3,
"type": 1,
"sp1RewardCount": 60,
"sp2RewardCount": 50,
"status": 1
},
{
"id": 4,
"type": 1,
"sp1RewardCount": 60,
"sp2RewardCount": 50,
......
{
"success": true,
"message": null,
"code": null,
"data": {
"sp_1": 1,
"sp_2": 0,
"sp_food_1": 999,
"sp_food_2": 888,
"sp_task_1": 10,
"sp_task_2": 100
}
}
\ No newline at end of file
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