blob: d7cd21ea5e9e45f1167fc4e4cce54466fd64c49c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
//
// GameModeManager.m
// Cartographic
//
// Created by Starla Insigna on 11/29/11.
// Copyright (c) 2011 Four Island. All rights reserved.
//
#import "GameModeManager.h"
#import "GameModeInfo.h"
#import "TutorialMode.h"
#import "ClassicGameMode.h"
#import "JumpGameMode.h"
@implementation GameModeManager
@synthesize gameModes;
static GameModeManager* sharedInstance = nil;
+ (GameModeManager*)sharedInstance
{
if (sharedInstance == nil)
{
sharedInstance = [[GameModeManager alloc] init];
}
return sharedInstance;
}
- (id)init
{
self = [super init];
if (nil != self)
{
gameModes = [[NSArray alloc] initWithObjects:
[TutorialMode info],
[ClassicGameMode info],
[JumpGameMode info],
nil];
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
stars = [defaults integerForKey:@"stars"];
}
return self;
}
- (void)setStars:(int)m_stars
{
if (stars != m_stars)
{
stars = m_stars;
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger:m_stars forKey:@"stars"];
// Here, unlock game modes that have reached enough stars
}
}
- (int)stars
{
return stars;
}
@end
|