Commit dafbd434 authored by Kevin Whitaker's avatar Kevin Whitaker

Character names are now able to be localized.

parent 18621d5c
......@@ -165,7 +165,7 @@ public class CampaignDetailsActivity extends RecyclerViewActivity {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if(playerSpinner.getSelectedItem() != null) {
((CampaignDetailsAdapter) getAdapter()).addCharacter(CharacterNames.valueOf(charSpinner.getSelectedItem().toString()), MiceAndMysticsApplication.getRealmInstance().where(Player.class).equalTo("playerName", playerSpinner.getSelectedItem().toString()).findFirst());
((CampaignDetailsAdapter) getAdapter()).addCharacter(((CharacterNames)charSpinner.getSelectedItem()), MiceAndMysticsApplication.getRealmInstance().where(Player.class).equalTo("playerName", playerSpinner.getSelectedItem().toString()).findFirst());
} else {
Toast.makeText(CampaignDetailsActivity.this,"No player selected. Maybe try making one first.",Toast.LENGTH_LONG).show();
}
......
package com.eyecreate.miceandmystics.miceandmystics.model.Enums;
import com.eyecreate.miceandmystics.miceandmystics.MiceAndMysticsApplication;
import com.eyecreate.miceandmystics.miceandmystics.R;
public enum CharacterNames {
Collin(new CharacterType[]{CharacterType.Warrior,CharacterType.Leader}, R.mipmap.collin),
Filch(new CharacterType[]{CharacterType.Scamp},R.mipmap.filch),
Lily(new CharacterType[]{CharacterType.Archer},R.mipmap.lily),
Maginos(new CharacterType[]{CharacterType.Mystic,CharacterType.Maginos},R.mipmap.maginos),
Nez(new CharacterType[]{CharacterType.Tinkerer,CharacterType.Warrior},R.mipmap.nez),
Tilda(new CharacterType[]{CharacterType.Healer},R.mipmap.tilda);
Collin(R.string.char_name_collin,new CharacterType[]{CharacterType.Warrior,CharacterType.Leader}, R.mipmap.collin),
Filch(R.string.char_name_filch,new CharacterType[]{CharacterType.Scamp},R.mipmap.filch),
Lily(R.string.char_name_lily,new CharacterType[]{CharacterType.Archer},R.mipmap.lily),
Maginos(R.string.char_name_maginos,new CharacterType[]{CharacterType.Mystic,CharacterType.Maginos},R.mipmap.maginos),
Nez(R.string.char_name_nez,new CharacterType[]{CharacterType.Tinkerer,CharacterType.Warrior},R.mipmap.nez),
Tilda(R.string.char_name_tilda,new CharacterType[]{CharacterType.Healer},R.mipmap.tilda);
private CharacterType[] types;
private int drawableIcon;
private int displayName;
CharacterNames(CharacterType[] types,int drawableIcon) {
CharacterNames(int displayName,CharacterType[] types,int drawableIcon) {
this.displayName = displayName;
this.types = types;
this.drawableIcon = drawableIcon;
}
public CharacterType[] characterTypes() { return types; }
public int getDrawableRes() {return drawableIcon;}
public String displayName() { return MiceAndMysticsApplication.getInstance().getString(displayName); }
@Override public String toString() { return displayName(); }
}
......@@ -33,7 +33,7 @@ public class CampaignDetailsViewHolder extends RecyclerView.ViewHolder implement
public void bindModel(Character character) {
boundCharacter = character;
characterName.setText(character.getCharacterName());
characterName.setText(CharacterNames.valueOf(character.getCharacterName()).displayName());
playerName.setText(character.getControllingPlayer().getPlayerName());
characterIcon.setImageResource(CharacterNames.valueOf(character.getCharacterName()).getDrawableRes());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment