Commit a8b84604 authored by 邱旭's avatar 邱旭

1

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