… | |
… | |
884 | user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Inventory"; |
884 | user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Inventory"; |
885 | |
885 | |
886 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
886 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
887 | |
887 | |
888 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
888 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
889 | $vb1->add (my $lbl = new CFClient::UI::Label); |
889 | $vb1->add (my $lbl = new CFClient::UI::Label xalign => 0.5); |
890 | $lbl->set_text ("Player"); |
890 | $lbl->set_text ("Player"); |
891 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
891 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
892 | |
892 | |
893 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
893 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
894 | $vb2->add ($INVR_LBL = new CFClient::UI::Label); |
894 | $vb2->add ($INVR_LBL = new CFClient::UI::Label xalign => 0.5); |
895 | $INVR_LBL->set_text ("Floor"); |
895 | $INVR_LBL->set_text ("Floor"); |
896 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
896 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
897 | |
897 | |
898 | $invwin |
898 | $invwin |
899 | } |
899 | } |
… | |
… | |
1748 | $FLOORBOX->add (0, 1, new CFClient::UI::Empty expand => 1); |
1748 | $FLOORBOX->add (0, 1, new CFClient::UI::Empty expand => 1); |
1749 | |
1749 | |
1750 | my $row; |
1750 | my $row; |
1751 | for (@{ $CONN->{container}{0} }) { |
1751 | for (@{ $CONN->{container}{0} }) { |
1752 | if (++$row < 7) { |
1752 | if (++$row < 7) { |
|
|
1753 | local $_->{face_widget}; # hack to force recreation of widget |
|
|
1754 | local $_->{desc_widget}; # hack to force recreation of widget |
1753 | CFClient::Item::update_widgets $_; |
1755 | CFClient::Item::update_widgets $_; |
|
|
1756 | |
1754 | $FLOORBOX->add (0, $row, $_->{face_widget}); |
1757 | $FLOORBOX->add (0, $row, $_->{face_widget}); |
1755 | $FLOORBOX->add (1, $row, $_->{desc_widget}); |
1758 | $FLOORBOX->add (1, $row, $_->{desc_widget}); |
1756 | } else { |
1759 | } else { |
1757 | $FLOORBOX->add (new CFClient::UI::Label text => "More..."); |
1760 | $FLOORBOX->add (new CFClient::UI::Label text => "More..."); |
1758 | last; |
1761 | last; |
… | |
… | |
1776 | } elsif ($tag == $self->{player}{tag}) { |
1779 | } elsif ($tag == $self->{player}{tag}) { |
1777 | $INVR_LBL->set_text ("Player"); |
1780 | $INVR_LBL->set_text ("Player"); |
1778 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1781 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1779 | } else { |
1782 | } else { |
1780 | $OPENCONT = $tag; |
1783 | $OPENCONT = $tag; |
1781 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1784 | $INVR_LBL->set_text (CFClient::Item::desc_string $self->{item}->{$OPENCONT}); |
1782 | $INVR->set_items ($self->{container}{$tag}); |
1785 | $INVR->set_items ($self->{container}{$tag}); |
1783 | } |
1786 | } |
1784 | |
1787 | |
1785 | # $self-<{player}{tag} => player inv |
1788 | # $self-<{player}{tag} => player inv |
1786 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
1789 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
… | |
… | |
1799 | } elsif ($tag == $self->{player}{tag}) { |
1802 | } elsif ($tag == $self->{player}{tag}) { |
1800 | $INVR_LBL->set_text ("Player"); |
1803 | $INVR_LBL->set_text ("Player"); |
1801 | $INV->set_items ($self->{container}{$tag}) |
1804 | $INV->set_items ($self->{container}{$tag}) |
1802 | } else { |
1805 | } else { |
1803 | $OPENCONT = $tag; |
1806 | $OPENCONT = $tag; |
1804 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1807 | $INVR_LBL->set_text (CFClient::Item::desc_string $self->{item}->{$OPENCONT}); |
1805 | $INVR->set_items ($self->{container}{$tag}); |
1808 | $INVR->set_items ($self->{container}{$tag}); |
1806 | } |
1809 | } |
1807 | |
1810 | |
1808 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1811 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1809 | } |
1812 | } |
… | |
… | |
1822 | } elsif ($_->{container} == $self->{player}{tag}) { |
1825 | } elsif ($_->{container} == $self->{player}{tag}) { |
1823 | $INVR_LBL->set_text ("Player"); |
1826 | $INVR_LBL->set_text ("Player"); |
1824 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1827 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1825 | } else { |
1828 | } else { |
1826 | $OPENCONT = $_->{container}; |
1829 | $OPENCONT = $_->{container}; |
1827 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1830 | $INVR_LBL->set_text (CFClient::Item::desc_string $self->{item}->{$OPENCONT}); |
1828 | $INVR->set_items ($self->{container}{$_->{container}}); |
1831 | $INVR->set_items ($self->{container}{$_->{container}}); |
1829 | } |
1832 | } |
1830 | } |
1833 | } |
1831 | } |
1834 | } |
1832 | |
1835 | |