Commit d137a9c3 authored by wjf's avatar wjf

l

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