diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-06 18:26:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 18:26:01 +0300 |
commit | 813779679c40323d29aaa6cb334210e3944d5c99 (patch) | |
tree | 60ea74121bba5113431fc9cd550bdef6ba401837 /src | |
parent | 6d57a376b3f676b79280d4109dbe5d9bb7147821 (diff) | |
download | mv-813779679c40323d29aaa6cb334210e3944d5c99.tar.gz mv-813779679c40323d29aaa6cb334210e3944d5c99.tar.bz2 mv-813779679c40323d29aaa6cb334210e3944d5c99.tar.xz mv-813779679c40323d29aaa6cb334210e3944d5c99.zip |
Use skillpopup in skills window.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/skillinfo.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/skillinfo.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/skilllistbox.h | 22 |
3 files changed, 17 insertions, 21 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp index 721c4c98e..01cb0cb16 100644 --- a/src/gui/widgets/skillinfo.cpp +++ b/src/gui/widgets/skillinfo.cpp @@ -38,7 +38,7 @@ SkillInfo::SkillInfo() : skillLevel(), skillExp(), - skillMana(), + skillEffect(), useButton(), progress(0.0F), color(), @@ -94,10 +94,18 @@ void SkillInfo::update() skillLevel = strprintf(_("Lvl: %d"), baseLevel); } + if (sp) - skillMana = strprintf(_("Mana: -%d"), sp); + skillEffect = strprintf(_("Mana: -%d"), sp); else - skillMana.clear(); + skillEffect.clear(); + + if (range > 0) + { + if (!skillEffect.empty()) + skillEffect.append(" / "); + skillEffect.append(strprintf(_("Range: %d"), range)); + } level = baseLevel; skillLevelWidth = -1; diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index 06c5a8670..f41bc46fc 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -45,7 +45,7 @@ struct SkillInfo final { std::string skillLevel; std::string skillExp; - std::string skillMana; + std::string skillEffect; std::string useButton; float progress; Color color; diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h index 97be121a8..5ae389d83 100644 --- a/src/gui/widgets/skilllistbox.h +++ b/src/gui/widgets/skilllistbox.h @@ -36,7 +36,7 @@ #include "gui/models/skillmodel.h" -#include "gui/popups/textpopup.h" +#include "gui/popups/skillpopup.h" #include "render/graphics.h" @@ -55,7 +55,7 @@ class SkillListBox final : public ListBox SkillModel *const model) : ListBox(widget, model, "skilllistbox.xml"), mModel(model), - mPopup(new TextPopup), + mPopup(new SkillPopup), mTextColor(getThemeColor(Theme::TEXT)), mTextColor2(getThemeColor(Theme::TEXT_OUTLINE)), mTextPadding(mSkin ? mSkin->getOption("textPadding", 34) : 34), @@ -165,20 +165,8 @@ class SkillListBox final : public ListBox return; const SkillInfo *const skill = getSkillByEvent(event); - if (!skill || !skill->data) - return; - - std::string description = skill->data->description; - std::string mana = skill->skillMana; - if (description.empty()) - { - description = mana; - mana.clear(); - } - mPopup->show(viewport->mMouseX, viewport->mMouseY, - skill->data->dispName, - description, - mana); + mPopup->show(skill); + mPopup->position(viewport->mMouseX, viewport->mMouseY); } void mouseDragged(MouseEvent &event) @@ -230,7 +218,7 @@ class SkillListBox final : public ListBox private: SkillModel *mModel; - TextPopup *mPopup; + SkillPopup *mPopup; Color mTextColor; Color mTextColor2; int mTextPadding; |