var o0 = require('o0');
var o0Project = require('o0Project');
var o0CC = require('o0CC');
var o0Game = require('o0Game');
cc.Class({
extends: cc.Component,
properties: {
canvas: {
default: null,
type: cc.Canvas
},
camera: {
default: null,
type: cc.Camera
},
UICamera: {
default: null,
type: cc.Camera
},
gameScene:null,
menuNode:null,
DeviceMs:1,
map:null,
mapHit:null,
mapRadius: 200,
chart:null,
TestButton:[],
Filter:null,
LastTime:new Date().getTime(),
},
// use this for initialization
onLoad: function () {
//cc.director.setAnimationInterval(1.0/30);
//cc.game.setFrameRate(30);//模拟器不能正常显示
var self = this;
//cc.director.getPhysicsManager().enabled = true;
//this.cocos.node.x;
//node.parent = this.canvas.node;
//this.label.node.parent = node;
//this.label.node.x = 0;
//this.label.node.y = 0;
//this.label.string = this.text;
//var Snake = require("Snake");
//cc.log("oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo "+Snake);
/*var snake = new cc.Node('snake');
snake.parent = this.camera.node;
snake.addComponent('Snake');/** */
//newSnake(this.camera.node);
this.menuNode = new cc.Node();
this.node.addChild(this.menuNode,1);
this.map = o0CC.addScriptNode(this.node,'cc.Graphics',10);
this.mapHit = o0CC.addScriptNode(this.node,'cc.Graphics',10);
this.chart = o0CC.addScriptNode(this.node,'cc.Graphics',10);
var col = 1;
for(var i = 0;i
=0 && i>=this.Filter.frame.length-30;--i){
var io = this.Filter.frame[i];
var color = 255 - (newestTime - io.time) / 6;
this.map.strokeColor = new cc.Color(255 - color,color,0,255);
this.map.moveTo(lastFrame.acc.x * this.mapRadius, lastFrame.acc.y * this.mapRadius);
this.map.lineTo(io.acc.x * this.mapRadius, io.acc.y * this.mapRadius);
this.map.stroke();
this.map.strokeColor = new cc.Color(color,color,color,255);
this.map.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
this.map.lineTo(io.pos.x * this.mapRadius, io.pos.y * this.mapRadius);
this.map.stroke();
this.map.strokeColor = new cc.Color(255,0,0,255);
this.map.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
this.map.lineTo(io.predict.x * this.mapRadius, io.predict.y * this.mapRadius);
this.map.stroke();/* */
this.map.strokeColor = new cc.Color(255,255,255,255);
this.map.moveTo(lastFrame.gyr.x / 50 * this.mapRadius, lastFrame.gyr.y / 50 * this.mapRadius);
this.map.lineTo(io.gyr.x / 50 * this.mapRadius, io.gyr.y / 50 * this.mapRadius);
this.map.stroke();
this.mapHit.strokeColor = new cc.Color(255 - color,color,0,255);
this.mapHit.moveTo(lastFrame.speed.x * this.mapRadius, lastFrame.speed.y * this.mapRadius);
this.mapHit.lineTo(io.speed.x * this.mapRadius, io.speed.y * this.mapRadius);
this.mapHit.stroke();
lastFrame = io;
}
if(this.Filter.frameHit.length > 0){
var lastFrameHit = this.Filter.frameHit[this.Filter.frameHit.length-1];
var firstFrameHit = this.Filter.frameHit[0];
this.mapHit.lineWidth = 2;
/*
this.mapHit.strokeColor = new cc.Color(255,0,0,255);
this.mapHit.moveTo(0,10);
this.mapHit.lineTo(lastFrameHit.pos.x* this.mapRadius,10+ lastFrameHit.pos.y* this.mapRadius);
this.mapHit.stroke();/** */
var direction = new o0.Vector2(0,0);
var directionDistance = 0;
for(var fi = 1;fi=0;--i){
var io = this.Filter.frameHit[i];
var color = 255 - (newestTime - io.time);
/*
this.mapHit.strokeColor = new cc.Color(color,color,color,255);
this.mapHit.moveTo(lastFrameHit.pos.x * this.mapRadius, lastFrameHit.pos.y * this.mapRadius);
this.mapHit.lineTo(io.pos.x * this.mapRadius, io.pos.y * this.mapRadius);
this.mapHit.stroke();/* */
this.mapHit.strokeColor = new cc.Color(color,color,color,255);
this.mapHit.moveTo((lastFrameHit.gyr.x - firstFrameHit.gyr.x)*5,(lastFrameHit.gyr.y - firstFrameHit.gyr.y)*5);
this.mapHit.lineTo((io.gyr.x - firstFrameHit.gyr.x)*5,(io.gyr.y - firstFrameHit.gyr.y)*5);
this.mapHit.stroke();
/*
this.mapHit.strokeColor = new cc.Color(255,0,0,255);
this.mapHit.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
this.mapHit.lineTo(io.predict.x * this.mapRadius, io.predict.y * this.mapRadius);
this.mapHit.stroke();/* */
/*
this.map.circle(lastFrame.pos.x * this.mapRadius, lastFrame.pos.z * this.mapRadius, 1);
this.map.fillColor = new cc.Color(255,0,0,255);
this.map.fill();/* */
lastFrameHit = io;
}
}
this.TestButton[0][0].name = "power";
for(var i = this.Filter.frame.length-1;i>=0;--i){
var io = this.Filter.frame[i];
if(io.hit != 0){
this.TestButton[0][1].name = io.hit;
break;
}
}
/*
this.TestButton[1][12].name = this.Filter.angle;
this.TestButton[3][12].name = this.Filter.punchCount;
this.TestButton[2][12].name = this.Filter.leftRight;
for(var i =0;i=0;--j){
this.TestButton[i][j+1].name = this.TestButton[i][j].name;
this.TestButton[i][j+1].button.normalColor = this.TestButton[i][j].button.normalColor;
}
}/* */
}
});