moved Wagic Version macros into a new header file so that iOS can use it.
updated iOS port to use wagic versioning macros.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#import "EAGLViewController.h"
|
#import "EAGLViewController.h"
|
||||||
#import "ASIHTTPRequest.h"
|
#import "ASIHTTPRequest.h"
|
||||||
#import "ZipArchive.h"
|
#import "ZipArchive.h"
|
||||||
|
#include "Wagic_Version.h"
|
||||||
|
|
||||||
#include <CommonCrypto/CommonDigest.h>
|
#include <CommonCrypto/CommonDigest.h>
|
||||||
|
|
||||||
@@ -17,9 +18,9 @@
|
|||||||
{
|
{
|
||||||
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
[dnc postNotificationName: @"initializeGame" object: self];
|
|
||||||
[dnc removeObserver: self name: @"coreComplete" object: nil];
|
[dnc removeObserver: self name: @"coreComplete" object: nil];
|
||||||
[dnc removeObserver: self name: @"iosConfigComplete" object: nil];
|
[dnc removeObserver: self name: @"iosConfigComplete" object: nil];
|
||||||
|
[dnc postNotificationName: @"initializeGame" object: self];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,9 +130,10 @@
|
|||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
|
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
NSString *docsPath = [paths objectAtIndex: 0];
|
NSString *docsPath = [paths objectAtIndex: 0];
|
||||||
NSArray *docsPathContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: docsPath error:nil];
|
NSArray *docsPathContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: docsPath error:nil];
|
||||||
NSCompoundPredicate *compoundPredicate = [[NSCompoundPredicate alloc] initWithType:NSAndPredicateType subpredicates: [NSArray arrayWithObjects: [NSPredicate predicateWithFormat:@"self ENDSWITH '.zip'"], [NSPredicate predicateWithFormat:@"NOT (self BEGINSWITH 'core_')"], nil]];
|
NSString *versionPredicate = [NSString stringWithFormat: @"(self BEGINSWITH '%@')", [NSString stringWithCString: WAGIC_CORE_VERSION_STRING encoding:NSUTF8StringEncoding]];
|
||||||
|
NSCompoundPredicate *compoundPredicate = [[NSCompoundPredicate alloc] initWithType:NSAndPredicateType subpredicates: [NSArray arrayWithObjects: [NSPredicate predicateWithFormat:@"self ENDSWITH '.zip'"], [NSPredicate predicateWithFormat: [NSString stringWithFormat: @" NOT ( %@ ) ", versionPredicate]], nil]];
|
||||||
|
|
||||||
NSArray *coreFiles = [docsPathContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self BEGINSWITH 'core_0171'"]];
|
NSArray *coreFiles = [docsPathContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat: versionPredicate]];
|
||||||
|
|
||||||
NSArray *resourceZipFiles = [docsPathContents filteredArrayUsingPredicate: compoundPredicate];
|
NSArray *resourceZipFiles = [docsPathContents filteredArrayUsingPredicate: compoundPredicate];
|
||||||
NSString *userPath = [NSString stringWithFormat: @"%@/User", docsPath];
|
NSString *userPath = [NSString stringWithFormat: @"%@/User", docsPath];
|
||||||
@@ -179,7 +181,9 @@
|
|||||||
NSString *resPath = [NSString stringWithFormat: @"%@/Res", docsPath];
|
NSString *resPath = [NSString stringWithFormat: @"%@/Res", docsPath];
|
||||||
|
|
||||||
NSArray *resDirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: resPath error:nil];
|
NSArray *resDirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: resPath error:nil];
|
||||||
NSArray *coreFiles = [resDirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self BEGINSWITH 'core_'"]];
|
NSString *versionPredicate = [NSString stringWithFormat: @"(self BEGINSWITH '%@')", [NSString stringWithCString: WAGIC_CORE_VERSION_STRING encoding:NSUTF8StringEncoding]];
|
||||||
|
|
||||||
|
NSArray *coreFiles = [resDirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat: versionPredicate]];
|
||||||
|
|
||||||
if ([coreFiles count] >= 2)
|
if ([coreFiles count] >= 2)
|
||||||
{
|
{
|
||||||
@@ -245,8 +249,6 @@
|
|||||||
[glViewController release];
|
[glViewController release];
|
||||||
glViewController = [[EAGLViewController alloc] init];
|
glViewController = [[EAGLViewController alloc] init];
|
||||||
|
|
||||||
if (wagicDownloadController != nil)
|
|
||||||
[wagicDownloadController release];
|
|
||||||
|
|
||||||
[self.window addSubview:self.glViewController.view];
|
[self.window addSubview:self.glViewController.view];
|
||||||
|
|
||||||
@@ -257,6 +259,7 @@
|
|||||||
[dnc addObserver: glViewController selector:@selector(resumeGame) name: UIApplicationDidBecomeActiveNotification object: nil];
|
[dnc addObserver: glViewController selector:@selector(resumeGame) name: UIApplicationDidBecomeActiveNotification object: nil];
|
||||||
[dnc addObserver: glViewController selector:@selector(resumeGame) name:UIApplicationWillEnterForegroundNotification object: nil];
|
[dnc addObserver: glViewController selector:@selector(resumeGame) name:UIApplicationWillEnterForegroundNotification object: nil];
|
||||||
[dnc addObserver: glViewController selector:@selector(destroyGame) name:UIApplicationWillTerminateNotification object: nil];
|
[dnc addObserver: glViewController selector:@selector(destroyGame) name:UIApplicationWillTerminateNotification object: nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,11 +270,11 @@
|
|||||||
[dnc removeObserver: glViewController name: UIApplicationDidEnterBackgroundNotification object: nil];
|
[dnc removeObserver: glViewController name: UIApplicationDidEnterBackgroundNotification object: nil];
|
||||||
[dnc removeObserver: glViewController name: UIApplicationWillTerminateNotification object: nil];
|
[dnc removeObserver: glViewController name: UIApplicationWillTerminateNotification object: nil];
|
||||||
[dnc removeObserver: glViewController name: UIApplicationWillResignActiveNotification object: nil];
|
[dnc removeObserver: glViewController name: UIApplicationWillResignActiveNotification object: nil];
|
||||||
[window release];
|
|
||||||
[glViewController release];
|
|
||||||
[hostReach release];
|
[hostReach release];
|
||||||
[wifiReach release];
|
[wifiReach release];
|
||||||
[internetReach release];
|
[internetReach release];
|
||||||
|
[wagicDownloadController release];
|
||||||
|
[glViewController release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,5 +17,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, retain) UITextView *downloadMessageStatus;
|
@property (nonatomic, retain) UITextView *downloadMessageStatus;
|
||||||
@property (nonatomic, retain) UIProgressView *downloadProgressView;
|
@property (nonatomic, retain) UIProgressView *downloadProgressView;
|
||||||
|
@property (nonatomic, retain) NSString *kDownloadFileName;
|
||||||
|
@property (nonatomic, retain) NSString *kDownloadIosUpdateFileName;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -10,17 +10,18 @@
|
|||||||
#import "wagicAppDelegate.h"
|
#import "wagicAppDelegate.h"
|
||||||
#import "ASIHTTPRequest.h"
|
#import "ASIHTTPRequest.h"
|
||||||
#import "QuartzCore/QuartzCore.h"
|
#import "QuartzCore/QuartzCore.h"
|
||||||
|
#include "Wagic_Version.h"
|
||||||
|
|
||||||
@implementation WagicDownloadProgressViewController
|
@implementation WagicDownloadProgressViewController
|
||||||
|
|
||||||
@synthesize downloadProgressView;
|
@synthesize downloadProgressView;
|
||||||
@synthesize downloadMessageStatus;
|
@synthesize downloadMessageStatus;
|
||||||
|
@synthesize kDownloadIosUpdateFileName;
|
||||||
|
@synthesize kDownloadFileName;
|
||||||
|
|
||||||
|
#define WAGIC_IOS_RESOURCE_NAME WAGIC_CORE_VERSION_STRING "_iOS.zip"
|
||||||
|
|
||||||
static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
|
static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
|
||||||
static NSString *kDownloadFileName = @"core_0171.zip";
|
|
||||||
static NSString *kDownloadIosUpdateFileName = @"core_0171_iOS.zip";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void) handleFailedDownload: (NSNotification *) sender
|
- (void) handleFailedDownload: (NSNotification *) sender
|
||||||
{
|
{
|
||||||
@@ -102,6 +103,9 @@ static NSString *kDownloadIosUpdateFileName = @"core_0171_iOS.zip";
|
|||||||
NSURL *url = nil;
|
NSURL *url = nil;
|
||||||
NSString *downloadFilename = nil;
|
NSString *downloadFilename = nil;
|
||||||
// determine which file to download
|
// determine which file to download
|
||||||
|
kDownloadFileName = [NSString stringWithCString: WAGIC_RESOURCE_NAME encoding:NSUTF8StringEncoding];
|
||||||
|
kDownloadIosUpdateFileName = [NSString stringWithCString: WAGIC_IOS_RESOURCE_NAME encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
if ([downloadType isEqualToString: @"core"])
|
if ([downloadType isEqualToString: @"core"])
|
||||||
{
|
{
|
||||||
downloadFilename = kDownloadFileName;
|
downloadFilename = kDownloadFileName;
|
||||||
@@ -154,6 +158,19 @@ static NSString *kDownloadIosUpdateFileName = @"core_0171_iOS.zip";
|
|||||||
[pool drain], pool = nil;
|
[pool drain], pool = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[kDownloadFileName release], kDownloadFileName = nil;
|
||||||
|
[kDownloadIosUpdateFileName release], kDownloadIosUpdateFileName = nil;
|
||||||
|
if (downloadProgressView)
|
||||||
|
[downloadProgressView release], downloadProgressView = nil;
|
||||||
|
if (downloadMessageStatus)
|
||||||
|
[downloadMessageStatus release], downloadMessageStatus = nil;
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
||||||
|
|||||||
@@ -26,23 +26,7 @@
|
|||||||
#endif //NETWORK_SUPPORT
|
#endif //NETWORK_SUPPORT
|
||||||
#include "GameObserver.h"
|
#include "GameObserver.h"
|
||||||
|
|
||||||
/* Wagic versions */
|
#include "Wagic_Version.h"
|
||||||
#define WAGIC_VERSION_MAJOR 0
|
|
||||||
#define WAGIC_VERSION_MEDIUM 18
|
|
||||||
#define WAGIC_VERSION_MINOR 0
|
|
||||||
|
|
||||||
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
|
|
||||||
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c
|
|
||||||
#define VERSION_GAME(a, b, c) VERSION_DOT(a, b, c)
|
|
||||||
#define VERSION_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c)
|
|
||||||
#define VERSION_TOSTRING(a) #a
|
|
||||||
#define VERSION_STRINGIFY(a) VERSION_TOSTRING(a)
|
|
||||||
|
|
||||||
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
|
||||||
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
|
||||||
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
|
|
||||||
#define WAGIC_RESOURCE_NAME "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) ".zip"
|
|
||||||
|
|
||||||
class Rules;
|
class Rules;
|
||||||
class MTGAllCards;
|
class MTGAllCards;
|
||||||
class TransitionBase;
|
class TransitionBase;
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// Wagic_Version.h
|
||||||
|
// wagic
|
||||||
|
//
|
||||||
|
// Created by Michael Nguyen on 2/5/12.
|
||||||
|
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef wagic_Wagic_Version_h
|
||||||
|
#define wagic_Wagic_Version_h
|
||||||
|
|
||||||
|
|
||||||
|
/* Wagic versions */
|
||||||
|
#define WAGIC_VERSION_MAJOR 0
|
||||||
|
#define WAGIC_VERSION_MEDIUM 18
|
||||||
|
#define WAGIC_VERSION_MINOR 0
|
||||||
|
|
||||||
|
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
|
||||||
|
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c
|
||||||
|
#define VERSION_GAME(a, b, c) VERSION_DOT(a, b, c)
|
||||||
|
#define VERSION_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c)
|
||||||
|
#define VERSION_TOSTRING(a) #a
|
||||||
|
#define VERSION_STRINGIFY(a) VERSION_TOSTRING(a)
|
||||||
|
|
||||||
|
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||||
|
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||||
|
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
|
||||||
|
#define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION)
|
||||||
|
#define WAGIC_RESOURCE_NAME WAGIC_CORE_VERSION_STRING ".zip"
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -570,6 +570,7 @@
|
|||||||
12272FC614CD68FB00192DC7 /* InteractiveButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteractiveButton.h; sourceTree = "<group>"; };
|
12272FC614CD68FB00192DC7 /* InteractiveButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteractiveButton.h; sourceTree = "<group>"; };
|
||||||
12272FC714CD6A3900192DC7 /* InteractiveButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InteractiveButton.cpp; sourceTree = "<group>"; };
|
12272FC714CD6A3900192DC7 /* InteractiveButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InteractiveButton.cpp; sourceTree = "<group>"; };
|
||||||
1235D03C14DE396D00B02B42 /* JSfx.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSfx.cpp; path = android/JSfx.cpp; sourceTree = "<group>"; };
|
1235D03C14DE396D00B02B42 /* JSfx.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSfx.cpp; path = android/JSfx.cpp; sourceTree = "<group>"; };
|
||||||
|
1235D03E14DE859D00B02B42 /* Wagic_Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wagic_Version.h; sourceTree = "<group>"; };
|
||||||
12769483144127380088F6D3 /* AIPlayerBaka.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AIPlayerBaka.cpp; sourceTree = "<group>"; };
|
12769483144127380088F6D3 /* AIPlayerBaka.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AIPlayerBaka.cpp; sourceTree = "<group>"; };
|
||||||
12769484144127380088F6D3 /* AIPlayerBakaB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AIPlayerBakaB.cpp; sourceTree = "<group>"; };
|
12769484144127380088F6D3 /* AIPlayerBakaB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AIPlayerBakaB.cpp; sourceTree = "<group>"; };
|
||||||
12769485144127380088F6D3 /* TestSuiteAI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSuiteAI.cpp; sourceTree = "<group>"; };
|
12769485144127380088F6D3 /* TestSuiteAI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSuiteAI.cpp; sourceTree = "<group>"; };
|
||||||
@@ -1665,6 +1666,7 @@
|
|||||||
CEA376EA1291C60500B9016A /* WFont.h */,
|
CEA376EA1291C60500B9016A /* WFont.h */,
|
||||||
CEA376EB1291C60500B9016A /* WGui.h */,
|
CEA376EB1291C60500B9016A /* WGui.h */,
|
||||||
CEA376EC1291C60500B9016A /* WResourceManager.h */,
|
CEA376EC1291C60500B9016A /* WResourceManager.h */,
|
||||||
|
1235D03E14DE859D00B02B42 /* Wagic_Version.h */,
|
||||||
);
|
);
|
||||||
path = include;
|
path = include;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|||||||
Reference in New Issue
Block a user