Display unequipped base stats on player info screen.

Add "All" button to bulk selection interface.
Do not show bulk selection interface when dropping just one item.
Confirmation dialog when overwriting savegames with a new player name (thanks ejwessel)
Hide critical multiplier if equal to 0 or 1.
Do not trigger map events if the player moves to another tile on the same mapevent.
Add LayoutParams to all dynamically generated views (reduces graphical artifacts on Motorola devices)
Use wrap_content instead of match_parent as height on listviews (reduces graphical artifacts on Motorola devices)

git-svn-id: https://andors-trail.googlecode.com/svn/trunk@142 08aca716-68be-ccc6-4d58-36f5abd142ac
This commit is contained in:
oskar.wiksten
2011-07-24 11:24:45 +00:00
parent 173b8cb6c5
commit 9730afade8
28 changed files with 185 additions and 75 deletions

View File

@@ -51,7 +51,7 @@
<ListView
android:id="@+id/inventorylist_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>

View File

@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:gravity="bottom|left">
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="left"
>
<com.gpl.rpg.AndorsTrail.view.QuickButton
android:id="@+id/quickitemview_item1"
android:layout_width="wrap_content"

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TableRow>
<TextView android:text="@string/traitsinfo_base_max_hp" android:layout_marginRight="10sp" />
<TextView android:id="@+id/basetraitsinfo_max_hp" />
</TableRow>
<TableRow>
<TextView android:text="@string/traitsinfo_base_max_ap" android:layout_marginRight="10sp" />
<TextView android:id="@+id/basetraitsinfo_max_ap" />
</TableRow>
<include layout="@layout/traitsinfoview" />
</merge>

View File

@@ -14,7 +14,7 @@
>
<TextView
android:text="Drop"
android:text="@string/inventory_drop"
android:id="@+id/bulkselection_action_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -30,9 +30,11 @@
/>
<TextView
android:text=" / "
android:text="/"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
/>
<TextView
@@ -51,11 +53,12 @@
>
<Button
android:text=" -1 "
android:text="-1"
android:id="@+id/bulkselection_decrement_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingLeft="20dp"
android:paddingRight="20dp"
/>
<SeekBar
@@ -67,17 +70,27 @@
/>
<Button
android:text=" +1 "
android:text="+1"
android:id="@+id/bulkselection_increment_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:paddingLeft="20dp"
android:paddingRight="20dp"
/>
<Button
android:text="@string/bulkselection_select_all"
android:id="@+id/bulkselection_select_all_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
/>
</LinearLayout>
<TextView
android:text="gold amount"
android:text="@string/bulkselection_totalcost_buy"
android:id="@+id/bulkselection_summary_totalgold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -96,7 +109,7 @@
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Sell"
android:text="@string/inventory_drop"
/>
<Button
@@ -104,7 +117,7 @@
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel"
android:text="@android:string/cancel"
/>
</LinearLayout>

View File

@@ -4,7 +4,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent"
>
<ListView
@@ -16,7 +15,6 @@
android:id="@+id/conversation_statements"
android:transcriptMode="alwaysScroll"
android:padding="@dimen/dialog_margin"
style="@style/Style.BlackListView"
/>
<LinearLayout

View File

@@ -36,7 +36,7 @@
<ListView
android:id="@+id/inventorylist_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>

View File

@@ -18,6 +18,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/heroinfo_listskills_list"
>
</ListView>
/>
</LinearLayout>

View File

@@ -111,7 +111,17 @@
android:gravity="left"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/actorinfo_basetraits"
android:layout_marginTop="@dimen/section_margin"
/>
<com.gpl.rpg.AndorsTrail.view.BaseTraitsInfoView
android:id="@+id/heroinfo_basetraits"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</ScrollView>

View File

@@ -14,11 +14,10 @@
<com.gpl.rpg.AndorsTrail.view.QuickitemView
android:id="@+id/main_quickitemview"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/main_statusview"
android:layout_centerHorizontal="true"
android:visibility="gone"
android:visibility="gone"
/>
<com.gpl.rpg.AndorsTrail.view.CombatView

View File

@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom|center_horizontal">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
>
<com.gpl.rpg.AndorsTrail.view.QuickButton
android:id="@+id/quickitemview_item1"
android:layout_width="wrap_content"
@@ -22,4 +24,4 @@
android:layout_height="@dimen/smalltext_buttonheight"
android:textSize="@dimen/actionbar_text"
android:longClickable="true"/>
</merge>
</LinearLayout>

View File

