… | |
… | |
81 | our $LOGVIEW; |
81 | our $LOGVIEW; |
82 | our $CONSOLE; |
82 | our $CONSOLE; |
83 | our $METASERVER; |
83 | our $METASERVER; |
84 | our $LOGIN_BUTTON; |
84 | our $LOGIN_BUTTON; |
85 | our $QUIT_DIALOG; |
85 | our $QUIT_DIALOG; |
|
|
86 | our $HOST_ENTRY; |
86 | our $SERVER_SETUP; |
87 | our $SERVER_SETUP; |
87 | |
88 | |
88 | our $FLOORBOX; |
89 | our $FLOORBOX; |
89 | our $GAUGES; |
90 | our $GAUGES; |
90 | our $STATWIDS; |
91 | our $STATWIDS; |
… | |
… | |
628 | |
629 | |
629 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
630 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
630 | for keys %tbl; |
631 | for keys %tbl; |
631 | } |
632 | } |
632 | |
633 | |
633 | sub metaserver_dialog { |
|
|
634 | my $dialog = new CFClient::UI::FancyFrame |
|
|
635 | title => "Server List", |
|
|
636 | child => (my $vbox = new CFClient::UI::VBox); |
|
|
637 | |
|
|
638 | $vbox->add ($dialog->{table} = new CFClient::UI::Table); |
|
|
639 | |
|
|
640 | $dialog |
|
|
641 | } |
|
|
642 | |
|
|
643 | my $METASERVER_ATIME; |
634 | my $METASERVER_ATIME; |
644 | |
635 | |
645 | sub update_metaserver { |
636 | sub update_metaserver { |
646 | my ($HOST) = @_; |
|
|
647 | |
|
|
648 | return if $METASERVER_ATIME > time; |
637 | return if $METASERVER_ATIME > time; |
649 | $METASERVER_ATIME = time + 60; |
638 | $METASERVER_ATIME = time + 60; |
650 | |
639 | |
651 | my $table = $METASERVER->{table}; |
640 | my $table = $METASERVER->{table}; |
652 | $table->clear; |
641 | $table->clear; |
… | |
… | |
704 | |
693 | |
705 | $y++; |
694 | $y++; |
706 | |
695 | |
707 | $table->add (0, $y, new CFClient::UI::VBox children => [ |
696 | $table->add (0, $y, new CFClient::UI::VBox children => [ |
708 | (new CFClient::UI::Button text => "Use", on_activate => sub { |
697 | (new CFClient::UI::Button text => "Use", on_activate => sub { |
709 | $HOST->set_text ($CFG->{host} = $host); |
698 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
|
|
699 | $METASERVER->toggle_visibility; |
710 | }), |
700 | }), |
711 | (new CFClient::UI::Empty expand => 1), |
701 | (new CFClient::UI::Empty expand => 1), |
712 | ]); |
702 | ]); |
713 | |
703 | |
714 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
704 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
… | |
… | |
717 | } |
707 | } |
718 | } |
708 | } |
719 | }); |
709 | }); |
720 | } |
710 | } |
721 | |
711 | |
|
|
712 | sub metaserver_dialog { |
|
|
713 | my $dialog = new CFClient::UI::FancyFrame |
|
|
714 | title => "Server List", |
|
|
715 | name => 'metaserver_dialog', |
|
|
716 | x => 'center', |
|
|
717 | y => 'center', |
|
|
718 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
719 | on_visibility_change => sub { |
|
|
720 | update_metaserver if $_[1]; |
|
|
721 | }, |
|
|
722 | ; |
|
|
723 | |
|
|
724 | $vbox->add ($dialog->{table} = new CFClient::UI::Table); |
|
|
725 | |
|
|
726 | $dialog |
|
|
727 | } |
|
|
728 | |
722 | sub server_setup { |
729 | sub server_setup { |
723 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
730 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
724 | x => "center", |
731 | x => "center", |
725 | y => "center", |
732 | y => "center", |
726 | name => "server_setup", |
733 | name => "server_setup", |
… | |
… | |
733 | |
740 | |
734 | { |
741 | { |
735 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
742 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
736 | |
743 | |
737 | $vbox->add ( |
744 | $vbox->add ( |
738 | my $HOST = new CFClient::UI::Entry |
745 | $HOST_ENTRY = new CFClient::UI::Entry |
739 | expand => 1, |
746 | expand => 1, |
740 | text => $CFG->{host}, |
747 | text => $CFG->{host}, |
741 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
748 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
742 | on_changed => sub { |
749 | on_changed => sub { |
743 | my ($self, $value) = @_; |
750 | my ($self, $value) = @_; |
… | |
… | |
745 | } |
752 | } |
746 | ); |
753 | ); |
747 | |
754 | |
748 | $METASERVER = metaserver_dialog; |
755 | $METASERVER = metaserver_dialog; |
749 | |
756 | |
750 | $vbox->add (new CFClient::UI::Flopper |
757 | $vbox->add (new CFClient::UI::Button |
751 | expand => 1, |
758 | expand => 1, |
752 | text => "Server List", |
759 | text => "Server List", |
753 | other => $METASERVER, |
760 | other => $METASERVER, |
754 | tooltip => "Show a list of available crossfire servers", |
761 | tooltip => "Show a list of available crossfire servers", |
755 | on_open => sub { |
762 | on_activate => sub { $METASERVER->toggle_visibility }, |
756 | update_metaserver $HOST; |
|
|
757 | } |
|
|
758 | ); |
763 | ); |
759 | } |
764 | } |
760 | |
765 | |
761 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
766 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
762 | $table->add (1, 4, new CFClient::UI::Entry |
767 | $table->add (1, 4, new CFClient::UI::Entry |
… | |
… | |
1056 | $BIND_WINDOW |
1061 | $BIND_WINDOW |
1057 | } |
1062 | } |
1058 | |
1063 | |
1059 | sub make_help_window { |
1064 | sub make_help_window { |
1060 | my $win = new CFClient::UI::FancyFrame |
1065 | my $win = new CFClient::UI::FancyFrame |
|
|
1066 | x => 'center', |
|
|
1067 | y => 'center', |
|
|
1068 | name => 'doc_browser', |
1061 | def_w => int $WIDTH * 7/8, |
1069 | force_w => int $WIDTH * 7/8, |
1062 | def_h => int $HEIGHT * 7/8, |
1070 | force_h => int $HEIGHT * 7/8, |
1063 | title => "Documentation"; |
1071 | title => "Documentation"; |
1064 | |
1072 | |
1065 | $win->add (my $vbox = new CFClient::UI::VBox); |
1073 | $win->add (my $vbox = new CFClient::UI::VBox); |
1066 | |
1074 | |
1067 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1075 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1068 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1076 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
… | |
… | |
1149 | force_y => "max", |
1157 | force_y => "max", |
1150 | child => $STATUSBOX, |
1158 | child => $STATUSBOX, |
1151 | )->show; |
1159 | )->show; |
1152 | |
1160 | |
1153 | CFClient::UI::FancyFrame->new ( |
1161 | CFClient::UI::FancyFrame->new ( |
|
|
1162 | title => "Mini Map", |
|
|
1163 | name => "mapmap", |
1154 | x => 0, |
1164 | x => 0, |
1155 | y => $FONTSIZE + 8, |
1165 | y => $FONTSIZE + 8, |
1156 | border_bg => [1, 1, 1, 192/255], |
1166 | border_bg => [1, 1, 1, 192/255], |
1157 | bg => [1, 1, 1, 0], |
1167 | bg => [1, 1, 1, 0], |
1158 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1168 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |