… | |
… | |
378 | : $_[0]; |
378 | : $_[0]; |
379 | }); |
379 | }); |
380 | $self->{board_click} = sub { |
380 | $self->{board_click} = sub { |
381 | if ($_[0] == 255) { |
381 | if ($_[0] == 255) { |
382 | $self->{button_pass}->sensitive (0); |
382 | $self->{button_pass}->sensitive (0); |
383 | warn sprintf "SEND DONE @{$self->{done}} %x\n", $self->{doneid};#d# |
|
|
384 | $self->done; |
383 | $self->done; |
385 | } else { |
384 | } else { |
386 | $self->send (mark_dead => |
385 | $self->send (mark_dead => |
387 | channel => $self->{channel}, |
386 | channel => $self->{channel}, |
388 | x => $_[0], |
387 | x => $_[0], |
… | |
… | |
713 | } |
712 | } |
714 | |
713 | |
715 | sub event_done { |
714 | sub event_done { |
716 | my ($self) = @_; |
715 | my ($self) = @_; |
717 | |
716 | |
718 | warn sprintf "EVENT DONE @{$self->{done}} %x\n", $self->{doneid};#d# |
|
|
719 | |
|
|
720 | if ($self->{done}[1 - $self->{colour}] && !$self->{done}[$self->{colour}]) { |
717 | if ($self->{done}[1 - $self->{colour}] && !$self->{done}[$self->{colour}]) { |
721 | sound::play 2, "ring" unless $inlay->{count}; |
718 | sound::play 2, "info" unless $inlay->{count}; |
722 | $self->{chat}->append_text ("\n<infoblock><header>Press Done</header>" |
719 | $self->{chat}->append_text ("\n<infoblock><header>Press Done</header>" |
723 | . "\nYour opponent pressed done. Now it's up to you."); |
720 | . "\nYour opponent pressed done. Now it's up to you."); |
724 | } |
721 | } |
725 | if ($self->{doneid} & 0x80000000) { |
722 | if ($self->{doneid} & 0x80000000) { |
726 | sound::play 2, "warning" unless $inlay->{count}; |
723 | sound::play 2, "info" unless $inlay->{count}; |
727 | $self->{chat}->append_text ("\n<infoblock><header>Press Done Again</header>" |
724 | $self->{chat}->append_text ("\n<infoblock><header>Press Done Again</header>" |
728 | . "\nYour opponent changed the board.."); |
725 | . "\nThe board has changed."); |
729 | } |
726 | } |
730 | |
727 | |
731 | $self->{button_pass}->sensitive (!$self->{done}[$self->{colour}]); |
728 | $self->{button_pass}->sensitive (!$self->{done}[$self->{colour}]); |
732 | |
729 | |
733 | $self->{chat}->set_end; |
730 | $self->{chat}->set_end; |
… | |
… | |
969 | my $as_black = $info->{black}->{name} eq $self->{conn}{name}; |
966 | my $as_black = $info->{black}->{name} eq $self->{conn}{name}; |
970 | my $opponent = $as_black ? $info->{white} : $info->{black}; |
967 | my $opponent = $as_black ? $info->{white} : $info->{black}; |
971 | |
968 | |
972 | my $id = $opponent->{name}; |
969 | my $id = $opponent->{name}; |
973 | |
970 | |
|
|
971 | sound::play 2, "info"; |
|
|
972 | |
974 | $self->{challenge}{$id} = $info; |
973 | $self->{challenge}{$id} = $info; |
975 | $self->{challenge}{$id}{inlay} = $self->{chat}->new_switchable_inlay ( |
974 | $self->{challenge}{$id}{inlay} = $self->{chat}->new_switchable_inlay ( |
976 | exists $self->{challenge}{""} |
975 | exists $self->{challenge}{""} |
977 | ? "Challenge from $opponent->{name}" |
976 | ? "Challenge from $opponent->{name}" |
978 | : "Challenge to $opponent->{name}", |
977 | : "Challenge to $opponent->{name}", |