author | antonc27 <antonc27@mail.ru> |
Fri, 06 Nov 2015 00:33:41 +0100 | |
branch | ios-revival |
changeset 11310 | 9671c2bfce41 |
parent 11226 | 628ac6f8a41e |
child 11554 | 73e6a3d2f768 |
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 |
48 |
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); |
|
49 |
NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); |
|
50 |
CFRelease(uuid); |
|
51 |
NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; |
|
52 |
self.seedCommand = seedCmd; |
|
53 |
[seedCmd release]; |
|
3697 | 54 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
55 |
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
|
56 |
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
|
57 |
// 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
|
58 |
[self turnOffWidgets]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
59 |
[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
|
60 |
// the preview for static maps is loaded in didSelectRowAtIndexPath |
3547 | 61 |
} |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
62 |
[seed release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
63 |
|
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
64 |
// perform as if user clicked on an entry |
11206
2e80c9861818
- Better random number generation for front-end: random() replaced with arc4random_uniform()
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
65 |
NSIndexPath *theIndex = [NSIndexPath indexPathForRow:arc4random_uniform((int)[source count]) inSection:0]; |
3547 | 66 |
[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
|
67 |
if (IS_NOT_POWERFUL([HWUtils modelType]) == NO) |
4287 | 68 |
[self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; |
3547 | 69 |
} |
70 |
||
71 |
-(void) turnOffWidgets { |
|
72 |
busy = YES; |
|
73 |
self.previewButton.alpha = 0.5f; |
|
74 |
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
|
75 |
self.maxLabel.text = NSLocalizedString(@"Loading...",@"");; |
3547 | 76 |
self.segmentedControl.enabled = NO; |
77 |
self.slider.enabled = NO; |
|
78 |
} |
|
79 |
||
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
|
80 |
#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
|
81 |
#pragma mark MapPreviewButtonView delegate methods |
3547 | 82 |
-(void) turnOnWidgets { |
83 |
self.previewButton.alpha = 1.0f; |
|
84 |
self.previewButton.enabled = YES; |
|
85 |
self.segmentedControl.enabled = YES; |
|
86 |
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
|
87 |
self.busy = NO; |
3547 | 88 |
} |
3697 | 89 |
|
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 |
-(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
|
91 |
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
|
92 |
self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str]; |
3547 | 93 |
} |
94 |
||
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
95 |
-(NSDictionary *)getDataForEngine { |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
96 |
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
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
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
|
101 |
nil]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
102 |
return dictForEngine; |
3547 | 103 |
} |
104 |
||
105 |
#pragma mark - |
|
106 |
#pragma mark Table view data source |
|
107 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
108 |
return 1; |
|
109 |
} |
|
110 |
||
111 |
-(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
|
112 |
return [[self.dataSourceArray objectAtIndex:scIndex] count]; |
3547 | 113 |
} |
114 |
||
115 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
116 |
static NSString *CellIdentifier = @"Cell"; |
|
6908
896ed2afcfb8
ios: turn on more warning messages and start correcting them
koda
parents:
6869
diff
changeset
|
117 |
NSUInteger row = [indexPath row]; |
3697 | 118 |
|
3547 | 119 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
3697 | 120 |
if (cell == nil) |
3547 | 121 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
3697 | 122 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
123 |
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
|
124 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
125 |
NSString *labelString = [source objectAtIndex:row]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
126 |
cell.textLabel.text = labelString; |
3996 | 127 |
cell.textLabel.adjustsFontSizeToFitWidth = YES; |
128 |
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
|
129 |
cell.textLabel.textColor = [UIColor lightYellowColor]; |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
4362
diff
changeset
|
130 |
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
|
131 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
132 |
if (isRandomness()) { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
133 |
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]]; |
3547 | 134 |
cell.imageView.image = image; |
135 |
[image release]; |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
136 |
} else |
3547 | 137 |
cell.imageView.image = nil; |
3697 | 138 |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
139 |
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
|
140 |
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
|
141 |
cell.accessoryView = checkbox; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
142 |
[checkbox release]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
143 |
} else |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
144 |
cell.accessoryView = nil; |
3547 | 145 |
|
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
|
146 |
cell.backgroundColor = [UIColor blackColorTransparent]; |
3547 | 147 |
return cell; |
148 |
} |
|
149 |
||
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
150 |
// 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
|
151 |
-(void) setDetailsForStaticMap:(NSInteger) index { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
152 |
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
8441 | 153 |
|
154 |
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
|
155 |
(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
|
156 |
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
|
157 |
[fileCfg release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
158 |
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
|
159 |
[contents release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
160 |
|
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
161 |
// 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
|
162 |
// 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
|
163 |
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
|
164 |
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
|
165 |
max = [split objectAtIndex:1]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
166 |
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
|
167 |
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
|
168 |
[self setMaxLabelText:max]; |
8441 | 169 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
170 |
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
|
171 |
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
|
172 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
173 |
if (scIndex != 3) |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
174 |
self.missionCommand = @""; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
175 |
else |
3920
a54ca6185307
updated lua loading in the ifrontend and also fixed masked maps
koda
parents:
3912
diff
changeset
|
176 |
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
|
177 |
} |
3547 | 178 |
|
179 |
#pragma mark - |
|
180 |
#pragma mark Table view delegate |
|
181 |
-(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
|
182 |
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
|
183 |
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
3697 | 184 |
|
3547 | 185 |
if (newRow != oldRow) { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
186 |
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
|
187 |
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
|
188 |
// 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
|
189 |
self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]]; |
3642 | 190 |
} else { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
191 |
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
|
192 |
(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
|
193 |
[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
|
194 |
[self setDetailsForStaticMap:newRow]; |
3642 | 195 |
} |
3697 | 196 |
|
197 |
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
|
198 |
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
|
199 |
newCell.accessoryView = checkbox; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
200 |
[checkbox release]; |
3547 | 201 |
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
|
202 |
oldCell.accessoryView = nil; |
3547 | 203 |
|
204 |
self.lastIndexPath = indexPath; |
|
205 |
[aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; |
|
206 |
} |
|
207 |
[aTableView deselectRowAtIndexPath:indexPath animated:YES]; |
|
208 |
} |
|
209 |
||
210 |
#pragma mark - |
|
4082 | 211 |
#pragma mark slider & segmentedControl & button |
3547 | 212 |
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl |
213 |
// no methods are called by this routine and you can pass nil to it |
|
214 |
-(IBAction) sliderChanged:(id) sender { |
|
215 |
NSString *labelText; |
|
216 |
NSString *templateCommand; |
|
217 |
NSString *mazeCommand; |
|
3697 | 218 |
|
3547 | 219 |
switch ((int)(self.slider.value*100)) { |
220 |
case 0: |
|
221 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
222 |
labelText = NSLocalizedString(@"Wacky",@""); |
|
223 |
} else { |
|
224 |
labelText = NSLocalizedString(@"Large Floating Islands",@""); |
|
225 |
} |
|
226 |
templateCommand = @"e$template_filter 5"; |
|
227 |
mazeCommand = @"e$maze_size 5"; |
|
228 |
break; |
|
229 |
case 1: |
|
230 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
231 |
labelText = NSLocalizedString(@"Cavern",@""); |
|
232 |
} else { |
|
233 |
labelText = NSLocalizedString(@"Medium Floating Islands",@""); |
|
234 |
} |
|
235 |
templateCommand = @"e$template_filter 4"; |
|
236 |
mazeCommand = @"e$maze_size 4"; |
|
237 |
break; |
|
238 |
case 2: |
|
239 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
6669 | 240 |
labelText = NSLocalizedString(@"Large",@""); |
3547 | 241 |
} else { |
242 |
labelText = NSLocalizedString(@"Small Floating Islands",@""); |
|
243 |
} |
|
244 |
templateCommand = @"e$template_filter 1"; |
|
245 |
mazeCommand = @"e$maze_size 3"; |
|
246 |
break; |
|
247 |
case 3: |
|
248 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
249 |
labelText = NSLocalizedString(@"Medium",@""); |
|
250 |
} else { |
|
251 |
labelText = NSLocalizedString(@"Large Tunnels",@""); |
|
252 |
} |
|
253 |
templateCommand = @"e$template_filter 2"; |
|
254 |
mazeCommand = @"e$maze_size 2"; |
|
255 |
break; |
|
256 |
case 4: |
|
257 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
6669 | 258 |
labelText = NSLocalizedString(@"Small",@""); |
3547 | 259 |
} else { |
260 |
labelText = NSLocalizedString(@"Medium Tunnels",@""); |
|
261 |
} |
|
262 |
templateCommand = @"e$template_filter 3"; |
|
263 |
mazeCommand = @"e$maze_size 1"; |
|
264 |
break; |
|
265 |
case 5: |
|
266 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
267 |
labelText = NSLocalizedString(@"All",@""); |
|
268 |
} else { |
|
269 |
labelText = NSLocalizedString(@"Small Tunnels",@""); |
|
270 |
} |
|
271 |
templateCommand = @"e$template_filter 0"; |
|
272 |
mazeCommand = @"e$maze_size 0"; |
|
273 |
break; |
|
274 |
default: |
|
275 |
labelText = nil; |
|
276 |
templateCommand = nil; |
|
277 |
mazeCommand = nil; |
|
278 |
break; |
|
279 |
} |
|
3697 | 280 |
|
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
|
281 |
self.slider.textValue = labelText; |
3547 | 282 |
self.templateFilterCommand = templateCommand; |
283 |
self.mazeSizeCommand = mazeCommand; |
|
284 |
} |
|
285 |
||
286 |
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up |
|
287 |
-(IBAction) sliderEndedChanging:(id) sender { |
|
288 |
int num = (int) (self.slider.value * 100); |
|
289 |
if (oldValue != num) { |
|
290 |
[self updatePreview]; |
|
291 |
oldValue = num; |
|
292 |
} |
|
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
293 |
[[AudioManagerController mainManager] playClickSound]; |
3547 | 294 |
} |
295 |
||
3697 | 296 |
// perform actions based on the activated section, then call updatePreview to visually update the selection |
3547 | 297 |
// and if necessary update the table with a slide animation |
298 |
-(IBAction) segmentedControlChanged:(id) sender { |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
299 |
NSString *mapgen, *staticmap, *mission; |
3547 | 300 |
NSInteger newPage = self.segmentedControl.selectedSegmentIndex; |
3697 | 301 |
|
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
302 |
[[AudioManagerController mainManager] playSelectSound]; |
3547 | 303 |
switch (newPage) { |
304 |
case 0: // Random |
|
305 |
mapgen = @"e$mapgen 0"; |
|
3642 | 306 |
staticmap = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
307 |
mission = @""; |
3547 | 308 |
[self sliderChanged:nil]; |
309 |
self.slider.enabled = YES; |
|
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
310 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"fillsections" object:nil]; |
3547 | 311 |
break; |
3697 | 312 |
|
3547 | 313 |
case 1: // Map |
314 |
mapgen = @"e$mapgen 0"; |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
315 |
// dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap |
3642 | 316 |
staticmap = @"map Bamboo"; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
317 |
mission = @""; |
3547 | 318 |
self.slider.enabled = NO; |
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
319 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"fillsections" object:nil]; |
3547 | 320 |
break; |
3697 | 321 |
|
3547 | 322 |
case 2: // Maze |
323 |
mapgen = @"e$mapgen 1"; |
|
3642 | 324 |
staticmap = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
325 |
mission = @""; |
3547 | 326 |
[self sliderChanged:nil]; |
327 |
self.slider.enabled = YES; |
|
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
328 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"fillsections" object:nil]; |
4349 | 329 |
break; |
330 |
||
331 |
case 3: // Mission |
|
332 |
mapgen = @"e$mapgen 0"; |
|
333 |
// dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap |
|
334 |
staticmap = @"map Bamboo"; |
|
335 |
mission = @""; |
|
336 |
self.slider.enabled = NO; |
|
6829
60b039d88dab
ios: use notifications instead of class methods (maybe tidier)
koda
parents:
6823
diff
changeset
|
337 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"emptysections" object:nil]; |
3547 | 338 |
break; |
3697 | 339 |
|
3547 | 340 |
default: |
341 |
mapgen = nil; |
|
3642 | 342 |
staticmap = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
343 |
mission = nil; |
3547 | 344 |
break; |
345 |
} |
|
346 |
self.mapGenCommand = mapgen; |
|
3642 | 347 |
self.staticMapCommand = staticmap; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
348 |
self.missionCommand = mission; |
3697 | 349 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
350 |
[self.tableView reloadData]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
351 |
[self updatePreview]; |
3547 | 352 |
oldPage = newPage; |
353 |
} |
|
354 |
||
11226
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
355 |
- (void)localizeSegmentedControl |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
356 |
{ |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
357 |
for (NSUInteger i = 0; i < self.segmentedControl.numberOfSegments; i++) |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
358 |
{ |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
359 |
NSString *oldTitle = [self.segmentedControl titleForSegmentAtIndex:i]; |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
360 |
[self.segmentedControl setTitle:NSLocalizedString(oldTitle, nil) forSegmentAtIndex:i]; |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
361 |
} |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
362 |
} |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
363 |
|
4082 | 364 |
#pragma mark - |
365 |
#pragma mark view management |
|
6107 | 366 |
-(NSArray *) dataSourceArray { |
367 |
if (dataSourceArray == nil) { |
|
368 |
NSString *model = [HWUtils modelType]; |
|
8441 | 369 |
|
6107 | 370 |
// only folders containing icon.png are a valid theme |
371 |
NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; |
|
372 |
NSMutableArray *themeArray = [[NSMutableArray alloc] init]; |
|
373 |
for (NSString *themeName in themeArrayFull) { |
|
374 |
NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; |
|
375 |
if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) |
|
376 |
[themeArray addObject:themeName]; |
|
377 |
[checkPath release]; |
|
378 |
} |
|
8441 | 379 |
|
6107 | 380 |
// remove images that are too big for certain devices without loading the whole image |
381 |
NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
|
382 |
NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
|
383 |
for (NSString *str in mapArrayFull) { |
|
384 |
CGSize imgSize = [UIImage imageSizeFromMetadataOf:[MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]]; |
|
385 |
if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
|
386 |
continue; |
|
387 |
if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
|
388 |
continue; |
|
389 |
[mapArray addObject:str]; |
|
390 |
} |
|
8441 | 391 |
|
6107 | 392 |
NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
393 |
NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
|
394 |
for (NSString *str in missionArrayFull) { |
|
395 |
CGSize imgSize = [UIImage imageSizeFromMetadataOf:[MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]]; |
|
396 |
if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
|
397 |
continue; |
|
398 |
if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
|
399 |
continue; |
|
400 |
[missionArray addObject:str]; |
|
401 |
} |
|
402 |
NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
|
403 |
[missionArray release]; |
|
404 |
[themeArray release]; |
|
405 |
[mapArray release]; |
|
8441 | 406 |
|
6107 | 407 |
self.dataSourceArray = array; |
408 |
[array release]; |
|
5281 | 409 |
} |
6107 | 410 |
return dataSourceArray; |
3547 | 411 |
} |
412 |
||
413 |
-(void) viewDidLoad { |
|
414 |
[super viewDidLoad]; |
|
11226
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
415 |
|
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
416 |
[self localizeSegmentedControl]; |
628ac6f8a41e
- SegmentedControl is localizable now in MapConfig
antonc27 <antonc27@mail.ru>
parents:
11206
diff
changeset
|
417 |
|
3547 | 418 |
// initialize some "default" values |
419 |
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
|
420 |
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
|
421 |
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
|
422 |
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
|
423 |
self.oldPage = self.segmentedControl.selectedSegmentIndex; |
3547 | 424 |
|
425 |
self.templateFilterCommand = @"e$template_filter 0"; |
|
426 |
self.mazeSizeCommand = @"e$maze_size 0"; |
|
427 |
self.mapGenCommand = @"e$mapgen 0"; |
|
3642 | 428 |
self.staticMapCommand = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
429 |
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
|
430 |
|
6108 | 431 |
if (IS_IPAD()) { |
432 |
[self.tableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; |
|
433 |
self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; |
|
434 |
self.tableView.layer.borderWidth = 2.7f; |
|
435 |
self.tableView.layer.cornerRadius = 8; |
|
436 |
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
|
437 |
|
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 |
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
|
439 |
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
|
440 |
[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
|
441 |
[backLabel release]; |
6108 | 442 |
} |
443 |
self.tableView.separatorColor = [UIColor whiteColor]; |
|
4244 | 444 |
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
3547 | 445 |
} |
446 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
447 |
-(void) viewWillAppear:(BOOL)animated { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
448 |
[super viewWillAppear:animated]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
449 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
450 |
|
3547 | 451 |
-(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
|
452 |
[self updatePreview]; |
3547 | 453 |
[super viewDidAppear:animated]; |
454 |
} |
|
455 |
||
456 |
-(void) viewDidUnload { |
|
457 |
self.previewButton = nil; |
|
458 |
self.seedCommand = nil; |
|
459 |
self.templateFilterCommand = nil; |
|
460 |
self.mapGenCommand = nil; |
|
461 |
self.mazeSizeCommand = nil; |
|
462 |
self.themeCommand = nil; |
|
3642 | 463 |
self.staticMapCommand = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
464 |
self.missionCommand = nil; |
3697 | 465 |
|
3547 | 466 |
self.tableView = nil; |
467 |
self.maxLabel = nil; |
|
468 |
self.segmentedControl = nil; |
|
469 |
self.slider = nil; |
|
3697 | 470 |
|
3547 | 471 |
self.lastIndexPath = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
472 |
self.dataSourceArray = nil; |
3697 | 473 |
|
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
|
474 |
MSG_DIDUNLOAD(); |
3547 | 475 |
[super viewDidUnload]; |
476 |
} |
|
477 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
478 |
-(void) didReceiveMemoryWarning { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
479 |
self.dataSourceArray = nil; |
4356 | 480 |
[super didReceiveMemoryWarning]; |
3984 | 481 |
|
4356 | 482 |
if (self.view.superview == nil) { |
6823 | 483 |
self.previewButton = nil; |
4356 | 484 |
self.tableView = nil; |
485 |
self.maxLabel = nil; |
|
486 |
self.slider = nil; |
|
487 |
} |
|
3971 | 488 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
489 |
MSG_MEMCLEAN(); |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
490 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
491 |
|
3547 | 492 |
-(void) dealloc { |
5208 | 493 |
releaseAndNil(seedCommand); |
494 |
releaseAndNil(templateFilterCommand); |
|
495 |
releaseAndNil(mapGenCommand); |
|
496 |
releaseAndNil(mazeSizeCommand); |
|
497 |
releaseAndNil(themeCommand); |
|
498 |
releaseAndNil(staticMapCommand); |
|
499 |
releaseAndNil(missionCommand); |
|
3697 | 500 |
|
5208 | 501 |
releaseAndNil(previewButton); |
502 |
releaseAndNil(tableView); |
|
503 |
releaseAndNil(maxLabel); |
|
504 |
releaseAndNil(segmentedControl); |
|
505 |
releaseAndNil(slider); |
|
3697 | 506 |
|
5208 | 507 |
releaseAndNil(lastIndexPath); |
508 |
releaseAndNil(dataSourceArray); |
|
3697 | 509 |
|
3547 | 510 |
[super dealloc]; |
511 |
} |
|
512 |
||
513 |
@end |