ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.184 by root, Thu Dec 27 18:35:56 2007 UTC vs.
Revision 1.187 by root, Sat Dec 29 13:44:30 2007 UTC

194 ); 194 );
195} 195}
196 196
197# widgetset create template 197# widgetset create template
198sub ext_ws_ct { 198sub ext_ws_ct {
199 my ($self, $ws, $template, $cfg) = @_; 199 my ($self, $ws, $type, $template, $done_cb, $cfg) = @_;
200 200
201 $template = eval <<EOF; 201 $done_cb ||= sub { };
202[
203 Toplevel => {
204 s_id => "toplevel",
205 title => "Character Creation",
206 x => "center",
207 y => "center",
208 z => 5,
209 s_cl => [VBox => {s_cl => [
210 Label => {
211 text => "Character Creation",
212 fontsize => 1,
213 align => 0,
214 },
215 Label => {
216 markup => "View or Edit your character attributes below, then press <b>Finish</b> to create your character",
217 fontsize => 0.8,
218 align => 0,
219 },
220 Notebook => {
221 s_cl => [
222 Label => {
223 text => "hulla-hoop"
224 },
225 Entry => {
226 s_id => "entry",
227 },
228 ],
229 },
230 Button => {
231 s_id => "finish",
232 title => "Finish",
233 },
234 ]}],
235 },
236]
237EOF
238 die if $@;
239 202
240 my $parse_list; $parse_list = sub { 203 my $parse_list; $parse_list = sub {
241 my ($list) = @_; 204 my ($list) = @_;
242 my @w; 205 my @w;
243 206
260 } 223 }
261 224
262 @w 225 @w
263 }; 226 };
264 227
228 # either array reference, or face #
229 if ($type eq "inline") {
230 $done_cb->();
265 $parse_list->($template); 231 $parse_list->($template);
232 } elsif ($type eq "face") {
233 my $handler; $handler = $self->register_face_handler ($template, sub {
234 my ($face) = @_;
266 235
236 undef $handler;
237 $done_cb->();
238 $parse_list->($self->{json_coder}->decode ($face->{data}));
239 });
240 } else {
241 $done_cb->(0);
242 }
267} 243}
268 244
269# widgetset associate 245# widgetset associate
270sub ext_ws_a { 246sub ext_ws_a {
271 my ($self, %ass) = @_; 247 my ($self, %ass) = @_;
549 $sktbl->clear; 525 $sktbl->clear;
550 526
551 my $sw = $self->{skillwid}{""} ||= [ 527 my $sw = $self->{skillwid}{""} ||= [
552 0, 0, (new DC::UI::Label text => "Experience", align => 1), 528 0, 0, (new DC::UI::Label text => "Experience", align => 1),
553 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), 529 1, 0, (new DC::UI::Label text => "Lvl.", align => 1),
554 2, 0, (new DC::UI::Label text => "Progress", align => 0), 530 2, 0, (new DC::UI::Label text => "Progress"),
555 3, 0, (new DC::UI::Label text => "Skill", expand => 1), 531 3, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
556 4, 0, (new DC::UI::Label text => "Experience", align => 1), 532 4, 0, (new DC::UI::Label text => "Experience", align => 1),
557 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), 533 5, 0, (new DC::UI::Label text => "Lvl.", align => 1),
558 6, 0, (new DC::UI::Label text => "Progress", align => 0), 534 6, 0, (new DC::UI::Label text => "Progress"),
559 7, 0, (new DC::UI::Label text => "Skill", expand => 1), 535 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
560 ]; 536 ];
561 537
562 my @add = @$sw; 538 my @add = @$sw;
563 539
564 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 540 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>";
603 579
604 # progress 580 # progress
605 (new DC::UI::ExperienceProgress), 581 (new DC::UI::ExperienceProgress),
606 582
607 # label 583 # label
608 (new DC::UI::Label text => $name, on_button_down => $spell_cb, 584 (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0,
609 can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), 585 can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
610 ]; 586 ];
611 587
612 push @add, 588 push @add,
613 $x * 4 + 0, $y, $sw->[0], 589 $x * 4 + 0, $y, $sw->[0],
1231 my ($conn, $tag, $name) = @_; 1207 my ($conn, $tag, $name) = @_;
1232 $conn->{open_container} = $tag; 1208 $conn->{open_container} = $tag;
1233 update_floorbox; 1209 update_floorbox;
1234 1210
1235 $::INVR_HB->clear (); 1211 $::INVR_HB->clear ();
1236 $::INVR_HB->add (new DC::UI::Label align => 0, expand => 1, text => $name); 1212 $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name);
1237 1213
1238 if ($tag != 0) { # Floor isn't closable, is it? 1214 if ($tag != 0) { # Floor isn't closable, is it?
1239 $::INVR_HB->add (new DC::UI::Button 1215 $::INVR_HB->add (new DC::UI::Button
1240 text => "Close container", 1216 text => "Close container",
1241 tooltip => "Close the currently open container (if one is open)", 1217 tooltip => "Close the currently open container (if one is open)",
1325 1301
1326 my $weight = .001 * $self->{player}{weight}; 1302 my $weight = .001 * $self->{player}{weight};
1327 my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; 1303 my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM};
1328 1304
1329 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); 1305 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight);
1330 $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); 1306 $::STATWIDS->{m_weight}->set_text (sprintf "Max Weight: %.1fkg", $limit);
1331 $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); 1307 $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit);
1332} 1308}
1333 1309
1334sub update_server_info { 1310sub update_server_info {
1335 my ($self) = @_; 1311 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines