Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
xiaoxiaole
Commits
30648b97
Commit
30648b97
authored
Nov 05, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
ac47af6a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
7 deletions
+89
-7
index.html
egret/index.html
+1
-1
MainBase.ts
egret/libs/new_wx/MainBase.ts
+3
-0
MainScene.ts
egret/src/mainScene/MainScene.ts
+10
-2
CurScoreNum.ts
egret/src/something/uis/CurScoreNum.ts
+70
-0
ScoreProgress.ts
egret/src/something/uis/ScoreProgress.ts
+4
-3
TargetNumber.ts
egret/src/something/uis/TargetNumber.ts
+1
-1
No files found.
egret/index.html
View file @
30648b97
...
...
@@ -41,7 +41,7 @@
<body>
<div
style=
"margin: auto;width: 100%;height: 100%;"
class=
"egret-player"
data-entry-class=
"Main"
data-orientation=
"auto"
data-scale-mode=
"showAll"
data-frame-rate=
"60"
data-content-width=
"750"
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"
tru
e"
data-show-log=
"true"
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"
fals
e"
data-show-log=
"true"
data-show-fps-style=
"x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"
>
</div>
...
...
egret/libs/new_wx/MainBase.ts
View file @
30648b97
...
...
@@ -269,6 +269,9 @@ export default class MainBase extends eui.UILayer {
for
(
var
i
=
1
;
i
<=
11
;
i
++
)
{
RES
.
getResAsync
(
"hairballPiece"
+
i
+
"_png"
)
}
for
(
var
i
=
0
;
i
<=
9
;
i
++
)
{
RES
.
getResAsync
(
"curScoreNum"
+
i
+
"_png"
)
}
var
arr
=
[
"hairballDisBg"
,
"brownBallFace"
,
...
...
egret/src/mainScene/MainScene.ts
View file @
30648b97
...
...
@@ -64,6 +64,7 @@ import { EleDownAni } from '../something/anis/EleDownAni';
import
{
GameGuide
}
from
'../something/uis/GameGuide'
;
import
{
PropBtnCon
}
from
'../something/uis/PropBtnCon'
;
import
{
ChapterNum
}
from
'../something/uis/ChapterNum'
;
import
{
CurScoreNum
}
from
'../something/uis/CurScoreNum'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -230,6 +231,8 @@ export default class MainScene extends Scene {
this
.
chapter
=
(
data
&&
data
.
chapter
)
?
data
.
chapter
:
1
;
// this.chapter = 24;
this
.
chapterTxt
.
text
=
"第"
+
this
.
chapter
+
"关"
;
this
.
removeChild
(
this
.
chapterTxt
);
this
.
removeChild
(
this
.
scoreTxt
);
//关卡数据
this
.
chapterData
=
getChapterData
(
this
.
chapter
);
//初始化目标信息
...
...
@@ -318,9 +321,14 @@ export default class MainScene extends Scene {
this
.
addChild
(
this
.
stepNumber
);
//步数初始化
this
.
steps
=
this
.
chapterData
.
stepCount
;
//当前分数
var
curScoreNum
=
new
CurScoreNum
();
curScoreNum
.
x
=
322
;
curScoreNum
.
y
=
92
;
this
.
addChild
(
curScoreNum
);
//分数进度条,托管
this
.
scoreProgress
=
new
ScoreProgress
(
this
.
starProgress
,
this
.
scoreTxt
,
this
.
chapterData
.
starScores
);
this
.
scoreTxt
.
y
-=
2
;
this
.
scoreProgress
=
new
ScoreProgress
(
this
.
starProgress
,
curScoreNum
,
this
.
chapterData
.
starScores
);
//分数置0
this
.
score
=
0
;
//地图生成
...
...
egret/src/something/uis/CurScoreNum.ts
0 → 100644
View file @
30648b97
import
{
BitmapNumber
}
from
"../class/BitmapNumber"
;
import
{
Tool
}
from
"../Tool"
;
import
{
Pool
}
from
"../Pool"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
/**
* 位图数字 目标元素数量
* 不管多少位,都按中间数字居中
* 暂不做通用,以后再说,否则回收问题
*/
export
class
CurScoreNum
extends
egret
.
DisplayObjectContainer
{
/**
* 数字
*/
private
_num
:
number
;
get
num
():
number
{
return
this
.
_num
}
set
num
(
value
:
number
)
{
if
(
value
==
this
.
_num
)
return
;
this
.
_num
=
value
;
var
arr
=
Tool
.
returnTO
(
value
);
//位数从小到大add,
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
this
.
$children
[
i
])
{
//先用完原先$children里的,不通用就没必要修改resName
this
.
$children
[
i
][
"num"
]
=
arr
[
i
];
}
else
{
//如果没有就
let
o
:
BitmapNumber
=
Pool
.
takeOut
(
RecoverName
.
BITMAP_NUMBER
);
if
(
!
o
)
{
o
=
new
BitmapNumber
(
"curScoreNum"
);
}
else
{
o
.
reset
(
"curScoreNum"
)
}
o
.
num
=
arr
[
i
];
this
.
addChild
(
o
)
}
}
//如果多了,去掉后面的,回收
if
(
this
.
$children
.
length
>
arr
.
length
)
{
//移除后序
for
(
var
i
=
this
.
$children
.
length
-
1
;
i
>=
arr
.
length
;
i
--
)
{
let
c
=
this
.
$children
[
i
];
this
.
removeChild
(
c
);
Pool
.
recover
(
RecoverName
.
BITMAP_NUMBER
,
c
);
}
}
//居中适配
this
.
center
()
}
constructor
()
{
super
();
this
.
num
=
0
;
}
/**
* 居中位置
*/
center
()
{
//按顺序排,从右到左,
var
len
=
this
.
$children
.
length
;
var
w
=
this
.
$children
[
0
][
"texture"
].
textureWidth
-
4
;
var
right
=
len
/
2
*
w
-
w
+
len
/
2
*
w
;
for
(
var
i
=
0
;
i
<
this
.
$children
.
length
;
i
++
)
{
this
.
$children
[
i
].
x
=
right
-
w
*
i
;
}
}
}
\ No newline at end of file
egret/src/something/uis/ScoreProgress.ts
View file @
30648b97
import
{
CurScoreNum
}
from
"./CurScoreNum"
;
/**
* 分数条的托管类,不需要继承
...
...
@@ -15,7 +16,7 @@ export class ScoreProgress {
star3
:
eui
.
Image
;
starProgress
:
eui
.
Image
;
scoreTxt
:
eui
.
Label
;
scoreTxt
:
CurScoreNum
;
allScore
:
number
;
private
_score
:
number
;
get
score
()
{
...
...
@@ -24,7 +25,7 @@ export class ScoreProgress {
set
score
(
value
:
number
)
{
if
(
this
.
_score
==
value
)
return
this
.
_score
=
value
this
.
scoreTxt
.
text
=
Math
.
ceil
(
value
)
+
""
;
this
.
scoreTxt
.
num
=
Math
.
ceil
(
value
)
;
var
diss
=
[
188
,
446
,
...
...
@@ -92,7 +93,7 @@ export class ScoreProgress {
* @param scoreTxt 托管
* @param starScores
*/
constructor
(
starProgress
:
eui
.
Image
,
scoreTxt
:
eui
.
Label
,
starScores
:
number
[])
{
constructor
(
starProgress
:
eui
.
Image
,
scoreTxt
:
CurScoreNum
,
starScores
:
number
[])
{
this
.
starProgress
=
starProgress
;
this
.
scoreTxt
=
scoreTxt
;
this
.
starScores
=
starScores
;
...
...
egret/src/something/uis/TargetNumber.ts
View file @
30648b97
...
...
@@ -61,7 +61,7 @@ export class TargetNumber extends egret.DisplayObjectContainer {
center
()
{
//按顺序排,从右到左,
var
len
=
this
.
$children
.
length
;
var
w
=
this
.
$children
[
0
][
"texture"
].
textureWidth
;
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment