Commit 063c86e8 authored by wjf's avatar wjf

l

parent aeb79820
...@@ -430,8 +430,17 @@ export class NetManager extends ABNetManager { ...@@ -430,8 +430,17 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
/**
hc_submit(callback: Function, gamedata,score?): void { *
* @param callback
* @param orderId 订单id,来自doJoin,,DataManager.ins.getData("hc_doJoin").data
* @param score 关卡
* @param gameData json带分数和通关元素
* @param submitToken token,来自getNgameStartStatus,,DataManager.ins.getData("getNgameStartStatus").data.submitToken
*/
hc_submit(callback: Function, orderId: number, score: number, gameData: string, submitToken: string): void {
const sign = this.createSgin(orderId, score, gameData, submitToken);
NetName.CUSTOM_DO_JOIN
const net: INetData = { const net: INetData = {
name: 'hc_submit', name: 'hc_submit',
uri: '/hdtool/happyclear/submit', uri: '/hdtool/happyclear/submit',
...@@ -439,10 +448,12 @@ export class NetManager extends ABNetManager { ...@@ -439,10 +448,12 @@ export class NetManager extends ABNetManager {
dataType: 'json', dataType: 'json',
param: { param: {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
gameData: gamedata, gameData: gameData,
sign: sign,
dynamicData: JSON.stringify([]),
detect: window['detect'], detect: window['detect'],
deviceSessionId: window['_device_session_id'], deviceSessionId: window['_device_session_id'],
score:score score: score,
}, },
hideMsg: true, hideMsg: true,
callback: callback callback: callback
...@@ -464,6 +475,13 @@ export class NetManager extends ABNetManager { ...@@ -464,6 +475,13 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
/**
*
* @param callback
* @param orderId DataManager.ins.getData("doJoin").data,或hc_doJoin
* @param pollingCheck
* @param pollingCount
*/
getOrderStatus(callback: Function, orderId: number, pollingCheck?: Function, pollingCount = 10): void { getOrderStatus(callback: Function, orderId: number, pollingCheck?: Function, pollingCount = 10): void {
const param: any = { const param: any = {
orderId: orderId orderId: orderId
...@@ -814,19 +832,19 @@ export class NetManager extends ABNetManager { ...@@ -814,19 +832,19 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public hc_exchange(callback: Function, category: number, propType?: number): void { public hc_exchange(callback: Function, category: number, propType?: number): void {
const d:any = { const d: any = {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
category: category category: category
}; };
if(propType) { if (propType) {
d.propType=propType; d.propType = propType;
} }
const net: INetData = { const net: INetData = {
name: 'hc_exchange', name: 'hc_exchange',
uri: '/customActivity/happyclear/exchange', uri: '/customActivity/happyclear/exchange',
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
param:d , param: d,
callback: callback callback: callback
}; };
this.send(net); this.send(net);
...@@ -970,16 +988,16 @@ export class NetManager extends ABNetManager { ...@@ -970,16 +988,16 @@ export class NetManager extends ABNetManager {
this.getToken(net); this.getToken(net);
} }
public hc_doJoin(callback: Function,score: number,detect,deviceSessionId): void { public hc_doJoin(callback: Function, score: number, detect, deviceSessionId): void {
const param: any = { const param: any = {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
activityType: 'hdtool', activityType: 'hdtool',
score:score, score: score,
consumerId: window['CFG'].consumerId, consumerId: window['CFG'].consumerId,
detect: window['detect'], detect: window['detect'],
deviceSessionId: window['_device_session_id'] deviceSessionId: window['_device_session_id']
}; };
const net: INetData = { const net: INetData = {
name: 'hc_doJoin', name: 'hc_doJoin',
uri: '/hdtool/happyclear/doJoin', uri: '/hdtool/happyclear/doJoin',
......
...@@ -9,7 +9,7 @@ import { Lattice } from '../something/class/Lattice'; ...@@ -9,7 +9,7 @@ import { Lattice } from '../something/class/Lattice';
import { Pool } from '../something/Pool'; import { Pool } from '../something/Pool';
import { RecoverName } from '../something/enum/RecoverName'; import { RecoverName } from '../something/enum/RecoverName';
import { Element } from '../something/class/Element'; import { Element } from '../something/class/Element';
import { ElementType, submitTran } from '../something/enum/ElementType'; import { ElementType, submitTran, codeMsgs } from '../something/enum/ElementType';
import { EffectType } from '../something/enum/EffectType'; import { EffectType } from '../something/enum/EffectType';
import { BoomAni } from '../something/anis/BoomAni'; import { BoomAni } from '../something/anis/BoomAni';
import { IceAni } from '../something/anis/IceAni'; import { IceAni } from '../something/anis/IceAni';
...@@ -87,6 +87,8 @@ export default class MainScene extends Scene { ...@@ -87,6 +87,8 @@ export default class MainScene extends Scene {
get skinKey() { return 'Main' } get skinKey() { return 'Main' }
exposure exposure
chapterData: ChapterData; chapterData: ChapterData;
//关数
chapter:number
//所有的格子数组 //所有的格子数组
lattices: Lattice[]; lattices: Lattice[];
//最后一行的行数 //最后一行的行数
...@@ -192,11 +194,11 @@ export default class MainScene extends Scene { ...@@ -192,11 +194,11 @@ export default class MainScene extends Scene {
//初始化索引信息 //初始化索引信息
Tool.init(); Tool.init();
//第几关 //第几关
// var chapter = (data && data.chapter) ? data.chapter : 1; // this.chapter = (data && data.chapter) ? data.chapter : 1;
var chapter = 20 this.chapter = 20;
this.chapterTxt.text = "第" + chapter + "关"; this.chapterTxt.text = "第" + this.chapter + "关";
//关卡数据 //关卡数据
this.chapterData = Chapters[chapter]; this.chapterData = Chapters[this.chapter];
this.initUi(); this.initUi();
this.initSvgas(); this.initSvgas();
//先禁掉事件 //先禁掉事件
...@@ -236,10 +238,10 @@ export default class MainScene extends Scene { ...@@ -236,10 +238,10 @@ export default class MainScene extends Scene {
//引导提示 //引导提示
if (chapter <= 5) { if (this.chapter <= 5) {
Loading.instace.show() Loading.instace.show()
let g = new GuideMsg(); let g = new GuideMsg();
g.init(chapter, () => { g.init(this.chapter, () => {
Loading.instace.hide() Loading.instace.hide()
this.addChild(g); this.addChild(g);
this.enableMouseEvt(true); this.enableMouseEvt(true);
...@@ -2034,9 +2036,8 @@ export default class MainScene extends Scene { ...@@ -2034,9 +2036,8 @@ export default class MainScene extends Scene {
PanelCtrl.instance.show(ModuleTypes.NO_PRIZE_PANEL); PanelCtrl.instance.show(ModuleTypes.NO_PRIZE_PANEL);
} }
}, },
DataManager.ins.getData(NetName.CUSTOM_DO_JOIN).data, DataManager.ins.getData("hc_doJoin").data,
() => { return DataManager.ins.getData(NetName.CUSTOM_ORDER_STATUS).code == "C000000001"; }, () => { return DataManager.ins.getCustomOrderStatusData.code == "C000000001"; })
10)
} else { } else {
Loading.instace.hide(); Loading.instace.hide();
if (!data) { if (!data) {
...@@ -2047,14 +2048,19 @@ export default class MainScene extends Scene { ...@@ -2047,14 +2048,19 @@ export default class MainScene extends Scene {
this.submit(json); this.submit(json);
}, 1300) }, 1300)
} else { } else {
//提交失败 //提交失败,根据错误码显示错误信息
showToast("提交失败") var txt = codeMsgs[data.code] || "提交失败";
showToast(txt);
setTimeout(() => { setTimeout(() => {
SceneCtrl.instance.change(ModuleTypes.MAP_SCENE); SceneCtrl.instance.change(ModuleTypes.MAP_SCENE);
}, 1300) }, 1300)
} }
} }
}, json) },
DataManager.ins.getData("hc_doJoin").data,
this.chapter,
json,
DataManager.ins.getData("getNgameStartStatus").data.submitToken)
} }
/** /**
......
...@@ -11,6 +11,13 @@ export enum ElementType { ...@@ -11,6 +11,13 @@ export enum ElementType {
LOLLIPOP,//棒棒糖6 LOLLIPOP,//棒棒糖6
ICE,//冰块7 ICE,//冰块7
} }
export const codeMsgs = {
"E1002090011": "用户关卡记录异常",
"E1002090012": "暂不能挑战此关卡",
"E1002090015": "关卡目标未完成",
"E1002090016": "游戏数据提交异常",
"E1002090017": "游戏关卡配置异常或关卡暂未开放",
}
//提交时候的对应字段字段,分数额外,字段是1 //提交时候的对应字段字段,分数额外,字段是1
export const submitTran = { export const submitTran = {
0: 4, 0: 4,
......
...@@ -45,18 +45,26 @@ export class ScoreProgress { ...@@ -45,18 +45,26 @@ export class ScoreProgress {
} }
} }
w = (663 - 595) * scale + 595; w = (663 - 595) * scale + 595;
if (this.star3.source != "lightedStar_png") this.star3.source = "lightedStar_png"; if (this.star3.source != "lightedStar_png") {
this.star3.source = "lightedStar_png";
this.starCount = 3;
};
} }
else if (value >= this.starScores[1]) { else if (value >= this.starScores[1]) {
scale = (value - this.starScores[1]) / (this.starScores[2] - this.starScores[1]); scale = (value - this.starScores[1]) / (this.starScores[2] - this.starScores[1]);
w = (595 - 522) * scale + 522; w = (595 - 522) * scale + 522;
if (this.star2.source != "lightedStar_png") this.star2.source = "lightedStar_png"; if (this.star2.source != "lightedStar_png") {
this.star2.source = "lightedStar_png";
this.starCount = 2;
};
} }
else if (value >= this.starScores[0]) { else if (value >= this.starScores[0]) {
scale = (value - this.starScores[0]) / (this.starScores[1] - this.starScores[0]); scale = (value - this.starScores[0]) / (this.starScores[1] - this.starScores[0]);
w = (522 - 446) * scale + 446; w = (522 - 446) * scale + 446;
if (this.star1.source != "lightedStar_png") this.star1.source = "lightedStar_png"; if (this.star1.source != "lightedStar_png") {
this.star1.source = "lightedStar_png";
this.starCount = 1;
};
} else { } else {
scale = value / this.starScores[0]; scale = value / this.starScores[0];
w = (446 - 188) * scale + 188; w = (446 - 188) * scale + 188;
......
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