| | package org.ntlab.radishforandroidstudio.cactusClient.models; |
---|
| | |
---|
| | import android.content.res.Resources; |
---|
| | import android.view.MotionEvent; |
---|
| | |
---|
| | import net.arnx.jsonic.JSON; |
---|
| | |
---|
| | import org.ntlab.radishforandroidstudio.cactusClient.connections.CharacterConnection; |
---|
| | import org.ntlab.radishforandroidstudio.framework.animation.Animation3D; |
---|
| | import org.ntlab.radishforandroidstudio.framework.event.PadEvent; |
---|
| |
---|
| | import org.ntlab.radishforandroidstudio.framework.listener.PadListener; |
---|
| | import org.ntlab.radishforandroidstudio.framework.model3D.ModelFactory; |
---|
| | import org.ntlab.radishforandroidstudio.framework.model3D.Object3D; |
---|
| | import org.ntlab.radishforandroidstudio.framework.model3D.Position3D; |
---|
| | import org.ntlab.radishforandroidstudio.framework.model3D.Quaternion3D; |
---|
| | import org.ntlab.radishforandroidstudio.framework.model3D.Universe; |
---|
| | import org.ntlab.radishforandroidstudio.framework.network.CallBack; |
---|
| | import org.ntlab.radishforandroidstudio.framework.physics.Solid3D; |
---|
| | import org.ntlab.radishforandroidstudio.framework.physics.Velocity3D; |
---|
| | import org.ntlab.radishforandroidstudio.framework.view3D.Camera3D; |
---|
| | import org.ntlab.radishforandroidstudio.java3d.Appearance; |
---|
| | import org.ntlab.radishforandroidstudio.java3d.Material; |
---|
| |
---|
| | } |
---|
| | |
---|
| | @Override |
---|
| | public void update(double interval) { |
---|
| | // updateCamera(); |
---|
| | // |
---|
| | // if (isTouched) { |
---|
| | // Velocity3D vel = actor.getVelocity(); |
---|
| | // vel.setX(touchX); |
---|
| | // vel.setY(touchY); |
---|
| | // actor.setVelocity(vel); |
---|
| | // } |
---|
| | // |
---|
| | // nextConnectRenaimdTime -= interval; |
---|
| | // if (nextConnectRenaimdTime <= 0 && con != null) { |
---|
| | // nextConnectRenaimdTime = connectInterval; |
---|
| | // |
---|
| | // Quaternion3D q = ((Solid3D)(actor.getBody())).getQuaternion(); |
---|
| | // player.setPosition(actor.getPosition()); |
---|
| | // player.setQuaternion3D(q); |
---|
| | // |
---|
| | // JSON json = new JSON(); |
---|
| | // con.addFormParam("characterID", json.encode(player.getCharacterID())); |
---|
| | // con.addFormParam("cameraState", json.encode(player.getCameraState())); |
---|
| | // con.addFormParam("position", json.encode(player.getPosition())); |
---|
| | // con.addFormParam("animationClassToStart", json.encode(player.getEmoteState())); |
---|
| | // con.addFormParam("angle", "{ \"x\":" + q.getX() + ", \"y\":" + q.getY() + ", \"z\":" + q.getZ() + ", \"w\":" + q.getW() + "}"); |
---|
| | // con.doPut(); |
---|
| | // } |
---|
| | updateCamera(); |
---|
| | |
---|
| | if (isTouched) { |
---|
| | Velocity3D vel = actor.getVelocity(); |
---|
| | vel.setX(touchX); |
---|
| | vel.setY(touchY); |
---|
| | actor.setVelocity(vel); |
---|
| | } |
---|
| | |
---|
| | nextConnectRenaimdTime -= interval; |
---|
| | if (nextConnectRenaimdTime <= 0) { |
---|
| | nextConnectRenaimdTime = connectInterval; |
---|
| | con = new CharacterConnection(playerId); |
---|
| | con.setCallBack(this); |
---|
| | |
---|
| | Quaternion3D q = ((Solid3D)(actor.getBody())).getQuaternion(); |
---|
| | player.setPosition(actor.getPosition()); |
---|
| | player.setQuaternion3D(q); |
---|
| | |
---|
| | JSON json = new JSON(); |
---|
| | con.addFormParam("characterID", json.encode(player.getCharacterID())); |
---|
| | con.addFormParam("cameraState", json.encode(player.getCameraState())); |
---|
| | con.addFormParam("position", json.encode(player.getPosition())); |
---|
| | con.addFormParam("animationClassToStart", json.encode(player.getEmoteState())); |
---|
| | con.addFormParam("angle", "{ \"x\":" + q.getX() + ", \"y\":" + q.getY() + ", \"z\":" + q.getZ() + ", \"w\":" + q.getW() + "}"); |
---|
| | con.doPut(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | @Override |
---|
| | public void setInstanceId(String id) { |
---|
| | player.setInstanceID(id); |
---|
| | playerId = id; |
---|
| | con = new CharacterConnection(playerId); |
---|
| | con.setCallBack(this); |
---|
| | } |
---|
| | |
---|
| | @Override |
---|
| | public void onResponse(String response) { |
---|
| | |