@@ -55,7 +55,7 @@
<ListView
android:id="@+id/shop_buy_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
@@ -96,7 +96,7 @@
<ListView
android:id="@+id/shop_sell_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>

View File

@@ -371,6 +371,7 @@
<string name="actorconditioninfo_effect_every_full_round">Every full round</string>
<string name="bulkselection_totalcost_buy">Total cost: %1$d gold</string>
<string name="bulkselection_totalcost_sell">Total cost: %1$d gold</string>
<string name="bulkselection_select_all">All</string>
<string name="skill_title_weapon_chance">Weapon Accuracy</string>
<string name="skill_title_weapon_dmg">Hard Hit</string>
@@ -380,7 +381,7 @@
<string name="skill_title_more_criticals">More Criticals</string>
<string name="skill_title_better_criticals">Better Criticals</string>
<string name="skill_title_speed">Combat Speed</string>
<string name="skill_title_coinfinder">Gold Digger</string>
<string name="skill_title_coinfinder">Treasure Hunter</string>
<string name="skill_title_more_exp">Quick Learner</string>
<string name="skill_title_cleave">Cleave</string>
<string name="skill_title_eater">Corpse Eater</string>
@@ -431,12 +432,14 @@
<string name="skill_current_level_with_maximum">Current level: %1$d / %2$d</string>
<string name="skill_prerequisite_other_skill">To level up this skill, you need at least level %1$d of the %2$s skill.</string>
<string name="skill_prerequisite_level">To level up this skill, you need at least experience level %1$d.</string>
<string name="skill_prerequisite_stat">To level up this skill, you need at least %1$d %2$s.</string>
<string name="skill_prerequisite_stat">To level up this skill, you need at least %1$d %2$s (unequipped stats).</string>
<string name="skill_number_of_increases_one">You may select one skill to increase.</string>
<string name="skill_number_of_increases_several">You may select %1$d skills to increase.</string>
<string name="levelup_adds_new_skillpoint">This level also gives you a new skill point to spend!</string>
<string name="loadsave_save_to_new_slot">Create new savegame slot</string>
<string name="loadsave_save_overwrite_confirmation_title">Overwrite savegame?</string>
<string name="loadsave_save_overwrite_confirmation">This savegame contains a different player name (%1$s) than your current player name (%2$s). Are you sure you want to overwrite this savegame?</string>
<string-array name="iteminfo_displaytypes">
<item>Ordinary</item>
@@ -452,6 +455,9 @@
<item>Mental</item>
<item>Physical Capacity</item>
<item>Blood Disorder</item>
</string-array>
</string-array>
<string name="traitsinfo_base_max_hp">Max HP:</string>
<string name="traitsinfo_base_max_ap">Max AP:</string>
</resources>

View File

@@ -3,8 +3,4 @@
<style name="Theme.NoBackground" parent="android:Theme">
<item name="android:windowBackground">@null</item>
</style>
<style name="Style.BlackListView" parent="@android:style/Widget.ListView">
<item name="android:background">#000000</item>
<item name="android:cacheColorHint">#00000000</item>
</style>
</resources>

View File

