… | |
… | |
769 | }, |
769 | }, |
770 | ); |
770 | ); |
771 | |
771 | |
772 | $vbox->add ($self->{options} = new CFClient::UI::VBox); |
772 | $vbox->add ($self->{options} = new CFClient::UI::VBox); |
773 | |
773 | |
774 | $self->{close_button} = new CFClient::UI::Button |
774 | $self->{bye_button} = new CFClient::UI::Button |
775 | text => "Bye (close)", |
775 | text => "Bye (close)", |
776 | tooltip => "Use this button to end talking to the NPC. This also closes the dialog window.", |
776 | tooltip => "Use this button to end talking to the NPC. This also closes the dialog window.", |
777 | on_activate => sub { $this->destroy; 0 }, |
777 | on_activate => sub { $this->destroy; 0 }, |
778 | ; |
778 | ; |
779 | |
779 | |
… | |
… | |
795 | my ($self) = @_; |
795 | my ($self) = @_; |
796 | |
796 | |
797 | Scalar::Util::weaken $self; |
797 | Scalar::Util::weaken $self; |
798 | |
798 | |
799 | $self->{options}->clear; |
799 | $self->{options}->clear; |
800 | $self->{options}->add ($self->{close_button}); |
800 | $self->{options}->add ($self->{bye_button}); |
801 | |
801 | |
802 | for my $kw (sort keys %{ $self->{kw} }) { |
802 | for my $kw (sort keys %{ $self->{kw} }) { |
803 | $self->{options}->add (new CFClient::UI::Button |
803 | $self->{options}->add (new CFClient::UI::Button |
804 | text => $kw, |
804 | text => $kw, |
805 | on_activate => sub { |
805 | on_activate => sub { |
… | |
… | |
840 | } |
840 | } |
841 | |
841 | |
842 | sub destroy { |
842 | sub destroy { |
843 | my ($self) = @_; |
843 | my ($self) = @_; |
844 | |
844 | |
845 | #Carp::cluck "debug\n";#d# #todo# enable: destroyx gets called twice because scalar keys {} is 1 |
845 | #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1 |
846 | |
846 | |
847 | delete $self->{conn}{npc_dialog}; |
847 | delete $self->{conn}{npc_dialog}; |
848 | $self->{conn}->disconnect_ext ($self->{token}); |
848 | $self->{conn}->disconnect_ext ($self->{token}); |
849 | |
849 | |
850 | $self->SUPER::destroy; |
850 | $self->SUPER::destroy; |