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