Skip to content

Commit

Permalink
Fix checkings on fifth gam-jeon, close #4, close #5
Browse files Browse the repository at this point in the history
  • Loading branch information
irzinfante committed Dec 15, 2022
1 parent c12e12d commit e5813c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tkd-scoreboard"
version = "1.1.0"
version = "1.1.1"
edition = "2021"
authors = ["irzinfante <[email protected]>"]
repository = "https://github.com/irzinfante/tkd-scoreboard/"
Expand Down
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,19 @@ impl Scoreboard {
return false;
}

pub fn check_fifth_gam_jeon(&mut self) {
if self.cheong_gam_jeon_count > 4 && self.hong_gam_jeon_count == 4 {
self.controls.hong_plus_gam_jeon_btn.deactivate();
} else if self.hong_gam_jeon_count == 4 {
self.controls.hong_plus_gam_jeon_btn.activate();
}
if self.hong_gam_jeon_count > 4 && self.cheong_gam_jeon_count == 4 {
self.controls.cheong_plus_gam_jeon_btn.deactivate();
} else if self.cheong_gam_jeon_count == 4 {
self.controls.cheong_plus_gam_jeon_btn.activate();
}
}

pub fn round_winner(&self) -> Winner {

// 5 gam-jeons
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ fn main() {
if share.cheong_gam_jeon_count > 4 {
cheong_plus_gam_jeon_btn.deactivate();
}
share.check_fifth_gam_jeon();
});
});

Expand All @@ -573,6 +574,7 @@ fn main() {
if share.cheong_gam_jeon_count == 0 {
cheong_minus_gam_jeon_btn.deactivate();
}
share.check_fifth_gam_jeon();
});
});

Expand Down Expand Up @@ -602,6 +604,7 @@ fn main() {
if share.hong_gam_jeon_count > 4 {
hong_plus_gam_jeon_btn.deactivate();
}
share.check_fifth_gam_jeon();
});
});

Expand All @@ -614,6 +617,7 @@ fn main() {
if share.hong_gam_jeon_count == 0 {
hong_minus_gam_jeon_btn.deactivate();
}
share.check_fifth_gam_jeon();
});
});

Expand Down

0 comments on commit e5813c2

Please sign in to comment.