1
0
Fork 0

Bug fixing and further development

This commit is contained in:
Carlos Galindo 2015-02-21 00:13:39 +01:00
parent 9aeb975ffb
commit 91e8eed8b0
8 changed files with 53 additions and 14 deletions

View file

@ -8,8 +8,6 @@
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />

View file

@ -9,7 +9,6 @@
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />

View file

@ -95,6 +95,8 @@ public class MainActivity extends ActionBarActivity
startActivity(intent);
} else if (id == R.id.action_save) {
saveData();
} else if (id == R.id.action_load) {
restoreData();
}
return super.onOptionsItemSelected(item);
@ -122,7 +124,6 @@ public class MainActivity extends ActionBarActivity
protected void onStop() {
super.onStop();
Log.e("UTIL", "stop");
saveData();
}
@Override
@ -149,6 +150,13 @@ public class MainActivity extends ActionBarActivity
Toast.LENGTH_LONG
).show();
}
((TextView) findViewById(R.id.curativeEffortsText)).setText(
getString(R.string.curative_display_text1) + " " +
player.getCurativeEfforts() + " " +
getString(R.string.curative_display_text2) + " " +
player.getMaxCurativeEfforts() + " " +
getString(R.string.curative_display_text3)
);
healthStatusCheck();
}
}
@ -162,7 +170,6 @@ public class MainActivity extends ActionBarActivity
input.setInputType(InputType.TYPE_CLASS_NUMBER);
input.setHint(R.string.suffer_damage_hint);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@ -199,7 +206,13 @@ public class MainActivity extends ActionBarActivity
Button pg = (Button) findViewById(R.id.pgCurrent);
pg.setText(String.valueOf(player.getPg()));
if (status == Player.MUERTO) {
pg.setText("");
pg.setTextColor(Color.BLACK);
pg.setBackgroundColor(Color.RED);
Toast.makeText(
getApplicationContext(),
R.string.message_death,
Toast.LENGTH_LONG
).show();
} else if (status == Player.DEBILITADO)
pg.setTextColor(Color.RED);
else if (status == Player.MALHERIDO)
@ -233,7 +246,7 @@ public class MainActivity extends ActionBarActivity
((TextView) findViewById(R.id.raceText)).setText(player.getRaceName());
((TextView) findViewById(R.id.classText)).setText(player.getClassName());
((TextView) findViewById(R.id.lvl)).setText(String.valueOf(player.getLevel()));
((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(player.getMaxPg()));
((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(player.getPg()));
}
private void saveData() {

View file

@ -80,7 +80,7 @@ public class Player {
if(recovered == USE_CURATIVE_EFFORT){
if(uses && curativeEfforts <= 0) return NOT_CURED;
else {
if(uses) curativeEfforts--;
if(uses && pg < maxPg) curativeEfforts--;
pg += maxPg / 4;
}
} else {

View file

@ -23,7 +23,7 @@
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/pgCurrent"
android:layout_toStartOf="@+id/pgCurrent"
android:id="@+id/linearLayout"
android:id="@+id/basicInfoContainer"
android:layout_alignBottom="@+id/pgCurrent">
<TextView
@ -80,4 +80,21 @@
android:layout_alignTop="@+id/lvlText"
android:layout_marginLeft="10dp" />
</RelativeLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/basicInfoContainer"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/curativeEffortsContainer">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/curativeEffortsText"/>
</LinearLayout>
</RelativeLayout>

View file

@ -13,22 +13,26 @@
android:orderInCategory="2"
app:showAsAction="always"
android:icon="@drawable/ic_action_heal"/>
<item
android:id="@+id/action_load"
android:title="@string/action_load"
android:orderInCategory="10"
app:showAsAction="never"/>
<item
android:id="@+id/action_save"
android:title="@string/action_save"
android:orderInCategory="3"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_action_save"/>
android:orderInCategory="11"
app:showAsAction="never"/>
<item
android:id="@+id/action_edit_basics"
android:title="@string/action_edit_basics"
android:orderInCategory="4"
android:orderInCategory="20"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_action_edit"/>
<item
android:id="@+id/action_calendar_activity"
android:title="@string/action_calendar_activity"
android:orderInCategory="5"
android:orderInCategory="30"
app:showAsAction="never" />
</menu>

View file

@ -29,4 +29,7 @@
<string name="action_save">Guardar</string>
<string name="action_undo_current_pg">Acción deshecha</string>
<string name="dungeons_and_dragons">Dragones y Mazmorras</string>
<string name="action_load">Cargar</string>
<string name="curative_efforts">Esfuerzos curativos</string>
<string name="pg">PG</string>
</resources>

View file

@ -6,6 +6,10 @@
<string name="action_undo">Undo</string>
<string name="pg">PG</string>
<string name="curative_efforts">Curative efforts</string>
<string name="curative_display_text1">You have</string>
<string name="curative_display_text2">out of</string>
<string name="curative_display_text3">daily curative efforts.</string>
<string name="action_load">Load</string>
<string name="dungeons_and_dragons">Dungeons and Dragons</string>
<string name="action_save">Save</string>
<string name="action_calendar_activity">Create event</string>
@ -21,6 +25,7 @@
<string name="no">No</string>
<string name="edit_PG_Title">Suffer damage</string>
<string name="message_death">Your character has died</string>
<string name="new_energies1">You have</string>
<string name="new_energies2">curative efforts</string>
<string name="new_energies_title">Use a curative effort?</string>