Commit b9a5f08a authored by XieChuanJin's avatar XieChuanJin

去除多次提交限制

parent 44d29037
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -16,7 +16,6 @@ import { initNECaptcha } from "./Component/InitNECaptcha";
export class ShootPlanet extends engine.Container {
public game: Game = null;
private isSubmited = false;
private constantSubmitSeq = 1;
private needSubmitCount = 0; //实际分数减去ConstantSubmitScoreNum的次数
private isSubmiting = false;
......@@ -50,6 +49,9 @@ export class ShootPlanet extends engine.Container {
this.game.onScoreChange = (delta: number) => {
this.localScore += delta;
};
this.game.onGameOver = () => {
this.finalSubmit();
}
if (GuideMgr.instance.guideFlag == true) {
const car = this.game._car;
GuideMgr.instance.runGuide(0, car.x + car.width / 2, car.y + car.height / 2 /* - 130 */);
......@@ -108,14 +110,6 @@ export class ShootPlanet extends engine.Container {
this.isSubmiting = true;
let seq = NetUtils.encryptSeq(this.constantSubmitSeq);
/* return new Promise((resolve, reject) => {
console.error(this.constantSubmitSeq);
this.constantSubmitSeq++;
this.needSubmitCount--;
this.isSubmiting = false;
resolve();
}); */
return new Promise((resolve, reject) => {
Net.sendPost(Net.Url.constantSubmit, {
startId: this.startId,
......@@ -136,23 +130,7 @@ export class ShootPlanet extends engine.Container {
});
}
/* private updateTime() {
let temp = Math.ceil(this.game.timer / 1000);
let second = temp % 60;
let minute = (temp - second) / 60;
let str = "";
str += (minute < 10 ? "0" : "") + minute.toString();
str += ":";
str += (second < 10 ? "0" : "") + second.toString();
this.labelTime.text = str;
} */
public async finalSubmit(propsId?: string, onSubmited?: () => void) {
if (this.isSubmited) {
return;
}
this.isSubmited = true;
Loading.instace.show();
if (this.needSubmitCount > 0) {
if (!this.isSubmiting) {
......@@ -191,32 +169,13 @@ export class ShootPlanet extends engine.Container {
}
});
engine.globalEvent.dispatchEvent("ShootPlanetFinalSubmit",{
engine.globalEvent.dispatchEvent("ShootPlanetFinalSubmit", {
startId: this.startId,
score: score,
useSpId: propsId || "",
token: NetUtils.md5(this.startId.toString() + score.toString() + "qzBankRPW@dui88"),
validate: validate
});
return;
return new Promise<any>((resolve, reject) => {
//调用接口
Net.sendPost(Net.Url.finalSubmit, {
startId: this.startId,
score: score,
useSpId: propsId || "",
token: NetUtils.md5(this.startId.toString() + score.toString() + "qzBankRPW@dui88"),
validate: validate
}, (res) => {
Loading.instace.hide();
resolve(res);
}, (res) => {
Net.defaultOnFail(res);
reject(res);
});
});
}
}
......
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