Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LEGER ROMAIN
CasseBrique
Commits
0560d11b
Commit
0560d11b
authored
Jan 23, 2016
by
Rominho15
Browse files
Version 9.4.2 : 2e essai de Bluetooth + changement du score selon la difficulté
parent
96742ccf
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/example/rleger/cassebrique/Controller/GameController.java
View file @
0560d11b
...
...
@@ -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
);
}
...
...
app/src/main/java/com/example/rleger/cassebrique/Model/Evenements.java
View file @
0560d11b
...
...
@@ -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
)
;
}
}
app/src/main/java/com/example/rleger/cassebrique/Online/ConnectSessionThread.java
View file @
0560d11b
...
...
@@ -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
;
}
*/
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment