Commit d137a9c3 authored by wjf's avatar wjf

l

parent 90d52136
...@@ -99,7 +99,7 @@ export class EventDispatcher extends HashObject { ...@@ -99,7 +99,7 @@ export class EventDispatcher extends HashObject {
let ee: EE = eventTypes[type][i] let ee: EE = eventTypes[type][i]
if (ee.fn === listener && ee.context === context) { if (ee.fn === listener && ee.context === context) {
console.log("已添加过该事件") console.log("已添加过该事件")
return return s
} }
} }
eventTypes[type].unshift(new EE(listener, context || s)); eventTypes[type].unshift(new EE(listener, context || s));
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"name": "taskPanel" "name": "taskPanel"
}, },
{ {
"keys": "jixuyouxi.png,unlock128.png,unlockMsg.png,unlockPanelBg.png", "keys": "jixuyouxi.png,unlock1024.png,unlock128.png,unlock16.png,unlock2.png,unlock2048.png,unlock256.png,unlock32.png,unlock512.png,unlock64.png,unlock8.png,unlockMsg.png,unlockPanelBg.png",
"name": "unlockPanel" "name": "unlockPanel"
} }
] ]
......
resource/unlockPanel/unlock128.png

92 KB | W: | H:

resource/unlockPanel/unlock128.png

41.6 KB | W: | H:

