Commit a8b84604 authored by 邱旭's avatar 邱旭

1

parent 011cc831
......@@ -331,6 +331,9 @@ export default class MainBase extends eui.UILayer {
for (var i = 0; i <= 9; i++) {
RES.getResAsync("propNum" + i + "_png")
}
RES.getResAsync("propNum" + "第" + "_png");
RES.getResAsync("propNum" + "关" + "_png");
// for (var i = 1; i <= 5; i++) {
// RES.getResAsync("guideTxt" + i + "_png")
// }
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
</w:Declarations>
<e:Image x="0" y="0" source="playSceneBg_jpg"/>
<e:Image y="245" source="targetBoard_png" x="174"/>
<e:Image y="247" source="targetBoard_png" x="174"/>
<e:Image y="0" source="progressDown_png" horizontalCenter="0"/>
<e:Image id="starProgress" x="131" y="201.85" source="starProgress_png"/>
<e:Image x="69" y="-1.15" source="stepsBoard_png"/>
......@@ -46,6 +46,7 @@
<e:Image id="progressmask2" y="9.14" x="16" source="mask2_png" width="444" height="60" scaleX="1" visible="false"/>
</e:Group>
</e:Group>
<e:BitmapLabel width="20" height="20" x="531" y="132"/>
......
......@@ -435,8 +435,8 @@ export default class MainScene extends Scene {
initUi() {
//第几关
var chapterTxt = new ChapterNum();
chapterTxt.num = this.chapter >> 0;
chapterTxt.x = 542;
chapterTxt.num = `第${this.chapter}关` // >> 0;
chapterTxt.x = 500;
chapterTxt.y = 148
this.addChild(chapterTxt)
//步数
......
/**
* 位图数字,单个
*/
......@@ -11,14 +10,15 @@ export class BitmapNumber extends egret.Bitmap {
/**
* 数字0到9
*/
private _num: number;
get num(): number {
private _num: number | string;
get num(): number | string {
return this._num
}
set num(value: number) {
if (value == this._num) return;
set num(value: number | string) {
if(value == this._num) return;
this._num = value;
var texture: egret.Texture = RES.getRes(this.resName + value+"_png");
var texture: egret.Texture = RES.getRes(this.resName + value + "_png");
this.texture = texture;
}
......
......@@ -12,15 +12,29 @@ export class ChapterNum extends egret.DisplayObjectContainer {
/**
* 数字
*/
private _num: number;
get num(): number {
private _num: string | number;
get num(): string | number {
return this._num
}
set num(value: number) {
private returnTO(str: string | number) {
var length = str.toString().length;
var arr = [];
for(let i = 0; i < length; i++) {
arr[i] = str[i]
}
return arr;
}
set num(value: string | number) {
if(value == this._num) return;
this._num = value;
var arr = Tool.returnTO(value);
// var arr = Tool.returnTO(value);
var arr = this.returnTO(value);
//位数从小到大add,
for(var i = 0; i < arr.length; i++) {
if(this.$children[i]) {
......@@ -53,7 +67,7 @@ export class ChapterNum extends egret.DisplayObjectContainer {
constructor() {
super();
this.num = 0;
this.num = '0';
}
/**
......@@ -61,11 +75,18 @@ export class ChapterNum extends egret.DisplayObjectContainer {
*/
center() {
//按顺序排,从右到左,
var len = this.$children.length;
var w = this.$children[0]["texture"].textureWidth - 2;
var right = len / 2 * w - w;
for(var i = 0; i < this.$children.length; i++) {
this.$children[i].x = right - w * i;
}
let _x = 0;
this.$children.forEach((v) => {
v.x = _x;
_x += v.width;
});
// var len = this.$children.length;
// var w = this.$children[0]["texture"].textureWidth - 2;
// var right = len / 2 * w - w;
// for(var i = 0; i < this.$children.length; i++) {
// this.$children[i].x = right - w * i;
// }
}
}
\ 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