Add in basic setup for Artificer Disassembly menu. Release Build 11382.
This commit is contained in:
parent
ef5239657d
commit
ac934eead5
@ -38,11 +38,42 @@ All rights reserved.
|
|||||||
|
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "AdventuresInLestoria.h"
|
#include "AdventuresInLestoria.h"
|
||||||
|
#include "RowInventoryScrollableWindowComponent.h"
|
||||||
|
#include "InventoryCreator.h"
|
||||||
|
#include "MenuItemItemButton.h"
|
||||||
|
#include "RowItemDisplay.h"
|
||||||
|
|
||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
|
|
||||||
void Menu::InitializeArtificerDisassembleWindow(){
|
void Menu::InitializeArtificerDisassembleWindow(){
|
||||||
Menu*artificerDisassembleWindow=CreateMenu(ARTIFICER_DISASSEMBLE,CENTERED,vi2d{144,144});
|
Menu*artificerDisassembleWindow=CreateMenu(ARTIFICER_DISASSEMBLE,CENTERED,game->GetScreenSize()-vi2d{52,52});
|
||||||
|
|
||||||
|
auto disassemblyTitleLabel{artificerDisassembleWindow->ADD("Disassembly Title Label",MenuLabel)(geom2d::rect<float>{{},{artificerDisassembleWindow->size.x,24.f}},"Accessory Disassembly",2.f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END};
|
||||||
|
|
||||||
|
auto inventoryLabel=artificerDisassembleWindow->ADD("Accessory List Label",MenuLabel)(geom2d::rect<float>{{0.f,28.f},{180.f,12.f}},"Choose Accessory:",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
|
||||||
|
|
||||||
|
auto inventoryDisplay=artificerDisassembleWindow->ADD("Accessory List",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{0.f,44.f},{artificerDisassembleWindow->size.x/2-4.f,artificerDisassembleWindow->size.y-60}},"","",[](MenuFuncData data){
|
||||||
|
return true;
|
||||||
|
},[](MenuFuncData data){
|
||||||
|
RowItemDisplay&item{*DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component)};
|
||||||
|
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(item.GetItem().lock());
|
||||||
|
return true;
|
||||||
|
},DO_NOTHING,
|
||||||
|
InventoryCreator::RowPlayer_InventoryUpdate,
|
||||||
|
InventoryWindowOptions{.padding=1,.size={artificerDisassembleWindow->size.x/2-5.f-12.f,28}})END;
|
||||||
|
|
||||||
|
auto itemIcon{artificerDisassembleWindow->ADD("Item Icon",MenuItemItemButton)(geom2d::rect<float>({artificerDisassembleWindow->size.x/2+4.f,44.f},{48,48}),Item::BLANK,DO_NOTHING,"","Item Description",IconButtonAttr::NOT_SELECTABLE)END};
|
||||||
|
itemIcon->SetIconScale({2.f,2.f});
|
||||||
|
itemIcon->SetCompactDescriptions(true);
|
||||||
|
|
||||||
|
auto accessoryDescription{artificerDisassembleWindow->ADD("Item Description",MenuLabel)(geom2d::rect<float>({artificerDisassembleWindow->size.x/2+56.f,44.f},{artificerDisassembleWindow->size.x/2-56.f,72.f}),"",0.5f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END};
|
||||||
|
|
||||||
|
auto backButton=artificerDisassembleWindow->ADD("Back",MenuComponent)(geom2d::rect<float>{{0.f,artificerDisassembleWindow->size.y-12.f},{96.f,16.f}},"Back",[](MenuFuncData data){
|
||||||
|
Menu::CloseMenu();
|
||||||
|
return true;
|
||||||
|
})END;
|
||||||
|
|
||||||
|
Menu::AddInventoryListener(inventoryDisplay,"Accessories");
|
||||||
|
|
||||||
artificerDisassembleWindow->SetupKeyboardNavigation(
|
artificerDisassembleWindow->SetupKeyboardNavigation(
|
||||||
[](MenuType type,Data&returnData){ //On Open
|
[](MenuType type,Data&returnData){ //On Open
|
||||||
|
@ -153,6 +153,7 @@ void ItemInfo::InitializeItems(){
|
|||||||
std::unordered_set<std::string>equippableClass;
|
std::unordered_set<std::string>equippableClass;
|
||||||
EventName useSound;
|
EventName useSound;
|
||||||
std::optional<std::string>fragmentName;
|
std::optional<std::string>fragmentName;
|
||||||
|
std::optional<std::string>fragmentIcon;
|
||||||
for(auto&[itemKey,itemValue]:data[key].GetKeys()){
|
for(auto&[itemKey,itemValue]:data[key].GetKeys()){
|
||||||
std::string keyName=itemKey;
|
std::string keyName=itemKey;
|
||||||
if(keyName=="Description"){
|
if(keyName=="Description"){
|
||||||
@ -204,6 +205,9 @@ void ItemInfo::InitializeItems(){
|
|||||||
}else
|
}else
|
||||||
if(keyName.starts_with("Fragment Name")){
|
if(keyName.starts_with("Fragment Name")){
|
||||||
fragmentName=data[key][keyName].GetString();
|
fragmentName=data[key][keyName].GetString();
|
||||||
|
}else
|
||||||
|
if(keyName.starts_with("Fragment Icon")){
|
||||||
|
fragmentIcon=data[key][keyName].GetString();
|
||||||
}else{ //THis is a custom override modifier for a script. NO-OP
|
}else{ //THis is a custom override modifier for a script. NO-OP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,6 +330,7 @@ void ItemInfo::InitializeItems(){
|
|||||||
it.minStats=minStats;
|
it.minStats=minStats;
|
||||||
it.maxStats=maxStats;
|
it.maxStats=maxStats;
|
||||||
it.fragmentName=fragmentName;
|
it.fragmentName=fragmentName;
|
||||||
|
it.fragmentIcon=fragmentIcon;
|
||||||
|
|
||||||
#pragma region Equipment Category Verification Tests
|
#pragma region Equipment Category Verification Tests
|
||||||
int equipmentCategories=0;
|
int equipmentCategories=0;
|
||||||
@ -368,6 +373,14 @@ void ItemInfo::InitializeItems(){
|
|||||||
ItemInfo&it{ITEM_DATA[fragmentName]};
|
ItemInfo&it{ITEM_DATA[fragmentName]};
|
||||||
GFX[fragmentName].Create(24,24);
|
GFX[fragmentName].Create(24,24);
|
||||||
if(!game->TestingModeEnabled()){
|
if(!game->TestingModeEnabled()){
|
||||||
|
if(it.FragmentIcon()){
|
||||||
|
game->SetDrawTarget(GFX.at(fragmentName).Sprite());
|
||||||
|
game->Clear(BLANK);
|
||||||
|
game->SetPixelMode(Pixel::ALPHA);
|
||||||
|
game->DrawSprite({},GFX.at(it.FragmentIcon().value()).Sprite());
|
||||||
|
game->SetDrawTarget(nullptr);
|
||||||
|
GFX.at(fragmentName).Decal()->Update();
|
||||||
|
}else{
|
||||||
#pragma region Collect colors from source ring image
|
#pragma region Collect colors from source ring image
|
||||||
std::set<Pixel>colors;
|
std::set<Pixel>colors;
|
||||||
for(int y=0;y<24;y++){
|
for(int y=0;y<24;y++){
|
||||||
@ -390,6 +403,7 @@ void ItemInfo::InitializeItems(){
|
|||||||
GFX.at(fragmentName).Decal()->Update();
|
GFX.at(fragmentName).Decal()->Update();
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
}
|
}
|
||||||
|
}
|
||||||
it.img=GFX.at(fragmentName).Decal();
|
it.img=GFX.at(fragmentName).Decal();
|
||||||
it.name=fragmentName;
|
it.name=fragmentName;
|
||||||
it.description="Fragment Description"_S;
|
it.description="Fragment Description"_S;
|
||||||
@ -1495,3 +1509,6 @@ const bool Item::SelectedEquipIsDifferent(const std::weak_ptr<Item>equipAttempti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const std::optional<std::string>&ItemInfo::FragmentIcon()const{
|
||||||
|
return fragmentIcon;
|
||||||
|
}
|
@ -361,6 +361,7 @@ class ItemInfo{
|
|||||||
Stats minStats;
|
Stats minStats;
|
||||||
Stats maxStats;
|
Stats maxStats;
|
||||||
std::optional<std::string>fragmentName;
|
std::optional<std::string>fragmentName;
|
||||||
|
std::optional<std::string>fragmentIcon;
|
||||||
private:
|
private:
|
||||||
static void InitializeScripts();
|
static void InitializeScripts();
|
||||||
static void InitializeSets();
|
static void InitializeSets();
|
||||||
@ -403,6 +404,7 @@ public:
|
|||||||
const std::unordered_set<std::string>&GetClass()const;
|
const std::unordered_set<std::string>&GetClass()const;
|
||||||
Stats RandomizeStats();
|
Stats RandomizeStats();
|
||||||
const std::string&FragmentName()const;
|
const std::string&FragmentName()const;
|
||||||
|
const std::optional<std::string>&FragmentIcon()const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ItemOverlay{
|
class ItemOverlay{
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
}
|
}
|
||||||
inline const std::weak_ptr<Item>SetItem(const std::weak_ptr<Item>newItem,bool labelUpdate=true){
|
inline const std::weak_ptr<Item>SetItem(const std::weak_ptr<Item>newItem,bool labelUpdate=true){
|
||||||
itemRef=newItem;
|
itemRef=newItem;
|
||||||
|
borderCol=newItem.lock()->HasEnchant()?newItem.lock()->GetEnchant().value().DisplayCol():WHITE;
|
||||||
if(labelUpdate){
|
if(labelUpdate){
|
||||||
UpdateLabel();
|
UpdateLabel();
|
||||||
}
|
}
|
||||||
@ -135,10 +136,12 @@ protected:
|
|||||||
}
|
}
|
||||||
if(itemNameLabelName!=""){
|
if(itemNameLabelName!=""){
|
||||||
Component<MenuLabel>(parentMenu,itemNameLabelName)->SetLabel(labelNameText);
|
Component<MenuLabel>(parentMenu,itemNameLabelName)->SetLabel(labelNameText);
|
||||||
|
Component<MenuLabel>(parentMenu,itemNameLabelName)->SetBorderCol(borderCol);
|
||||||
Component<MenuLabel>(parentMenu,itemNameLabelName)->Enable();
|
Component<MenuLabel>(parentMenu,itemNameLabelName)->Enable();
|
||||||
}
|
}
|
||||||
if(itemDescriptionLabelName!=""){
|
if(itemDescriptionLabelName!=""){
|
||||||
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->SetLabel(labelDescriptionText);
|
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->SetLabel(labelDescriptionText);
|
||||||
|
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->SetBorderCol(borderCol);
|
||||||
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->Enable();
|
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->Enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,9 @@ public:
|
|||||||
CalculateWrappedLabel();
|
CalculateWrappedLabel();
|
||||||
if(runOnLabelChangeFunc)onLabelChangeFunc(text);
|
if(runOnLabelChangeFunc)onLabelChangeFunc(text);
|
||||||
}
|
}
|
||||||
|
inline void SetBorderCol(const Pixel col){
|
||||||
|
borderCol=col;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
inline virtual void Update(AiL*game)override{
|
inline virtual void Update(AiL*game)override{
|
||||||
MenuComponent::Update(game);
|
MenuComponent::Update(game);
|
||||||
@ -122,7 +125,7 @@ protected:
|
|||||||
if(shadow){
|
if(shadow){
|
||||||
if(proportional){
|
if(proportional){
|
||||||
for(int counter=0;const std::string_view&text:lines){
|
for(int counter=0;const std::string_view&text:lines){
|
||||||
window.DrawShadowStringPropDecal(rect.pos+vf2d{offsets[counter],counter*10.f},text,WHITE,BLACK);
|
window.DrawShadowStringPropDecal(rect.pos+vf2d{offsets[counter],counter*10.f},text,WHITE,BLACK,{scale,scale});
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -131,7 +134,7 @@ protected:
|
|||||||
}else{
|
}else{
|
||||||
if(proportional){
|
if(proportional){
|
||||||
for(int counter=0;const std::string_view&text:lines){
|
for(int counter=0;const std::string_view&text:lines){
|
||||||
window.DrawStringPropDecal(rect.pos+vf2d{offsets[counter],counter*10.f},text,WHITE);
|
window.DrawStringPropDecal(rect.pos+vf2d{offsets[counter],counter*10.f},text,WHITE,{scale,scale});
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -159,7 +162,7 @@ private:
|
|||||||
if(multiLineCentered){
|
if(multiLineCentered){
|
||||||
lines.clear();
|
lines.clear();
|
||||||
offsets.clear();
|
offsets.clear();
|
||||||
wrappedLabel=util::WrapText(game,GetLabel(),rect.size.x,true,{1.f,1.f});
|
wrappedLabel=util::WrapText(game,GetLabel(),rect.size.x,true,{scale,scale});
|
||||||
int labelInd=0;
|
int labelInd=0;
|
||||||
float largestWidth=0;
|
float largestWidth=0;
|
||||||
while(labelInd!=wrappedLabel.length()){
|
while(labelInd!=wrappedLabel.length()){
|
||||||
@ -176,11 +179,11 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(const std::string_view&text:lines){
|
for(const std::string_view&text:lines){
|
||||||
float width=game->GetTextSizeProp(text).x;
|
float width=game->GetTextSizeProp(text).x*scale;
|
||||||
offsets.push_back(rect.size.x/2.f-width/2);
|
offsets.push_back(rect.size.x/2.f-width/2);
|
||||||
}
|
}
|
||||||
//Recalculate label height based on line count.
|
//Recalculate label height based on line count.
|
||||||
rect.size.y=lines.size()*10.f;
|
rect.size.y=lines.size()*10.f*scale;
|
||||||
if(!parentComponent.expired()){
|
if(!parentComponent.expired()){
|
||||||
parentComponent.lock()->CalculateBounds();
|
parentComponent.lock()->CalculateBounds();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.DrawDecal(rect.pos+vf2d{2,2},const_cast<Decal*>(itemRef.lock()->Decal()),{scaleFactor,scaleFactor},tint);
|
window.DrawDecal(rect.pos+vf2d{2,2},const_cast<Decal*>(itemRef.lock()->Decal()),{scaleFactor,scaleFactor},tint);
|
||||||
window.DrawRectDecal(rect.pos+vf2d{2,2},iconSize);
|
window.DrawRectDecal(rect.pos+vf2d{2,2},iconSize,borderCol);
|
||||||
|
|
||||||
#pragma region Item Name Display
|
#pragma region Item Name Display
|
||||||
std::string itemName=itemRef.lock()->DisplayName();
|
std::string itemName=itemRef.lock()->DisplayName();
|
||||||
@ -119,8 +119,8 @@ public:
|
|||||||
window.DrawShadowStringPropDecal(rect.pos+rect.size-vf2d{1,1}+vf2d{-qtyTextSize.x,-qtyTextSize.y},quantityText,WHITE,BLACK,{qtyTextScale,qtyTextScale});
|
window.DrawShadowStringPropDecal(rect.pos+rect.size-vf2d{1,1}+vf2d{-qtyTextSize.x,-qtyTextSize.y},quantityText,WHITE,BLACK,{qtyTextScale,qtyTextScale});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
borderCol=itemRef.lock()->HasEnchant()?itemRef.lock()->GetEnchant().value().DisplayCol():WHITE;
|
||||||
if(priceLabel!=PriceLabel::NONE){
|
if(priceLabel!=PriceLabel::NONE){
|
||||||
borderCol=WHITE;
|
|
||||||
switch(priceLabel){
|
switch(priceLabel){
|
||||||
case PriceLabel::CRAFTABLE:{
|
case PriceLabel::CRAFTABLE:{
|
||||||
if(!canEnhance&&fadeOutIfMissingRequirements){
|
if(!canEnhance&&fadeOutIfMissingRequirements){
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 5
|
#define VERSION_PATCH 5
|
||||||
#define VERSION_BUILD 11362
|
#define VERSION_BUILD 11382
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user