Commit cc98c03e authored by jtwu's avatar jtwu

6

parent 2314a1ee
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
left: 0; left: 0;
top: 50%; top: 50%;
width: 750px; width: 750px;
height: 1624px; height: 100vh;
//touch-action: auto !important; //touch-action: auto !important;
transform: translateY(-50%); transform: translateY(-50%);
} }
......
...@@ -23,6 +23,7 @@ import { LOG_KEY, pageView, sensorLog } from "@/utils/sensors"; ...@@ -23,6 +23,7 @@ import { LOG_KEY, pageView, sensorLog } from "@/utils/sensors";
import "./js/output"; import "./js/output";
import API from '@/api'; import API from '@/api';
import { handleLogClick, handleLogExposure } from '@/MD'; import { handleLogClick, handleLogExposure } from '@/MD';
import Homepage from '../HomePage/HomePage';
declare const Game: any; declare const Game: any;
...@@ -80,14 +81,15 @@ class GamePage extends React.Component<any, any> { ...@@ -80,14 +81,15 @@ class GamePage extends React.Component<any, any> {
// } // }
} }
}) })
//退出游戏
store.game.addGlobalEvent("exitGame", (e) => { store.game.addGlobalEvent("exitGame", (e) => {
//自行切换,游戏有需要就销毁 //自行切换,游戏有需要就销毁
store.game.destroy() store.game.destroy()
PageCtrl.changePage(Homepage)
}) })
// store.game.addGlobalEvent("pauseGame", (e) => {
store.game.addGlobalEvent("pauseGame", (e) => { // console.log('暂停游戏')
console.log(123123123) // })
})
//派发事件,比如倒计时暂停,pauseGame|continueGame|restartGame //派发事件,比如倒计时暂停,pauseGame|continueGame|restartGame
...@@ -96,12 +98,12 @@ class GamePage extends React.Component<any, any> { ...@@ -96,12 +98,12 @@ class GamePage extends React.Component<any, any> {
//继续游戏 //继续游戏
// store.game.dispatchGlobalEvent("continueGame") // store.game.dispatchGlobalEvent("continueGame")
//重玩游戏 //重玩游戏
store.game.dispatchGlobalEvent("restartGame", { targetStudy: 1, targetTravel: 1, time: 120 }) // store.game.dispatchGlobalEvent("restartGame", { targetStudy: 1, targetTravel: 1, time: 120 })
} }
componentWillUnmount() { componentWillUnmount() {
store.game.destroy()
} }
render() { render() {
......
...@@ -6,6 +6,7 @@ import './index.less'; ...@@ -6,6 +6,7 @@ import './index.less';
import { _asyncThrottle, _throttle } from '../../utils/utils.ts'; import { _asyncThrottle, _throttle } from '../../utils/utils.ts';
import { ModalCtrl } from '@/core/ctrls/ModalCtrl'; import { ModalCtrl } from '@/core/ctrls/ModalCtrl';
import store from "@/store/store.js"; import store from "@/store/store.js";
import gameStore from "@/store/gameStore.js";
import { PageCtrl } from "@/core/ctrls/PageCtrl"; import { PageCtrl } from "@/core/ctrls/PageCtrl";
import HomePage from '@/pages/HomePage/HomePage.tsx'; import HomePage from '@/pages/HomePage/HomePage.tsx';
...@@ -29,13 +30,16 @@ class FailPopup extends React.Component { ...@@ -29,13 +30,16 @@ class FailPopup extends React.Component {
//再玩一次 //再玩一次
onReceive = () => { onReceive = () => {
ModalCtrl.closeModal(); ModalCtrl.closeModal();
PageCtrl.changePage(HomePage);//回到首页 // PageCtrl.changePage(HomePage);//回到首页
/*
//重玩游戏 //重玩游戏
if (store.game) { if (store.game) {
store.game.dispatchGlobalEvent("restartGame", { targetStudy: 1, targetTravel: 1, time: 120 }) const d = {
targetStudy: gameStore.gameInfo.targetConfig.target1,
targetTravel: gameStore.gameInfo.targetConfig.target2,
time: gameStore.gameInfo.countdownSeconds
}
store.game.dispatchGlobalEvent("restartGame", d)
} }
*/
} }
render() { render() {
......
...@@ -18,6 +18,13 @@ import { PageCtrl } from "@/core/ctrls/PageCtrl"; ...@@ -18,6 +18,13 @@ import { PageCtrl } from "@/core/ctrls/PageCtrl";
import HomePage from '@/pages/HomePage/HomePage.tsx'; import HomePage from '@/pages/HomePage/HomePage.tsx';
import GiftPackPopup from '@/panels/GiftPackPopup/index.jsx'; import GiftPackPopup from '@/panels/GiftPackPopup/index.jsx';
const cities = [
{ spId: 'sp_landmark1', name: '北京', icon: '../src/assets/victoryPopup/cities_sp_landmark1.png' },
{ spId: 'sp_landmark2', name: '西安', icon: '../src/assets/victoryPopup/cities_sp_landmark2.png' },
{ spId: 'sp_landmark3', name: '上海', icon: '../src/assets/victoryPopup/cities_sp_landmark3.png' },
{ spId: 'sp_landmark4', name: '杭州', icon: '../src/assets/victoryPopup/cities_sp_landmark4.png' },
{ spId: 'sp_landmark5', name: '成都', icon: '../src/assets/victoryPopup/cities_sp_landmark5.png' }
];
@observer @observer
class VictoryPopup extends React.Component { class VictoryPopup extends React.Component {
constructor(props) { constructor(props) {
...@@ -32,24 +39,26 @@ class VictoryPopup extends React.Component { ...@@ -32,24 +39,26 @@ class VictoryPopup extends React.Component {
} }
//抽奖 //抽奖
onDraw = ()=>{ onDraw = async () => {
ModalCtrl.closeModal(); ModalCtrl.closeModal();
// ModalCtrl.showModal(GiftPackPopup); // ModalCtrl.showModal(GiftPackPopup);
await store.getDrawInfo();
store.doLotttery(); store.doLotttery();
} }
render() { render() {
const { gotSpInfo, rewardDrawTimes } = this.state;
return ( return (
<div className="VictoryPopup"> <div className="VictoryPopup">
<div className="vp_mask"></div> <div className="vp_mask"></div>
<div className='vp_title'></div> <div className='vp_title'></div>
<div className='vp_ditu_txt'>{this.state?.gotSpInfo.name}地图</div> <div className='vp_ditu_txt'>{gotSpInfo.name}地图</div>
<div className='vp_guang'></div> <div className='vp_guang'></div>
<div className='vp_xz_icon' style={{backgroundImage: `url(${this.state?.gotSpInfo.icon})`}}></div> <div className='vp_xz_icon' style={{ backgroundImage: `url(${cities.find(city => city.spId === gotSpInfo.spId).icon})` }}></div>
<div className='vp_cjjh_tips'> <div className='vp_cjjh_tips'>
<div>抽奖机会+{this.state?.rewardDrawTimes}</div> <div>抽奖机会+{rewardDrawTimes}</div>
</div> </div>
<div className='vp_btn' onClick={()=>this.onDraw()}></div> <div className='vp_btn' onClick={() => this.onDraw()}></div>
<div className='vp_close' onClick={() => this.onClose()}></div> <div className='vp_close' onClick={() => this.onClose()}></div>
</div> </div>
); );
......
...@@ -69,6 +69,7 @@ class GameStore { ...@@ -69,6 +69,7 @@ class GameStore {
const param = AESEncrypt(JSON.stringify(d), "4fe20bdefdd4804f", "cDOiBC1n2QrkAY2P"); const param = AESEncrypt(JSON.stringify(d), "4fe20bdefdd4804f", "cDOiBC1n2QrkAY2P");
const { success, data } = await API.submit({ param }); const { success, data } = await API.submit({ param });
this.gameInfo.isSubmit = true;
if (!success) { if (!success) {
PageCtrl.changePage(HomePage); PageCtrl.changePage(HomePage);
return success; return success;
......
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