Affichage des totaux des joueurs en cours

This commit is contained in:
ynerant 2019-12-05 00:18:48 +01:00
parent edb1183f95
commit a6bd3fe1c0
3 changed files with 62 additions and 3 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "fr.ynerant.tarot"
minSdkVersion 24
targetSdkVersion 29
versionCode 2
versionName "0.0.1"
versionCode 3
versionName "0.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {

View File

@ -133,6 +133,13 @@ public class NewGameFragment extends Fragment {
final TextView points5 = root.findViewById(R.id.player5_points);
final TextView points6 = root.findViewById(R.id.player6_points);
final TextView[] points = new TextView[]{points1, points2, points3, points4, points5, points6};
final TextView totalPoints1 = root.findViewById(R.id.player1_total_points);
final TextView totalPoints2 = root.findViewById(R.id.player2_total_points);
final TextView totalPoints3 = root.findViewById(R.id.player3_total_points);
final TextView totalPoints4 = root.findViewById(R.id.player4_total_points);
final TextView totalPoints5 = root.findViewById(R.id.player5_total_points);
final TextView totalPoints6 = root.findViewById(R.id.player6_total_points);
final TextView[] totalPoints = new TextView[]{totalPoints1, totalPoints2, totalPoints3, totalPoints4, totalPoints5, totalPoints6};
final TextView points1Text = root.findViewById(R.id.player1_points_text);
final TextView points2Text = root.findViewById(R.id.player2_points_text);
final TextView points3Text = root.findViewById(R.id.player3_points_text);
@ -203,6 +210,7 @@ public class NewGameFragment extends Fragment {
miseryTexts[i].setText(((Player) spinners[i].getSelectedItem()).getName());
pointsText[i].setText(((Player) spinners[i].getSelectedItem()).getName());
handleTexts[i].setText(((Player) spinners[i].getSelectedItem()).getName());
totalPoints[i].setText(String.valueOf(((Player) spinners[i].getSelectedItem()).getScore(Game.GameType.values()[nb_players.getProgress()])));
}
updateScore.run();
@ -267,6 +275,7 @@ public class NewGameFragment extends Fragment {
misery4.setVisibility(View.GONE);
points4Text.setVisibility(View.GONE);
points4.setVisibility(View.GONE);
totalPoints4.setVisibility(View.GONE);
player5_layout.setVisibility(View.GONE);
handle5Text.setVisibility(View.GONE);
handle5.setVisibility(View.GONE);
@ -274,6 +283,7 @@ public class NewGameFragment extends Fragment {
misery5.setVisibility(View.GONE);
points5Text.setVisibility(View.GONE);
points5.setVisibility(View.GONE);
totalPoints5.setVisibility(View.GONE);
player6_layout.setVisibility(View.GONE);
handle6Text.setVisibility(View.GONE);
handle6.setVisibility(View.GONE);
@ -281,6 +291,7 @@ public class NewGameFragment extends Fragment {
misery6.setVisibility(View.GONE);
points6Text.setVisibility(View.GONE);
points6.setVisibility(View.GONE);
totalPoints6.setVisibility(View.GONE);
follower_layout.setVisibility(View.GONE);
switch (progress + 3) {
@ -292,6 +303,7 @@ public class NewGameFragment extends Fragment {
misery6.setVisibility(View.VISIBLE);
points6Text.setVisibility(View.VISIBLE);
points6.setVisibility(View.VISIBLE);
totalPoints6.setVisibility(View.VISIBLE);
case 5:
player5_layout.setVisibility(View.VISIBLE);
handle5Text.setVisibility(View.VISIBLE);
@ -300,6 +312,7 @@ public class NewGameFragment extends Fragment {
misery5.setVisibility(View.VISIBLE);
points5Text.setVisibility(View.VISIBLE);
points5.setVisibility(View.VISIBLE);
totalPoints5.setVisibility(View.VISIBLE);
follower_layout.setVisibility(View.VISIBLE);
case 4:
player4_layout.setVisibility(View.VISIBLE);
@ -309,11 +322,15 @@ public class NewGameFragment extends Fragment {
misery4.setVisibility(View.VISIBLE);
points4Text.setVisibility(View.VISIBLE);
points4.setVisibility(View.VISIBLE);
totalPoints4.setVisibility(View.VISIBLE);
}
little_end.setMax(progress + 3);
for (int i = 0; i < 6; ++i)
totalPoints[i].setText(String.valueOf(((Player) spinners[i].getSelectedItem()).getScore(Game.GameType.values()[nb_players.getProgress()])));
updatePlayers.onItemSelected(null, null, 0, 0);
updateScore.run();
}
@ -490,7 +507,6 @@ public class NewGameFragment extends Fragment {
co.setRequestProperty("json", g.toJson());
co.connect();
co.getResponseCode();
System.out.println(IOUtils.readLines(co.getInputStream()));
co.disconnect();
Game.updateGames();

View File

@ -694,6 +694,49 @@
android:visibility="gone" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/player1_total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp" />
<TextView
android:id="@+id/player2_total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp" />
<TextView
android:id="@+id/player3_total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp" />
<TextView
android:id="@+id/player4_total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp" />
<TextView
android:id="@+id/player5_total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:visibility="gone" />
<TextView
android:id="@+id/player6_total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:visibility="gone" />
</TableRow>
</TableLayout>
</HorizontalScrollView>