Améliorations graphiques
This commit is contained in:
parent
763eb69d93
commit
c924564bf1
@ -7,8 +7,8 @@ android {
|
||||
applicationId "fr.ynerant.tarot"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 5
|
||||
versionName "0.2.1"
|
||||
versionCode 6
|
||||
versionName "0.2.2"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -28,6 +28,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import fr.ynerant.tarot.ui.games.GameInfoFragment;
|
||||
|
||||
public class Game {
|
||||
private static final Gson GSON;
|
||||
@SuppressLint("UseSparseArrays")
|
||||
@ -357,6 +359,12 @@ public class Game {
|
||||
|
||||
final List<Game> games = GSON.fromJson(new InputStreamReader(co.getInputStream()), new TypeToken<ArrayList<Game>>(){}.getType());
|
||||
GAMES.clear();
|
||||
|
||||
for (Player p : Player.getAllPlayers()) {
|
||||
for (GameType type : GameType.values())
|
||||
p.setScore(type, 0);
|
||||
}
|
||||
|
||||
for (Game g : games) {
|
||||
GAMES.put(g.getId(), g);
|
||||
|
||||
@ -395,16 +403,7 @@ public class Game {
|
||||
if (g.player6 != null)
|
||||
g.getMiseries().add(g.misery6);
|
||||
|
||||
g.points = new ArrayList<>();
|
||||
g.points.add(g.score1);
|
||||
g.points.add(g.score2);
|
||||
g.points.add(g.score3);
|
||||
if (g.player4 != null)
|
||||
g.points.add(g.score4);
|
||||
if (g.player5 != null)
|
||||
g.points.add(g.score5);
|
||||
if (g.player6 != null)
|
||||
g.points.add(g.score6);
|
||||
g.calculateScores();
|
||||
|
||||
for (Player p : g.getPlayers()) {
|
||||
p.addScore(g.getGameType(), g.getPoints(p));
|
||||
|
@ -514,6 +514,22 @@ public class NewGameFragment extends Fragment {
|
||||
co.disconnect();
|
||||
|
||||
Game.updateGames();
|
||||
|
||||
MainActivity.INSTANCE.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
totalPoints[i].setText(String.valueOf(((Player) spinners[i].getSelectedItem()).getScore(Game.GameType.values()[nb_players.getProgress()])));
|
||||
miseries[i].setChecked(false);
|
||||
handles[i].setAlpha(1.0F);
|
||||
handles[i].setText(R.string.handle0);
|
||||
}
|
||||
|
||||
little_end.setProgress(0);
|
||||
chelem_announced.setChecked(false);
|
||||
chelem_realized.setChecked(false);
|
||||
}
|
||||
});
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -545,17 +561,6 @@ public class NewGameFragment extends Fragment {
|
||||
game.setMiseries(miseriesList);
|
||||
game.calculateScores();
|
||||
|
||||
for (int i = 0; i < game.getGameType().getNbPlayers(); ++i)
|
||||
players.get(i).addScore(game.getGameType(), game.getPoints(players.get(i)));
|
||||
|
||||
MainActivity.INSTANCE.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < 6; ++i)
|
||||
totalPoints[i].setText(String.valueOf(((Player) spinners[i].getSelectedItem()).getScore(Game.GameType.values()[nb_players.getProgress()])));
|
||||
}
|
||||
});
|
||||
|
||||
return game;
|
||||
}
|
||||
});
|
||||
|
@ -21,7 +21,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
android:textAlignment="center"
|
||||
android:stretchColumns="0,1,2,3,4,5">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
|
@ -597,10 +597,11 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
android:textAlignment="center"
|
||||
android:stretchColumns="0,1,2,3,4,5">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
|
@ -6,7 +6,8 @@
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="0,1">
|
||||
|
||||
<TableRow>
|
||||
<TextView
|
||||
@ -19,8 +20,7 @@
|
||||
android:id="@+id/points3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textAlignment="textEnd"/>
|
||||
android:textSize="18sp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
Loading…
Reference in New Issue
Block a user