diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 7288c7f..d5a3189 100644 --- a/.idea/caches/build_file_checksums.ser +++ b/.idea/caches/build_file_checksums.ser Binary files differ diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/models/OwnPlayer.java b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/models/OwnPlayer.java index c11ffed..e581f7c 100644 --- a/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/models/OwnPlayer.java +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/models/OwnPlayer.java @@ -7,8 +7,10 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; +import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; +import android.widget.Toast; import net.arnx.jsonic.JSON; @@ -32,7 +34,7 @@ import org.ntlab.radishforandroidstudio.java3d.Material; import org.ntlab.radishforandroidstudio.java3d.Vector3d; -public class OwnPlayer implements PadListener, GameBaseModel, CallBack { +public class OwnPlayer implements PadListener, GameBaseModel, CallBack, OnClickListener { private boolean isTouched = false; private float touchX = 0.0f; private float touchY = 0.0f; @@ -76,6 +78,7 @@ updateCamera(); } + public void setPlayerId(String id) { playerId = id; } @@ -89,11 +92,25 @@ } @Override + public void onClick(View v) { + if(actor.isOnGround()) { + Velocity3D vel = actor.getVelocity(); + vel.setY(vel.getY() + 15); + actor.setVelocity(vel); + System.out.print("Jumpしました。"); + }else{ + System.out.print("地に足がついてない。"); + } + System.out.print("onClick押されましたよ----------------------------------------------------"); + } + + @Override public boolean onEvent(PadEvent event) { Vector3d charaVector3d = actor.getDirection(); charaVector3d.normalize();//キャラの向きを単位ベクトルに MotionEvent motionEvent = event.getMotionEvent(); + if (motionEvent.getAction() == MotionEvent.ACTION_DOWN || motionEvent.getAction() == MotionEvent.ACTION_MOVE) { isTouched = true; touchX = (float) (Math.cos(event.getAngle()) * event.getLength()); @@ -106,7 +123,7 @@ vel.setY(0); actor.setVelocity(vel); isTouched = false; - }// ここのelse if いらなくない? + } return false; } @@ -183,4 +200,6 @@ public void onResponse(String response) { } + + } \ No newline at end of file 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 2009dfb..b7b1af5 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 @@ -1,14 +1,17 @@ package org.ntlab.radishforandroidstudio.cactusClient.views; +import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; 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 android.widget.Button; import org.ntlab.radishforandroidstudio.R; import org.ntlab.radishforandroidstudio.cactusClient.models.CactusModels; @@ -32,16 +35,11 @@ import org.ntlab.radishforandroidstudio.java3d.Vector3d; import org.ntlab.radishforandroidstudio.java3d.Vector3f; -public class PlayerFragment extends RealTime3DFragment { +public class PlayerFragment extends RealTime3DFragment{ private OvergroundActor pocha; RWTPad pad = null; private OwnPlayer player; private OtherPlayerCharactersModel otherPlayerCharactersModel; - - private boolean isScreenTouched = false; - private float touchX = 0.0f; - private float touchY = 0.0f; - public PlayerFragment() { // Required empty public constructor } @@ -102,7 +100,6 @@ modelManager.addModel(otherPlayerCharactersModel); modelManager.setInstanceId(bundle.getString("instanceId")); initGameWindowView(); - return parentView; } @@ -116,7 +113,6 @@ public void initGameWindowView() { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); - RWTUIFragment f = new RWTUIFragment(); f.setListener(this); View uiLayout = parentView.findViewById(R.id.ui_layout); @@ -128,11 +124,10 @@ public void onCreateFragmentEvent(RWTUIFragment f) { pad = (RWTPad) f.findViewById(org.ntlab.radishforandroidstudio.R.id.pad); pad.addListener(player); +// Button button = (Button) f.findViewById(R.id.Button); +// button.setOnClickListener(player); +} - } - public void onClickJumpButton(Vector3d total, Velocity3D vel){ - total.y = vel.getY() + 15; - } } diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/RWT/RWTUIFragment.java b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/RWT/RWTUIFragment.java index 5082cd9..3838cc6 100644 --- a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/RWT/RWTUIFragment.java +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/RWT/RWTUIFragment.java @@ -7,6 +7,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import org.ntlab.radishforandroidstudio.R; @@ -34,7 +35,6 @@ v = inflater.inflate(R.layout.ui_fragment, container, false); RWTPad pad = v.findViewById(R.id.pad); pad.addListener(this); - if (listener != null) { listener.onCreateFragmentEvent(this); } @@ -47,6 +47,7 @@ return false; } + @Override public boolean onEvent(PadEvent event) { return false; diff --git a/app/src/main/res/layout/ui_fragment.xml b/app/src/main/res/layout/ui_fragment.xml index 510af98..edf17da 100644 --- a/app/src/main/res/layout/ui_fragment.xml +++ b/app/src/main/res/layout/ui_fragment.xml @@ -16,16 +16,16 @@ android:layout_marginBottom="44dp" android:text="Button" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/JumpButton" + app:layout_constraintEnd_toStartOf="@+id/Button" app:layout_constraintStart_toStartOf="parent" />