path la faute et path des hp+dmg invisible

This commit is contained in:
marc barbier
2021-01-09 12:06:54 +01:00
parent 7fb11f51b0
commit 86657ce1c7
5 changed files with 24 additions and 12 deletions
@@ -21,11 +21,11 @@ public abstract class Card {
* @param c
*/
public Card(String UID,Context c) {
this.attack=getDefaultAttack();
this.health=getDefaultHealth();
if(!(UID == null || c == null)) {
drawableCard = new DrawableCard(this, 0, 0, UID, c);
}
this.attack=getDefaultAttack();
this.health=getDefaultHealth();
}
public int getAttack() {
@@ -90,6 +90,7 @@ public class GameLogicThread extends Thread{
//pickDeck();
//loading textures
Log.i("ressources","loading bitmaps");
Bitmap bitmapYourTurn = BitmapFactory.decodeResource(renderer.getResources(),R.drawable.t_pb_your_turn);
Bitmap bitmapEnemyTurn = BitmapFactory.decodeResource(renderer.getResources(),R.drawable.t_pb_enemy_turn);
Bitmap bitmapBattlePhase = BitmapFactory.decodeResource(renderer.getResources(),R.drawable.t_pb_battlephase);
@@ -97,6 +98,7 @@ public class GameLogicThread extends Thread{
Bitmap bitmapVictory = BitmapFactory.decodeResource(cont.getResources(), R.drawable.t_pb_victory);
Bitmap bitmapDefeat = BitmapFactory.decodeResource(cont.getResources(), R.drawable.t_pb_defeat);
Log.i("loading","prefs");
SharedPreferences sharedPref = gameActivity.getSharedPreferences("handicape",Context.MODE_PRIVATE);
boolean modeHandicape = sharedPref.getBoolean(gameActivity.getString(R.string.handicape), false);
@@ -109,6 +111,8 @@ public class GameLogicThread extends Thread{
}
Log.i("ressources","base ressources loaded");
//adding the background
renderer.addToDraw(new DrawableBitmap(bitmapBackground, 0,0, "background", 100, 100 ));
//drawHandPreview();
@@ -119,9 +123,7 @@ public class GameLogicThread extends Thread{
final int port = 17057;
//gameativity.finish() n'etait pas utilisable il fermais l'application
Intent intent = new Intent(gameActivity,MainActivity.class);
//on reset le top et recrée l'activité principale
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
try {
Socket client = new Socket(host, port);
coms= new Communication(client);
@@ -129,7 +131,7 @@ public class GameLogicThread extends Thread{
Log.e("ERROR SERVER DEAD","srv");
gameActivity.runOnUiThread(new PopupRunable("erreur de comunication avec le serveur",gameActivity));
renderer.terminate();
gameActivity.startActivity(intent);
returnToTheMainActivity();
return;
}
renderer.updateFrame();
@@ -235,7 +237,7 @@ public class GameLogicThread extends Thread{
renderer.updateFrame();
cancelled = true;
currentThread().sleep(2000);
gameActivity.startActivity(intent);
returnToTheMainActivity();
break;
case Command.LOSE:
//on termine la partie
@@ -245,7 +247,7 @@ public class GameLogicThread extends Thread{
cancelled=true;
currentThread().sleep(2000);
//gameativity.finish() n'etait pas utilisable il fermais l'application
gameActivity.startActivity(intent);
returnToTheMainActivity();
break;
case Command.PING:
coms.send(Command.PONG);
@@ -378,6 +380,18 @@ public class GameLogicThread extends Thread{
}
}
private void returnToTheMainActivity() {
gameActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(gameActivity,MainActivity.class);
//on reset le top et recrée l'activité principale
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
gameActivity.startActivity(intent);
}
});
}
/**
* cette methode permet d'afficher la main
*/