Commit eccf6925 authored by wildfirecode13's avatar wildfirecode13

1

parent 1399ae5c
No preview for this file type
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
"baseOffset": { "baseOffset": {
"alias": "底座偏移", "alias": "底座偏移",
"type": "number", "type": "number",
"default": 500 "default": 262
}, },
"playerOffset": { "playerOffset": {
"alias": "角色偏移", "alias": "角色偏移",
......
/** /**
* Created by rockyl on 2018/8/16. * Created by rockyl on 2018/8/16.
*/ */
import { props } from "../props";
import { Background } from "./Background";
import { Base } from "./Base";
import Block from "./Block"; import Block from "./Block";
import {Background} from "./Background"; import { GoldBag } from "./GoldBag";
import { GuideLayer } from "./GuideLayer";
import Player from "./Player"; import Player from "./Player";
import {props} from "../props"; import { createSvga, getTextureByName, playSound } from "./utils";
import {createSvga, getTextureByName, playSound} from "./utils";
import {Base} from "./Base";
import {GuideLayer} from "./GuideLayer";
import {GoldBag} from "./GoldBag";
import ObjectPool = engine.ObjectPool; import ObjectPool = engine.ObjectPool;
import { JumpTips } from "./JumpTips";
const PoolName: string = 'gold-bag'; const PoolName: string = 'gold-bag';
...@@ -37,7 +36,6 @@ export default class GameView extends engine.Container { ...@@ -37,7 +36,6 @@ export default class GameView extends engine.Container {
baseOffset: number; baseOffset: number;
scoreAddTipsContainer; scoreAddTipsContainer;
jumpTips
timer; timer;
...@@ -125,18 +123,12 @@ export default class GameView extends engine.Container { ...@@ -125,18 +123,12 @@ export default class GameView extends engine.Container {
scoreAddTips.x = this.player.x-scoreAddTips.width / 2; scoreAddTips.x = this.player.x-scoreAddTips.width / 2;
scoreAddTipsContainer.addChild(scoreAddTips); scoreAddTipsContainer.addChild(scoreAddTips);
let jumpTips = this.jumpTips =new JumpTips()
jumpTips.setup()
jumpTips.x=props.jumpTipsOffset.x
frontContainer.addChild(playerShadow); frontContainer.addChild(playerShadow);
frontContainer.addChild(player); frontContainer.addChild(player);
frontContainer.addChild(scoreAddTipsContainer); frontContainer.addChild(scoreAddTipsContainer);
frontContainer.addChild(jumpTips);
ObjectPool.recycleObject(PoolName, ObjectPool.getObject(PoolName, { ObjectPool.recycleObject(PoolName, ObjectPool.getObject(PoolName, {
y: 0, y: 0,
...@@ -209,7 +201,6 @@ export default class GameView extends engine.Container { ...@@ -209,7 +201,6 @@ export default class GameView extends engine.Container {
this._playerShadow.y =this.player.y+props.playerShadowOffset; this._playerShadow.y =this.player.y+props.playerShadowOffset;
this.scoreAddTipsContainer.y =this.player.y+props.scoreAddTipsOffset; this.scoreAddTipsContainer.y =this.player.y+props.scoreAddTipsOffset;
this.jumpTips.y =this.player.y+props.jumpTipsOffset.y;
//this.setScoreText("+100") //this.setScoreText("+100")
if (!revive) { if (!revive) {
await this.player.playReady(); await this.player.playReady();
...@@ -456,9 +447,6 @@ export default class GameView extends engine.Container { ...@@ -456,9 +447,6 @@ export default class GameView extends engine.Container {
this.scoreAddTipsContainer.y =this.player.y+props.scoreAddTipsOffset; this.scoreAddTipsContainer.y =this.player.y+props.scoreAddTipsOffset;
this.setScoreText(`+${scoreAdd}`) this.setScoreText(`+${scoreAdd}`)
this.jumpTips.y =this.player.y+props.jumpTipsOffset.y;
this.jumpTips.show()
console.log(score, this._remainToShowGoldBag); console.log(score, this._remainToShowGoldBag);
if (this._remainToShowGoldBag <= 0) { if (this._remainToShowGoldBag <= 0) {
......
/**
* Created by rockyl on 2020-01-21.
*/
import {getTextureByName} from "./utils";
import {props} from "../props";
export class JumpTips extends engine.Container {
private _bg: engine.Image;
private _jumpTipsLabel: engine.Label;
private _minScale: number;
constructor() {
super();
}
setup() {
// const {width, height} = this.stage;
this.width=124;
this.height=93;
let bg = this._bg = new engine.Image(getTextureByName('跳跃提示背景'));
bg.width=this.width;
bg.height=this.height;
bg.anchorX = bg.width / 2;
bg.anchorY = bg.height / 2;
this.addChild(bg);
//this._minScale = width / bg.width;
let jumpTipsLabel = this._jumpTipsLabel = new engine.Label();
jumpTipsLabel.width=this.width;
jumpTipsLabel.height=this.height;
jumpTipsLabel.anchorX = jumpTipsLabel.width / 2;
jumpTipsLabel.anchorY = jumpTipsLabel.height / 2;
jumpTipsLabel.fillColor = "#fc4454";
jumpTipsLabel.textAlign=engine.TEXT_ALIGN.CENTER;
jumpTipsLabel.verticalAlign=engine.VERTICAL_ALIGN.MIDDLE;
jumpTipsLabel.size = 24;
jumpTipsLabel.rotation=-26;
jumpTipsLabel.text = "+00";
jumpTipsLabel.x=0;
jumpTipsLabel.y=0;
this.addChild(jumpTipsLabel);
this.alpha=0;
}
show() {
return new Promise(resolve => {
this._jumpTipsLabel.text=props.jumpTips[parseInt((Math.random()*props.jumpTips.length)+"")]
this.alpha=1;
engine.Tween.get(this, null, null, true)
.wait(800)
.to({alpha: 0}, 200, engine.Ease.cubicInOut)
.call(resolve);
})
}
}
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