Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crazyflirt
Project
Overview
Details
Activity
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
Shawn Wang
crazyflirt
Commits
9ff81dfe
Commit
9ff81dfe
authored
May 05, 2018
by
Matt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop-matt' into develop
parents
f564fe0c
439120b6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
Map.ts
fe/src/Map.ts
+11
-3
MapGrid.ts
fe/src/MapGrid.ts
+2
-2
No files found.
fe/src/Map.ts
View file @
9ff81dfe
...
@@ -5,6 +5,7 @@ const gridsInY = 10
...
@@ -5,6 +5,7 @@ const gridsInY = 10
class
Map
extends
egret
.
Sprite
{
class
Map
extends
egret
.
Sprite
{
private
grids
:
any
=
[]
private
grids
:
any
=
[]
private
touchArea
:
egret
.
Bitmap
private
touchArea
:
egret
.
Bitmap
private
isShowingTouchArea
public
constructor
()
{
public
constructor
()
{
super
();
super
();
this
.
init
()
this
.
init
()
...
@@ -30,8 +31,8 @@ class Map extends egret.Sprite {
...
@@ -30,8 +31,8 @@ class Map extends egret.Sprite {
}
}
public
getSurroundedGrids
(
x
,
y
)
{
public
getSurroundedGrids
(
x
,
y
)
{
const
left
=
Math
.
max
(
x
/
gridWidth
-
2
)
const
left
=
x
/
gridWidth
-
2
const
top
=
Math
.
max
(
y
/
gridHeight
-
2
)
const
top
=
y
/
gridHeight
-
2
const
grids
=
[]
const
grids
=
[]
for
(
let
i
=
left
;
i
<
5
+
left
;
i
++
)
{
for
(
let
i
=
left
;
i
<
5
+
left
;
i
++
)
{
for
(
let
j
=
top
;
j
<
5
+
top
;
j
++
)
{
for
(
let
j
=
top
;
j
<
5
+
top
;
j
++
)
{
...
@@ -43,7 +44,12 @@ class Map extends egret.Sprite {
...
@@ -43,7 +44,12 @@ class Map extends egret.Sprite {
return
grids
return
grids
}
}
public
showSurroundedGrids
(
x
,
y
)
{
public
showSurroundedGrids
(
x
,
y
,
centerGrid
)
{
if
(
this
.
isShowingTouchArea
)
{
return
}
this
.
isShowingTouchArea
=
true
centerGrid
.
bg
.
texture
=
RES
.
getRes
(
'grid_select_jpg'
)
const
surroundedGrids
=
this
.
getSurroundedGrids
(
x
,
y
)
const
surroundedGrids
=
this
.
getSurroundedGrids
(
x
,
y
)
surroundedGrids
.
forEach
(
grid
=>
{
surroundedGrids
.
forEach
(
grid
=>
{
grid
.
alpha
=
1
grid
.
alpha
=
1
...
@@ -53,10 +59,12 @@ class Map extends egret.Sprite {
...
@@ -53,10 +59,12 @@ class Map extends egret.Sprite {
this
.
touchArea
.
y
=
y
-
2
*
gridHeight
this
.
touchArea
.
y
=
y
-
2
*
gridHeight
setTimeout
(()
=>
{
setTimeout
(()
=>
{
centerGrid
.
bg
.
texture
=
RES
.
getRes
(
'grid_jpg'
)
surroundedGrids
.
forEach
(
grid
=>
{
surroundedGrids
.
forEach
(
grid
=>
{
grid
.
alpha
=
0
grid
.
alpha
=
0
})
})
this
.
touchArea
.
alpha
=
0
this
.
touchArea
.
alpha
=
0
this
.
isShowingTouchArea
=
false
},
1000
);
},
1000
);
}
}
...
...
fe/src/MapGrid.ts
View file @
9ff81dfe
class
MapGrid
extends
egret
.
Sprite
{
class
MapGrid
extends
egret
.
Sprite
{
p
rivate
bg
:
egret
.
Bitmap
=
new
egret
.
Bitmap
()
p
ublic
bg
:
egret
.
Bitmap
=
new
egret
.
Bitmap
()
public
constructor
()
{
public
constructor
()
{
super
();
super
();
this
.
init
()
this
.
init
()
...
@@ -18,7 +18,7 @@ class MapGrid extends egret.Sprite {
...
@@ -18,7 +18,7 @@ class MapGrid extends egret.Sprite {
private
onTouchTap
()
{
private
onTouchTap
()
{
if
(
Store
.
isCatcher
())
{
if
(
Store
.
isCatcher
())
{
this
.
parent
.
showSurroundedGrids
(
this
.
x
,
this
.
y
)
this
.
parent
.
showSurroundedGrids
(
this
.
x
,
this
.
y
,
this
)
}
}
}
}
...
...
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