… | |
… | |
142 | our $SERVER_INFO; |
142 | our $SERVER_INFO; |
143 | |
143 | |
144 | our $SETUP_DIALOG; |
144 | our $SETUP_DIALOG; |
145 | our $SETUP_NOTEBOOK; |
145 | our $SETUP_NOTEBOOK; |
146 | our $SETUP_SERVER; |
146 | our $SETUP_SERVER; |
|
|
147 | our $SETUP_LOGIN; |
147 | our $SETUP_KEYBOARD; |
148 | our $SETUP_KEYBOARD; |
148 | |
149 | |
149 | our $PL_NOTEBOOK; |
150 | our $PL_NOTEBOOK; |
150 | our $PL_WINDOW; |
151 | our $PL_WINDOW; |
151 | |
152 | |
… | |
… | |
726 | stop_game(); |
727 | stop_game(); |
727 | } |
728 | } |
728 | } |
729 | } |
729 | |
730 | |
730 | sub stop_game { |
731 | sub stop_game { |
731 | $LOGIN_BUTTON->set_text ("Login"); |
732 | $LOGIN_BUTTON->set_text ("Login / Register"); |
732 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
733 | $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); |
733 | $SETUP_DIALOG->show; |
734 | $SETUP_DIALOG->show; |
734 | $PL_WINDOW->hide; |
735 | $PL_WINDOW->hide; |
735 | $SPELL_LIST->clear_spells; |
736 | $SPELL_LIST->clear_spells; |
736 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
737 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
737 | |
738 | |
… | |
… | |
1447 | ; |
1448 | ; |
1448 | |
1449 | |
1449 | $dialog |
1450 | $dialog |
1450 | } |
1451 | } |
1451 | |
1452 | |
1452 | sub server_setup { |
1453 | sub login_setup { |
1453 | my $vbox = new CFPlus::UI::VBox; |
1454 | my $vbox = new CFPlus::UI::VBox; |
1454 | |
1455 | |
1455 | $vbox->add (new CFPlus::UI::FancyFrame |
1456 | $vbox->add (new CFPlus::UI::FancyFrame |
1456 | label => "Connection Settings", |
1457 | label => "Login Settings", |
1457 | child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]), |
1458 | child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]), |
1458 | ); |
1459 | ); |
1459 | $table->add_at (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port"); |
1460 | $table->add_at (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port"); |
1460 | |
1461 | |
1461 | { |
1462 | { |
… | |
… | |
1496 | hidden => 1, |
1497 | hidden => 1, |
1497 | tooltip => "The password for your character", |
1498 | tooltip => "The password for your character", |
1498 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1499 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1499 | ); |
1500 | ); |
1500 | |
1501 | |
|
|
1502 | $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button |
|
|
1503 | expand => 1, |
|
|
1504 | align => 0, |
|
|
1505 | text => "Login / Register", |
|
|
1506 | tooltip => "This button will either login to the account configured above or register a new account.", |
|
|
1507 | on_activate => sub { |
|
|
1508 | $CONN ? stop_game |
|
|
1509 | : start_game; |
|
|
1510 | 1 |
|
|
1511 | }, |
|
|
1512 | ); |
|
|
1513 | |
|
|
1514 | $vbox |
|
|
1515 | } |
|
|
1516 | |
|
|
1517 | sub server_setup { |
|
|
1518 | my $vbox = new CFPlus::UI::VBox; |
|
|
1519 | |
|
|
1520 | $vbox->add (new CFPlus::UI::FancyFrame |
|
|
1521 | label => "Connection Settings", |
|
|
1522 | child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]), |
|
|
1523 | ); |
|
|
1524 | |
1501 | $table->add_at (0, 7, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Size"); |
1525 | $table->add_at (0, 1, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Size"); |
1502 | $table->add_at (1, 7, new CFPlus::UI::Slider |
1526 | $table->add_at (1, 1, new CFPlus::UI::Slider |
1503 | force_w => 100, |
1527 | force_w => 100, |
1504 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1528 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1505 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1529 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1506 | . "If you set this to a high value you will be able to see further, " |
1530 | . "If you set this to a high value you will be able to see further, " |
1507 | . "but you also increase bandwidth requirements and latency. " |
1531 | . "but you also increase bandwidth requirements and latency. " |
1508 | . "This option is only used once at log-in.", |
1532 | . "This option is only used once at log-in.", |
1509 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1533 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1510 | ); |
1534 | ); |
1511 | |
1535 | |
1512 | $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1536 | $table->add_at (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1513 | $table->add_at (1, 8, new CFPlus::UI::Entry |
1537 | $table->add_at (1, 2, new CFPlus::UI::Entry |
1514 | text => $CFG->{output_rate}, |
1538 | text => $CFG->{output_rate}, |
1515 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1539 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1516 | . "when sending data. When 0 or unset, the server " |
1540 | . "when sending data. When 0 or unset, the server " |
1517 | . "default will be used, which is usually around 100kb/s. Most servers will " |
1541 | . "default will be used, which is usually around 100kb/s. Most servers will " |
1518 | . "dynamically find an optimal rate, so adjust this only when necessary.", |
1542 | . "dynamically find an optimal rate, so adjust this only when necessary.", |
1519 | on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, |
1543 | on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, |
1520 | ); |
1544 | ); |
1521 | |
1545 | |
1522 | $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1546 | $table->add_at (0, 3, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1523 | $table->add_at (1, 9, new CFPlus::UI::Entry |
1547 | $table->add_at (1, 3, new CFPlus::UI::Entry |
1524 | text => $CFG->{output_count}, |
1548 | text => $CFG->{output_count}, |
1525 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1549 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1526 | on_changed => sub { $CFG->{output_count} = $_[1]; 1 }, |
1550 | on_changed => sub { $CFG->{output_count} = $_[1]; 1 }, |
1527 | ); |
1551 | ); |
1528 | |
1552 | |
1529 | $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1553 | $table->add_at (0, 4, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1530 | $table->add_at (1, 10, new CFPlus::UI::Entry |
1554 | $table->add_at (1, 4, new CFPlus::UI::Entry |
1531 | text => $CFG->{output_sync}, |
1555 | text => $CFG->{output_sync}, |
1532 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1556 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1533 | on_changed => sub { $CFG->{output_sync} = $_[1]; 1 }, |
1557 | on_changed => sub { $CFG->{output_sync} = $_[1]; 1 }, |
1534 | ); |
|
|
1535 | |
|
|
1536 | $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button |
|
|
1537 | expand => 1, |
|
|
1538 | align => 0, |
|
|
1539 | text => "Login", |
|
|
1540 | on_activate => sub { |
|
|
1541 | $CONN ? stop_game |
|
|
1542 | : start_game; |
|
|
1543 | 1 |
|
|
1544 | }, |
|
|
1545 | ); |
1558 | ); |
1546 | |
1559 | |
1547 | $vbox->add (new CFPlus::UI::FancyFrame |
1560 | $vbox->add (new CFPlus::UI::FancyFrame |
1548 | label => "Server Info", |
1561 | label => "Server Info", |
1549 | child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), |
1562 | child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), |
… | |
… | |
2172 | $MESSAGE_WINDOW = new CFPlus::UI::MessageWindow; |
2185 | $MESSAGE_WINDOW = new CFPlus::UI::MessageWindow; |
2173 | |
2186 | |
2174 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1, |
2187 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1, |
2175 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2188 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2176 | |
2189 | |
|
|
2190 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
|
|
2191 | "Configure the server to play on, your username and password."); |
2177 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2192 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2178 | "Configure the server to play on, your username, password and other server-related options."); |
2193 | "Configure other server related options."); |
2179 | $SETUP_NOTEBOOK->add_tab (Client => client_setup, |
2194 | $SETUP_NOTEBOOK->add_tab (Client => client_setup, |
2180 | "Configure various client-specific settings."); |
2195 | "Configure various client-specific settings."); |
2181 | $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup, |
2196 | $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup, |
2182 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
2197 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
2183 | $SETUP_NOTEBOOK->add_tab (Audio => audio_setup, |
2198 | $SETUP_NOTEBOOK->add_tab (Audio => audio_setup, |