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
708a3fd5
Commit
708a3fd5
authored
Aug 21, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
20e8ee56
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
261 additions
and
31 deletions
+261
-31
MainBase.ts
egret/libs/new_wx/MainBase.ts
+4
-0
propNum0.png
egret/resource/assets/mainScene/propNum0.png
+0
-0
propNum1.png
egret/resource/assets/mainScene/propNum1.png
+0
-0
propNum2.png
egret/resource/assets/mainScene/propNum2.png
+0
-0
propNum3.png
egret/resource/assets/mainScene/propNum3.png
+0
-0
propNum4.png
egret/resource/assets/mainScene/propNum4.png
+0
-0
propNum5.png
egret/resource/assets/mainScene/propNum5.png
+0
-0
propNum6.png
egret/resource/assets/mainScene/propNum6.png
+0
-0
propNum7.png
egret/resource/assets/mainScene/propNum7.png
+0
-0
propNum8.png
egret/resource/assets/mainScene/propNum8.png
+0
-0
propNum9.png
egret/resource/assets/mainScene/propNum9.png
+0
-0
propNumBg.png
egret/resource/assets/mainScene/propNumBg.png
+0
-0
default.res.json
egret/resource/default.res.json
+57
-2
MainScene.ts
egret/src/mainScene/MainScene.ts
+70
-10
Chapters.ts
egret/src/something/Chapters.ts
+19
-19
PropNumShow.ts
egret/src/something/uis/PropNumShow.ts
+52
-0
PropNumber.ts
egret/src/something/uis/PropNumber.ts
+59
-0
No files found.
egret/libs/new_wx/MainBase.ts
View file @
708a3fd5
...
...
@@ -156,10 +156,14 @@ export default class MainBase extends eui.UILayer {
for
(
var
i
=
0
;
i
<=
9
;
i
++
)
{
RES
.
getResAsync
(
"targetNumber"
+
i
+
"_png"
)
}
for
(
var
i
=
0
;
i
<=
9
;
i
++
)
{
RES
.
getResAsync
(
"propNum"
+
i
+
"_png"
)
}
for
(
var
i
=
1
;
i
<=
5
;
i
++
)
{
RES
.
getResAsync
(
"guideTxt"
+
i
+
"_png"
)
}
var
arr
=
[
"propNumBg"
,
"guideBg"
,
"guideKnowBtn"
,
"bonusShoot"
,
...
...
egret/resource/assets/mainScene/propNum0.png
0 → 100644
View file @
708a3fd5
1.59 KB
egret/resource/assets/mainScene/propNum1.png
0 → 100644
View file @
708a3fd5
1.29 KB
egret/resource/assets/mainScene/propNum2.png
0 → 100644
View file @
708a3fd5
1.52 KB
egret/resource/assets/mainScene/propNum3.png
0 → 100644
View file @
708a3fd5
1.63 KB
egret/resource/assets/mainScene/propNum4.png
0 → 100644
View file @
708a3fd5
1.47 KB
egret/resource/assets/mainScene/propNum5.png
0 → 100644
View file @
708a3fd5
1.54 KB
egret/resource/assets/mainScene/propNum6.png
0 → 100644
View file @
708a3fd5
1.65 KB
egret/resource/assets/mainScene/propNum7.png
0 → 100644
View file @
708a3fd5
1.3 KB
egret/resource/assets/mainScene/propNum8.png
0 → 100644
View file @
708a3fd5
1.7 KB
egret/resource/assets/mainScene/propNum9.png
0 → 100644
View file @
708a3fd5
1.67 KB
egret/resource/assets/mainScene/propNumBg.png
0 → 100644
View file @
708a3fd5
4.55 KB
egret/resource/default.res.json
View file @
708a3fd5
...
...
@@ -57,11 +57,11 @@
"name"
:
"startpanel"
},
{
"keys"
:
"yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,playSceneBg_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png"
,
"keys"
:
"yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,playSceneBg_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png
,propNum9_png,propNum8_png,propNum7_png,propNum6_png,propNum5_png,propNum4_png,propNum3_png,propNum2_png,propNum1_png,propNum0_png,propNumBg_png
"
,
"name"
:
"mainScene"
},
{
"keys"
:
"showoff_jpg,share2_jpg"
,
"keys"
:
"showoff_jpg,share2_jpg
,propNum9_png,propNum0_png,propNum1_png,propNum2_png,propNum3_png,propNum4_png,propNum5_png,propNum6_png,propNum7_png,propNum8_png,propNumBg_png
"
,
"name"
:
"preload"
}
],
...
...
@@ -1355,6 +1355,61 @@
"url"
:
"assets/mainScene/guideTxt4.png"
,
"type"
:
"image"
,
"name"
:
"guideTxt4_png"
},
{
"url"
:
"assets/mainScene/propNum9.png"
,
"type"
:
"image"
,
"name"
:
"propNum9_png"
},
{
"url"
:
"assets/mainScene/propNum0.png"
,
"type"
:
"image"
,
"name"
:
"propNum0_png"
},
{
"url"
:
"assets/mainScene/propNum1.png"
,
"type"
:
"image"
,
"name"
:
"propNum1_png"
},
{
"url"
:
"assets/mainScene/propNum2.png"
,
"type"
:
"image"
,
"name"
:
"propNum2_png"
},
{
"url"
:
"assets/mainScene/propNum3.png"
,
"type"
:
"image"
,
"name"
:
"propNum3_png"
},
{
"url"
:
"assets/mainScene/propNum4.png"
,
"type"
:
"image"
,
"name"
:
"propNum4_png"
},
{
"url"
:
"assets/mainScene/propNum5.png"
,
"type"
:
"image"
,
"name"
:
"propNum5_png"
},
{
"url"
:
"assets/mainScene/propNum6.png"
,
"type"
:
"image"
,
"name"
:
"propNum6_png"
},
{
"url"
:
"assets/mainScene/propNum7.png"
,
"type"
:
"image"
,
"name"
:
"propNum7_png"
},
{
"url"
:
"assets/mainScene/propNum8.png"
,
"type"
:
"image"
,
"name"
:
"propNum8_png"
},
{
"url"
:
"assets/mainScene/propNumBg.png"
,
"type"
:
"image"
,
"name"
:
"propNumBg_png"
}
]
}
\ No newline at end of file
egret/src/mainScene/MainScene.ts
View file @
708a3fd5
...
...
@@ -43,6 +43,9 @@ import { BonusShootAni, stepPosition } from '../something/anis/BonusShootAni';
import
{
GuideMsg
}
from
'../something/uis/GuideMsg'
;
import
Loading
from
'../../libs/new_wx/components/Loading'
;
import
{
getlogItem
}
from
'../Main'
;
import
getHomeData
,
{
getPropNums
}
from
'../getHomeData'
;
import
PropType
from
'../PropType'
;
import
{
PropNumShow
}
from
'../something/uis/PropNumShow'
;
// import BridgeFactory from "../../libs/JSBridge/bridge/BridgeFactory";
const
aniClass
=
{
...
...
@@ -178,7 +181,9 @@ export default class MainScene extends Scene {
//同时加进度条,和星星的判断
// this.scoreProgress.score=value
}
boomBtnNum
:
PropNumShow
;
hammerBtnNum
:
PropNumShow
;
stepBtnNum
:
PropNumShow
;
start
(
data
)
{
super
.
start
();
//初始化索引信息
...
...
@@ -294,7 +299,7 @@ export default class MainScene extends Scene {
//容器事件
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
mouseDownE
,
this
);
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_MOVE
,
this
.
mouseMoveE
,
this
);
//根据
缓存
修改音乐显示按钮
//根据修改音乐显示按钮
if
(
getSoundOn
())
{
this
.
soundBtn
.
source
=
"mainSoundBtnOn_png"
}
else
{
...
...
@@ -305,6 +310,20 @@ export default class MainScene extends Scene {
}
else
{
this
.
musicBtn
.
source
=
"mainSoundBtnOff_png"
}
//初始化道具信息
var
arrObj
=
[
"boomBtnNum"
,
"hammerBtnNum"
,
"stepBtnNum"
];
var
nums
=
[
getPropNums
(
PropType
.
BOOM
),
getPropNums
(
PropType
.
HAMMER
),
getPropNums
(
PropType
.
CHANCE_NUM
)]
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
this
[
arrObj
[
i
]]
=
new
PropNumShow
();
this
[
arrObj
[
i
]].
x
=
205
+
i
*
195
;
this
[
arrObj
[
i
]].
y
=
1125
;
this
[
arrObj
[
i
]].
count
=
nums
[
i
];
this
.
addChild
(
this
[
arrObj
[
i
]])
}
//用一次发一次hc_home接口
// getPropNums(PropType.BOOM);
// getPropNums(PropType.HAMMER);
// getPropNums(PropType.CHANCE_NUM);
}
//初始化格子
initLattices
()
{
...
...
@@ -437,6 +456,16 @@ export default class MainScene extends Scene {
}
return
Tool
.
randomT
(
arr
);
}
/**
* 更新三个道具
*/
updateScene
()
{
var
arrObj
=
[
"boomBtnNum"
,
"hammerBtnNum"
,
"stepBtnNum"
];
var
nums
=
[
getPropNums
(
PropType
.
BOOM
),
getPropNums
(
PropType
.
HAMMER
),
getPropNums
(
PropType
.
CHANCE_NUM
)]
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
this
[
arrObj
[
i
]].
count
=
nums
[
i
];
}
}
// 初始化埋点信息
initBuired
()
{
...
...
@@ -457,6 +486,10 @@ export default class MainScene extends Scene {
this
.
soundBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_soundBtnn
,
this
)
this
.
musicBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_musicBtn
,
this
)
this
.
quitBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_quitBtn
,
this
)
this
.
boomBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_boomBtn
,
this
)
this
.
hammerBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_hammerBtn
,
this
)
this
.
stepBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_stepBtn
,
this
)
}
removeEvents
()
{
...
...
@@ -466,6 +499,10 @@ export default class MainScene extends Scene {
this
.
soundBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_soundBtnn
,
this
)
this
.
musicBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_musicBtn
,
this
)
this
.
quitBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_quitBtn
,
this
)
this
.
boomBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_boomBtn
,
this
)
this
.
hammerBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_hammerBtn
,
this
)
this
.
stepBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_stepBtn
,
this
)
}
onEnterFrame
()
{
if
(
this
.
enableTouch
)
{
...
...
@@ -535,14 +572,37 @@ export default class MainScene extends Scene {
onTap_quitBtn
()
{
PanelCtrl
.
instance
.
show
(
"quit"
);
}
onTap_boomBtn
(){
NetManager
.
ins
.
showLog
(
getlogItem
(
7
))
onTap_boomBtn
()
{
NetManager
.
ins
.
showLog
(
getlogItem
(
7
));
if
(
this
.
boomBtnNum
.
count
<=
0
)
{
//购买弹框
PanelCtrl
.
instance
.
show
(
"Buy1"
)
}
else
{
}
}
onTap_hammerBtn
(){
NetManager
.
ins
.
showLog
(
getlogItem
(
10
))
onTap_hammerBtn
()
{
NetManager
.
ins
.
showLog
(
getlogItem
(
10
));
if
(
this
.
hammerBtnNum
.
count
<=
0
)
{
//购买弹框
PanelCtrl
.
instance
.
show
(
"Buy2"
,
{})
}
else
{
}
}
onTap_stepBtn
(){
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
onTap_stepBtn
()
{
NetManager
.
ins
.
showLog
(
getlogItem
(
13
));
if
(
this
.
stepBtnNum
.
count
<=
0
)
{
//购买弹框
PanelCtrl
.
instance
.
show
(
"Buy3"
,
{})
}
else
{
//再写
NetManager
.
ins
.
hc_useProp
((
s
)
=>
{
if
(
s
){
}
},
PropType
.
CHANCE_NUM
)
}
}
mouseDownE
(
e
:
egret
.
TextEvent
)
{
...
...
@@ -612,7 +672,7 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
ele
.
index
);
this
.
lollipopCount
--
;
//通关目标还有棒棒糖,并且,图中已为0,下次需要生成
if
(
this
.
passElements
[
ElementType
.
LOLLIPOP
]
&&
this
.
lollipopCount
<=
0
)
{
if
(
this
.
passElements
&&
this
.
passElements
[
ElementType
.
LOLLIPOP
]
&&
this
.
lollipopCount
<=
0
)
{
this
.
lollipopCount
=
0
;
this
.
lollipopMark
=
true
}
...
...
@@ -838,7 +898,7 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
index
);
this
.
lollipopCount
--
;
//通关目标还有棒棒糖,并且,图中已为0,下次需要生成
if
(
this
.
passElements
[
ElementType
.
LOLLIPOP
]
&&
this
.
lollipopCount
<=
0
)
{
if
(
this
.
passElements
&&
this
.
passElements
[
ElementType
.
LOLLIPOP
]
&&
this
.
lollipopCount
<=
0
)
{
this
.
lollipopCount
=
0
;
this
.
lollipopMark
=
true
}
...
...
egret/src/something/Chapters.ts
View file @
708a3fd5
...
...
@@ -38,27 +38,27 @@ export const Chapters: ChapterData[] = [
baseElementTypes
:
[
0
,
1
,
2
,
3
],
effectInitProbability
:
0.15
,
stepCount
:
30
,
// passTarget: {
// type: PassType.SCORE_TARGET,
// score: 10000000,
// },
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
// {
// type: ElementType.ICE,
// count: 100,
// },
{
type
:
ElementType
.
RABBIT
,
count
:
56
,
},
{
type
:
ElementType
.
LOLLIPOP
,
count
:
2
,
}
],
type
:
PassType
.
SCORE_TARGET
,
score
:
10000
,
},
// passTarget: {
// type: PassType.ELEMENT_TARGET,
// elements: [
// // {
// // type: ElementType.ICE,
// // count: 100,
// // },
// {
// type: ElementType.RABBIT,
// count: 56,
// },
// {
// type: ElementType.LOLLIPOP,
// count: 2,
// }
// ],
// },
starScores
:
[
3000
,
5000
,
10000
]
}
]
\ No newline at end of file
egret/src/something/uis/PropNumShow.ts
0 → 100644
View file @
708a3fd5
import
{
PropNumber
}
from
"./PropNumber"
;
/**
* 道具显示数字
*/
export
class
PropNumShow
extends
egret
.
DisplayObjectContainer
{
/**
* 灰度滤镜
*/
private
colorFlilter
;
/**
* 数量文案
*/
private
countNum
:
PropNumber
;
/**
* 数量
*/
private
_count
:
number
;
get
count
():
number
{
return
this
.
_count
;
}
set
count
(
value
:
number
)
{
if
(
value
<=
0
)
{
value
=
0
;
//变灰
this
.
filters
=
[
this
.
colorFlilter
];
}
else
{
this
.
filters
=
[];
}
this
.
_count
=
value
;
this
.
countNum
.
num
=
value
;
}
constructor
()
{
super
();
//滤镜
var
colorMatrix
=
[
0.3
,
0.6
,
0
,
0
,
0
,
0.3
,
0.6
,
0
,
0
,
0
,
0.3
,
0.6
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
];
this
.
colorFlilter
=
new
egret
.
ColorMatrixFilter
(
colorMatrix
);
//背景
var
bg
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"propNumBg_png"
))
this
.
addChild
(
bg
)
//数字
this
.
countNum
=
new
PropNumber
();
this
.
countNum
.
x
=
26
;
this
.
countNum
.
y
=
9
;
this
.
addChild
(
this
.
countNum
);
}
}
\ No newline at end of file
egret/src/something/uis/PropNumber.ts
0 → 100644
View file @
708a3fd5
import
{
BitmapNumber
}
from
"../class/BitmapNumber"
;
import
{
Tool
}
from
"../Tool"
;
/**
* 道具数量,两位
*/
export
class
PropNumber
extends
egret
.
DisplayObjectContainer
{
/**
* 数字,最大99
*/
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
);
if
(
arr
.
length
>
2
)
arr
=
[
9
,
9
];
this
.
ones
.
num
=
arr
[
0
];
if
(
arr
[
1
])
{
this
.
tens
.
visible
=
true
;
this
.
tens
.
num
=
arr
[
1
];
}
else
{
this
.
tens
.
visible
=
false
;
}
//居中适配
this
.
center
()
}
/**
* 个位
*/
private
ones
:
BitmapNumber
;
/**
* 十位
*/
private
tens
:
BitmapNumber
;
constructor
()
{
super
();
this
.
ones
=
new
BitmapNumber
(
"propNum"
);
this
.
tens
=
new
BitmapNumber
(
"propNum"
);
this
.
addChild
(
this
.
ones
)
this
.
addChild
(
this
.
tens
)
this
.
num
=
0
;
}
/**
* 居中位置
*/
center
()
{
if
(
this
.
tens
.
visible
)
{
this
.
ones
.
x
=
0
;
this
.
tens
.
x
=
-
this
.
tens
.
texture
.
textureWidth
;
}
else
{
this
.
ones
.
x
=
-
this
.
ones
.
texture
.
textureWidth
/
2
}
}
}
\ No newline at end of file
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