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
d68283ed
Commit
d68283ed
authored
May 05, 2018
by
Nick An
Browse files
Options
Browse Files
Download
Plain Diff
mg
parents
41570fe6
abd8ecb2
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
32 deletions
+60
-32
grid.jpg
fe/resource/assets/grid.jpg
+0
-0
grid_select.jpg
fe/resource/assets/grid_select.jpg
+0
-0
default.res.json
fe/resource/default.res.json
+7
-1
Guy.ts
fe/src/Guy.ts
+5
-4
Map.ts
fe/src/Map.ts
+36
-14
MapGrid.ts
fe/src/MapGrid.ts
+6
-10
SceneManager.ts
fe/src/SceneManager.ts
+1
-1
Store.ts
fe/src/Store.ts
+2
-1
GameScene.ts
fe/src/scenes/GameScene.ts
+3
-1
No files found.
fe/resource/assets/grid.jpg
View replaced file @
41570fe6
View file @
d68283ed
453 Bytes
|
W:
|
H:
333 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
fe/resource/assets/grid_select.jpg
0 → 100644
View file @
d68283ed
331 Bytes
fe/resource/default.res.json
View file @
d68283ed
{
{
"groups"
:
[
"groups"
:
[
{
{
"keys"
:
"bg_jpg,egret_icon_png,description_json,control_jpg,grid_jpg,logo_jpg,mask_jpg"
,
"keys"
:
"bg_jpg,egret_icon_png,description_json,control_jpg,grid_jpg,logo_jpg,mask_jpg
,grid_select_jpg
"
,
"name"
:
"preload"
"name"
:
"preload"
}
}
],
],
...
@@ -40,6 +40,11 @@
...
@@ -40,6 +40,11 @@
"name"
:
"mask_jpg"
,
"name"
:
"mask_jpg"
,
"type"
:
"image"
,
"type"
:
"image"
,
"url"
:
"assets/mask.jpg"
"url"
:
"assets/mask.jpg"
},
{
"name"
:
"grid_select_jpg"
,
"type"
:
"image"
,
"url"
:
"assets/grid_select.jpg"
}
}
]
]
}
}
\ No newline at end of file
fe/src/Guy.ts
View file @
d68283ed
...
@@ -26,8 +26,8 @@ class Guy extends egret.Sprite {
...
@@ -26,8 +26,8 @@ class Guy extends egret.Sprite {
this
.
x
+=
this
.
step
*
delta
.
x
this
.
x
+=
this
.
step
*
delta
.
x
this
.
y
+=
this
.
step
*
delta
.
y
this
.
y
+=
this
.
step
*
delta
.
y
if
(
this
.
x
<=
0
){
if
(
this
.
x
<=
1
0
){
this
.
x
=
0
this
.
x
=
1
0
}
}
if
(
this
.
y
<=
15
){
if
(
this
.
y
<=
15
){
this
.
y
=
15
this
.
y
=
15
...
@@ -35,8 +35,8 @@ class Guy extends egret.Sprite {
...
@@ -35,8 +35,8 @@ class Guy extends egret.Sprite {
if
(
this
.
y
>=
72
*
9
+
15
){
if
(
this
.
y
>=
72
*
9
+
15
){
this
.
y
=
72
*
9
+
15
this
.
y
=
72
*
9
+
15
}
}
if
(
this
.
x
>=
72
*
13
){
if
(
this
.
x
>=
72
*
13
+
10
){
this
.
x
=
72
*
13
this
.
x
=
72
*
13
+
10
}
}
}
}
}
}
\ No newline at end of file
fe/src/Map.ts
View file @
d68283ed
...
@@ -4,6 +4,7 @@ const gridsInX = 14
...
@@ -4,6 +4,7 @@ const gridsInX = 14
const
gridsInY
=
10
const
gridsInY
=
10
class
Map
extends
egret
.
Sprite
{
class
Map
extends
egret
.
Sprite
{
private
grids
:
any
=
[]
private
grids
:
any
=
[]
private
touchArea
:
egret
.
Bitmap
public
constructor
()
{
public
constructor
()
{
super
();
super
();
this
.
init
()
this
.
init
()
...
@@ -11,7 +12,6 @@ class Map extends egret.Sprite {
...
@@ -11,7 +12,6 @@ class Map extends egret.Sprite {
// 初始化(给开始按钮绑定点击事件)
// 初始化(给开始按钮绑定点击事件)
private
init
()
{
private
init
()
{
console
.
log
(
'Map.init'
)
for
(
let
i
=
0
;
i
<
gridsInY
;
i
++
)
{
for
(
let
i
=
0
;
i
<
gridsInY
;
i
++
)
{
this
.
grids
.
push
([])
this
.
grids
.
push
([])
for
(
let
j
=
0
;
j
<
gridsInX
;
j
++
)
{
for
(
let
j
=
0
;
j
<
gridsInX
;
j
++
)
{
...
@@ -22,21 +22,44 @@ class Map extends egret.Sprite {
...
@@ -22,21 +22,44 @@ class Map extends egret.Sprite {
this
.
addChild
(
grid
)
this
.
addChild
(
grid
)
}
}
}
}
if
(
Store
.
isCatcher
())
{
const
mask
=
new
egret
.
Shape
()
this
.
touchArea
=
new
egret
.
Bitmap
()
mask
.
x
=
100
this
.
touchArea
.
texture
=
RES
.
getRes
(
'mask_jpg'
)
mask
.
y
=
100
this
.
touchArea
.
alpha
=
0
mask
.
graphics
.
lineStyle
(
10
,
0x00ff00
);
this
.
addChild
(
this
.
touchArea
)
mask
.
graphics
.
beginFill
(
0xff0000
,
1
);
}
mask
.
graphics
.
drawCircle
(
0
,
0
,
50
);
mask
.
graphics
.
endFill
();
public
getSurroundedGrids
(
x
,
y
)
{
mask
.
touchEnabled
=
false
const
left
=
Math
.
max
(
x
/
gridWidth
-
2
)
this
.
mask
=
mask
const
top
=
Math
.
max
(
y
/
gridHeight
-
2
)
const
grids
=
[]
for
(
let
i
=
left
;
i
<
5
+
left
;
i
++
)
{
for
(
let
j
=
top
;
j
<
5
+
top
;
j
++
)
{
if
(
i
>=
0
&&
j
>=
0
&&
i
<
gridsInX
&&
j
<
gridsInY
)
{
grids
.
push
(
this
.
grids
[
j
][
i
])
}
}
}
// put display object to this scene
}
return
grids
}
public
showSurroundedGrids
(
x
,
y
)
{
const
surroundedGrids
=
this
.
getSurroundedGrids
(
x
,
y
)
surroundedGrids
.
forEach
(
grid
=>
{
grid
.
alpha
=
1
})
this
.
touchArea
.
alpha
=
1
this
.
touchArea
.
x
=
x
-
2
*
gridWidth
this
.
touchArea
.
y
=
y
-
2
*
gridHeight
setTimeout
(()
=>
{
surroundedGrids
.
forEach
(
grid
=>
{
grid
.
alpha
=
0
})
this
.
touchArea
.
alpha
=
0
},
1000
);
}
}
public
release
()
{
public
release
()
{
// 移除事件
}
}
}
}
\ No newline at end of file
fe/src/MapGrid.ts
View file @
d68283ed
...
@@ -6,25 +6,22 @@ class MapGrid extends egret.Sprite {
...
@@ -6,25 +6,22 @@ class MapGrid extends egret.Sprite {
this
.
init
()
this
.
init
()
}
}
// 初始化(给开始按钮绑定点击事件)
private
init
()
{
private
init
()
{
console
.
log
(
'Map.init'
)
this
.
bg
.
texture
=
RES
.
getRes
(
'grid_jpg'
)
this
.
bg
.
texture
=
RES
.
getRes
(
'grid_jpg'
)
this
.
addChild
(
this
.
bg
)
this
.
addChild
(
this
.
bg
)
this
.
bg
.
touchEnabled
=
true
this
.
touchEnabled
=
true
this
.
bg
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
onTouchTap
,
this
)
if
(
Store
.
isCatcher
())
{
this
.
alpha
=
0
this
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
onTouchTap
,
this
)
}
}
}
private
onTouchTap
()
{
private
onTouchTap
()
{
console
.
log
(
this
,
this
.
parent
)
if
(
Store
.
isCatcher
())
{
if
(
Store
.
isCatcher
())
{
console
.
log
(
this
,
this
.
parent
)
this
.
parent
.
showSurroundedGrids
(
this
.
x
,
this
.
y
)
// const map = SceneManager.getInstance().gameScene.map
}
}
}
}
public
release
()
{
public
release
()
{
// 移除事件
}
}
}
}
\ No newline at end of file
fe/src/SceneManager.ts
View file @
d68283ed
...
@@ -15,7 +15,7 @@ class SceneManager extends egret.DisplayObjectContainer {
...
@@ -15,7 +15,7 @@ class SceneManager extends egret.DisplayObjectContainer {
this
.
roomScene
=
new
RoomScene
();
this
.
roomScene
=
new
RoomScene
();
this
.
gameScene
=
new
GameScene
();
this
.
gameScene
=
new
GameScene
();
// 默认添加开始场景
// 默认添加开始场景
this
.
addChild
(
this
.
room
Scene
);
this
.
addChild
(
this
.
game
Scene
);
}
}
// 实例化单例获取方法
// 实例化单例获取方法
public
static
getInstance
():
SceneManager
{
public
static
getInstance
():
SceneManager
{
...
...
fe/src/Store.ts
View file @
d68283ed
...
@@ -31,6 +31,6 @@ class Store {
...
@@ -31,6 +31,6 @@ class Store {
static
isCatcher
()
{
static
isCatcher
()
{
return
true
return
true
return
_state
.
role
===
'ghost'
//
return _state.role === 'ghost'
}
}
}
}
\ No newline at end of file
fe/src/scenes/GameScene.ts
View file @
d68283ed
...
@@ -24,9 +24,11 @@ class GameScene extends egret.Sprite {
...
@@ -24,9 +24,11 @@ class GameScene extends egret.Sprite {
this
.
controller
.
addEventListener
(
"position_change"
,
this
.
onPositionChange
,
this
)
this
.
controller
.
addEventListener
(
"position_change"
,
this
.
onPositionChange
,
this
)
this
.
map
=
new
Map
()
this
.
map
=
new
Map
()
this
.
map
.
y
=
15
this
.
map
.
y
=
15
this
.
map
.
x
=
10
this
.
me
.
y
=
15
this
.
me
.
y
=
15
this
.
me
.
x
=
10
this
.
addChild
(
this
.
map
)
this
.
addChild
(
this
.
map
)
this
.
addChild
(
this
.
me
)
this
.
map
.
addChild
(
this
.
me
)
}
}
private
onPositionChange
(
delta
){
private
onPositionChange
(
delta
){
...
...
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