game: add a filter for player inventory

This commit is contained in:
Crypto City 2020-04-08 00:42:10 +00:00
parent a0b6a6e8aa
commit 29c65a60e6
3 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,7 @@ TBTabContainer
TBLayout: axis: y, distribution-position: "left top", distribution: "gravity"
TBSelectList: id: "item-balances", gravity: "all"
TBEditField: id: "items-search", gravity: "left right", placeholder: "search", type: "search"
TBLayout: axis: y, distribution-position: "left top", distribution: "gravity"
TBSelectList: id: "flags", gravity: "all"

View File

@ -590,6 +590,7 @@ UIPlayerInfoDialog::UIPlayerInfoDialog(Context *ctx, const GameState *game, uint
levelUpWidget = GetWidgetByIDAndType<TBButton>(TBIDC("level-up"));
playerProfileWidget = GetWidgetByIDAndType<TBEditField>(TBIDC("player-profile"));
savePlayerProfileWidget = GetWidgetByIDAndType<TBButton>(TBIDC("save-player-profile"));
itemsSearchWidget = GetWidgetByIDAndType<TBEditField>(TBIDC("items-search"));
flagsWidget->SetHeader(flagsHeaderWidget = new FlagListHeaderWidget(context_), true);
SubscribeToEvent(flagsHeaderWidget, E_LIST_HEADER_RESIZED, URHO3D_HANDLER(UIPlayerInfoDialog, HandleListHeaderResized));
@ -793,6 +794,11 @@ void UIPlayerInfoDialog::HandleDiscoveriesSearchChanged(StringHash eventType, Va
discoveriesWidget->SetFilter(discoveriesSearchWidget->GetText());
}
void UIPlayerInfoDialog::HandleItemsSearchChanged(StringHash eventType, VariantMap& eventData)
{
itemBalancesWidget->SetFilter(itemsSearchWidget->GetText());
}
void UIPlayerInfoDialog::HandleColumnsChanged(StringHash eventType, VariantMap& eventData)
{
TBWidgetEvent *ev = (TBWidgetEvent*)eventData[TBWidgetEventNamespace::P_WIDGET_EVENT].GetVoidPtr();
@ -933,6 +939,7 @@ void UIPlayerInfoDialog::HandleTBMessage(StringHash eventType, VariantMap& event
{
CONNECT("flags-search", HandleFlagsSearchChanged);
CONNECT("discoveries-search", HandleDiscoveriesSearchChanged);
CONNECT("items-search", HandleItemsSearchChanged);
CONNECT("column-visibility", HandleColumnsChanged);
}

View File

@ -51,6 +51,7 @@ private:
void HandleGiveMoney(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
void HandleFlagsSearchChanged(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
void HandleDiscoveriesSearchChanged(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
void HandleItemsSearchChanged(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
void HandleColumnsChanged(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
void HandleTBMessage(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
@ -176,6 +177,7 @@ private:
FlagListHeaderWidget *flagsHeaderWidget;
tb::TBEditField *flagsSearchWidget;
tb::TBSelectList *discoveriesWidget;
tb::TBEditField *itemsSearchWidget;
tb::TBEditField *discoveriesSearchWidget;
tb::TBSelectDropdown *columnsWidget;
tb::TBSelectList *badgesWidget;