--- deliantra/Deliantra-Client/bin/cfplus 2006/05/28 01:16:04 1.21 +++ deliantra/Deliantra-Client/bin/cfplus 2006/05/28 02:31:04 1.23 @@ -83,6 +83,7 @@ our $METASERVER; our $LOGIN_BUTTON; our $QUIT_DIALOG; +our $SERVER_SETUP; our $FLOORBOX; our $GAUGES; @@ -99,6 +100,7 @@ our $STATUSBOX; our $DEBUG_STATUS; +our $INV_WINDOW; our $INV; our $INVR; our $INVR_LBL; @@ -116,6 +118,9 @@ sub start_game { status "logging in..."; + $LOGIN_BUTTON->set_text ("Logout"); + $SERVER_SETUP->hide; + my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; my ($host, $port) = split /:/, $CFG->{host}; @@ -153,12 +158,7 @@ if ($CONN) { CFClient::lowdelay fileno $CONN->{fh}; - $LOGIN_BUTTON->set_text ("Logout"); status "login successful"; - - $BUTTONBAR->{children}[1]->emit ("activate") - if $BUTTONBAR->{children}[1]->{state}; - } else { status "unable to connect"; stop_game(); @@ -166,15 +166,17 @@ } sub stop_game { + $LOGIN_BUTTON->set_text ("Login"); + $SERVER_SETUP->show; + $INV_WINDOW->hide; + $LOGVIEW->hide; + return unless $CONN; status "connection closed"; - $LOGIN_BUTTON->set_text ("Login"); + $CONN->destroy; $CONN = 0; # false, does not autovivify - - $BUTTONBAR->{children}[1]->emit ("activate") - unless $BUTTONBAR->{children}[1]->{state}; } sub client_setup { @@ -713,7 +715,7 @@ } sub server_setup { - my $dialog = new CFClient::UI::FancyFrame + my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame x => $WIDTH * (1/3), y => $HEIGHT * (1/8), name => "server_setup", @@ -917,7 +919,7 @@ } sub make_inventory_window { - my $invwin = new CFClient::UI::FancyFrame + my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame def_w => $WIDTH * 7/8, def_h => $HEIGHT * 7/8, title => "Inventory", @@ -1117,13 +1119,7 @@ $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); - # delay till geometry is constant - $CFClient::UI::ROOT->on_post_alloc (startup => sub { - $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup - my $widget = $GAUGES->{win}; - $widget->move (0, $HEIGHT - $widget->{h});#d# to in toplevel - }); - force_refresh (); + $SERVER_SETUP->show; } }