diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/views/PlayerFragment.java b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/views/PlayerFragment.java index 00ca820..57a8743 100644 --- a/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/views/PlayerFragment.java +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/views/PlayerFragment.java @@ -6,26 +6,20 @@ import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import org.ntlab.radishforandroidstudio.R; +import org.ntlab.radishforandroidstudio.cactusClient.models.CactusModels; +import org.ntlab.radishforandroidstudio.cactusClient.models.OtherPlayerCharactersModel; import org.ntlab.radishforandroidstudio.cactusClient.models.OwnPlayer; import org.ntlab.radishforandroidstudio.cactusClient.models.Player; import org.ntlab.radishforandroidstudio.framework.RWT.RWTPad; import org.ntlab.radishforandroidstudio.framework.RWT.RWTUIFragment; -import org.ntlab.radishforandroidstudio.framework.animation.Animation3D; -import org.ntlab.radishforandroidstudio.framework.event.PadEvent; import org.ntlab.radishforandroidstudio.framework.gameMain.OvergroundActor; import org.ntlab.radishforandroidstudio.framework.gameMain.RealTime3DFragment; -import org.ntlab.radishforandroidstudio.framework.listener.PadListener; import org.ntlab.radishforandroidstudio.framework.model3D.BaseObject3D; -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.physics.Ground; -import org.ntlab.radishforandroidstudio.framework.physics.Velocity3D; import org.ntlab.radishforandroidstudio.java3d.AmbientLight; import org.ntlab.radishforandroidstudio.java3d.Appearance; import org.ntlab.radishforandroidstudio.java3d.Color3f; @@ -33,13 +27,13 @@ import org.ntlab.radishforandroidstudio.java3d.IndexedTriangleArray; import org.ntlab.radishforandroidstudio.java3d.Material; import org.ntlab.radishforandroidstudio.java3d.Point3d; -import org.ntlab.radishforandroidstudio.java3d.Vector3d; import org.ntlab.radishforandroidstudio.java3d.Vector3f; public class PlayerFragment extends RealTime3DFragment { private OvergroundActor pocha; RWTPad pad = null; private OwnPlayer player; + private OtherPlayerCharactersModel otherPlayerCharactersModel; public PlayerFragment() { // Required empty public constructor @@ -47,8 +41,9 @@ @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + modelManager = new CactusModels(this, universe); + //環境光 AmbientLight amblight = new AmbientLight(new Color3f(1.0f, 1.0f, 1.0f)); @@ -91,17 +86,21 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); Bundle bundle = getArguments(); - - // プレイヤーの作成 - player = new OwnPlayer((Player)bundle.getSerializable("player"), getResources(), universe, camera); - + // プレイヤーの作成とインスタンスIDのセット + String playerId = bundle.getString("playerId"); + player = new OwnPlayer((Player)bundle.getSerializable("player"), getResources(), universe, camera, playerId); + modelManager.addModel(player); + otherPlayerCharactersModel = new OtherPlayerCharactersModel(this, universe); + otherPlayerCharactersModel.setPlayerId(playerId); + modelManager.addModel(otherPlayerCharactersModel); + modelManager.setInstanceId(bundle.getString("instanceId")); initGameWindowView(); return parentView; } @Override protected void progress(long interval) { - player.progress(interval); + super.progress(interval); } @@ -122,4 +121,5 @@ pad = (RWTPad) f.findViewById(org.ntlab.radishforandroidstudio.R.id.pad); pad.addListener(player); } -} \ No newline at end of file +} +