Commit b6518e6f authored by haiyoucuv's avatar haiyoucuv

1

parent e2c7db6e
......@@ -3,8 +3,16 @@
<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/resource/skins/SelledPanelSkin.exml" beforeDir="false" afterPath="$PROJECT_DIR$/egret/resource/skins/SelledPanelSkin.exml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/Panels/SelledPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Panels/SelledPanel.ts" 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/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/components/ProgressNum.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/components/ProgressNum.ts" 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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -80,7 +88,7 @@
<workItem from="1575511989902" duration="370000" />
<workItem from="1575512375307" duration="22831000" />
<workItem from="1575602130550" duration="39482000" />
<workItem from="1575855730362" duration="36584000" />
<workItem from="1575855730362" duration="41160000" />
</task>
<servers />
</component>
......@@ -108,9 +116,9 @@
<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="1575942163065">
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1575947398722">
<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="1575942163065" />
<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" />
</component>
</project>
\ No newline at end of file
......@@ -26,7 +26,7 @@
<e:Label id="userGold" text="欢趣豆:23" x="78" y="41" size="20"/>
<e:Image id="medal" source="勋章_png" x="44" y="49" visible="false"/>
</e:Group>
<e:Button id="warehouseBtn" label="" x="339" verticalCenter="484.5">
<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"/>
......@@ -34,7 +34,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="taskBtn" label="" x="121.5" verticalCenter="484.5">
<e:Button id="taskBtn" label="" verticalCenter="484.5" horizontalCenter="-199.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="任务_png" source.down="任务_png" source.disabled="任务_png"/>
......
......@@ -16,7 +16,6 @@ import { Panels, Scenes, Tops } from "./types/Scenes";
import Bar from "./components/Bar";
let MainStage:egret.Stage = null;
console.log(MainStage);
export { MainStage };
class Main extends eui.UILayer {
......
......@@ -74,7 +74,7 @@ export default class SellPanel extends Panel {
this.numBar.x = this.width / 2 - this.numBar.width / 2;
this.numBar.y = 400;
this.sellBtn.enabled = false;
this.updateSellValue();
}
/**
......
......@@ -3,6 +3,7 @@ import { getSkinPath } from "../utils";
import TopLayerCtrl from "../ctrls/topLayerCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { IndexDispatcher } from "../Scenes/IndexScene/IndexScene";
export default class TaskPanel extends Panel {
public list: eui.List;
......@@ -37,11 +38,11 @@ export default class TaskPanel extends Panel {
private getTaskInfo() {
/// TODO 调用接口根据返回数据设置添加显示列表
NetManager.ins.getTaskInfo((success, res)=>{
if(!success){
NetManager.ins.getTaskInfo((success, res) => {
if(!success) {
return;
}
console.log(res);
console.log(res);
});
this.list.useVirtualLayout = false;
this.list.itemRenderer = TaskItem;
......@@ -92,11 +93,18 @@ class TaskItem extends eui.ItemRenderer {
/// TODO 根据需要设置btn监听事件
this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
TopLayerCtrl.instance.show(ModuleTypes.TASK_TOAST, {
title: "签到成功",
water: 10,
food: 30,
});
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);
}
}
......@@ -23,20 +23,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'
......@@ -89,10 +89,15 @@ export default class WareHousePanel extends Panel {
if(!success) {
return;
}
const data = res.data;
console.log(data);
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);
});
......
......@@ -3,25 +3,34 @@ import { GDispatchHideOption } from "./Objs/OptionPanel";
import PanelCtrl from "../../ctrls/panelCtrl";
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";
let propData = {
sp_food_1: {name: 'food',},
sp_food_2: {name: 'water',},
};
export default class IndexUI extends ComponentBase {
public uiLayer:eui.Group;
public btnGroup:eui.Group;
public taskBtn:eui.Button;
public warehouseBtn:eui.Button;
public propPanel:eui.Group;
public speedGroup:eui.Group;
public speedNum:eui.Label;
public foodGroup:eui.Group;
public foodNum:eui.Label;
public waterGroup:eui.Group;
public waterNum:eui.Label;
public avatarPanel:eui.Group;
public avatarImg:eui.Image;
public avatarMask:eui.Image;
public userName:eui.Label;
public userGold:eui.Label;
public medal:eui.Image;
public uiLayer: eui.Group;
public btnGroup: eui.Group;
public taskBtn: eui.Button;
public warehouseBtn: eui.Button;
public propPanel: eui.Group;
public speedGroup: eui.Group;
public speedNum: eui.Label;
public foodGroup: eui.Group;
public foodNum: eui.Label;
public waterGroup: eui.Group;
public waterNum: eui.Label;
public avatarPanel: eui.Group;
public avatarImg: eui.Image;
public avatarMask: eui.Image;
public userName: eui.Label;
public userGold: eui.Label;
public medal: eui.Image;
constructor() {
......@@ -80,12 +89,49 @@ export default class IndexUI extends ComponentBase {
private initUI(): void {
this.uiLayer.height = 750 / window.innerWidth * window.innerHeight;
this.touchEnabled = true;
/// TODO 根据数据初始化道具Panel
this.foodNum.text = "×" + 30;
this.waterNum.text = "×" + 30;
this.getPropInfo();
/// TODO 根据数据初始化头像Panel
//
this.warehouseBtn.anchorOffsetX = this.warehouseBtn.width / 2;
this.warehouseBtn.anchorOffsetY = this.warehouseBtn.height / 2;
IndexDispatcher.addEvent('warehouseEffect', this.warehouseEffect, this);
IndexDispatcher.addEvent('getPropInfo', this.getPropInfo, this);
}
private warehouseEffect() {
// 0s(100%,100%)-0.1s(120%,80%)-0.2s(100%,100%)
egret.Tween.removeTweens(this.warehouseBtn);
egret.Tween.get(this.warehouseBtn).to({scaleX: 1.2, scaleY: 0.8}, 100, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this.warehouseBtn).to({scaleX: 1, scaleY: 1}, 100, egret.Ease.quadInOut);
});
}
private getPropInfo() {
NetManager.ins.queryPrizeInfo((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);
}
}
data.forEach(v => {
this[`${propData[v.id].name}Num`].text = ${v.stock}`;
})
}, '');
}
destroy() {
super.destroy();
IndexDispatcher.removeEvent('warehouseEffect', this.warehouseEffect, this);
IndexDispatcher.removeEvent('getPropInfo', this.getPropInfo, this);
}
get skinKey() {
......
......@@ -166,29 +166,35 @@ export default class Crop extends eui.Component {
this.cropMv && this.removeChild(this.cropMv) && (this.cropMv = null);
let catherImg = new eui.Image(`${petData[this.petId]['catherImg']}_png`);
let dy = IndexIns().indexUI.height - IndexIns().group.height;
catherImg.x = IndexIns().landMgr.lands[this.index - 1].x + this.x + 100;
catherImg.y = IndexIns().landMgr.lands[this.index - 1].y + this.y - dy / 2 + 20;
catherImg.x = IndexIns().landMgr.lands[this.index - 1].x + this.x + 100 + 57 / 2;
catherImg.y = IndexIns().landMgr.lands[this.index - 1].y + this.y - dy / 2 + 40 + 63 / 2;
catherImg.anchorOffsetX = 57 / 2;
catherImg.anchorOffsetY = 63 / 2;
catherImg.scaleX = 0;
catherImg.scaleY = 0;
IndexIns().indexUI.addChild(catherImg);
// 移动
egret.Tween.get(catherImg).to({y: catherImg.y - 10}, 170).call(() => {
egret.Tween.get(catherImg).to({y: catherImg.y + 10}, 160, egret.Ease.quadInOut).wait(500).call(() => {
let _x = IndexIns().indexUI.warehouseBtn.x + 25 + 57 / 2;
let _y = IndexIns().indexUI.warehouseBtn.y + 35 + 63 / 2;
egret.Tween.get(catherImg).to({x: _x, y: _y}, 680);
});
});
// 缩放
egret.Tween.get(catherImg).to({scaleX: 1, scaleY: 1}, 170).wait(500).call(() => {
egret.Tween.get(catherImg).to({scaleX: 0.8, scaleY: 1.2}, 500).call(() => {
egret.Tween.get(catherImg).to({x: 0.8, y: 0.8}, 330);
});
});
egret.Tween.get(catherImg).to({y: catherImg.y - 10}, 170).call(() => {
egret.Tween.get(catherImg).to({y: catherImg.y + 10}, 160).wait(500).call(() => {
let _x = IndexIns().indexUI.warehouseBtn.x + 25;
let _y = IndexIns().indexUI.warehouseBtn.y + 35;
egret.Tween.get(catherImg).to({x: _x, y: _y}, 680);
});
});
// 透明度
egret.Tween.get(catherImg).wait(1470).to({alpha: 0}, 30).call(() => {
egret.Tween.removeTweens(catherImg);
IndexIns().indexUI.removeChild(catherImg);
SetGameLayerUpdate(true);
IndexDispatcher.dispatchEvent('updateIndex');
IndexDispatcher.dispatchEvent('warehouseEffect');
});
this.changePetId(CROP_TYPE.NONE);
......@@ -208,7 +214,7 @@ export default class Crop extends eui.Component {
this.optionMv && this.removeChild(this.optionMv) && (this.optionMv = null);
loadSvga(getSvga(petData[this.petId]['option'])).then(
(mv: egret.MovieClip) => {
mv.x = -10;
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, () => {
......@@ -261,16 +267,16 @@ export default class Crop extends eui.Component {
loadSvga(getSvga(`${petData[this.petId].key}${this.state}_birth`)).then(
(_mv: egret.MovieClip) => {
this.addChild(_mv);
_mv.x = -60;
_mv.y = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -165 : -140;
_mv.x = -65;
_mv.y = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -162 : -140;
_mv.addEventListener(egret.Event.COMPLETE, () => {
_mv.stop();
let name = `${petData[this.petId].key}${this.state}`;
loadSvga(getSvga(name)).then(
(mv: egret.MovieClip) => {
this.cropMv = mv;
this.cropMv.x = -60;
this.cropMv.y = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -165 : -140;
this.cropMv.x = -65;
this.cropMv.y = ((this.petId == CROP_TYPE.CHICKEN) || (this.petId == CROP_TYPE.CATTLE)) ? -162 : -140;
this.removeChild(_mv);
this.addChild(mv);
this.cropMv.pixelHitTest = true;
......
......@@ -12,7 +12,7 @@ export class ProgressNum extends eui.Component {
private data = null;
private total = 0; // 总个数
private number = 0; // 当前个数
private number = 1; // 当前个数
public get value() {
return this.number;
}
......@@ -24,7 +24,8 @@ export class ProgressNum extends eui.Component {
this.total = this.data.total;
this.numLabel.text = `${this.number}`;
// this.numLabel.text = `${this.number}`;
this.setHandX(0);
this.initEvents();
this.hand.anchorOffsetX = this.hand.width / 2;
......@@ -38,7 +39,7 @@ export class ProgressNum extends eui.Component {
}
private setHandX(x) {
let aWidth = this.bar.width / this.total;
let aWidth = this.bar.width / (this.total - 1);
let dx = x % aWidth; // 取余数
x = (~~(x / aWidth) + (dx >= (aWidth / 2) ? 1 : 0)) * aWidth; // 过半吸附
this.hand.x = x;
......@@ -48,12 +49,19 @@ export class ProgressNum extends eui.Component {
this.hand.x = this.bar.width;
}
this.number = ~~(this.hand.x / this.bar.width * this.total);
this.numLabel.text = `${this.number}`;
this.number = ~~(this.hand.x / this.bar.width * (this.total - 1) + 1);
this.setNumber();
IndexDispatcher.dispatchEvent('updateSellValue');
}
private setNumber(){
if(this.total == 0){
this.number = 0;
}
this.numLabel.text = `${this.number}`;
}
private groupTouchBegin(e: egret.TouchEvent) {
this.canMove = this.touchGroup.hitTestPoint(e.stageX, e.stageY);
if(this.canMove) {
......
......@@ -7,17 +7,17 @@
"id": 1,
"petId": 2,
"level": 1,
"canFeed": false,
"canFeed": true,
"feedLeftSeconds": 3,
"canGather": false
},
{
"id": 2,
"petId": 0,
"level": 4,
"canFeed": false,
"petId": 1,
"level": 1,
"canFeed": true,
"feedLeftSeconds": 4,
"canGather": true
"canGather": false
},
{
"id": 3,
......
......@@ -9,13 +9,31 @@
"stock": 100,
"type": 2
},
{
"degree": "10",
"icon": "//yun.dui88.com/projectxh5/credits-250-250.png",
"id": "sp_food_2",
"name": "加10积分",
"refType": "increase-credits",
"stock": 666,
"type": 2
},
{
"degree": "10",
"icon": "//yun.dui88.com/projectxh5/credits-250-250.png",
"id": "sp_2",
"name": "加10积分",
"refType": "increase-credits",
"stock": 3,
"stock": 0,
"type": 2
},
{
"degree": "10",
"icon": "//yun.dui88.com/projectxh5/credits-250-250.png",
"id": "sp_food_1",
"name": "加10积分",
"refType": "increase-credits",
"stock": 777,
"type": 2
}
],
......
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