Only allow hovered over scrollable window components to be scrolled by the mouse wheel. Fix bug with display colors for accessory enchantment display names. Release Build 11508.
This commit is contained in:
parent
a6876f2523
commit
3afeb7fa91
@ -291,5 +291,10 @@ namespace ItemTests
|
||||
Test::InRange(enchantCounts[ItemEnchantInfo::ItemEnchantCategory::CLASS],{350U,450U},util::wformat("Class enchants % is approx 40%."));
|
||||
Test::InRange(enchantCounts[ItemEnchantInfo::ItemEnchantCategory::UNIQUE],{50U,150U},util::wformat("Unique enchants % is approx 40%."));
|
||||
}
|
||||
TEST_METHOD(EnchantColorTest){
|
||||
Assert::AreEqual("Item Enchants.General Enchants.Enchant Display Color"_Pixel.n,ItemEnchantInfo::GetEnchant("Health Boost").DisplayCol().n,L"Expecting a general enchant to have the general enchant pixel display color.");
|
||||
Assert::AreEqual("Item Enchants.Class Enchants.Enchant Display Color"_Pixel.n,ItemEnchantInfo::GetEnchant("Quickdraw").DisplayCol().n,L"Expecting a class enchant to have the class enchant pixel display color.");
|
||||
Assert::AreEqual("Item Enchants.Unique Enchants.Enchant Display Color"_Pixel.n,ItemEnchantInfo::GetEnchant("Magical Protection").DisplayCol().n,L"Expecting a unique enchant to have the unique enchant pixel display color.");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -66,6 +66,11 @@ void Menu::InitializeArtificerEnchantWindow(){
|
||||
const auto EnableRefineDisplay{[artificerEnchantWindow](){
|
||||
MenuType menuType{artificerEnchantWindow->GetType()};
|
||||
const std::weak_ptr<Item>&selectedItem{Component<MenuItemItemButton>(menuType,"Item Icon")->GetItem()};
|
||||
std::vector<ItemEnchantInfo>availableEnchants{ItemEnchant::GetAvailableEnchants()};
|
||||
std::string enchantList{std::accumulate(availableEnchants.begin(),availableEnchants.end(),""s,[](const std::string&acc,const ItemEnchantInfo&enchant){
|
||||
return std::format("{}{}{}#FFFFFF\n",acc,enchant.DisplayCol().toHTMLColorCode(),enchant.Name());
|
||||
})};
|
||||
Component<MenuLabel>(menuType,"Enchant List")->SetLabel(enchantList);
|
||||
}};
|
||||
|
||||
auto inventoryDisplay{artificerEnchantWindow->ADD("Accessory List",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{0.f,28.f},{artificerEnchantWindow->size.x/2-4.f,artificerEnchantWindow->size.y-44}},"","",[](MenuFuncData data){
|
||||
@ -94,6 +99,7 @@ void Menu::InitializeArtificerEnchantWindow(){
|
||||
auto enchantListHeaderLabel{artificerEnchantWindow->ADD("Enchant List Header",MenuLabel)(geom2d::rect<float>{{artificerEnchantWindow->size.x/2+4.f,92.f},{artificerEnchantWindow->size.x/2+12.f,12.f}},"Possible Enchantments:",1.f,ComponentAttr::FIT_TO_LABEL|ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END};
|
||||
|
||||
auto enchantContainer{artificerEnchantWindow->ADD("Enchant Container",ScrollableWindowComponent)(geom2d::rect<float>{{artificerEnchantWindow->size.x/2+4.f,104.f},{artificerEnchantWindow->size.x/2+12.f,44.f}})END};
|
||||
auto enchantList{enchantContainer->ADD("Enchant List",MenuLabel)(geom2d::rect<float>{{0.f,2.f},{enchantContainer->GetSize().x-12.f,0.f}},"",1.f,ComponentAttr::CENTER|ComponentAttr::SHADOW)END};
|
||||
|
||||
auto enchantCostLabel{artificerEnchantWindow->ADD("Enchant Cost Label",MenuLabel)(geom2d::rect<float>{{artificerEnchantWindow->size.x/2+4.f,152.f},{64.f,20.f}},"Enchant Cost:",1.f,ComponentAttr::SHADOW|ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)END};
|
||||
|
||||
|
@ -52,6 +52,7 @@ INCLUDE_DATA
|
||||
const Pixel ItemEnchantInfo::enchantAttributeCol{0x00DFE2};
|
||||
std::unordered_map<std::string,ItemEnchantInfo>ItemEnchantInfo::ENCHANT_LIST;
|
||||
std::unordered_map<ItemEnchantInfo::ItemEnchantCategory,ItemEnchantInfo::ItemEnchantCategoryData>ItemEnchantInfo::ENCHANT_CATEGORIES;
|
||||
std::unordered_map<ItemEnchantInfo::ItemEnchantCategory,Pixel>ItemEnchantInfo::enchantTextDisplayCol;
|
||||
|
||||
const ItemEnchantInfo&operator ""_ENC(const char*key,std::size_t len){
|
||||
return ItemEnchantInfo::GetEnchant(std::string(key));
|
||||
@ -79,6 +80,8 @@ void ItemEnchantInfo::Initialize(){
|
||||
enchantCategory=ItemEnchantCategory::UNIQUE;
|
||||
}else ERR(std::format("WARNING! Enchant type {} is not supported! THIS SHOULD NOT BE HAPPENING! Please check ItemEnchants.txt",key));
|
||||
|
||||
enchantTextDisplayCol[enchantCategory]=DATA["Item Enchants"][key]["Enchant Display Color"].GetPixel();
|
||||
|
||||
datafile&enchantData=DATA["Item Enchants"][key];
|
||||
|
||||
ItemEnchantCategoryData categoryData;
|
||||
@ -290,7 +293,7 @@ std::map<ItemAttribute,float>::const_iterator ItemEnchant::end()const{
|
||||
}
|
||||
|
||||
const Pixel&ItemEnchant::DisplayCol()const{
|
||||
return ItemEnchantInfo::GetEnchant(Name()).enchantAttributeCol;
|
||||
return ItemEnchantInfo::enchantTextDisplayCol.at(Category());
|
||||
}
|
||||
|
||||
const std::optional<ItemEnchantInfo::AbilitySlot>&ItemEnchantInfo::GetAbilitySlot()const{
|
||||
@ -321,4 +324,8 @@ const std::optional<Ability*>ItemEnchantInfo::GetAbility()const{
|
||||
const std::optional<std::reference_wrapper<Ability>>ItemEnchant::Ability()const{
|
||||
if(GetEnchantInfo().GetAbility())return **GetEnchantInfo().GetAbility();
|
||||
return {};
|
||||
}
|
||||
|
||||
const Pixel&ItemEnchantInfo::DisplayCol()const{
|
||||
return ItemEnchantInfo::enchantTextDisplayCol.at(Category());
|
||||
}
|
@ -69,6 +69,7 @@ public:
|
||||
static void Initialize();
|
||||
const static ItemEnchantInfo&GetEnchant(const std::string_view enchantName);
|
||||
const static std::unordered_map<std::string,ItemEnchantInfo>&GetEnchants();
|
||||
static std::unordered_map<ItemEnchantCategory,Pixel>enchantTextDisplayCol;
|
||||
|
||||
const std::string Name(TextStyle style=TextStyle::NORMAL)const;
|
||||
const std::string_view Description()const;
|
||||
@ -76,6 +77,7 @@ public:
|
||||
const std::optional<Class>&GetClass()const;
|
||||
const std::optional<AbilitySlot>&GetAbilitySlot()const;
|
||||
const std::optional<Ability*>GetAbility()const; //Get the ability this enchant is tied to.
|
||||
const Pixel&DisplayCol()const;
|
||||
const float GetConfigValue(const std::string_view keyName)const;
|
||||
const float operator[](const std::string&name)const;
|
||||
private:
|
||||
|
@ -223,7 +223,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
if(game->GetMouseWheel()!=0){
|
||||
if(game->GetMouseWheel()!=0&&geom2d::overlaps(game->GetMousePos(),geom2d::rect<float>{windowAbsPos,rect.size})){
|
||||
if(game->GetMouseWheel()>0){
|
||||
SetScrollAmount(GetTargetScrollAmount()+vf2d{0,"ThemeGlobal.MenuScrollWheelSpeed"_F});
|
||||
}else{
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 5
|
||||
#define VERSION_BUILD 11497
|
||||
#define VERSION_BUILD 11508
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user