Skip to content

Commit

Permalink
Implement stash all button in dead-body inventory
Browse files Browse the repository at this point in the history
For #58
  • Loading branch information
Hozar2002 committed Aug 4, 2024
1 parent 9d6ebc4 commit 119d3be
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
12 changes: 12 additions & 0 deletions gamedata/configs/ui/actor_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@
</text_color>
</takeall_button>

<putall_button x="699" y="695" width="312" height="24" stretch="1" hint="ui_st_put_all_hint">
<window_name>putall_button</window_name>
<texture>ui_inGame2_big_inventory_button</texture>
<text font="graffiti22" align="c">ui_st_put_all</text>
<text_color>
<e color ="ui_6"/>
<t color ="ui_black"/>
<d color ="ui_5"/>
<h color ="ui_black"/>
</text_color>
</putall_button>

<exit_button x="353" y="736" width="320" height="24" hint="ui_st_exit_hint">
<window_name>exit_button</window_name>
<texture>ui_inGame2_big_inventory_button</texture>
Expand Down
26 changes: 19 additions & 7 deletions gamedata/configs/ui/actor_menu_16.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,31 +265,31 @@
<dragdrop_trash x="0" y="0" width="375" height="768"
cell_width="375" cell_height="768" rows_num="1" cols_num="1" a="0"/>

<dragdrop_bag x="662" y="119" width="250" height="574"
<dragdrop_bag x="662" y="119" width="247" height="574"
cell_width="33" cell_height="41" rows_num="14" cols_num="7"
unlimited="1" group_similar="1" always_show_scroll="1" condition_progress_bar="1"/>

<dragdrop_belt x="390" y="480" width="240" height="41"
cell_width="33" cell_height="41" rows_num="1" cols_num="5"
cell_sp_x="19" cell_sp_y="0" a="0"/>

<dragdrop_actor_trade x="662" y="114" width="250" height="164"
<dragdrop_actor_trade x="662" y="114" width="247" height="164"
cell_width="33" cell_height="41" rows_num="4" cols_num="7"
unlimited="1" group_similar="1" always_show_scroll="1" condition_progress_bar="1"/>

<dragdrop_actor_trade_bag x="662" y="340" width="250" height="369"
<dragdrop_actor_trade_bag x="662" y="340" width="247" height="369"
cell_width="33" cell_height="41" rows_num="9" cols_num="7"
unlimited="1" group_similar="1" always_show_scroll="1" condition_progress_bar="1"/>

<dragdrop_partner_trade x="117" y="114" width="250" height="164"
<dragdrop_partner_trade x="117" y="114" width="247" height="164"
cell_width="33" cell_height="41" rows_num="4" cols_num="7"
unlimited="1" group_similar="1" always_show_scroll="1" condition_progress_bar="1"/>

<dragdrop_partner_bag x="117" y="340" width="250" height="369"
<dragdrop_partner_bag x="117" y="340" width="247" height="369"
cell_width="33" cell_height="41" rows_num="9" cols_num="7"
unlimited="1" group_similar="1" always_show_scroll="1" condition_progress_bar="1"/>

<dragdrop_deadbody_bag x="117" y="119" width="250" height="574"
<dragdrop_deadbody_bag x="117" y="119" width="247" height="574"
cell_width="33" cell_height="41" rows_num="14" cols_num="7"
unlimited="1" group_similar="1" always_show_scroll="1" condition_progress_bar="1"/>

Expand Down Expand Up @@ -321,7 +321,7 @@
</text_color>
</trade_sell_button>

<takeall_button x="115" y="695" width="249" height="24" stretch="1" hint="ui_st_take_all_hint">
<takeall_button x="116" y="694" width="248" height="24" stretch="1" hint="ui_st_take_all_hint">
<window_name>takeall_button</window_name>
<texture>ui_inGame2_big_inventory_button</texture>
<text font="graffiti22" align="c">ui_st_take_all</text>
Expand All @@ -333,6 +333,18 @@
</text_color>
</takeall_button>

<putall_button x="662" y="694" width="248" height="24" stretch="1" hint="ui_st_put_all_hint">
<window_name>putall_button</window_name>
<texture>ui_inGame2_big_inventory_button</texture>
<text font="graffiti22" align="c">ui_st_put_all</text>
<text_color>
<e color ="ui_6"/>
<t color ="ui_black"/>
<d color ="ui_5"/>
<h color ="ui_black"/>
</text_color>
</putall_button>

