Commit 43775945 authored by haiyoucuv's avatar haiyoucuv

guide

parent ec1680f1
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{ {
"image": "https://source.unsplash.com/user/erondu/250x250", "image": "https://source.unsplash.com/user/erondu/250x250",
"amount": 20, "amount": 20,
"drawStatus": 4, "drawStatus": 3,
"openId": "AAEAuNyCAKrpWdzBzedO22-F", "openId": "AAEAuNyCAKrpWdzBzedO22-F",
"remark": "订购应用已过期,请联系商家处理", "remark": "订购应用已过期,请联系商家处理",
"updateTime": 1591775841679, "updateTime": 1591775841679,
......
{
"success": true,
"message": "ok",
"data": true
}
{
"success":true,
"data":{
"guideIsEnd":false,
"guideStep":3,
"waterDrops":100,
"plants":[
{
"index":1,
"plant":false,
"level":"",
"plantType":"",
"waterTime":"",
"waterRestCount":""
},
{
"index":2,
"plant":true,
"level":1,
"plantType":"PEANUT",
"waterTime":5000,
"waterRestCount":1,
"totalTime":5000
},
{
"index":3,
"plant":false,
"level":"",
"plantType":"",
"waterTime":"",
"waterRestCount":""
},
{
"index":4,
"plant":false,
"level":"",
"plantType":"",
"waterTime":"",
"waterRestCount":""
}
]
}
}
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
"success": true, "success": true,
"data": { "data": {
"guideIsEnd": false, "guideIsEnd": false,
"guideStep": 3, "guideStep": 1,
"waterDrops": 100, "waterDrops": 100,
"plants": [ "plants": [
{ {
"index": 1, "index": 1,
"plant": true, "plant": false,
"level": 3, "level": 3,
"plantType": "PEANUT", "plantType": "PEANUT",
"waterTime": 1591891173326, "waterTime": 1591891173326,
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
}, },
{ {
"index": 2, "index": 2,
"plant": true, "plant": false,
"level": 1, "level": 1,
"plantType": "CASHEWNUT", "plantType": "CASHEWNUT",
"waterTime": 1591891173326, "waterTime": 1591891173326,
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
}, },
{ {
"index": 3, "index": 3,
"plant": true, "plant": false,
"level": 1, "level": 1,
"plantType": "PECAN", "plantType": "PECAN",
"waterTime": 1591891173326, "waterTime": 1591891173326,
......
This diff is collapsed.
...@@ -6330,9 +6330,31 @@ ...@@ -6330,9 +6330,31 @@
} }
}, },
{ {
"keys": "record_icon.png,record_item_bg.png", "keys": "record_dis.png,record_en.png,record_icon.png,record_item_bg.png",
"name": "exRecordPanel", "name": "exRecordPanel",
"atlas": { "atlas": {
"record_dis.png": {
"x": 851,
"y": 70,
"w": 129,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 129,
"sh": 66,
"ro": false
},
"record_en.png": {
"x": 851,
"y": 2,
"w": 129,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 129,
"sh": 66,
"ro": false
},
"record_icon.png": { "record_icon.png": {
"x": 657, "x": 657,
"y": 2, "y": 2,
...@@ -6425,7 +6447,7 @@ ...@@ -6425,7 +6447,7 @@
} }
}, },
{ {
"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", "name": "gameScene",
"atlas": { "atlas": {
"btn_仓库.png": { "btn_仓库.png": {
...@@ -6604,17 +6626,6 @@ ...@@ -6604,17 +6626,6 @@
"sh": 34, "sh": 34,
"ro": false "ro": false
}, },
"种植框_山核桃.png": {
"x": 957,
"y": 367,
"w": 35,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 35,
"sh": 44,
"ro": true
},
"种植框_开心果.png": { "种植框_开心果.png": {
"x": 448, "x": 448,
"y": 470, "y": 470,
...@@ -6637,6 +6648,17 @@ ...@@ -6637,6 +6648,17 @@
"sh": 41, "sh": 41,
"ro": false "ro": false
}, },
"种植框_核桃.png": {
"x": 957,
"y": 367,
"w": 35,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 35,
"sh": 44,
"ro": true
},
"种植框_瓜子.png": { "种植框_瓜子.png": {
"x": 950, "x": 950,
"y": 461, "y": 461,
...@@ -6705,6 +6727,34 @@ ...@@ -6705,6 +6727,34 @@
} }
} }
}, },
{
"keys": "guide_bg.png,guide_btn.png",
"name": "guidePanel",
"atlas": {
"guide_bg.png": {
"x": 2,
"y": 2,
"w": 738,
"h": 804,
"ox": 5,
"oy": 410,
"sw": 750,
"sh": 1624,
"ro": false
},
"guide_btn.png": {
"x": 2,
"y": 808,
"w": 400,
"h": 76,
"ox": 0,
"oy": 0,
"sw": 400,
"sh": 76,
"ro": false
}
}
},
{ {
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png", "keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene", "name": "loadingScene",
...@@ -6960,7 +7010,7 @@ ...@@ -6960,7 +7010,7 @@
} }
}, },
{ {
"keys": "wareHouse_icon.png,wareHouse_item_bg.png,wareHouse_山核桃.png,wareHouse_开心果.png,wareHouse_板栗.png,wareHouse_瓜子.png,wareHouse_腰果.png,wareHouse_花生.png", "keys": "wareHouse_icon.png,wareHouse_item_bg.png,wareHouse_开心果.png,wareHouse_板栗.png,wareHouse_核桃.png,wareHouse_瓜子.png,wareHouse_腰果.png,wareHouse_花生.png",
"name": "wareHouse", "name": "wareHouse",
"atlas": { "atlas": {
"wareHouse_icon.png": { "wareHouse_icon.png": {
...@@ -6985,17 +7035,6 @@ ...@@ -6985,17 +7035,6 @@
"sh": 328, "sh": 328,
"ro": false "ro": false
}, },
"wareHouse_山核桃.png": {
"x": 316,
"y": 2,
"w": 140,
"h": 164,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 164,
"ro": false
},
"wareHouse_开心果.png": { "wareHouse_开心果.png": {
"x": 458, "x": 458,
"y": 156, "y": 156,
...@@ -7018,6 +7057,17 @@ ...@@ -7018,6 +7057,17 @@
"sh": 152, "sh": 152,
"ro": false "ro": false
}, },
"wareHouse_核桃.png": {
"x": 316,
"y": 2,
"w": 140,
"h": 164,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 164,
"ro": false
},
"wareHouse_瓜子.png": { "wareHouse_瓜子.png": {
"x": 458, "x": 458,
"y": 308, "y": 308,
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
"name": "common" "name": "common"
}, },
{ {
"keys": "record_icon.png,record_item_bg.png", "keys": "record_dis.png,record_en.png,record_icon.png,record_item_bg.png",
"name": "exRecordPanel" "name": "exRecordPanel"
}, },
{ {
...@@ -92,6 +92,10 @@ ...@@ -92,6 +92,10 @@
"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" "name": "gameScene"
}, },
{
"keys": "guide_bg.png,guide_btn.png",
"name": "guidePanel"
},
{ {
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png", "keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene" "name": "loadingScene"
...@@ -117,7 +121,7 @@ ...@@ -117,7 +121,7 @@
"name": "taskPanel" "name": "taskPanel"
}, },
{ {
"keys": "wareHouse_icon.png,wareHouse_item_bg.png,wareHouse_山核桃.png,wareHouse_开心果.png,wareHouse_板栗.png,wareHouse_瓜子.png,wareHouse_腰果.png,wareHouse_花生.png", "keys": "wareHouse_icon.png,wareHouse_item_bg.png,wareHouse_开心果.png,wareHouse_板栗.png,wareHouse_核桃.png,wareHouse_瓜子.png,wareHouse_腰果.png,wareHouse_花生.png",
"name": "wareHouse" "name": "wareHouse"
} }
], ],
......
This diff is collapsed.
...@@ -41,8 +41,12 @@ export enum TbNetName { ...@@ -41,8 +41,12 @@ export enum TbNetName {
exchangeGoods = 'qiaqia2.exchangeGoods', exchangeGoods = 'qiaqia2.exchangeGoods',
receiveEname = 'qiaqia2.receiveEnamePrize',
getMyPrizeList = 'qiaqia2.getMyPrizeList', getMyPrizeList = 'qiaqia2.getMyPrizeList',
guide = 'qiaqiaHome.doNoviceGuide',
// 游戏信息 // 游戏信息
gameInfo = 'qiaqiaHome.getGameInfo', gameInfo = 'qiaqiaHome.getGameInfo',
......
export enum G_EVENT { export enum G_EVENT {
GET_WAREHOUSE = 'getWareHouse', GET_WAREHOUSE = 'getWareHouse',
GET_SHOPLIST = 'getShopList' GET_SHOPLIST = 'getShopList',
GET_MY_PRIZE_LIST = 'getMyPrizeList',
GET_TASK_LIST = 'getTaskList',
GUIDE2_PLANT = 'guide2Plant',
GUIDE1 = 'guide1',
GUIDE2 = 'guide2',
GUIDE3 = 'guide3',
GUIDE4 = 'guide4',
GUIDE5 = 'guide5',
GUIDE7 = 'guide7',
GUIDE8 = 'guide8',
GUIDE9 = 'guide9',
GUIDE10 = 'guide10',
} }
...@@ -2,6 +2,7 @@ import { Panel } from "../../module/views/Panel"; ...@@ -2,6 +2,7 @@ import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools"; import { Tool } from "../Tools";
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet"; import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import { RES } from "../../module/RES";
import Sprite = FYGE.Sprite; import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween; import Tween = FYGE.Tween;
import ScrollList = FYGE.ScrollList; import ScrollList = FYGE.ScrollList;
...@@ -11,6 +12,12 @@ import Texture = FYGE.Texture; ...@@ -11,6 +12,12 @@ import Texture = FYGE.Texture;
import Graphics = FYGE.Graphics; import Graphics = FYGE.Graphics;
import TextField = FYGE.TextField; import TextField = FYGE.TextField;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
import MouseEvent = FYGE.MouseEvent;
import { showToast } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../const/GEVENT";
export default class ExRecordPanel extends Panel { export default class ExRecordPanel extends Panel {
get groupNames() { get groupNames() {
...@@ -32,7 +39,14 @@ export default class ExRecordPanel extends Panel { ...@@ -32,7 +39,14 @@ export default class ExRecordPanel extends Panel {
this.scroll = this.addChild(new ScrollList(RecordItem, 653, 200, 653, 830)); this.scroll = this.addChild(new ScrollList(RecordItem, 653, 200, 653, 830));
this.scroll.position.set((this.width - this.scroll.width) / 2, 210); this.scroll.position.set((this.width - this.scroll.width) / 2, 210);
}
start(data) {
super.start();
GDispatcher.dispatchEvent(G_EVENT.GET_MY_PRIZE_LIST);
}
private getMyPrizeList() {
sendTbNet(TbNetName.getMyPrizeList, { sendTbNet(TbNetName.getMyPrizeList, {
activityId: activityId activityId: activityId
}, (success, res) => { }, (success, res) => {
...@@ -64,33 +78,71 @@ export default class ExRecordPanel extends Panel { ...@@ -64,33 +78,71 @@ export default class ExRecordPanel extends Panel {
}); });
} }
start(data) {
super.start();
}
initEvents() { initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this) this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.addEventListener(G_EVENT.GET_MY_PRIZE_LIST, this.getMyPrizeList, this);
GDispatcher.addEventListener('onShow', this.getMyPrizeList, this);
} }
removeEvents() { removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this) this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.removeEventListener(G_EVENT.GET_MY_PRIZE_LIST, this.getMyPrizeList, this);
GDispatcher.removeEventListener('onShow', this.getMyPrizeList, this);
} }
} }
class RecordItem extends Container implements IScrollListItem { class RecordItem extends Container implements IScrollListItem {
public data: number; public data: any;
public id: number; public id: number;
private prizeImg: Sprite; private prizeImg: Sprite;
private prizeName: TextField; private prizeName: TextField;
private prizeDate: TextField; private prizeDate: TextField;
private remark: TextField;
private btn: Sprite;
public initData(id: number, data: any): void { public initData(id: number, data: any): void {
if (!data) return; if (!data) return;
this.data = data;
this.prizeImg.texture = Texture.fromUrl(data.image); this.prizeImg.texture = Texture.fromUrl(data.image);
this.prizeName.text = data.name; this.prizeName.text = data.name;
this.prizeDate.text = `${data.exchangeDay}兑换`; this.prizeDate.text = `${data.exchangeDay}兑换`;
if (data.drawStatus == 4 || data.drawStatus == 6) {
this.remark.visible = true;
this.remark.text = data.remark;
} else {
this.remark.visible = false;
}
this.btn.removeAllEventListener();
if (data.drawStatus == 1 || data.drawStatus == 4 || data.drawStatus == 6) {
this.btn.texture = RES.getRes('record_en.png');
this.btn.addEventListener(MouseEvent.CLICK, () => {
if (this.data.type == 1) {
/// todo 权益
sendTbNet(TbNetName.receiveEname, {
_id: this.data._id,
activityId: activityId
}, (success, res) => {
if (!success || !res || !res.data) {
showToast('领取异常,请稍后重试');
return;
}
GDispatcher.dispatchEvent(G_EVENT.GET_MY_PRIZE_LIST);
});
} else if (this.data.type == 3) {
// todo 实物
}
}, this);
} else {
this.btn.texture = RES.getRes('record_dis.png');
}
} }
constructor() { constructor() {
...@@ -111,6 +163,16 @@ class RecordItem extends Container implements IScrollListItem { ...@@ -111,6 +163,16 @@ class RecordItem extends Container implements IScrollListItem {
this.prizeDate = this.addChild(Tool.getText('', 22, '#999999')); this.prizeDate = this.addChild(Tool.getText('', 22, '#999999'));
this.prizeDate.position.set(176, 91); this.prizeDate.position.set(176, 91);
// this.prizeDate.visible = false;
this.remark = this.addChild(Tool.getText('', 22, '#ff0000'));
this.remark.textWidth = this.width - 20;
this.remark.textAlign = TEXT_ALIGN.RIGHT;
this.remark.lineType = TEXT_lINETYPE.MULTI;
this.remark.y = 130;
this.btn = this.addChild(Tool.getSprite('record_en.png'));
this.btn.position.set(500, (this.height - this.btn.height) / 2);
} }
} }
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import Sprite = FYGE.Sprite;
import TextField = FYGE.TextField;
import MouseEvent = FYGE.MouseEvent;
import { showToast } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../const/GEVENT";
export default class GuidePanel extends Panel {
get groupNames() {
return ["guidePanel"];
}
closeBtn: Sprite;
numLabel: TextField;
btn: Sprite;
initUi() {
this.addChild(Tool.getSprite("guide_bg.png"))
.position.set(0, -130);
this.numLabel = this.addChild(Tool.getText('+3', 28, '#c05413'));
this.numLabel.position.set(414, 765);
this.btn = this.addChild(Tool.getSprite('guide_btn.png'));
this.btn.position.set((this.width - this.btn.width) / 2, 939);
}
start(data) {
super.start();
}
private guide1() {
sendTbNet(TbNetName.guide, {
activityId: activityId,
index: 1,
}, (success, res) => {
if (!success) {
return;
}
if (!res.data) {
showToast('请稍后再试');
}
GDispatcher.dispatchEvent(G_EVENT.GUIDE2);
this.hidePanel();
});
}
initEvents() {
this.btn.addEventListener(MouseEvent.CLICK, this.guide1, this);
}
removeEvents() {
this.btn.removeEventListener(MouseEvent.CLICK, this.guide1, this);
}
}
...@@ -12,6 +12,8 @@ import TextField = FYGE.TextField; ...@@ -12,6 +12,8 @@ import TextField = FYGE.TextField;
import MouseEvent = FYGE.MouseEvent; import MouseEvent = FYGE.MouseEvent;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import { showToast } from "../../module/ctrls"; import { showToast } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../const/GEVENT";
const TASK_TYPE = { const TASK_TYPE = {
sign: 'sign', sign: 'sign',
...@@ -46,27 +48,6 @@ export default class TaskPanel extends Panel { ...@@ -46,27 +48,6 @@ export default class TaskPanel extends Panel {
this.scroll = this.addChild(new ScrollList(TaskItem, 654, 200, 654, 830)); this.scroll = this.addChild(new ScrollList(TaskItem, 654, 200, 654, 830));
this.scroll.position.set((this.width - this.scroll.width) / 2, 210); this.scroll.position.set((this.width - this.scroll.width) / 2, 210);
sendTbNet(TbNetName.taskList, {
activityId: activityId
}, (success, res) => {
if (!success) {
return;
}
const a = [
'member',
'follow',
'joinGroup',
];
let data = [];
for (let i = 0; i < res.data.length; i++) {
if (a.indexOf(res.data[i].taskType) > -1 && res.data[i].todayCompleteTimes >= res.data[i].times) {
continue;
}
data.push(res.data[i]);
}
this.scroll.updateData(data);
});
} }
public showAni() { public showAni() {
...@@ -92,16 +73,40 @@ export default class TaskPanel extends Panel { ...@@ -92,16 +73,40 @@ export default class TaskPanel extends Panel {
}); });
} }
private getTaskList() {
sendTbNet(TbNetName.taskList, {
activityId: activityId
}, (success, res) => {
if (!success) {
return;
}
const a = ['member', 'follow', 'joinGroup'];
let data = [];
for (let i = 0; i < res.data.length; i++) {
if (a.indexOf(res.data[i].taskType) > -1 && res.data[i].todayCompleteTimes >= res.data[i].times) {
continue;
}
data.push(res.data[i]);
}
this.scroll.updateData(data);
});
}
start(data) { start(data) {
super.start(); super.start();
GDispatcher.dispatchEvent(G_EVENT.GET_TASK_LIST);
} }
initEvents() { initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this) this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.addEventListener(G_EVENT.GET_TASK_LIST, this.getTaskList, this);
GDispatcher.addEventListener('onShow', this.getTaskList, this);
} }
removeEvents() { removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this) this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this);
GDispatcher.removeEventListener(G_EVENT.GET_TASK_LIST, this.getTaskList, this);
GDispatcher.removeEventListener('onShow', this.getTaskList, this);
} }
} }
...@@ -181,10 +186,10 @@ class TaskItem extends Container implements IScrollListItem { ...@@ -181,10 +186,10 @@ class TaskItem extends Container implements IScrollListItem {
} }
sendTbNet(TbNetName.completeTask, { sendTbNet(TbNetName.completeTask, {
taskType:data.taskType, taskType: data.taskType,
activityId: activityId activityId: activityId
}, (success, res) => { }, (success, res) => {
if(!success || !res || !res.data){ if (!success || !res || !res.data) {
showToast('网络异常,请稍后重试'); showToast('网络异常,请稍后重试');
return; return;
} }
......
...@@ -21,11 +21,14 @@ export default class GameLayer extends Container { ...@@ -21,11 +21,14 @@ export default class GameLayer extends Container {
public static get ins(): GameLayer { public static get ins(): GameLayer {
return GameLayer._ins || (GameLayer._ins = new GameLayer()); return GameLayer._ins || (GameLayer._ins = new GameLayer());
} }
public static kill(){
GameLayer._ins && GameLayer._ins.destroy();
GameLayer._ins = null; // 一定要清除单例
}
public destroy() { public destroy() {
super.destroy(); super.destroy();
this.removeEvent(); this.removeEvent();
GameLayer._ins = null; // 一定要清除单例
} }
private landList: Land[] = []; // 土地列表 private landList: Land[] = []; // 土地列表
...@@ -51,6 +54,7 @@ export default class GameLayer extends Container { ...@@ -51,6 +54,7 @@ export default class GameLayer extends Container {
* @param {PLANT_TYPE} type 植物类型 * @param {PLANT_TYPE} type 植物类型
*/ */
public addPlant(landId: number, type: PLANT_TYPE) { public addPlant(landId: number, type: PLANT_TYPE) {
console.log('请求种植接口');
sendTbNet(TbNetName.plant, { sendTbNet(TbNetName.plant, {
landIndex: landId, landIndex: landId,
activityId: activityId, activityId: activityId,
......
This diff is collapsed.
...@@ -126,7 +126,6 @@ export class Land extends Container { ...@@ -126,7 +126,6 @@ export class Land extends Container {
* @param data * @param data
*/ */
public updatePlant(data) { public updatePlant(data) {
console.log(data);
this.plant.updatePlant(data); this.plant.updatePlant(data);
this.waterRestCount = +data.waterRestCount; this.waterRestCount = +data.waterRestCount;
...@@ -149,6 +148,8 @@ export class Land extends Container { ...@@ -149,6 +148,8 @@ export class Land extends Container {
timestamp: +data.waterTime, timestamp: +data.waterTime,
fullTime: +data.totalTime, fullTime: +data.totalTime,
}); });
this.progressBar.show();
} }
/** /**
...@@ -352,7 +353,7 @@ export class Land extends Container { ...@@ -352,7 +353,7 @@ export class Land extends Container {
* 为自己添加一个Option * 为自己添加一个Option
* @param {OPTION_TYPE} type Option的类型 * @param {OPTION_TYPE} type Option的类型
*/ */
private addOption(type: OPTION_TYPE) { public addOption(type: OPTION_TYPE) {
this.removeOption(); this.removeOption();
this.option = this.addChild(OptionPool.ins.takeOut(type)); this.option = this.addChild(OptionPool.ins.takeOut(type));
if (type == OPTION_TYPE.WATER) { if (type == OPTION_TYPE.WATER) {
...@@ -363,12 +364,14 @@ export class Land extends Container { ...@@ -363,12 +364,14 @@ export class Land extends Container {
this.option.x = 160; this.option.x = 160;
this.option.y = -50; this.option.y = -50;
this.option.play(); this.option.play();
return this.option;
} }
/** /**
* 移除自己的当前Option * 移除自己的当前Option
*/ */
private removeOption() { public removeOption() {
if (this.option) { if (this.option) {
this.option.removeAllEventListener(); this.option.removeAllEventListener();
this.removeChild(this.option); this.removeChild(this.option);
......
...@@ -13,10 +13,14 @@ import Ease = FYGE.Ease; ...@@ -13,10 +13,14 @@ import Ease = FYGE.Ease;
import GameLayer from "./GameLayer"; import GameLayer from "./GameLayer";
import MouseEvent = FYGE.MouseEvent; import MouseEvent = FYGE.MouseEvent;
import { Land } from "./Land"; import { Land } from "./Land";
import { activityId, sendTbNet, TbNetName } from "../../TaoBaoNet";
import { showToast } from "../../../module/ctrls";
import { GDispatcher } from "../../Main";
import { G_EVENT } from "../../const/GEVENT";
export default class PlantList extends Container { export default class PlantList extends Container {
private scrollList: ScrollList; public scrollList: ScrollList;
// 对应哪个土地,即点击哪个土地来显示这个列表 // 对应哪个土地,即点击哪个土地来显示这个列表
private _bindId = -1; private _bindId = -1;
...@@ -24,7 +28,7 @@ export default class PlantList extends Container { ...@@ -24,7 +28,7 @@ export default class PlantList extends Container {
return this._bindId; return this._bindId;
} }
constructor() { constructor(isGuide = false) {
super(); super();
// bg // bg
...@@ -41,7 +45,10 @@ export default class PlantList extends Container { ...@@ -41,7 +45,10 @@ export default class PlantList extends Container {
this.scrollList = this.addChild(new ScrollList(ListPlant, 123, 160, 500, 160, false)); this.scrollList = this.addChild(new ScrollList(ListPlant, 123, 160, 500, 160, false));
const data = []; const data = [];
for (let k in s_PlantData) { for (let k in s_PlantData) {
data.push(s_PlantData[k].key); data.push({
key: s_PlantData[k].key,
isGuide: isGuide
});
} }
this.scrollList.updateData(data); this.scrollList.updateData(data);
this.scrollList.x = (this.width - 500) / 2; this.scrollList.x = (this.width - 500) / 2;
...@@ -92,7 +99,7 @@ export default class PlantList extends Container { ...@@ -92,7 +99,7 @@ export default class PlantList extends Container {
*/ */
class ListPlant extends Container implements IScrollListItem { class ListPlant extends Container implements IScrollListItem {
id: number; id: number;
data: number; data: any;
/** /**
* 数据更新 * 数据更新
...@@ -101,8 +108,9 @@ class ListPlant extends Container implements IScrollListItem { ...@@ -101,8 +108,9 @@ class ListPlant extends Container implements IScrollListItem {
*/ */
public initData(id: number, data: any) { public initData(id: number, data: any) {
if (!data || data == PLANT_TYPE.NONE) return; if (!data || data == PLANT_TYPE.NONE) return;
this.key = data; this.key = data.key;
this.img.texture = RES.getRes(`种植框_${s_PlantData[data].name}.png`); this.data = data;
this.img.texture = RES.getRes(`种植框_${s_PlantData[data.key].name}.png`);
this.img.position.set((this.width - this.img.width) / 2 - 5, (this.height - this.img.height) / 2 + 20); this.img.position.set((this.width - this.img.width) / 2 - 5, (this.height - this.img.height) / 2 + 20);
} }
...@@ -168,12 +176,15 @@ class ListPlant extends Container implements IScrollListItem { ...@@ -168,12 +176,15 @@ class ListPlant extends Container implements IScrollListItem {
this.addEventListener(MouseEvent.MOUSE_OUT, up); this.addEventListener(MouseEvent.MOUSE_OUT, up);
this.addEventListener(MouseEvent.CLICK, () => { this.addEventListener(MouseEvent.CLICK, () => {
if(this.data.isGuide){
GDispatcher.dispatchEvent(G_EVENT.GUIDE2_PLANT, this.key);
return;
}
Land.activeLand.deactivate(); Land.activeLand.deactivate();
const bindId = GameLayer.ins.plantList.bindId; const bindId = GameLayer.ins.plantList.bindId;
/// TODO 请求种植接口 /// TODO 请求种植接口
console.log(`点到了: ${this.key} ${s_PlantData[this.key].name}, 土地Id: ${bindId}`); console.log(`点到了: ${this.key} ${s_PlantData[this.key].name}, 土地Id: ${bindId}`);
console.log('请求种植接口');
GameLayer.ins.addPlant(bindId, this.key); GameLayer.ins.addPlant(bindId, this.key);
......
...@@ -119,7 +119,7 @@ export default class ProgressBar extends Container { ...@@ -119,7 +119,7 @@ export default class ProgressBar extends Container {
.set({alpha: 0, visible: true}) .set({alpha: 0, visible: true})
.to({alpha: 1}, 500, Ease.quadInOut); .to({alpha: 1}, 500, Ease.quadInOut);
tw.wait(3000) tw.wait(5000)
.call(() => { .call(() => {
this.hidden(); this.hidden();
}); });
......
...@@ -27,6 +27,7 @@ export class UILayer extends Container { ...@@ -27,6 +27,7 @@ export class UILayer extends Container {
private taskBtn: Sprite; // 任务按钮 private taskBtn: Sprite; // 任务按钮
private wareHouseBtn: Sprite; // 仓库按钮 private wareHouseBtn: Sprite; // 仓库按钮
private storeBtn: Sprite; // 商店按钮 private storeBtn: Sprite; // 商店按钮
private recordBtn: Sprite; // 商店按钮
constructor() { constructor() {
super(); super();
...@@ -43,13 +44,13 @@ export class UILayer extends Container { ...@@ -43,13 +44,13 @@ export class UILayer extends Container {
} }
public initEvents() { public initEvents() {
[this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn].forEach((v) => { [this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn, this.recordBtn].forEach((v) => {
v.addEventListener(MouseEvent.CLICK, this.touchBtn, this); v.addEventListener(MouseEvent.CLICK, this.touchBtn, this);
}); });
} }
public removeEvents() { public removeEvents() {
[this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn].forEach((v) => { [this.ruleBtn, this.taskBtn, this.wareHouseBtn, this.storeBtn, this.recordBtn].forEach((v) => {
v.removeEventListener(MouseEvent.CLICK, this.touchBtn, this); v.removeEventListener(MouseEvent.CLICK, this.touchBtn, this);
}); });
} }
...@@ -75,7 +76,9 @@ export class UILayer extends Container { ...@@ -75,7 +76,9 @@ export class UILayer extends Container {
break; break;
case this.ruleBtn: case this.ruleBtn:
console.log('点击了规则'); console.log('点击了规则');
// PanelCtrl.instance.show(RulePanel); PanelCtrl.instance.show(RulePanel);
break;
case this.recordBtn:
PanelCtrl.instance.show(ExRecordPanel); PanelCtrl.instance.show(ExRecordPanel);
break; break;
} }
...@@ -115,6 +118,10 @@ export class UILayer extends Container { ...@@ -115,6 +118,10 @@ export class UILayer extends Container {
this.ruleBtn.position.set(622, 0); this.ruleBtn.position.set(622, 0);
this.ruleBtn.name = '规则'; this.ruleBtn.name = '规则';
this.recordBtn = topGroup.addChild(Tool.getSprite('btn_兑换记录.png'));
this.recordBtn.position.set(622, 130);
this.recordBtn.name = '兑换记录';
topGroup.y = getAdjustTopHeight(topGroup, 117 / 1624); topGroup.y = getAdjustTopHeight(topGroup, 117 / 1624);
} }
......
...@@ -36,6 +36,7 @@ export class GameScene extends Scene { ...@@ -36,6 +36,7 @@ export class GameScene extends Scene {
this.uiLayer = this.addChild(new UILayer()); this.uiLayer = this.addChild(new UILayer());
// 游戏层 // 游戏层
GameLayer.kill();
this.gameLayer = this.addChild(GameLayer.ins); this.gameLayer = this.addChild(GameLayer.ins);
......
import { Scene } from "../../module/views/Scene";
import { Tool } from "../Tools";
import GameLayer from "../parts/Game/GameLayer";
import { UILayer } from "../parts/UI/UILayer";
import { Land } from "../parts/Game/Land";
import MouseEvent = FYGE.MouseEvent;
import { gameResource } from "../const/staticData";
import PanelCtrl from "../../module/ctrls/panelCtrl";
import GuidePanel from "../panels/GuidePanel";
import GuideLayer from "../parts/Game/GuideLayer";
import { getTbData, TbNetName } from "../TaoBaoNet";
export class GuideScene extends Scene {
get groupNames() {
return gameResource;
}
// 游戏层
private gameLayer: GameLayer; // 游戏层
// UI层
private uiLayer: UILayer;
// 引导层
private guideLayer: GuideLayer;
initUi() {
// 背景图
this.addChild(Tool.getSprite('game_bg.jpg'))
.addEventListener(MouseEvent.CLICK, () => {
console.log('点击了BG');
GameLayer.ins.plantList.hidden(); // 隐藏种植栏
Land.activeLand && Land.activeLand.deactivate();
});
// UI层
this.uiLayer = this.addChild(new UILayer());
// 游戏层
GameLayer.kill();
this.gameLayer = this.addChild(GameLayer.ins);
// 引导层
this.guideLayer = this.addChild(new GuideLayer());
}
public destroy() {
super.destroy();
}
start() {
super.start();
this.guideLayer.start();
const gameInfo: any = getTbData(TbNetName.gameInfo).data;
const guideStep = gameInfo.guideStep;
if (guideStep < 1) {
PanelCtrl.instance.show(GuidePanel);
}
}
initEvents() {
super.initEvents();
this.gameLayer.initEvent();
this.uiLayer.initEvents();
this.guideLayer.initEvent();
}
removeEvents() {
super.removeEvents();
this.gameLayer.removeEvent();
this.uiLayer.removeEvents();
this.guideLayer.removeEvent();
}
}
import { Scene } from "../../module/views/Scene"; import { Scene } from "../../module/views/Scene";
import { Tool } from "../Tools"; import { Tool } from "../Tools";
import { activityId, sellerId, sendTbNet, setActiveId, setTbData, TbNetName } from "../TaoBaoNet"; import { activityId, getTbData, sellerId, sendTbNet, setActiveId, setTbData, TbNetName } from "../TaoBaoNet";
import { getAdjustTopHeight } from "../const/myLab"; import { getAdjustTopHeight } from "../const/myLab";
import SceneCtrl from "../../module/ctrls/sceneCtrl"; import SceneCtrl from "../../module/ctrls/sceneCtrl";
import { GameScene } from "./GameScene"; import { GameScene } from "./GameScene";
...@@ -8,13 +8,14 @@ import OptionPool from "../const/OptionPool"; ...@@ -8,13 +8,14 @@ import OptionPool from "../const/OptionPool";
import PlantEffectPool from "../const/PlantEffectPool"; import PlantEffectPool from "../const/PlantEffectPool";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { gameResource } from "../const/staticData"; import { gameResource } from "../const/staticData";
import { checkShopFavoredStatus, getAuthUserInfo } from "../utils";
import Container = FYGE.Container; import Container = FYGE.Container;
import Sprite = FYGE.Sprite; import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween; import Tween = FYGE.Tween;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import Graphics = FYGE.Graphics; import Graphics = FYGE.Graphics;
import TextField = FYGE.TextField; import TextField = FYGE.TextField;
import { checkShopFavoredStatus, getAuthUserInfo } from "../utils"; import { GuideScene } from "./GuideScene";
export class LoadingScene extends Scene { export class LoadingScene extends Scene {
...@@ -135,7 +136,8 @@ export class LoadingScene extends Scene { ...@@ -135,7 +136,8 @@ export class LoadingScene extends Scene {
this.titleEffect().call(() => { this.titleEffect().call(() => {
this.startLoading().call(() => { this.startLoading().call(() => {
SceneCtrl.instance.change(GameScene); const gameInfo: any = getTbData(TbNetName.gameInfo);
SceneCtrl.instance.change(gameInfo.guideIsEnd ? GameScene : GuideScene);
}); });
}); });
} }
......
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