Search in sources :

Example 1 with Skill

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())));
}
Also used : Skill(cn.nicolite.palm300heroes.model.bean.Skill)

Example 2 with Skill

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;
}
Also used : Skill(cn.nicolite.palm300heroes.model.bean.Skill) ArrayList(java.util.ArrayList)

Example 3 with Skill

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());
                }
            }
        }
    });
}
Also used : Skill(cn.nicolite.palm300heroes.model.bean.Skill) BmobException(cn.bmob.v3.exception.BmobException) BmobQuery(cn.bmob.v3.BmobQuery) List(java.util.List) SkillDao(cn.nicolite.palm300heroes.db.dao.SkillDao)

Aggregations

Skill (cn.nicolite.palm300heroes.model.bean.Skill)3 BmobQuery (cn.bmob.v3.BmobQuery)1 BmobException (cn.bmob.v3.exception.BmobException)1 SkillDao (cn.nicolite.palm300heroes.db.dao.SkillDao)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1