Commit 37966fde authored by wjf's avatar wjf

l

parent 937969c1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -67,8 +67,8 @@ export class Main {
showWaiting();
sendTbNet(TbNetName.getAppData, {}, (s, res) => {
Tool.globalData = res.data;
// changeScene(PlayScene,Tool.globalData.gameObj);
changeScene(StartScene);
changeScene(PlayScene,Tool.globalData.gameObj);
// changeScene(StartScene);
})
......
......@@ -281,6 +281,10 @@ const mockData = {
"data": {
"inviteSuccessCount": 2
}
},
//消耗道具
"useTools": {
"success": true,
}
}
......
......@@ -112,7 +112,7 @@ export class Tool {
activityId: string,
nickName: string,
avatar: string,
gameObj: {
gameObj: {//注意这里面只有id是确定要用的,其他别用
maxScore: number,
bombCount: number,
exchangeCount: number,
......
......@@ -8,6 +8,14 @@ export enum TaskType {
doCollect = "doCollect",
doOrder = "doOrder"
}
/**
* 和消耗道具接口保持一致
*/
export enum PropType {
boom = 1,
exchange = 2,
net = 3,
}
/**
*
* @param callback
......@@ -16,7 +24,7 @@ export enum TaskType {
* @param id
* @param isFinal 是否最终提交,默认是的
*/
export function submit(callback: (s: boolean, res?: any) => void, score: number, grade: number, id: string, isFinal: boolean = true) {
export function submit(callback: (s: boolean, res?: any) => void, score: number, grade: number, isFinal: boolean = true) {
sendTbNet(
TbNetName.submit,
{
......@@ -24,7 +32,7 @@ export function submit(callback: (s: boolean, res?: any) => void, score: number,
grade: grade,
score: score,
type: isFinal ? 1 : 0,
playId: id
playId: Tool.globalData.gameObj.id
},
(s, res) => {
callback(s, res)
......@@ -48,3 +56,20 @@ export function getTools() {
true
)
}
/**
*
* @param callback 回调
* @param type 道具类型
*/
export function useTools(callback: (s: boolean) => void, type: PropType) {
sendTbNet(
TbNetName.useTools,
{
activityId: Tool.globalData.activityId,
type: type,
playId: Tool.globalData.gameObj.id
},
(s) => { callback(s); }
)
}
......@@ -130,14 +130,14 @@ export class GameOverPanel extends Panel {
desTxt.text = "(" + levelDes[this.data.grade] + ")";
// this.addChild(desTxt);//貌似不用显示了
//返回首页按钮
this.returnBtn = this.addChild(new Button(RES.getRes("fanhuishouye.png"))) as Button;
this.returnBtn = this.addChild(new Button(RES.getRes("fanhuishouye.png")));
this.returnBtn.position.set(117, 959);
//再来一次按钮
this.againBtn = this.addChild(new Button(RES.getRes("zailaiyiju.png"))) as Button;
this.againBtn = this.addChild(new Button(RES.getRes("zailaiyiju.png")));
this.againBtn.position.set(383, 959);
this.againBtn.visible = false;
//去赚积分按钮
this.goEarnBtn = this.addChild(new Button(RES.getRes("quzhuanjifen.png"))) as Button;
this.goEarnBtn = this.addChild(new Button(RES.getRes("quzhuanjifen.png")));
this.goEarnBtn.position.set(383, 959);
this.goEarnBtn.visible = false;
//积分/次文案
......@@ -186,11 +186,13 @@ export class GameOverPanel extends Panel {
sendTbNet(
TbNetName.startGame,
{ activityId: Tool.globalData.activityId, nickName: Tool.globalData.nickName },
(s, res: { data: { maxScore: number, unlockGrade: number, bombCount: number, exchangeCount: number, netCount: number } }) => {
(s, res: { data: { maxScore: number, unlockGrade: number, bombCount: number, exchangeCount: number, netCount: number, id: string } }) => {
hideWaiting();
this.hidePanel();
if (s) {
var data = res.data
var data = res.data;
// 修改Tool里的数据
Tool.globalData.gameObj = data;
var playScene: PlayScene = getCurrentScene();
// playScene.resetGame(res.unlockGrade)//代加参数,方法
//修改道具数量
......
......@@ -66,7 +66,7 @@ export class PropPanel extends Panel {
netCount: number,
grade: number,
score: number,
id: string;
// id: string;
}
initUi() {
......@@ -121,7 +121,7 @@ export class PropPanel extends Panel {
//显示结束弹框
showPanel(GameOverPanel, res.data)
}
}, this.data.score, this.data.grade, this.data.id)
}, this.data.score, this.data.grade)
}
onClick_getPropBtn() {
showPanel(TaskPanel)
......
......@@ -22,7 +22,7 @@ export class QuitPanel extends Panel {
data: {
grade: number,
score: number,
id: string//订单id
// id: string//订单id
}
initUi() {
......@@ -47,7 +47,7 @@ export class QuitPanel extends Panel {
this.hidePanel();
//显示结束弹框
showPanel(GameOverPanel, res.data)
}, this.data.score, this.data.grade, this.data.id)
}, this.data.score, this.data.grade)
}, this)
.position.set(134, 750)
}
......
......@@ -51,12 +51,10 @@ export class StartScene extends Scene {
// netCount: 33,
// score: 22,
// grade: 1024,
// id:"223"
// })
// showPanel(QuitPanel, {
// score: 22,
// grade: 1024,
// id:"223"
// })
// showPanel(GameOverPanel, {
// score: 4444,
......
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