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
241e286d
Commit
241e286d
authored
Apr 17, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
黑洞转移前,将本次操作的导致的元素状态变化先变了
parent
7e80f0bf
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
346 additions
and
159 deletions
+346
-159
MainScene.ts
egret/src/mainScene/MainScene.ts
+317
-142
Tool.ts
egret/src/something/Tool.ts
+1
-1
IceAni.ts
egret/src/something/anis/IceAni.ts
+8
-4
RockAni.ts
egret/src/something/anis/RockAni.ts
+8
-4
Chapter25.ts
egret/src/something/chapters/Chapter25.ts
+5
-5
AiControl.ts
egret/src/something/logic/AiControl.ts
+7
-3
No files found.
egret/src/mainScene/MainScene.ts
View file @
241e286d
...
...
@@ -189,9 +189,30 @@ for(let i = 1; i < 999; i++) { /// TODO 测试
const
festivalIndex
:
number
=
40
;
export
default
class
MainScene
extends
Scene
{
private
_converyorTag
;
private
_wormholeTag
;
// private _converyorTag;
// private _wormholeTag;
//一次操作仅影响一次
private
_checkMtag
:{
coveryor
:
boolean
,
//传送带
sand
:
boolean
,
//流沙
block
:
boolean
,
//石门
candy
:
boolean
,
//糖果
jelly
:
boolean
,
//果冻怪物
hairball
:
boolean
,
//毛球
jellymo
:
boolean
,
//果冻
bubble
:
boolean
,
//气泡
wormhole
:
boolean
,
//黑洞转移
}
=
{
coveryor
:
false
,
sand
:
false
,
block
:
false
,
candy
:
false
,
jelly
:
false
,
hairball
:
false
,
jellymo
:
false
,
bubble
:
false
,
wormhole
:
false
,
};
get
skinKey
()
{
return
'Main2'
}
...
...
@@ -1744,8 +1765,7 @@ export default class MainScene extends Scene {
this
.
checkPongoHVEle
(
rc
[
0
],
rc
[
1
],
"vir"
);
setTimeout
(()
=>
{
this
.
_converyorTag
=
true
;
this
.
_wormholeTag
=
true
;
this
.
initOneElmtTag
();
this
.
eliminate
(
pcannostatArr
);
},
200
)
break
;
...
...
@@ -1757,8 +1777,7 @@ export default class MainScene extends Scene {
Tool
.
getPositionByIndex
(
index
)
)
}
this
.
_converyorTag
=
true
;
this
.
_wormholeTag
=
true
;
this
.
initOneElmtTag
();
this
.
eliminate
();
break
;
case
PropType
.
CHANCE_NUM
:
...
...
@@ -1782,6 +1801,20 @@ export default class MainScene extends Scene {
}
},
prop
)
}
initOneElmtTag
(){
this
.
_checkMtag
=
{
coveryor
:
true
,
wormhole
:
true
,
sand
:
true
,
block
:
true
,
candy
:
true
,
jelly
:
true
,
hairball
:
true
,
jellymo
:
true
,
bubble
:
true
,
};
}
//横向消除,不包括炮台石头
getEliHorPassCannoStone
(
row
:
number
,
col
:
number
){
var
elimitarr
:
number
[]
=
new
Array
();
...
...
@@ -1857,8 +1890,7 @@ export default class MainScene extends Scene {
mouseDownE
(
e
:
egret
.
TextEvent
)
{
this
.
wormHolePromise
=
new
Array
();
// if (!this.enableTouch) return
this
.
_converyorTag
=
true
;
this
.
_wormholeTag
=
true
;
this
.
initOneElmtTag
();
var
self
=
this
;
if
(
e
.
target
.
parent
instanceof
Element
)
{
//去掉提示动画
...
...
@@ -1884,8 +1916,7 @@ export default class MainScene extends Scene {
mouseMoveE
(
e
)
{
this
.
wormHolePromise
=
new
Array
();
this
.
_converyorTag
=
true
;
this
.
_wormholeTag
=
true
;
this
.
initOneElmtTag
();
if
(
this
.
SELECTED
&&
e
.
target
.
parent
instanceof
Element
)
{
if
(
!
Tool
.
judgeChosen
(
e
.
target
.
parent
))
return
if
(
Tool
.
checkNeb
(
e
.
target
.
parent
,
this
.
SELECTED
))
{
...
...
@@ -2793,9 +2824,9 @@ export default class MainScene extends Scene {
// return;
// }
if
(
this
.
_converyorTag
)
{
if
(
this
.
_checkMtag
.
coveryor
)
{
this
.
_checkMtag
.
coveryor
=
false
;
await
doConveyorAI
(
this
);
this
.
_converyorTag
=
false
;
}
//棒棒糖消除
var
recoverlp1
=
this
.
checkEmtbbt
();
...
...
@@ -2806,46 +2837,14 @@ export default class MainScene extends Scene {
})
return
;
}
//黑洞转移
if
(
this
.
_wormholeTag
){
this
.
_wormholeTag
=
false
;
let
wormholes
=
this
.
chapterData
.
map
.
WORMHOLE
;
if
(
wormholes
&&
wormholes
.
length
>
0
){
await
Promise
.
all
(
this
.
wormHolePromise
).
then
(()
=>
{
// console.log("本次烟花播放完毕");
});
await
doWormHoleAI
(
this
);
// console.log("黑洞转移完毕");
//黑洞转移,使黑洞占位变空,需要添加到emptys中
for
(
var
_w
=
0
;
_w
<
this
.
lattices
.
length
;
_w
++
){
var
_wlattice
=
this
.
lattices
[
_w
];
if
(
_wlattice
&&!
_wlattice
.
element
&&
this
.
emptys
.
indexOf
(
_wlattice
.
index
)
==-
1
){
this
.
emptys
.
push
(
_wlattice
.
index
);
}
}
//棒棒糖消除
var
recoverlp2
=
this
.
checkEmtbbt
();
if
(
recoverlp2
>
0
){
// console.log("传送带棒棒糖消除");
// this.fall(()=>{
// this.fallCallback();
// })
// return;
}
this
.
fall
(()
=>
{
this
.
fallCallback
();
})
return
;
}
}
if
(
this
.
_checkMtag
.
sand
){
this
.
_checkMtag
.
sand
=
false
;
await
doSandAI
(
this
);
}
const
doHoneyPotAIResult
=
await
doHoneyPotAI
(
this
);
if
(
doHoneyPotAIResult
.
length
>
0
)
{
//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
doHoneyPotAIResult
.
forEach
((
index
)
=>
{
...
...
@@ -2872,19 +2871,25 @@ export default class MainScene extends Scene {
}
;
//消除结束之后检查石门
if
(
this
.
_checkMtag
.
block
){
this
.
_checkMtag
.
block
=
false
;
const
blockResult
=
await
this
.
checkAllBlock
();
if
(
blockResult
&&
blockResult
.
length
&&
blockResult
.
some
(
item
=>
item
))
{
// console.log('有至少一个门翻转过来了', blockResult);
this
.
eliminate
();
return
;
}
}
//检查糖果
if
(
this
.
_checkMtag
.
candy
){
this
.
_checkMtag
.
candy
=
false
;
const
candyResult
=
await
this
.
checkAllCandy
();
if
(
candyResult
)
{
//是不是有融化了的
this
.
eliminate
();
return
};
}
;
//果冻怪物
let
jellyMonsterAIResult
=
0
;
if
(
!
this
.
jellyBrokenMark
)
{
...
...
@@ -2900,11 +2905,41 @@ export default class MainScene extends Scene {
return
}
//鸡蛋的ai操作,存在判断三消,毛球的ai,也一样,所以放前面,存在三消时都直接执行eliminate了。不执行后续的回调
let
aiPromise
:
Promise
<
any
>
[]
=
new
Array
();
//鸡蛋每次都检测
let
eggpro
;
eggpro
=
new
Promise
((
resolve
,
reject
)
=>
{
AiControl
.
ins
.
eggMotion
(
this
,
()
=>
{
//后执行毛球跳动
resolve
();
})
});
if
(
eggpro
){
await
eggpro
;
}
//毛球移动每次操作,移动一次
let
hairpro
;
if
(
this
.
_checkMtag
.
hairball
){
this
.
_checkMtag
.
hairball
=
false
;
hairpro
=
new
Promise
((
resolve
,
reject
)
=>
{
AiControl
.
ins
.
hairballMotion
(
this
,
()
=>
{
//节日元素
resolve
();
})
});
}
if
(
hairpro
){
await
hairpro
;
}
//每次都检测
let
fespro
;
fespro
=
new
Promise
((
resolve
,
reject
)
=>
{
AiControl
.
ins
.
fesEleMotion
(
this
,
()
=>
{
resolve
();
})
})
if
(
fespro
){
await
fespro
;
}
//如果早已通关,正在结算
if
(
this
.
hasPassed
)
{
//如果原先特效还有,
...
...
@@ -2971,17 +3006,112 @@ export default class MainScene extends Scene {
//额外加一步ai果冻的操作,考虑和气泡一起改变,然后再执行检查死图
let
count
=
0
;
let
countAll
=
2
;
//和操作步数一致
if
(
this
.
_checkMtag
.
jellymo
){
this
.
_checkMtag
.
jellymo
=
false
;
//果冻的先执行,因为有元素类型的改变,会影响变色气泡的动画
AiControl
.
ins
.
jellyMotion
(
this
,
()
=>
{
if
(
++
count
===
countAll
)
this
.
aiMotionCheckDieMap
()
})
}
else
{
countAll
-=
1
;
}
//然后执行气泡
if
(
this
.
_checkMtag
.
bubble
){
this
.
_checkMtag
.
bubble
=
false
;
AiControl
.
ins
.
bubbleMotion
(
this
,
()
=>
{
if
(
++
count
===
countAll
)
this
.
aiMotionCheckDieMap
()
})
})
})
})
}
else
{
countAll
-=
1
;
}
if
(
countAll
==
0
){
this
.
aiMotionCheckDieMap
()
}
// AiControl.ins.eggMotion(this, () => {
// //后执行毛球跳动
// AiControl.ins.hairballMotion(this, () => {
// //节日元素
// AiControl.ins.fesEleMotion(this, () => {
// //如果早已通关,正在结算
// if(this.hasPassed) {
// //如果原先特效还有,
// if(!this.isCountingTime) {
// this.terminateSteps();
// }
// //如果只有步数转化的,不能再进结算,
// else {
// //通关了
// //提交分数等
// var json = this.getSubmitJson()
// this.submit(json)
// }
// return
// }
// //判断是否已达目标
// this.hasPassed = this.judgePass();
// //如果已达目标
// if(this.hasPassed) {
// //连消基数为1
// this.commonContinuityTimes = 1;
// this.effectContinuityTimes = 1;
// if(movieClips["bonusTime"]) {
// playSound(SoundType.bonusTime);
// let rect = new Rect(750, 1624, 0x000000);
// rect.alpha = 0.6;
// this.addChild(rect);
// this.addChild(movieClips["bonusTime"])
// movieClips["bonusTime"].gotoAndPlay(1, true)
// setTimeout(() => {
// this.terminateSteps();
// if(movieClips["bonusTime"].parent) {
// this.removeChild(movieClips["bonusTime"])
// }
// if(rect.parent){
// this.removeChild(rect);
// }
// }, 1930)
// } else {
// this.addChild(this.bonusTime);
// this.bonusTime.play(() => {
// this.removeChild(this.bonusTime)
// this.terminateSteps();
// })
// }
// return
// }
// //出累计一步分数的toast;
// this.oneStepScoreToast();
// //连消置0
// this.commonContinuityTimes = 0;
// this.effectContinuityTimes = 0;
// //判断步数是否为0;
// if(this.steps == 0) {
// //失败弹框
// // playSound(SoundType.fail);
// var panelsDatas = this.returnPanels("failed", {level: this.chapter})
// PanelCtrl.instance.showPanels(panelsDatas[0], panelsDatas[1], () => {
// });
// // PanelCtrl.instance.show("failed", { level: this.chapter });
// return
// }
// //果冻的时间980,气泡的时间1100,必须考虑直接执行的情况,所以必须同时判断
// //额外加一步ai果冻的操作,考虑和气泡一起改变,然后再执行检查死图
// let count = 0;
// let countAll = 2;//和操作步数一致
// //果冻的先执行,因为有元素类型的改变,会影响变色气泡的动画
// AiControl.ins.jellyMotion(this, () => {
// if(++count === countAll) this.aiMotionCheckDieMap()
// })
// //然后执行气泡
// AiControl.ins.bubbleMotion(this, () => {
// if(++count === countAll) this.aiMotionCheckDieMap()
// })
// })
// })
// })
}
//新增棒棒糖消除检测
...
...
@@ -3127,7 +3257,42 @@ export default class MainScene extends Scene {
/**
* 果冻蔓延和气泡变色需要重新检查死图
*/
aiMotionCheckDieMap
()
{
async
aiMotionCheckDieMap
()
{
//黑洞转移
if
(
this
.
_checkMtag
.
wormhole
){
this
.
_checkMtag
.
wormhole
=
false
;
let
wormholes
=
this
.
chapterData
.
map
.
WORMHOLE
;
if
(
wormholes
&&
wormholes
.
length
>
0
){
await
Promise
.
all
(
this
.
wormHolePromise
).
then
(()
=>
{
// console.log("本次烟花播放完毕");
});
await
doWormHoleAI
(
this
);
// console.log("黑洞转移完毕");
//黑洞转移,使黑洞占位变空,需要添加到emptys中
for
(
var
_w
=
0
;
_w
<
this
.
lattices
.
length
;
_w
++
){
var
_wlattice
=
this
.
lattices
[
_w
];
if
(
_wlattice
&&!
_wlattice
.
element
&&
this
.
emptys
.
indexOf
(
_wlattice
.
index
)
==-
1
){
this
.
emptys
.
push
(
_wlattice
.
index
);
}
}
//棒棒糖消除
var
recoverlp2
=
this
.
checkEmtbbt
();
if
(
recoverlp2
>
0
){
// console.log("传送带棒棒糖消除");
// this.fall(()=>{
// this.fallCallback();
// })
// return;
}
this
.
fall
(()
=>
{
this
.
fallCallback
();
})
return
;
}
}
//检查死图
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
...
...
@@ -4238,6 +4403,7 @@ export default class MainScene extends Scene {
}
ani
.
x
=
p
[
0
];
ani
.
y
=
p
[
1
];
ani
.
play
();
if
(
name
==
RecoverName
.
MAGICLION_ANI
)
{
//具体索引还要改
...
...
@@ -4268,7 +4434,10 @@ export default class MainScene extends Scene {
}
const
p
=
Tool
.
getPositionByIndex
(
lat
.
index
);
//动画
this
.
playAni
(
RecoverName
.
ICE_ANI
,
p
);
let
pro
=
this
.
playAni
(
RecoverName
.
ICE_ANI
,
p
);
if
(
Tool
.
judgeInWormHole
(
lat
.
index
,
this
.
chapterData
.
map
.
WORMHOLE
)){
this
.
wormHolePromise
.
push
(
pro
);
}
}
else
if
(
lat
.
block
&&
lat
.
block
.
ice
&&
lat
.
block
.
canIceBroken
)
{
//石门(可能带冰) && 石门反转了可以消除了
const
block
=
lat
.
block
;
block
.
iceCountNum
--
;
...
...
@@ -4281,7 +4450,10 @@ export default class MainScene extends Scene {
}
const
p
=
Tool
.
getPositionByIndex
(
lat
.
index
);
//动画
this
.
playAni
(
RecoverName
.
ICE_ANI
,
p
);
let
pro
=
this
.
playAni
(
RecoverName
.
ICE_ANI
,
p
);
if
(
Tool
.
judgeInWormHole
(
lat
.
index
,
this
.
chapterData
.
map
.
WORMHOLE
)){
this
.
wormHolePromise
.
push
(
pro
);
}
}
else
if
(
lat
.
sand
)
{
lat
.
sand
&&
lat
.
sand
.
parent
&&
lat
.
sand
.
parent
.
removeChild
(
lat
.
sand
);
this
.
goElementTarget
(
ElementType
.
SAND
,
[
lat
.
sand
.
x
,
lat
.
sand
.
y
]);
...
...
@@ -4824,7 +4996,10 @@ export default class MainScene extends Scene {
removeRock
(
index
:
number
)
{
this
.
removeOperation
(
index
);
//播放动效
this
.
playAni
(
RecoverName
.
ROCK_ANI
,
Tool
.
getPositionByIndex
(
index
))
let
pro
=
this
.
playAni
(
RecoverName
.
ROCK_ANI
,
Tool
.
getPositionByIndex
(
index
))
if
(
Tool
.
judgeInWormHole
(
index
,
this
.
chapterData
.
map
.
WORMHOLE
)){
this
.
wormHolePromise
.
push
(
pro
);
}
}
/**
* 炮台石头的动效
...
...
egret/src/something/Tool.ts
View file @
241e286d
...
...
@@ -1293,7 +1293,7 @@ export class Tool {
for
(
var
j
=
0
;
j
<
iworm
.
length
;
j
++
){
var
iwormidx
=
iworm
[
j
];
if
(
iwormidx
==
idx
){
console
.
log
(
"是在黑洞上"
)
// console.log("是在黑洞上");
_have
=
true
;
return
true
;
}
...
...
egret/src/something/anis/IceAni.ts
View file @
241e286d
...
...
@@ -17,10 +17,14 @@ export class IceAni extends Ani {
play
()
{
//重置图片
var
pro
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
showImage
.
currentFrame
=
0
;
this
.
showImage
.
source
=
this
.
showImage
.
sourceAll
[
0
];
this
.
showImage
.
play
(()
=>
{
this
.
recover
();
resolve
();
})
})
return
pro
;
}
}
\ No newline at end of file
egret/src/something/anis/RockAni.ts
View file @
241e286d
...
...
@@ -17,10 +17,14 @@ export class RockAni extends Ani {
play
()
{
//重置图片
let
pro
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
showImage
.
currentFrame
=
0
;
this
.
showImage
.
source
=
this
.
showImage
.
sourceAll
[
0
];
this
.
showImage
.
play
(()
=>
{
this
.
recover
();
resolve
();
})
})
return
pro
;
}
}
\ No newline at end of file
egret/src/something/chapters/Chapter25.ts
View file @
241e286d
...
...
@@ -12,13 +12,13 @@ export const Chapters25: ChapterData[] = [
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
6
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
7
,
1
,
7
,
1
,
1
,
1
,
1
,
1
,
1
,
7
,
1
,
7
,
1
,
1
,
1
,
1
,
6
,
1
,
7
,
1
,
7
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
7
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
],
...
...
@@ -52,14 +52,14 @@ export const Chapters25: ChapterData[] = [
// [ 72, 53 ]
// ],
elements
:
[
1
,
14
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
14
,
1
,
1
,
9
,
1
,
14
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
14
,
1
,
1
,
9
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
baseElements
:
[
...
...
egret/src/something/logic/AiControl.ts
View file @
241e286d
...
...
@@ -371,10 +371,14 @@ export class AiControl {
pieceToEggAni
=
new
PieceToEggAni
()
}
thisObj
.
addChild
(
pieceToEggAni
);
let
pro
=
new
Promise
((
resolve
,
reject
)
=>
{
pieceToEggAni
.
play
(
Tool
.
getPositionByIndex
(
activeEggIndex
),
()
=>
{
activeEgg
.
reset
();
activeEgg
.
visible
=
true
;
resolve
();
})
})
thisObj
.
wormHolePromise
.
push
(
pro
);
if
(
++
count
==
countAll
)
{
//做个延时,有节奏感
...
...
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