use of cn.nicolite.palm300heroes.model.bean.Skill in project Palm300Heroes by nicolite.
the class SkillAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(SkillViewHolder holder, int position) {
Skill skill = dataList.get(position);
Glide.with(context).load(UrlHead + Uri.encode(skill.getPictureUrl())).crossFade().into(holder.skillPicture);
holder.skillName.setText(skill.getName());
holder.skillConsumption.setText(Html.fromHtml("<font color='#00FF00'>消耗:" + skill.getConsumption() + "</font>"));
holder.skillChilldown.setText(Html.fromHtml("<font color='#FF4500'>冷却:" + skill.getChilldown() + "</font>"));
holder.skillShortCut.setText(String.valueOf("【 " + skill.getShortcut() + " 】"));
holder.skillEffectiveness.setText(Html.fromHtml(String.valueOf("效果:" + skill.getEffectiveness())));
}
use of cn.nicolite.palm300heroes.model.bean.Skill in project Palm300Heroes by nicolite.
the class HeroSkillFragment method sortSkill.
private List<Skill> sortSkill(List<Skill> list) {
Skill[] skills = new Skill[5];
List<Skill> skillList = new ArrayList<>();
for (Skill skill : list) {
switch(skill.getShortcut()) {
case "Q":
skills[1] = skill;
break;
case "W":
skills[2] = skill;
break;
case "E":
skills[3] = skill;
break;
case "R":
skills[4] = skill;
break;
default:
skills[0] = skill;
break;
}
}
for (Skill skill : skills) {
if (skill != null) {
skillList.add(skill);
}
}
return skillList;
}
use of cn.nicolite.palm300heroes.model.bean.Skill in project Palm300Heroes by nicolite.
the class HeroSkillPresenter method showSkill.
public void showSkill(final String UNCode, boolean isForce) {
final SkillDao skillDao = getDaoSession().getSkillDao();
if (!isForce && getView() != null) {
List<Skill> list = skillDao.queryBuilder().where(SkillDao.Properties.UNCode.eq(UNCode)).list();
if (!ListUtils.isEmpty(list)) {
getView().showSkill(list);
return;
}
}
BmobQuery<Skill> query = new BmobQuery<>(Constants.BMOB_SKILL);
query.addWhereEqualTo("UNCode", UNCode).findObjects(new FindListener<Skill>() {
@Override
public void done(final List<Skill> list, BmobException e) {
if (getView() != null) {
if (e == null) {
if (!ListUtils.isEmpty(list)) {
getView().showSkill(list);
if (!isSaving) {
isSaving = true;
new Thread(new Runnable() {
@Override
public void run() {
List<Skill> oldList = skillDao.queryBuilder().where(SkillDao.Properties.UNCode.eq(UNCode)).list();
for (Skill skill : oldList) {
skillDao.delete(skill);
}
for (Skill skill : list) {
skillDao.save(skill);
}
isSaving = false;
}
}).start();
}
}
} else {
getView().loadFailure();
BmobUtils.showErrorMessage(e.toString());
}
}
}
});
}