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
a8f4e7df
Commit
a8f4e7df
authored
May 05, 2018
by
Mike Zhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
房间里准备增加头像
parent
6d265e88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
RoomScene.ts
fe/src/scenes/RoomScene.ts
+22
-9
No files found.
fe/src/scenes/RoomScene.ts
View file @
a8f4e7df
...
@@ -2,6 +2,7 @@ class RoomScene extends egret.Sprite {
...
@@ -2,6 +2,7 @@ class RoomScene extends egret.Sprite {
private
startLabel
:
egret
.
TextField
private
startLabel
:
egret
.
TextField
private
players
:
Array
<
any
>
private
players
:
Array
<
any
>
private
playerContainer
:
egret
.
DisplayObjectContainer
public
constructor
()
{
public
constructor
()
{
super
();
super
();
...
@@ -13,8 +14,10 @@ class RoomScene extends egret.Sprite {
...
@@ -13,8 +14,10 @@ class RoomScene extends egret.Sprite {
console
.
log
(
'RoomScene.init'
)
console
.
log
(
'RoomScene.init'
)
this
.
initBg
()
this
.
initBg
()
this
.
initStartLabel
()
this
.
initStartLabel
()
this
.
initPlayerContainer
()
this
.
addChild
(
this
.
startLabel
);
this
.
addChild
(
this
.
startLabel
);
// var sound: egret.Sound = RES.getRes("catched_0_mp3");
// sound.play();
// put display object to this scene
// put display object to this scene
}
}
...
@@ -22,14 +25,7 @@ class RoomScene extends egret.Sprite {
...
@@ -22,14 +25,7 @@ class RoomScene extends egret.Sprite {
switch
(
data
.
type
)
{
switch
(
data
.
type
)
{
case
'entry'
:
case
'entry'
:
const
payload
=
data
.
payload
const
payload
=
data
.
payload
if
(
payload
.
seat
==
0
)
{
this
.
updateStartLabelAndPlayers
(
payload
)
this
.
startLabel
.
text
=
'开始'
this
.
startLabel
.
touchEnabled
=
true
this
.
startLabel
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
startHandler
,
this
)
}
else
{
this
.
startLabel
.
text
=
'等待房主点击开始'
this
.
startLabel
.
touchEnabled
=
false
}
break
;
break
;
case
'game_ready'
:
case
'game_ready'
:
this
.
countDown
(
payload
)
this
.
countDown
(
payload
)
...
@@ -39,6 +35,18 @@ class RoomScene extends egret.Sprite {
...
@@ -39,6 +35,18 @@ class RoomScene extends egret.Sprite {
}
}
private
updateStartLabelAndPlayers
(
payload
)
{
if
(
payload
.
seat
==
0
)
{
this
.
startLabel
.
text
=
'开始'
this
.
startLabel
.
touchEnabled
=
true
this
.
startLabel
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
startHandler
,
this
)
}
else
{
this
.
startLabel
.
text
=
'等待房主点击开始'
this
.
startLabel
.
touchEnabled
=
false
}
const
members
=
payload
.
members
this
.
addChild
(
this
.
playerContainer
)
}
private
countDown
(
res
)
{
private
countDown
(
res
)
{
this
.
startLabel
.
text
=
'3'
this
.
startLabel
.
text
=
'3'
const
timer
=
setInterval
(()
=>
{
const
timer
=
setInterval
(()
=>
{
...
@@ -77,6 +85,11 @@ class RoomScene extends egret.Sprite {
...
@@ -77,6 +85,11 @@ class RoomScene extends egret.Sprite {
this
.
startLabel
.
textAlign
=
egret
.
HorizontalAlign
.
CENTER
;
this
.
startLabel
.
textAlign
=
egret
.
HorizontalAlign
.
CENTER
;
this
.
startLabel
.
y
=
1136
/
2
this
.
startLabel
.
y
=
1136
/
2
}
}
private
initPlayerContainer
()
{
this
.
playerContainer
=
new
egret
.
DisplayObjectContainer
()
this
.
playerContainer
.
width
=
600
this
.
playerContainer
.
height
=
200
}
private
startHandler
()
{
private
startHandler
()
{
console
.
log
(
'starthandler'
)
console
.
log
(
'starthandler'
)
...
...
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