Commit 1eebe1f6 by Nick An

Merge branch 'develop' of cd.i.strikingly.com:shawn.wang/crazyflirt into develop

parents 1cf4776c 659607b4
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="ModuleRunConfigurationManager">
<shared />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.0, rbenv: 2.2.2) [gem]" level="application" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.2.2" project-jdk-type="RUBY_SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/crazyflirt.iml" filepath="$PROJECT_DIR$/.idea/crazyflirt.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.3.0'
gemspec
gem 'faye-websocket'
gem 'sinatra'
gem 'rack'
gem 'thin'
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
ruby
DEPENDENCIES
BUNDLED WITH
1.16.0
{ {
"groups":[ "groups": [
{ {
"keys":"bg_jpg,egret_icon_png,description_json", "keys": "bg_jpg,egret_icon_png,description_json,control_jpg,grid_jpg",
"name":"preload" "name": "preload"
}], }
"resources":[ ],
"resources": [
{ {
"name":"bg_jpg", "name": "bg_jpg",
"type":"image", "type": "image",
"url":"assets/bg.jpg" "url": "assets/bg.jpg"
}, },
{ {
"name":"egret_icon_png", "name": "egret_icon_png",
"type":"image", "type": "image",
"url":"assets/egret_icon.png" "url": "assets/egret_icon.png"
}, },
{ {
"name":"description_json", "name": "description_json",
"type":"json", "type": "json",
"url":"config/description.json" "url": "config/description.json"
}] },
{
"name": "control_jpg",
"type": "image",
"url": "assets/control.jpg"
},
{
"name": "grid_jpg",
"type": "image",
"url": "assets/grid.jpg"
}
]
} }
\ No newline at end of file
...@@ -4,59 +4,78 @@ class Controller extends egret.Sprite { ...@@ -4,59 +4,78 @@ class Controller extends egret.Sprite {
this.init() this.init()
} }
private speed = 10 private control = new egret.Bitmap()
private speedX = 0 private panel = new egret.Shape()
private speedY = 0 private pointtt = new egret.Shape()
private p1:egret.Point = new egret.Point();
private p2:egret.Point = new egret.Point(); private up = new egret.Shape()
private control = new egret.Shape(); private down = new egret.Shape()
private pointtt = new egret.Shape(); private left = new egret.Shape()
private controlCenter = new egret.Point(1100, 450) private right = new egret.Shape()
// 初始化(给开始按钮绑定点击事件) // 初始化(给开始按钮绑定点击事件)
private init() { private init() {
this.control.graphics.beginFill( 0xFF3866, 1);
this.control.graphics.drawCircle(1100, 450, 90); this.panel.graphics.beginFill(0x353E5D, 1)
this.control.graphics.endFill(); this.panel.graphics.drawRect(1008, 0, 326, 750)
this.addChild( this.control ); this.panel.graphics.endFill()
this.addChild(this.panel)
this.pointtt.graphics.beginFill(0xFF0000, 1) this.pointtt.graphics.beginFill(0xFF0000, 1)
this.pointtt.graphics.drawCircle(1100, 450, 10) this.pointtt.graphics.drawCircle(667, 375, 15)
this.pointtt.graphics.endFill() this.pointtt.graphics.endFill()
this.addChild(this.pointtt) this.addChild(this.pointtt)
this.touchEnabled = true let texture: egret.Texture = RES.getRes("control_jpg")
this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this) this.control.texture = texture
this.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.controlTouchMove, this)
this.addEventListener(egret.TouchEvent.TOUCH_END, this.controlTouchEnd, this)
this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this)
}
private onEnterFrame(e: egret.Event){ let controlContainer = new egret.Sprite()
if(this.touchEnd){ this.addChild(controlContainer)
return controlContainer.x = 1040
} controlContainer.y = 450
this.pointtt.x += this.speedX controlContainer.addChild(this.control)
this.pointtt.y += this.speedY
}
private touchEnd = false this.up.graphics.beginFill(0xFF00FF, 1)
private controlTouchBegin(e: egret.TouchEvent){ this.up.graphics.drawRect(93, 0, 80, 80)
this.touchEnd = false this.up.graphics.endFill()
} this.up.touchEnabled = true
this.up.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
this.down.graphics.beginFill(0xFF00FF, 1)
this.down.graphics.drawRect(93, 186, 80, 80)
this.down.graphics.endFill()
this.down.touchEnabled = true
this.down.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
this.left.graphics.beginFill(0xFF00FF, 1)
this.left.graphics.drawRect(0, 93, 80, 80)
this.left.graphics.endFill()
this.left.touchEnabled = true
this.left.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
private controlTouchMove(e: egret.TouchEvent){ this.right.graphics.beginFill(0xFF00FF, 1)
var angle = Math.atan2(e.stageY - this.controlCenter.y, e.stageX - this.controlCenter.x ) this.right.graphics.drawRect(186, 93, 80, 80)
// console.error(e) this.right.graphics.endFill()
this.speedX = Math.cos(angle)*this.speed; this.right.touchEnabled = true
this.speedY = Math.sin(angle)*this.speed; this.right.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
// console.error(this.speedX)
// console.error(e.stageX) controlContainer.addChild(this.up)
controlContainer.addChild(this.down)
controlContainer.addChild(this.left)
controlContainer.addChild(this.right)
} }
private controlTouchEnd(e: egret.TouchEvent){ private delta = 72
this.touchEnd = true private controlTouchBegin(e: egret.TouchEvent){
// this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this); if(e.currentTarget === this.up){
this.pointtt.y += this.delta
}else if(e.currentTarget === this.down){
this.pointtt.y -= this.delta
}else if(e.currentTarget === this.left){
this.pointtt.x -= this.delta
}else if(e.currentTarget === this.right){
this.pointtt.x += this.delta
}
} }
public release() { public release() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment