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
6431ca54
Commit
6431ca54
authored
Sep 21, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Plain Diff
1
parents
70a96abf
edc2166b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
613 additions
and
18 deletions
+613
-18
GameGuide.ts
egret/src/mainScene/GameGuide.ts
+518
-0
MainScene.ts
egret/src/mainScene/MainScene.ts
+41
-12
Tool.ts
egret/src/something/Tool.ts
+45
-1
aaa.ts
egret/src/something/logic/aaa.ts
+9
-5
No files found.
egret/src/mainScene/GameGuide.ts
0 → 100644
View file @
6431ca54
import
{
Lattice
}
from
"../something/class/Lattice"
;
import
{
Tool
}
from
"../something/Tool"
;
import
{
generateMapBg
,
drawPoly
}
from
"../something/logic/aaa"
;
import
MainScene
from
"./MainScene"
;
import
{
writeCache
,
getCacheKey
}
from
"../mapScene/GuideCon"
;
import
{
Element
}
from
"../something/class/Element"
;
import
{
EffectType
}
from
"../something/enum/EffectType"
;
/**
* 引导前,initElements需要编排特定元素
* 游戏引导,。8种
* 蒙层都一致,但是需要特定镂空,手势,和提示文案
*
*/
export
class
GameGuide
extends
egret
.
DisplayObjectContainer
{
/**
* 背景黑色蒙层
*/
bg
:
egret
.
Shape
;
hand
:
egret
.
Bitmap
;
msg
:
eui
.
Label
;
stepCount
:
number
;
stepAll
:
number
;
thisObj
:
MainScene
;
/**
* 直接把this传入得了
* @param thisObj
*/
constructor
(
thisObj
:
MainScene
)
{
super
();
// this.touchEnabled = true;
this
.
bg
=
new
egret
.
Shape
()
this
.
bg
.
touchEnabled
=
true
this
.
addChild
(
this
.
bg
);
this
.
hand
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guidePropHand_png"
));
this
.
hand
.
touchEnabled
=
false
;
this
.
addChild
(
this
.
hand
);
this
.
msg
=
new
eui
.
Label
();
this
.
msg
.
size
=
22
;
this
.
msg
.
y
=
850
;
this
.
msg
.
textColor
=
0xffffff
;
this
.
msg
.
lineSpacing
=
10
;
this
.
msg
.
textAlign
=
egret
.
HorizontalAlign
.
CENTER
;
this
.
addChild
(
this
.
msg
);
this
.
thisObj
=
thisObj
this
.
stepCount
=
chapterFuns
[
thisObj
.
chapter
]
?
chapterFuns
[
thisObj
.
chapter
].
stepCount
:
0
;
this
.
stepAll
=
this
.
stepCount
;
//双特效的不过
if
(
this
.
thisObj
.
chapter
==
8
)
{
var
indexs
=
chapterFuns
[
thisObj
.
chapter
].
showIndexs
[
0
];
for
(
var
i
=
0
;
i
<
indexs
.
length
;
i
++
)
{
var
index
=
indexs
[
i
];
if
(
this
.
thisObj
.
lattices
[
index
]
&&
this
.
thisObj
.
lattices
[
index
].
element
&&
this
.
thisObj
.
lattices
[
index
].
element
.
type
<=
4
)
this
.
thisObj
.
lattices
[
indexs
[
i
]].
element
.
effectType
=
i
==
0
?
EffectType
.
VERTICAL
:
EffectType
.
EXPLOSIVE
}
}
else
{
this
.
initElementEx
();
}
}
/**
* 修改原先元素
* 唯一影响mainScene里布局的方法,如果有bug优先查
*/
private
initElementEx
()
{
if
(
!
chapterFuns
[
this
.
thisObj
.
chapter
]
||
!
chapterFuns
[
this
.
thisObj
.
chapter
].
elementTypes
)
{
return
}
var
lattices
=
this
.
thisObj
.
lattices
;
var
chapter
=
this
.
thisObj
.
chapter
;
var
elementTypes
=
chapterFuns
[
this
.
thisObj
.
chapter
].
elementTypes
;
for
(
var
i
=
0
;
i
<
elementTypes
.
length
;
i
++
)
{
if
(
!
elementTypes
[
i
])
continue
//如果元素为普通元素
if
(
lattices
[
i
]
&&
lattices
[
i
].
element
&&
lattices
[
i
].
element
.
type
<=
4
)
{
var
effectType
=
lattices
[
i
].
element
.
effectType
;
var
isLock
=
lattices
[
i
].
element
.
isLock
;
lattices
[
i
].
element
.
reset
(
elementTypes
[
i
]
-
1
);
lattices
[
i
].
element
.
isLock
=
isLock
;
//如果不是需要显示的元素,恢复特效
if
(
chapterFuns
[
chapter
].
showIndexs
[
0
].
indexOf
(
i
)
==
-
1
)
{
//还原该有的特效
if
(
effectType
!=
null
)
lattices
[
i
].
element
.
effectType
=
effectType
}
}
}
}
show
()
{
//判断一次,如果引导并不能产生消除,就return,并移除自己
if
(
!
this
.
stepCount
||
!
judgeMatch
(
this
.
thisObj
.
chapter
,
this
.
stepAll
-
this
.
stepCount
,
this
.
thisObj
.
lattices
))
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
writeCache
(
getCacheKey
()
+
this
.
thisObj
.
chapter
);
this
.
thisObj
.
gameGuide
=
null
;
return
}
var
step
=
this
.
stepAll
-
this
.
stepCount
;
this
.
drawBg
(
step
);
var
handIndexs
=
chapterFuns
[
this
.
thisObj
.
chapter
].
handIndexs
[
step
];
this
.
handAni
(
handIndexs
);
this
.
msg
.
text
=
chapterFuns
[
this
.
thisObj
.
chapter
].
msg
[
step
]
||
""
;
this
.
msg
.
x
=
(
750
-
this
.
msg
.
textWidth
)
/
2
;
var
p1
=
Tool
.
getPositionByIndex
(
handIndexs
[
0
]);
var
p2
=
Tool
.
getPositionByIndex
(
handIndexs
[
1
]);
this
.
msg
.
y
=
Math
.
max
(
p1
[
1
],
p2
[
1
])
+
135
;
//定制修改,魔力鸟第九关第一步时
if
(
this
.
thisObj
.
chapter
==
9
&&
step
==
0
)
{
this
.
msg
.
y
+=
80
;
}
this
.
stepCount
--
;
}
hideSelf
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
console
.
log
(
this
.
stepCount
)
if
(
!
this
.
stepCount
)
{
//计入缓存
writeCache
(
getCacheKey
()
+
this
.
thisObj
.
chapter
);
//置空gameGuide
this
.
thisObj
.
gameGuide
=
null
;
}
}
private
handAni
(
handIndexs
:
number
)
{
egret
.
Tween
.
removeTweens
(
this
.
hand
)
var
p1
=
Tool
.
getPositionByIndex
(
handIndexs
[
0
]);
var
p2
=
Tool
.
getPositionByIndex
(
handIndexs
[
1
]);
this
.
hand
.
x
=
p1
[
0
];
this
.
hand
.
y
=
p1
[
1
];
egret
.
Tween
.
get
(
this
.
hand
,
{
loop
:
true
})
// .set({ x: p1[0], y: p1[1] })
.
to
({
x
:
p2
[
0
],
y
:
p2
[
1
]
},
1000
)
.
to
({
x
:
p1
[
0
],
y
:
p1
[
1
]
},
100
)
}
/**
*
* @param chapter
* @param step 0第一步,1第二步
*/
private
drawBg
(
step
:
number
=
0
)
{
this
.
bg
.
graphics
.
clear
();
this
.
bg
.
graphics
.
beginFill
(
0x000000
,
0.7
);
this
.
drawRect
();
//画特定的洞
var
data
=
chapterFuns
[
this
.
thisObj
.
chapter
]
drawHole
(
this
.
bg
,
data
.
showIndexs
[
step
],
data
.
hideIndexs
[
step
]);
}
private
drawRect
()
{
//逆时针
this
.
bg
.
graphics
.
moveTo
(
0
,
0
);
this
.
bg
.
graphics
.
lineTo
(
0
,
1624
);
this
.
bg
.
graphics
.
lineTo
(
750
,
1624
);
this
.
bg
.
graphics
.
lineTo
(
750
,
0
);
this
.
bg
.
graphics
.
lineTo
(
0
,
0
);
}
}
const
chapterFuns
=
{
//基本操作 1
1
:
{
//初始化类型图
elementTypes
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
5
,
5
,
4
,
3
,
1
,
1
,
2
,
5
,
2
,
4
,
3
,
5
,
5
,
1
,
1
,
5
,
2
,
3
,
2
,
4
,
4
,
2
,
2
,
5
,
5
,
2
,
2
,
1
,
5
,
2
,
5
,
2
,
3
,
1
,
5
,
2
,
3
,
4
,
4
,
5
,
3
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
//需要步数
stepCount
:
1
,
//中空的格子,stepCount有多少,就有多少组
showIndexs
:
[
[
39
,
40
,
41
,
48
],
],
//和遮挡的格子
hideIndexs
:
[
[
40
,
41
],
],
//手势来回滑的两个位置索引
handIndexs
:
[
[
39
,
48
]
],
//提示文案,尽量通用点的位置。x肯定都居中
msg
:
[
"3个同色动物头像成一排即可消除~"
]
},
//冰块消除
5
:
{
elementTypes
:
[
0
,
0
,
1
,
2
,
4
,
5
,
1
,
0
,
0
,
0
,
0
,
1
,
3
,
1
,
3
,
4
,
0
,
0
,
0
,
0
,
5
,
3
,
2
,
4
,
3
,
0
,
0
,
0
,
0
,
2
,
1
,
5
,
2
,
1
,
0
,
0
,
0
,
0
,
1
,
2
,
3
,
4
,
5
,
0
,
0
,
0
,
0
,
1
,
3
,
1
,
3
,
4
,
0
,
0
,
0
,
0
,
5
,
3
,
2
,
4
,
3
,
0
,
0
,
0
,
0
,
2
,
1
,
5
,
2
,
1
,
0
,
0
,
0
,
0
,
1
,
2
,
3
,
4
,
5
,
0
,
0
,
],
stepCount
:
1
,
showIndexs
:
[
[
40
,
48
,
49
,
50
],
],
hideIndexs
:
[
[
48
,
50
],
],
handIndexs
:
[
[
40
,
49
]
],
msg
:
[
"消除冰块上的元素即可打破冰块"
]
},
//直线特效
6
:
{
elementTypes
:
[
1
,
2
,
4
,
5
,
1
,
3
,
5
,
4
,
3
,
1
,
3
,
1
,
3
,
4
,
1
,
3
,
5
,
2
,
5
,
3
,
2
,
4
,
3
,
4
,
4
,
3
,
1
,
2
,
1
,
5
,
2
,
1
,
3
,
2
,
1
,
5
,
1
,
2
,
3
,
4
,
5
,
1
,
2
,
3
,
4
,
2
,
2
,
4
,
5
,
1
,
3
,
5
,
4
,
3
,
1
,
3
,
1
,
3
,
4
,
1
,
3
,
5
,
2
,
5
,
3
,
2
,
4
,
3
,
4
,
4
,
3
,
1
,
2
,
1
,
5
,
2
,
1
,
3
,
2
,
1
,
5
,
],
stepCount
:
1
,
showIndexs
:
[
[
13
,
21
,
22
,
23
,
24
],
],
hideIndexs
:
[
[
21
,
23
,
24
],
],
handIndexs
:
[
[
13
,
22
]
],
msg
:
[
"4个同色元素形成直线就能合成直线特效,
\n
消除直线特效会产生直线消除"
]
},
//爆炸特效
7
:
{
elementTypes
:
[
1
,
2
,
4
,
5
,
0
,
3
,
5
,
4
,
3
,
1
,
3
,
1
,
3
,
0
,
1
,
3
,
5
,
2
,
5
,
3
,
2
,
4
,
3
,
4
,
4
,
3
,
1
,
2
,
1
,
5
,
2
,
1
,
3
,
2
,
1
,
5
,
1
,
2
,
3
,
1
,
2
,
1
,
1
,
3
,
4
,
2
,
2
,
4
,
5
,
1
,
3
,
5
,
4
,
3
,
1
,
3
,
1
,
3
,
4
,
1
,
3
,
5
,
2
,
0
,
3
,
2
,
4
,
3
,
4
,
4
,
3
,
0
,
0
,
0
,
5
,
2
,
1
,
3
,
2
,
0
,
0
,
],
stepCount
:
1
,
showIndexs
:
[
[
31
,
39
,
40
,
41
,
42
,
49
],
],
hideIndexs
:
[
[
31
,
41
,
42
,
49
],
],
handIndexs
:
[
[
39
,
40
]
],
msg
:
[
"5个同色动物头像成L形或T形就能合成
\n
爆炸特效,消除爆炸特效会产生3*3的范围消除"
]
},
//两特效组合
8
:
{
elementTypes
:
null
,
stepCount
:
1
,
showIndexs
:
[
[
48
,
49
],
],
hideIndexs
:
[
[],
],
handIndexs
:
[
[
48
,
49
]
],
msg
:
[
"将两个特效互相拖动即可直接触发组合特效,
\n
组合特效的效果视组合的两个特效类型而定"
]
},
//魔力鸟特效
9
:
{
elementTypes
:
[
1
,
2
,
4
,
5
,
1
,
3
,
5
,
4
,
3
,
1
,
3
,
1
,
3
,
1
,
1
,
3
,
5
,
2
,
5
,
3
,
2
,
1
,
3
,
4
,
5
,
3
,
1
,
0
,
1
,
5
,
2
,
1
,
3
,
2
,
1
,
0
,
1
,
2
,
3
,
1
,
1
,
4
,
1
,
3
,
4
,
2
,
2
,
4
,
5
,
0
,
3
,
5
,
4
,
3
,
1
,
3
,
1
,
3
,
4
,
1
,
3
,
5
,
2
,
5
,
3
,
2
,
4
,
3
,
4
,
4
,
3
,
1
,
2
,
1
,
5
,
2
,
1
,
3
,
2
,
1
,
5
],
stepCount
:
2
,
showIndexs
:
[
[
4
,
13
,
22
,
31
,
40
,
21
],
[
40
,
39
]
],
hideIndexs
:
[
[
4
,
13
,
31
,
40
],
[]
],
handIndexs
:
[
[
21
,
22
],
[
40
,
39
]
],
msg
:
[
"五个相同动物形成一字型即可合成魔力花特效"
,
"拖动魔力花特效即可直接触发"
]
},
//棒棒糖消除
10
:
{
elementTypes
:
[
0
,
0
,
5
,
2
,
0
,
4
,
4
,
0
,
0
,
0
,
0
,
2
,
1
,
4
,
1
,
1
,
0
,
0
,
0
,
0
,
2
,
1
,
2
,
4
,
4
,
0
,
0
,
0
,
0
,
4
,
3
,
1
,
4
,
2
,
0
,
0
,
0
,
0
,
3
,
5
,
1
,
2
,
1
,
0
,
0
,
0
,
0
,
4
,
3
,
5
,
2
,
3
,
0
,
0
,
0
,
0
,
3
,
5
,
4
,
3
,
5
,
0
,
0
,
0
,
0
,
1
,
4
,
4
,
2
,
5
,
0
,
0
,
0
,
0
,
4
,
2
,
2
,
1
,
2
,
0
,
0
],
stepCount
:
1
,
showIndexs
:
[
[
4
,
5
,
6
,
13
],
],
hideIndexs
:
[
[
5
,
6
],
],
handIndexs
:
[
[
13
,
4
]
],
msg
:
[
"当棒棒糖移至底层时,即可移除棒棒糖"
]
},
//石头消除
19
:
{
elementTypes
:
[
0
,
2
,
3
,
0
,
2
,
0
,
5
,
1
,
0
,
0
,
1
,
1
,
0
,
1
,
0
,
1
,
3
,
0
,
0
,
4
,
3
,
0
,
0
,
0
,
4
,
4
,
0
,
0
,
5
,
0
,
0
,
0
,
0
,
0
,
4
,
0
,
0
,
3
,
2
,
0
,
0
,
0
,
4
,
3
,
0
,
4
,
1
,
5
,
1
,
0
,
3
,
1
,
4
,
4
,
0
,
5
,
1
,
2
,
4
,
3
,
5
,
1
,
0
,
0
,
0
,
3
,
3
,
5
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
3
,
2
,
3
,
0
,
0
,
0
,
],
stepCount
:
1
,
showIndexs
:
[
[
46
,
47
,
48
,
56
],
],
hideIndexs
:
[
[
46
,
48
],
],
handIndexs
:
[
[
47
,
56
]
],
msg
:
[
"当石头附近的元素产生消除时,即可粉碎石头"
]
},
//笼子消除
24
:
{
elementTypes
:
[
0
,
0
,
0
,
1
,
2
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
4
,
2
,
0
,
0
,
0
,
0
,
0
,
3
,
3
,
2
,
2
,
1
,
0
,
0
,
0
,
3
,
3
,
5
,
5
,
4
,
4
,
2
,
0
,
3
,
1
,
5
,
5
,
3
,
1
,
3
,
2
,
3
,
5
,
4
,
1
,
2
,
4
,
3
,
4
,
3
,
2
,
2
,
3
,
4
,
1
,
3
,
1
,
3
,
5
,
3
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
stepCount
:
1
,
showIndexs
:
[
[
40
,
49
,
58
,
50
],
],
hideIndexs
:
[
[
40
,
58
],
],
handIndexs
:
[
[
49
,
50
]
],
msg
:
[
"被枷锁的元素无法进行移动,当触发元素
\n
消除时,元素上的锁即可被消除"
]
},
}
/**
* 根据显示index和隐藏的绘制图形
* @param shape
* @param showIndexs
* @param hideIndexs
*/
function
drawHole
(
shape
:
egret
.
Shape
,
showIndexs
:
number
[],
hideIndexs
:
number
[])
{
var
lattices
=
createLattices9
(
showIndexs
);
var
paths
=
generateMapBg
(
lattices
);
//顺时针
//画洞
for
(
var
j
=
0
;
j
<
paths
.
length
;
j
++
)
{
var
path
=
paths
[
j
];
drawPoly
(
shape
,
path
)
}
shape
.
graphics
.
endFill
();
//根据hideIndexs画遮,为了不能点击
if
(
!
hideIndexs
||
!
hideIndexs
.
length
)
return
shape
.
graphics
.
beginFill
(
0x000000
,
0
);
for
(
var
i
=
0
;
i
<
hideIndexs
.
length
;
i
++
)
{
var
center
=
Tool
.
getPositionByIndex
(
hideIndexs
[
i
]);
shape
.
graphics
.
drawRect
(
center
[
0
]
-
Tool
.
width
/
2
,
center
[
1
]
-
Tool
.
height
/
2
,
Tool
.
width
,
Tool
.
height
);
}
shape
.
graphics
.
endFill
();
}
//根据显示的格子求Tool.colNum * Tool.rowNum格子,显示的标为1;
function
createLattices9
(
indexs
:
number
[]):
number
[]
{
var
arr
:
number
[]
=
[];
for
(
var
i
=
0
;
i
<
Tool
.
colNum
*
Tool
.
rowNum
;
i
++
)
{
if
(
indexs
.
indexOf
(
i
)
>
-
1
)
{
arr
[
i
]
=
1
}
else
{
arr
[
i
]
=
0
}
}
return
arr
}
/**
* 判断是否有效
* 需要2次引导时重写逻辑,要把手移动的元素算入
*/
function
judgeMatch
(
chapter
:
number
,
step
:
number
,
lattices
:
Lattice
[]):
boolean
{
var
data
=
chapterFuns
[
chapter
];
if
(
!
data
||
!
data
.
showIndexs
||
!
data
.
showIndexs
[
step
])
{
return
false
;
}
//取出所有的元素索引
var
indexs
=
data
.
showIndexs
[
step
];
var
elements
:
Element
[]
=
[]
var
arr
=
{};
for
(
var
i
=
0
;
i
<
indexs
.
length
;
i
++
)
{
var
index
=
indexs
[
i
];
if
(
lattices
[
index
]
&&
lattices
[
index
].
element
)
{
elements
.
push
(
lattices
[
index
].
element
)
var
type
=
lattices
[
index
].
element
.
type
;
if
(
!
arr
[
type
])
arr
[
type
]
=
0
;
arr
[
type
]
++
;
}
}
//特效组合,或魔力鸟 的,就两个元素的应该
if
(
elements
.
length
==
2
)
{
if
(
elements
[
0
].
effectType
==
EffectType
.
MAGICLION
&&
elements
[
1
].
type
<=
4
)
{
return
true
}
if
(
elements
[
1
].
effectType
==
EffectType
.
MAGICLION
&&
elements
[
0
].
type
<=
4
)
{
return
true
}
if
(
elements
[
1
].
effectType
!=
null
&&
elements
[
0
].
effectType
!=
null
)
{
return
true
}
}
//这个要重写
for
(
var
a
in
arr
)
{
if
(
arr
[
a
]
>=
3
)
{
return
true
}
}
return
false
}
var
arr
=
[
"apple"
,
"orange"
,
"apple"
,
"orange"
,
"pear"
,
"orange"
];
function
getWordCnt
(
arr
:
any
[])
{
return
arr
.
reduce
(
function
(
prev
,
next
)
{
prev
[
next
]
=
(
prev
[
next
]
+
1
)
||
1
;
return
prev
;
},
{});
}
egret/src/mainScene/MainScene.ts
View file @
6431ca54
...
...
@@ -51,8 +51,12 @@ import { GuideMsg } from '../something/uis/GuideMsg';
import
{
readCache
,
getCacheKey
}
from
'../mapScene/GuideCon'
;
import
{
PropGuideInt
}
from
'./PropGuide'
;
import
{
StepAni
}
from
'../something/anis/StepAni'
;
<<<<<<<
HEAD
import
{
updateMainTimerAfterGetData
}
from
'../../libs/new_wx/MainBase'
;
import
wait
from
'../../libs/new_tc/wait'
;
=======
import
{
GameGuide
}
from
'./GameGuide'
;
>>>>>>>
edc2166bb8da76159df10a9a2edcbcb0c9506091
// tslint:disable: no-var-keyword
// tslint:disable: prefer-const
// tslint:disable: cyclomatic-complexity
...
...
@@ -206,11 +210,10 @@ export default class MainScene extends Scene {
stepCircle
:
egret
.
Shape
;
//bonus Time 提示
bonusTime
:
BonusTime
;
//游戏操作引导
gameGuide
:
GameGuide
;
start
(
data
)
{
super
.
start
();
//初始化索引信息
Tool
.
init
();
//第几关
this
.
chapter
=
(
data
&&
data
.
chapter
)
?
data
.
chapter
:
1
;
// this.chapter = 24;
...
...
@@ -222,6 +225,8 @@ export default class MainScene extends Scene {
mapDataIndex
=
this
.
chapter
-
20
}
this
.
chapterData
=
Chapters
[
mapDataIndex
];
//初始化索引信息,暂时不做判断列数的奇偶,如需,要修改的地方再考虑,还有道具使用的蒙层是否要改
Tool
.
init
(
/*Tool.getColOddEven(this.chapterData.map.lattices)*/
);
this
.
initUi
();
this
.
initSvgas
();
//先禁掉事件
...
...
@@ -278,7 +283,7 @@ export default class MainScene extends Scene {
//引导提示
var
guideImageNum
:
number
;
// 15678是操作引导
const
chapterToGuideNum
=
{
/*
const chapterToGuideNum = {
1: 1,
5: 2,
6: 3,
...
...
@@ -301,9 +306,18 @@ export default class MainScene extends Scene {
() => {
Loading2.instace.hide()
})
}*/
//游戏引导
const
gameGuideChapterNum
=
[
1
,
5
,
6
,
7
,
8
,
9
,
10
,
19
,
24
]
if
(
gameGuideChapterNum
.
indexOf
(
this
.
chapter
>>
0
)
>
-
1
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
))
{
this
.
gameGuide
=
new
GameGuide
(
this
);
this
.
addChild
(
this
.
gameGuide
);
this
.
gameGuide
.
show
();
}
}
// 234是道具引导
if
(
this
.
chapter
==
2
||
this
.
chapter
==
3
||
this
.
chapter
==
4
)
{
else
if
(
this
.
chapter
==
2
||
this
.
chapter
==
3
||
this
.
chapter
==
4
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
+
"prop"
))
{
this
.
enableMouseEvt
(
false
);
var
pgi
=
new
PropGuideInt
(
this
)
...
...
@@ -347,12 +361,12 @@ export default class MainScene extends Scene {
const
texture
:
egret
.
Texture
=
RES
.
getRes
(
'main_mapbottom_png'
);
const
imgs
=
new
egret
.
DisplayObjectContainer
;
for
(
const
key
in
this
.
endRowNumHash
)
{
const
{
index
,
row
}
=
this
.
endRowNumHash
[
key
];
if
(
this
.
endRowNum
==
row
)
{
const
{
index
,
row
}
=
this
.
endRowNumHash
[
key
];
if
(
this
.
endRowNum
==
row
)
{
const
img
=
new
eui
.
Image
(
texture
);
const
[
x
,
y
]
=
Tool
.
getPositionByIndex
(
index
);
img
.
x
=
x
;
img
.
y
=
y
;
const
[
x
,
y
]
=
Tool
.
getPositionByIndex
(
index
);
img
.
x
=
x
;
img
.
y
=
y
;
imgs
.
addChild
(
img
);
}
}
...
...
@@ -702,7 +716,15 @@ export default class MainScene extends Scene {
}
// this.lattices[11].element.effectType=EffectType.MAGICLION;
// this.lattices[20].element.effectType=EffectType.MAGICLION;
var
aa
=
[]
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
if
(
!
this
.
lattices
[
i
]
||
!
this
.
lattices
[
i
].
element
)
{
aa
.
push
(
0
)
}
else
{
aa
.
push
(
this
.
lattices
[
i
].
element
.
type
)
}
}
console
.
log
(
aa
)
//初始化完先检测死图
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
...
...
@@ -766,7 +788,7 @@ export default class MainScene extends Scene {
this
.
elementContainer
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_MOVE
,
this
.
mouseMoveE
,
this
);
}
onEnterFrame
()
{
if
(
this
.
enableTouch
)
{
if
(
this
.
enableTouch
&&
!
this
.
gameGuide
)
{
this
.
noActionCount
++
;
}
else
{
this
.
noActionCount
=
0
;
...
...
@@ -1043,6 +1065,8 @@ export default class MainScene extends Scene {
private
callbackEx
(
s
,
o
)
{
this
.
exchangeData
(
s
,
o
);
if
(
this
.
simpleMatch
(
s
,
o
))
{
//有游戏引导时去掉
if
(
this
.
gameGuide
)
this
.
gameGuide
.
hideSelf
();
//次数减1;
this
.
steps
--
;
this
.
oneStepScore
=
0
;
...
...
@@ -1762,6 +1786,11 @@ export default class MainScene extends Scene {
this
.
upsetElement
()
},
1000
)
}
else
{
//如果还有游戏引导
if
(
this
.
gameGuide
)
{
this
.
addChild
(
this
.
gameGuide
)
this
.
gameGuide
.
show
()
};
//允许移动
this
.
enableMouseEvt
(
true
)
}
...
...
egret/src/something/Tool.ts
View file @
6431ca54
...
...
@@ -51,7 +51,8 @@ export class Tool {
/**
* 初始化数据
*/
public
static
init
()
{
public
static
init
(
isTwo
:
boolean
=
false
)
{
this
.
offsetX
=
isTwo
?
55
:
15
//都是9*9
//位置信息
var
spaceX
=
this
.
width
,
...
...
@@ -109,6 +110,49 @@ export class Tool {
return
this
.
indexPositions
[
index
]
}
/**
* 根据9*9格子得到中间列数的奇偶性
* 其实只是要知道左右两边空的列数
* @param lattices
* @returns true为偶数,false为奇数
*/
public
static
getColOddEven
(
lattices
:
number
[]):
boolean
{
var
left
:
number
=
0
;
for
(
var
i
=
0
;
i
<
Tool
.
colNum
;
i
++
)
{
//判断该列是否有格子,没有就加1,有就直接over
var
mark
=
false
;
for
(
var
j
=
0
;
j
<
Tool
.
rowNum
;
j
++
)
{
if
(
lattices
[
j
*
this
.
colNum
+
i
])
{
mark
=
true
;
break
}
}
if
(
mark
)
{
break
}
else
{
left
++
}
}
var
right
:
number
=
0
;
for
(
var
i
=
Tool
.
colNum
-
1
;
i
>=
0
;
i
--
)
{
//判断该列是否有格子,没有就加1,有就直接over
var
mark
=
false
;
for
(
var
j
=
0
;
j
<
Tool
.
rowNum
;
j
++
)
{
if
(
lattices
[
j
*
this
.
colNum
+
i
])
{
mark
=
true
;
break
}
}
if
(
mark
)
{
break
}
else
{
right
++
}
}
return
(
left
+
right
)
%
2
!=
0
}
/**
* 判断相邻
* @param a
...
...
egret/src/something/logic/aaa.ts
View file @
6431ca54
...
...
@@ -44,7 +44,7 @@ export function drawShape(paths: PathData[]): egret.Shape {
return
shape
}
//画多边形路径
function
drawPoly
(
shape
:
egret
.
Shape
,
path
:
PathData
)
{
export
function
drawPoly
(
shape
:
egret
.
Shape
,
path
:
PathData
)
{
var
firstFrom
;
for
(
var
j
=
0
;
j
<
path
.
points
.
length
;
j
+=
2
)
{
//当前点
...
...
@@ -149,9 +149,11 @@ function calVet(index: string): number[] {
}
//给出10*10
let
indexToRcMap10
:
number
[][]
=
[];
let
indexPositions10
:
number
[][]
=
[];
(
function
()
{
let
indexToRcMap10
:
number
[][];
let
indexPositions10
:
number
[][];
function
get10DataUp
()
{
indexToRcMap10
=
[];
indexPositions10
=
[];
var
rowNum
=
Tool
.
rowNum
+
1
;
var
colNum
=
Tool
.
colNum
+
1
;
var
offsetX
=
Tool
.
offsetX
...
...
@@ -163,13 +165,15 @@ let indexPositions10: number[][] = [];
indexPositions10
[
i
*
colNum
+
j
]
=
[
offsetX
+
j
*
Tool
.
width
,
offsetY
+
i
*
Tool
.
height
];
}
}
}
)()
}
//返回10的索引
function
indexToRc10
(
index
:
number
):
number
[]
{
if
(
!
indexToRcMap10
)
get10DataUp
();
return
indexToRcMap10
[
index
]
}
//
function
getPositionByIndex10
(
index
:
number
):
number
[]
{
if
(
!
indexPositions10
)
get10DataUp
();
return
indexPositions10
[
index
]
}
...
...
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