project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
author koda
Sat, 28 Aug 2010 00:30:29 +0200
changeset 3778 2e61bb50cc57
parent 3753 bb5a0252fb56
child 3781 2bfda544ae48
permissions -rw-r--r--
add a nice group of hogs in lobby page
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     1
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     2
//  SingleSchemeViewController.m
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     3
//  Hedgewars
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     4
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     5
//  Created by Vittorio on 23/05/10.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     7
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     8
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     9
#import "SingleSchemeViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    10
#import <QuartzCore/QuartzCore.h>
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    11
#import "CommodityFunctions.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    12
#import "UIImageExtra.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    13
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    14
#define LABEL_TAG  12345
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    15
#define SLIDER_TAG 54321
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    16
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    17
@implementation SingleSchemeViewController
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
    18
@synthesize schemeName, schemeArray, basicSettingList, gameModifierArray;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    19
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    20
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    22
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
#pragma mark View lifecycle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
-(void) viewDidLoad {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    27
    [super viewDidLoad];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    28
3753
bb5a0252fb56 small update for the about page
koda
parents: 3752
diff changeset
    29
    // title, description, image name (+btn)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    30
    NSArray *mods = [[NSArray alloc] initWithObjects:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    31
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Fort Mode",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
                      NSLocalizedString(@"Defend your fort and destroy the opponents (two team colours max)",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
                      @"Forts",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Divide Team",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
                      NSLocalizedString(@"Teams will start on opposite sides of the terrain (two team colours max)",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
                      @"TeamsDivide",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    37
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Solid Land",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    38
                      NSLocalizedString(@"Land can not be destroyed",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    39
                      @"Solid",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    40
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Add Border",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    41
                      NSLocalizedString(@"Add an indestructable border around the terrain",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    42
                      @"Border",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    43
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Low Gravity",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    44
                      NSLocalizedString(@"Lower gravity",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    45
                      @"LowGravity",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    46
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Laser Sight",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    47
                      NSLocalizedString(@"Assisted aiming with laser sight",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    48
                      @"LaserSight",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    49
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Invulnerable",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    50
                      NSLocalizedString(@"All hogs have a personal forcefield",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    51
                      @"Invulnerable",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    52
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Add Mines",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    53
                      NSLocalizedString(@"Enable random mines",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    54
                      @"Mines",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    55
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Vampirism Mode",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    56
                      NSLocalizedString(@"Gain 80% of the damage you do back in health",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    57
                      @"Vampiric",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    58
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Karma Mode",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    59
                      NSLocalizedString(@"Share your opponents pain, share their damage",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    60
                      @"Karma",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    61
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Artillery Mode",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    62
                      NSLocalizedString(@"Your hogs are unable to move, test your aim",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
                      @"Artillery",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    64
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Random Order",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    65
                      NSLocalizedString(@"Order of play is random instead of in room order",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    66
                      @"RandomOrder",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    67
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"King Mode",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    68
                      NSLocalizedString(@"Play with a King. If he dies, your side loses",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    69
                      @"King",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    70
                     [NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"Place Hedgehogs",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
                      NSLocalizedString(@"Take turns placing your hedgehogs pre-game",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
                      @"PlaceHog",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Clan Shares Ammo",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
                      NSLocalizedString(@"Ammo is shared between all clan teams",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    75
                      @"SharedAmmo",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    76
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Disable Girders",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    77
                      NSLocalizedString(@"Disable girders when generating random maps",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    78
                      @"DisableGirders",@"image",nil],
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    79
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Disable Land Objects",@""),@"title",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    80
                      NSLocalizedString(@"Disable land objects when generating maps",@""),@"description",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    81
                      @"DisableLandObjects",@"image",nil],
3752
73c2d7d5643b add the new flag, fix a couple of hicups in creating config files, swap animation between settings and lobby
koda
parents: 3697
diff changeset
    82
                     [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"AI Survival Mode",@""),@"title",
73c2d7d5643b add the new flag, fix a couple of hicups in creating config files, swap animation between settings and lobby
koda
parents: 3697
diff changeset
    83
                      NSLocalizedString(@"AI-controlled hogs respawn on death",@""),@"description",
73c2d7d5643b add the new flag, fix a couple of hicups in creating config files, swap animation between settings and lobby
koda
parents: 3697
diff changeset
    84
                      @"AISurvival",@"image",nil],
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
                     nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
    self.gameModifierArray = mods;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
    [mods release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    88
3753
bb5a0252fb56 small update for the about page
koda
parents: 3752
diff changeset
    89
    // title, image name (+icon), default value, max value, min value
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    90
    NSArray *basicSettings = [[NSArray alloc] initWithObjects:
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    91
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Damage Modifier",@""),@"title",@"Damage",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    92
                               [NSNumber numberWithInt:100],@"default",[NSNumber numberWithInt:10],@"min",[NSNumber numberWithInt:300],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    93
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Turn Time",@""),@"title",@"Time",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    94
                               [NSNumber numberWithInt:45],@"default",[NSNumber numberWithInt:1],@"min",[NSNumber numberWithInt:99],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    95
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Initial Health",@""),@"title",@"Health",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    96
                               [NSNumber numberWithInt:100],@"default",[NSNumber numberWithInt:50],@"min",[NSNumber numberWithInt:200],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    97
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Sudden Death Timeout",@""),@"title",@"SuddenDeath",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    98
                               [NSNumber numberWithInt:15],@"default",[NSNumber numberWithInt:0],@"min",[NSNumber numberWithInt:50],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    99
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Crate Drops",@""),@"title",@"Box",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   100
                               [NSNumber numberWithInt:5],@"default",[NSNumber numberWithInt:0],@"min",[NSNumber numberWithInt:9],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   101
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Mines Time",@""),@"title",@"Time",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   102
                               [NSNumber numberWithInt:3],@"default",[NSNumber numberWithInt:0],@"min",[NSNumber numberWithInt:3],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   103
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Mines Number",@""),@"title",@"Mine",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   104
                               [NSNumber numberWithInt:4],@"default",[NSNumber numberWithInt:1],@"min",[NSNumber numberWithInt:80],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   105
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Dud Mines Probability",@""),@"title",@"Dud",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   106
                               [NSNumber numberWithInt:0],@"default",[NSNumber numberWithInt:0],@"min",[NSNumber numberWithInt:100],@"max",nil],
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   107
                              [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Explosives",@""),@"title",@"Damage",@"image",
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   108
                               [NSNumber numberWithInt:2],@"default",[NSNumber numberWithInt:0],@"min",[NSNumber numberWithInt:40],@"max",nil],
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   109
                              nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   110
    self.basicSettingList = basicSettings;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   111
    [basicSettings release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   112
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   113
    self.title = NSLocalizedString(@"Edit scheme preferences",@"");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   114
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   115
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   116
// load from file
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   117
-(void) viewWillAppear:(BOOL) animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   118
    [super viewWillAppear:animated];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   119
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   120
    NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   121
    NSMutableArray *scheme = [[NSMutableArray alloc] initWithContentsOfFile:schemeFile];
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3574
diff changeset
   122
    [schemeFile release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   123
    self.schemeArray = scheme;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   124
    [scheme release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   125
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
    [self.tableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   128
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
// save to file
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   130
-(void) viewWillDisappear:(BOOL) animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   131
    [super viewWillDisappear:animated];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   132
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   133
    NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   134
    [self.schemeArray writeToFile:schemeFile atomically:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   135
    [schemeFile release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   136
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   137
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   138
#pragma mark -
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   139
#pragma mark editableCellView delegate
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   140
// set the new value
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   141
-(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   142
    // delete old file
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   143
    [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] error:NULL];
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   144
    // update filename
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   145
    self.schemeName = textString;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   146
    // save new file
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   147
    [self.schemeArray writeToFile:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] atomically:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   150
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   151
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   152
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   153
    return 3;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   154
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   155
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   156
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
    switch (section) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   158
        case 0:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
            return 1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   160
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
        case 1:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   162
            return [self.basicSettingList count];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   163
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   164
        case 2:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   165
            return [self.gameModifierArray count];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   166
        default:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   167
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   168
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   169
    return 0;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   170
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   171
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   172
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   173
    static NSString *CellIdentifier0 = @"Cell0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   174
    static NSString *CellIdentifier1 = @"Cell1";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   175
    static NSString *CellIdentifier2 = @"Cell2";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   176
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   177
    UITableViewCell *cell = nil;
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   178
    EditableCellView *editableCell = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   179
    NSInteger row = [indexPath row];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   180
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   181
    switch ([indexPath section]) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
        case 0:
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   183
            editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   184
            if (editableCell == nil) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   185
                editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   186
                                               reuseIdentifier:CellIdentifier0] autorelease];
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   187
                editableCell.delegate = self;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   188
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   189
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   190
            editableCell.textField.text = self.schemeName;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   191
            editableCell.detailTextLabel.text = nil;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   192
            editableCell.imageView.image = nil;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   193
            editableCell.selectionStyle = UITableViewCellSelectionStyleNone;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   194
            cell = editableCell;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   195
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
        case 1:
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   197
            cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   198
            NSDictionary *detail = [self.basicSettingList objectAtIndex:row];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   199
            // need to offset this section (see format in CommodityFunctions.m and above)
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   200
            NSInteger gmSize = [self.gameModifierArray count];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   201
            if (cell == nil) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   202
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   203
                                               reuseIdentifier:CellIdentifier1] autorelease];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   204
3643
858b20bafb6e reworked the ammunition configuration page (visually)
koda
parents: 3623
diff changeset
   205
                int offset = 0;
858b20bafb6e reworked the ammunition configuration page (visually)
koda
parents: 3623
diff changeset
   206
                if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   207
                    offset = 50;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   208
3643
858b20bafb6e reworked the ammunition configuration page (visually)
koda
parents: 3623
diff changeset
   209
                UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(offset+260, 12, offset+150, 23)];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   210
                slider.maximumValue = [[detail objectForKey:@"max"] floatValue];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   211
                slider.minimumValue = [[detail objectForKey:@"min"] floatValue];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   212
                slider.tag = row+gmSize;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   213
                [slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   214
                [cell.contentView addSubview:slider];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   215
                [slider release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   216
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   217
                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 7, 200, 30)];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   218
                label.tag = LABEL_TAG;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   219
                label.backgroundColor = [UIColor clearColor];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   220
                label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   221
                [cell.contentView addSubview:label];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   222
                [label release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   223
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   224
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   225
            UIImage *img = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/icon%@.png",BTN_DIRECTORY(),[[self.basicSettingList objectAtIndex:row] objectForKey:@"image"]]];
3623
f14db208f2fa graphics applied and fixes here and there
koda
parents: 3621
diff changeset
   226
            cell.imageView.image = img;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   227
            [img release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   228
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   229
            UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   230
            cellLabel.text = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   231
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   232
            UISlider *cellSlider = (UISlider *)[cell.contentView viewWithTag:row+gmSize];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   233
            cellSlider.value = [[self.schemeArray objectAtIndex:row+gmSize] floatValue];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   234
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   235
            // forced to use this weird format otherwise the label disappears when size of the text is bigger than the original
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   236
            NSString *prestring = [NSString stringWithFormat:@"%d",[[self.schemeArray objectAtIndex:row+gmSize] intValue]];
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   237
            while ([prestring length] <= 4)
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   238
                prestring = [NSString stringWithFormat:@" %@",prestring];
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   239
            cell.detailTextLabel.text = prestring;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   240
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   241
            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   242
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   243
        case 2:
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   244
            cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier2];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   245
            if (cell == nil) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   246
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   247
                                               reuseIdentifier:CellIdentifier2] autorelease];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   248
                UISwitch *onOff = [[UISwitch alloc] init];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   249
                onOff.tag = row;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   250
                [onOff addTarget:self action:@selector(toggleSwitch:) forControlEvents:UIControlEventValueChanged];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   251
                cell.accessoryView = onOff;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   252
                [onOff release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   253
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   254
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   255
            UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/btn%@.png",BTN_DIRECTORY(),[[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   256
            cell.imageView.image = image;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   257
            [image release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   258
            [cell.imageView.layer setCornerRadius:7.0f];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   259
            [cell.imageView.layer setBorderWidth:1];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   260
            [cell.imageView.layer setMasksToBounds:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   261
            cell.textLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   262
            cell.detailTextLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"description"];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   263
            [(UISwitch *)cell.accessoryView setOn:[[self.schemeArray objectAtIndex:row] boolValue] animated:NO];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   264
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   265
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   266
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   267
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   268
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   269
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   270
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   271
-(void) toggleSwitch:(id) sender {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   272
    UISwitch *theSwitch = (UISwitch *)sender;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   273
    [self.schemeArray replaceObjectAtIndex:theSwitch.tag withObject:[NSNumber numberWithBool:theSwitch.on]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   274
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   275
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   276
-(void) sliderChanged:(id) sender {
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   277
    // need to offset this section (see format in CommodityFunctions.m and above)
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   278
    NSInteger gmSize = [self.gameModifierArray count];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   279
    // the slider that changed is sent as object
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   280
    UISlider *theSlider = (UISlider *)sender;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   281
    // create the indexPath of the row of the slider
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   282
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:theSlider.tag-gmSize inSection:1];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   283
    // get its cell
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   284
    UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   285
    // grab the associated label
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   286
    UILabel *label = (UILabel *)cell.detailTextLabel;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   287
    // modify it
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   288
    label.text = [NSString stringWithFormat:@"%d",(int)theSlider.value];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   289
    // save changes in the main array (remember that you need to offset it)
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   290
    [self.schemeArray replaceObjectAtIndex:theSlider.tag withObject:[NSNumber numberWithInt:(int)theSlider.value]];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   291
}
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   292
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   293
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   294
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   295
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   296
    UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath];
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   297
    EditableCellView *editableCell = nil;
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   298
    UISlider *cellSlider = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   299
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   300
    switch ([indexPath section]) {
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   301
        case 0:
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   302
            editableCell = (EditableCellView *)cell;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   303
            [editableCell replyKeyboard];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   304
            break;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   305
        case 1:
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   306
            cellSlider = (UISlider *)[cell.contentView viewWithTag:[indexPath row]+[self.gameModifierArray count]];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   307
            [cellSlider setValue:[[[self.basicSettingList objectAtIndex:[indexPath row]] objectForKey:@"default"] floatValue] animated:YES];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   308
            [self sliderChanged:cellSlider];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   309
            //cell.detailTextLabel.text = [[[self.basicSettingList objectAtIndex:[indexPath row]] objectForKey:@"default"] stringValue];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   310
            break;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   311
        case 2:
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   312
            /*sw = (UISwitch *)cell.accessoryView;
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   313
            [sw setOn:!sw.on animated:YES];
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   314
            [self toggleSwitch:sw];*/
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   315
            break;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   316
        default:
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   317
            break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   318
    }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   319
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   320
    [aTableView deselectRowAtIndexPath:indexPath animated:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   321
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   322
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   323
-(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   324
    NSString *sectionTitle = nil;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   325
    switch (section) {
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   326
        case 0:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   327
            sectionTitle = NSLocalizedString(@"Scheme Name", @"");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   328
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   329
        case 1:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   330
            sectionTitle = NSLocalizedString(@"Game Settings", @"");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   331
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   332
        case 2:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   333
            sectionTitle = NSLocalizedString(@"Game Modifiers", @"");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   334
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   335
        default:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   336
            DLog(@"nope");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   337
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   338
    }
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   339
    return sectionTitle;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   340
}
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   341
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   342
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   343
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   344
-(void) didReceiveMemoryWarning {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   345
    [super didReceiveMemoryWarning];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   346
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   347
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   348
-(void) viewDidUnload {
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   349
    self.schemeName = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   350
    self.schemeArray = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   351
    self.basicSettingList = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   352
    self.gameModifierArray = nil;
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
   353
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   354
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   355
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   356
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   357
-(void) dealloc {
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   358
    [schemeName release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   359
    [schemeArray release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   360
    [basicSettingList release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   361
    [gameModifierArray release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   362
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   363
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   364
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   365
@end