resource/unlockPanel/unlock128.png
resource/unlockPanel/unlock128.png
resource/unlockPanel/unlock128.png
resource/unlockPanel/unlock128.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -46,6 +46,11 @@ export enum TbNetName { ...@@ -46,6 +46,11 @@ export enum TbNetName {
returnGame = "returnGame", returnGame = "returnGame",
/**
* 关注店铺方法,特例
*/
favorShop = "favorShop",
//前端自己调用小程序的方法 //前端自己调用小程序的方法
/** /**
...@@ -122,9 +127,10 @@ export function sendTbNet(netName: TbNetName, parameter: any, callback: Function ...@@ -122,9 +127,10 @@ export function sendTbNet(netName: TbNetName, parameter: any, callback: Function
//记录数据 //记录数据
data[netName] = returnData; data[netName] = returnData;
if (returnData) { if (returnData) {
callback(returnData.success, returnData)
// if (!hideMsg && !returnData.success) showToast(codeMsg[returnData.code] || "网络异常") // if (!hideMsg && !returnData.success) showToast(codeMsg[returnData.code] || "网络异常")
if (!hideMsg && !returnData.success) showToast(returnData.message || "网络异常") if (!hideMsg && !returnData.success) showToast(returnData.message || "网络异常")
callback(returnData.success, returnData); // callback(returnData.success, returnData);//有问题,有人用了removeAllTweens,上面toast失效的,先放上面
} else { } else {
if (!hideMsg) showToast("网络异常") if (!hideMsg) showToast("网络异常")
callback(false) callback(false)
...@@ -142,10 +148,11 @@ export function sendTbNet(netName: TbNetName, parameter: any, callback: Function ...@@ -142,10 +148,11 @@ export function sendTbNet(netName: TbNetName, parameter: any, callback: Function
let timeId: any; let timeId: any;
//事件回调 //事件回调
let fun = function (d) { let fun = function (d) {
callback(d.success, d);
// if (!hideMsg && !d.success) showToast(codeMsg[d.code] || "网络异常") // if (!hideMsg && !d.success) showToast(codeMsg[d.code] || "网络异常")
if (!hideMsg && !d.success) showToast(d.message || "网络异常") if (!hideMsg && !d.success) showToast(d.message || "网络异常")
GDispatcher.removeEvent(netName, fun); GDispatcher.removeEvent(netName, fun);
callback(d.success, d); // callback(d.success, d);//先临时解决放上面
clearTimeout(timeId); clearTimeout(timeId);
} }
//加事件 //加事件
...@@ -294,6 +301,7 @@ const mockData = { ...@@ -294,6 +301,7 @@ const mockData = {
//消耗道具 //消耗道具
"useTools": { "useTools": {
"success": true, "success": true,
"message":"asdsad"
} }
} }
......
...@@ -56,7 +56,7 @@ export function submit( ...@@ -56,7 +56,7 @@ export function submit(
export function getTools() { export function getTools() {
sendTbNet( sendTbNet(
TbNetName.getTools, TbNetName.getTools,
{ actitvityId: Tool.globalData.activityId }, { activityId: Tool.globalData.activityId },
(s, res) => { (s, res) => {
//如果成功就更新道具数量 //如果成功就更新道具数量
if (s) GDispatcher.dispatchEvent("updateProp", res.data.bombCount, res.data.exchangeCount, res.data.netCount) if (s) GDispatcher.dispatchEvent("updateProp", res.data.bombCount, res.data.exchangeCount, res.data.netCount)
......
...@@ -224,6 +224,12 @@ class CusButton extends Button { ...@@ -224,6 +224,12 @@ class CusButton extends Button {
); );
break; break;
} }
if (this.type == TaskType.doFollowShop) {//关注店铺
sendTbNet(TbNetName.favorShop, {}, () => {
GDispatcher.dispatchEvent(flushTaskEvent)
}, true)
}
else if (this.type == TaskType.doCollect || this.type == TaskType.doOrder) {
//都需要添加事件,回来时,派发事件刷任务接口 //都需要添加事件,回来时,派发事件刷任务接口
let fun = () => { let fun = () => {
GDispatcher.removeEvent(TbNetName.returnGame, fun, this) GDispatcher.removeEvent(TbNetName.returnGame, fun, this)
...@@ -232,6 +238,7 @@ class CusButton extends Button { ...@@ -232,6 +238,7 @@ class CusButton extends Button {
GDispatcher.addEvent(TbNetName.returnGame, fun, this) GDispatcher.addEvent(TbNetName.returnGame, fun, this)
} }
} }
}
......
...@@ -14,15 +14,15 @@ import { TEXT_ALIGN } from '../../engine/2d/const'; ...@@ -14,15 +14,15 @@ import { TEXT_ALIGN } from '../../engine/2d/const';
const foodData: { const foodData: {
[key: number]: { name: string, des: string } [key: number]: { name: string, des: string }
} = { } = {
8: { name: "啊是大", des: "自学成才" }, 8: { name: "爆浆麻薯150g*2袋", des: "" },
16: { name: "", des: "" }, 16: { name: "面筋卷120g*2袋", des: "" },
32: { name: "", des: "" }, 32: { name: "岩焗乳酪吐司500g", des: "" },
64: { name: "", des: "" }, 64: { name: "鱼豆腐170g", des: "" },
128: { name: "良品铺子猪肉脯", des: "靖江特产独立小包装肉干网红休闲零食小吃" }, 128: { name: "猪肉脯200g", des: "解锁后可在首页领取奖励哦~" },
256: { name: "", des: "" }, 256: { name: "卤藕168g*2袋", des: "解锁后可在首页领取奖励哦~" },
512: { name: "", des: "" }, 512: { name: "手撕面包1050g", des: "解锁后可在首页领取奖励哦~" },
1024: { name: "", des: "" }, 1024: { name: "枣夹核桃700g", des: "解锁后可在首页领取奖励哦~" },
2048: { name: "", des: "" }, 2048: { name: "甜辣鸭脖190g", des: "解锁后可在首页领取奖励哦~" },
} }
/** /**
* 解锁弹框 * 解锁弹框
...@@ -48,10 +48,10 @@ export class UnlockPanel extends Panel { ...@@ -48,10 +48,10 @@ export class UnlockPanel extends Panel {
.once(MouseEvent.CLICK, this.onClick_closeBtn, this) .once(MouseEvent.CLICK, this.onClick_closeBtn, this)
.position.set((750 - 341) / 2, 978) .position.set((750 - 341) / 2, 978)
//标题文案 //标题文案
this.addChild(new Title(this.data.grade)) // this.addChild(new Title(this.data.grade))
//奖品图片 246; //奖品图片 246;
this.addChild(new Sprite(RES.getRes("unlock" + this.data.grade + ".png"))) this.addChild(new Sprite(RES.getRes("unlock" + this.data.grade + ".png")))
.position.set((750 - 246) / 2, 622) .position.set((750 - 449) / 2, 580)
//名字 //名字
this.addChild(Tool.addText( this.addChild(Tool.addText(
foodData[this.data.grade].name, foodData[this.data.grade].name,
......
...@@ -23,6 +23,7 @@ import { RES } from '../../../module/RES'; ...@@ -23,6 +23,7 @@ import { RES } from '../../../module/RES';
import { getTools, getSoundStatus, useTools } from '../../commonNet' import { getTools, getSoundStatus, useTools } from '../../commonNet'
import PanelCtrl from '../../../module/ctrls/panelCtrl'; import PanelCtrl from '../../../module/ctrls/panelCtrl';
import { showPanel } from '../../../module/ctrls'; import { showPanel } from '../../../module/ctrls';
import { TEXT_ALIGN } from '../../../engine/2d/const';
export class PlayScene extends Scene { export class PlayScene extends Scene {
get groupNames() { return ["playScene"] } get groupNames() { return ["playScene"] }
...@@ -66,6 +67,7 @@ export class PlayScene extends Scene { ...@@ -66,6 +67,7 @@ export class PlayScene extends Scene {
get unlockGrade() { get unlockGrade() {
return this._unlockGrade return this._unlockGrade
} }
maxUnlockGrade: number
_isPlayMusic: boolean = false _isPlayMusic: boolean = false
...@@ -122,7 +124,9 @@ export class PlayScene extends Scene { ...@@ -122,7 +124,9 @@ export class PlayScene extends Scene {
exchangeBottom.y = 0 exchangeBottom.y = 0
this.exchangeBtn.addChild(exchangeBottom) this.exchangeBtn.addChild(exchangeBottom)
this.exchangeCountTxt = this.drawTxt(0, 105, 10, "#ffffff", 26) this.exchangeCountTxt = this.drawTxt(0, 105 - 18, 10, "#ffffff", 26)
this.exchangeCountTxt.textAlign = TEXT_ALIGN.CENTER;
this.exchangeCountTxt.textWidth = 50;
this.exchangeBtn.addChild(this.exchangeCountTxt) this.exchangeBtn.addChild(this.exchangeCountTxt)
this.bombBtn = new Button(RES.getRes('bombBtn.png')) this.bombBtn = new Button(RES.getRes('bombBtn.png'))
...@@ -135,7 +139,9 @@ export class PlayScene extends Scene { ...@@ -135,7 +139,9 @@ export class PlayScene extends Scene {
bombBottom.y = 0 bombBottom.y = 0
this.bombBtn.addChild(bombBottom) this.bombBtn.addChild(bombBottom)
this.bombCountTxt = this.drawTxt(0, 105, 10, "#ffffff", 26) this.bombCountTxt = this.drawTxt(0, 105 - 18, 10, "#ffffff", 26)
this.bombCountTxt.textAlign = TEXT_ALIGN.CENTER;
this.bombCountTxt.textWidth = 50;
this.bombBtn.addChild(this.bombCountTxt) this.bombBtn.addChild(this.bombCountTxt)
this.filterBtn = new Button(RES.getRes('filterBtn.png')) this.filterBtn = new Button(RES.getRes('filterBtn.png'))
...@@ -148,7 +154,9 @@ export class PlayScene extends Scene { ...@@ -148,7 +154,9 @@ export class PlayScene extends Scene {
filterBottom.y = 0 filterBottom.y = 0
this.filterBtn.addChild(filterBottom) this.filterBtn.addChild(filterBottom)
this.filterCountTxt = this.drawTxt(0, 105, 10, "#ffffff", 26) this.filterCountTxt = this.drawTxt(0, 105 - 18, 10, "#ffffff", 26)
this.filterCountTxt.textAlign = TEXT_ALIGN.CENTER;
this.filterCountTxt.textWidth = 50;
this.filterBtn.addChild(this.filterCountTxt) this.filterBtn.addChild(this.filterCountTxt)
this.loadSvgas() this.loadSvgas()
...@@ -175,11 +183,11 @@ export class PlayScene extends Scene { ...@@ -175,11 +183,11 @@ export class PlayScene extends Scene {
this.goBackBtn = new Button(RES.getRes("goBackBtn.png")) this.goBackBtn = new Button(RES.getRes("goBackBtn.png"))
this.goBackBtn.x = 0 this.goBackBtn.x = 0
this.goBackBtn.y = 200 this.goBackBtn.y = 200+60
this.addChild(this.goBackBtn) this.addChild(this.goBackBtn)
this.musicBtn = new Button(RES.getRes("musicOn.png")) this.musicBtn = new Button(RES.getRes("musicOn.png"))
this.musicBtn.x = 680 this.musicBtn.x = 680
this.musicBtn.y = 200 this.musicBtn.y = 200+60
this.addChild(this.musicBtn) this.addChild(this.musicBtn)
this.exchangeTarget1 = new Sprite(RES.getRes("focusTips.png")) this.exchangeTarget1 = new Sprite(RES.getRes("focusTips.png"))
...@@ -200,7 +208,9 @@ export class PlayScene extends Scene { ...@@ -200,7 +208,9 @@ export class PlayScene extends Scene {
this.isPlayMusic = getSoundStatus() this.isPlayMusic = getSoundStatus()
this.updateProp(this.gameData.bombCount, this.gameData.exchangeCount, this.gameData.netCount) this.updateProp(this.gameData.bombCount, this.gameData.exchangeCount, this.gameData.netCount)
this.unlockGrade = this.gameData.unlockGrade ? this.gameData.unlockGrade : 2 // this.unlockGrade = this.gameData.unlockGrade ? this.gameData.unlockGrade : 2
this.maxUnlockGrade = this.gameData.unlockGrade ? this.gameData.unlockGrade : 2
this.unlockGrade = 2
this._maxScore = this.gameData.maxScore ? this.gameData.maxScore : 0 this._maxScore = this.gameData.maxScore ? this.gameData.maxScore : 0
} }
...@@ -217,6 +227,9 @@ export class PlayScene extends Scene { ...@@ -217,6 +227,9 @@ export class PlayScene extends Scene {
this.renderBoard() this.renderBoard()
getTools() getTools()
this.score = 0 this.score = 0
//重置最高等级
this.unlockGrade = 2
} }
createAniPool = [] createAniPool = []
...@@ -984,17 +997,28 @@ export class PlayScene extends Scene { ...@@ -984,17 +997,28 @@ export class PlayScene extends Scene {
let ele = new GameEle(num) let ele = new GameEle(num)
this.containerPool[x][y].addChild(ele) this.containerPool[x][y].addChild(ele)
if (num > this.unlockGrade) {
if (num > this.unlockGrade && num >= 8) { this.unlockGrade = num;
this.unlockGrade = num if (num > this.maxUnlockGrade && num >= 8) {
this.maxUnlockGrade = num;
// 显示解锁弹窗 // 显示解锁弹窗
submit(() => { submit(() => {
}, this.score, this.unlockGrade, false, true) }, this.score, this.unlockGrade, false, true)
showPanel(UnlockPanel, { grade: num }) showPanel(UnlockPanel, { grade: num })
} }
} }
// if (num > this.unlockGrade && num >= 8) {
// this.unlockGrade = num
// // 显示解锁弹窗
// submit(() => {
// }, this.score, this.unlockGrade, false, true)
// showPanel(UnlockPanel, { grade: num })
// }
}
} }
} }
......
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