@@ -50,22 +50,22 @@
</tileset>
<layer name="Ground" width="30" height="30">
<data encoding="base64" compression="zlib">
eJytlMsNwjAQRK1EFBO5AKACOOYGR9pBqQDRFR3QCViJhTV4v/ZhFCmb7PPsx1MIYWIUN9VirwZxTIn9FtTKlXxT4viWPBLb0g8Ll2NHJlbrgZWLjHlYFcO/PLm13NuwqsbtyUav900zqCcXvSSfj003UE/PyF0KvwuI4552fvZxDOE8/vw+QRz30sBNStzsl5qr3n6TroVfC9PjF9n7L/sw6riZ6fHLzZnEzUyv3x7sVm6NXYu1zrPE1sbKmmPt8T319JyrrDXWHhmYy9qrkl3zR/nFPJ7ZzGxtLdGXZhepeGRiXE5tf727Sv2j7bv0nXRe655Ts0l9w53bWyfKd8+7Q1OnzGu5py3zj2fy7JDUR2nfy1p77inso2WuP0Uf1ro=
eJytlMsNwjAMhqNUDFN1AGACOPYGx66DmACxFRuwCa1EFNfyOzn8qlS3/vL7kTGlNAqa/qJinwZJTI39VdTK1XxzkviePBrb0w8PF7LnXDWlvSz98HILe8lVmBvpiZX7yFUctye75HvlqplQTy70Af0uhHp6hrmg3ychiXs5xNjnYe/3TUji3oLcTdeh+pXmqqffTfeVe1x1GvzMiF/cZ4/Xwoz49fJxX1v89mC3cik2FWudZ41tjcGa49rj99wzci5Ya1x7zMC5vL2CbMof5xfnicxmYVtriX1ZdpGLT0JMymntb3RXuX+sfde+087r3XNuNrlvpHNH68T57nl3WOpUeC33tGf+8ZkiO6T1Udt3WOvIPYX76JnrH8282XI=
</data>
</layer>
<layer name="Objects" width="30" height="30">
<data encoding="base64" compression="zlib">
eJydVjtOw0AQdWIvVwktKEBafhGiInwiQRMkqCgRFNDlB1y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cnP0nmehL+x90O8UdadqpXwr4Iv1JTMHje8FzKGe6xmYuksx3yvhKyWmLf3azo+7HfuktJJ6KV+pVuoZaJVnctBqPH+Zve/XoR/UGee8E67vPfwO4Dj1xWjPoBOeA+g99aZ+A7g+ql68B1ScsxcaPnEXOX2g+iepO3evcH6xuHY9Cm3dEjh3UbIm5y3h5ITzk7xLSyKpa060OTwBXEEw8Q==
</data>
</layer>
<layer name="Walkable" width="30" height="30" visible="0">
<data encoding="base64" compression="zlib">
eJzFlFEKwDAIQ3uF3v+y+92kmrzaMkEG3fQlVTbHN+YrY0zxnkRWr3rf4ip29L7KHe58PdU3ShetjT12wuVSfc4eVHNQfGfOJDr37O6Ue+ZqI9yMmfm5zc2Y2XfVnlRcV1t1vupB/Lq75XBVLf3Hq512atVcnLujQX2ejA7X0b37jmgg55GtZq5y1dPRfCKj145nNUvy3+lwq/tX/TrcrEb1rPzSc+o324NKU9cv2XvnrhytZE9vs8e46+dU/sE+zXwAWeoaCQ==
eJzFlNkNwDAIQ7MC+y/b3xYFbHOoSKhSDh4OFDtfs5d7M7CvWHQfxd7iIrbXfvMK117fijbEZ2Le7k/pqpxjuVkdEL/KzfJhzmRc1FPsGpObyo2YUextbsS8nUN9knGj/Cr9rM42pSen7qr/QfefYeoS1bNjyuyetg6Xybu6p+SgrHs2qnl3Jqpsxb3WjmZUS2YmTnCz90fxOtzoDoqZ6VXXVb1RH2Q5dfUqfc+8FZOr0qfb7HN29Uz5H+xp5gNZ3hpe
</data>
</layer>
<objectgroup name="Mapevents" width="30" height="30">

View File

