Commit 7a69fb71 authored by wjf's avatar wjf

l

parent de2a0c90
This diff is collapsed.
This diff is collapsed.
resource/playScene/boomBtn.png

21.4 KB | W: | H:

resource/playScene/boomBtn.png

13 KB | W: | H:

resource/playScene/boomBtn.png
resource/playScene/boomBtn.png
resource/playScene/boomBtn.png
resource/playScene/boomBtn.png
  • 2-up
  • Swipe
  • Onion skin
resource/playScene/hammerBtn.png

20.4 KB | W: | H:

resource/playScene/hammerBtn.png

14 KB | W: | H:

resource/playScene/hammerBtn.png
resource/playScene/hammerBtn.png
resource/playScene/hammerBtn.png
resource/playScene/hammerBtn.png
  • 2-up
  • Swipe
  • Onion skin
resource/playScene/leftArrow.png

2.2 KB | W: | H:

resource/playScene/leftArrow.png

1.23 KB | W: | H:

resource/playScene/leftArrow.png
resource/playScene/leftArrow.png
resource/playScene/leftArrow.png
resource/playScene/leftArrow.png
  • 2-up
  • Swipe
  • Onion skin
resource/playScene/lightedStar.png

6.04 KB | W: | H:

resource/playScene/lightedStar.png

3.35 KB | W: | H:

resource/playScene/lightedStar.png
resource/playScene/lightedStar.png
resource/playScene/lightedStar.png
resource/playScene/lightedStar.png
  • 2-up
  • Swipe
  • Onion skin
resource/playScene/main_mapbottom.png

3.47 KB | W: | H:

resource/playScene/main_mapbottom.png

2.8 KB | W: | H:

resource/playScene/main_mapbottom.png
resource/playScene/main_mapbottom.png
resource/playScene/main_mapbottom.png
resource/playScene/main_mapbottom.png
  • 2-up
  • Swipe
  • Onion skin
resource/playScene/rightArrow.png

2.18 KB | W: | H:

resource/playScene/rightArrow.png

15.3 KB | W: | H:

resource/playScene/rightArrow.png
resource/playScene/rightArrow.png
resource/playScene/rightArrow.png
resource/playScene/rightArrow.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
resource/playScene/stepBtn.png

20.8 KB | W: | H:

resource/playScene/stepBtn.png

18 KB | W: | H:

resource/playScene/stepBtn.png
resource/playScene/stepBtn.png
resource/playScene/stepBtn.png
resource/playScene/stepBtn.png
  • 2-up
  • Swipe
  • Onion skin
resource/playScene/unlightedStar.png

4.31 KB | W: | H:

resource/playScene/unlightedStar.png

3.8 KB | W: | H:

