project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
changeset 3643 858b20bafb6e
parent 3624 304c6d32383a
child 3644 42c5684289ae
equal deleted inserted replaced
3642:fb39fecca350 3643:858b20bafb6e
    82     NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
    82     NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
    83     UIImage *img = [[UIImage alloc] initWithContentsOfFile:str];
    83     UIImage *img = [[UIImage alloc] initWithContentsOfFile:str];
    84     self.ammoStoreImage = img;
    84     self.ammoStoreImage = img;
    85     [img release];
    85     [img release];
    86     
    86     
    87     self.tableView.rowHeight = 75;
    87     self.tableView.rowHeight = 120;
    88 }
    88 }
    89 
    89 
    90 -(void) viewWillAppear:(BOOL) animated {
    90 -(void) viewWillAppear:(BOOL) animated {
    91     [super viewWillAppear:animated];
    91     [super viewWillAppear:animated];
    92     
    92     
   144 #pragma mark Table view data source
   144 #pragma mark Table view data source
   145 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
   145 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
   146     return 1;
   146     return 1;
   147 }
   147 }
   148 
   148 
   149 
       
   150 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   149 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   151     return CURRENT_AMMOSIZE;
   150     return CURRENT_AMMOSIZE;
   152 }
   151 }
   153 
       
   154 
   152 
   155 // Customize the appearance of table view cells.
   153 // Customize the appearance of table view cells.
   156 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   154 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   157     static NSString *CellIdentifier = @"Cell";
   155     static NSString *CellIdentifier = @"Cell";
   158     NSInteger row = [indexPath row];
   156     NSInteger row = [indexPath row];
   169     UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, 32, 32)] makeRoundCornersOfSize:CGSizeMake(7, 7)];
   167     UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, 32, 32)] makeRoundCornersOfSize:CGSizeMake(7, 7)];
   170     cell.weaponIcon.image = img;
   168     cell.weaponIcon.image = img;
   171     cell.weaponName.text = [ammoNames objectAtIndex:row];
   169     cell.weaponName.text = [ammoNames objectAtIndex:row];
   172     cell.tag = row;
   170     cell.tag = row;
   173     
   171     
   174     [cell.initialQt setTitle:[NSString stringWithFormat:@"%c",quantity[row]] forState:UIControlStateNormal];
   172     [cell.initialQt setValue:[[NSString stringWithFormat:@"%c",quantity[row]] intValue] animated:NO];
   175     cell.probability.titleLabel.text = [NSString stringWithFormat:@"%c",probability[row]];
   173     [cell.probabilityQt setValue:[[NSString stringWithFormat:@"%c", probability[row]] intValue] animated:NO];
   176     cell.delay.titleLabel.text = [NSString stringWithFormat:@"%c",delay[row]];
   174     [cell.delayQt setValue:[[NSString stringWithFormat:@"%c", delay[row]] intValue] animated:NO];
   177     cell.crateQt.titleLabel.text = [NSString stringWithFormat:@"%c",crateness[row]];
   175     [cell.crateQt setValue:[[NSString stringWithFormat:@"%c",crateness[row]] intValue] animated:NO];
       
   176     
       
   177     cell.selectionStyle = UITableViewCellSelectionStyleNone;
   178     return cell;
   178     return cell;
   179 }
   179 }
   180 
   180 
   181 
   181 
   182 #pragma mark -
   182 #pragma mark -
   192      */
   192      */
   193 }
   193 }
   194 
   194 
   195 #pragma mark -
   195 #pragma mark -
   196 #pragma mark WeaponButtonControllerDelegate
   196 #pragma mark WeaponButtonControllerDelegate
   197 -(void) buttonPressed:(id) sender {
   197 -(void) valueChanged:(id) sender {
   198     UIButton *button = (UIButton *)sender;
   198    // UIButton *button = (UIButton *)sender;
   199     DLog(@"%@ %d", button.titleLabel.text, button.tag);
   199    // DLog(@"%@ %d", button.titleLabel.text, button.tag);
   200 }
   200 }
   201 
   201 
   202 #pragma mark -
   202 #pragma mark -
   203 #pragma mark Memory management
   203 #pragma mark Memory management
   204 -(void) didReceiveMemoryWarning {
   204 -(void) didReceiveMemoryWarning {