Commit 18030d40 authored by haiyoucuv's avatar haiyoucuv

倒计时

parent 553a1938
......@@ -32,6 +32,8 @@ export interface IGamePageState {
@observer
class GamePage extends React.Component {
gameOver: boolean = false;
state: IGamePageState = {
}
......@@ -69,6 +71,8 @@ class GamePage extends React.Component {
if (gameStore.gameInfo.cd <= 0) {
clearInterval(this.interval);
gameStore.gameInfo.cd = 0;
this.gameOver = true;
gameStore.submit();
}
}, 1000);
}
......@@ -120,6 +124,8 @@ class GamePage extends React.Component {
}
onUpdate = (time: Ticker) => {
if (this.gameOver) return;
Tween.flush();
this.game.onUpdate(time);
collisionSys.update();
......
......@@ -4,6 +4,8 @@ import "./FailPanel.less";
import {Button} from "@grace/ui";
import {_asyncThrottle} from "@/utils/utils.ts";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx";
import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx";
import HomePage from "@/pages/HomePage/HomePage.tsx";
export interface IFailPanelProps {
score: number,
......@@ -21,6 +23,7 @@ class FailPanel extends React.Component<IFailPanelProps> {
clickClose = () => {
ModalCtrl.closeModal();
PageCtrl.changePage(HomePage);
};
clickBtn = _asyncThrottle(async () => {
......
......@@ -4,6 +4,8 @@ import "./SucPanel.less";
import {Button} from "@grace/ui";
import {_asyncThrottle} from "@/utils/utils.ts";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx";
import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx";
import HomePage from "@/pages/HomePage/HomePage.tsx";
export interface ISucPanelProps {
score: number,
......@@ -21,6 +23,7 @@ class SucPanel extends React.Component<ISucPanelProps> {
clickClose = () => {
ModalCtrl.closeModal();
PageCtrl.changePage(HomePage);
};
clickBtn = _asyncThrottle(async () => {
......
......@@ -80,10 +80,9 @@ class GameStore {
}
}
async submit(score: number) {
const recordId = this.startInfo.recordId;
async submit() {
const { recordId } = this.startInfo;
const { score } = this.gameInfo;
const param = AESEncrypt(JSON.stringify({
timestamp: Date.now(),
recordId,
......
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