Commit cede12d6 authored by wjf's avatar wjf

l

parent c3265068
......@@ -173,6 +173,8 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("guideTxt" + i + "_png")
}
var arr = [
"道具",
"recordbtn",
"lionMsgBg",
"guideBox",
"msgTri",
......
......@@ -277,7 +277,7 @@ export default class MainScene extends Scene {
playSound(SoundType.fail);
PanelCtrl.instance.show("failed", { level: this.chapter });
}, this)
this.addChild(fail);
// this.addChild(fail);
var sucess = new eui.Image(RES.getRes("guideKnowBtn_png"));
sucess.x = 474;
sucess.y = 10;
......
......@@ -72,48 +72,45 @@ export class GuideCon extends egret.DisplayObjectContainer {
this.tri = tri;
this.addChild(tri);
this.showWord = new ShowWord();
this.showWord.x = 286;
this.showWord.x = 315;
this.showWord.y = 692;
this.addChild(this.showWord);
this.groups = [];
//两个图标,道具商城和我的奖励
var gg = new egret.DisplayObjectContainer();
gg.addChild(new egret.Bitmap(RES.getRes("道具_png")));
var recordBtn = new egret.Bitmap(RES.getRes("recordbtn_png"));
recordBtn.y = 304.4 - 154;
gg.addChild(recordBtn);
this.addChild(gg);
this.groups.push(gg);
//guideLove
var guideLove = new egret.Bitmap(RES.getRes("guideLove_png"));
guideLove.x = 38.72;
guideLove.y = 23.5;
this.addChild(guideLove);
this.groups.push(guideLove);
//guideMoney
var guideMoney = new egret.Bitmap(RES.getRes("guideMoney_png"));
guideMoney.x = 354;
guideMoney.y = 24.34;
this.addChild(guideMoney);
this.groups.push(guideMoney);
//关卡
var guideLevel = new egret.Bitmap(RES.getRes("guideLevel_png"));
guideLevel.x = 20.61;
guideLevel.y = 136.24;
guideLevel.x = 315;
guideLevel.y = 462;
this.addChild(guideLevel);
console.log(guideLevel);
this.groups.push(guideLevel);
//宝箱
var box = new egret.Bitmap(RES.getRes("guideBox_png"));
box.x = 20.61;
box.y = 136.24;
this.addChild(box);
this.groups.push(box);
//guideMoney
var guideMoney = new egret.Bitmap(RES.getRes("guideMoney_png"));
guideMoney.x = 354;
guideMoney.y = 24.34;
this.addChild(guideMoney);
this.groups.push(guideMoney);
//guideLove
var guideLove = new egret.Bitmap(RES.getRes("guideLove_png"));
guideLove.x = 38.72;
guideLove.y = 23.5;
this.addChild(guideLove);
this.groups.push(guideLove);
//两个图标,道具商城和我的奖励
var gg = new egret.DisplayObjectContainer();
gg.addChild(new egret.Bitmap(RES.getRes("道具_png")));
var recordBtn = new egret.Bitmap(RES.getRes("recordbtn_png"));
recordBtn.y = 304.4 - 154;
gg.addChild(recordBtn);
this.addChild(gg);
this.groups.push(gg);
gg.x = 615;
gg.y = 154;
//跳过提示
var guideOver = new egret.Bitmap(RES.getRes("guideOver_png"));
......@@ -125,7 +122,7 @@ export class GuideCon extends egret.DisplayObjectContainer {
clearTimeout(this.timeoutId);
writeCache();
}, this)
this.addChild(guideLove);
this.addChild(guideOver);
//箭头
if (!arrow) {
......@@ -148,11 +145,11 @@ export class GuideCon extends egret.DisplayObjectContainer {
}
positions: number[][] = [
[1, 1, 180],
[1, 1, 180],
[1, 1, 0],
[1, 1, 180],
[1, 1, -90],
[245, 290, 180],
[570, 290, 180],
[260, 280, 0],
[255, 430, 180],
[440, 390, -90],
]
words: string[] = [
"这里是生命值,闯关失败后\n都会扣除一点生命值",
......@@ -170,15 +167,23 @@ export class GuideCon extends egret.DisplayObjectContainer {
this.toggleVisible(step);
//箭头位置
arrow.x = this.positions[step - 1][0];
arrow.x = this.positions[step - 1][1];
arrow.y = this.positions[step - 1][1];
arrow.rotation = this.positions[step - 1][2];
//文案播放,播放完后this.couldOver=true,计时
this.showWord.play(this.words[step - 1], () => {
this.couldOver = true;
this.tri.visible = true;
egret.Tween.get(this.tri, { loop: true })
.to({ y: 814 }, 100)
.to({ y: 804 }, 100)
egret.Tween.get(this.tri, { loop: true }, null, true)
.set({ y: 804 })
.to({ y: 814 }, 300)
.to({ y: 804 }, 300)
this.timeoutId = setTimeout(() => {
clearTimeout(this.timeoutId);
this.couldOver = false;
this.goNext();
}, 3000)
})
}
......
......@@ -26,12 +26,12 @@ export default class MapScene extends Scene {
async start(data?) {
super.start();
// if (!readCache()) {
// var guide = new GuideCon();
// this.addChild(guide);
// // guide.play(1)
// console.log(guide)
// }
if (!readCache()) {
var guide = new GuideCon();
this.addChild(guide);
guide.play(1)
console.log(guide)
}
// window['gameover'] = ()=>{
// NetManager.ins.hc_submit(() => { }, 1, 1, null, '');
......
......@@ -10,6 +10,7 @@ export class ShowWord extends egret.DisplayObjectContainer {
this.showText.textColor = 0x000000;
this.showText.width = 410;
this.showText.textAlign = egret.HorizontalAlign.LEFT;
this.showText.lineSpacing = 10;
this.addChild(this.showText);
}
/**
......@@ -17,27 +18,25 @@ export class ShowWord extends egret.DisplayObjectContainer {
* @param text
*/
play(text: string, callback: Function) {
var a = { x: 0 }
egret.Tween.get(a)
.wait(200)
.call(() => {
})
var spiltStrs = text.split("\n");
//拆分文本
let strs: string[] = []
for (var i = 0; i < spiltStrs.length; i++) {
var spiltStr: string = spiltStrs[i];
var str: string = "";
while (i > 0) {
str += spiltStrs[--i];
str += "\n";
var ori: string = "";
var index = 0;
while (index < i) {
ori += spiltStrs[index];
ori += "\n";
index++;
}
for (var j = 0; j < spiltStr.length; j++) {
var str = "" + ori;
str += spiltStr.substring(0, j + 1)
strs.push(str)
}
}
// console.log(strs)
//轮流替换文本
for (let m = 0; m < strs.length; m++) {
let str = strs[m];
......@@ -46,7 +45,7 @@ export class ShowWord extends egret.DisplayObjectContainer {
if (m == strs.length - 1) {
callback();
}
}, 200 * m)
}, 100 * m)
}
}
}
\ 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