project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
changeset 3814 7af568bc0710
parent 3780 7c704e69242e
child 3829 81db3c85784b
equal deleted inserted replaced
3812:ce18fd3ff02d 3814:7af568bc0710
    97             UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)];
    97             UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)];
    98             numberButton.tag = NUMBERBUTTON_TAG;
    98             numberButton.tag = NUMBERBUTTON_TAG;
    99             [cell addSubview:numberButton];
    99             [cell addSubview:numberButton];
   100             [numberButton release];
   100             [numberButton release];
   101 
   101 
   102             SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+7, 5, 36, 36)];
   102             SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+6, 5, 36, 36)];
   103             squareButton.tag = SQUAREBUTTON_TAG;
   103             squareButton.tag = SQUAREBUTTON_TAG;
   104             [cell addSubview:squareButton];
   104             [cell addSubview:squareButton];
   105             [squareButton release];
   105             [squareButton release];
   106 
   106 
   107             UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+7+36+7, 10, 250, 25)];
   107             UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+6+36, 10, 103, 25)];
   108             label.textAlignment = UITextAlignmentLeft;
   108             label.textAlignment = UITextAlignmentLeft;
       
   109             label.minimumFontSize = 11;
       
   110             label.adjustsFontSizeToFitWidth = YES;
       
   111             label.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
   109             label.backgroundColor = [UIColor clearColor];
   112             label.backgroundColor = [UIColor clearColor];
   110             label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   113             label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   111             label.textColor = UICOLOR_HW_YELLOW_TEXT;
   114             label.textColor = UICOLOR_HW_YELLOW_TEXT;
   112             label.tag = LABEL_TAG;
   115             label.tag = LABEL_TAG;
   113             [cell.contentView addSubview:label];
   116             [cell.contentView addSubview:label];
   124         numberButton.ownerDictionary = selectedRow;
   127         numberButton.ownerDictionary = selectedRow;
   125 
   128 
   126         SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG];
   129         SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG];
   127         [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]];
   130         [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]];
   128         squareButton.ownerDictionary = selectedRow;
   131         squareButton.ownerDictionary = selectedRow;
       
   132         
       
   133         NSString *teamPath = [NSString stringWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[selectedRow objectForKey:@"team"]];
       
   134         NSDictionary *firstHog = [[[NSDictionary dictionaryWithContentsOfFile:teamPath] objectForKey:@"hedgehogs"] objectAtIndex:0];
       
   135         if ([[firstHog objectForKey:@"level"] intValue]> 0) {
       
   136             NSString *filePath = [NSString stringWithFormat:@"%@/cyborg.png",HATS_DIRECTORY()];
       
   137             UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:filePath andCutAt:CGRectMake(0, 2, 32, 32)];
       
   138             UIImageView *spriteView = [[UIImageView alloc] initWithImage:sprite];
       
   139             [sprite release];
       
   140             
       
   141             cell.accessoryView = spriteView;
       
   142             [spriteView release];
       
   143         } else
       
   144             cell.accessoryView = nil;
   129     } else {
   145     } else {
   130         cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
   146         cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
   131         if (cell == nil)
   147         if (cell == nil)
   132             cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
   148             cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
   133 
   149 
   134         cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension];
   150         cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension];
       
   151         cell.accessoryView = nil;
   135     }
   152     }
   136 
   153 
   137     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
   154     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
   138         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
   155         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
   139         cell.backgroundColor = [UIColor blackColor];
   156         cell.backgroundColor = [UIColor blackColor];