@@ -13,7 +13,6 @@ import android.content.DialogInterface.OnDismissListener;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
@@ -152,7 +151,7 @@ public final class Dialogs {
}
final ListView itemList = new ListView(mainActivity);
itemList.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
itemList.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.FILL_PARENT, ListView.LayoutParams.WRAP_CONTENT));
itemList.setPadding(20, 0, 20, 20);
itemList.setOnItemClickListener(new OnItemClickListener() {
@Override

View File

@@ -45,11 +45,11 @@ public class BulkSelectionInterface extends Activity implements TextWatcher {
private TextView bulkselection_amount_available;
private TextView bulkselection_summary_totalgold;
private EditText bulkselection_amount_taken; // the amount we're going to take from the totalAmount
private EditText bulkselection_amount_taken; // the amount we're going to take from the totalAmount
private SeekBar bulkselection_slider;
private Button okButton;
private final Handler timedEventHandler = new Handler(); // variables to count up or down on long presses on the buttons
private final Handler timedEventHandler = new Handler(); // variables to count up or down on long presses on the buttons
private int countValue, countTime;
private final Runnable countEvent = new Runnable() {
public void run() {
@@ -95,6 +95,7 @@ public class BulkSelectionInterface extends Activity implements TextWatcher {
Button cancelButton = (Button)findViewById(R.id.bulkselection_cancel_button);
final Button decrementButton = (Button)findViewById(R.id.bulkselection_decrement_button);
final Button incrementButton = (Button)findViewById(R.id.bulkselection_increment_button);
final Button selectAllButton = (Button)findViewById(R.id.bulkselection_select_all_button);
int actionTextResourceID = 0;
if (interfaceType == BULK_INTERFACE_BUY) {
@@ -185,6 +186,13 @@ public class BulkSelectionInterface extends Activity implements TextWatcher {
finish();
}
});
selectAllButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateControls(totalAvailableAmount);
}
});
}
private void incrementValueAndRepeat(int repeatAfterInterval) {

View File

@@ -93,6 +93,7 @@ public final class ConversationActivity extends Activity {
setContentView(R.layout.conversation);
replyGroup = new RadioGroup(this);
replyGroup.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.WRAP_CONTENT, ListView.LayoutParams.WRAP_CONTENT));
statementList = (ListView) findViewById(R.id.conversation_statements);
statementList.addFooterView(replyGroup);
@@ -188,19 +189,20 @@ public final class ConversationActivity extends Activity {
for (Reply r : phrase.replies) {
addReply(phrase, r);
}
replyGroup.setVisibility(View.VISIBLE);
nextButton.setEnabled(false);
nextButton.setEnabled(false);
}
}
private void addReply(final Phrase p, final Reply r) {
if (!ConversationController.canSelectReply(player, r)) return;
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
RadioButton rb = new RadioButton(this);
rb.setLayoutParams(layoutParams);
rb.setText(r.text);
rb.setOnClickListener(radioButtonListener);
rb.setTag(r);
replyGroup.addView(rb);
replyGroup.addView(rb, layoutParams);
}
private static boolean isPhraseOnlyNextReply(Phrase p) {
@@ -222,8 +224,6 @@ public final class ConversationActivity extends Activity {
}
private void nextButtonClicked() {
replyGroup.setVisibility(View.GONE);
Reply r;
if (isPhraseOnlyNextReply(phrase)) {
// If there is only a "Next" as reply, we don't need to add it to the conversation history.
@@ -252,6 +252,7 @@ public final class ConversationActivity extends Activity {
s.color = color;
conversationHistory.add(s);
listAdapter.notifyDataSetChanged();
statementList.requestLayout();
}
@Override

View File

@@ -104,12 +104,11 @@ public final class HeroinfoActivity_Inventory extends Activity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ItemType itemType;
switch (requestCode) {
case MainActivity.INTENTREQUEST_ITEMINFO:
if (resultCode != RESULT_OK) break;
itemType = world.itemTypes.getItemType(data.getExtras().getInt("itemTypeID"));
ItemType itemType = world.itemTypes.getItemType(data.getExtras().getInt("itemTypeID"));
int actionType = data.getExtras().getInt("actionType");
if (actionType == ItemInfoActivity.ITEMACTION_UNEQUIP) {
view.itemController.unequipSlot(itemType, data.getExtras().getInt("inventorySlot"));
@@ -124,12 +123,16 @@ public final class HeroinfoActivity_Inventory extends Activity {
int quantity = data.getExtras().getInt("selectedAmount");
int itemTypeID = data.getExtras().getInt("itemTypeID");
itemType = world.itemTypes.getItemType(itemTypeID);
view.itemController.dropItem(itemType, quantity);
dropItem(itemTypeID, quantity);
break;
}
}
private void dropItem(int itemTypeID, int quantity) {
ItemType itemType = world.itemTypes.getItemType(itemTypeID);
view.itemController.dropItem(itemType, quantity);
}
private void update() {
updateTraits();
updateWorn();
@@ -195,7 +198,12 @@ public final class HeroinfoActivity_Inventory extends Activity {
break;
case R.id.inv_menu_drop:
int itemTypeID = getSelectedItemType(info).id;
Dialogs.showBulkDroppingInterface(this, itemTypeID, player.inventory.getItemQuantity(itemTypeID));
int quantity = player.inventory.getItemQuantity(itemTypeID);
if (quantity > 1) {
Dialogs.showBulkDroppingInterface(this, itemTypeID, quantity);
} else {
dropItem(itemTypeID, quantity);
}
break;
case R.id.inv_menu_equip:
view.itemController.equipItem(getSelectedItemType(info));
@@ -224,8 +232,8 @@ public final class HeroinfoActivity_Inventory extends Activity {
update();
return true;
}
private void showEquippedItemInfo(ItemType itemType, int inventorySlot) {
private void showEquippedItemInfo(ItemType itemType, int inventorySlot) {
String text;
boolean enabled = true;

View File

@@ -14,6 +14,7 @@ import com.gpl.rpg.AndorsTrail.model.item.Inventory;
import com.gpl.rpg.AndorsTrail.model.item.ItemTraits_OnUse;
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
import com.gpl.rpg.AndorsTrail.view.ActorConditionEffectList;
import com.gpl.rpg.AndorsTrail.view.BaseTraitsInfoView;
import com.gpl.rpg.AndorsTrail.view.ItemEffectsView;
import com.gpl.rpg.AndorsTrail.view.RangeBar;
import com.gpl.rpg.AndorsTrail.view.TraitsInfoView;
@@ -49,6 +50,7 @@ public final class HeroinfoActivity_Stats extends Activity {
private TextView heroinfo_totalexperience;
private RangeBar rangebar_hp;
private RangeBar rangebar_exp;
private BaseTraitsInfoView heroinfo_basetraits;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -90,6 +92,8 @@ public final class HeroinfoActivity_Stats extends Activity {
levelUpButton.setEnabled(false);
}
});
heroinfo_basetraits = (BaseTraitsInfoView) findViewById(R.id.heroinfo_basetraits);
}
@Override
@@ -147,6 +151,7 @@ public final class HeroinfoActivity_Stats extends Activity {
if (effects_hit.isEmpty()) effects_hit = null;
if (effects_kill.isEmpty()) effects_kill = null;
heroinfo_itemeffects.update(null, null, effects_hit, effects_kill);
heroinfo_basetraits.update(player.traits);
}
private void updateConditions() {
@@ -172,7 +177,7 @@ public final class HeroinfoActivity_Stats extends Activity {
Dialogs.showActorConditionInfo(context, conditionType);
}
});
heroinfo_currentconditions.addView(v);
heroinfo_currentconditions.addView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
}
}
}

View File

@@ -104,10 +104,13 @@ public final class LoadSaveActivity extends Activity implements OnClickListener
if (slot == SLOT_NUMBER_CREATE_NEW_SLOT) return false; // if we're creating a new slot
final String currentPlayerName = model.player.traits.name;
final String savedPlayerName = Savegames.quickload(this, slot).playerName;
if (!currentPlayerName.equals(savedPlayerName)) return true; // if the names do not match
final FileHeader header = Savegames.quickload(this, slot);
if (header == null) return false;
return false;
final String savedPlayerName = header.playerName;
if (currentPlayerName.equals(savedPlayerName)) return false; // if the names match
return true;
}
@Override
@@ -118,14 +121,15 @@ public final class LoadSaveActivity extends Activity implements OnClickListener
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setMessage("Overwrite " + Savegames.quickload(this, slot).playerName + " with " + playerName + "?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
.setTitle(R.string.loadsave_save_overwrite_confirmation_title)
.setMessage(getString(R.string.loadsave_save_overwrite_confirmation, Savegames.quickload(this, slot).playerName, playerName))
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
loadsave(slot);
}
})
.setNegativeButton("Cancel", null)
.setNegativeButton(android.R.string.no, null)
.show();
} else {
loadsave(slot);

View File

@@ -96,8 +96,6 @@ public final class StartScreenActivity extends Activity {
Dialogs.showLoad(StartScreenActivity.this);
}
});
boolean hasSavegames = !Savegames.getUsedSavegameSlots(this).isEmpty();
b.setEnabled(hasSavegames);
TextView development_version = (TextView) findViewById(R.id.startscreen_dev_version);
if (AndorsTrailApplication.DEVELOPMENT_DEBUGRESOURCES) {

View File

@@ -194,7 +194,11 @@ public final class MovementController implements TimedMessageTask.Callback {
if (handleEvents) {
MapObject o = currentMap.getEventObjectAt(newPosition);
if (o != null) view.controller.handleMapEvent(o, newPosition);
if (o != null) {
if (!o.position.contains(player.lastPosition)) { // Do not trigger event if the player already was on the same MapObject before.
view.controller.handleMapEvent(o, newPosition);
}
}
Loot loot = currentMap.getBagAt(newPosition);
if (loot != null) view.itemController.handleLootBag(loot);

View File

@@ -48,7 +48,7 @@ public class CombatTraits {
public boolean hasAttackDamageEffect() { return damagePotential.max != 0; }
public boolean hasBlockEffect() { return blockChance != 0; }
public boolean hasCriticalChanceEffect() { return criticalChance != 0; }
public boolean hasCriticalMultiplierEffect() { return criticalMultiplier != 0; }
public boolean hasCriticalMultiplierEffect() { return criticalMultiplier != 0 && criticalMultiplier != 1; }
public int getAttacksPerTurn(final int maxAP) {
return (int) Math.floor(maxAP / attackCost);

View File

@@ -31,6 +31,8 @@ public final class ActorConditionEffectList extends LinearLayout {
final Context context = getContext();
final Resources res = getResources();
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
for (ActorConditionEffect e : effects) {
String msg;
final ActorConditionType conditionType = e.conditionType;
@@ -40,6 +42,7 @@ public final class ActorConditionEffectList extends LinearLayout {
msg = describeEffect(res, e);
}
TextView tv = new TextView(context);
tv.setLayoutParams(layoutParams);
SpannableString content = new SpannableString(msg);
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
@@ -50,7 +53,7 @@ public final class ActorConditionEffectList extends LinearLayout {
Dialogs.showActorConditionInfo(context, conditionType);
}
});
this.addView(tv);
this.addView(tv, layoutParams);
}
}

View File

@@ -0,0 +1,27 @@
package com.gpl.rpg.AndorsTrail.view;
import com.gpl.rpg.AndorsTrail.R;
import com.gpl.rpg.AndorsTrail.model.actor.ActorTraits;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
public final class BaseTraitsInfoView extends TraitsInfoView {
private final TextView basetraitsinfo_max_hp;
private final TextView basetraitsinfo_max_ap;
public BaseTraitsInfoView(Context context, AttributeSet attr) {
super(context, attr, R.layout.basetraitsinfoview);
basetraitsinfo_max_hp = (TextView) findViewById(R.id.basetraitsinfo_max_hp);
basetraitsinfo_max_ap = (TextView) findViewById(R.id.basetraitsinfo_max_ap);
}
public void update(ActorTraits traits) {
super.update(traits.baseCombatTraits);
basetraitsinfo_max_hp.setText(Integer.toString(traits.maxHP));
basetraitsinfo_max_ap.setText(Integer.toString(traits.maxAP));
}
}

View File

@@ -66,17 +66,19 @@ public final class ItemEffectsView_OnUse extends LinearLayout {
}
public static void describeStatsModifierTraits(StatsModifierTraits traits, Context context, Resources res, LinearLayout listView) {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
if (traits.currentAPBoost != null) {
final int label = traits.currentAPBoost.max > 0 ? R.string.iteminfo_effect_increase_current_ap : R.string.iteminfo_effect_decrease_current_ap;
final TextView tv = new TextView(context);
tv.setText(res.getString(label, traits.currentAPBoost.toMinMaxAbsString()));
listView.addView(tv);
listView.addView(tv, layoutParams);
}
if (traits.currentHPBoost != null) {
final int label = traits.currentHPBoost.max > 0 ? R.string.iteminfo_effect_increase_current_hp : R.string.iteminfo_effect_decrease_current_hp;
final TextView tv = new TextView(context);
tv.setText(res.getString(label, traits.currentHPBoost.toMinMaxAbsString()));
listView.addView(tv);
listView.addView(tv, layoutParams);
}
}
}

View File

@@ -120,6 +120,8 @@ public final class StatusView extends RelativeLayout {
private final Context context;
private int currentChildIndex = 0;
private final int previousChildCount;
private final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
public GreedyImageViewAppender(Context context, LinearLayout container) {
this.container = container;
this.context = context;
@@ -137,7 +139,7 @@ public final class StatusView extends RelativeLayout {
// The player has never had this many conditions, create a new ImageView to hold the condition image.
ImageView iv = new ImageView(context);
iv.setImageBitmap(b);
container.addView(iv);
container.addView(iv, layoutParams);
}
++currentChildIndex;
}

View File

@@ -10,7 +10,7 @@ import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public final class TraitsInfoView extends TableLayout {
public class TraitsInfoView extends TableLayout {
private final TableRow traitsinfo_attack_row1;
private final TableRow traitsinfo_attack_row2;
private final TableRow traitsinfo_attack_row3;
@@ -27,9 +27,13 @@ public final class TraitsInfoView extends TableLayout {
private final TextView traitsinfo_defense_damageresist;
public TraitsInfoView(Context context, AttributeSet attr) {
this(context, attr, R.layout.traitsinfoview);
}
public TraitsInfoView(Context context, AttributeSet attr, int layoutResourceID) {
super(context, attr);
setFocusable(false);
inflate(context, R.layout.traitsinfoview, this);
inflate(context, layoutResourceID, this);
traitsinfo_attack_row1 = (TableRow) findViewById(R.id.traitsinfo_attack_row1);
traitsinfo_attack_row2 = (TableRow) findViewById(R.id.traitsinfo_attack_row2);