project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
changeset 3624 304c6d32383a
parent 3623 f14db208f2fa
child 3643 858b20bafb6e
equal deleted inserted replaced
3623:f14db208f2fa 3624:304c6d32383a
   158     NSInteger row = [indexPath row];
   158     NSInteger row = [indexPath row];
   159     
   159     
   160     WeaponCellView *cell = (WeaponCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   160     WeaponCellView *cell = (WeaponCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   161     if (cell == nil) {
   161     if (cell == nil) {
   162         cell = [[[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
   162         cell = [[[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
       
   163         cell.delegate = self;
   163     }
   164     }
   164     
   165     
   165     int x = ((row*32)/1024)*32;
   166     int x = ((row*32)/1024)*32;
   166     int y = (row*32)%1024;
   167     int y = (row*32)%1024;
   167 
   168 
   168     UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, 32, 32)] makeRoundCornersOfSize:CGSizeMake(7, 7)];
   169     UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, 32, 32)] makeRoundCornersOfSize:CGSizeMake(7, 7)];
   169     cell.weaponIcon.image = img;
   170     cell.weaponIcon.image = img;
   170     cell.weaponName.text = [ammoNames objectAtIndex:row];
   171     cell.weaponName.text = [ammoNames objectAtIndex:row];
   171 
   172     cell.tag = row;
   172     cell.initialQt.titleLabel.text = [NSString stringWithFormat:@"%c",quantity[row]];
   173     
       
   174     [cell.initialQt setTitle:[NSString stringWithFormat:@"%c",quantity[row]] forState:UIControlStateNormal];
   173     cell.probability.titleLabel.text = [NSString stringWithFormat:@"%c",probability[row]];
   175     cell.probability.titleLabel.text = [NSString stringWithFormat:@"%c",probability[row]];
   174     cell.delay.titleLabel.text = [NSString stringWithFormat:@"%c",delay[row]];
   176     cell.delay.titleLabel.text = [NSString stringWithFormat:@"%c",delay[row]];
   175     cell.initialQt.titleLabel.text = [NSString stringWithFormat:@"%c",crateness[row]];
   177     cell.crateQt.titleLabel.text = [NSString stringWithFormat:@"%c",crateness[row]];
   176     return cell;
   178     return cell;
   177 }
   179 }
   178 
   180 
   179 
   181 
   180 #pragma mark -
   182 #pragma mark -
   188      [self.navigationController pushViewController:detailViewController animated:YES];
   190      [self.navigationController pushViewController:detailViewController animated:YES];
   189      [detailViewController release];
   191      [detailViewController release];
   190      */
   192      */
   191 }
   193 }
   192 
   194 
       
   195 #pragma mark -
       
   196 #pragma mark WeaponButtonControllerDelegate
       
   197 -(void) buttonPressed:(id) sender {
       
   198     UIButton *button = (UIButton *)sender;
       
   199     DLog(@"%@ %d", button.titleLabel.text, button.tag);
       
   200 }
   193 
   201 
   194 #pragma mark -
   202 #pragma mark -
   195 #pragma mark Memory management
   203 #pragma mark Memory management
   196 -(void) didReceiveMemoryWarning {
   204 -(void) didReceiveMemoryWarning {
   197     // Releases the view if it doesn't have a superview.
   205     // Releases the view if it doesn't have a superview.