ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/widget.ext
(Generate patch)

Comparing deliantra/server/ext/widget.ext (file contents):
Revision 1.2 by root, Mon Jun 25 07:40:53 2007 UTC vs.
Revision 1.4 by root, Mon Jul 2 03:15:30 2007 UTC

14 14
15cf::client->attach ( 15cf::client->attach (
16 on_connect => sub { 16 on_connect => sub {
17 my ($ns) = @_; 17 my ($ns) = @_;
18 18
19 Scalar::Util::weaken (my $weakns = $ns);
20
19 $ns->{id} = "a"; 21 $ns->{id} = "a";
22 $ns->{json_coder}->filter_json_single_key_object (__widget_ref__ => sub {
23 # cannot deserialise ATM
24 undef
25 });
20 }, 26 },
21); 27);
22 28
23sub csc_update_stats { 29sub csc_update_stats {
24 my ($ns) = @_; 30 my ($ns) = @_;
37 min_w => 600, 43 min_w => 600,
38 min_h => 400, 44 min_h => 400,
39 x => "center", 45 x => "center",
40 y => "center", 46 y => "center",
41 title => "Character Creation", 47 title => "Character Creation",
48 has_close_button => 1,
49 on_delete => sub {
50 $ws->destroy;
51 },
42 ); 52 );
43 53
44 $w->add (my $ntb = $ws->new (Notebook => expand => 1)); 54 $w->add (my $ntb = $ws->new (Notebook => expand => 1));
45 55
46 $ntb->add (Statistics => (my $stats = $ws->new (Table => expand => 1)), "Basic statistics of your new character"); 56 $ntb->add (Statistics => (my $stats = $ws->new (Table => expand => 1)), "Basic statistics of your new character");
47 57
48 $stats->add (0, 0, (my $statstable = $ws->new ("Table"))); 58 $stats->add (0, 0, (my $statstable = $ws->new ("Table")));
49 59
50 for ( 60 for (
51 [0, "Str", "Strength"], 61 [0, "Str"],
52 [1, "Dex", "Dexterity"], 62 [1, "Dex"],
53 [2, "Con", "Constitution"], 63 [2, "Con"],
54 [3, "Int", "Intelligence"], 64 [3, "Int"],
55 [4, "Wis", "Wisdom"], 65 [4, "Wis"],
56 [5, "Pow", "Power"], 66 [5, "Pow"],
57 [6, "Cha", "Charisma"], 67 [6, "Cha"],
58 ) { 68 ) {
59 my ($x, $label, $description) = @$_; 69 my ($x, $label) = @$_;
60 70
61 $statstable->add ($x, 0, $ws->new (Label => 71 $statstable->add ($x, 0, $ws->new (Label =>
62 can_hover => 1, can_events => 1, 72 can_hover => 1, can_events => 1,
63 align => +1, text => $label, tooltip => "#stat_$label", 73 align => +1, text => $label, tooltip => "#stat_$label",
64 )); 74 ));
146sub msg { 156sub msg {
147 my ($self, $type, %msg) = @_; 157 my ($self, $type, %msg) = @_;
148 158
149 if (my $ns = shift->{ns}) { 159 if (my $ns = shift->{ns}) {
150 $msg{msgtype} = $type; 160 $msg{msgtype} = $type;
151 $ns->send_packet ("ext " . cf::to_json \%msg); 161 $ns->send_packet ("ext " . $ns->{json_coder}->encode (\%msg));
152 } 162 }
153} 163}
154 164
155sub new { 165sub new {
156 my ($self, $class, %args) = @_; 166 my ($self, $class, %args) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines