… | |
… | |
263 | $sw->add(($self->{userlist} = new userlist)->widget); |
263 | $sw->add(($self->{userlist} = new userlist)->widget); |
264 | |
264 | |
265 | $self->{vpane}->add(my $vbox = new Gtk2::VBox); |
265 | $self->{vpane}->add(my $vbox = new Gtk2::VBox); |
266 | |
266 | |
267 | $vbox->pack_start((my $hbox = new Gtk2::HBox 1), 0, 1, 0); |
267 | $vbox->pack_start((my $hbox = new Gtk2::HBox 1), 0, 1, 0); |
268 | $hbox->add (($self->{userpanel}[WHITE] = new game::userpanel colour => WHITE)->widget); |
268 | $hbox->add (($self->{userpanel}[COLOUR_WHITE] = new game::userpanel colour => COLOUR_WHITE)->widget); |
269 | $hbox->add (($self->{userpanel}[BLACK] = new game::userpanel colour => BLACK)->widget); |
269 | $hbox->add (($self->{userpanel}[COLOUR_BLACK] = new game::userpanel colour => COLOUR_BLACK)->widget); |
270 | |
270 | |
271 | $vbox->pack_start(($self->{chat} = new chat), 1, 1, 0); |
271 | $vbox->pack_start(($self->{chat} = new chat), 1, 1, 0); |
272 | |
272 | |
273 | $self->{chat}->signal_connect(command => sub { |
273 | $self->{chat}->signal_connect(command => sub { |
274 | my ($chat, $cmd, $arg) = @_; |
274 | my ($chat, $cmd, $arg) = @_; |
… | |
… | |
333 | $self->{board_label}->set_text ("Move " . ($move - 1)); |
333 | $self->{board_label}->set_text ("Move " . ($move - 1)); |
334 | |
334 | |
335 | $self->{cur_board} = new KGS::Game::Board $self->{size}; |
335 | $self->{cur_board} = new KGS::Game::Board $self->{size}; |
336 | $self->{cur_board}->interpret_path ([@{$self->{path}}[0 .. $move - 1]]); |
336 | $self->{cur_board}->interpret_path ([@{$self->{path}}[0 .. $move - 1]]); |
337 | |
337 | |
338 | for my $colour (WHITE, BLACK) { |
338 | for my $colour (COLOUR_WHITE, COLOUR_BLACK) { |
339 | $self->{userpanel}[$colour]->set_state ( |
339 | $self->{userpanel}[$colour]->set_state ( |
340 | $self->{cur_board}{captures}[$colour], |
340 | $self->{cur_board}{captures}[$colour], |
341 | $self->{cur_board}{timer}[$colour], |
341 | $self->{cur_board}{timer}[$colour], |
342 | ($running && $self->{lastmove_colour} == !$colour) |
342 | ($running && $self->{lastmove_colour} == !$colour) |
343 | ? $self->{lastmove_time} : 0 |
343 | ? $self->{lastmove_time} : 0 |
… | |
… | |
430 | ? $self->owner->as_string . " " . $self->opponent_string |
430 | ? $self->owner->as_string . " " . $self->opponent_string |
431 | : "Game Window"; |
431 | : "Game Window"; |
432 | $self->{window}->set_title("KGS Game $title"); |
432 | $self->{window}->set_title("KGS Game $title"); |
433 | $self->{title}->set_text ($title); |
433 | $self->{title}->set_text ($title); |
434 | |
434 | |
435 | $self->{user}[BLACK] = $self->{user1}; |
435 | $self->{user}[COLOUR_BLACK] = $self->{user1}; |
436 | $self->{user}[WHITE] = $self->{user2}; |
436 | $self->{user}[COLOUR_WHITE] = $self->{user2}; |
437 | |
437 | |
438 | # show board |
438 | # show board |
439 | |
439 | |
440 | if ($self->is_valid) { |
440 | if ($self->is_valid) { |
441 | #D# TODO: check wether already inside, or already removed!!! |
441 | #D# TODO: check wether already inside, or already removed!!! |
… | |
… | |
492 | |
492 | |
493 | sub event_update_rules { |
493 | sub event_update_rules { |
494 | my ($self, $rules) = @_; |
494 | my ($self, $rules) = @_; |
495 | |
495 | |
496 | $self->{userpanel}[$_]->configure ($self->{app}, $self->{user}[$_], $rules) |
496 | $self->{userpanel}[$_]->configure ($self->{app}, $self->{user}[$_], $rules) |
497 | for BLACK, WHITE; |
497 | for COLOUR_BLACK, COLOUR_WHITE; |
498 | |
498 | |
499 | sound::play 3, "gamestart"; |
499 | sound::play 3, "gamestart"; |
500 | |
500 | |
501 | my $text = "\n<header>Game Rules</header>"; |
501 | my $text = "\n<header>Game Rules</header>"; |
502 | |
502 | |
… | |
… | |
551 | sub destroy { |
551 | sub destroy { |
552 | my ($self) = @_; |
552 | my ($self) = @_; |
553 | |
553 | |
554 | delete $self->{app}{gamelist}{game}{$self->{channel}}; |
554 | delete $self->{app}{gamelist}{game}{$self->{channel}}; |
555 | $self->{userpanel}[$_] && (delete $self->{userpanel}[$_])->destroy |
555 | $self->{userpanel}[$_] && (delete $self->{userpanel}[$_])->destroy |
556 | for BLACK, WHITE; |
556 | for COLOUR_BLACK, COLOUR_WHITE; |
557 | $self->SUPER::destroy; |
557 | $self->SUPER::destroy; |
558 | } |
558 | } |
559 | |
559 | |
560 | 1; |
560 | 1; |
561 | |
561 | |