ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/client-settings-page.ext
Revision: 1.1
Committed: Fri Dec 28 12:44:45 2007 UTC (16 years, 5 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #! perl # mandatory depends=widget
2    
3     sub settings_page {
4     my ($ns) = @_;
5     my $pl = $ns->pl;
6    
7     my $ws = $ns->{ws_settings} = $ns->new_widgetset;
8    
9     # I hope not doing range checking is ok here...
10     $ws->template (face => (cf::face::find "res/ui/pl_settings_page"),
11     [
12     page => { },
13    
14     title => { text => $pl->own_title },
15     info => { text => $pl->{user_info} },
16     info_save => {
17     on_activate => sub {
18     $ws->{title}->get (text => sub {
19     $pl->statusmsg ("new title has been saved");
20     $pl->own_title ($_[0]);
21     });
22     $ws->{info}->get (text => sub {
23     $pl->statusmsg ("new character info text has been saved");
24     $pl->{user_info} = $_[0];
25     });
26     },
27     },
28    
29     applymode => { value => $pl->unapply , on_changed => sub { $pl->unapply ($_[1]) } },
30     bowmode => { value => $pl->bowtype , on_changed => sub { $pl->bowtype ($_[1]) } },
31     petmode => { value => $pl->petmode , on_changed => sub { $pl->petmode ($_[1]) } },
32     hintmode => { value => $pl->hintmode , on_changed => sub { $pl->hintmode ($_[1]) } },
33     usekeys => { value => $pl->usekeys , on_changed => sub { $pl->usekeys ($_[1]) } },
34     ],
35     sub {
36     $ws->find ("pl_notebook")->add ($ws->{page});
37     }
38     );
39     }
40    
41     cf::player->attach (
42     on_login => sub {
43     my ($pl) = @_;
44    
45     my $ns = $pl->ns;
46     return unless $ns->{can_widget};
47    
48     settings_page $ns;
49     },
50     );
51