Commit 0560d11b authored by Rominho15's avatar Rominho15
Browse files

Version 9.4.2 : 2e essai de Bluetooth + changement du score selon la difficulté

parent 96742ccf
......@@ -203,7 +203,7 @@ public class GameController {
vx*=-1;
giveBonus(b.getX()+b.getWidth()/2,b.getY()+b.getHeight()/2);
brickGroup.destroyBrick(b);
gameModel.getEvents().addScore();
gameModel.getEvents().addScore(niveau);
if(gameModel.getNbBricks() == 0) {
this.endGame(true);
}
......@@ -215,7 +215,7 @@ public class GameController {
mp.start();
gameModel.destroyShoot();
brickGroup.destroyBrick(b);
gameModel.getEvents().addScore();
gameModel.getEvents().addScore(niveau);
if(gameModel.getNbBricks() == 0) {
this.endGame(true);
}
......
......@@ -14,7 +14,7 @@ public class Evenements {
this.score = score;
}
public void addScore() {
this.score += 10;
public void addScore(int niveau) {
this.score += 5*(niveau+1);
}
}
......@@ -3,43 +3,47 @@ package com.example.rleger.cassebrique.Online;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.util.Log;
import java.io.IOException;
import java.util.UUID;
/**
* Created by Utilisateur on 19/01/2016.
*/
public class ConnectSessionThread extends Thread {
/*private final BluetoothSocket mmSocket;
private final BluetoothDevice mmDevice;
private BluetoothSocket bTSocket;
public ConnectSessionThread(BluetoothDevice device) {
BluetoothSocket tmp = null;
mmDevice = device;
public boolean connect(BluetoothDevice bTDevice, UUID mUUID) {
BluetoothSocket temp = null;
try {
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
} catch (IOException e) { }
mmSocket = tmp;
}
public void run() {
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
bluetoothAdapter.cancelDiscovery();
temp = bTDevice.createRfcommSocketToServiceRecord(mUUID);
} catch (IOException e) {
Log.d("CONNECTTHREAD","Could not create RFCOMM socket:" + e.toString());
return false;
}
try {
mmSocket.connect();
} catch (IOException connectException) {
bTSocket.connect();
} catch(IOException e) {
Log.d("CONNECTTHREAD","Could not connect: " + e.toString());
try {
mmSocket.close();
} catch (IOException closeException) { }
return;
bTSocket.close();
} catch(IOException close) {
Log.d("CONNECTTHREAD", "Could not close connection:" + e.toString());
return false;
}
}
manageConnectedSocket(mmSocket);
return true;
}
public void cancel() {
public boolean cancel() {
try {
mmSocket.close();
} catch (IOException e) { }
bTSocket.close();
} catch(IOException e) {
Log.d("CONNECTTHREAD", "Could not close connection:" + e.toString());
return false;
}
return true;
}
*/
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment