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
670ab98a
Commit
670ab98a
authored
Aug 27, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
476d415d
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
59 deletions
+36
-59
common.tmproject
egret/resource/TextureMerger/common.tmproject
+1
-1
main.tmproject
egret/resource/TextureMerger/main.tmproject
+1
-1
MainScene.ts
egret/src/mainScene/MainScene.ts
+4
-57
Tool.ts
egret/src/something/Tool.ts
+30
-0
No files found.
egret/resource/TextureMerger/common.tmproject
View file @
670ab98a
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"common","version":5,"files":["..
/assets/common/toast.png","../assets/common/closeCommonBtn.png","../assets/common/btn.png","../assets/common/alertbg.png","../assets/common/按钮 副本 4.png","../assets/common/按钮 副本 3.png","../assets/common/share_btn2.png","../assets/common/share_btn1.png","../assets/common/commmon_okbtn1.png","../assets/common/
lightani.png"]}
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"common","version":5,"files":["..
\\assets\\common\\toast.png","..\\assets\\common\\closeCommonBtn.png","..\\assets\\common\\btn.png","..\\assets\\common\\alertbg.png","..\\assets\\common\\按钮 副本 4.png","..\\assets\\common\\按钮 副本 3.png","..\\assets\\common\\share_btn2.png","..\\assets\\common\\share_btn1.png","..\\assets\\common\\commmon_okbtn1.png","..\\assets\\common\\
lightani.png"]}
\ No newline at end of file
egret/resource/TextureMerger/main.tmproject
View file @
670ab98a
This diff is collapsed.
Click to expand it.
egret/src/mainScene/MainScene.ts
View file @
670ab98a
...
...
@@ -1018,13 +1018,10 @@ export default class MainScene extends Scene {
* @param callback 所有fall完成后的回调,检查三消,
*/
fall
(
callback
:
Function
)
{
//记录一个对象和位置信息[obj,index]的数组,如果obj是null则生成,index位置上方
// var anis = [];
//排序从小到大
// emptys.sort(function (a, b) { return a > b ? 1 : -1 })
//先找完竖直的,
//去重一次
Tool
.
removeReapty
(
this
.
emptys
);
//注释里的备用
var
anis
=
this
.
fallVertical
();
//然后找斜落得
anis
=
anis
.
concat
(
this
.
fallSkew
());
if
(
!
anis
.
length
)
{
//如果没有能掉落的就直接回调
...
...
@@ -1079,55 +1076,6 @@ export default class MainScene extends Scene {
}
return
anis
;
}
private
fallVertical1
()
{
var
verticalAnis
=
[]
//先把竖直的掉落完,掉满后
for
(
var
m
=
0
;
m
<
Tool
.
colNum
;
m
++
)
{
//同一列
for
(
var
n
=
Tool
.
rowNum
-
1
;
n
>=
0
;
n
--
)
{
var
index
=
Tool
.
rcToIndex
(
n
,
m
);
let
lat
=
this
.
lattices
[
index
];
if
(
Tool
.
judgeFall
(
lat
))
{
var
emptyIndex
=
Tool
.
findBottom
(
lat
,
this
.
emptys
,
this
.
lattices
)
if
(
emptyIndex
!=
null
)
{
verticalAnis
.
push
([
lat
.
element
,
this
.
emptys
[
emptyIndex
]]);
//去掉一个
this
.
emptys
.
splice
(
emptyIndex
,
1
);
//加上一个
this
.
emptys
.
push
(
index
);
lat
.
element
=
null
}
//找最下面的那个空格
var
latDown
,
indexDown
;
if
(
lat
.
down
!=
null
)
{
latDown
=
this
.
lattices
[
lat
.
down
];
indexDown
=
lat
.
down
;
}
else
{
latDown
=
this
.
lattices
[
index
+
Tool
.
colNum
]
indexDown
=
index
+
Tool
.
colNum
;
}
//下方有格子,并且再this.empty中
var
emptyIndex
=
this
.
emptys
.
indexOf
(
indexDown
)
if
(
emptyIndex
>
-
1
)
{
verticalAnis
.
push
([
lat
.
element
,
indexDown
]);
//去掉一个
this
.
emptys
.
splice
(
emptyIndex
,
1
);
//加上一个
this
.
emptys
.
push
(
index
);
lat
.
element
=
null
}
}
else
{
//如果有格子。无元素,是生成口
if
(
lat
&&
!
lat
.
element
&&
lat
.
isGenerate
)
{
verticalAnis
.
push
([
null
,
index
]);
Tool
.
removeEle
(
index
,
this
.
emptys
)
}
}
}
}
return
verticalAnis
;
}
private
fallSkew
()
{
//记录一个对象和位置信息[obj,index]的数组,如果obj是null则生成,index位置上方
...
...
@@ -1240,7 +1188,7 @@ export default class MainScene extends Scene {
obj
.
fallAni
()
//执行Tween
egret
.
Tween
.
get
(
obj
)
.
to
({
x
:
position
[
0
],
y
:
position
[
1
]
},
1
8
0
/*, egret.Ease.cubicOut*/
)
.
to
({
x
:
position
[
0
],
y
:
position
[
1
]
},
1
0
0
/*, egret.Ease.cubicOut*/
)
.
call
(()
=>
{
obj
.
x
=
position
[
0
];
obj
.
y
=
position
[
1
];
...
...
@@ -1263,7 +1211,6 @@ export default class MainScene extends Scene {
}
}
/**
* 只关心交换后元素的可消除
* 或者冰淇淋的掉落
...
...
egret/src/something/Tool.ts
View file @
670ab98a
...
...
@@ -4,6 +4,8 @@ import { Lattice } from "./class/Lattice";
import
{
ElementType
}
from
"./enum/ElementType"
;
import
{
PassType
}
from
"./enum/PassType"
;
import
{
EffectType
}
from
"./enum/EffectType"
;
import
{
Pool
}
from
"./Pool"
;
import
{
RecoverName
}
from
"./enum/RecoverName"
;
export
class
Tool
{
public
static
rowNum
=
9
;
...
...
@@ -585,6 +587,34 @@ export class Tool {
return
e
&&
"number"
==
typeof
e
.
length
&&
e
.
length
?
e
[
Math
.
floor
(
Math
.
random
()
*
e
.
length
)]
:
(
"number"
!=
typeof
n
&&
(
n
=
e
||
1
,
e
=
0
),
e
+
Math
.
random
()
*
(
n
-
e
))
}
/**
* 数字数组去重
*/
public
static
removeReapty
(
arr
:
number
[])
{
var
obj
=
{};
for
(
var
i
=
arr
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
obj
[
arr
[
i
]])
{
//有出现的的,去掉
arr
.
splice
(
i
,
1
)
}
else
{
obj
[
arr
[
i
]]
=
true
}
}
}
/**
* 获得元素
* @param type
*/
public
static
getElement
(
type
:
ElementType
)
{
let
obj
=
Pool
.
takeOut
(
RecoverName
.
ELEMENT
);
if
(
!
obj
)
{
obj
=
new
Element
(
type
)
}
else
{
obj
.
reset
(
type
)
}
return
obj
}
/**
* 返回个十百等,0是个位
* 78[ 8, 7]
...
...
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