Commit b343ee9c authored by huangwenjie's avatar huangwenjie

1.0

parent dc05c071
......@@ -44,9 +44,8 @@
</head>
<body>
<audio style="display:none;
height: 0" id="bg0-music" preload="auto"
src="https://yun.duiba.com.cn/db_games/activity/dwslz_wn/bg0Music.mp3" loop="loop">
<audio style="display:none;height: 0" id="bg0-music" preload="auto"
src="https://yun.duiba.com.cn/db_games/activity/ChristmasGifts/music/bgMusic.mp3" loop="loop">
</audio>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main"
data-orientation="auto" data-scale-mode="fixedWidth" data-frame-rate="60" data-content-width="750"
......@@ -89,7 +88,7 @@
// var dev = true;
var resPath = '';
// svga路径
var svgaPath = "//duiba.oss-cn-hangzhou.aliyuncs.com/db_games/activity/ChristmasGifts/svgas/"
var svgaPath = "//yun.duiba.com.cn/db_games/activity/ChristmasGifts/svgas/"
// http://duiba.oss-cn-hangzhou.aliyuncs.com/db_games/activity/Thanksgivingballons/svgas/playTurkey.svga
function resolve(a) {
var b = eval(a);
......
......@@ -4,7 +4,7 @@ import { IExposureData } from '../data/common/IExposureData';
export class Buried {
private static appId: number;
// private static consumerId: number;
private static consumerId: number;
private static oaId: number;
/**
......@@ -13,19 +13,19 @@ export class Buried {
public static init(): void {
if (DataManager.ins.gameCfgData) {
this.appId = DataManager.ins.gameCfgData.appInfo.appId;
// this.consumerId = DataManager.ins.getInfoData.consumerId;
this.consumerId = DataManager.ins.getInfoData.consumerId;
this.oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
} else if (DataManager.ins.customCfgData) {
this.appId = DataManager.ins.customCfgData.appId;
// this.consumerId = DataManager.ins.customCfgData.consumerId;
this.consumerId = DataManager.ins.customCfgData.consumerId;
this.oaId = DataManager.ins.customCfgData.oaId;
} else if (DataManager.ins.petIndexData && DataManager.ins.petIndexData.appId && DataManager.ins.petIndexData.activityId) {
this.appId = DataManager.ins.petIndexData.appId;
// this.consumerId = DataManager.ins.petIndexData.consumerId;
this.consumerId = DataManager.ins.petIndexData.consumerId;
this.oaId = DataManager.ins.petIndexData.activityId;
} else if (DataManager.ins.petsIndexData && DataManager.ins.petsIndexData.appId && DataManager.ins.petsIndexData.activityId) {
this.appId = DataManager.ins.petsIndexData.appId;
// this.consumerId = DataManager.ins.petsIndexData.consumerId;
this.consumerId = DataManager.ins.petsIndexData.consumerId;
this.oaId = DataManager.ins.petsIndexData.activityId;
} else {
this.appId = window['appId']
......@@ -45,7 +45,7 @@ export class Buried {
const exposure: IExposureData = {
dpm: dpm,
dcm: dcm,
// consumerId: Buried.consumerId,
consumerId: Buried.consumerId,
appId: Buried.appId,
domain: embedDomain
};
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Guide_1","version":5,"files":["..\\assets\\guide\\finger.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Guide_1","version":5,"files":["..\\assets\\guide\\step3Tips.png","..\\assets\\guide\\step2Tips.png","..\\assets\\guide\\step1Tips.png","..\\assets\\guide\\guideDir.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Preload_0","version":5,"files":["..\\assets\\waiting\\progress.png","..\\assets\\waiting\\bg.png","..\\assets\\pops\\sureBtn.png","..\\assets\\pops\\ruleTitle.png","..\\assets\\pops\\restartBtn.png","..\\assets\\pops\\prizePanelBg.png","..\\assets\\pops\\noPrizeTitle.png","..\\assets\\pops\\msgSureBtn.png","..\\assets\\pops\\msgBg.png","..\\assets\\pops\\loginBtn.png","..\\assets\\pops\\knowBtn.png","..\\assets\\common\\closeBtn.png","..\\assets\\pops\\noPrizePanelBg.png","..\\assets\\pops\\ruleBg.png","..\\assets\\pops\\restartBtn3.png","..\\assets\\pops\\restartBtn2.png","..\\assets\\pops\\warningtitle.png","..\\assets\\pops\\useBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Preload_0","version":5,"files":["..\\assets\\waiting\\progress.png","..\\assets\\waiting\\bg.png","..\\assets\\pops\\sureBtn.png","..\\assets\\pops\\ruleTitle.png","..\\assets\\pops\\restartBtn.png","..\\assets\\pops\\prizePanelBg.png","..\\assets\\pops\\noPrizeTitle.png","..\\assets\\pops\\msgSureBtn.png","..\\assets\\pops\\msgBg.png","..\\assets\\pops\\loginBtn.png","..\\assets\\pops\\knowBtn.png","..\\assets\\common\\closeBtn.png","..\\assets\\pops\\noPrizePanelBg.png","..\\assets\\pops\\ruleBg.png","..\\assets\\pops\\restartBtn3.png","..\\assets\\pops\\restartBtn2.png","..\\assets\\pops\\warningtitle.png","..\\assets\\pops\\useBtn.png","..\\assets\\common\\musicOn.png","..\\assets\\common\\musicOff.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_5","version":5,"files":["..\\assets\\common\\musicOn.png","..\\assets\\common\\musicOff.png","..\\assets\\guide\\guideDir.png","..\\assets\\guide\\step1Tips.png","..\\assets\\guide\\step2Tips.png","..\\assets\\guide\\step3Tips.png"]}
\ No newline at end of file
{
"groups": [
{
"keys": "progress_png,bg_png,sureBtn_png,ruleTitle_png,restartBtn_png,prizePanelBg_png,noPrizeTitle_png,msgSureBtn_png,msgBg_png,loginBtn_png,knowBtn_png,closeBtn_png,noPrizePanelBg_png,ruleBg_png,restartBtn3_png,restartBtn2_png,warningtitle_png,useBtn_png",
"keys": "progress_png,bg_png,sureBtn_png,ruleTitle_png,restartBtn_png,prizePanelBg_png,noPrizeTitle_png,msgSureBtn_png,msgBg_png,loginBtn_png,knowBtn_png,closeBtn_png,noPrizePanelBg_png,ruleBg_png,restartBtn3_png,restartBtn2_png,warningtitle_png,useBtn_png,musicOn_png,musicOff_png",
"name": "Preload"
},
{
"keys": "finger_png",
"keys": "step3Tips_png,step2Tips_png,step1Tips_png,guideDir_png",
"name": "Guide"
},
{
......@@ -19,10 +19,6 @@
{
"keys": "ready_mp3,impact_stone_mp3,impact_snow_mp3,gameSuc_mp3,gameFail_mp3,fall_mp3,collect_mp3,bgMusic_mp3",
"name": "Music"
},
{
"name": "preload",
"keys": "musicOn_png,musicOff_png,guideDir_png,step1Tips_png,step2Tips_png,step3Tips_png"
}
],
"resources": [
......@@ -252,34 +248,34 @@
"name": "impact_stone_mp3"
},
{
"name": "musicOn_png",
"url": "assets/common/musicOn.png",
"type": "image",
"url": "assets/common/musicOn.png"
"name": "musicOn_png"
},
{
"name": "musicOff_png",
"url": "assets/common/musicOff.png",
"type": "image",
"url": "assets/common/musicOff.png"
"name": "musicOff_png"
},
{
"name": "guideDir_png",
"url": "assets/guide/guideDir.png",
"type": "image",
"url": "assets/guide/guideDir.png"
"name": "guideDir_png"
},
{
"name": "step1Tips_png",
"url": "assets/guide/step1Tips.png",
"type": "image",
"url": "assets/guide/step1Tips.png"
"name": "step1Tips_png"
},
{
"name": "step2Tips_png",
"url": "assets/guide/step2Tips.png",
"type": "image",
"url": "assets/guide/step2Tips.png"
"name": "step2Tips_png"
},
{
"name": "step3Tips_png",
"url": "assets/guide/step3Tips.png",
"type": "image",
"url": "assets/guide/step3Tips.png"
"name": "step3Tips_png"
}
]
}
\ No newline at end of file
{
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/ToastSkin.exml",
"resource/skins/BallonSkin.exml",
"resource/skins/GetCreditsSkin.exml",
"resource/skins/LoginSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/WarningSkin.exml",
"resource/skins/ReadySkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/StartSkin.exml",
"resource/skins/PlaySkin.exml",
"resource/skins/GameFailSkin.exml",
"resource/skins/NoPrizeSkin.exml",
"resource/skins/PrizeSkin.exml",
"resource/skins/VScrollBarSkin.exml",
"resource/skins/WaitingSkin.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/MusicButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml",
"resource/skins/ui/SliderSkin.exml",
"resource/skins/ui/StartButtonSkin.exml"
],
"path": "resource/default.thm.json"
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/BallonSkin.exml",
"resource/skins/GameFailSkin.exml",
"resource/skins/GetCreditsSkin.exml",
"resource/skins/LoginSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/NoPrizeSkin.exml",
"resource/skins/PlaySkin.exml",
"resource/skins/PrizeSkin.exml",
"resource/skins/ReadySkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/StartSkin.exml",
"resource/skins/ToastSkin.exml",
"resource/skins/VScrollBarSkin.exml",
"resource/skins/WaitingSkin.exml",
"resource/skins/WarningSkin.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/MusicButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml",
"resource/skins/ui/SliderSkin.exml",
"resource/skins/ui/StartButtonSkin.exml"
],
"path": "resource/default.thm.json"
}
\ No newline at end of file
......@@ -6,7 +6,8 @@
<e:Label id="prizeName" y="782" width="508" textAlign="center" size="30" fontFamily="Microsoft YaHei" text="六字奖品文案" textColor="0x661414" horizontalCenter="0" x="121" scaleX="1" scaleY="1"/>
<e:Button id="sureBtn" label="" skinName="ui.IconButtonSkin" icon="msgSureBtn_png" y="877" width="343" anchorOffsetX="171.5" height="87" anchorOffsetY="43.5" scaleX="1" scaleY="1" horizontalCenter="0.5"/>
<e:Button id="againBtn" label="" skinName="ui.IconButtonSkin" icon="restartBtn_png" y="877" anchorOffsetX="119" anchorOffsetY="50" scaleX="1" scaleY="1" width="238" height="100" x="506"/>
<e:Button id="useBtn" label="" skinName="ui.IconButtonSkin" icon="useBtn_png" y="877" anchorOffsetX="119" anchorOffsetY="50" scaleX="1" scaleY="1" width="238" height="100" x="243"/>
<e:Image id="prizeImg" width="512" height="240" horizontalCenter="0" y="527" scaleX="1" scaleY="1" x="119"/>
<e:Button id="closeBtn" label="Button" skinName="ui.IconButtonSkin" icon="closeBtn_png" width="49" height="49" horizontalCenter="300.5" anchorOffsetX="24.5" anchorOffsetY="24.5" y="119" x="651" scaleX="1" scaleY="1"/>
<e:Label id="scoreTxt" text="0" x="124" y="476.68" anchorOffsetX="0" width="250" anchorOffsetY="0" height="50" textColor="0x000000" textAlign="center" verticalAlign="middle" fontFamily="Microsoft YaHei" size="25"/>
......
import { Buried } from './../libs/tw/util/Buried';
import GetCreditsPanel from './pops/getCredits/GetCreditsPanel';
import { LoginPanel } from './pops/login/LoginPanel';
import { DataManager } from './../libs/tw/manager/DataManager';
......@@ -141,6 +142,8 @@ class Main extends MainBase {
// 创建游戏场景
protected async createGameScene() {
super.createGameScene();
Buried.init()
//获取UA信息
GameConst.userAgent = navigator.userAgent.toLowerCase();
console.log(GameConst.userAgent);
......@@ -152,11 +155,16 @@ class Main extends MainBase {
// 开始计时停留时长
// initstatistics();
if (GameConst.isIOS()) {
GameConst.isPlayMusic = false;
} else {
GameConst.isPlayMusic = true;
}
await NetPromise.ajaxElement()
.catch((e) => {
console.error(e);
Waiting.instance.hide()
PanelCtrl.instance.show(ModuleTypes.MSG_PANEL, { msg: "网络异常,请重试~", type: "reload", title: "很遗憾" })
})
Waiting.instance.hide()
......
......@@ -29,10 +29,14 @@ export const playBg = async () => {
}
export enum SoundType {
levelUp = 'levelUp',
createEq = 'createEq',
createCoins = 'createCoins',
collectCoins = 'collectCoins'
bgMusic = 'bgMusic',
collect = 'collect',
fall = 'fall',
gameFail = 'gameFail',
gameSuc = 'gameSuc',
impact_stone = 'impact_stone',
impact_snow = 'impact_snow',
ready = 'ready'
}
......
import { NetManager } from './../../../libs/tw/manager/NetManager';
import { Buried } from './../../../libs/tw/util/Buried';
import { DataManager } from './../../../libs/tw/manager/DataManager';
import Panel from "../../views/Panel";
......@@ -16,6 +18,17 @@ export default class GetCreditsPanel extends Panel {
start() {
this.msgTitle.text = `${DataManager.ins.customCfgData.unitName}不足`;
this.tips.text = `抱歉,您当前的${DataManager.ins.customCfgData.unitName}不足`;
this.initBuried()
}
getExposure
initBuried() {
let getDpmOut = Buried.connectDpm(254, 6, 1); // 点击埋点
let getDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.getExposure = Buried.createExposure(getDpmOut, getDcmOut);
NetManager.ins.showLog(this.getExposure);
}
initEvents() {
......@@ -25,6 +38,7 @@ export default class GetCreditsPanel extends Panel {
onTap_earnBtn() {
// 赚积分链接
NetManager.ins.clickLog(this.getExposure)
if (window["CFG"] && window["CFG"].getCreditsLink && window["CFG"].getCreditsLink !== "") {
window.location.href = window["CFG"].getCreditsLink;
} else {
......
import { Buried } from './../../../libs/tw/util/Buried';
import { noPrizeTypes } from './../../scenes/playScene/PlayScene';
import { DataManager } from './../../../libs/tw/manager/DataManager';
import { NetManager } from './../../../libs/tw/manager/NetManager';
......@@ -23,6 +24,8 @@ export default class NoPrizePanel extends Panel {
get maxScore() { return DataManager.ins.getData("ngameSubmit").data.maxScore }
start(data) {
this.initBuried()
if (this.score) {
this.scoreTxt.text = `${this.score}`
} else {
......@@ -35,6 +38,16 @@ export default class NoPrizePanel extends Panel {
this.maxScoreTxt.text = `0`
}
}
againExposure
initBuried() {
let againDpmOut = Buried.connectDpm(254, 4, 1); // 点击埋点
let againDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.againExposure = Buried.createExposure(againDpmOut, againDcmOut);
NetManager.ins.showLog(this.againExposure);
}
initEvents() {
......@@ -45,6 +58,7 @@ export default class NoPrizePanel extends Panel {
}
private onTap_CloseBtn(e: egret.TouchEvent) {
NetManager.ins.clickLog(this.againExposure)
Waiting.instance.show()
NetPromise.ajaxElement()
.then(() => {
......
......@@ -16,14 +16,14 @@ export default class PrizePanel extends Panel {
protected get skinKey() { return 'Prize' }
public prizeName: eui.Label;
public sureBtn: eui.Button;
public againBtn: eui.Button;
public useBtn: eui.Button;
public prizeImg: eui.Image;
public closeBtn: eui.Button;
public scoreTxt: eui.Label;
public maxScoreTxt: eui.Label;
get lottery() { return DataManager.ins.getData("getOrderStatus").data.lottery; }
get score() { return DataManager.ins.getData("ngameSubmit").data.score }
get maxScore() { return DataManager.ins.getData("ngameSubmit").data.maxScore }
......@@ -32,9 +32,27 @@ export default class PrizePanel extends Panel {
get bigPicRatio() { return 640 / 300 }
//埋点
useExposure
againExposure
initBuired() {
let useDpmOut = Buried.connectDpm(254, 2, 1); // 点击埋点
let useDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.useExposure = Buried.createExposure(useDpmOut, useDcmOut);
NetManager.ins.showLog(this.useExposure);
let againDpmOut = Buried.connectDpm(254, 3, 1); // 点击埋点
let againDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.againExposure = Buried.createExposure(againDpmOut, againDcmOut);
NetManager.ins.showLog(this.againExposure);
}
// 开始
start() {
this.initBuired()
if (this.lottery) {
const sizeType = getOptionImgSize(this.lottery);
if (ImgSizeType.BIG === sizeType) {
......@@ -69,11 +87,13 @@ export default class PrizePanel extends Panel {
initEvents() {
super.initEvents();
this.onTap(this.closeBtn, this.onTap_CloseBtn)
this.onTap(this.sureBtn, this.onTap_CloseBtn)
this.onTap(this.againBtn, this.onTap_CloseBtn)
this.onTap(this.useBtn, this.onTap_GetPrize)
this.onTap(this.prizeImg, this.onTap_GetPrize)
}
onTap_GetPrize() {
NetManager.ins.clickLog(this.useExposure)
if (this.lottery.type == LotteryType.LUCKY) {
window["downloadAppConfig"] =
......@@ -94,6 +114,7 @@ export default class PrizePanel extends Panel {
}
onTap_CloseBtn(e: egret.TouchEvent) {
NetManager.ins.clickLog(this.againExposure)
NetPromise.ajaxElement()
.then(() => {
this.hidePanel()
......@@ -111,7 +132,8 @@ export default class PrizePanel extends Panel {
removeEvents() {
super.removeEvents()
this.clearTap(this.closeBtn, this.onTap_CloseBtn)
this.clearTap(this.sureBtn, this.onTap_CloseBtn)
this.clearTap(this.againBtn, this.onTap_CloseBtn)
this.clearTap(this.useBtn, this.onTap_GetPrize)
this.clearTap(this.prizeImg, this.onTap_GetPrize)
}
......
import { NetManager } from './../../../libs/tw/manager/NetManager';
import { Buried } from './../../../libs/tw/util/Buried';
import { BarrierType } from './../../scenes/playScene/Barrier';
import { NetPromise } from '../../promises/NetPromise';
import Panel from "../../views/Panel";
......@@ -34,6 +36,15 @@ export default class GameFailPanel extends Panel {
}
}
againExposure
initBuried() {
let againDpmOut = Buried.connectDpm(254, 5, 1); // 点击埋点
let againDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.againExposure = Buried.createExposure(againDpmOut, againDcmOut);
NetManager.ins.showLog(this.againExposure);
}
initEvents() {
super.initEvents()
this.onTap(this.againBtn, this.onTap_againBtn)
......@@ -41,6 +52,7 @@ export default class GameFailPanel extends Panel {
}
onTap_againBtn() {
NetManager.ins.clickLog(this.againExposure)
NetPromise.ajaxElement()
.then(() => {
this.hidePanel()
......
import { NetManager } from './../../../libs/tw/manager/NetManager';
import { Buried } from './../../../libs/tw/util/Buried';
import { DataManager } from './../../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../../types/ModuleTypes';
import { NetPromise } from './../../promises/NetPromise';
......@@ -26,6 +28,20 @@ export default class warningPanel extends Panel {
this.warningTips.text = `确认消耗${this.cost}${this.unitName}参与游戏吗?`
}
start() {
this.initBuried()
}
sureExposure
initBuried() {
let sureDpmOut = Buried.connectDpm(254, 7, 1); // 点击埋点
let sureDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.sureExposure = Buried.createExposure(sureDpmOut, sureDcmOut);
NetManager.ins.showLog(this.sureExposure);
}
initEvents() {
super.initEvents()
this.onTap(this.sureBtn, this.doStart)
......@@ -37,6 +53,7 @@ export default class warningPanel extends Panel {
}
doStart() {
NetManager.ins.clickLog(this.sureExposure)
Waiting.instance.show()
NetPromise.doJoin()
.then(() => {
......
import { NetManager } from './../../libs/tw/manager/NetManager';
import { Buried } from './../../libs/tw/util/Buried';
import { playSound, SoundType } from './../ctrls/soundCtrl';
import GameConst, { arr, wait } from './../consts/GameConst';
import { DataManager } from './../../libs/tw/manager/DataManager';
import { GDispatcher } from './../../libs/tc/util/GDispatcher';
......@@ -40,7 +43,7 @@ export default class StartScene extends Scene {
start() {
super.start()
this.initUI()
this.initBuired()
}
initUI() {
......@@ -57,6 +60,17 @@ export default class StartScene extends Scene {
this.initAni()
}
startExposure
initBuired() {
// 开始按钮曝光埋点
let startDpmOut = Buried.connectDpm(254, 1, 1); // 点击埋点
let startDcmOut = Buried.connectDcm(260, 0, 0); // 曝光埋点
this.startExposure = Buried.createExposure(startDpmOut, startDcmOut);
NetManager.ins.showLog(this.startExposure);
}
initEvents() {
super.initEvents()
......@@ -125,6 +139,7 @@ export default class StartScene extends Scene {
}
onTap_startBtn() {
NetManager.ins.clickLog(this.startExposure)
// 判断是否进行游戏
if (DataManager.ins.customCfgData["uid"] == 'not_login') {
// 未登录
......@@ -137,6 +152,9 @@ export default class StartScene extends Scene {
} else if (DataManager.ins.getData('gameAjaxElement').data.element.status == 4) {
ToastCtrl.instance.show(`今日次数已用完,请明日再来吧~`);
} else if (DataManager.ins.getData('gameAjaxElement').data.element.status == 5 && DataManager.ins.getData('gameAjaxElement').data.element.freeLimit > 0) {
if (GameConst.isPlayMusic) {
playSound(SoundType.ready)
}
this.doStart();
} else if (DataManager.ins.getData('gameAjaxElement').data.element.status == 2 || DataManager.ins.getData('gameAjaxElement').data.element.needCreditsLong > DataManager.ins.getData('gameAjaxElement').data.element.myCreditsLong) {
PanelCtrl.instance.show(ModuleTypes.GETCREDITS_PANEL);
......
import { playSound, SoundType } from './../../ctrls/soundCtrl';
import { arr } from './../../consts/GameConst';
import { DataManager } from './../../../libs/tw/manager/DataManager';
import { NetPromise } from './../../promises/NetPromise';
......@@ -163,6 +164,9 @@ export default class PlayScene extends Scene {
return NetPromise.getOrderStatus()
})
.then(() => {
if (GameConst.isPlayMusic) {
playSound(SoundType.gameSuc)
}
if (DataManager.ins.getData("getOrderStatus").data.lottery && DataManager.ins.getData("getOrderStatus").data.lottery.type !== "thanks") {
PanelCtrl.instance.show(ModuleTypes.PRIZE_PANEL)
} else {
......@@ -177,7 +181,19 @@ export default class PlayScene extends Scene {
}
gameFail(type) {
PanelCtrl.instance.show(ModuleTypes.GAMEFAIL_PANEL, { type: type })
let orderId = DataManager.ins.getData("getNgameStartStatus").data.orderId
let submitToken = DataManager.ins.getData("getNgameStartStatus").data.submitToken
NetPromise.submit(orderId, this.score, submitToken)
.then(() => {
if (GameConst.isPlayMusic) {
playSound(SoundType.gameFail)
}
PanelCtrl.instance.show(ModuleTypes.GAMEFAIL_PANEL, { type: type })
})
.catch(e => {
console.error(e);
PanelCtrl.instance.show(ModuleTypes.GAMEFAIL_PANEL, { type: type })
})
}
......@@ -186,6 +202,26 @@ export default class PlayScene extends Scene {
initEvents() {
super.initEvents()
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.onTap(this.musicOn, this.onTap_musicOn);
this.onTap(this.musicOff, this.onTap_musicOff);
}
onTap_musicOn(e) {
e.stopPropagation();
GameConst.isPlayMusic = false;
this.musicOn.visible = !this.musicOn.visible;
this.musicOff.visible = !this.musicOff.visible;
window['playBg0Music'](false);
}
onTap_musicOff(e) {
e.stopPropagation();
GameConst.isPlayMusic = true;
this.musicOn.visible = !this.musicOn.visible;
this.musicOff.visible = !this.musicOff.visible;
window['playBg0Music'](true);
}
private startX: number = 375;
......@@ -277,6 +313,9 @@ export default class PlayScene extends Scene {
case BarrierType.BELL:
case BarrierType.GIFTBOX:
case BarrierType.SOCKS:
if (GameConst.isPlayMusic) {
playSound(SoundType.collect)
}
this.score += 10;
this.scoreTxt.text = this.score + "";
arr.removeEle(collisionBarrier, this.currBarriers)
......@@ -301,6 +340,9 @@ export default class PlayScene extends Scene {
case BarrierType.HOLE:
this.gamePuase()
this.user.visible = false;
if (GameConst.isPlayMusic) {
playSound(SoundType.fall)
}
let smoke = new window['SVGA'].EgretMovieClip(SVGACtrl.instance.getSVGAByName("fall"));
smoke.x = collisionBarrier.x - 80;
smoke.y = collisionBarrier.y - 150;
......@@ -313,6 +355,9 @@ export default class PlayScene extends Scene {
}, 1000);
break;
case BarrierType.STONE:
if (GameConst.isPlayMusic) {
playSound(SoundType.impact_stone)
}
this.gamePuase()
let impact_user = new window['SVGA'].EgretMovieClip(SVGACtrl.instance.getSVGAByName("impact_user"));
impact_user.x = this.user.x - 40;
......@@ -330,6 +375,9 @@ export default class PlayScene extends Scene {
}, 1000);
break;
case BarrierType.SNOWBALL:
if (GameConst.isPlayMusic) {
playSound(SoundType.impact_snow)
}
this.gamePuase()
this.snowCrash().then(() => {
this.gameFail(BarrierType.SNOWBALL)
......@@ -396,6 +444,10 @@ export default class PlayScene extends Scene {
this.user.removeEventListener(egret.TouchEvent.TOUCH_CANCEL, this.onTouchEnd, this);
this.user.removeEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE, this.onTouchEnd, this);
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this)
this.clearTap(this.musicOn, this.onTap_musicOn);
this.clearTap(this.musicOff, this.onTap_musicOff);
}
gamePuase() {
......@@ -478,7 +530,7 @@ export default class PlayScene extends Scene {
}
guideStep1() {
let mask = GameConst.drawCircleMask(this.user.x, this.user.y, 120)
let mask = GameConst.drawCircleMask(this.user.x, GameConst.stage.stageHeight - 300 + 60, 120)
this.step1.addChild(mask)
let up = new eui.Image();
......@@ -486,7 +538,7 @@ export default class PlayScene extends Scene {
up.anchorOffsetX = 30;
up.anchorOffsetY = 30;
up.x = this.user.x;
up.y = this.user.y - 180;
up.y = GameConst.stage.stageHeight - 300 - 180 + 60;
this.step1.addChild(up)
let down = new eui.Image();
......@@ -495,7 +547,7 @@ export default class PlayScene extends Scene {
down.anchorOffsetY = 30;
down.rotation = 180;
down.x = this.user.x;
down.y = this.user.y + 180;
down.y = GameConst.stage.stageHeight - 300 + 180 + 60;
this.step1.addChild(down)
let right = new eui.Image();
......@@ -504,7 +556,7 @@ export default class PlayScene extends Scene {
right.anchorOffsetY = 30;
right.rotation = 90;
right.x = this.user.x + 180;
right.y = this.user.y;
right.y = GameConst.stage.stageHeight - 300 + 60
this.step1.addChild(right)
let left = new eui.Image();
......@@ -513,14 +565,14 @@ export default class PlayScene extends Scene {
left.anchorOffsetY = 30;
left.rotation = 270;
left.x = this.user.x - 180;
left.y = this.user.y;
left.y = GameConst.stage.stageHeight - 300 + 60
this.step1.addChild(left)
egret.Tween.get(up, { loop: true })
.to({ y: this.user.y - 200 }, 1000)
.to({ y: GameConst.stage.stageHeight - 300 + 60 - 200 }, 1000)
egret.Tween.get(down, { loop: true })
.to({ y: this.user.y + 200 }, 1000)
.to({ y: GameConst.stage.stageHeight - 300 + 60 + 200 }, 1000)
egret.Tween.get(left, { loop: true })
.to({ x: this.user.x - 200 }, 1000)
......
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