<exit_button x="384" y="736" width="256" height="24" stretch="1" hint="ui_st_exit_hint">
<window_name>exit_button</window_name>
<texture>ui_inGame2_big_inventory_button</texture>
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ui/UIActorMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class CUIActorMenu : public CUIDialogWnd,
CUI3tButton* m_trade_buy_button;
CUI3tButton* m_trade_sell_button;
CUI3tButton* m_takeall_button;
CUI3tButton* m_putall_button;
CUI3tButton* m_exit_button;
// CUIStatic* m_clock_value;

Expand Down Expand Up @@ -334,6 +335,7 @@ class CUIActorMenu : public CUIDialogWnd,
void OnBtnPerformTradeSell (CUIWindow* w, void* d);
void OnBtnExitClicked (CUIWindow* w, void* d);
void TakeAllFromPartner (CUIWindow* w, void* d);
void PutAllToPartner (CUIWindow* w, void* d);
void TakeAllFromInventoryBox ();
void UpdateConditionProgressBars ();

Expand Down
15 changes: 15 additions & 0 deletions src/xrGame/ui/UIActorMenuDeadBodySearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void CUIActorMenu::InitDeadBodySearchMode()
m_PartnerBottomInfo->Show (true);
m_PartnerWeight->Show (true);
m_takeall_button->Show (true);
m_putall_button->Show (true);

if ( m_pPartnerInvOwner )
{
Expand Down Expand Up @@ -125,6 +126,7 @@ void CUIActorMenu::DeInitDeadBodySearchMode()
m_PartnerBottomInfo->Show (false);
m_PartnerWeight->Show (false);
m_takeall_button->Show (false);
m_putall_button->Show (false);

if ( m_pInvBox )
{
Expand Down Expand Up @@ -201,6 +203,19 @@ void CUIActorMenu::UpdateDeadBodyBag()
m_PartnerBottomInfo->SetWndPos( pos );
}

void CUIActorMenu::PutAllToPartner(CUIWindow* w, void* d)
{
u32 Iter = 0;
while (Iter < m_pInventoryBagList->ItemsCount())
{
CUICellItem* ci = m_pInventoryBagList->GetItemIdx(Iter);
if (!ToDeadBodyBag(ci, false))
{
++Iter;
}
}
}

void CUIActorMenu::TakeAllFromPartner(CUIWindow* w, void* d)
{
VERIFY( m_pActorInvOwner );
Expand Down
3 changes: 3 additions & 0 deletions src/xrGame/ui/UIActorMenuInitialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ void CUIActorMenu::Construct()
m_trade_buy_button = UIHelper::Create3tButton(uiXml, "trade_buy_button", this);
m_trade_sell_button = UIHelper::Create3tButton(uiXml, "trade_sell_button", this);
m_takeall_button = UIHelper::Create3tButton(uiXml, "takeall_button", this);
m_putall_button = UIHelper::Create3tButton(uiXml, "putall_button", this);
m_exit_button = UIHelper::Create3tButton(uiXml, "exit_button", this);

// m_clock_value = UIHelper::CreateStatic(uiXml, "clock_value", this);
Expand Down Expand Up @@ -391,6 +392,7 @@ void CUIActorMenu::InitCallbacks()
Register (m_trade_buy_button);
Register (m_trade_sell_button);
Register (m_takeall_button);
Register (m_putall_button);
Register (m_exit_button);
Register (m_UIPropertiesBox);
VERIFY (m_pUpgradeWnd);
Expand All @@ -399,6 +401,7 @@ void CUIActorMenu::InitCallbacks()
AddCallback(m_trade_buy_button,BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::OnBtnPerformTradeBuy));
AddCallback(m_trade_sell_button,BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::OnBtnPerformTradeSell));
AddCallback(m_takeall_button, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::TakeAllFromPartner));
AddCallback(m_putall_button, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::PutAllToPartner));
AddCallback(m_exit_button, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::OnBtnExitClicked));
AddCallback(m_UIPropertiesBox, PROPERTY_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::ProcessPropertiesBoxClicked));
AddCallback(m_pUpgradeWnd->m_btn_repair, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::TryRepairItem));
Expand Down

0 comments on commit 119d3be

Please sign in to comment.