reverted accidental change to modrules.xml
added missing appdelegate chagnes for previous changes.(iOS only) removed system copy of bundled Res folder with app deployment (iOS only)
This commit is contained in:
@@ -89,19 +89,10 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
string userPath = _userPath;
|
||||
|
||||
#ifdef IOS
|
||||
//copy the RES folder over to the Documents folder
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSError *error;
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,
|
||||
NSUserDomainMask, YES);
|
||||
NSString *documentsDirectory = [[paths objectAtIndex:0] stringByAppendingString: @"/Res"];
|
||||
|
||||
NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath]
|
||||
stringByAppendingPathComponent:@"Res"];
|
||||
// copy the Res folder over to the Documents directory if it doesn't exist.
|
||||
if ( ![fileManager fileExistsAtPath: documentsDirectory])
|
||||
[fileManager copyItemAtPath:resourceDBFolderPath toPath:documentsDirectory error:&error];
|
||||
|
||||
userPath = [documentsDirectory cStringUsingEncoding:1];
|
||||
userPath += "/";
|
||||
systemPath = "";
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "Reachability.h"
|
||||
#import "WagicDownloadProgressViewController.h"
|
||||
@class EAGLViewController;
|
||||
|
||||
@interface wagicAppDelegate : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
EAGLViewController *glViewController;
|
||||
//Reachability variables
|
||||
Reachability* hostReach;
|
||||
Reachability* internetReach;
|
||||
Reachability* wifiReach;
|
||||
|
||||
}
|
||||
- (void) rotateBackgroundImage:(UIInterfaceOrientation)fromInterfaceOrientation toInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
|
||||
|
||||
- (void) handleWEngineCommand:(NSString *) command;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIWindow *window;
|
||||
@property (nonatomic, retain) EAGLViewController *glViewController;
|
||||
@property (nonatomic, retain) WagicDownloadProgressViewController *wagicDownloadController;
|
||||
@property (nonatomic, retain) Reachability *hostReach, *internetReach, *wifiReach;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,52 +1,120 @@
|
||||
#import "wagicAppDelegate.h"
|
||||
#import "EAGLView.h"
|
||||
#import "EAGLViewController.h"
|
||||
|
||||
#import "ASIHTTPRequest.h"
|
||||
#import "ZipArchive.h"
|
||||
|
||||
@implementation wagicAppDelegate
|
||||
|
||||
@synthesize window;
|
||||
@synthesize glViewController;
|
||||
@synthesize wagicDownloadController;
|
||||
@synthesize hostReach, wifiReach, internetReach;
|
||||
|
||||
|
||||
- (void) downloadResources
|
||||
{
|
||||
wagicDownloadController = [[WagicDownloadProgressViewController alloc] init];
|
||||
|
||||
[self.window addSubview: wagicDownloadController.view];
|
||||
[self.window makeKeyWindow];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) hasResourceFiles
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,
|
||||
NSUserDomainMask, YES);
|
||||
NSString *userResourceDirectory = [[paths objectAtIndex:0] stringByAppendingString: @"/Res"];
|
||||
|
||||
if (![fileManager fileExistsAtPath: userResourceDirectory] )
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (void) startGame
|
||||
{
|
||||
glViewController = [[EAGLViewController alloc] init];
|
||||
[self.wagicDownloadController release];
|
||||
[self.window addSubview:self.glViewController.view];
|
||||
|
||||
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
||||
[dnc removeObserver: self name: @"readyToStartGame" object: nil];
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[window release];
|
||||
[glViewController release];
|
||||
[hostReach release];
|
||||
[wifiReach release];
|
||||
[internetReach release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (void) applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
glViewController = [[EAGLViewController alloc] init];
|
||||
self.glViewController = nil;
|
||||
|
||||
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
||||
[dnc addObserver:self selector:@selector(startGame) name:@"readyToStartGame" object: nil];
|
||||
|
||||
// check to see if the Res folder exists. If it does continue
|
||||
// otherwise bring up the download dialog and download the core files
|
||||
// once downloaded, extract the files and kick off the game.
|
||||
BOOL requiresResourceUpdate = [self hasResourceFiles];
|
||||
if (!requiresResourceUpdate)
|
||||
{
|
||||
[self downloadResources];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self startGame];
|
||||
}
|
||||
|
||||
[self.window addSubview:self.glViewController.view];
|
||||
[self.window makeKeyAndVisible];
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application
|
||||
{
|
||||
EAGLView *eaglView = (EAGLView *)self.glViewController.view;
|
||||
[eaglView stopAnimation];
|
||||
if ( [self.glViewController.view respondsToSelector: @selector(stopAnimation)])
|
||||
[self.glViewController.view stopAnimation];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
{
|
||||
EAGLView *eaglView = (EAGLView *)self.glViewController.view;
|
||||
[eaglView startAnimation];
|
||||
if ( [self.glViewController.view respondsToSelector: @selector(stopAnimation)])
|
||||
[self.glViewController.view startAnimation];
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||
{
|
||||
EAGLView *eaglView = (EAGLView *)self.glViewController.view;
|
||||
[eaglView startAnimation];
|
||||
if ( [self.glViewController.view respondsToSelector: @selector(stopAnimation)])
|
||||
[self.glViewController.view startAnimation];
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||
{
|
||||
EAGLView *eaglView = (EAGLView *)self.glViewController.view;
|
||||
[eaglView stopAnimation];
|
||||
if ( [self.glViewController.view respondsToSelector: @selector(stopAnimation)])
|
||||
[self.glViewController.view stopAnimation];
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application
|
||||
{
|
||||
EAGLView *eaglView = (EAGLView *)self.glViewController.view;
|
||||
[eaglView stopAnimation];
|
||||
if ( [self.glViewController.view respondsToSelector: @selector(stopAnimation)])
|
||||
[self.glViewController.view stopAnimation];
|
||||
}
|
||||
|
||||
|
||||
@@ -69,12 +137,56 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[window release];
|
||||
[glViewController release];
|
||||
|
||||
[super dealloc];
|
||||
- (void) rotateBackgroundImage:(UIInterfaceOrientation)fromInterfaceOrientation toInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
|
||||
{
|
||||
bool isPhone = (UI_USER_INTERFACE_IDIOM()) == UIUserInterfaceIdiomPhone;
|
||||
|
||||
if (isPhone)
|
||||
{
|
||||
UIImage *bgImage = [UIImage imageNamed: @"Default-Portrait.png"];
|
||||
[[[self.window subviews] objectAtIndex: 0] setBackgroundColor: [UIColor colorWithPatternImage: bgImage]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.window setBackgroundColor: [UIColor clearColor]];
|
||||
if (UIInterfaceOrientationIsLandscape( toInterfaceOrientation)) {
|
||||
UIImage *bgImage = [UIImage imageNamed: @"Default-Landscape"];
|
||||
[[[self.window subviews] objectAtIndex: 0] setBackgroundColor: [UIColor colorWithPatternImage: bgImage]];
|
||||
}
|
||||
else {
|
||||
UIImage *bgImage = [UIImage imageNamed: @"Default-Portrait.png"];
|
||||
[[[self.window subviews] objectAtIndex: 0] setBackgroundColor: [UIColor colorWithPatternImage: bgImage]];
|
||||
[self.window setBackgroundColor: [UIColor colorWithPatternImage: bgImage]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Application Contents
|
||||
|
||||
- (BOOL) isNetworkAvailable
|
||||
{
|
||||
BOOL netAvailable = NO;
|
||||
NSDate *startTime = [[[NSDate alloc ] init] autorelease];
|
||||
|
||||
hostReach = [[Reachability reachabilityForGoogleDNS] retain];
|
||||
|
||||
NetworkStatus netStatus = [hostReach currentReachabilityStatus];
|
||||
|
||||
|
||||
if (netStatus == ReachableViaWiFi || netStatus == ReachableViaWWAN) {
|
||||
netAvailable = YES;
|
||||
}
|
||||
|
||||
//[[QLog log] logOption: kLogOptionTiming withFormat:@"isNetworkAvailble? %5.2f", [startTime timeIntervalSinceNow]];
|
||||
|
||||
[hostReach release];
|
||||
|
||||
return netAvailable;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
<item iconId="2" displayName="Deck Editor" action="deckEditor" particleFile="particle2.psi" />
|
||||
<item iconId="1" displayName="Shop" action="shop" particleFile="particle3.psi" />
|
||||
<item iconId="4" displayName="Options" action="options" particleFile="particle4.psi" />
|
||||
<item iconId="3" displayName="Trophies" action="trophies" particleFile="particle5.psi" />
|
||||
<item iconId="3" displayName="Exit" action="quit" particleFile="particle5.psi" />
|
||||
</main>
|
||||
<!--
|
||||
<other>
|
||||
<item displayName="Trophy Room" action="trophies" key="btn_next" />
|
||||
</other>
|
||||
-->
|
||||
</menu>
|
||||
<cardgui>
|
||||
<background>
|
||||
@@ -42,4 +40,4 @@
|
||||
<item name="types" posx="22" posy="49" formattedtext="" type=""/>
|
||||
<item name="expansionrarity" posx="22" posy="113" formattedtext="expansion rarity" type=""/>
|
||||
</rendertinycrop>
|
||||
</cardgui>
|
||||
</cardgui>
|
||||
|
||||
Reference in New Issue
Block a user