ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.206 by root, Tue May 9 22:27:55 2006 UTC vs.
Revision 1.211 by root, Fri May 12 02:08:52 2006 UTC

37use CFClient; 37use CFClient;
38use CFClient::UI; 38use CFClient::UI;
39use CFClient::MapWidget; 39use CFClient::MapWidget;
40 40
41$Event::DIED = sub { 41$Event::DIED = sub {
42 # TODO: display dialog box or so
42 CFClient::error $_[1]; 43 CFClient::error $_[1];
43}; 44};
44 45
45#$SIG{__WARN__} = sub { Carp::cluck $_[0] };#d# 46#$SIG{__WARN__} = sub { Carp::cluck $_[0] };#d#
46 47
100 101
101our $INVWIN; 102our $INVWIN;
102our $INV; 103our $INV;
103 104
104sub status { 105sub status {
105 $STATUS_LINE->set_text ($_[0]); 106 $STATUS_LINE->add ($_[0], pri => -10, group => "status", timeout => 20, color => [1, 1, 0, 1]);
106 $STATUS_LINE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $STATUS_LINE->{h}); 107 $CFClient::UI::ROOT->on_post_alloc ($STATUS_LINE => sub {
108 $STATUS_LINE->move (0, $HEIGHT - $STATUS_LINE->{h});#d# to in toplevel
109 });
107} 110}
108 111
109sub debug { 112sub debug {
110 $DEBUG_STATUS->set_text ($_[0]); 113 $DEBUG_STATUS->set_text ($_[0]);
111 my ($w, $h) = $DEBUG_STATUS->size_request; 114 my ($w, $h) = $DEBUG_STATUS->size_request;
852 # create the widgets 855 # create the widgets
853 856
854 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, text => "hulla", x => 100;#d# 857 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, text => "hulla", x => 100;#d#
855 $DEBUG_STATUS->show; 858 $DEBUG_STATUS->show;
856 859
857 $STATUS_LINE = new CFClient::UI::Label 860 $STATUS_LINE = new CFClient::UI::Statusbox;
858 padding => 0, 861 $STATUS_LINE->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, size => 0.8, color => [1, 1, 1, 0.8]);
859 y => $HEIGHT - $FONTSIZE * 1.8;
860 $STATUS_LINE->show; 862 $STATUS_LINE->show;
861
862 $ALT_ENTER_MESSAGE = new CFClient::UI::Label
863 padding => 0,
864 fontsize => 0.8,
865 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode";
866 $ALT_ENTER_MESSAGE->show;
867 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h});
868 863
869 CFClient::UI::FancyFrame->new ( 864 CFClient::UI::FancyFrame->new (
870 border_bg => [1, 1, 1, 192/255], 865 border_bg => [1, 1, 1, 192/255],
871 bg => [1, 1, 1, 0], 866 bg => [1, 1, 1, 0],
872 child => ($MAPMAP = new CFClient::MapWidget::MapMap), 867 child => ($MAPMAP = new CFClient::MapWidget::MapMap),
905 }); 900 });
906 901
907 $BUTTONBAR->show; 902 $BUTTONBAR->show;
908 903
909 # delay till geometry is constant 904 # delay till geometry is constant
910 $CFClient::UI::ROOT->on_refresh (startup => sub { 905 $CFClient::UI::ROOT->on_post_alloc (startup => sub {
911 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 906 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
912 }); 907 });
913 force_refresh (); 908 force_refresh ();
914 } 909 }
915} 910}
1326 [0.55, 0.41, 0.13], 1321 [0.55, 0.41, 0.13],
1327 [0.99, 0.77, 0.26], 1322 [0.99, 0.77, 0.26],
1328 [0.74, 0.65, 0.41], 1323 [0.74, 0.65, 0.41],
1329 ); 1324 );
1330 1325
1326 my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0];
1327
1328 $text =~ s/&/&amp;/g; $text =~ s/</&lt;/g;
1329 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g;
1330 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g;
1331
1331 $LOGVIEW->add_paragraph ($color[$color], $text); 1332 $LOGVIEW->add_paragraph ($color[$color],
1333 join "\n", map "$time $_", split /\n/, $text);
1334
1335 $STATUS_LINE->add ($text,
1336 group => $text,
1337 color => $color[$color],
1338 timeout => 60,
1339 tooltip_font => $::FONT_FIXED,
1340 );
1341}
1342
1343sub conn::drawextinfo {
1344 my ($self, $color, $type, $subtype, $message) = @_;
1345
1346 $self->drawinfo ($color, $message);
1332} 1347}
1333 1348
1334sub conn::spell_add { 1349sub conn::spell_add {
1335 my ($self, $spell) = @_; 1350 my ($self, $spell) = @_;
1336 1351
1367 return unless $CONN; 1382 return unless $CONN;
1368 1383
1369 $FLOORBOX->clear; 1384 $FLOORBOX->clear;
1370 $FLOORBOX->add (new CFClient::UI::Empty expand => 1); 1385 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1371 1386
1372 # we basically have to use the same sorting as everybody else 1387 my $count = 4;
1373 $FLOORBOX->add ( 1388 for (@{ $CONN->{container}{0} }) {
1389 if (--$count) {
1374 map +(new CFClient::UI::InventoryItem item => $_), 1390 $FLOORBOX->add (new CFClient::UI::InventoryItem item => $_);
1375 @{ $CONN->{container}{0} } 1391 } else {
1392 $FLOORBOX->add (new CFClient::UI::Label text => "More...");
1393 last;
1394 }
1376 ); 1395 }
1377 }); 1396 });
1378 1397
1379 $WANT_REFRESH++; 1398 $WANT_REFRESH++;
1380} 1399}
1381 1400

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines