Commit 6cdf9bf0 authored by zhangjinzhou's avatar zhangjinzhou

修改盲盒裂开动效前暂存

parent e27fc729
...@@ -15,6 +15,7 @@ module.exports = { ...@@ -15,6 +15,7 @@ module.exports = {
'/activityPlugDrawInfo/*': 'http://localhost:3000', '/activityPlugDrawInfo/*': 'http://localhost:3000',
'/collectRule/*': 'http://localhost:3000', '/collectRule/*': 'http://localhost:3000',
'/hdtool/*': 'http://localhost:3000', '/hdtool/*': 'http://localhost:3000',
'/mixloanv/*':'http://localhost:3000',
'/activityPlugin/*': 'http://localhost:3000', '/activityPlugin/*': 'http://localhost:3000',
'/aaw/*': 'http://localhost:3000', '/aaw/*': 'http://localhost:3000',
'/wechatShare/*': 'http://localhost:3000', '/wechatShare/*': 'http://localhost:3000',
......
...@@ -18,7 +18,7 @@ import SignPanel from "../../src/panels/SignPanel"; ...@@ -18,7 +18,7 @@ import SignPanel from "../../src/panels/SignPanel";
import StartPanel from "../../src/panels/StartPanel"; import StartPanel from "../../src/panels/StartPanel";
// import StartPanelNew from "../../src/panels/StartPanelNew"; // import StartPanelNew from "../../src/panels/StartPanelNew";
import { getSoundOn, playBg, stopBg } from "../../src/soundCtrl"; import { getBgOn, playBg, stopBg } from "../../src/soundCtrl";
import { playGameBg, stopGamebg } from "../../src/soundCtrl2"; import { playGameBg, stopGamebg } from "../../src/soundCtrl2";
import StartScene from "../../src/startScene/StartScene"; import StartScene from "../../src/startScene/StartScene";
import getResPath from "../new_tc/getResPath"; import getResPath from "../new_tc/getResPath";
...@@ -436,7 +436,7 @@ export default class MainBase extends eui.UILayer { ...@@ -436,7 +436,7 @@ export default class MainBase extends eui.UILayer {
// if (document.visibilityState == "visible") { // if (document.visibilityState == "visible") {
// if (getSoundOn()) { // if (getBgOn()) {
// if (SceneCtrl.instance.currentScene instanceof MapScene) // if (SceneCtrl.instance.currentScene instanceof MapScene)
// playBg(); // playBg();
// else if (SceneCtrl.instance.currentScene instanceof MainScene) // else if (SceneCtrl.instance.currentScene instanceof MainScene)
...@@ -472,7 +472,7 @@ export default class MainBase extends eui.UILayer { ...@@ -472,7 +472,7 @@ export default class MainBase extends eui.UILayer {
stopGamebg(); stopGamebg();
} }
window["webviewShow"] = () => { window["webviewShow"] = () => {
if (getSoundOn()) { if (getBgOn()) {
if (SceneCtrl.instance.currentScene instanceof MapScene) if (SceneCtrl.instance.currentScene instanceof MapScene)
playBg(); playBg();
else if (SceneCtrl.instance.currentScene instanceof MainScene) else if (SceneCtrl.instance.currentScene instanceof MainScene)
...@@ -522,6 +522,7 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => { ...@@ -522,6 +522,7 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => {
export const mainTimer = timer; export const mainTimer = timer;
export const updateMainTimer = () => { export const updateMainTimer = () => {
const data = getHomeData(); const data = getHomeData();
return mainTimer.stop();
if (data.remainEnargy >= BLOOD_NUMS_MAX) { if (data.remainEnargy >= BLOOD_NUMS_MAX) {
mainTimer.stop(); mainTimer.stop();
} else { } else {
......
...@@ -50,7 +50,7 @@ export default class PrizePanel extends Panel { ...@@ -50,7 +50,7 @@ export default class PrizePanel extends Panel {
//打开宝箱 //打开宝箱
this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
Utils.couponJoin(CouponJoinScene.Checkpoint,()=>{ Utils.couponJoin(CouponJoinScene.Checkpoint,this._level,()=>{
},()=>{ },()=>{
this.changeSceneShow(2); this.changeSceneShow(2);
......
...@@ -630,7 +630,25 @@ export class DataManager extends ABDataManager { ...@@ -630,7 +630,25 @@ export class DataManager extends ABDataManager {
private getKey(name) { private getKey(name) {
return `_tw_data_${name}_` return `_tw_data_${name}_`
} }
setData(name,data){
this[this.getKey(name)] = data;
}
setHomeStarData(data){
const {levelNum} = data;
let homeData = this.getData("hc_home").data;
let {starBox} = homeData;
let resetidx = -1;
for(let i=0;i<starBox.length;i++){
let idata = starBox[i];
if(idata.levelNum==levelNum){
resetidx = i;
break;
}
}
this.getData("hc_home").data.starBox[resetidx] = data;
// let levelstardata = starBox.find(item=>item.levelNum==levelNum);
// levelstardata = data;
}
/** /**
* 用户信息 * 用户信息
*/ */
......
...@@ -975,7 +975,7 @@ export class NetManager extends ABNetManager { ...@@ -975,7 +975,7 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public getShareInfo(callback: Function, ): void { public getShareInfo(callback: Function,): void {
const net: INetData = { const net: INetData = {
name: 'getShareInfo', name: 'getShareInfo',
uri: window['duiba'] + '/wechatShare/getShareInfo/v2', uri: window['duiba'] + '/wechatShare/getShareInfo/v2',
...@@ -2432,4 +2432,22 @@ export class NetManager extends ABNetManager { ...@@ -2432,4 +2432,22 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
submitStarBox(callback: Function, level: number, boxNo: number, boxType: number): void {
const net: INetData = {
name: 'hc_submitstarbox',
uri: window['duiba'] + '/mixloanv/happyclear/submitStarBox',
type: 'post',
dataType: 'json',
param: {
level:level,
boxNo:boxNo,
boxType:boxType,
},
callback: callback
};
this.send(net);
}
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Button id="doubleBtn" label="" y="611.73" horizontalCenter="0"> <e:Button id="doubleBtn" label="" y="611.73" horizontalCenter="0" visible="false">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="kanguanggao2beijiangli_png" source.down="kanguanggao2beijiangli_png" source.disabled="kanguanggao2beijiangli_png"/> <e:Image width="100%" height="100%" source="kanguanggao2beijiangli_png" source.down="kanguanggao2beijiangli_png" source.disabled="kanguanggao2beijiangli_png"/>
......
export enum CouponJoinScene{ import { DataManager } from "../libs/tw/manager/DataManager";
BlindBox=0,//盲盒
export enum CouponJoinScene {
BlindBox = 0,//盲盒
//星级宝箱 //星级宝箱
StarBox1, StarBox1,
StarBox2, StarBox2,
...@@ -8,20 +10,29 @@ export enum CouponJoinScene{ ...@@ -8,20 +10,29 @@ export enum CouponJoinScene{
Checkpoint, Checkpoint,
Buoy, Buoy,
} }
export interface CouponJoinOptions{ /** 激励视频入口场景 */
scene:CouponJoinScene,//场景 export enum VideoEntranceScene {
beforeUse:Function,//跳转前 defeated = 1, // 闯关失败
afterClose:Function,//关闭 life = 2, // 体力不足
gameprops = 3 // 领取道具
}
export interface CouponJoinOptions {
scene: CouponJoinScene,//场景
stage: Number,//当前关卡
beforeUse: Function,//跳转前
afterClose: Function,//关闭
} }
export interface ShowTurnCircleOptions{ export interface ShowTurnCircleOptions {
afterClose:Function,//关闭转盘 afterClose: Function,//关闭转盘
} }
interface ShowVideoOptions{ interface ShowVideoOptions {
afterClose:Function scene: VideoEntranceScene,
afterClose: Function
} }
interface ShowMeituanExchangeOptions{ interface ShowMeituanExchangeOptions {
afterClose:Function afterClose: Function
} }
export default class Utils { export default class Utils {
constructor() { constructor() {
...@@ -34,10 +45,10 @@ export default class Utils { ...@@ -34,10 +45,10 @@ export default class Utils {
public static getRequest() { public static getRequest() {
const url = location.search; //获取url中"?"符后的字串 const url = location.search; //获取url中"?"符后的字串
let theRequest = {}; let theRequest = {};
if(url.indexOf("?") != -1) { if (url.indexOf("?") != -1) {
let str = url.substr(1); let str = url.substr(1);
let strs = str.split("&"); let strs = str.split("&");
for(let i = 0; i < strs.length; i++) { for (let i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
} }
} }
...@@ -84,13 +95,13 @@ export default class Utils { ...@@ -84,13 +95,13 @@ export default class Utils {
* @returns {Object} obj - 拷贝完成的对象 * @returns {Object} obj - 拷贝完成的对象
*/ */
public static deepClone(src, dst = undefined) { public static deepClone(src, dst = undefined) {
if(src){ if (src) {
return src; return src;
} }
let _obj = dst || (src instanceof Array ? [] : {}); let _obj = dst || (src instanceof Array ? [] : {});
for(let key in src) { for (let key in src) {
let prop = src[key]; let prop = src[key];
if(prop === _obj) { // 避免相互引用对象导致死循环,如src.a = dst的情况 if (prop === _obj) { // 避免相互引用对象导致死循环,如src.a = dst的情况
continue; continue;
} }
_obj[key] = ((typeof prop === 'object') ? this.deepClone(prop) : _obj[key] = prop); _obj[key] = ((typeof prop === 'object') ? this.deepClone(prop) : _obj[key] = prop);
...@@ -127,8 +138,8 @@ export default class Utils { ...@@ -127,8 +138,8 @@ export default class Utils {
* @param array * @param array
*/ */
public static isInArray(obj: any, array: any[]) { public static isInArray(obj: any, array: any[]) {
for(let i in array) { for (let i in array) {
if(obj == array[i]) { if (obj == array[i]) {
return true; return true;
} }
} }
...@@ -150,37 +161,66 @@ export default class Utils { ...@@ -150,37 +161,66 @@ export default class Utils {
return rect1.intersects(rect2); return rect1.intersects(rect2);
} }
//星星宝箱的显示
static getStarBox(level) {
const homeData = DataManager.ins.getData('hc_home').data;
let { starBox } = homeData;
let levelstardata = starBox.find(item => item.levelNum == level);
// console.error("本关星星:",levelstardata);
let showstar = [0, 0, 0];
if (levelstardata) {
const { awardedBox, openBox } = levelstardata;
for (var i = 0; i < awardedBox.length; i++) {
let idata = awardedBox[i];
if (openBox.indexOf(idata) != -1) {//开了
showstar[i] = 2;
} else {//未开
showstar[i] = 1;
}
}
}
// console.log("地图星星检查==》",showstar,levelstardata);
return showstar;
}
//奖品相关弹窗 //奖品相关弹窗
static couponJoin(scene:CouponJoinScene,beforeUse=()=>{},afterClose=()=>{}):void{ static couponJoin(scene: CouponJoinScene, level: number, beforeUse = () => { }, afterClose = () => { }): void {
let options:CouponJoinOptions = { let options: CouponJoinOptions = {
scene:scene, scene: scene,
beforeUse:beforeUse, stage: level,
afterClose:afterClose beforeUse: beforeUse,
afterClose: afterClose
} }
console.error("奖品弹窗点击===》",scene); console.error("奖品弹窗点击===》", scene);
beforeUse&&beforeUse(); beforeUse && beforeUse();
afterClose&&afterClose(); afterClose && afterClose();
} }
//展示大转盘 //展示大转盘
static showTurnCircle(afterClose=()=>{}):void{ static showTurnCircle(afterClose = () => { }): void {
let options:ShowTurnCircleOptions = { let options: ShowTurnCircleOptions = {
afterClose, afterClose,
} }
afterClose&&afterClose(); afterClose && afterClose();
}
//是否存在视频
/** 是否展示观看视频按钮 */
static isShowVideoEntrance(scene: VideoEntranceScene): Boolean {
return false;
} }
//打开视频 //打开视频
static showVideo(afterClose=(suc)=>{}){ static showVideo(scene:VideoEntranceScene,afterClose = (suc) => { }) {
let options:ShowVideoOptions = { let options: ShowVideoOptions = {
scene,
afterClose, afterClose,
}; };
//true,false,发奖成功失败 //true,false,发奖成功失败
afterClose&&afterClose(true); afterClose && afterClose(true);
} }
//美团碎片弹窗 //美团碎片弹窗
static showMeituanExchange(afterClose=()=>{}){ static showMeituanExchange(afterClose = () => { }) {
let options:ShowMeituanExchangeOptions = { let options: ShowMeituanExchangeOptions = {
afterClose, afterClose,
}; };
afterClose&&afterClose(); afterClose && afterClose();
} }
} }
\ No newline at end of file
...@@ -9,7 +9,10 @@ interface IHomeData { ...@@ -9,7 +9,10 @@ interface IHomeData {
remainEnargy; remainEnargy;
nextRangeStarsNum; nextRangeStarsNum;
askForEnergy:number; askForEnergy:number;
remainProp:{type,num}[] remainProp:{type,num}[],
starBox:{awardedBox:number[],levelNum:number,openBox:number[]}[];
totalVideoTimes:number,
currentVideoTimes:number;
} }
export default ():IHomeData=>{ export default ():IHomeData=>{
const {data} = DataManager.ins.getData('hc_home'); const {data} = DataManager.ins.getData('hc_home');
......
...@@ -37,7 +37,7 @@ import { ElementTargets } from '../something/uis/ElementTargets'; ...@@ -37,7 +37,7 @@ import { ElementTargets } from '../something/uis/ElementTargets';
import { PropGuide } from '../something/uis/PropGuide'; import { PropGuide } from '../something/uis/PropGuide';
import { ScoreProgress } from '../something/uis/ScoreProgress'; import { ScoreProgress } from '../something/uis/ScoreProgress';
import { StepNumber } from '../something/uis/StepNumber'; import { StepNumber } from '../something/uis/StepNumber';
import { getSoundOn, playSound, SoundType, stopBg, toggleSound } from '../soundCtrl'; import {getBgOn, getSoundOn, playSound, SoundType, stopBg, toggleSound } from '../soundCtrl';
import { playGameBg, toggleGameBg } from '../soundCtrl2'; import { playGameBg, toggleGameBg } from '../soundCtrl2';
import { createData } from '../startScene/StartScene'; import { createData } from '../startScene/StartScene';
import { DataManager } from './../../libs/tw/manager/DataManager'; import { DataManager } from './../../libs/tw/manager/DataManager';
...@@ -437,7 +437,7 @@ export default class MainScene extends Scene { ...@@ -437,7 +437,7 @@ export default class MainScene extends Scene {
this.addChild(curScoreNum); this.addChild(curScoreNum);
//分数进度条,托管 //分数进度条,托管
this.scoreProgress = new ScoreProgress(this.starProgress, curScoreNum, this.chapterData.starScores, this.addStarDia.bind(this)); this.scoreProgress = new ScoreProgress(this.starProgress, curScoreNum, this.chapterData.starScores, this.addStarDia.bind(this),this.chapter);
//分数置0 //分数置0
this.score = 0; this.score = 0;
//地图生成 //地图生成
...@@ -461,7 +461,7 @@ export default class MainScene extends Scene { ...@@ -461,7 +461,7 @@ export default class MainScene extends Scene {
} else { } else {
this.soundBtn.source = "mainSoundBtnOff_png" this.soundBtn.source = "mainSoundBtnOff_png"
} }
if (getSoundOn()) { if (getBgOn()) {
this.musicBtn.source = "mainMusicBtnOn_png"; this.musicBtn.source = "mainMusicBtnOn_png";
stopBg(); stopBg();
playGameBg(); playGameBg();
...@@ -969,7 +969,7 @@ export default class MainScene extends Scene { ...@@ -969,7 +969,7 @@ export default class MainScene extends Scene {
onTap_musicBtn() { onTap_musicBtn() {
// toggleBg(); // toggleBg();
toggleGameBg(); toggleGameBg();
if (getSoundOn()) { if (getBgOn()) {
this.musicBtn.source = "mainMusicBtnOn_png" this.musicBtn.source = "mainMusicBtnOn_png"
} else { } else {
this.musicBtn.source = "mainMusicBtnOff_png" this.musicBtn.source = "mainMusicBtnOff_png"
...@@ -3082,7 +3082,7 @@ export default class MainScene extends Scene { ...@@ -3082,7 +3082,7 @@ export default class MainScene extends Scene {
} }
//气球奖励开启 //气球奖励开启
openBallonDia(){ openBallonDia(){
Utils.couponJoin(CouponJoinScene.Buoy,()=>{ Utils.couponJoin(CouponJoinScene.Buoy,this.chapter,()=>{
},()=>{ },()=>{
this.isInDom = false; this.isInDom = false;
...@@ -3091,7 +3091,7 @@ export default class MainScene extends Scene { ...@@ -3091,7 +3091,7 @@ export default class MainScene extends Scene {
} }
//盲盒弹窗 //盲盒弹窗
openBlindBox() { openBlindBox() {
Utils.couponJoin(CouponJoinScene.BlindBox,()=>{ Utils.couponJoin(CouponJoinScene.BlindBox,this.chapter,()=>{
},()=>{ },()=>{
this.isInDom = false; this.isInDom = false;
...@@ -3100,7 +3100,7 @@ export default class MainScene extends Scene { ...@@ -3100,7 +3100,7 @@ export default class MainScene extends Scene {
} }
//星星宝箱开启 //星星宝箱开启
openStarDia(staridx){ openStarDia(staridx){
Utils.couponJoin(CouponJoinScene["StarBox" + staridx],()=>{ Utils.couponJoin(CouponJoinScene["StarBox" + staridx],this.chapter,()=>{
},()=>{ },()=>{
this.isInDom = false; this.isInDom = false;
......
...@@ -36,7 +36,7 @@ export default class MapBottomPart extends ComponentBase { ...@@ -36,7 +36,7 @@ export default class MapBottomPart extends ComponentBase {
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon['mappart']=this; icon['mappart']=this;
const star = new MapStarComp(); const star = new MapStarComp(levelOrder);
star.loadSkin(); star.start(); star.loadSkin(); star.start();
MapScene.starHash[levelOrder] = star; MapScene.starHash[levelOrder] = star;
icon.addChild(star); icon.addChild(star);
......
...@@ -29,7 +29,7 @@ export default class MapRpeatPart extends ComponentBase { ...@@ -29,7 +29,7 @@ export default class MapRpeatPart extends ComponentBase {
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon['mappart']=this; icon['mappart']=this;
const star = new MapStarComp(); const star = new MapStarComp(levelOrder);
star.loadSkin(); star.start(); star.loadSkin(); star.start();
MapScene.starHash[levelOrder] = star; MapScene.starHash[levelOrder] = star;
icon.addChild(star); icon.addChild(star);
......
...@@ -434,9 +434,9 @@ export default class MapScene extends Scene { ...@@ -434,9 +434,9 @@ export default class MapScene extends Scene {
if (level) { if (level) {
star.setStar(level.stars); star.setStar(level.stars);
let havebx = [1, 2, 3]; let levelNum = level.levelNum;
let openbx = [1]; let showstar = Utils.getStarBox(levelNum);
star.setBox(havebx,openbx); star.setBox(showstar);
this.enableIcon(level.levelNum); this.enableIcon(level.levelNum);
} else { } else {
this.disableIcon(level.levelNum); this.disableIcon(level.levelNum);
...@@ -446,9 +446,7 @@ export default class MapScene extends Scene { ...@@ -446,9 +446,7 @@ export default class MapScene extends Scene {
const star = MapScene.starHash[1]; const star = MapScene.starHash[1];
star.setStar(0); star.setStar(0);
let havebx = []; star.setBox([0,0,0]);
let openbx = [];
star.setBox(havebx,openbx);
this.enableIcon(1); this.enableIcon(1);
} else if (homeData.levels.length == window['last_level']) { } else if (homeData.levels.length == window['last_level']) {
......
import ComponentBase from "../../libs/new_wx/components/ComponentBase"; import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import Utils, { CouponJoinScene } from "../Utils";
export default class MapStarComp extends ComponentBase { export default class MapStarComp extends ComponentBase {
constructor(level){
super();
this.level = level;
}
level:number;
start() { start() {
super.start(); super.start();
this.x = 15; this.x = 15;
this.y=-24; this.y=-24;
this.setStar(0); this.setStar(0);
this.setBox([1,2,3],[1,2]);
this['starlbox1'].addEventListener(egret.TouchEvent.TOUCH_TAP, (e)=>{
e.stopPropagation();
this.openStarDia(1);
}, this)
this['starlbox2'].addEventListener(egret.TouchEvent.TOUCH_TAP, (e)=>{
e.stopPropagation();
this.openStarDia(2);
}, this)
this['starlbox3'].addEventListener(egret.TouchEvent.TOUCH_TAP, (e)=>{
e.stopPropagation();
this.openStarDia(3);
}, this)
} }
//星星宝箱开启
openStarDia(staridx){
Utils.couponJoin(CouponJoinScene["StarBox" + staridx],this.level,()=>{
},()=>{
});
}
setStar(num:number) setStar(num:number)
{ {
this['star1'].visible=false; this['star1'].visible=false;
...@@ -27,15 +53,17 @@ export default class MapStarComp extends ComponentBase { ...@@ -27,15 +53,17 @@ export default class MapStarComp extends ComponentBase {
this['star3'].visible=true; this['star3'].visible=true;
} }
} }
//拥有的宝箱,[1,2,3],打开的宝箱:[1,2,3] //0:未拥有,1:未开,2:开了
setBox(havebx,openbx){ setBox(showstar){
let idx = -1; let idx = 0;
for(let ih of havebx){ for(let i=0;i<showstar.length;i++){
if(openbx.indexOf(ih)==-1){ let idata = showstar[i];
idx = ih; if(idata==1){
idx = i;
break; break;
} }
} }
this['starlbox1'].visible = false; this['starlbox1'].visible = false;
this['starlbox2'].visible = false; this['starlbox2'].visible = false;
this['starlbox3'].visible = false; this['starlbox3'].visible = false;
......
...@@ -12,7 +12,7 @@ export default class MapTopPart extends ComponentBase { ...@@ -12,7 +12,7 @@ export default class MapTopPart extends ComponentBase {
const icon = MapScene.iconHash[levelOrder] = this.getIcon(i); const icon = MapScene.iconHash[levelOrder] = this.getIcon(i);
// const label:eui.BitmapLabel=icon.getChildAt(1) as eui.BitmapLabel; // const label:eui.BitmapLabel=icon.getChildAt(1) as eui.BitmapLabel;
const star = new MapStarComp(); const star = new MapStarComp(levelOrder);
star.loadSkin(); star.start(); star.loadSkin(); star.start();
MapScene.starHash[levelOrder] = star; MapScene.starHash[levelOrder] = star;
icon.addChild(star); icon.addChild(star);
......
...@@ -4,7 +4,7 @@ import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; ...@@ -4,7 +4,7 @@ import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import getHomeData, { BLOOD_NUMS_MAX } from "../getHomeData"; import getHomeData, { BLOOD_NUMS_MAX } from "../getHomeData";
import { PropNumber } from "../something/uis/PropNumber"; import { PropNumber } from "../something/uis/PropNumber";
import Utils from "../Utils"; import Utils, { VideoEntranceScene } from "../Utils";
export default class AddBloodV extends Panel { export default class AddBloodV extends Panel {
start(data) { start(data) {
...@@ -27,7 +27,7 @@ export default class AddBloodV extends Panel { ...@@ -27,7 +27,7 @@ export default class AddBloodV extends Panel {
onTapBuy() { onTapBuy() {
this['videoBtn'].enabled = false; this['videoBtn'].enabled = false;
Utils.showVideo((suc) => { Utils.showVideo(VideoEntranceScene.life,(suc) => {
this['videoBtn'].enabled = true; this['videoBtn'].enabled = true;
if (suc) { if (suc) {
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
......
...@@ -11,7 +11,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; ...@@ -11,7 +11,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import MainScene from "../mainScene/MainScene"; import MainScene from "../mainScene/MainScene";
import Loading from "../../libs/new_wx/components/Loading"; import Loading from "../../libs/new_wx/components/Loading";
import { handleVideo } from "../myVideo/videoCtrl"; import { handleVideo } from "../myVideo/videoCtrl";
import Utils from "../Utils"; import Utils, { VideoEntranceScene } from "../Utils";
import { CusButton } from "../something/uis/PropBtnCon"; import { CusButton } from "../something/uis/PropBtnCon";
export default class AddToolV extends Panel { export default class AddToolV extends Panel {
...@@ -76,7 +76,7 @@ export default class AddToolV extends Panel { ...@@ -76,7 +76,7 @@ export default class AddToolV extends Panel {
// this["videoBtn"].visible = true; // this["videoBtn"].visible = true;
this["videoBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["videoBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(10)); NetManager.ins.clickLog(getlogItem(10));
Utils.showVideo((suc)=>{ Utils.showVideo(VideoEntranceScene.gameprops,(suc)=>{
if(suc){ if(suc){
this.hidePanel(); this.hidePanel();
//回调 //回调
......
...@@ -5,7 +5,7 @@ import { changeMapScene } from "../startScene/StartScene"; ...@@ -5,7 +5,7 @@ import { changeMapScene } from "../startScene/StartScene";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { PropNumber } from "../something/uis/PropNumber"; import { PropNumber } from "../something/uis/PropNumber";
import Utils from "../Utils"; import Utils, { VideoEntranceScene } from "../Utils";
export default class FailedPanel extends Panel { export default class FailedPanel extends Panel {
_level; _level;
...@@ -67,7 +67,7 @@ export default class FailedPanel extends Panel { ...@@ -67,7 +67,7 @@ export default class FailedPanel extends Panel {
} }
openFailVideo = () => { openFailVideo = () => {
this['videoBtn'].enabled = false; this['videoBtn'].enabled = false;
Utils.showVideo((suc) => { Utils.showVideo(VideoEntranceScene.defeated,(suc) => {
this['videoBtn'].enabled = true; this['videoBtn'].enabled = true;
if (suc) { if (suc) {
this.hidePanel(); this.hidePanel();
......
...@@ -7,7 +7,7 @@ import Loading from "../../libs/new_wx/components/Loading"; ...@@ -7,7 +7,7 @@ import Loading from "../../libs/new_wx/components/Loading";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import { updateMainTimer } from "../../libs/new_wx/MainBase"; import { updateMainTimer } from "../../libs/new_wx/MainBase";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl"; import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import Utils from "../Utils"; import Utils, { VideoEntranceScene } from "../Utils";
export default class SignPrizePanel extends Panel { export default class SignPrizePanel extends Panel {
doubleBtn: eui.Button doubleBtn: eui.Button
...@@ -48,34 +48,34 @@ export default class SignPrizePanel extends Panel { ...@@ -48,34 +48,34 @@ export default class SignPrizePanel extends Panel {
NetManager.ins.showLog(getlogItem(7)) NetManager.ins.showLog(getlogItem(7))
//新增看视频双倍 //新增看视频双倍
this['close2Btn'].visible = false; // this['close2Btn'].visible = false;
this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(8)); NetManager.ins.clickLog(getlogItem(8));
Utils.showVideo((suc)=>{ // Utils.showVideo(VideoEntranceScene,(suc)=>{
if(suc){ // if(suc){
Loading.instace.show(); // Loading.instace.show();
NetManager.ins.getIncentiveAward( // NetManager.ins.getIncentiveAward(
(s) => { // (s) => {
Loading.instace.hide(); // Loading.instace.hide();
this['close2Btn'].visible = true; // this['close2Btn'].visible = true;
this['doubleBtn'].visible = false; // this['doubleBtn'].visible = false;
if (s) { // if (s) {
showToast("翻倍成功"); // showToast("翻倍成功");
NetManager.ins.hc_home(() => { // NetManager.ins.hc_home(() => {
updateMainTimer(); // updateMainTimer();
SceneCtrl.instance.updateScene(); // SceneCtrl.instance.updateScene();
}, window['collectRuleId']); // }, window['collectRuleId']);
} else { // } else {
showToast("加倍失败"); // showToast("加倍失败");
this.hidePanel(); // this.hidePanel();
} // }
}, // },
21 // 21
) // )
}else{ // }else{
showToast("广告未成功观看,无法加倍领取") // showToast("广告未成功观看,无法加倍领取")
} // }
}) // })
// NetManager.ins.getTuiaAd( // NetManager.ins.getTuiaAd(
// () => { // () => {
// Loading.instace.show(); // Loading.instace.show();
......
...@@ -18,7 +18,7 @@ import { addRankFriendList } from "../mapScene/RankFriendList"; ...@@ -18,7 +18,7 @@ import { addRankFriendList } from "../mapScene/RankFriendList";
import { addAdComp } from "./BoxPanel"; import { addAdComp } from "./BoxPanel";
import { getChapterData } from "../something/chapters/getChapter"; import { getChapterData } from "../something/chapters/getChapter";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import Utils from "../Utils"; import Utils, { VideoEntranceScene } from "../Utils";
export default class StartPanel extends Panel { export default class StartPanel extends Panel {
static currlevel; static currlevel;
...@@ -198,7 +198,7 @@ export default class StartPanel extends Panel { ...@@ -198,7 +198,7 @@ export default class StartPanel extends Panel {
onTap_video1btn() { onTap_video1btn() {
//看视频按钮点击 //看视频按钮点击
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
Utils.showVideo((suc)=>{ Utils.showVideo(VideoEntranceScene.gameprops,(suc)=>{
if(suc){ if(suc){
this['video1btn'].visible = false; this['video1btn'].visible = false;
this.videoProp[1] = 1; this.videoProp[1] = 1;
...@@ -223,7 +223,7 @@ export default class StartPanel extends Panel { ...@@ -223,7 +223,7 @@ export default class StartPanel extends Panel {
onTap_video2btn() { onTap_video2btn() {
//看视频按钮点击 //看视频按钮点击
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
Utils.showVideo((suc)=>{ Utils.showVideo(VideoEntranceScene.gameprops,(suc)=>{
if(suc){ if(suc){
this['video2btn'].visible = false; this['video2btn'].visible = false;
this.videoProp[0] = 1; this.videoProp[0] = 1;
...@@ -248,7 +248,7 @@ export default class StartPanel extends Panel { ...@@ -248,7 +248,7 @@ export default class StartPanel extends Panel {
onTap_video3btn() { onTap_video3btn() {
//看视频按钮点击 //看视频按钮点击
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
Utils.showVideo((suc)=>{ Utils.showVideo(VideoEntranceScene.gameprops,(suc)=>{
if(suc){ if(suc){
this['video3btn'].visible = false; this['video3btn'].visible = false;
this.videoProp[2] = 1; this.videoProp[2] = 1;
......
import { loadImageByUrl } from "../../../libs/new_wx/loadSpriteSheet"; import { loadImageByUrl } from "../../../libs/new_wx/loadSpriteSheet";
import { DataManager } from "../../../libs/tw/manager/DataManager";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import { getPropNums } from "../../getHomeData";
import setGray from "../../setGray"; import setGray from "../../setGray";
import Utils, { CouponJoinScene } from "../../Utils"; import Utils, { CouponJoinScene } from "../../Utils";
import { CurScoreNum } from "./CurScoreNum"; import { CurScoreNum } from "./CurScoreNum";
...@@ -50,6 +53,19 @@ export class ScoreProgress { ...@@ -50,6 +53,19 @@ export class ScoreProgress {
} }
w = (663 - 595) * scale + 595; w = (663 - 595) * scale + 595;
if (this.star3.source != "lightedStar_png") { if (this.star3.source != "lightedStar_png") {
if (this.showstar[2] == 0) {
NetManager.ins.submitStarBox((...args) => {
console.error("3星宝箱获得===》", args);
if (args[0] && args[1]) {
let awardata = args[1].data;
if (awardata) {
DataManager.ins.setHomeStarData(awardata);
this.showstar[2] = 1;
this.updateStarBox(this.showstar);
}
}
}, this.level, 3, 1)
}
this.star3.source = "lightedStar_png"; this.star3.source = "lightedStar_png";
this.star2.source = "lightedStar_png"; this.star2.source = "lightedStar_png";
this.star1.source = "lightedStar_png"; this.star1.source = "lightedStar_png";
...@@ -61,6 +77,20 @@ export class ScoreProgress { ...@@ -61,6 +77,20 @@ export class ScoreProgress {
scale = (value - this.starScores[1]) / (this.starScores[2] - this.starScores[1]); scale = (value - this.starScores[1]) / (this.starScores[2] - this.starScores[1]);
w = (595 - 522) * scale + 522; w = (595 - 522) * scale + 522;
if (this.star2.source != "lightedStar_png") { if (this.star2.source != "lightedStar_png") {
if (this.showstar[1] == 0) {
NetManager.ins.submitStarBox((...args) => {
console.error("2星宝箱获得===》", args);
if (args[0] && args[1]) {
let awardata = args[1].data;
if (awardata) {
DataManager.ins.setHomeStarData(awardata);
this.showstar[1] = 1;
this.updateStarBox(this.showstar);
}
}
}, this.level, 2, 1)
}
this.star2.source = "lightedStar_png"; this.star2.source = "lightedStar_png";
this.star1.source = "lightedStar_png"; this.star1.source = "lightedStar_png";
this.starCount = 2; this.starCount = 2;
...@@ -71,6 +101,20 @@ export class ScoreProgress { ...@@ -71,6 +101,20 @@ export class ScoreProgress {
scale = (value - this.starScores[0]) / (this.starScores[1] - this.starScores[0]); scale = (value - this.starScores[0]) / (this.starScores[1] - this.starScores[0]);
w = (522 - 446) * scale + 446; w = (522 - 446) * scale + 446;
if (this.star1.source != "lightedStar_png") { if (this.star1.source != "lightedStar_png") {
if (this.showstar[0] == 0) {
NetManager.ins.submitStarBox((...args) => {
console.error("1星宝箱获得===》", args);
if (args[0] && args[1]) {
let awardata = args[1].data;
if (awardata) {
DataManager.ins.setHomeStarData(awardata);
this.showstar[0] = 1;
this.updateStarBox(this.showstar);
}
}
}, this.level, 0, 1)
}
this.star1.source = "lightedStar_png"; this.star1.source = "lightedStar_png";
this.starCount = 1; this.starCount = 1;
}; };
...@@ -97,7 +141,8 @@ export class ScoreProgress { ...@@ -97,7 +141,8 @@ export class ScoreProgress {
* @param scoreTxt 托管 * @param scoreTxt 托管
* @param starScores * @param starScores
*/ */
constructor(starProgress: eui.Image, scoreTxt: CurScoreNum, starScores: number[],openStarDia) { constructor(starProgress: eui.Image, scoreTxt: CurScoreNum, starScores: number[], openStarDia, level) {
this.level = level;
this.openStarDia = openStarDia; this.openStarDia = openStarDia;
this.starProgress = starProgress; this.starProgress = starProgress;
this.scoreTxt = scoreTxt; this.scoreTxt = scoreTxt;
...@@ -149,14 +194,19 @@ export class ScoreProgress { ...@@ -149,14 +194,19 @@ export class ScoreProgress {
this.starbox3.y = starboxy; this.starbox3.y = starboxy;
this.updateStarBox([2, 1, 0]); let showstar = Utils.getStarBox(level);
this.showstar = showstar;
this.updateStarBox(showstar);
this.starbox1.addEventListener(egret.TouchEvent.TOUCH_TAP,this.clickStar1,this); this.starbox1.addEventListener(egret.TouchEvent.TOUCH_TAP, this.clickStar1, this);
this.starbox2.addEventListener(egret.TouchEvent.TOUCH_TAP,this.clickStar2,this); this.starbox2.addEventListener(egret.TouchEvent.TOUCH_TAP, this.clickStar2, this);
this.starbox3.addEventListener(egret.TouchEvent.TOUCH_TAP,this.clickStar3,this); this.starbox3.addEventListener(egret.TouchEvent.TOUCH_TAP, this.clickStar3, this);
} }
//关卡
level = 0;
//本关的星星宝箱显示
showstar = [0, 0, 0];
//新增星星宝箱 //新增星星宝箱
starboxdata = [0, 0, 0];//0未开启,1待开启,2已开启 starboxdata = [0, 0, 0];//0未开启,1待开启,2已开启
starbox1: eui.Image; starbox1: eui.Image;
...@@ -185,15 +235,15 @@ export class ScoreProgress { ...@@ -185,15 +235,15 @@ export class ScoreProgress {
let data = this.starboxdata[idx]; let data = this.starboxdata[idx];
let spx = this["sbox" + (idx + 1) + "x"]; let spx = this["sbox" + (idx + 1) + "x"];
let texsrc = "starbox"+(idx+1); let texsrc = "starbox" + (idx + 1);
if(data==0){ if (data == 0) {
texsrc += "close"; texsrc += "close";
}else if(data==1){ } else if (data == 1) {
texsrc += ""; texsrc += "";
}else{ } else {
texsrc += "open"; texsrc += "open";
} }
sp.texture = RES.getRes(texsrc+"_png"); sp.texture = RES.getRes(texsrc + "_png");
sp.anchorOffsetX = sp.width / 2; sp.anchorOffsetX = sp.width / 2;
sp.anchorOffsetY = sp.height / 2; sp.anchorOffsetY = sp.height / 2;
sp.x = spx + this.starwid / 2; sp.x = spx + this.starwid / 2;
...@@ -221,19 +271,19 @@ export class ScoreProgress { ...@@ -221,19 +271,19 @@ export class ScoreProgress {
} }
} }
//星星宝箱点击 //星星宝箱点击
clickStar1(){ clickStar1() {
if(this.starboxdata[0]==1){ if (this.starboxdata[0] == 1) {
this.openStarDia&&this.openStarDia(1); this.openStarDia && this.openStarDia(1);
} }
} }
clickStar2(){ clickStar2() {
if(this.starboxdata[1]==1){ if (this.starboxdata[1] == 1) {
this.openStarDia&&this.openStarDia(2); this.openStarDia && this.openStarDia(2);
} }
} }
clickStar3(){ clickStar3() {
if(this.starboxdata[2]==1){ if (this.starboxdata[2] == 1) {
this.openStarDia&&this.openStarDia(3); this.openStarDia && this.openStarDia(3);
} }
} }
} }
\ No newline at end of file
import { getSoundOn, toggleBgStatus } from "./soundCtrl"; import { getBgOn,getSoundOn, toggleBgStatus } from "./soundCtrl";
let bgChannel: egret.SoundChannel; let bgChannel: egret.SoundChannel;
let loading = false; let loading = false;
export const toggleGameBg = () => { export const toggleGameBg = () => {
toggleBgStatus(); toggleBgStatus();
const bgOn=getSoundOn(); const bgOn=getBgOn();
if (bgChannel) { if (bgChannel) {
if (!bgOn) { if (!bgOn) {
bgChannel.stop(); bgChannel.stop();
......
...@@ -201,6 +201,9 @@ const config = { ...@@ -201,6 +201,9 @@ const config = {
'/customActivity/happyclear/taskSystem/award': { '/customActivity/happyclear/taskSystem/award': {
data: './happyclear/taskAward.json' data: './happyclear/taskAward.json'
}, },
'/mixloanv/happyclear/submitStarBox':{
data: './happyclear/submitStarBox.json'
}
}; };
for (let item in config) { for (let item in config) {
......
This diff is collapsed.
{
"code": "string",
"data": {
"awardedBox": [
0,1,2
],
"levelNum": 1,
"openBox": [
0,1,2
]
},
"desc": "OK",
"success": 1,
"timestamp": 1566546925981
}
\ No newline at end of file
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