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.169 by root, Mon Apr 24 02:41:48 2006 UTC vs.
Revision 1.170 by root, Mon Apr 24 03:19:42 2006 UTC

1122 1122
1123 $chunk->play; 1123 $chunk->play;
1124# warn "sound $x,$y,$soundnum,$type\n";#d# 1124# warn "sound $x,$y,$soundnum,$type\n";#d#
1125} 1125}
1126 1126
1127my $LAST_QUERY; # server is stupid, stupid, stupid
1128
1127sub conn::query { 1129sub conn::query {
1128 my ($self, $flags, $prompt) = @_; 1130 my ($self, $flags, $prompt) = @_;
1129 1131
1130 #TODO, display dialog with relevant information 1132 $prompt = $LAST_QUERY unless length $prompt;
1131 warn "<<<<QUERY:$flags:$prompt>>>\n";#d# 1133 $LAST_QUERY = $prompt;
1134
1135 my $dialog = new CFClient::UI::FancyFrame
1136 title => "Query",
1137 child => my $vbox = new CFClient::UI::VBox;
1138
1139 $vbox->add (new CFClient::UI::Label
1140 max_w => $::WIDTH * 0.4,
1141 text => $prompt);
1142
1143 if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) {
1144 $vbox->add (my $hbox = new CFClient::HBox);
1145 $hbox->add (new CFClient::Button
1146 text => "No",
1147 connect_activate => sub {
1148 $self->send ("reply n");
1149 $dialog->destroy;
1150 $MAPWIDGET->focus_in;
1151 }
1152 );
1153 $hbox->add (new CFClient::Button
1154 text => "Yes",
1155 connect_activate => sub {
1156 $self->send ("reply y");
1157 $dialog->destroy;
1158 $MAPWIDGET->focus_in;
1159 },
1160 );
1161
1162 $dialog->focus_in;
1163
1164 } elsif ($flags & Crossfire::Protocol::CS_QUERY_SINGLECHAR) {
1165 $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)";
1166 $vbox->add (my $entry = new CFClient::UI::Entry
1167 connect_changed => sub {
1168 $self->send ("reply $_[1]");
1169 $dialog->destroy;
1170 $MAPWIDGET->focus_in;
1171 },
1172 );
1173
1174 $entry->focus_in;
1175
1176 } else {
1177 $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)";
1178
1179 $vbox->add (my $entry = new CFClient::UI::Entry
1180 $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (),
1181 connect_activate => sub {
1182 $self->send ("reply $_[1]");
1183 $dialog->destroy;
1184 $MAPWIDGET->focus_in;
1185 },
1186 );
1187
1188 $entry->focus_in;
1189 }
1190
1191 $dialog->show;
1132} 1192}
1133 1193
1134sub conn::drawinfo { 1194sub conn::drawinfo {
1135 my ($self, $color, $text) = @_; 1195 my ($self, $color, $text) = @_;
1136 1196

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines