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
10ba22f7
Commit
10ba22f7
authored
May 05, 2018
by
Shawn Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control refactor
parent
659607b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
15 deletions
+24
-15
control.jpg
fe/resource/assets/control.jpg
+0
-0
Controller.ts
fe/src/Controller.ts
+8
-13
GameScene.ts
fe/src/scenes/GameScene.ts
+16
-2
No files found.
fe/resource/assets/control.jpg
View replaced file @
659607b4
View file @
10ba22f7
22.9 KB
|
W:
|
H:
30.1 KB
|
W:
|
H:
2-up
Swipe
Onion skin
fe/src/Controller.ts
View file @
10ba22f7
...
@@ -6,7 +6,6 @@ class Controller extends egret.Sprite {
...
@@ -6,7 +6,6 @@ class Controller extends egret.Sprite {
private
control
=
new
egret
.
Bitmap
()
private
control
=
new
egret
.
Bitmap
()
private
panel
=
new
egret
.
Shape
()
private
panel
=
new
egret
.
Shape
()
private
pointtt
=
new
egret
.
Shape
()
private
up
=
new
egret
.
Shape
()
private
up
=
new
egret
.
Shape
()
private
down
=
new
egret
.
Shape
()
private
down
=
new
egret
.
Shape
()
...
@@ -20,11 +19,6 @@ class Controller extends egret.Sprite {
...
@@ -20,11 +19,6 @@ class Controller extends egret.Sprite {
this
.
panel
.
graphics
.
drawRect
(
1008
,
0
,
326
,
750
)
this
.
panel
.
graphics
.
drawRect
(
1008
,
0
,
326
,
750
)
this
.
panel
.
graphics
.
endFill
()
this
.
panel
.
graphics
.
endFill
()
this
.
addChild
(
this
.
panel
)
this
.
addChild
(
this
.
panel
)
this
.
pointtt
.
graphics
.
beginFill
(
0xFF0000
,
1
)
this
.
pointtt
.
graphics
.
drawCircle
(
667
,
375
,
15
)
this
.
pointtt
.
graphics
.
endFill
()
this
.
addChild
(
this
.
pointtt
)
let
texture
:
egret
.
Texture
=
RES
.
getRes
(
"control_jpg"
)
let
texture
:
egret
.
Texture
=
RES
.
getRes
(
"control_jpg"
)
this
.
control
.
texture
=
texture
this
.
control
.
texture
=
texture
...
@@ -65,20 +59,22 @@ class Controller extends egret.Sprite {
...
@@ -65,20 +59,22 @@ class Controller extends egret.Sprite {
controlContainer
.
addChild
(
this
.
right
)
controlContainer
.
addChild
(
this
.
right
)
}
}
private
delta
=
72
private
controlTouchBegin
(
e
:
egret
.
TouchEvent
){
private
controlTouchBegin
(
e
:
egret
.
TouchEvent
){
const
delta
=
{
x
:
0
,
y
:
0
}
if
(
e
.
currentTarget
===
this
.
up
){
if
(
e
.
currentTarget
===
this
.
up
){
this
.
pointtt
.
y
+=
this
.
delta
delta
.
y
-=
1
}
else
if
(
e
.
currentTarget
===
this
.
down
){
}
else
if
(
e
.
currentTarget
===
this
.
down
){
this
.
pointtt
.
y
-=
this
.
delta
delta
.
y
+=
1
}
else
if
(
e
.
currentTarget
===
this
.
left
){
}
else
if
(
e
.
currentTarget
===
this
.
left
){
this
.
pointtt
.
x
-=
this
.
delta
delta
.
x
-=
1
}
else
if
(
e
.
currentTarget
===
this
.
right
){
}
else
if
(
e
.
currentTarget
===
this
.
right
){
this
.
pointtt
.
x
+=
this
.
delta
delta
.
x
+=
1
}
}
this
.
dispatchEventWith
(
"position_change"
,
false
,
delta
)
}
}
public
release
()
{
public
release
()
{
// 移除事件
// 移除事件
}
}
}
}
\ No newline at end of file
fe/src/scenes/GameScene.ts
View file @
10ba22f7
class
GameScene
extends
egret
.
Sprite
{
class
GameScene
extends
egret
.
Sprite
{
private
controller
private
controller
:
egret
.
Sprite
public
constructor
()
{
public
constructor
()
{
super
();
super
();
this
.
init
()
this
.
init
()
}
}
private
pointtt
=
new
egret
.
Shape
()
// 初始化(给开始按钮绑定点击事件)
// 初始化(给开始按钮绑定点击事件)
private
init
()
{
private
init
()
{
// put display object to this scene
// put display object to this scene
this
.
controller
=
new
Controller
()
this
.
controller
=
new
Controller
()
this
.
addChild
(
this
.
controller
)
this
.
addChild
(
this
.
controller
)
this
.
controller
.
addEventListener
(
"position_change"
,
this
.
onPositionChange
,
this
)
this
.
pointtt
.
graphics
.
beginFill
(
0xFF0000
,
1
)
this
.
pointtt
.
graphics
.
drawCircle
(
667
,
375
,
15
)
this
.
pointtt
.
graphics
.
endFill
()
this
.
addChild
(
this
.
pointtt
)
}
private
step
=
72
private
onPositionChange
(
delta
){
this
.
pointtt
.
x
+=
this
.
step
*
delta
.
data
.
x
this
.
pointtt
.
y
+=
this
.
step
*
delta
.
data
.
y
}
}
public
release
()
{
public
release
()
{
...
...
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