Commit 88df60fa authored by wjf's avatar wjf

l

parent d7b02efb
......@@ -42,11 +42,13 @@ import { PropNumShow } from '../something/uis/PropNumShow';
import { ScoreProgress } from '../something/uis/ScoreProgress';
import { StepNumber } from '../something/uis/StepNumber';
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 { DataManager } from './../../libs/tw/manager/DataManager';
import { NetManager } from './../../libs/tw/manager/NetManager';
import { Buried } from './../../libs/tw/util/Buried';
import { GuideMsg } from '../something/uis/GuideMsg';
import { readCache, getCacheKey } from '../mapScene/GuideCon';
const aniClass = {
"BoomAni": BoomAni,
......@@ -257,16 +259,31 @@ export default class MainScene extends Scene {
//引导提示
// if (this.chapter <= 5) {
// Loading2.instace.show()
// let g = new GuideMsg();
// g.init(3, () => {
// Loading2.instace.hide()
// this.addChild(g);
// // this.enableMouseEvt(true);
// })
// } else {
// }
var guideImageNum: number;
if (this.chapter <= 5) {
guideImageNum = this.chapter;
}
else if (this.chapter == 11) {
guideImageNum = 8;
}
else if (this.chapter == 20) {
guideImageNum = 6;
} else if (this.chapter == 24) {
guideImageNum = 7;
}
if (guideImageNum && !readCache(getCacheKey() + guideImageNum)) {
Loading2.instace.show()
let g = new GuideMsg();
g.init(
guideImageNum,
() => {
Loading2.instace.hide()
this.addChild(g);
},
() => {
Loading2.instace.hide()
})
}
//开启事件,具体不应该放在这里,到时看
// this.enableMouseEvt(true);
//测试代码
......
......@@ -4,6 +4,9 @@ import { ShowWord } from "../something/uis/ShowWord";
let cacheKey = "happyClear" + window["CFG"].consumerId;
export const getCacheKey=()=>{
return cacheKey
}
/**
* 读取缓存
*/
......
import getResPath from "../../../libs/new_tc/getResPath";
import { writeCache, getCacheKey } from "../../mapScene/GuideCon";
const rrr = "//yun.duiba.com.cn/db_games/activity/game/guideImage/guide";
const moiveClip = {};
const resPath = getResPath()
const parser = new window["SVGA"].Parser();
/**
* 引导
*/
......@@ -10,11 +10,9 @@ export class GuideMsg extends egret.DisplayObjectContainer {
bg: egret.Bitmap;
knowBtn: egret.Bitmap;
closeBtn: egret.Bitmap;
msgTxt: egret.Bitmap;
moiveClip;
guideImageNum: number;
/**
* closeCommonBtn_png
* @param num 1到5的引导
*/
constructor() {
super()
......@@ -26,85 +24,54 @@ export class GuideMsg extends egret.DisplayObjectContainer {
this.addChild(shape);
//背景图
this.bg = new egret.Bitmap(RES.getRes("guideBg_png"));
this.bg.x = (750 - 639) / 2;
this.bg.x = (750 - 580) / 2;
this.bg.y = 300;
this.addChild(this.bg);
//关闭按钮
this.closeBtn = new egret.Bitmap(RES.getRes("closeCommonBtn_png"));
this.closeBtn.x = 615;
this.closeBtn.y = 300;
this.closeBtn.x = 600;
this.closeBtn.y = 285;
this.closeBtn.touchEnabled = true;
this.addChild(this.closeBtn);
this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
if (this.parent) this.parent.removeChild(this)
writeCache(getCacheKey() + this.guideImageNum);
}, this)
//知道了
this.knowBtn = new egret.Bitmap(RES.getRes("guideKnowBtn_png"));
this.knowBtn.x = (750 - 266) / 2;
this.knowBtn.y = 800;
this.knowBtn.y = 750;
this.knowBtn.touchEnabled = true;
this.addChild(this.knowBtn);
this.knowBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
if (this.parent) this.parent.removeChild(this)
writeCache(getCacheKey() + this.guideImageNum);
}, this)
}
/**
*
* @param num
* @param guideImageNum
* @param callback 里面是移除转圈,加进场景
*/
init(num: number, callback: Function) {
//移除原先的svga
if (this.moiveClip) this.removeChild(this.moiveClip);
//svga
if (moiveClip["guide" + num]) {
this.moiveClip = moiveClip["guide" + num];
this.addChild(moiveClip["guide" + num]);
callback();
} else {
parser.load(resPath + 'resource/assets/svgas/' + 'guide' + num + '.svga', (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep = true;
mv.x = 3;
mv.y = -263;
this.moiveClip = mv;
this.addChild(mv);
moiveClip["guide" + num] = mv;
callback();
}, function (error) {
// alert(error.message);
})
}
this.initTxt(num)
}
//调位置
private initTxt(num: number) {
if (!this.msgTxt) {
this.msgTxt = new egret.Bitmap();
this.addChild(this.msgTxt);
init(guideImageNum: number, callback: Function,onerror:Function) {
this.guideImageNum = guideImageNum;
let imgTag = new Image();
imgTag.setAttribute('crossOrigin', 'anonymous');
imgTag.onload = () => {
var bitmapData = new egret.BitmapData(imgTag);
var texture = new egret.Texture();
texture.bitmapData = bitmapData;
var bitmap = new egret.Bitmap(texture);
bitmap.x = (750 - 481) / 2;
bitmap.y = 380;
this.addChild(bitmap);
callback()
}
let y: number;
switch (num) {
case 1:
y = 705;
break;
case 2:
y = 685;
break;
case 3:
y = 685;
break;
case 4:
y = 685;
break;
case 5:
y = 705;
break;
imgTag.src = rrr + guideImageNum + ".png";
imgTag.onerror=()=>{
onerror();
}
var texture: egret.Texture = RES.getRes("guideTxt" + num + "_png");
this.msgTxt.texture = texture;
this.msgTxt.x = (750 - texture.textureWidth) / 2;
this.msgTxt.y = y;
}
}
\ No newline at end of file
import getResPath from "../../../libs/new_tc/getResPath";
const moiveClip = {};
const resPath = getResPath()
const parser = new window["SVGA"].Parser();
/**
* 引导
*/
export class GuideMsg extends egret.DisplayObjectContainer {
bg: egret.Bitmap;
knowBtn: egret.Bitmap;
closeBtn: egret.Bitmap;
msgTxt: egret.Bitmap;
moiveClip;
/**
* closeCommonBtn_png
* @param num 1到5的引导
*/
constructor() {
super()
var shape: egret.Shape = new egret.Shape();
shape.graphics.beginFill(0x000000, 0.7);
shape.graphics.drawRect(0, 0, 750, 1624);
shape.graphics.endFill();
shape.touchEnabled = true;
this.addChild(shape);
//背景图
this.bg = new egret.Bitmap(RES.getRes("guideBg_png"));
this.bg.x = (750 - 639) / 2;
this.bg.y = 300;
this.addChild(this.bg);
//关闭按钮
this.closeBtn = new egret.Bitmap(RES.getRes("closeCommonBtn_png"));
this.closeBtn.x = 615;
this.closeBtn.y = 300;
this.closeBtn.touchEnabled = true;
this.addChild(this.closeBtn);
this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
if (this.parent) this.parent.removeChild(this)
}, this)
//知道了
this.knowBtn = new egret.Bitmap(RES.getRes("guideKnowBtn_png"));
this.knowBtn.x = (750 - 266) / 2;
this.knowBtn.y = 800;
this.knowBtn.touchEnabled = true;
this.addChild(this.knowBtn);
this.knowBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
if (this.parent) this.parent.removeChild(this)
}, this)
}
/**
*
* @param num
* @param callback 里面是移除转圈,加进场景
*/
init(num: number, callback: Function) {
//移除原先的svga
if (this.moiveClip) this.removeChild(this.moiveClip);
//svga
if (moiveClip["guide" + num]) {
this.moiveClip = moiveClip["guide" + num];
this.addChild(moiveClip["guide" + num]);
callback();
} else {
parser.load(resPath + 'resource/assets/svgas/' + 'guide' + num + '.svga', (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep = true;
mv.x = 3;
mv.y = -263;
this.moiveClip = mv;
this.addChild(mv);
moiveClip["guide" + num] = mv;
callback();
}, function (error) {
// alert(error.message);
})
}
this.initTxt(num)
}
//调位置
private initTxt(num: number) {
if (!this.msgTxt) {
this.msgTxt = new egret.Bitmap();
this.addChild(this.msgTxt);
}
let y: number;
switch (num) {
case 1:
y = 705;
break;
case 2:
y = 685;
break;
case 3:
y = 685;
break;
case 4:
y = 685;
break;
case 5:
y = 705;
break;
}
var texture: egret.Texture = RES.getRes("guideTxt" + num + "_png");
this.msgTxt.texture = texture;
this.msgTxt.x = (750 - texture.textureWidth) / 2;
this.msgTxt.y = y;
}
}
\ 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