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
1c0c374e
Commit
1c0c374e
authored
May 06, 2018
by
Shawn Wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of cd.i.strikingly.com:shawn.wang/crazyflirt into develop
parents
6381a215
613892d1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
23 deletions
+110
-23
Map.ts
fe/src/Map.ts
+16
-8
Rank.ts
fe/src/Rank.ts
+33
-0
RankGroup.ts
fe/src/RankGroup.ts
+30
-0
GameoverScene.ts
fe/src/scenes/GameoverScene.ts
+29
-15
RoomScene.ts
fe/src/scenes/RoomScene.ts
+2
-0
No files found.
fe/src/Map.ts
View file @
1c0c374e
...
...
@@ -96,27 +96,31 @@ class Map extends egret.Sprite {
centerGrid
.
bg
.
texture
=
RES
.
getRes
(
'grid_select_jpg'
)
const
runners
=
Store
.
getState
().
runners
this
.
touchArea
.
alpha
=
1
//
this.touchArea.alpha = 1
this
.
touchArea
.
x
=
x
-
2
*
gridWidth
this
.
touchArea
.
y
=
y
-
2
*
gridHeight
surroundedGrids
.
forEach
(
grid
=>
{
grid
.
alpha
=
1
})
// const twTouchArea = egret.Tween.get( this.touchArea );
// twTouchArea.to( {alpha: 1}, 300 ).call(function() {
// surroundedGrids.forEach(grid => {
// grid.alpha = 1
// })
const
twTouchArea
=
egret
.
Tween
.
get
(
this
.
touchArea
);
twTouchArea
.
to
(
{
alpha
:
1
},
300
).
call
(
function
()
{
surroundedGrids
.
forEach
(
grid
=>
{
grid
.
alpha
=
1
})
// egret.Tween.get(grid).to({ alpha: 1 }, 300)
})
// surroundedGrids.forEach(grid => {
// egret.Tween.get(grid).to({ alpha: 1 }, 300)
// })
runners
.
forEach
(
runner
=>
{
console
.
log
(
runner
.
x
,
runner
.
y
,
this
.
touchArea
.
hitTestPoint
(
runner
.
x
*
gridWidth
,
runner
.
y
*
gridHeight
))
const
runnerInMap
=
this
.
runnerMap
[
runner
.
t_cid
]
if
(
this
.
touchArea
.
hitTestPoint
(
runnerInMap
.
x
*
gridWidth
,
runnerInMap
.
y
*
gridHeight
))
{
if
(
this
.
touchArea
.
hitTestPoint
(
runnerInMap
.
x
,
runnerInMap
.
y
))
{
runnerInMap
.
alpha
=
1
}
})
this
.
getCatchedRunners
(
x
,
y
).
forEach
(
runner
=>
{
platform
.
sendSocketMessage
({
data
:
JSON
.
stringify
({
type
:
'catch'
,
...
...
@@ -133,6 +137,10 @@ class Map extends egret.Sprite {
if
(
Store
.
isMe
(
runner
.
t_cid
)
||
Store
.
isCatcher
())
{
SoundManager
.
getInstance
().
playCatched
()
}
if
(
Store
.
isCatcher
())
{
this
.
runnerMap
[
runner
.
t_cid
].
alpha
=
0
}
})
setTimeout
(()
=>
{
centerGrid
.
bg
.
texture
=
RES
.
getRes
(
'grid_jpg'
)
...
...
fe/src/Rank.ts
0 → 100644
View file @
1c0c374e
class
Rank
extends
egret
.
Sprite
{
public
constructor
(
userData
)
{
super
()
this
.
init
(
userData
)
}
private
avatar
=
new
egret
.
Bitmap
()
private
bg
=
new
egret
.
Bitmap
()
private
imageLoader
=
new
egret
.
ImageLoader
()
private
init
(
userData
)
{
this
.
bg
.
width
=
100
this
.
bg
.
height
=
100
this
.
bg
.
texture
=
RES
.
getRes
(
"avatar_bg_jpg"
)
this
.
addChild
(
this
.
bg
)
this
.
avatar
.
x
=
10
this
.
avatar
.
y
=
10
this
.
avatar
.
width
=
80
this
.
avatar
.
height
=
80
this
.
imageLoader
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
this
.
loadCompleteHandler
,
this
)
this
.
imageLoader
.
load
(
userData
.
avatar_url
||
"http://www.insajderi.com/wp-content/uploads/2018/01/asdja.jpg"
)
this
.
addChild
(
this
.
avatar
)
}
private
loadCompleteHandler
()
{
let
texture
=
new
egret
.
Texture
()
texture
.
_setBitmapData
(
this
.
imageLoader
.
data
)
this
.
avatar
.
texture
=
texture
}
}
fe/src/RankGroup.ts
0 → 100644
View file @
1c0c374e
class
RankGroup
extends
egret
.
Sprite
{
public
constructor
(
ranks
)
{
super
()
this
.
init
(
ranks
)
}
private
init
(
ranks
)
{
ranks
.
forEach
((
rank
,
index
)
=>
{
let
yPosition
=
index
*
100
let
avatar
=
new
Avatar
(
rank
[
0
])
avatar
.
y
=
yPosition
this
.
addChild
(
avatar
)
let
name
=
new
egret
.
TextField
()
name
.
text
=
rank
[
0
].
nick_name
name
.
y
=
yPosition
+
40
name
.
x
=
120
this
.
addChild
(
name
)
let
score
=
new
egret
.
TextField
()
score
.
text
=
rank
[
1
]
score
.
y
=
yPosition
+
40
score
.
x
=
500
this
.
addChild
(
score
)
})
}
}
\ No newline at end of file
fe/src/scenes/GameoverScene.ts
View file @
1c0c374e
class
GameoverScene
extends
egret
.
Sprite
{
private
startLabel
:
egret
.
TextField
private
players
:
Array
<
any
>
private
avatars
:
any
private
rankGroup
:
any
public
constructor
()
{
super
();
...
...
@@ -15,19 +15,33 @@ class GameoverScene extends egret.Sprite {
this
.
initBg
()
this
.
initEndLabel
()
this
.
initBackLabel
()
// this.initRankGroup()
}
public
update
(
data
)
{
const
payload
=
data
.
payload
switch
(
data
.
type
)
{
case
'game_end'
:
this
.
updateRank
(
payload
)
default
:
break
;
}
}
private
updateRank
(
data
)
{
if
(
this
.
rankGroup
&&
this
.
rankGroup
.
parent
)
{
this
.
rankGroup
.
parent
.
removeChild
(
this
.
rankGroup
)
}
this
.
rankGroup
=
new
RankGroup
(
data
.
rank
)
this
.
rankGroup
.
x
=
400
this
.
rankGroup
.
y
=
250
this
.
addChild
(
this
.
rankGroup
)
}
// private initRankGroup() {
// this.rankGroup
// }
private
initBackLabel
()
{
var
backLabel
=
new
egret
.
TextField
()
backLabel
.
text
=
'< 返回'
...
...
@@ -61,18 +75,18 @@ class GameoverScene extends egret.Sprite {
})
SceneManager
.
getInstance
().
changeScene
(
'roomScene'
)
}
private
initCountDown
(
res
)
{
var
cdText
=
new
egret
.
TextField
()
cdText
.
text
=
'10'
const
timer
=
setInterval
(()
=>
{
if
(
cdText
.
text
==
'0'
)
{
clearInterval
(
timer
)
SceneManager
.
getInstance
().
changeScene
(
'roomScene'
)
return
}
cdText
.
text
=
`
${
Number
(
cdText
.
text
)
-
1
}
`
},
1000
)
}
//
private initCountDown(res) {
//
var cdText = new egret.TextField()
//
cdText.text = '10'
//
const timer = setInterval(() => {
//
if (cdText.text == '0') {
//
clearInterval(timer)
//
SceneManager.getInstance().changeScene('roomScene')
//
return
//
}
//
cdText.text = `${Number(cdText.text) - 1}`
//
}, 1000)
//
}
private
initBg
()
{
var
shape
:
egret
.
Shape
=
new
egret
.
Shape
();
...
...
fe/src/scenes/RoomScene.ts
View file @
1c0c374e
...
...
@@ -49,10 +49,12 @@ class RoomScene extends egret.Sprite {
private
updateStartLabelAndPlayers
(
payload
)
{
const
{
seat
,
members
,
nick_name
}
=
payload
if
(
payload
.
seat
==
0
)
{
this
.
startLabel
.
size
=
egret
.
TextField
.
default_size
this
.
startLabel
.
text
=
'开始'
this
.
startLabel
.
touchEnabled
=
true
this
.
startLabel
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
startHandler
,
this
)
}
else
{
this
.
startLabel
.
size
=
egret
.
TextField
.
default_size
this
.
startLabel
.
text
=
'等待房主点击开始'
this
.
startLabel
.
touchEnabled
=
false
}
...
...
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