17 #import "UIImageExtra.h" |
17 #import "UIImageExtra.h" |
18 |
18 |
19 #define TEAMNAME_TAG 78789 |
19 #define TEAMNAME_TAG 78789 |
20 |
20 |
21 @implementation SingleTeamViewController |
21 @implementation SingleTeamViewController |
22 @synthesize teamDictionary, normalHogSprite, secondaryItems, teamName; |
22 @synthesize teamDictionary, normalHogSprite, secondaryItems, moreSecondaryItems, teamName; |
23 |
23 |
24 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
24 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
25 return rotationManager(interfaceOrientation); |
25 return rotationManager(interfaceOrientation); |
26 } |
26 } |
27 |
27 |
56 NSLocalizedString(@"Fort",@""), |
56 NSLocalizedString(@"Fort",@""), |
57 NSLocalizedString(@"Flag",@""), |
57 NSLocalizedString(@"Flag",@""), |
58 NSLocalizedString(@"Level",@""),nil]; |
58 NSLocalizedString(@"Level",@""),nil]; |
59 self.secondaryItems = array; |
59 self.secondaryItems = array; |
60 [array release]; |
60 [array release]; |
|
61 |
|
62 // labels for the subtitles |
|
63 NSArray *moreArray = [[NSArray alloc] initWithObjects: |
|
64 NSLocalizedString(@"Mark the death of your fallen warriors",@""), |
|
65 NSLocalizedString(@"Pick a slang your hogs will speak",@""), |
|
66 NSLocalizedString(@"Select the team invincible fortress (only valid for fort games)",@""), |
|
67 NSLocalizedString(@"Choose a charismatic symbol for your team",@""), |
|
68 NSLocalizedString(@"Opt for controlling the team or let the AI lead",@""),nil]; |
|
69 self.moreSecondaryItems = moreArray; |
|
70 [moreArray release]; |
61 |
71 |
62 // load the base hog image, drawing will occure in cellForRow... |
72 // load the base hog image, drawing will occure in cellForRow... |
63 NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; |
73 NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; |
64 UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; |
74 UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; |
65 [normalHogFile release]; |
75 [normalHogFile release]; |
206 cell = editableCell; |
216 cell = editableCell; |
207 break; |
217 break; |
208 case 2: |
218 case 2: |
209 cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; |
219 cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; |
210 if (cell == nil) { |
220 if (cell == nil) { |
211 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
221 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle |
212 reuseIdentifier:CellIdentifier2] autorelease]; |
222 reuseIdentifier:CellIdentifier2] autorelease]; |
213 } |
223 } |
214 |
224 |
215 cell.textLabel.text = [self.secondaryItems objectAtIndex:row]; |
225 cell.textLabel.text = [self.secondaryItems objectAtIndex:row]; |
|
226 cell.detailTextLabel.text = [self.moreSecondaryItems objectAtIndex:row]; |
216 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
227 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
217 switch (row) { |
228 switch (row) { |
218 case 0: // grave |
229 case 0: // grave |
219 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
230 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
220 GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]] |
231 GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]] |
221 andCutAt:CGRectMake(0,0,32,32)]; |
232 andCutAt:CGRectMake(0,0,32,32)]; |
222 cell.imageView.image = accessoryImage; |
233 cell.imageView.image = accessoryImage; |
223 [accessoryImage release]; |
234 [accessoryImage release]; |
224 break; |
235 break; |
|
236 case 1: // voice |
|
237 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/HellishBomb.png", |
|
238 GRAPHICS_DIRECTORY()]]; |
|
239 cell.imageView.image = accessoryImage; |
|
240 [accessoryImage release]; |
|
241 break; |
225 case 2: // fort |
242 case 2: // fort |
226 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@-preview.png", |
243 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@-preview.png", |
227 FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]]; |
244 FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]]; |
228 cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(42, 42)]; |
245 cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(32, 32)]; |
229 [accessoryImage release]; |
246 [accessoryImage release]; |
230 break; |
247 break; |
231 |
|
232 case 3: // flags |
248 case 3: // flags |
233 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
249 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
234 FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; |
250 FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; |
235 cell.imageView.image = accessoryImage; |
251 cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(32, 32)]; |
236 [accessoryImage release]; |
252 [accessoryImage release]; |
237 break; |
253 break; |
238 case 4: // level |
254 case 4: // level |
239 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png", |
255 accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png", |
240 BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"] |
256 BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"] |
241 objectAtIndex:0] objectForKey:@"level"] |
257 objectAtIndex:0] objectForKey:@"level"] |
242 intValue]]]; |
258 intValue]]]; |
243 cell.imageView.image = accessoryImage; |
259 cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(32, 32)]; |
244 [accessoryImage release]; |
260 [accessoryImage release]; |
245 break; |
261 break; |
246 default: |
262 default: |
247 cell.imageView.image = nil; |
263 cell.imageView.image = nil; |
248 break; |
264 break; |
346 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
362 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
347 self.teamDictionary = nil; |
363 self.teamDictionary = nil; |
348 self.teamName = nil; |
364 self.teamName = nil; |
349 self.normalHogSprite = nil; |
365 self.normalHogSprite = nil; |
350 self.secondaryItems = nil; |
366 self.secondaryItems = nil; |
|
367 self.moreSecondaryItems = nil; |
351 hogHatViewController = nil; |
368 hogHatViewController = nil; |
352 gravesViewController = nil; |
369 gravesViewController = nil; |
353 voicesViewController = nil; |
370 voicesViewController = nil; |
354 flagsViewController = nil; |
371 flagsViewController = nil; |
355 fortsViewController = nil; |
372 fortsViewController = nil; |
361 -(void) dealloc { |
378 -(void) dealloc { |
362 [teamDictionary release]; |
379 [teamDictionary release]; |
363 [teamName release]; |
380 [teamName release]; |
364 [normalHogSprite release]; |
381 [normalHogSprite release]; |
365 [secondaryItems release]; |
382 [secondaryItems release]; |
|
383 [moreSecondaryItems release]; |
366 [hogHatViewController release]; |
384 [hogHatViewController release]; |
367 [gravesViewController release]; |
385 [gravesViewController release]; |
368 [fortsViewController release]; |
386 [fortsViewController release]; |
369 [voicesViewController release]; |
387 [voicesViewController release]; |
370 [flagsViewController release]; |
388 [flagsViewController release]; |