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
e6325262
Commit
e6325262
authored
Aug 21, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
26dc3c0c
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
298 additions
and
80 deletions
+298
-80
MainBase.ts
egret/libs/new_wx/MainBase.ts
+6
-1
guideBg.png
egret/resource/assets/mainScene/guideBg.png
+0
-0
guideKnowBtn.png
egret/resource/assets/mainScene/guideKnowBtn.png
+0
-0
guideTxt1.png
egret/resource/assets/mainScene/guideTxt1.png
+0
-0
guideTxt2.png
egret/resource/assets/mainScene/guideTxt2.png
+0
-0
guideTxt3.png
egret/resource/assets/mainScene/guideTxt3.png
+0
-0
guideTxt4.png
egret/resource/assets/mainScene/guideTxt4.png
+0
-0
guideTxt5.png
egret/resource/assets/mainScene/guideTxt5.png
+0
-0
guide1.svga
egret/resource/assets/svgas/guide1.svga
+0
-0
guide2.svga
egret/resource/assets/svgas/guide2.svga
+0
-0
guide3.svga
egret/resource/assets/svgas/guide3.svga
+0
-0
guide4.svga
egret/resource/assets/svgas/guide4.svga
+0
-0
guide5.svga
egret/resource/assets/svgas/guide5.svga
+0
-0
default.res.json
egret/resource/default.res.json
+42
-7
MainScene.ts
egret/src/mainScene/MainScene.ts
+118
-71
Tool.ts
egret/src/something/Tool.ts
+25
-1
GuideMsg.ts
egret/src/something/uis/GuideMsg.ts
+107
-0
No files found.
egret/libs/new_wx/MainBase.ts
View file @
e6325262
...
...
@@ -156,7 +156,12 @@ export default class MainBase extends eui.UILayer {
for
(
var
i
=
0
;
i
<=
9
;
i
++
)
{
RES
.
getResAsync
(
"targetNumber"
+
i
+
"_png"
)
}
for
(
var
i
=
1
;
i
<=
5
;
i
++
)
{
RES
.
getResAsync
(
"guideTxt"
+
i
+
"_png"
)
}
var
arr
=
[
"guideBg"
,
"guideKnowBtn"
,
"bonusShoot"
,
"ele5"
,
"ele6"
,
...
...
egret/resource/assets/mainScene/guideBg.png
0 → 100644
View file @
e6325262
44.8 KB
egret/resource/assets/mainScene/guideKnowBtn.png
0 → 100644
View file @
e6325262
15 KB
egret/resource/assets/mainScene/guideTxt1.png
0 → 100644
View file @
e6325262
9.6 KB
egret/resource/assets/mainScene/guideTxt2.png
0 → 100644
View file @
e6325262
19.5 KB
egret/resource/assets/mainScene/guideTxt3.png
0 → 100644
View file @
e6325262
23.2 KB
egret/resource/assets/mainScene/guideTxt4.png
0 → 100644
View file @
e6325262
23.3 KB
egret/resource/assets/mainScene/guideTxt5.png
0 → 100644
View file @
e6325262
7.14 KB
egret/resource/assets/svgas/guide1.svga
0 → 100644
View file @
e6325262
File added
egret/resource/assets/svgas/guide2.svga
0 → 100644
View file @
e6325262
File added
egret/resource/assets/svgas/guide3.svga
0 → 100644
View file @
e6325262
File added
egret/resource/assets/svgas/guide4.svga
0 → 100644
View file @
e6325262
File added
egret/resource/assets/svgas/guide5.svga
0 → 100644
View file @
e6325262
File added
egret/resource/default.res.json
View file @
e6325262
...
...
@@ -57,12 +57,12 @@
"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"
,
"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
"
,
"name"
:
"mainScene"
},
{
"
name"
:
"preload
"
,
"
keys"
:
"showoff_jpg,share2_jpg
"
"
keys"
:
"showoff_jpg,share2_jpg
"
,
"
name"
:
"preload
"
}
],
"resources"
:
[
...
...
@@ -1312,14 +1312,49 @@
"name"
:
"bonusShoot_png"
},
{
"
name"
:
"share2_
jpg"
,
"
url"
:
"assets/share2.
jpg"
,
"type"
:
"image"
,
"
url"
:
"assets/share2.
jpg"
"
name"
:
"share2_
jpg"
},
{
"
name"
:
"showoff_
jpg"
,
"
url"
:
"assets/showoff.
jpg"
,
"type"
:
"image"
,
"url"
:
"assets/showoff.jpg"
"name"
:
"showoff_jpg"
},
{
"url"
:
"assets/mainScene/guideTxt5.png"
,
"type"
:
"image"
,
"name"
:
"guideTxt5_png"
},
{
"url"
:
"assets/mainScene/guideBg.png"
,
"type"
:
"image"
,
"name"
:
"guideBg_png"
},
{
"url"
:
"assets/mainScene/guideKnowBtn.png"
,
"type"
:
"image"
,
"name"
:
"guideKnowBtn_png"
},
{
"url"
:
"assets/mainScene/guideTxt1.png"
,
"type"
:
"image"
,
"name"
:
"guideTxt1_png"
},
{
"url"
:
"assets/mainScene/guideTxt2.png"
,
"type"
:
"image"
,
"name"
:
"guideTxt2_png"
},
{
"url"
:
"assets/mainScene/guideTxt3.png"
,
"type"
:
"image"
,
"name"
:
"guideTxt3_png"
},
{
"url"
:
"assets/mainScene/guideTxt4.png"
,
"type"
:
"image"
,
"name"
:
"guideTxt4_png"
}
]
}
\ No newline at end of file
egret/src/mainScene/MainScene.ts
View file @
e6325262
...
...
@@ -40,6 +40,9 @@ import { ElementTargets } from '../something/uis/ElementTargets';
import
{
Chapters
}
from
'../something/Chapters'
;
import
{
FlyTargetAni
}
from
'../something/anis/FlyTargetAni'
;
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 BridgeFactory from "../../libs/JSBridge/bridge/BridgeFactory";
const
aniClass
=
{
...
...
@@ -116,6 +119,7 @@ export default class MainScene extends Scene {
lollipopCount
:
number
=
0
;
//是否已通关
hasPassed
:
boolean
=
false
;
isCountingTime
:
boolean
=
false
;
//通关的目标元素的计数,下标和元素类型索引一致
passElements
:
number
[];
elementTargets
:
ElementTargets
;
...
...
@@ -189,6 +193,9 @@ export default class MainScene extends Scene {
//先禁掉事件
this
.
enableMouseEvt
(
false
);
// this.initBuired()
NetManager
.
ins
.
showLog
(
getlogItem
(
7
))
NetManager
.
ins
.
showLog
(
getlogItem
(
10
))
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
//步数初始化
this
.
steps
=
this
.
chapterData
.
stepCount
;
...
...
@@ -213,34 +220,21 @@ export default class MainScene extends Scene {
this
.
targetScoreTxt
.
visible
=
true
;
this
.
targetScoreTxt
.
text
=
"目标分数:"
+
this
.
chapterData
.
passTarget
.
score
;
}
//背景图生成
// var bg = drawBg(this.chapterData.map.paths, this.chapterData.map.lattices)
var
bg
=
drawBg
(
generateMapBg
(
this
.
chapterData
.
map
.
lattices
),
this
.
chapterData
.
map
.
lattices
)
this
.
addChild
(
bg
);
this
.
map
=
bg
;
//选择框
var
textureChoosed
:
egret
.
Texture
=
RES
.
getRes
(
"chooseRect_png"
)
this
.
choosed
=
new
eui
.
Image
(
textureChoosed
);
this
.
choosed
.
x
=
-
textureChoosed
.
textureWidth
/
2
;
this
.
choosed
.
y
=
-
textureChoosed
.
textureHeight
/
2
;
//容器
this
.
elementContainer
=
new
egret
.
DisplayObjectContainer
();
this
.
addChild
(
this
.
elementContainer
);
//加遮罩
var
mask
=
new
egret
.
Shape
();
mask
.
graphics
.
beginFill
(
0xffffff
,
1
);
mask
.
graphics
.
drawRect
(
Tool
.
offsetX
,
Tool
.
offsetY
,
Tool
.
width
*
Tool
.
colNum
,
Tool
.
height
*
Tool
.
rowNum
+
100
);
mask
.
graphics
.
endFill
();
this
.
elementContainer
.
mask
=
mask
;
this
.
addChild
(
mask
)
//容器事件
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
mouseDownE
,
this
);
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_MOVE
,
this
.
mouseMoveE
,
this
);
//初始化格子
this
.
initLattices
();
//设置栏置顶
this
.
addChild
(
this
[
"settingAll"
])
//引导提示
if
(
chapter
<=
5
)
{
Loading
.
instace
.
show
()
let
g
=
new
GuideMsg
();
g
.
init
(
chapter
,
()
=>
{
Loading
.
instace
.
hide
()
this
.
addChild
(
g
)
})
}
//开启事件,具体不应该放在这里,到时看
this
.
enableMouseEvt
(
true
);
}
...
...
@@ -264,7 +258,7 @@ export default class MainScene extends Scene {
},
this
)
this
.
movieClips
[
svgas
[
i
]]
=
mv
;
},
function
(
error
)
{
alert
(
error
.
message
);
//
alert(error.message);
})
}
}
...
...
@@ -277,10 +271,42 @@ export default class MainScene extends Scene {
this
.
addChild
(
this
.
stepNumber
);
//分数进度条
this
.
scoreProgress
=
new
ScoreProgress
(
this
.
starProgress
,
this
.
scoreTxt
,
this
.
chapterData
.
starScores
);
//背景图生成
// var bg = drawBg(this.chapterData.map.paths, this.chapterData.map.lattices)
var
bg
=
drawBg
(
generateMapBg
(
this
.
chapterData
.
map
.
lattices
),
this
.
chapterData
.
map
.
lattices
)
this
.
addChild
(
bg
);
this
.
map
=
bg
;
//选择框
var
textureChoosed
:
egret
.
Texture
=
RES
.
getRes
(
"chooseRect_png"
)
this
.
choosed
=
new
eui
.
Image
(
textureChoosed
);
this
.
choosed
.
x
=
-
textureChoosed
.
textureWidth
/
2
;
this
.
choosed
.
y
=
-
textureChoosed
.
textureHeight
/
2
;
//容器
this
.
elementContainer
=
new
egret
.
DisplayObjectContainer
();
this
.
addChild
(
this
.
elementContainer
);
//加遮罩
var
mask
=
new
egret
.
Shape
();
mask
.
graphics
.
beginFill
(
0xffffff
,
1
);
mask
.
graphics
.
drawRect
(
Tool
.
offsetX
,
Tool
.
offsetY
,
Tool
.
width
*
Tool
.
colNum
,
Tool
.
height
*
Tool
.
rowNum
+
100
);
mask
.
graphics
.
endFill
();
this
.
elementContainer
.
mask
=
mask
;
this
.
addChild
(
mask
)
//容器事件
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
{
this
.
soundBtn
.
source
=
"mainSoundBtnOff_png"
}
if
(
getBgOn
())
{
this
.
musicBtn
.
source
=
"mainSoundBtnOn_png"
}
else
{
this
.
musicBtn
.
source
=
"mainSoundBtnOff_png"
}
//初始化格子,包括冰块
}
//初始化格子
initLattices
()
{
var
latticesD
=
this
.
chapterData
.
map
.
lattices
;
var
generateLats
=
this
.
chapterData
.
map
.
generateLats
;
...
...
@@ -442,7 +468,7 @@ export default class MainScene extends Scene {
this
.
quitBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_quitBtn
,
this
)
}
onEnterFrame
()
{
if
(
this
.
touchEnabled
)
{
if
(
this
.
enableTouch
)
{
this
.
noActionCount
++
;
}
else
{
this
.
noActionCount
=
0
;
...
...
@@ -492,23 +518,32 @@ export default class MainScene extends Scene {
}
onTap_soundBtnn
()
{
toggleSound
()
if
(
getSoundOn
())
{
this
.
soundBtn
.
source
=
"mainSoundBtnOn_png"
}
else
{
this
.
soundBtn
.
source
=
"mainSoundBtnOff_png"
if
(
getSoundOn
())
{
this
.
soundBtn
.
source
=
"mainSoundBtnOn_png"
}
else
{
this
.
soundBtn
.
source
=
"mainSoundBtnOff_png"
}
}
onTap_musicBtn
()
{
toggleBg
();
if
(
getBgOn
())
{
this
.
musicBtn
.
source
=
"mainMusicBtnOn_png"
}
else
{
this
.
musicBtn
.
source
=
"mainMusicBtnOff_png"
if
(
getBgOn
())
{
this
.
musicBtn
.
source
=
"mainMusicBtnOn_png"
}
else
{
this
.
musicBtn
.
source
=
"mainMusicBtnOff_png"
}
}
onTap_quitBtn
()
{
PanelCtrl
.
instance
.
show
(
"quit"
);
}
onTap_boomBtn
(){
NetManager
.
ins
.
showLog
(
getlogItem
(
7
))
}
onTap_hammerBtn
(){
NetManager
.
ins
.
showLog
(
getlogItem
(
10
))
}
onTap_stepBtn
(){
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
}
mouseDownE
(
e
:
egret
.
TextEvent
)
{
// if (!this.enableTouch) return
...
...
@@ -1213,9 +1248,7 @@ export default class MainScene extends Scene {
var
latC
=
lattices
[
cur
];
if
(
Tool
.
judgeMatch
(
latP
)
&&
Tool
.
judgeMatch
(
latC
)
&&
latP
.
element
.
type
==
latC
.
element
.
type
&&
latP
.
element
.
effectType
!=
EffectType
.
MAGICLION
&&
latC
.
element
.
effectType
!=
EffectType
.
MAGICLION
)
{
latP
.
element
.
type
==
latC
.
element
.
type
)
{
result
[
i
].
push
(
cur
)
}
else
{
result
[
++
i
]
=
[
cur
];
...
...
@@ -1265,23 +1298,14 @@ export default class MainScene extends Scene {
if
(
this
.
threeMatch
())
{
this
.
eliminate
()
}
else
{
//出累计一步分数的toast;
this
.
oneStepScoreToast
();
//连消置0
this
.
commonContinuityTimes
=
0
;
this
.
effectContinuityTimes
=
0
;
//判断是否已达目标
this
.
hasPassed
=
this
.
judgePass
();
console
.
log
(
this
.
hasPassed
)
//如果早已通关,正在结算
if
(
this
.
hasPassed
)
{
if
(
this
.
steps
>
0
)
{
//连消倍数为1
this
.
commonContinuityTimes
=
1
;
this
.
effectContinuityTimes
=
1
;
//先出toast bonusTime,播完后
//bonustime,toast,把所有有特效的消除先
this
.
terminateSteps
()
}
else
{
//如果原先特效还有,
if
(
!
this
.
isCountingTime
)
{
this
.
terminateSteps
();
}
//如果只有步数转化的,不能再进结算,
else
{
//通关了
//提交分数等
var
json
=
this
.
getSubmitJson
()
...
...
@@ -1292,10 +1316,28 @@ export default class MainScene extends Scene {
}
return
}
//判断是否已达目标
this
.
hasPassed
=
this
.
judgePass
();
console
.
log
(
this
.
hasPassed
)
if
(
this
.
hasPassed
)
{
//连消基数为1
this
.
commonContinuityTimes
=
1
;
this
.
effectContinuityTimes
=
1
;
showToast
(
"bonus times"
)
setTimeout
(()
=>
{
this
.
terminateSteps
();
},
1300
)
return
}
//出累计一步分数的toast;
this
.
oneStepScoreToast
();
//连消置0
this
.
commonContinuityTimes
=
0
;
this
.
effectContinuityTimes
=
0
;
//先判断步数是否为0;
if
(
this
.
steps
==
0
)
{
//判断是否有加步数的道具,有则提示是否加(加完判断死图),没有则直接结束
//失败弹框
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
);
...
...
@@ -1345,7 +1387,7 @@ export default class MainScene extends Scene {
//把所有元素加入
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judge
Match
(
lat
))
{
if
(
Tool
.
judge
Eliminate
(
lat
))
{
this
.
eliminatedElements
.
push
(
i
);
//5倍
if
(
!
lat
.
element
.
isLock
/*&&lat.element.effectType==null*/
)
{
...
...
@@ -1382,8 +1424,7 @@ export default class MainScene extends Scene {
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judgeMatch
(
lat
)
&&
lat
.
element
.
type
==
other
.
type
&&
lat
.
element
.
effectType
!=
EffectType
.
MAGICLION
)
{
lat
.
element
.
type
==
other
.
type
)
{
this
.
eliminatedElements
.
push
(
i
);
//如果other带特效,符合的元素都加上特效,没动效,直接加吧先,
if
(
other
.
effectType
!=
null
)
{
...
...
@@ -1418,7 +1459,7 @@ export default class MainScene extends Scene {
//添加消除元素two,同行或同列
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judge
Match
(
lat
)
&&
(
lat
.
row
==
lat1
.
row
||
lat
.
column
==
lat1
.
column
))
{
if
(
Tool
.
judge
Eliminate
(
lat
)
&&
(
lat
.
row
==
lat1
.
row
||
lat
.
column
==
lat1
.
column
))
{
this
.
eliminatedElements
.
push
(
i
);
if
(
!
lat
.
element
.
isLock
)
{
//3倍
...
...
@@ -1441,7 +1482,7 @@ export default class MainScene extends Scene {
//添加消除元素two,同行或同列,需要优化
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judge
Match
(
lat
)
&&
if
(
Tool
.
judge
Eliminate
(
lat
)
&&
(
Math
.
abs
(
lat
.
row
-
lat1
.
row
)
<
2
||
Math
.
abs
(
lat
.
column
-
lat1
.
column
)
<
2
))
{
this
.
eliminatedElements
.
push
(
i
);
if
(
!
lat
.
element
.
isLock
)
{
...
...
@@ -1466,7 +1507,7 @@ export default class MainScene extends Scene {
//添加消除元素two,5*5,需要优化
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judge
Match
(
lat
)
&&
if
(
Tool
.
judge
Eliminate
(
lat
)
&&
(
Math
.
abs
(
lat
.
row
-
lat1
.
row
)
<
3
&&
Math
.
abs
(
lat
.
column
-
lat1
.
column
)
<
3
))
{
this
.
eliminatedElements
.
push
(
i
);
if
(
!
lat
.
element
.
isLock
)
{
...
...
@@ -1569,8 +1610,7 @@ export default class MainScene extends Scene {
//对于魔力鸟的效果有不一样的,旋转,该组元素要旋转消除
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
if
(
Tool
.
judgeMatch
(
this
.
lattices
[
i
])
&&
this
.
lattices
[
i
].
element
.
type
==
type
&&
this
.
lattices
[
i
].
element
.
effectType
!=
EffectType
.
MAGICLION
)
{
this
.
lattices
[
i
].
element
.
type
==
type
)
{
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
<
0
&&
effectIndexs
.
indexOf
(
i
)
<
0
)
{
this
.
eliminatedElements
.
push
(
i
);
//无特效未枷锁
...
...
@@ -1593,7 +1633,7 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
index
);
//3*3,需要优化
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
if
(
Tool
.
judge
Match
(
this
.
lattices
[
i
])
&&
if
(
Tool
.
judge
Eliminate
(
this
.
lattices
[
i
])
&&
(
Math
.
abs
(
this
.
lattices
[
i
].
row
-
lat
.
row
)
<
2
&&
Math
.
abs
(
this
.
lattices
[
i
].
column
-
lat
.
column
)
<
2
))
{
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
<
0
&&
effectIndexs
.
indexOf
(
i
)
<
0
)
{
this
.
eliminatedElements
.
push
(
i
);
...
...
@@ -1613,7 +1653,7 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
index
);
for
(
var
i
=
0
;
i
<
Tool
.
colNum
;
i
++
)
{
var
ein
=
Tool
.
rcToIndex
(
row
,
i
);
if
(
Tool
.
judge
Match
(
this
.
lattices
[
ein
]))
{
if
(
Tool
.
judge
Eliminate
(
this
.
lattices
[
ein
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
this
.
eliminatedElements
.
push
(
ein
);
//1.5倍
...
...
@@ -1632,7 +1672,7 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
index
);
for
(
var
i
=
0
;
i
<
Tool
.
rowNum
;
i
++
)
{
var
ein
=
Tool
.
rcToIndex
(
i
,
col
);
if
(
Tool
.
judge
Match
(
this
.
lattices
[
ein
]))
{
if
(
Tool
.
judge
Eliminate
(
this
.
lattices
[
ein
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
this
.
eliminatedElements
.
push
(
ein
);
//1.5倍
...
...
@@ -1676,7 +1716,7 @@ export default class MainScene extends Scene {
var
effectElements
=
[],
elements
=
[];
for
(
var
i
=
Tool
.
colNum
*
Tool
.
rowNum
-
1
;
i
>=
0
;
i
--
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
!
Tool
.
judge
Match
(
lat
))
continue
if
(
!
Tool
.
judge
Eliminate
(
lat
))
continue
if
(
lat
.
element
.
effectType
!=
null
)
{
effectElements
.
push
(
i
);
}
else
{
...
...
@@ -1689,8 +1729,7 @@ export default class MainScene extends Scene {
this
.
eliminate
();
}
else
{
//分数
this
.
score
+=
this
.
steps
*
500
;
this
.
isCountingTime
=
true
;
let
countAll
=
Math
.
min
(
this
.
steps
,
elements
.
length
);
let
count
=
0
;
let
deltaCount
=
0
;
...
...
@@ -1706,6 +1745,8 @@ export default class MainScene extends Scene {
}
setTimeout
(()
=>
{
this
.
steps
--
;
//分数
this
.
score
+=
500
;
this
.
addChild
(
bonusShootAni
);
//算角度
var
r
=
Tool
.
getForwardRotation
(
stepPosition
,
[
ele
.
x
,
ele
.
y
])
...
...
@@ -1982,8 +2023,14 @@ export default class MainScene extends Scene {
* @param b
*/
enableMouseEvt
(
b
:
boolean
)
{
this
.
touchEnabled
=
b
;
this
.
touchChildren
=
b
;
// this.touchEnabled = b;
// this.touchChildren = b;
var
arr
=
[
this
.
elementContainer
,
this
.
boomBtn
,
this
.
hammerBtn
,
this
.
stepBtn
]
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
arr
[
i
].
touchEnabled
=
b
;
arr
[
i
].
touchChildren
=
b
;
}
this
.
enableTouch
=
b
;
}
...
...
egret/src/something/Tool.ts
View file @
e6325262
...
...
@@ -3,6 +3,7 @@ import { Element } from "./class/Element";
import
{
Lattice
}
from
"./class/Lattice"
;
import
{
ElementType
}
from
"./enum/ElementType"
;
import
{
PassType
}
from
"./enum/PassType"
;
import
{
EffectType
}
from
"./enum/EffectType"
;
export
class
Tool
{
public
static
rowNum
=
9
;
...
...
@@ -156,10 +157,33 @@ export class Tool {
}
/**
* 判断格子是否可进行匹配
* 判断格子是否可进行匹配,
* 不包括魔力鸟,
* 包括笼子里的
* @param lat
*/
public
static
judgeMatch
(
lat
:
Lattice
)
{
//上方格子为null,或格子上元素为null
if
(
!
lat
||
!
lat
.
element
)
{
return
false
}
//上方元素为石头,或为冰淇淋,或为魔力鸟
else
if
(
lat
.
element
.
type
==
ElementType
.
ROCK
||
lat
.
element
.
type
==
ElementType
.
LOLLIPOP
||
lat
.
element
.
effectType
==
EffectType
.
MAGICLION
)
{
return
false
}
//剩下情况
else
{
return
true
}
}
/**
* 判断能执行消除的元素,
* 包括所有特效和基本元素
* @param lat
*/
public
static
judgeEliminate
(
lat
:
Lattice
)
{
//上方格子为null,或格子上元素为null
if
(
!
lat
||
!
lat
.
element
)
{
return
false
...
...
egret/src/something/uis/GuideMsg.ts
0 → 100644
View file @
e6325262
import
getResPath
from
"../../../libs/new_tc/getResPath"
;
const
moiveClip
=
{};
const
resPath
=
getResPath
()
const
parser
=
new
window
[
"SVGA"
].
Parser
();
/**
* 引导
*/
export
class
GuideMsg
extends
egret
.
DisplayObjectContainer
{
bg
:
egret
.
Bitmap
;
knowBtn
:
egret
.
Bitmap
;
closeBtn
:
egret
.
Bitmap
;
msgTxt
:
egret
.
Bitmap
;
moiveClip
;
/**
* closeCommonBtn_png
* @param num 1到5的引导
*/
constructor
()
{
super
()
var
shape
:
egret
.
Shape
=
new
egret
.
Shape
();
shape
.
graphics
.
beginFill
(
0x000000
,
0.7
);
shape
.
graphics
.
drawRect
(
0
,
0
,
750
,
1624
);
shape
.
graphics
.
endFill
();
this
.
addChild
(
shape
);
//背景图
this
.
bg
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guideBg_png"
));
this
.
bg
.
x
=
(
750
-
639
)
/
2
;
this
.
bg
.
y
=
300
;
this
.
addChild
(
this
.
bg
);
//关闭按钮
this
.
closeBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"closeCommonBtn_png"
));
this
.
closeBtn
.
x
=
615
;
this
.
closeBtn
.
y
=
300
;
this
.
closeBtn
.
touchEnabled
=
true
;
this
.
addChild
(
this
.
closeBtn
);
this
.
closeBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
},
this
)
//知道了
this
.
knowBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guideKnowBtn_png"
));
this
.
knowBtn
.
x
=
(
750
-
266
)
/
2
;
this
.
knowBtn
.
y
=
800
;
this
.
knowBtn
.
touchEnabled
=
true
;
this
.
addChild
(
this
.
knowBtn
);
this
.
knowBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
},
this
)
}
/**
*
* @param num
* @param callback 里面是移除转圈,加进场景
*/
init
(
num
:
number
,
callback
:
Function
)
{
//移除原先的svga
if
(
this
.
moiveClip
)
this
.
removeChild
(
this
.
moiveClip
);
//svga
if
(
moiveClip
[
"guide"
+
num
])
{
this
.
addChild
(
moiveClip
[
"guide"
+
num
]);
callback
();
}
else
{
parser
.
load
(
resPath
+
'resource/assets/svgas/'
+
'guide'
+
num
+
'.svga'
,
(
videoItem
)
=>
{
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
mv
.
x
=
3
;
mv
.
y
=
-
263
;
this
.
moiveClip
=
mv
;
this
.
addChild
(
mv
);
moiveClip
[
"guide"
+
num
]
=
mv
;
callback
();
},
function
(
error
)
{
// alert(error.message);
})
}
this
.
initTxt
(
num
)
}
//调位置
private
initTxt
(
num
:
number
)
{
if
(
!
this
.
msgTxt
)
{
this
.
msgTxt
=
new
egret
.
Bitmap
();
this
.
addChild
(
this
.
msgTxt
);
}
let
y
:
number
;
switch
(
num
)
{
case
1
:
y
=
705
;
break
;
case
2
:
y
=
685
;
break
;
case
3
:
y
=
685
;
break
;
case
4
:
y
=
685
;
break
;
case
5
:
y
=
705
;
break
;
}
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"guideTxt"
+
num
+
"_png"
);
this
.
msgTxt
.
texture
=
texture
;
this
.
msgTxt
.
x
=
(
750
-
texture
.
textureWidth
)
/
2
;
this
.
msgTxt
.
y
=
y
;
}
}
\ 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