project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
changeset 4003 ca0600ab38bf
parent 4000 ddc4a09889e7
child 4113 edb30dabf71a
equal deleted inserted replaced
4001:cfd83b04e0be 4003:ca0600ab38bf
   193             cellSlider.tag = SLIDER_TAG + row;
   193             cellSlider.tag = SLIDER_TAG + row;
   194             cellSlider.value = [[[self.schemeDictionary objectForKey:@"basic"] objectAtIndex:row] floatValue];
   194             cellSlider.value = [[[self.schemeDictionary objectForKey:@"basic"] objectAtIndex:row] floatValue];
   195 
   195 
   196             // forced to use this weird format otherwise the label disappears when size of the text is bigger than the original
   196             // forced to use this weird format otherwise the label disappears when size of the text is bigger than the original
   197             NSString *prestring = [NSString stringWithFormat:@"%d",(NSInteger) cellSlider.value];
   197             NSString *prestring = [NSString stringWithFormat:@"%d",(NSInteger) cellSlider.value];
       
   198 
   198             // turntime 100 means unlimited time turns (set in GameSetup)
   199             // turntime 100 means unlimited time turns (set in GameSetup)
   199             if (row == 1 && (NSInteger) cellSlider.value == 100)
   200             if (row == 1 && (NSInteger) cellSlider.value == 100)
   200                 prestring = @"∞";
   201                 prestring = @"∞";
       
   202             else
       
   203                 // mines less than 0 means random
       
   204                 if (row == 5 && (NSInteger) cellSlider.value == -1)
       
   205                     prestring = NSLocalizedString(@"Rnd",@"Short for 'Random'");
   201             
   206             
   202             while ([prestring length] <= 4)
   207             while ([prestring length] <= 4)
   203                 prestring = [NSString stringWithFormat:@" %@",prestring];
   208                 prestring = [NSString stringWithFormat:@" %@",prestring];
   204             cell.detailTextLabel.text = prestring;
   209             cell.detailTextLabel.text = prestring;
   205 
   210 
   253     UILabel *label = (UILabel *)cell.detailTextLabel;
   258     UILabel *label = (UILabel *)cell.detailTextLabel;
   254     // modify it
   259     // modify it
   255     if ([indexPath row] == 1 && [indexPath section] == 1 && (NSInteger) theSlider.value == 100)
   260     if ([indexPath row] == 1 && [indexPath section] == 1 && (NSInteger) theSlider.value == 100)
   256         label.text = @"∞";
   261         label.text = @"∞";
   257     else
   262     else
   258         label.text = [NSString stringWithFormat:@"%d",(NSInteger) theSlider.value];
   263         if ([indexPath row] == 5 && [indexPath section] == 1 && (NSInteger) theSlider.value == -1)
       
   264             label.text = NSLocalizedString(@"Rnd",@"Short for 'Random'");
       
   265         else
       
   266             label.text = [NSString stringWithFormat:@"%d",(NSInteger) theSlider.value];
   259     // save changes in the main array
   267     // save changes in the main array
   260     NSMutableArray *array = [self.schemeDictionary objectForKey:@"basic"];
   268     NSMutableArray *array = [self.schemeDictionary objectForKey:@"basic"];
   261     [array replaceObjectAtIndex:theSlider.tag-SLIDER_TAG withObject:[NSNumber numberWithInt:(NSInteger) theSlider.value]];
   269     [array replaceObjectAtIndex:theSlider.tag-SLIDER_TAG withObject:[NSNumber numberWithInt:(NSInteger) theSlider.value]];
   262 }
   270 }
   263 
   271