ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/client-settings-page.ext
Revision: 1.3
Committed: Sat Jan 30 23:30:26 2010 UTC (14 years, 3 months ago) by root
Branch: MAIN
Changes since 1.2: +6 -3 lines
Log Message:
*** empty log message ***

File Contents

# Content
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 cf::weaken $ws;
10
11 # I hope not doing range checking is ok here...
12 $ws->template (face => (cf::face::find "res/ui/pl_settings_page"),
13 [
14 page => { },
15
16 title => {
17 text => $pl->ob->is_dragon ? $pl->title : $pl->own_title,
18 can_events => !$pl->ob->is_dragon,
19 },
20 info => { text => $pl->{user_info} },
21 info_save => {
22 on_activate => sub {
23 $ws->{title}->get (text => sub {
24 return if $pl->ob->is_dragon;
25
26 $pl->statusmsg ("new title has been saved");
27 $pl->own_title ($_[0]);
28 });
29 $ws->{info}->get (text => sub {
30 $pl->statusmsg ("new character info text has been saved");
31 $pl->{user_info} = $_[0];
32 });
33 },
34 },
35
36 applymode => { value => $pl->unapply , on_changed => sub { $pl->unapply ($_[1]) } },
37 bowmode => { value => $pl->bowtype , on_changed => sub { $pl->bowtype ($_[1]) } },
38 petmode => { value => $pl->petmode , on_changed => sub { $pl->petmode ($_[1]) } },
39 hintmode => { value => $pl->hintmode , on_changed => sub { $pl->hintmode ($_[1]) } },
40 usekeys => { value => $pl->usekeys , on_changed => sub { $pl->usekeys ($_[1]) } },
41 ],
42 sub {
43 $ws->find ("pl_notebook")->add ($ws->{page});
44 },
45 );
46 }
47
48 cf::player->attach (
49 on_login => sub {
50 my ($pl) = @_;
51
52 my $ns = $pl->ns;
53 return unless $ns->{can_widget};
54
55 settings_page $ns;
56 },
57 );
58