StatsDialog: completed functionality, needs more styling
This commit is contained in:
parent
2f8895ff17
commit
31cb472e86
2 changed files with 24 additions and 18 deletions
|
@ -1,6 +1,5 @@
|
||||||
package com.kauron.dungeonmanager;
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
|
||||||
|
@ -63,12 +62,12 @@ class Player implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Values for attack
|
* Values for attack
|
||||||
*/
|
*/
|
||||||
public static final int STR = 0, CON = 1, DEX = 2, INT = 3, WIS = 4, CHA = 5;
|
public static final int STR = 1, CON = 2, DEX = 3, INT = 4, WIS = 5, CHA = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Values for defenses
|
* Values for defenses
|
||||||
*/
|
*/
|
||||||
public static final int AC = 0, FORT = 1, REF = 2, WILL = 3;
|
public static final int AC = 1, FORT = 2, REF = 3, WILL = 4;
|
||||||
|
|
||||||
//TODO: develop abilities like attacks, with a popup
|
//TODO: develop abilities like attacks, with a popup
|
||||||
//could be introduced by the player in a introduction screen, with ticks for train and bonuses
|
//could be introduced by the player in a introduction screen, with ticks for train and bonuses
|
||||||
|
@ -79,7 +78,7 @@ class Player implements Serializable {
|
||||||
"Habilidades", "Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
|
"Habilidades", "Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
|
||||||
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
|
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
|
||||||
"Religión", "Sanar", "Sigilo"
|
"Religión", "Sanar", "Sigilo"
|
||||||
};
|
}; //TODO: move the names to a string-array in the res/values folder
|
||||||
|
|
||||||
public static final int[] ABILITY_BOOST = new int[] {
|
public static final int[] ABILITY_BOOST = new int[] {
|
||||||
-1, DEX, CON, INT, STR, CHA, WIS, CHA, INT, CHA, DEX, WIS, WIS, WIS, CHA, INT, WIS, DEX
|
-1, DEX, CON, INT, STR, CHA, WIS, CHA, INT, CHA, DEX, WIS, WIS, WIS, CHA, INT, WIS, DEX
|
||||||
|
@ -110,8 +109,9 @@ class Player implements Serializable {
|
||||||
setLevel();
|
setLevel();
|
||||||
this.raceInt = p.getInt(RACE, 0);
|
this.raceInt = p.getInt(RACE, 0);
|
||||||
this.classInt = p.getInt(CLASS, 0);
|
this.classInt = p.getInt(CLASS, 0);
|
||||||
this.def = new int[4];
|
this.def = new int[5];
|
||||||
setAtk(new int[] {
|
setAtk(new int[] {
|
||||||
|
0,
|
||||||
p.getInt("fue", 10),
|
p.getInt("fue", 10),
|
||||||
p.getInt("con", 10),
|
p.getInt("con", 10),
|
||||||
p.getInt("des", 10),
|
p.getInt("des", 10),
|
||||||
|
@ -207,16 +207,8 @@ class Player implements Serializable {
|
||||||
|
|
||||||
private void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
|
private void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
|
||||||
|
|
||||||
int getFue() {return atk[STR];}
|
int[] getAtk() {return atk;}
|
||||||
int getCon() {return atk[CON];}
|
int[] getDef() {return def;}
|
||||||
int getSab() {return atk[WIS];}
|
|
||||||
int getCar() {return atk[CHA];}
|
|
||||||
int getDes() {return atk[DEX];}
|
|
||||||
int getInt() {return atk[INT];}
|
|
||||||
int getCa() {return def[AC];}
|
|
||||||
int getFort() {return def[FORT];}
|
|
||||||
int getRef() {return def[REF];}
|
|
||||||
int getVol() {return def[WILL];}
|
|
||||||
|
|
||||||
private void setClass() {
|
private void setClass() {
|
||||||
maxHp = atk[CON] + CLASS_STATS[INITIAL_HP][classInt]
|
maxHp = atk[CON] + CLASS_STATS[INITIAL_HP][classInt]
|
||||||
|
|
|
@ -230,9 +230,23 @@ public class ShowPlayer extends ActionBarActivity {
|
||||||
final Dialog dialog = new Dialog(ShowPlayer.this);
|
final Dialog dialog = new Dialog(ShowPlayer.this);
|
||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
dialog.setContentView(R.layout.stats_dialog);
|
dialog.setContentView(R.layout.stats_dialog);
|
||||||
//TODO: finish him!
|
|
||||||
|
String[] atkString = getResources().getStringArray(R.array.atk);
|
||||||
|
int[] atk = player.getAtk();
|
||||||
|
((TextView)dialog.findViewById(R.id.STR)).setText(atkString[Player.STR] + ": " + atk[Player.STR]);
|
||||||
|
((TextView)dialog.findViewById(R.id.CON)).setText(atkString[Player.CON] + ": " + atk[Player.CON]);
|
||||||
|
((TextView)dialog.findViewById(R.id.CHA)).setText(atkString[Player.CHA] + ": " + atk[Player.CHA]);
|
||||||
|
((TextView)dialog.findViewById(R.id.DEX)).setText(atkString[Player.DEX] + ": " + atk[Player.DEX]);
|
||||||
|
((TextView)dialog.findViewById(R.id.WIS)).setText(atkString[Player.WIS] + ": " + atk[Player.WIS]);
|
||||||
|
((TextView)dialog.findViewById(R.id.INT)).setText(atkString[Player.INT] + ": " + atk[Player.INT]);
|
||||||
|
|
||||||
|
String[] defString = getResources().getStringArray(R.array.def);
|
||||||
|
int[] def = player.getDef();
|
||||||
|
((TextView)dialog.findViewById(R.id.AC)).setText(defString[Player.AC] + ": " + def[Player.AC]);
|
||||||
|
((TextView)dialog.findViewById(R.id.FORT)).setText(defString[Player.FORT] + ": " + def[Player.FORT]);
|
||||||
|
((TextView)dialog.findViewById(R.id.REF)).setText(defString[Player.REF] + ": " + def[Player.REF]);
|
||||||
|
((TextView)dialog.findViewById(R.id.WILL)).setText(defString[Player.WILL] + ": " + def[Player.WILL]);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
Toast.makeText(getApplicationContext(), "Not ready yet", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void levelUp() {
|
private void levelUp() {
|
||||||
|
@ -406,7 +420,7 @@ public class ShowPlayer extends ActionBarActivity {
|
||||||
})
|
})
|
||||||
.actionColor(getResources().getColor(R.color.yellow))
|
.actionColor(getResources().getColor(R.color.yellow))
|
||||||
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
|
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
|
||||||
,activity); // action button's
|
,activity); // action button's
|
||||||
p.edit().putInt("pg", player.getHp()).apply();
|
p.edit().putInt("pg", player.getHp()).apply();
|
||||||
hpUpdate();
|
hpUpdate();
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
|
Reference in a new issue