author | Wuzzy <almikes@aol.com> |
Mon, 08 May 2017 03:42:51 +0200 | |
changeset 12414 | 7cdd8e113dc0 |
parent 11559 | 73e6a3d2f768 |
child 12877 | 00215a7ec5f5 |
permissions | -rw-r--r-- |
3829 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
6700 | 3 |
* Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com> |
3829 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
8441
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3829 | 17 |
*/ |
18 |
||
3547 | 19 |
|
20 |
#import "MapConfigViewController.h" |
|
6108 | 21 |
#import <QuartzCore/QuartzCore.h> |
3547 | 22 |
|
6832 | 23 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
24 |
#define scIndex self.segmentedControl.selectedSegmentIndex |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
25 |
#define isRandomness() (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2) |
3547 | 26 |
|
27 |
@implementation MapConfigViewController |
|
3642 | 28 |
@synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, |
6634
e00762923086
ios game configuration page supports rotation, with some enhancements (like the new slider); some glitches here and there
koda
parents:
6115
diff
changeset
|
29 |
missionCommand, tableView, maxLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
30 |
oldPage, oldValue; |
3547 | 31 |
|
32 |
||
33 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
|
34 |
return rotationManager(interfaceOrientation); |
|
35 |
} |
|
36 |
||
6109
f6726ec81e64
finally removed the white border glitch of the ipad preview map, moved initialization from IB to code
koda
parents:
6108
diff
changeset
|
37 |
-(IBAction) mapButtonPressed:(id) sender { |
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
38 |
[[AudioManagerController mainManager] playClickSound]; |
3783 | 39 |
[self updatePreview]; |
40 |
} |
|
41 |
||
42 |
-(void) updatePreview { |
|
3547 | 43 |
// don't generate a new preview while it's already generating one |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
44 |
if (self.busy) |
3547 | 45 |
return; |
3697 | 46 |
|
3547 | 47 |
// generate a seed |
11559
73e6a3d2f768
- Small refactoring for seed generation on iOS side
antonc27 <antonc27@mail.ru>
parents:
11230
diff
changeset
|
48 |
NSString *seed = [HWUtils seed]; |
3547 | 49 |
NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; |
50 |
self.seedCommand = seedCmd; |
|
51 |
[seedCmd release]; |
|
3697 | 52 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
53 |
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
54 |
if (isRandomness()) { |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
55 |
// prevent other events and add an activity while the preview is beign generated |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
56 |
[self turnOffWidgets]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
57 |
[self.previewButton updatePreviewWithSeed:seed]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
58 |
// the preview for static maps is loaded in didSelectRowAtIndexPath |
3547 | 59 |
} |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
60 |
[seed release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
61 |
|
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
62 |
// perform as if user clicked on an entry |
11210
2e80c9861818
- Better random number generation for front-end: random() replaced with arc4random_uniform()
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
63 |
NSIndexPath *theIndex = [NSIndexPath indexPathForRow:arc4random_uniform((int)[source count]) inSection:0]; |
3547 | 64 |
[self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; |
6078
8c0cc07731e5
headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents:
6000
diff
changeset
|
65 |
if (IS_NOT_POWERFUL([HWUtils modelType]) == NO) |
4287 | 66 |
[self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; |
3547 | 67 |
} |
68 |
||
69 |
-(void) turnOffWidgets { |
|
70 |
busy = YES; |
|
71 |
self.previewButton.alpha = 0.5f; |
|
72 |
self.previewButton.enabled = NO; |
|
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
73 |
self.maxLabel.text = NSLocalizedString(@"Loading...",@"");; |
3547 | 74 |
self.segmentedControl.enabled = NO; |
75 |
self.slider.enabled = NO; |
|
76 |
} |
|
77 |
||
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
78 |
#pragma mark - |
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
79 |
#pragma mark MapPreviewButtonView delegate methods |
3547 | 80 |
-(void) turnOnWidgets { |
81 |
self.previewButton.alpha = 1.0f; |
|
82 |
self.previewButton.enabled = YES; |
|
83 |
self.segmentedControl.enabled = YES; |
|
84 |
self.slider.enabled = YES; |
|
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
85 |
self.busy = NO; |
3547 | 86 |
} |
3697 | 87 |
|
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
88 |
-(void) setMaxLabelText:(NSString *)str { |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
89 |
self.maxHogs = [str intValue]; |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
90 |
self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str]; |
3547 | 91 |
} |
92 |
||
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
93 |
-(NSDictionary *)getDataForEngine { |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
94 |
NSDictionary *dictForEngine = [NSDictionary dictionaryWithObjectsAndKeys: |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
95 |
self.seedCommand,@"seedCommand", |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
96 |
self.templateFilterCommand,@"templateFilterCommand", |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
97 |
self.mapGenCommand,@"mapGenCommand", |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
98 |
self.mazeSizeCommand,@"mazeSizeCommand", |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
99 |
nil]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
100 |
return dictForEngine; |
3547 | 101 |
} |
102 |
||
103 |
#pragma mark - |
|
104 |
#pragma mark Table view data source |
|
105 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
106 |
return 1; |
|
107 |
} |
|
108 |
||
109 |
-(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
110 |
return [[self.dataSourceArray objectAtIndex:scIndex] count]; |
3547 | 111 |
} |
112 |
||
113 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
114 |
static NSString *CellIdentifier = @"Cell"; |
|
6908
896ed2afcfb8
ios: turn on more warning messages and start correcting them
koda
parents:
6869
diff
changeset
|
115 |
NSUInteger row = [indexPath row]; |
3697 | 116 |
|
3547 | 117 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
3697 | 118 |
if (cell == nil) |
3547 | 119 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
3697 | 120 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
121 |
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
122 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
123 |
NSString *labelString = [source objectAtIndex:row]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
124 |
cell.textLabel.text = labelString; |
3996 | 125 |
cell.textLabel.adjustsFontSizeToFitWidth = YES; |
126 |
cell.textLabel.minimumFontSize = 7; |
|
6078
8c0cc07731e5
headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents:
6000
diff
changeset
|
127 |
cell.textLabel.textColor = [UIColor lightYellowColor]; |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
4362
diff
changeset
|
128 |
cell.textLabel.backgroundColor = [UIColor clearColor]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
129 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
130 |
if (isRandomness()) { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
131 |
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]]; |
3547 | 132 |
cell.imageView.image = image; |
133 |
[image release]; |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
134 |
} else |
3547 | 135 |
cell.imageView.image = nil; |
3697 | 136 |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
137 |
if (row == [self.lastIndexPath row]) { |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
138 |
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
139 |
cell.accessoryView = checkbox; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
140 |
[checkbox release]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
141 |
} else |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
142 |
cell.accessoryView = nil; |
3547 | 143 |
|
6078
8c0cc07731e5
headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents:
6000
diff
changeset
|
144 |
cell.backgroundColor = [UIColor blackColorTransparent]; |
3547 | 145 |
return cell; |
146 |
} |
|
147 |
||
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
148 |
// this set details for a static map (called by didSelectRowAtIndexPath) |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
149 |
-(void) setDetailsForStaticMap:(NSInteger) index { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
150 |
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
8441 | 151 |
|
152 |
NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
153 |
(scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]]; |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
154 |
NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
155 |
[fileCfg release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
156 |
NSArray *split = [contents componentsSeparatedByString:@"\n"]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
157 |
[contents release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
158 |
|
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
159 |
// if the number is not set we keep 18 standard; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
160 |
// sometimes it's not set but there are trailing characters, we get around them with the second equation |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
161 |
NSString *max; |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
162 |
if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0) |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
163 |
max = [split objectAtIndex:1]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
164 |
else |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
165 |
max = @"18"; |
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
166 |
[self setMaxLabelText:max]; |
8441 | 167 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
168 |
self.themeCommand = [NSString stringWithFormat:@"etheme %@", [split objectAtIndex:0]]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
169 |
self.staticMapCommand = [NSString stringWithFormat:@"emap %@", [source objectAtIndex:index]]; |
3912
e11df2de6af2
have engine try for a second position when map loading fails (in this way it's possible to move Missions data to any path)
koda
parents:
3911
diff
changeset
|
170 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
171 |
if (scIndex != 3) |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
172 |
self.missionCommand = @""; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
173 |
else |
3920
a54ca6185307
updated lua loading in the ifrontend and also fixed masked maps
koda
parents:
3912
diff
changeset
|
174 |
self.missionCommand = [NSString stringWithFormat:@"escript Missions/Maps/%@/map.lua",[source objectAtIndex:index]]; |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
175 |
} |
3547 | 176 |
|
177 |
#pragma mark - |
|
178 |
#pragma mark Table view delegate |
|
179 |
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
11148
064a53861759
- Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
180 |
NSInteger newRow = [indexPath row]; |
064a53861759
- Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
181 |
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
3697 | 182 |
|
3547 | 183 |
if (newRow != oldRow) { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
184 |
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
185 |
if (isRandomness()) { |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
186 |
// just change the theme, don't update preview |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
187 |
self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]]; |
3642 | 188 |
} else { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
189 |
NSString *fileImage = [NSString stringWithFormat:@"%@/%@/preview.png", |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
190 |
(scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:newRow]]; |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
191 |
[self.previewButton updatePreviewWithFile:fileImage]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
192 |
[self setDetailsForStaticMap:newRow]; |
3642 | 193 |
} |
3697 | 194 |
|
195 |
UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
196 |
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
197 |
newCell.accessoryView = checkbox; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
198 |
[checkbox release]; |
3547 | 199 |
UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath]; |
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
200 |
oldCell.accessoryView = nil; |
3547 | 201 |
|
202 |
self.lastIndexPath = indexPath; |
|
203 |
[aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; |
|
204 |
} |
|
205 |
[aTableView deselectRowAtIndexPath:indexPath animated:YES]; |
|
206 |
} |
|
207 |
||
208 |
#pragma mark - |
|
4082 | 209 |
#pragma mark slider & segmentedControl & button |
3547 | 210 |
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl |
211 |
// no methods are called by this routine and you can pass nil to it |
|
212 |
-(IBAction) sliderChanged:(id) sender { |
|
213 |
NSString *labelText; |
|
214 |
NSString *templateCommand; |
|
215 |
NSString *mazeCommand; |
|
3697 | 216 |
|
3547 | 217 |
switch ((int)(self.slider.value*100)) { |
218 |
case 0: |
|
219 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
220 |
labelText = NSLocalizedString(@"Wacky",@""); |
|
221 |
} else { |
|
222 |
labelText = NSLocalizedString(@"Large Floating Islands",@""); |
|
223 |
} |
|
224 |
templateCommand = @"e$template_filter 5"; |
|
225 |
mazeCommand = @"e$maze_size 5"; |
|
226 |
break; |
|
227 |
case 1: |
|
228 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
229 |
labelText = NSLocalizedString(@"Cavern",@""); |
|
230 |
} else { |
|
231 |
labelText = NSLocalizedString(@"Medium Floating Islands",@""); |
|
232 |
} |
|
233 |
templateCommand = @"e$template_filter 4"; |
|
234 |
mazeCommand = @"e$maze_size 4"; |
|
235 |
break; |
|
236 |
case 2: |
|
237 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
6669 | 238 |
labelText = NSLocalizedString(@"Large",@""); |
3547 | 239 |
} else { |
240 |
labelText = NSLocalizedString(@"Small Floating Islands",@""); |
|
241 |
} |
|
242 |
templateCommand = @"e$template_filter 1"; |
|
243 |
mazeCommand = @"e$maze_size 3"; |
|
244 |
break; |
|
245 |
case 3: |
|
246 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
247 |
labelText = NSLocalizedString(@"Medium",@""); |
|
248 |
} else { |
|
249 |
labelText = NSLocalizedString(@"Large Tunnels",@""); |
|
250 |
} |
|
251 |
templateCommand = @"e$template_filter 2"; |
|
252 |
mazeCommand = @"e$maze_size 2"; |
|
253 |
break; |
|
254 |
case 4: |
|
255 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
6669 | 256 |
labelText = NSLocalizedString(@"Small",@""); |
3547 | 257 |
} else { |
258 |
labelText = NSLocalizedString(@"Medium Tunnels",@""); |
|
259 |
} |
|
260 |
templateCommand = @"e$template_filter 3"; |
|
261 |
mazeCommand = @"e$maze_size 1"; |
|
262 |
break; |
|
263 |
case 5: |
|
264 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
265 |
labelText = NSLocalizedString(@"All",@""); |
|
266 |
} else { |
|
267 |
labelText = NSLocalizedString(@"Small Tunnels",@""); |
|
268 |
} |
|
269 |
templateCommand = @"e$template_filter 0"; |
|
270 |
mazeCommand = @"e$maze_size 0"; |
|
271 |
break; |
|
272 |
default: |
|
273 |
labelText = nil; |
|
274 |
templateCommand = nil; |
|
275 |
mazeCommand = nil; |
|
276 |
break; |
|
277 |
} |
|
3697 | 278 |
|
6634
e00762923086
ios game configuration page supports rotation, with some enhancements (like the new slider); some glitches here and there
koda
parents:
6115
diff
changeset
|
279 |
self.slider.textValue = labelText; |
3547 | 280 |
self.templateFilterCommand = templateCommand; |
281 |
self.mazeSizeCommand = mazeCommand; |
|
282 |
} |
|
283 |
||
284 |
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up |
|
285 |
-(IBAction) sliderEndedChanging:(id) sender { |
|
286 |
int num = (int) (self.slider.value * 100); |
|
287 |
if (oldValue != num) { |
|
288 |
[self updatePreview]; |
|
289 |
oldValue = num; |
|
290 |
} |
|
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
291 |
[[AudioManagerController mainManager] playClickSound]; |
3547 | 292 |
} |
293 |
||
3697 | 294 |
// perform actions based on the activated section, then call updatePreview to visually update the selection |
3547 | 295 |
// and if necessary update the table with a slide animation |
296 |
-(IBAction) segmentedControlChanged:(id) sender { |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
297 |
NSString *mapgen, *staticmap, *mission; |
3547 | 298 |
NSInteger newPage = self.segmentedControl.selectedSegmentIndex; |
3697 | 299 |
|
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
300 |
[[AudioManagerController mainManager] playSelectSound]; |
3547 | 301 |
switch (newPage) { |
302 |
case 0: // Random |
|
303 |
mapgen = @"e$mapgen 0"; |
|
3642 | 304 |
staticmap = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
305 |
mission = @""; |
3547 | 306 |
[self sliderChanged:nil]; |
307 |
self.slider.enabled = YES; |
|
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
308 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"fillsections" object:nil]; |
3547 | 309 |
break; |
3697 | 310 |
|
3547 | 311 |
case 1: // Map |
312 |
mapgen = @"e$mapgen 0"; |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
313 |
// dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap |
3642 | 314 |
staticmap = @"map Bamboo"; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
315 |
mission = @""; |
3547 | 316 |
self.slider.enabled = NO; |
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
317 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"fillsections" object:nil]; |
3547 | 318 |
break; |
3697 | 319 |
|
3547 | 320 |
case 2: // Maze |
321 |
mapgen = @"e$mapgen 1"; |
|
3642 | 322 |
staticmap = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
323 |
mission = @""; |
3547 | 324 |
[self sliderChanged:nil]; |
325 |
self.slider.enabled = YES; |
|
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
326 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"fillsections" object:nil]; |
4349 | 327 |
break; |
328 |
||
329 |
case 3: // Mission |
|
330 |
mapgen = @"e$mapgen 0"; |
|
331 |
// dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap |
|
332 |
staticmap = @"map Bamboo"; |
|
333 |
mission = @""; |
|
334 |
self.slider.enabled = NO; |
|
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
335 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"emptysections" object:nil]; |
3547 | 336 |
break; |
3697 | 337 |
|
3547 | 338 |
default: |
339 |
mapgen = nil; |
|
3642 | 340 |
staticmap = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
341 |
mission = nil; |
3547 | 342 |
break; |
343 |
} |
|
344 |
self.mapGenCommand = mapgen; |
|
3642 | 345 |
self.staticMapCommand = staticmap; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
346 |
self.missionCommand = mission; |
3697 | 347 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
348 |
[self.tableView reloadData]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
349 |
[self updatePreview]; |
3547 | 350 |
oldPage = newPage; |
351 |
} |
|
352 |
||
11230
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
353 |
- (void)localizeSegmentedControl |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
354 |
{ |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
355 |
for (NSUInteger i = 0; i < self.segmentedControl.numberOfSegments; i++) |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
356 |
{ |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
357 |
NSString *oldTitle = [self.segmentedControl titleForSegmentAtIndex:i]; |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
358 |
[self.segmentedControl setTitle:NSLocalizedString(oldTitle, nil) forSegmentAtIndex:i]; |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
359 |
} |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
360 |
} |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
361 |
|
4082 | 362 |
#pragma mark - |
363 |
#pragma mark view management |
|
6107 | 364 |
-(NSArray *) dataSourceArray { |
365 |
if (dataSourceArray == nil) { |
|
366 |
NSString *model = [HWUtils modelType]; |
|
8441 | 367 |
|
6107 | 368 |
// only folders containing icon.png are a valid theme |
369 |
NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; |
|
370 |
NSMutableArray *themeArray = [[NSMutableArray alloc] init]; |
|
371 |
for (NSString *themeName in themeArrayFull) { |
|
372 |
NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; |
|
373 |
if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) |
|
374 |
[themeArray addObject:themeName]; |
|
375 |
[checkPath release]; |
|
376 |
} |
|
8441 | 377 |
|
6107 | 378 |
// remove images that are too big for certain devices without loading the whole image |
379 |
NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
|
380 |
NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
|
381 |
for (NSString *str in mapArrayFull) { |
|
382 |
CGSize imgSize = [UIImage imageSizeFromMetadataOf:[MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]]; |
|
383 |
if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
|
384 |
continue; |
|
385 |
if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
|
386 |
continue; |
|
387 |
[mapArray addObject:str]; |
|
388 |
} |
|
8441 | 389 |
|
6107 | 390 |
NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
391 |
NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
|
392 |
for (NSString *str in missionArrayFull) { |
|
393 |
CGSize imgSize = [UIImage imageSizeFromMetadataOf:[MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]]; |
|
394 |
if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
|
395 |
continue; |
|
396 |
if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
|
397 |
continue; |
|
398 |
[missionArray addObject:str]; |
|
399 |
} |
|
400 |
NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
|
401 |
[missionArray release]; |
|
402 |
[themeArray release]; |
|
403 |
[mapArray release]; |
|
8441 | 404 |
|
6107 | 405 |
self.dataSourceArray = array; |
406 |
[array release]; |
|
5281 | 407 |
} |
6107 | 408 |
return dataSourceArray; |
3547 | 409 |
} |
410 |
||
411 |
-(void) viewDidLoad { |
|
412 |
[super viewDidLoad]; |
|
11230
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
413 |
|
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
414 |
[self localizeSegmentedControl]; |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11210
diff
changeset
|
415 |
|
3547 | 416 |
// initialize some "default" values |
417 |
self.slider.value = 0.05f; |
|
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
418 |
self.slider.enabled = NO; |
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
419 |
self.oldValue = 5; |
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
420 |
self.busy = NO; |
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
421 |
self.oldPage = self.segmentedControl.selectedSegmentIndex; |
3547 | 422 |
|
423 |
self.templateFilterCommand = @"e$template_filter 0"; |
|
424 |
self.mazeSizeCommand = @"e$maze_size 0"; |
|
425 |
self.mapGenCommand = @"e$mapgen 0"; |
|
3642 | 426 |
self.staticMapCommand = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
427 |
self.missionCommand = @""; |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
428 |
|
6108 | 429 |
if (IS_IPAD()) { |
430 |
[self.tableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; |
|
431 |
self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; |
|
432 |
self.tableView.layer.borderWidth = 2.7f; |
|
433 |
self.tableView.layer.cornerRadius = 8; |
|
434 |
self.tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0); |
|
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
435 |
|
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
436 |
UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 14, 300, 190) andTitle:nil withBorderWidth:2.3f]; |
6634
e00762923086
ios game configuration page supports rotation, with some enhancements (like the new slider); some glitches here and there
koda
parents:
6115
diff
changeset
|
437 |
backLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
438 |
[self.view insertSubview:backLabel belowSubview:self.segmentedControl]; |
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
6109
diff
changeset
|
439 |
[backLabel release]; |
6108 | 440 |
} |
441 |
self.tableView.separatorColor = [UIColor whiteColor]; |
|
4244 | 442 |
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
3547 | 443 |
} |
444 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
445 |
-(void) viewWillAppear:(BOOL)animated { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
446 |
[super viewWillAppear:animated]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
447 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
448 |
|
3547 | 449 |
-(void) viewDidAppear:(BOOL) animated { |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
450 |
[self updatePreview]; |
3547 | 451 |
[super viewDidAppear:animated]; |
452 |
} |
|
453 |
||
454 |
-(void) viewDidUnload { |
|
455 |
self.previewButton = nil; |
|
456 |
self.seedCommand = nil; |
|
457 |
self.templateFilterCommand = nil; |
|
458 |
self.mapGenCommand = nil; |
|
459 |
self.mazeSizeCommand = nil; |
|
460 |
self.themeCommand = nil; |
|
3642 | 461 |
self.staticMapCommand = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
462 |
self.missionCommand = nil; |
3697 | 463 |
|
3547 | 464 |
self.tableView = nil; |
465 |
self.maxLabel = nil; |
|
466 |
self.segmentedControl = nil; |
|
467 |
self.slider = nil; |
|
3697 | 468 |
|
3547 | 469 |
self.lastIndexPath = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
470 |
self.dataSourceArray = nil; |
3697 | 471 |
|
3662
a44406f4369b
polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents:
3660
diff
changeset
|
472 |
MSG_DIDUNLOAD(); |
3547 | 473 |
[super viewDidUnload]; |
474 |
} |
|
475 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
476 |
-(void) didReceiveMemoryWarning { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
477 |
self.dataSourceArray = nil; |
4356 | 478 |
[super didReceiveMemoryWarning]; |
3984 | 479 |
|
4356 | 480 |
if (self.view.superview == nil) { |
6823 | 481 |
self.previewButton = nil; |
4356 | 482 |
self.tableView = nil; |
483 |
self.maxLabel = nil; |
|
484 |
self.slider = nil; |
|
485 |
} |
|
3971 | 486 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
487 |
MSG_MEMCLEAN(); |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
488 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
489 |
|
3547 | 490 |
-(void) dealloc { |
5208 | 491 |
releaseAndNil(seedCommand); |
492 |
releaseAndNil(templateFilterCommand); |
|
493 |
releaseAndNil(mapGenCommand); |
|
494 |
releaseAndNil(mazeSizeCommand); |
|
495 |
releaseAndNil(themeCommand); |
|
496 |
releaseAndNil(staticMapCommand); |
|
497 |
releaseAndNil(missionCommand); |
|
3697 | 498 |
|
5208 | 499 |
releaseAndNil(previewButton); |
500 |
releaseAndNil(tableView); |
|
501 |
releaseAndNil(maxLabel); |
|
502 |
releaseAndNil(segmentedControl); |
|
503 |
releaseAndNil(slider); |
|
3697 | 504 |
|
5208 | 505 |
releaseAndNil(lastIndexPath); |
506 |
releaseAndNil(dataSourceArray); |
|
3697 | 507 |
|
3547 | 508 |
[super dealloc]; |
509 |
} |
|
510 |
||
511 |
@end |