Commit 6cdf9bf0 authored by zhangjinzhou's avatar zhangjinzhou

修改盲盒裂开动效前暂存

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