… | |
… | |
712 | }); |
712 | }); |
713 | } |
713 | } |
714 | |
714 | |
715 | sub server_setup { |
715 | sub server_setup { |
716 | my $dialog = new CFClient::UI::FancyFrame |
716 | my $dialog = new CFClient::UI::FancyFrame |
717 | x => $WIDTH * (1/3), |
717 | x => $WIDTH * (1/3), |
718 | y => $HEIGHT * (1/8), |
718 | y => $HEIGHT * (1/8), |
719 | name => "server_setup", |
719 | name => "server_setup", |
720 | title => "Server Setup", |
720 | title => "Server Setup", |
721 | child => (my $vbox = new CFClient::UI::VBox), |
721 | child => (my $vbox = new CFClient::UI::VBox), |
722 | on_visibility_change => sub { |
722 | on_visibility_change => sub { |
723 | $_[0]->show_centered if $_[1] |
723 | my ($self, $visible) = @_; |
|
|
724 | $self->center if $visible; |
724 | }; |
725 | }, |
|
|
726 | ; |
725 | |
727 | |
726 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
728 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
727 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
729 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
728 | |
730 | |
729 | { |
731 | { |
… | |
… | |
886 | $window |
888 | $window |
887 | } |
889 | } |
888 | |
890 | |
889 | sub open_quit_dialog { |
891 | sub open_quit_dialog { |
890 | unless ($QUIT_DIALOG) { |
892 | unless ($QUIT_DIALOG) { |
891 | |
|
|
892 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
893 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
893 | |
894 | |
894 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
895 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
895 | |
896 | |
896 | $vb->add (new CFClient::UI::Label |
897 | $vb->add (new CFClient::UI::Label |
… | |
… | |
907 | $hb->add (new CFClient::UI::Button |
908 | $hb->add (new CFClient::UI::Button |
908 | text => "Quit anyway", |
909 | text => "Quit anyway", |
909 | expand => 1, |
910 | expand => 1, |
910 | on_activate => sub { exit }, |
911 | on_activate => sub { exit }, |
911 | ); |
912 | ); |
|
|
913 | } |
912 | |
914 | |
|
|
915 | $QUIT_DIALOG->show; |
913 | $QUIT_DIALOG->show_centered; |
916 | $QUIT_DIALOG->center; |
914 | } else { |
|
|
915 | $QUIT_DIALOG->show_centered; |
|
|
916 | } |
|
|
917 | } |
917 | } |
918 | |
918 | |
919 | sub make_inventory_window { |
919 | sub make_inventory_window { |
920 | my $invwin = new CFClient::UI::FancyFrame |
920 | my $invwin = new CFClient::UI::FancyFrame |
921 | def_w => $WIDTH * (7/8), |
921 | def_w => $WIDTH * 7/8, |
922 | def_h => $HEIGHT * (7/8), |
922 | def_h => $HEIGHT * 7/8, |
923 | title => "Inventory", |
923 | title => "Inventory", |
924 | name => "inventory_window", |
924 | name => "inventory_window", |
925 | on_visibility_change => sub { |
925 | on_visibility_change => sub { |
926 | $_[0]->show_centered if $_[1] |
926 | my ($self, $visible) = @_; |
|
|
927 | $self->center if $visible; |
927 | }; |
928 | }, |
|
|
929 | ; |
928 | |
930 | |
929 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
931 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
930 | |
932 | |
931 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
933 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
932 | $vb1->add (my $lbl = new CFClient::UI::Label align => 0); |
934 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
933 | $lbl->set_text ("Player"); |
|
|
934 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
935 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
935 | |
936 | |
936 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
937 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
937 | |
938 | |
938 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
939 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
939 | $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1); |
940 | $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1, text => "Floor"); |
940 | $hb2->add (new CFClient::UI::Button |
941 | $hb2->add (new CFClient::UI::Button |
941 | text => "Close", |
942 | text => "Close", |
942 | tooltip => "Close the currently open container (if one is open)", |
943 | tooltip => "Close the currently open container (if one is open)", |
943 | on_activate => sub { |
944 | on_activate => sub { |
944 | $CONN->send ("apply $CONN->{open_container}") |
945 | $CONN->send ("apply $CONN->{open_container}") |
945 | if $CONN->{open_container} != 0; |
946 | if $CONN->{open_container} != 0; |
946 | }, |
947 | }, |
947 | ); |
948 | ); |
948 | |
949 | |
949 | $INVR_LBL->set_text ("Floor"); |
|
|
950 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
950 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
951 | |
951 | |
952 | $invwin |
952 | $invwin |
953 | } |
953 | } |
954 | |
954 | |