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", {
"type":"image", "name": "bg_jpg",
"url":"assets/bg.jpg" "type": "image",
}, "url": "assets/bg.jpg"
{ },
"name":"egret_icon_png", {
"type":"image", "name": "egret_icon_png",
"url":"assets/egret_icon.png" "type": "image",
}, "url": "assets/egret_icon.png"
{ },
"name":"description_json", {
"type":"json", "name": "description_json",
"url":"config/description.json" "type": "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 control = new egret.Shape();
private pointtt = new egret.Shape();
private controlCenter = new egret.Point(1100, 450)
// 初始化(给开始按钮绑定点击事件) private up = new egret.Shape()
private down = new egret.Shape()
private left = new egret.Shape()
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)
let texture: egret.Texture = RES.getRes("control_jpg")
this.control.texture = texture
this.touchEnabled = true let controlContainer = new egret.Sprite()
this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this) this.addChild(controlContainer)
this.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.controlTouchMove, this) controlContainer.x = 1040
this.addEventListener(egret.TouchEvent.TOUCH_END, this.controlTouchEnd, this) controlContainer.y = 450
this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this) controlContainer.addChild(this.control)
}
private onEnterFrame(e: egret.Event){ this.up.graphics.beginFill(0xFF00FF, 1)
if(this.touchEnd){ this.up.graphics.drawRect(93, 0, 80, 80)
return this.up.graphics.endFill()
} this.up.touchEnabled = true
this.pointtt.x += this.speedX this.up.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
this.pointtt.y += this.speedY
}
private touchEnd = false this.down.graphics.beginFill(0xFF00FF, 1)
private controlTouchBegin(e: egret.TouchEvent){ this.down.graphics.drawRect(93, 186, 80, 80)
this.touchEnd = false 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)
this.right.graphics.beginFill(0xFF00FF, 1)
this.right.graphics.drawRect(186, 93, 80, 80)
this.right.graphics.endFill()
this.right.touchEnabled = true
this.right.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
private controlTouchMove(e: egret.TouchEvent){ controlContainer.addChild(this.up)
var angle = Math.atan2(e.stageY - this.controlCenter.y, e.stageX - this.controlCenter.x ) controlContainer.addChild(this.down)
// console.error(e) controlContainer.addChild(this.left)
this.speedX = Math.cos(angle)*this.speed; controlContainer.addChild(this.right)
this.speedY = Math.sin(angle)*this.speed;
// console.error(this.speedX)
// console.error(e.stageX)
} }
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