protected List<SButton> getAllAbilityButtons(Humanoid selectedHumanoid) { Game kc = Rpg.getGame(); allAbilityButtons.clear(); abilities.clear(); abilitiesTypes.clear(); if (selectedHumanoid != null) abilities.addAll(selectedHumanoid.getAbilities()); for (Ability ab : abilities) { if (abilitiesTypes.contains(ab.getAbility())) continue; AbilityButton abButton = AbilityButton.getInstance(kc.getActivity(), ab, ac); allAbilityButtons.add(abButton); abilitiesTypes.add(ab.getAbility()); } return allAbilityButtons; }
private AbilityButton(Activity a, @NotNull Ability ability, @NotNull final AbilityCaster ac_) { super(a); ab = ability; ac = ac_; if (ability.getIconImage() != null) { ImageDrawable id = new ImageDrawable(ability.getIconImage().getBitmap(), 0, 0, new Paint()); setBackgroundDrawable(id); } setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { ac.setPendingAbility(ab); } }); }