Changeset af91708 in orbit for iOS


Ignore:
Timestamp:
12/31/13 09:00:27 (6 years ago)
Author:
Steve Castellotti <sc@…>
Branches:
master, Servo
Children:
f45b70a
Parents:
b5aa714
Message:
  • displayScore() added
  • resetCurrentScore() added
  • Last score processing working
Location:
iOS/Orbit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • iOS/Orbit/Orbit/controllers/FlightViewController.h

    rb5aa714 raf91708  
    4242 
    4343- (void) updateScores; 
     44- (void) displayScore; 
     45- (void) resetCurrentScore; 
    4446 
    4547@end 
  • iOS/Orbit/Orbit/controllers/FlightViewController.m

    rb5aa714 raf91708  
    8686                          power: (float)powerLevel 
    8787{ 
    88    
     88    
    8989   // Set Attention and Meditation to zero if we've lost signal 
    9090   if (signalStrength < 100.0) { 
     
    111111{ 
    112112    
    113 //   NSLog(@"signalLevel: %f | powerLevel: %f", signalLevel, powerLevel); 
     113   //   NSLog(@"signalLevel: %f | powerLevel: %f", signalLevel, powerLevel); 
    114114    
    115115   if (signalLevel == 0.0) { // no signal 
     
    186186- (IBAction) testButtonPressed:(id) sender { 
    187187    
    188 //   NSLog(@"Available fonts: %@", [UIFont familyNames]); 
     188   //   NSLog(@"Available fonts: %@", [UIFont familyNames]); 
    189189    
    190190   [signalConverter isAudioJackPlugged]; 
     
    205205- (void) updateScores 
    206206{ 
    207  
     207    
    208208   //   /** 
    209209   //    * Score points based on target slider levels 
     
    229229   int eegAttention = self.attention.progress * 100; 
    230230   int eegAttentionTarget = self.attentionThreshold.value * 100; 
    231  
     231    
    232232   int eegMeditationScore = 0; 
    233233   int eegMeditation = self.meditation.progress * 100; 
    234234   int eegMeditationTarget = self.meditationThreshold.value * 100; 
    235235    
    236  
     236    
    237237   if ((eegAttention >= eegAttentionTarget) && 
    238238       (eegAttentionTarget > minimumScoreTarget)) 
     
    249249    
    250250    
    251 //   self.attentionPercent.text = [NSString stringWithFormat:@"%i%%", (int)(attentionLevel * 100)]; 
    252     
    253    self.scoresDisplay.text = [NSString stringWithFormat:@"%i%%", (int)scoreCurrent]; 
    254     
    255    
    256  
    257 //   // Catch anyone gaming the system with one slider 
    258 //   // below the minimum threshold and the other over. 
    259 //   // For example, setting Meditation to 1% will keep helicopter 
    260 //   // activated even if Attention is below target 
    261 //   if ((eegAttention < eegAttentionTarget) && (eegMeditation < minimumScoreTarget)) 
    262 //      resetCurrentScore(); 
    263 //   if ((eegMeditation < eegMeditationTarget) && (eegAttention < minimumScoreTarget)) 
    264 //      resetCurrentScore(); 
    265 //   if ((eegAttention < minimumScoreTarget) && (eegMeditation < minimumScoreTarget)) 
    266 //      resetCurrentScore(); 
    267  
    268  
     251   // High score 
     252   if (scoreCurrent > scoreHigh) { 
     253      scoreHigh = scoreCurrent; 
     254   } 
     255    
     256   // Reset score 
     257   if (power.progress == 0) 
     258      [self resetCurrentScore]; 
     259    
     260    
     261   // Catch anyone gaming the system with one slider 
     262   // below the minimum threshold and the other over. 
     263   // For example, setting Meditation to 1% will keep helicopter 
     264   // activated even if Attention is below target 
     265   if ((eegAttention < eegAttentionTarget) && (eegMeditation < minimumScoreTarget)) 
     266      [self resetCurrentScore]; 
     267    
     268   if ((eegMeditation < eegMeditationTarget) && (eegAttention < minimumScoreTarget)) 
     269      [self resetCurrentScore]; 
     270    
     271   if ((eegAttention < minimumScoreTarget) && (eegMeditation < minimumScoreTarget)) 
     272      [self resetCurrentScore]; 
     273    
     274    
     275   [self displayScore]; 
     276    
     277    
    269278} // updateScore 
    270279 
     
    272281// ################################################################ 
    273282 
    274 //public void resetCurrentScore() { 
    275 //    
    276 //   if (scoreCurrent > 0) 
    277 //      textViewLastScore.setText(Integer.toString(scoreCurrent)); 
    278 //   scoreCurrent = 0; 
    279 //   textViewScore.setText(Integer.toString(scoreCurrent)); 
    280 //    
    281 //} // resetCurrentScore 
     283- (void) displayScore 
     284{ 
     285   self.scoresDisplay.text = [NSString stringWithFormat:@"Scores        Current: %i    Last: %i    High: %i", (int)scoreCurrent, (int)scoreLast, (int)scoreHigh]; 
     286} 
     287 
     288// ################################################################ 
     289 
     290- (void) resetCurrentScore 
     291{ 
     292   if (scoreCurrent > 0) 
     293      scoreLast = scoreCurrent; 
     294    
     295   scoreCurrent = 0; 
     296    
     297} // resetCurrentScore 
    282298 
    283299@end 
Note: See TracChangeset for help on using the changeset viewer.