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