resource/playScene/unlightedStar.png
resource/playScene/unlightedStar.png
resource/playScene/unlightedStar.png
resource/playScene/unlightedStar.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
...@@ -9,6 +9,7 @@ import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet"; ...@@ -9,6 +9,7 @@ import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet";
import { SkinJson } from "./SkinJson"; import { SkinJson } from "./SkinJson";
import { G_EVENT } from "./common/G_EVENT"; import { G_EVENT } from "./common/G_EVENT";
import { MapScene } from "./scene/map/MapScene"; import { MapScene } from "./scene/map/MapScene";
import { PlayScene } from "./scene/PlayScene";
/** /**
* 全局事件,为了和小程序交互 * 全局事件,为了和小程序交互
...@@ -78,7 +79,7 @@ export class Main { ...@@ -78,7 +79,7 @@ export class Main {
// if (document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none"; // if (document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
//打开开始场景 //打开开始场景
changeScene(MapScene); changeScene(MapScene);
// changeScene(MainScene); // changeScene(PlayScene);
// changeScene(SStartScene); // changeScene(SStartScene);
// changeScene(StoryScene); // changeScene(StoryScene);
// changeScene(AdoptScene); // changeScene(AdoptScene);
......
This diff is collapsed.
...@@ -54,6 +54,7 @@ import { Tools } from '../Tools'; ...@@ -54,6 +54,7 @@ import { Tools } from '../Tools';
import { PropType } from '../something/enum/PropType'; import { PropType } from '../something/enum/PropType';
import { RES } from '../../module/RES'; import { RES } from '../../module/RES';
import { showToast } from '../../module/ctrls'; import { showToast } from '../../module/ctrls';
import { layers } from '../../module/views/layers';
const aniClass = { const aniClass = {
"BoomAni": BoomAni, "BoomAni": BoomAni,
...@@ -104,7 +105,7 @@ const fesChapterData: number[] = [] ...@@ -104,7 +105,7 @@ const fesChapterData: number[] = []
const festivalIndex: number = 40 const festivalIndex: number = 40
export class PlayScene extends Scene { export class PlayScene extends Scene {
get groupNames() { return ["playScene","fiveVerHorDis"] } get groupNames() { return ["playScene", "fiveVerHorDis", "bonusTime"] }
//关卡数据 //关卡数据
chapterData: ChapterData; chapterData: ChapterData;
//关数 //关数
...@@ -176,7 +177,6 @@ export class PlayScene extends Scene { ...@@ -176,7 +177,6 @@ export class PlayScene extends Scene {
*/ */
connectState: number = 2; connectState: number = 2;
//皮肤上的 //注意都需要重写 //皮肤上的 //注意都需要重写
public starProgress: FYGE.Sprite;
public settingGroup: FYGE.Container; public settingGroup: FYGE.Container;
public settingbg: FYGE.Sprite; public settingbg: FYGE.Sprite;
public soundBtn: FYGE.Sprite; public soundBtn: FYGE.Sprite;
...@@ -184,7 +184,7 @@ export class PlayScene extends Scene { ...@@ -184,7 +184,7 @@ export class PlayScene extends Scene {
public questionBtn: FYGE.Sprite; public questionBtn: FYGE.Sprite;
public quitBtn: FYGE.Sprite; public quitBtn: FYGE.Sprite;
public settingBtn: FYGE.Button; public settingBtn: FYGE.Button;
targetScoreTxt: FYGE.TextField; targetScoreTxt: FYGE.BitmapText;
/** /**
* 剩余步数 * 剩余步数
*/ */
...@@ -210,9 +210,9 @@ export class PlayScene extends Scene { ...@@ -210,9 +210,9 @@ export class PlayScene extends Scene {
set score(value: number) { set score(value: number) {
if (value == this._score) return; if (value == this._score) return;
this._score = value; this._score = value;
// FYGE.Tween.removeTweens(this.scoreProgress); FYGE.Tween.removeTweens(this.scoreProgress);
// FYGE.Tween.get(this.scoreProgress, {}, null, true) FYGE.Tween.get(this.scoreProgress, {}, null, true)
// .to({ score: value }, 300) .to({ score: value }, 300)
} }
//所有道具容器 //所有道具容器
propBtnCon: PropBtnCon; propBtnCon: PropBtnCon;
...@@ -234,6 +234,25 @@ export class PlayScene extends Scene { ...@@ -234,6 +234,25 @@ export class PlayScene extends Scene {
step: false, step: false,
failStep: false failStep: false
} }
initUi() {
//适配,整体置顶,
//背景图居中
this.addChild(FYGE.Sprite.fromFrame("playBg.jpg")).position.set(0, -layers.stageOffsetY);
//排版
//底部背景
this.addChild(FYGE.Sprite.fromFrame("topBg.png")).position.set(0, 10);
var commonTextArr = {};
for (var i = 0; i < 10; i++)commonTextArr[i] = RES.getRes("redNum" + i + ".png");
["第", "关", "分", "数"].forEach((e) => { commonTextArr[e] = RES.getRes("redNum" + e + ".png"); })
commonTextArr[":"] = RES.getRes("redNum冒号.png");
//通关目标分数
this.targetScoreTxt = this.addChild(new FYGE.BitmapText(commonTextArr));
this.targetScoreTxt.position.set(375, 188);
this.targetScoreTxt.scale.set(0.8, 0.8);
// this.targetScoreTxt.text = "通关分数:1000"
// console.log(this.targetScoreTxt)
}
start(data: { chapter: number }) { start(data: { chapter: number }) {
super.start(); super.start();
//第几关 //第几关
...@@ -246,7 +265,7 @@ export class PlayScene extends Scene { ...@@ -246,7 +265,7 @@ export class PlayScene extends Scene {
//初始化索引信息,包括10*10的, //初始化索引信息,包括10*10的,
Tool.init(Tool.getColOddEven(this.chapterData.map.lattices), !!(this.passElements && this.passElements[ElementType.LOLLIPOP])); Tool.init(Tool.getColOddEven(this.chapterData.map.lattices), !!(this.passElements && this.passElements[ElementType.LOLLIPOP]));
this.initScene(); this.initScene();
//修改道具数量,发接口消耗传过来的道具 //修改道具数量,
// if (data.boom) { // if (data.boom) {
// NetManager.ins.hc_useProp(() => { }, PropType.BOOMS, data.boom); // NetManager.ins.hc_useProp(() => { }, PropType.BOOMS, data.boom);
// this.propBtnCon.boomBtn.propNumShow.count += data.boom // this.propBtnCon.boomBtn.propNumShow.count += data.boom
...@@ -335,7 +354,7 @@ export class PlayScene extends Scene { ...@@ -335,7 +354,7 @@ export class PlayScene extends Scene {
} }
//初始化界面ui,,道具弄在这里s //初始化界面ui,,道具弄在这里s
initScene() { initScene() {
//皮肤上的几个
//第几关 //第几关
var chapterTxt = new FYGE.BitmapText({});//TODO文本 var chapterTxt = new FYGE.BitmapText({});//TODO文本
chapterTxt.text = "" + (this.chapter >> 0); chapterTxt.text = "" + (this.chapter >> 0);
...@@ -349,14 +368,9 @@ export class PlayScene extends Scene { ...@@ -349,14 +368,9 @@ export class PlayScene extends Scene {
this.addChild(this.stepNumber); this.addChild(this.stepNumber);
//步数初始化 //步数初始化
this.steps = this.chapterData.stepCount; this.steps = this.chapterData.stepCount;
//当前分数
var curScoreNum = new FYGE.BitmapText({});//TODO文本
curScoreNum.x = 322;
curScoreNum.y = 92;
this.addChild(curScoreNum);
//分数进度条,托管 //分数进度条,托管
// this.scoreProgress = new ScoreProgress(this.starProgress, curScoreNum, this.chapterData.starScores); this.scoreProgress = this.addChild(new ScoreProgress(this.chapterData.starScores));
this.scoreProgress.position.set(175, 113)
//分数置0 //分数置0
this.score = 0; this.score = 0;
//地图生成 //地图生成
...@@ -378,7 +392,8 @@ export class PlayScene extends Scene { ...@@ -378,7 +392,8 @@ export class PlayScene extends Scene {
//初始换道具容器 //初始换道具容器
this.propBtnCon = new PropBtnCon(); this.propBtnCon = new PropBtnCon();
this.propBtnCon.y = 230 + Tool.gameAreaHeight + 55; this.propBtnCon.y = 238 + Tool.gameAreaHeight + 10;
this.addChild(this.propBtnCon); this.addChild(this.propBtnCon);
//按钮的事件 //按钮的事件
this.propBtnCon.boomBtn.addEventListener(FYGE.MouseEvent.CLICK, this.onTap_boomBtn, this) this.propBtnCon.boomBtn.addEventListener(FYGE.MouseEvent.CLICK, this.onTap_boomBtn, this)
...@@ -395,8 +410,8 @@ export class PlayScene extends Scene { ...@@ -395,8 +410,8 @@ export class PlayScene extends Scene {
// this.addChild(this.propGuide); // this.addChild(this.propGuide);
//bonusTime引导,备用的,无需加入场景 //bonusTime引导,备用的,无需加入场景
this.bonusTime = new BonusTime(); this.bonusTime = new BonusTime();
this.bonusTime.x = 375; this.bonusTime.x = 375
this.bonusTime.y = 600; this.bonusTime.y = 1624 / 2;
} }
initTarget() { initTarget() {
//通关目标,如果通关目标是元素时,赋值this.passElements,否则 //通关目标,如果通关目标是元素时,赋值this.passElements,否则
...@@ -410,13 +425,13 @@ export class PlayScene extends Scene { ...@@ -410,13 +425,13 @@ export class PlayScene extends Scene {
} }
this.elementTargets = new ElementTargets(this.passElements); this.elementTargets = new ElementTargets(this.passElements);
this.elementTargets.x = 375; this.elementTargets.x = 375;
this.elementTargets.y = 148; this.elementTargets.y = 180;
this.addChild(this.elementTargets); this.addChild(this.elementTargets);
// this.targetScoreTxt.visible = false; this.targetScoreTxt.visible = false;
} else { } else {
this.passElements = null; this.passElements = null;
// this.targetScoreTxt.visible = true; this.targetScoreTxt.visible = true;
// this.targetScoreTxt.text = "目标分数:" + this.chapterData.passTarget.score; this.targetScoreTxt.text = "目标分数:" + this.chapterData.passTarget.score;
} }
} }
initRecycle() { initRecycle() {
...@@ -889,7 +904,7 @@ export class PlayScene extends Scene { ...@@ -889,7 +904,7 @@ export class PlayScene extends Scene {
// } // }
// }) // })
// } else { // } else {
// this.useProp(PropType.BOOMS) this.useProp(PropType.BOOMS)
// } // }
} }
onTap_hammerBtn() { onTap_hammerBtn() {
...@@ -904,7 +919,7 @@ export class PlayScene extends Scene { ...@@ -904,7 +919,7 @@ export class PlayScene extends Scene {
// } // }
// }) // })
// } else { // } else {
// this.useProp(PropType.HAMMERS) this.useProp(PropType.HAMMERS)
// } // }
} }
onTap_stepBtn() { onTap_stepBtn() {
...@@ -919,7 +934,7 @@ export class PlayScene extends Scene { ...@@ -919,7 +934,7 @@ export class PlayScene extends Scene {
// } // }
// }) // })
// } else { // } else {
// this.useProp(PropType.STEPS) this.useProp(PropType.STEPS)
// } // }
} }
//使用道具逻辑 //使用道具逻辑
...@@ -956,6 +971,9 @@ export class PlayScene extends Scene { ...@@ -956,6 +971,9 @@ export class PlayScene extends Scene {
}, this) }, this)
//如果点击引导取消使用,要把elementContainer事件移除 //如果点击引导取消使用,要把elementContainer事件移除
this.propGuide.once(FYGE.MouseEvent.CLICK, () => { this.propGuide.once(FYGE.MouseEvent.CLICK, () => {
//点击移除自己
this.removeChild(this.propGuide)
this.elementContainer.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, fun, this); this.elementContainer.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, fun, this);
//还原事件 //还原事件
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this); this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
...@@ -965,7 +983,7 @@ export class PlayScene extends Scene { ...@@ -965,7 +983,7 @@ export class PlayScene extends Scene {
} else { } else {
if (!this.stepCircle) { if (!this.stepCircle) {
this.stepCircle = new FYGE.Shape(); this.stepCircle = new FYGE.Shape();
this.stepCircle.beginFill(0xff0000, 0); this.stepCircle.beginFill(0xff0000, 0.5);
this.stepCircle.drawCircle(123, 98, 72); this.stepCircle.drawCircle(123, 98, 72);
this.stepCircle.endFill(); this.stepCircle.endFill();
this.stepCircle.addEventListener(FYGE.MouseEvent.CLICK, () => { this.stepCircle.addEventListener(FYGE.MouseEvent.CLICK, () => {
...@@ -975,6 +993,8 @@ export class PlayScene extends Scene { ...@@ -975,6 +993,8 @@ export class PlayScene extends Scene {
this.addChild(this.stepCircle) this.addChild(this.stepCircle)
//如果点击引导取消使用 //如果点击引导取消使用
this.propGuide.once(FYGE.MouseEvent.CLICK, () => { this.propGuide.once(FYGE.MouseEvent.CLICK, () => {
//点击移除自己
this.removeChild(this.propGuide)
//还原事件 //还原事件
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this); this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
if (this.stepCircle.parent) this.removeChild(this.stepCircle) if (this.stepCircle.parent) this.removeChild(this.stepCircle)
...@@ -982,22 +1002,13 @@ export class PlayScene extends Scene { ...@@ -982,22 +1002,13 @@ export class PlayScene extends Scene {
} }
} }
sendPropUse(prop: PropType, index?: number) { sendPropUse(prop: PropType, index?: number) {
//移除事件
this.propGuide.removeAllEventListener();
//移除自己
this.removeChild(this.propGuide); this.removeChild(this.propGuide);
// NetManager.ins.hc_useProp((s, data) => { // NetManager.ins.hc_useProp((s, data) => {
//还原事件 //还原事件
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this); this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
//新增,不发接口,直接减数量
switch (prop) {
case PropType.BOOMS:
this.propBtnCon.boomBtn.propNumShow.count--;
break;
case PropType.HAMMERS:
this.propBtnCon.hammerBtn.propNumShow.count--;
break;
case PropType.STEPS:
this.propBtnCon.stepBtn.propNumShow.count--;
break;
}
//区分 //区分
if (prop == PropType.BOOMS || prop == PropType.HAMMERS) { if (prop == PropType.BOOMS || prop == PropType.HAMMERS) {
this.enableMouseEvt(false) this.enableMouseEvt(false)
...@@ -2469,14 +2480,14 @@ export class PlayScene extends Scene { ...@@ -2469,14 +2480,14 @@ export class PlayScene extends Scene {
* @param p * @param p
*/ */
pushScoreAni(score: number, p: number[]) {//暂时不用 pushScoreAni(score: number, p: number[]) {//暂时不用
// let scoreAni = Pool.takeOut(RecoverName.SCORE_ANI); let scoreAni = Pool.takeOut(RecoverName.SCORE_ANI);
// if (!scoreAni) { if (!scoreAni) {
// scoreAni = new ScoreAni(); scoreAni = new ScoreAni();
// } }
// scoreAni.score = score; scoreAni.score = score;
// scoreAni.x = p[0]; scoreAni.x = p[0];
// scoreAni.y = p[1]; scoreAni.y = p[1];
// this.scoreAnis.push(scoreAni) this.scoreAnis.push(scoreAni)
} }
/** /**
......
...@@ -22,17 +22,19 @@ function initClientScale() { ...@@ -22,17 +22,19 @@ function initClientScale() {
var stageHeight = sysInfo ? sysInfo.windowHeight / sysInfo.windowWidth * 750 : var stageHeight = sysInfo ? sysInfo.windowHeight / sysInfo.windowWidth * 750 :
document.body.clientHeight / document.body.clientWidth * 750; document.body.clientHeight / document.body.clientWidth * 750;
var middleHeight = 80 * 9; var middleHeight = 80 * 9;
var smallestHeight = 230 + middleHeight + 180; var topHeight = 238;
var botHeight = 140+20//210 //+10
var smallestHeight = topHeight + middleHeight + botHeight;
if (stageHeight < smallestHeight) { if (stageHeight < smallestHeight) {
offsetYTwo[0] = 230; offsetYTwo[0] = topHeight;
offsetYTwo[1] = 230; offsetYTwo[1] = topHeight;
gameAreaHeightTwo[0] = middleHeight; gameAreaHeightTwo[0] = middleHeight;
gameAreaHeightTwo[1] = middleHeight + 45; gameAreaHeightTwo[1] = middleHeight + 45;
} else { } else {
offsetYTwo[0] = 230 + (stageHeight - smallestHeight) / 2; offsetYTwo[0] = topHeight + (stageHeight - smallestHeight) / 2;
offsetYTwo[1] = 230 + (stageHeight - smallestHeight - 45) / 2; offsetYTwo[1] = topHeight + (stageHeight - smallestHeight - 45) / 2;
gameAreaHeightTwo[0] = stageHeight - 230 - 180;; gameAreaHeightTwo[0] = stageHeight - topHeight - botHeight;;
gameAreaHeightTwo[1] = stageHeight - 230 - 180; gameAreaHeightTwo[1] = stageHeight - topHeight - botHeight;
} }
} }
......
import { Ani } from "../class/Ani"; import { Ani } from "../class/Ani";
import { ScoreNumber } from "../uis/ScoreNumber";
import { RecoverName } from "../enum/RecoverName"; import { RecoverName } from "../enum/RecoverName";
/** /**
* 分数的动效, * 分数的动效,
* 但是这里面需要记录分数 * 但是这里面需要记录分数
*/ */
export class ScoreAni extends Ani { export class ScoreAni extends Ani {
scoreNumber: ScoreNumber; scoreNumber: FYGE.BitmapText;
private _score: number; private _score: number;
get score(): number { get score(): number {
return this._score return this._score
...@@ -14,12 +13,12 @@ export class ScoreAni extends Ani { ...@@ -14,12 +13,12 @@ export class ScoreAni extends Ani {
set score(value: number) { set score(value: number) {
if (this._score == value) return; if (this._score == value) return;
this._score = value; this._score = value;
this.scoreNumber.num = value; this.scoreNumber.text =""+ value;
} }
constructor() { constructor() {
super(); super();
this.aniName = RecoverName.SCORE_ANI//"ScoreAni"; this.aniName = RecoverName.SCORE_ANI//"ScoreAni";
this.scoreNumber = new ScoreNumber(); this.scoreNumber = new FYGE.BitmapText({});
this.addChild(this.scoreNumber) this.addChild(this.scoreNumber)
} }
play() { play() {
......
...@@ -15,12 +15,15 @@ export class Ani extends FYGE.Container { ...@@ -15,12 +15,15 @@ export class Ani extends FYGE.Container {
aniName: RecoverName; aniName: RecoverName;
constructor() { constructor() {
super(); super();
//动效统统不交互
this.mouseEnable = false;
this.mouseChildren = false;
} }
/** /**
* 从初始位置播放 * 从初始位置播放
*/ */
play(){ play() {
} }
...@@ -28,7 +31,7 @@ export class Ani extends FYGE.Container { ...@@ -28,7 +31,7 @@ export class Ani extends FYGE.Container {
* 播放完后的移除和回收 * 播放完后的移除和回收
*/ */
recover() { recover() {
if(this.parent){ if (this.parent) {
this.parent.removeChild(this) this.parent.removeChild(this)
}; };
Pool.recover(this.aniName, this) Pool.recover(this.aniName, this)
......
...@@ -184,10 +184,13 @@ export class Element extends FYGE.Container { ...@@ -184,10 +184,13 @@ export class Element extends FYGE.Container {
} else { } else {
//直线特效的 hor ver //直线特效的 hor ver
texArr = []; texArr = [];
for (var i = 0; i <= 15; i++)texArr.push(RES.getRes( var hv = this._effectType == EffectType.HORIZONTAL ? "hor" : "ver";
(this._effectType == EffectType.HORIZONTAL ? "hor" : "ver") + for (var i = 0; i <= 15; i++) {
"_ele" + this._type + "_" + i + ".png" texArr.push(RES.getRes(hv + "_ele" + this._type + "_" + i + ".png"));
)) }
for (var i = 14; i >= 1; i--) {
texArr.push(RES.getRes(hv + "_ele" + this._type + "_" + i + ".png"));
}
} }
} }
//处理showImage //处理showImage
...@@ -210,6 +213,8 @@ export class Element extends FYGE.Container { ...@@ -210,6 +213,8 @@ export class Element extends FYGE.Container {
this._effectType == EffectType.MAGICLION this._effectType == EffectType.MAGICLION
) { ) {
this.showImage.alpha = 0; this.showImage.alpha = 0;
} else {
this.showImage.alpha = 1;
} }
//爆炸特效式加动效 //爆炸特效式加动效
if (this._effectType == EffectType.EXPLOSIVE) this.explosiveTween(); if (this._effectType == EffectType.EXPLOSIVE) this.explosiveTween();
...@@ -463,7 +468,7 @@ export class Element extends FYGE.Container { ...@@ -463,7 +468,7 @@ export class Element extends FYGE.Container {
if (!this.explosiveBgAni) return; if (!this.explosiveBgAni) return;
[this.explosiveBgAni, this.showImage].forEach((e) => { [this.explosiveBgAni, this.showImage].forEach((e) => {
e.y = 0; e.y = 0;
e.scaleY = 0; e.scaleY = 1;
FYGE.Tween.get(e, { loop: true }) FYGE.Tween.get(e, { loop: true })
.to({ y: -2 }, 100) .to({ y: -2 }, 100)
.to({ y: 4 }, 200) .to({ y: 4 }, 200)
...@@ -484,11 +489,10 @@ export class Element extends FYGE.Container { ...@@ -484,11 +489,10 @@ export class Element extends FYGE.Container {
} }
} }
//添加一个重置所有贴图的方法,到时加到引擎里 //添加一个重置所有贴图的方法,到时加到引擎里,可以注掉了
FYGE.FrameAni.prototype.resetTexturesAll = function (texturesAll: FYGE.Texture[]) { FYGE.FrameAni.prototype.resetTexturesAll = function (texturesAll: FYGE.Texture[]) {
this.texturesAll = texturesAll; this.texturesAll = texturesAll;
this.changeTexture(0); // this.changeTexture(0);
this.currentFrame = 0; this.currentFrame = 0;
this.frameRate = 30; this.frameRate = 30;
this.isPlay = true;//自动播放
} }
\ No newline at end of file
...@@ -6,6 +6,9 @@ import { Element } from "./Element"; ...@@ -6,6 +6,9 @@ import { Element } from "./Element";
export class State extends FYGE.Container { export class State extends FYGE.Container {
constructor() { constructor() {
super() super()
//状态不交互
this.mouseEnable = false;
this.mouseChildren = false;
} }
//重置方法,子类重写 //重置方法,子类重写
reset(data: any) { reset(data: any) {
......
...@@ -18,6 +18,10 @@ export class ExplosiveBgAni extends FYGE.FrameAni { ...@@ -18,6 +18,10 @@ export class ExplosiveBgAni extends FYGE.FrameAni {
} }
super(arr); super(arr);
//一直循环 //一直循环
this.play(0) this.play(0);
//不交互
this.mouseEnable = false;
this.mouseChildren = false;
} }
} }
\ No newline at end of file
...@@ -10,17 +10,41 @@ export class HorizontalBgAni extends FYGE.Container { ...@@ -10,17 +10,41 @@ export class HorizontalBgAni extends FYGE.Container {
count: number = 0; count: number = 0;
constructor() { constructor() {
super() super()
//不交互
this.mouseEnable = false;
this.mouseChildren = false;
var textureL: FYGE.Texture = RES.getRes("leftArrow.png") var textureL: FYGE.Texture = RES.getRes("leftArrow.png")
this.leftArrow = new FYGE.Sprite(textureL); this.leftArrow = new FYGE.Sprite(textureL);
this.leftArrow.x = -45; this.leftArrow.x = -50;
this.leftArrow.y = -textureL.height / 2; this.leftArrow.y = -textureL.height / 2;
this.addChild(this.leftArrow); this.addChild(this.leftArrow);
FYGE.Tween.get(this.leftArrow, { loop: true })
.set({ alpha: 1 })
.wait(300)
.to({ alpha: 0 }, 700)
FYGE.Tween.get(this.leftArrow, { loop: true })
.set({ x: -50 })
.to({ x: -50 - 6 }, 1000)
var textureR: FYGE.Texture = RES.getRes("rightArrow.png") var textureR: FYGE.Texture = RES.getRes("rightArrow.png")
this.rightArrow = new FYGE.Sprite(textureR); this.rightArrow = new FYGE.Sprite(textureR);
this.rightArrow.x = 45 - textureR.width; var oriX = 50 - textureR.width;
this.rightArrow.x = oriX;
this.rightArrow.y = -textureR.height / 2 this.rightArrow.y = -textureR.height / 2
this.addChild(this.rightArrow); this.addChild(this.rightArrow);
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
FYGE.Tween.get(this.rightArrow, { loop: true })
.set({ alpha: 1 })
.wait(300)
.to({ alpha: 0 }, 700)
FYGE.Tween.get(this.rightArrow, { loop: true })
.set({ x: oriX })
.to({ x: oriX + 6 }, 1000)
// this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
} }
private onEnterFrame() { private onEnterFrame() {
if (this.count >= 10) { if (this.count >= 10) {
...@@ -49,13 +73,13 @@ export class HorizontalBgAni extends FYGE.Container { ...@@ -49,13 +73,13 @@ export class HorizontalBgAni extends FYGE.Container {
reset() { reset() {
// this.showImage.scaleX = this.showImage.scaleY = 0.7; // this.showImage.scaleX = this.showImage.scaleY = 0.7;
// this.showImage.alpha = 1; // this.showImage.alpha = 1;
this.direction = true; // this.direction = true;
this.count = 0; // this.count = 0;
var textureL: FYGE.Texture = RES.getRes("leftArrow.png") // var textureL: FYGE.Texture = RES.getRes("leftArrow.png")
var textureR: FYGE.Texture = RES.getRes("rightArrow.png") // var textureR: FYGE.Texture = RES.getRes("rightArrow.png")
this.leftArrow.x = -45; // this.leftArrow.x = -45;
this.leftArrow.y = -textureL.height / 2; // this.leftArrow.y = -textureL.height / 2;
this.rightArrow.x = 45 - textureR.width; // this.rightArrow.x = 45 - textureR.width;
this.rightArrow.y = -textureR.height / 2 // this.rightArrow.y = -textureR.height / 2
} }
} }
\ No newline at end of file
...@@ -5,6 +5,13 @@ export class MagicLionBgAni extends FYGE.Container { ...@@ -5,6 +5,13 @@ export class MagicLionBgAni extends FYGE.Container {
showImage: FYGE.Sprite; showImage: FYGE.Sprite;
constructor() { constructor() {
super() super()
//不交互
this.mouseEnable = false;
this.mouseChildren = false;
var texture: FYGE.Texture = RES.getRes("magicLionBg.png") var texture: FYGE.Texture = RES.getRes("magicLionBg.png")
this.showImage = new FYGE.Sprite(texture); this.showImage = new FYGE.Sprite(texture);
this.showImage.anchorTexture.set(0.5, 0.5); this.showImage.anchorTexture.set(0.5, 0.5);
......
...@@ -10,19 +10,44 @@ export class VerticalBgAni extends FYGE.Container { ...@@ -10,19 +10,44 @@ export class VerticalBgAni extends FYGE.Container {
count: number = 0; count: number = 0;
constructor() { constructor() {
super() super()
//不交互
this.mouseEnable = false;
this.mouseChildren = false;
var textureL: FYGE.Texture = RES.getRes("leftArrow.png") var textureL: FYGE.Texture = RES.getRes("leftArrow.png")
this.upArrow = new FYGE.Sprite; (textureL); this.upArrow = new FYGE.Sprite(textureL);
this.upArrow.rotation = 90; this.upArrow.rotation = 90;
this.upArrow.x = textureL.width / 2 + 1; this.upArrow.x = textureL.height / 2;
this.upArrow.y = -45 this.upArrow.y = -50;
this.addChild(this.upArrow); this.addChild(this.upArrow);
FYGE.Tween.get(this.upArrow, { loop: true })
.set({ alpha: 1 })
.wait(300)
.to({ alpha: 0 }, 700)
FYGE.Tween.get(this.upArrow, { loop: true })
.set({ y: -50 })
.to({ y: -50 - 6 }, 1000)
var textureR: FYGE.Texture = RES.getRes("rightArrow.png") var textureR: FYGE.Texture = RES.getRes("rightArrow.png")
this.downArrow = new FYGE.Sprite(textureR); this.downArrow = new FYGE.Sprite(textureR);
this.downArrow.rotation = 90; this.downArrow.rotation = 90;
this.downArrow.x = textureR.width / 2 + 1; this.downArrow.x = textureR.height / 2;
this.downArrow.y = 45 - textureR.height; var oriY = 50 - textureR.width;
this.downArrow.y = oriY;
this.addChild(this.downArrow); this.addChild(this.downArrow);
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
FYGE.Tween.get(this.downArrow, { loop: true })
.set({ alpha: 1 })
.wait(300)
.to({ alpha: 0 }, 700)
FYGE.Tween.get(this.downArrow, { loop: true })
.set({ y: oriY })
.to({ y: oriY + 6 }, 1000)
// this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
} }
private onEnterFrame() { private onEnterFrame() {
if (this.count >= 10) { if (this.count >= 10) {
...@@ -51,14 +76,14 @@ export class VerticalBgAni extends FYGE.Container { ...@@ -51,14 +76,14 @@ export class VerticalBgAni extends FYGE.Container {
reset() { reset() {
// this.showImage.scaleX = this.showImage.scaleY = 0.7; // this.showImage.scaleX = this.showImage.scaleY = 0.7;
// this.showImage.alpha = 1; // this.showImage.alpha = 1;
this.direction = true; // this.direction = true;
this.count = 0; // this.count = 0;
var textureL: FYGE.Texture = RES.getRes("leftArrow.png") // var textureL: FYGE.Texture = RES.getRes("leftArrow.png")
var textureR: FYGE.Texture = RES.getRes("rightArrow.png") // var textureR: FYGE.Texture = RES.getRes("rightArrow.png")
this.upArrow.x = textureL.width / 2 + 1; // this.upArrow.x = textureL.width / 2 + 1;
this.upArrow.y = -45 // this.upArrow.y = -45
this.downArrow.x = textureR.width / 2 + 1; // this.downArrow.x = textureR.width / 2 + 1;
this.downArrow.y = 45 - textureR.height; // this.downArrow.y = 45 - textureR.height;
} }
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ export class BonusTime extends FYGE.FrameAni { ...@@ -11,7 +11,7 @@ export class BonusTime extends FYGE.FrameAni {
for (var i = 9; i <= 20; i++)arr.push(i); for (var i = 9; i <= 20; i++)arr.push(i);
for (var i = 9; i <= 14; i++)arr.push(i); for (var i = 9; i <= 14; i++)arr.push(i);
arr.push(9); arr.push(9);
for (var i = 21; i <= 32; i++)arr.push(i); for (var i = 21; i <= 28; i++)arr.push(i);
var texArr: FYGE.Texture[] = []; var texArr: FYGE.Texture[] = [];
arr.forEach((n) => { texArr.push(RES.getRes("bonusTime" + n + ".png")) }) arr.forEach((n) => { texArr.push(RES.getRes("bonusTime" + n + ".png")) })
super(texArr); super(texArr);
......
...@@ -3,20 +3,68 @@ import { RES } from "../../../module/RES"; ...@@ -3,20 +3,68 @@ import { RES } from "../../../module/RES";
export class PropBtnCon extends FYGE.Container { export class PropBtnCon extends FYGE.Container {
boomBtn: CusButton; boomBtn: FYGE.Button;
hammerBtn: CusButton; hammerBtn: FYGE.Button;
stepBtn: CusButton; stepBtn: FYGE.Button;
private stepNum: FYGE.BitmapText;
private _stepCount: number;
get stepCount() {
return this._stepCount;
}
set stepCount(value) {
this._stepCount = value;
this.stepNum.text = "" + value;
}
private boomNum: FYGE.BitmapText;
private _boomCount: number;
get boomCount() {
return this._boomCount;
}
set boomCount(value) {
this._boomCount = value;
this.boomNum.text = "" + value;
}
private hammerNum: FYGE.BitmapText;
private _hammerCount: number;
get hammerCount() {
return this._hammerCount;
}
set hammerCount(value) {
this._hammerCount = value;
this.hammerNum.text = "" + value;
}
constructor() { constructor() {
super(); super();
this.boomBtn = new CusButton("boomBtn.png"); this.addChild(FYGE.Sprite.fromFrame("table.png"));
this.boomBtn.x = 375 - 110 - 50 //110图片宽度,50按钮间隔 this.stepBtn = new FYGE.Button(RES.getRes("stepBtn.png"));
this.stepBtn.x = 100
this.addChild(this.stepBtn);
this.boomBtn = new FYGE.Button(RES.getRes("boomBtn.png"));
this.boomBtn.x = 311
this.addChild(this.boomBtn) this.addChild(this.boomBtn)
this.hammerBtn = new CusButton("hammerBtn.png"); this.hammerBtn = new FYGE.Button(RES.getRes("hammerBtn.png"));
this.hammerBtn.x = 375; this.hammerBtn.x = 488;
this.addChild(this.hammerBtn) this.addChild(this.hammerBtn)
this.stepBtn = new CusButton("stepBtn.png"); this.stepBtn.y = this.boomBtn.y = this.hammerBtn.y = -10
this.stepBtn.x = 375 + 110 + 50
this.addChild(this.stepBtn)
var arr = {};
for (var i = 0; i < 10; i++)arr[i] = RES.getRes("propNum" + i + ".png")
//文案
this.stepNum = this.addChild(new FYGE.BitmapText(arr));
this.boomNum = this.addChild(new FYGE.BitmapText(arr));
this.hammerNum = this.addChild(new FYGE.BitmapText(arr));
this.stepNum.y = this.boomNum.y = this.hammerNum.y = 60;
this.stepNum.text = this.boomNum.text = this.hammerNum.text = "13";
this.stepNum.textAlign = this.boomNum.textAlign = this.hammerNum.textAlign = FYGE.TEXT_ALIGN.CENTER;
this.stepNum.x = 227
this.boomNum.x = 227 + 187
this.hammerNum.x = 227 + 187 * 2;
// console.log(this.stepNum, this.boomNum,this.hammerNum)
} }
} }
...@@ -25,57 +73,5 @@ export class PropBtnCon extends FYGE.Container { ...@@ -25,57 +73,5 @@ export class PropBtnCon extends FYGE.Container {
/** /**
* 自定义按钮 * 自定义按钮
*/ */
class CusButton extends FYGE.Button {
propNumShow: PropNumShow
constructor(source: string) {
super(RES.getRes(source));
this.propNumShow = new PropNumShow();
this.propNumShow.x = 15;
this.propNumShow.y = 15;
this.addChild(this.propNumShow);
}
}
class PropNumShow extends FYGE.Container {
private bg: FYGE.Sprite;
private bgGrey: FYGE.Sprite;
/**
* 数量文案
*/
private countNum: FYGE.BitmapText;
/**
* 数量
*/
private _count: number;
get count(): number {
return this._count;
}
set count(value: number) {
if (value <= 0) {
value = 0;
//变灰 换图
this.bg.visible = this.countNum.visible = false;
this.bgGrey.visible = true;
} else {
this.bg.visible = this.countNum.visible = true;
this.bgGrey.visible = false;
}
this._count = value;
this.countNum.text = "" + value;
}
constructor() {
super();
//背景
this.bg = this.addChild(new FYGE.Sprite(RES.getRes("propNumBg.png")));
this.bgGrey = this.addChild(new FYGE.Sprite(RES.getRes("propNumBg.png")))
//数字
this.countNum = new FYGE.BitmapText({});//TODO文本待定
this.countNum.x = 22.5;
this.countNum.y = 7;
this.addChild(this.countNum);
this.count = 0;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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