-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEndOfGameViewController.m
executable file
·75 lines (59 loc) · 2.23 KB
/
EndOfGameViewController.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
/*
Dark Nova © Copyright 2009 Dead Jim Studios
This file is part of Dark Nova.
Dark Nova is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Dark Nova is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Dark Nova. If not, see <http://www.gnu.org/licenses/>
*/
#import "EndOfGameViewController.h"
#import "S1AppDelegate.h"
#import "StartGameViewController.h"
#import "HighScoresViewController.h"
@implementation EndOfGameViewController
-(void)showShipDestroyedImage {
self.view = shipDestroyedView;
S1AppDelegate * app = (S1AppDelegate *)[[UIApplication sharedApplication] delegate];
if (app.gamePlayer.escapePod)
self.view = shipDestroyedWithPodView;
[app.gamePlayer playSound:eYouLose];
[app.gamePlayer eraseAutoSave];
}
-(void)showPoorEndGameImage {
self.view = shipPoorEndGameView;
S1AppDelegate * app = (S1AppDelegate *)[[UIApplication sharedApplication] delegate];
[app.gamePlayer playSound:eYouRetirePoorly];
[app.gamePlayer eraseAutoSave];
}
-(void)showHappyEndImage {
self.view = shipHappyEndView;
S1AppDelegate * app = (S1AppDelegate *)[[UIApplication sharedApplication] delegate];
[app.gamePlayer playSound:eYouRetirelavishly];
[app.gamePlayer eraseAutoSave];
}
-(IBAction) startNewGame {
[self.view removeFromSuperview];
S1AppDelegate * app = (S1AppDelegate *)[[UIApplication sharedApplication] delegate];
int status;
if (self.view == shipDestroyedView)
status = 0;
else
if (self.view == shipPoorEndGameView)
status = 1;
else
status = 2;
bool highScore = [app.gamePlayer EndOfGame:status];
[app showStartGame];
if (highScore) {
UIViewController* highScores = [[HighScoresViewController alloc] initWithNibName:@"highScores" bundle:nil];;
[app.navigationController pushViewController:highScores animated:TRUE];
[highScores release];
}
}
@end