diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-14 20:23:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-14 20:23:15 +0300 |
commit | 3fc421539bc81f27262b91554694509f3e47f865 (patch) | |
tree | b191e1de4932ddcd3fad4a6780d0308f79d68e5e | |
parent | 6a763f58ad8ab52b9b444b096a8f298d440e0a65 (diff) | |
download | mv-3fc421539bc81f27262b91554694509f3e47f865.tar.gz mv-3fc421539bc81f27262b91554694509f3e47f865.tar.bz2 mv-3fc421539bc81f27262b91554694509f3e47f865.tar.xz mv-3fc421539bc81f27262b91554694509f3e47f865.zip |
Show cast type in skill popup from custom place.
For skill shortcuts for now it always "Default".
-rw-r--r-- | src/gui/popups/skillpopup.cpp | 10 | ||||
-rw-r--r-- | src/gui/popups/skillpopup.h | 6 | ||||
-rw-r--r-- | src/gui/shortcut/itemshortcut.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/skilllistbox.h | 3 |
5 files changed, 26 insertions, 6 deletions
diff --git a/src/gui/popups/skillpopup.cpp b/src/gui/popups/skillpopup.cpp index 4c9af3d0f..2797664dc 100644 --- a/src/gui/popups/skillpopup.cpp +++ b/src/gui/popups/skillpopup.cpp @@ -47,6 +47,7 @@ SkillPopup::SkillPopup() : mSkillEffect(new TextBox(this)), mSkillLevel(new TextBox(this)), mSkillCastType(new TextBox(this)), + mCastType(CastType::Default), mLastId(0U), mLastLevel(-1) { @@ -93,18 +94,21 @@ SkillPopup::~SkillPopup() } void SkillPopup::show(const SkillInfo *const skill, - const int level) + const int level, + const CastTypeT castType) { if (!skill || !skill->data || (skill->id == mLastId && - level == mLastLevel)) + level == mLastLevel && + castType == mCastType)) { return; } mLastId = skill->id; mLastLevel = level; + mCastType = castType; mSkillName->setCaption(skill->data->dispName); mSkillName->adjustSize(); @@ -144,7 +148,7 @@ void SkillPopup::show(const SkillInfo *const skill, } } std::string castStr; - switch (skill->customCastType) + switch (castType) { case CastType::Default: default: diff --git a/src/gui/popups/skillpopup.h b/src/gui/popups/skillpopup.h index be416330a..95d5a4133 100644 --- a/src/gui/popups/skillpopup.h +++ b/src/gui/popups/skillpopup.h @@ -26,6 +26,8 @@ #include "gui/widgets/popup.h" +#include "enums/resources/skill/casttype.h" + class Label; class TextBox; @@ -55,7 +57,8 @@ class SkillPopup final : public Popup * Sets the info to be displayed given a particular item. */ void show(const SkillInfo *const skill, - const int level); + const int level, + const CastTypeT type); void mouseMoved(MouseEvent &event) override final; @@ -67,6 +70,7 @@ class SkillPopup final : public Popup TextBox *mSkillEffect A_NONNULLPOINTER; TextBox *mSkillLevel A_NONNULLPOINTER; TextBox *mSkillCastType A_NONNULLPOINTER; + CastTypeT mCastType; unsigned int mLastId; int mLastLevel; }; diff --git a/src/gui/shortcut/itemshortcut.h b/src/gui/shortcut/itemshortcut.h index d3418eadd..4f223478f 100644 --- a/src/gui/shortcut/itemshortcut.h +++ b/src/gui/shortcut/itemshortcut.h @@ -73,6 +73,9 @@ class ItemShortcut final ItemColor getItemColor(const int index) const A_WARN_UNUSED { return mItemColors[index]; } + std::string getItemData(const int index) const A_WARN_UNUSED + { return mItemData[index]; } + /** * Returns the amount of shortcut items. */ diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 9604d33d8..7b6df7644 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -594,8 +594,16 @@ void ItemShortcutContainer::mouseMoved(MouseEvent &event) if (!skill) return; + // +++ for now from data only get cast type + const std::string data = selShortcut->getItemData(index); + CastTypeT castType = CastType::Default; + if (!data.empty()) + { + castType = static_cast<CastTypeT>(atoi(data.c_str())); + } skillPopup->show(skill, - toInt(itemColor, int)); + toInt(itemColor, int), + castType); skillPopup->position(viewport->mMouseX, viewport->mMouseY); } diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h index 818dbf8cb..533d12b5e 100644 --- a/src/gui/widgets/skilllistbox.h +++ b/src/gui/widgets/skilllistbox.h @@ -200,7 +200,8 @@ class SkillListBox final : public ListBox if (!skill) return; skillPopup->show(skill, - skill->customSelectedLevel); + skill->customSelectedLevel, + skill->customCastType); skillPopup->position(viewport->mMouseX, viewport->mMouseY); } |