Commit ed94117f authored by wangzhujun's avatar wangzhujun
parents 3f49b6b5 18030d40
...@@ -27,7 +27,7 @@ class App extends Component { ...@@ -27,7 +27,7 @@ class App extends Component {
const defaultPage = { const defaultPage = {
myPrize: MyPrize, // TODO 举例子 新宿台奖品页 myPrize: MyPrize, // TODO 举例子 新宿台奖品页
index: HomePage, index: HomePage,
}[skinId] || HomePage; }[skinId] || GamePage;
PageCtrl.changePage(defaultPage); PageCtrl.changePage(defaultPage);
} }
......
src/assets/FailPanel/bg.png

104 KB | W: | H:

src/assets/FailPanel/bg.png

74.2 KB | W: | H:

src/assets/FailPanel/bg.png
src/assets/FailPanel/bg.png
src/assets/FailPanel/bg.png
src/assets/FailPanel/bg.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -16,7 +16,7 @@ import { Stats } from 'pixi-stats'; ...@@ -16,7 +16,7 @@ import { Stats } from 'pixi-stats';
import { System } from 'detect-collisions'; import { System } from 'detect-collisions';
import gameStore from "@/store/gameStore.ts"; import gameStore from "@/store/gameStore.ts";
import { prefixInteger, second2Date } from "@/utils/utils.ts"; import { prefixInteger } from "@/utils/utils.ts";
export const collisionSys: System = new System(); export const collisionSys: System = new System();
const DEBUG = true ; const DEBUG = true ;
...@@ -32,6 +32,8 @@ export interface IGamePageState { ...@@ -32,6 +32,8 @@ export interface IGamePageState {
@observer @observer
class GamePage extends React.Component { class GamePage extends React.Component {
gameOver: boolean = false;
state: IGamePageState = { state: IGamePageState = {
} }
...@@ -60,6 +62,7 @@ class GamePage extends React.Component { ...@@ -60,6 +62,7 @@ class GamePage extends React.Component {
await this.initStage(); await this.initStage();
this.startCd(); this.startCd();
} }
startCd = () => { startCd = () => {
...@@ -68,6 +71,8 @@ class GamePage extends React.Component { ...@@ -68,6 +71,8 @@ class GamePage extends React.Component {
if (gameStore.gameInfo.cd <= 0) { if (gameStore.gameInfo.cd <= 0) {
clearInterval(this.interval); clearInterval(this.interval);
gameStore.gameInfo.cd = 0; gameStore.gameInfo.cd = 0;
this.gameOver = true;
gameStore.submit();
} }
}, 1000); }, 1000);
} }
...@@ -119,6 +124,8 @@ class GamePage extends React.Component { ...@@ -119,6 +124,8 @@ class GamePage extends React.Component {
} }
onUpdate = (time: Ticker) => { onUpdate = (time: Ticker) => {
if (this.gameOver) return;
Tween.flush(); Tween.flush();
this.game.onUpdate(time); this.game.onUpdate(time);
collisionSys.update(); collisionSys.update();
......
...@@ -7,31 +7,83 @@ ...@@ -7,31 +7,83 @@
left: 0; left: 0;
top: 0; top: 0;
.FailBg { .bg {
position: absolute; position: absolute;
left: 93px; left: 151px;
top: 538px; top: 447px;
width: 562px; width: 444px;
height: 349px; height: 560px;
.webpBg("FailPanel/bg.png"); .webpBg("FailPanel/bg.png");
} }
.cancel { .rank {
font-size: 29px;
color: rgb(255, 255, 255);
position: absolute; position: absolute;
left: 132px; left: 0;
top: 746px; top: 535px;
width: 233px; width: 100%;
height: 73px; text-align: center;
.webpBg("FailPanel/我知道了.png"); text-shadow: 0 0 5px #16c8c2,
0 0 5px #16c8c2,
0 0 5px #16c8c2,
0 0 10px #16c8c2,
0 0 10px #16c8c2,
0 0 20px #16c8c2;
} }
.again { .score {
font-size: 96.09px;
color: rgb(255, 255, 255);
font-weight: bold;
text-align: center;
position: absolute; position: absolute;
left: 370px; left: 0;
top: 739px; top: 672px;
width: 257px; width: 100%;
height: 95px; text-shadow: 0 0 5px #f3d71a,
.webpBg("FailPanel/再来一次.png"); 0 0 5px #f3d71a,
0 0 5px #f3d71a,
0 0 10px #f3d71a,
0 0 10px #f3d71a;
span {
font-size: 32.34px;
}
}
.tip {
color: rgb(255, 255, 255);
font-size: 20px;
text-align: center;
position: absolute;
left: 0;
top: 800px;
width: 100%;
line-height: 33px;
span {
font-size: 26px;
color: #f3c81b;
}
}
.btn {
position: absolute;
left: 214px;
top: 887px;
width: 318px;
height: 80px;
.webpBg("FailPanel/btn.png");
}
.close {
position: absolute;
left: 340px;
top: 1023px;
width: 70px;
height: 70px;
.webpBg("FailPanel/close.png");
} }
} }
...@@ -4,30 +4,46 @@ import "./FailPanel.less"; ...@@ -4,30 +4,46 @@ import "./FailPanel.less";
import {Button} from "@grace/ui"; import {Button} from "@grace/ui";
import {_asyncThrottle} from "@/utils/utils.ts"; import {_asyncThrottle} from "@/utils/utils.ts";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx"; import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx";
import PrizePanel from "@/panels/PrizePanel/PrizePanel.tsx"; import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx";
import HomePage from "@/pages/HomePage/HomePage.tsx";
export interface IFailPanelProps {
score: number,
rank: number,
prizeName: string,
reachTargetScore: boolean,
drawChance: number,
}
@observer @observer
class FailPanel extends React.Component { class FailPanel extends React.Component<IFailPanelProps> {
componentDidMount() { componentDidMount() {
} }
clickCancel = () => { clickClose = () => {
ModalCtrl.showModal(PrizePanel, { ModalCtrl.closeModal();
prizeVO: { }, PageCtrl.changePage(HomePage);
});
}; };
clickAgain = _asyncThrottle(async () => { clickBtn = _asyncThrottle(async () => {
ModalCtrl.closeModal();
}); });
render() { render() {
return <div className="FailPanel">
<div className="FailBg"/>
<Button className="cancel md12" onClick={this.clickCancel}/> const {score, rank} = this.props;
<Button className="again md13" onClick={this.clickAgain}/>
return <div className="FailPanel">
<div className="bg"/>
<div className="rank">当前排名:NO.{rank}</div>
<div className="score">{score}<span></span></div>
<div className="tip">
单局游戏分数达200<br/>
即可获得<span>1次抽奖机会</span>
</div>
<Button className="btn" onClick={this.clickBtn}/>
<Button className="close" onClick={this.clickClose}/>
</div>; </div>;
} }
} }
......
...@@ -3,7 +3,6 @@ import { observer } from "mobx-react"; ...@@ -3,7 +3,6 @@ import { observer } from "mobx-react";
import "./PrizePanel.less"; import "./PrizePanel.less";
import { Button } from "@grace/ui"; import { Button } from "@grace/ui";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx"; import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx";
import FailPanel from "@/panels/FailPanel/FailPanel.tsx";
export interface IPrizePanelProps { export interface IPrizePanelProps {
...@@ -26,7 +25,6 @@ class PrizePanel extends React.Component<IPrizePanelProps> { ...@@ -26,7 +25,6 @@ class PrizePanel extends React.Component<IPrizePanelProps> {
}; };
clickGet = () => { clickGet = () => {
ModalCtrl.showModal(FailPanel);
}; };
......
@import "../../res.less";
.SucPanel {
width: 750px;
height: 1624px;
position: absolute;
left: 0;
top: 0;
.bg {
position: absolute;
left: 153px;
top: 335px;
width: 444px;
height: 706px;
.webpBg("SucPanel/bg.png");
}
.rank {
font-size: 29px;
color: rgb(255, 255, 255);
position: absolute;
left: 0;
top: 424px;
width: 100%;
text-align: center;
text-shadow: 0 0 5px #16c8c2,
0 0 5px #16c8c2,
0 0 5px #16c8c2,
0 0 10px #16c8c2,
0 0 10px #16c8c2,
0 0 20px #16c8c2;
}
.score {
font-size: 96.09px;
color: rgb(255, 255, 255);
font-weight: bold;
text-align: center;
position: absolute;
left: 0;
top: 555px;
width: 100%;
text-shadow: 0 0 5px #f3d71a,
0 0 5px #f3d71a,
0 0 5px #f3d71a,
0 0 10px #f3d71a,
0 0 10px #f3d71a;
span {
font-size: 32.34px;
}
}
.tip {
color: rgb(255, 255, 255);
font-size: 32.34px;
text-align: center;
position: absolute;
left: 0;
top: 682px;
width: 100%;
span {
margin-left: 10px;
font-size: 32.34px;
text-shadow: 0 0 5px #f3d71a,
0 0 5px #f3d71a,
0 0 5px #f3d71a,
0 0 10px #f3d71a,
0 0 10px #f3d71a;
}
}
.btn {
position: absolute;
left: 233px;
top: 904px;
width: 284px;
height: 90px;
.webpBg("SucPanel/btn.png");
}
.close {
position: absolute;
left: 341px;
top: 1065px;
width: 70px;
height: 70px;
.webpBg("SucPanel/close.png");
}
}
import React from "react";
import {observer} from "mobx-react";
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,
rank: number,
prizeName: string,
reachTargetScore: boolean,
drawChance: number,
}
@observer
class SucPanel extends React.Component<ISucPanelProps> {
componentDidMount() {
}
clickClose = () => {
ModalCtrl.closeModal();
PageCtrl.changePage(HomePage);
};
clickBtn = _asyncThrottle(async () => {
});
render() {
const {score, rank} = this.props;
return <div className="SucPanel">
<div className="bg"/>
<div className="rank">当前排名:NO.{rank}</div>
<div className="score">{score}<span></span></div>
<div className="tip">恭喜获得抽奖机会<span>+1</span></div>
<Button className="btn" onClick={this.clickBtn}/>
<Button className="close" onClick={this.clickClose}/>
</div>;
}
}
export default SucPanel;
...@@ -6,6 +6,9 @@ import {AESEncrypt} from "@/utils/Crypto.ts"; ...@@ -6,6 +6,9 @@ import {AESEncrypt} from "@/utils/Crypto.ts";
import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx"; import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx";
import HomePage from "@/pages/HomePage/HomePage.tsx"; import HomePage from "@/pages/HomePage/HomePage.tsx";
import { GameConfig } from "@/pages/GamePage/config/Config.ts"; import { GameConfig } from "@/pages/GamePage/config/Config.ts";
import FailPanel from "@/panels/FailPanel/FailPanel.tsx";
import SucPanel from "@/panels/SucPanel/SucPanel.tsx";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx";
class GameStore { class GameStore {
...@@ -77,10 +80,9 @@ class GameStore { ...@@ -77,10 +80,9 @@ class GameStore {
} }
} }
async submit(score: number) { async submit() {
const { recordId } = this.startInfo;
const recordId = this.startInfo.recordId; const { score } = this.gameInfo;
const param = AESEncrypt(JSON.stringify({ const param = AESEncrypt(JSON.stringify({
timestamp: Date.now(), timestamp: Date.now(),
recordId, recordId,
...@@ -94,8 +96,10 @@ class GameStore { ...@@ -94,8 +96,10 @@ class GameStore {
return; return;
} }
if (data) { if (data.reachTargetScore) {
ModalCtrl.showModal(SucPanel, data);
} else { } else {
ModalCtrl.showModal(FailPanel, data);
} }
} }
......
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