Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | |
Philipp Schrader | 93ade04 | 2022-03-05 17:16:10 -0800 | [diff] [blame^] | 3 | type Section = 'Team Selection'|'Auto'|'TeleOp'|'Climb'|'Defense'|'Review and Submit'|'Home' |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 4 | type Level = 'Low'|'Medium'|'High'|'Transversal' |
| 5 | |
| 6 | @Component({ |
| 7 | selector: 'app-entry', |
| 8 | templateUrl: './entry.ng.html', |
| 9 | styleUrls: ['./entry.component.css'] |
| 10 | }) |
| 11 | export class EntryComponent { |
Philipp Schrader | 93ade04 | 2022-03-05 17:16:10 -0800 | [diff] [blame^] | 12 | section: Section = 'Team Selection'; |
| 13 | matchNumber: number = 1 |
| 14 | teamNumber: number = 1 |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 15 | autoUpperShotsMade: number = 0; |
| 16 | autoLowerShotsMade: number = 0; |
| 17 | autoShotsMissed: number = 0; |
| 18 | teleUpperShotsMade: number = 0; |
| 19 | teleLowerShotsMade: number = 0; |
| 20 | teleShotsMissed: number = 0; |
Alex Perry | bb3d206 | 2022-03-05 18:14:33 -0800 | [diff] [blame] | 21 | defensePlayedOnScore: number = 3; |
| 22 | defensePlayedScore: number = 3; |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 23 | level: Level; |
| 24 | proper: boolean = false; |
| 25 | climbed: boolean = false; |
| 26 | |
| 27 | toggleProper() { |
| 28 | this.proper = !this.proper; |
| 29 | } |
| 30 | |
| 31 | setLow() { |
| 32 | this.level = 'Low'; |
| 33 | } |
| 34 | |
| 35 | setMedium() { |
| 36 | this.level = 'Medium'; |
| 37 | } |
| 38 | |
| 39 | setHigh() { |
| 40 | this.level = 'High'; |
| 41 | } |
| 42 | |
| 43 | setTransversal() { |
| 44 | this.level = 'Transversal'; |
| 45 | } |
| 46 | |
| 47 | defensePlayedOnSlider(event) { |
| 48 | this.defensePlayedOnScore = event.target.value; |
| 49 | } |
| 50 | |
| 51 | defensePlayedSlider(event) { |
| 52 | this.defensePlayedScore = event.target.value; |
| 53 | } |
| 54 | |
| 55 | setClimbedTrue() { |
| 56 | this.climbed = true; |
| 57 | } |
| 58 | |
| 59 | setClimbedFalse() { |
| 60 | this.climbed = false; |
| 61 | } |
| 62 | |
| 63 | nextSection() { |
Philipp Schrader | 93ade04 | 2022-03-05 17:16:10 -0800 | [diff] [blame^] | 64 | if (this.section === 'Team Selection') { |
| 65 | this.section = 'Auto'; |
| 66 | } else if (this.section === 'Auto') { |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 67 | this.section = 'TeleOp'; |
| 68 | } else if (this.section === 'TeleOp') { |
| 69 | this.section = 'Climb'; |
| 70 | } else if (this.section === 'Climb') { |
| 71 | this.section = 'Defense'; |
| 72 | } else if (this.section === 'Defense') { |
| 73 | this.section = 'Review and Submit'; |
| 74 | } else if (this.section === 'Review and Submit') { |
| 75 | this.section = 'Home'; |
| 76 | } |
| 77 | } |
| 78 | |
Alex Perry | bb3d206 | 2022-03-05 18:14:33 -0800 | [diff] [blame] | 79 | prevSection() { |
Philipp Schrader | 93ade04 | 2022-03-05 17:16:10 -0800 | [diff] [blame^] | 80 | if (this.section === 'Auto') { |
| 81 | this.section = 'Team Selection'; |
| 82 | } else if (this.section === 'TeleOp') { |
Alex Perry | bb3d206 | 2022-03-05 18:14:33 -0800 | [diff] [blame] | 83 | this.section = 'Auto'; |
| 84 | } else if (this.section === 'Climb') { |
| 85 | this.section = 'TeleOp'; |
| 86 | } else if (this.section === 'Defense') { |
| 87 | this.section = 'Climb'; |
| 88 | } else if (this.section === 'Review and Submit') { |
| 89 | this.section = 'Defense'; |
| 90 | } |
| 91 | } |
| 92 | |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 93 | adjustAutoUpper(by: number) { |
| 94 | this.autoUpperShotsMade = Math.max(0, this.autoUpperShotsMade + by); |
| 95 | } |
| 96 | |
| 97 | adjustAutoLower(by: number) { |
| 98 | this.autoLowerShotsMade = Math.max(0, this.autoLowerShotsMade + by); |
| 99 | } |
| 100 | |
| 101 | adjustAutoMissed(by: number) { |
| 102 | this.autoShotsMissed = Math.max(0, this.autoShotsMissed + by); |
| 103 | } |
| 104 | |
| 105 | adjustTeleUpper(by: number) { |
| 106 | this.teleUpperShotsMade = Math.max(0, this.teleUpperShotsMade + by); |
| 107 | } |
| 108 | |
| 109 | adjustTeleLower(by: number) { |
| 110 | this.teleLowerShotsMade = Math.max(0, this.teleLowerShotsMade + by); |
| 111 | } |
| 112 | |
| 113 | adjustTeleMissed(by: number) { |
| 114 | this.teleShotsMissed = Math.max(0, this.teleShotsMissed + by); |
| 115 | } |
| 116 | } |