114 caption.minimumFontSize = 8; |
114 caption.minimumFontSize = 8; |
115 self.captionLabel = caption; |
115 self.captionLabel = caption; |
116 [self.view addSubview:self.captionLabel]; |
116 [self.view addSubview:self.captionLabel]; |
117 [caption release]; |
117 [caption release]; |
118 |
118 |
119 UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, y+20, 410, 53)]; |
119 UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, y+20, 415, 53)]; |
120 description.backgroundColor = [UIColor clearColor]; |
120 description.backgroundColor = [UIColor clearColor]; |
121 description.textColor = [UIColor whiteColor]; |
121 description.textColor = [UIColor whiteColor]; |
122 description.text = DEFAULT_DESCRIPTION; |
122 description.text = DEFAULT_DESCRIPTION; |
123 description.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; |
123 description.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; |
124 description.adjustsFontSizeToFitWidth = YES; |
124 description.adjustsFontSizeToFitWidth = YES; |
269 self.extraLabel.text = [[[morePurgedElements objectAtIndex:0] stringByReplacingOccurrencesOfString:@"|" withString:@" "] stringByAppendingString:@"."]; |
269 self.extraLabel.text = [[[morePurgedElements objectAtIndex:0] stringByReplacingOccurrencesOfString:@"|" withString:@" "] stringByAppendingString:@"."]; |
270 if (theButton.currentTitle != nil) |
270 if (theButton.currentTitle != nil) |
271 self.captionLabel.text = NSLocalizedString(@"This weapon is locked",@""); |
271 self.captionLabel.text = NSLocalizedString(@"This weapon is locked",@""); |
272 else |
272 else |
273 self.captionLabel.text = [NSString stringWithUTF8String:HW_getWeaponCaptionByIndex(theButton.tag)]; |
273 self.captionLabel.text = [NSString stringWithUTF8String:HW_getWeaponCaptionByIndex(theButton.tag)]; |
|
274 |
|
275 self.nameLabel.backgroundColor = [UIColor blackColor]; |
|
276 self.captionLabel.backgroundColor = [UIColor blackColor]; |
|
277 self.extraLabel.backgroundColor = [UIColor blackColor]; |
|
278 |
|
279 int y, x = 8; |
|
280 // display labels on top for lower buttons |
|
281 if (theButton.tag > 41) |
|
282 y = 5; |
|
283 else |
|
284 y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18; |
|
285 |
|
286 self.nameLabel.frame = CGRectMake(x, y, 200, 20); |
|
287 self.captionLabel.frame = CGRectMake(x+200, y, 220, 20); |
|
288 self.extraLabel.frame = CGRectMake(x+2, y+20, 415, 53); |
274 } |
289 } |
275 |
290 |
276 -(void) buttonCancelled:(id) sender { |
291 -(void) buttonCancelled:(id) sender { |
277 self.nameLabel.text = nil; |
292 self.nameLabel.text = nil; |
278 self.extraLabel.text = nil; |
293 self.extraLabel.text = nil; |
279 self.captionLabel.text = nil; |
294 self.captionLabel.text = nil; |
|
295 self.extraLabel.backgroundColor = [UIColor clearColor]; |
|
296 self.captionLabel.backgroundColor = [UIColor clearColor]; |
|
297 self.nameLabel.backgroundColor = [UIColor clearColor]; |
280 } |
298 } |
281 |
299 |
282 -(void) buttonReleased:(id) sender { |
300 -(void) buttonReleased:(id) sender { |
283 UIButton *theButton = (UIButton *)sender; |
301 UIButton *theButton = (UIButton *)sender; |
284 if (self.nameLabel == nil || self.extraLabel == nil) |
302 if (self.nameLabel == nil || self.extraLabel == nil) |
285 [self loadLabels]; |
303 [self loadLabels]; |
286 |
304 |
287 self.nameLabel.text = nil; |
|
288 self.extraLabel.text = nil; |
|
289 self.captionLabel.text = nil; |
|
290 if (theButton.currentTitle == nil) { |
305 if (theButton.currentTitle == nil) { |
291 HW_setWeapon(theButton.tag); |
306 HW_setWeapon(theButton.tag); |
292 playSound(@"clickSound"); |
307 playSound(@"clickSound"); |
293 if (IS_DUALHEAD() == NO) |
308 if (IS_DUALHEAD() == NO) |
294 [self disappear]; |
309 [self disappear]; |
295 } |
310 } |
|
311 [self buttonCancelled:sender]; |
296 } |
312 } |
297 |
313 |
298 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { |
314 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { |
299 NSSet *allTouches = [event allTouches]; |
315 NSSet *allTouches = [event allTouches]; |
300 |
316 |