-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.m
143 lines (110 loc) · 4.46 KB
/
Menu.m
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//
// Menu.m
// YouSpell
//
// Created by Francisco F Neto on 18/09/14.
// Copyright (c) 2014 giovannibf. All rights reserved.
//
#import "Menu.h"
#import "AppConstants.h"
@interface Menu ()
@end
@implementation Menu
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
//[Chartboost showInterstitial:CBLocationMainMenu];
/*if([ALInterstitialAd isReadyForDisplay]){
NSLog(@"appLovinReady");
[ALInterstitialAd show];
}else NSLog(@"appLovingNotReady");*/
[coinsPocket setFont:[UIFont fontWithName:@"Delicious-Roman" size:18]];
[playBtn.titleLabel setFont:[UIFont fontWithName:@"Delicious-Roman" size:25]];
[storeBtn.titleLabel setFont:[UIFont fontWithName:@"Delicious-Roman" size:25]];
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"back72.png"]]];
// setando a variável de streak atual para 0, pois não estamos em jogo...
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:0] forKey:@"currentStreak"];
NSMutableArray *themesArray = [[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"words" ofType:@"plist"]] mutableCopy];
if([[NSUserDefaults standardUserDefaults] objectForKey:@"Streaks"] == nil)
{
NSMutableArray *streakArray = [NSMutableArray array];
for(int y = 0 ; y < 3 ; y++)
{
[streakArray addObject:[NSMutableArray array]];
for(int u = 0 ; u < themesArray.count; u++)
{
[streakArray[y] addObject:[NSNumber numberWithInt: 0]];
}
}
[[NSUserDefaults standardUserDefaults] setObject:[streakArray mutableCopy] forKey:@"Streaks"];
}
if([[NSUserDefaults standardUserDefaults] objectForKey:@"Scores"] == nil)
{
NSMutableArray *scoreArray = [NSMutableArray array];
for (NSInteger j = 0; j < 3; j++)
{
//NSLog(@"level: %i",j);
[scoreArray addObject:[NSMutableArray array]];
for(NSInteger i = 0 ; i < themesArray.count ; i++)
{
//NSLog(@"tema: %i",i);
[scoreArray[j] addObject: [NSMutableArray array]];
for (NSInteger k = 0; k < [themesArray[i] count]; k++)
{
//NSLog(@"palavra: %i",k);
[scoreArray[j][i] addObject:[NSNumber numberWithBool:NO]];
}
}
}
[[NSUserDefaults standardUserDefaults] setObject:[scoreArray mutableCopy] forKey:@"Scores"];
}
if([[NSUserDefaults standardUserDefaults] objectForKey:THEMESSTATUS] == nil)
{
NSMutableArray *array = [NSMutableArray array];
for (int j = 0; j < 9 ; j++)
{
[array addObject:[NSNumber numberWithBool:YES]];
}
for (int n = 9; n < 20 ; n++)
{
[array addObject:[NSNumber numberWithBool:NO]];
}
[[NSUserDefaults standardUserDefaults] setObject:array forKey:THEMESSTATUS];
}
NSInteger superCoins = [[NSUserDefaults standardUserDefaults] integerForKey: COINS];
[coinsPocket setText: [NSString stringWithFormat: @"%i", (int)superCoins]];
NSLog(@"coins: %i", (int)superCoins);
[[NSUserDefaults standardUserDefaults] synchronize];
//[self showInMobiBanner];
}
-(void)dealloc {
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"EasyClicked"])
{
NSLog(@"easy");
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"LevelSelected"];
}
else if([segue.identifier isEqualToString:@"MediumClicked"])
{
NSLog(@"medium");
[[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"LevelSelected"];
}
else if([segue.identifier isEqualToString:@"HardClicked"])
{
NSLog(@"hard");
[[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"LevelSelected"];
}
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
@end