This commit is contained in:
Bryce Covert
2020-10-11 08:40:35 -07:00
parent c70e8be312
commit 1fd7c36e87
3 changed files with 49 additions and 35 deletions

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>141</string> <string>146</string>
<key>CFBundleIconName</key> <key>CFBundleIconName</key>
<string>AppIcon</string> <string>AppIcon</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>

View File

@@ -44,9 +44,11 @@ public class GameCenter {
/** Do the login logic. If the user has never loged, a dialog will be shown. */ /** Do the login logic. If the user has never loged, a dialog will be shown. */
public void login (final UIWindow window) { public void login (final UIWindow window) {
try {
GKLocalPlayer.getLocalPlayer().setAuthenticateHandler(new VoidBlock2<UIViewController, NSError>() { GKLocalPlayer.getLocalPlayer().setAuthenticateHandler(new VoidBlock2<UIViewController, NSError>() {
@Override @Override
public void invoke (UIViewController viewController, NSError error) { public void invoke (UIViewController viewController, NSError error) {
System.out.println("AUTH: invoked");
// If the device does not have an authenticated player, show the login dialog // If the device does not have an authenticated player, show the login dialog
if (viewController != null) { if (viewController != null) {
System.out.println("Not logged in"); System.out.println("Not logged in");
@@ -65,6 +67,10 @@ public class GameCenter {
} }
} }
}); });
} catch (Exception e) {
System.out.println(e.toString());
throw e;
}
} }
public void show(final UIViewController d) { public void show(final UIViewController d) {

View File

@@ -18,10 +18,17 @@ public class IOSLauncher extends IOSApplication.Delegate {
TransactionObserver transactionObserver; TransactionObserver transactionObserver;
@Override @Override
public boolean didFinishLaunching (UIApplication application, UIApplicationLaunchOptions launchOptions) { public boolean didFinishLaunching (UIApplication application, UIApplicationLaunchOptions launchOptions) {
System.out.println("Did finish loading");
try {
transactionObserver = new TransactionObserver(); transactionObserver = new TransactionObserver();
SKPaymentQueue.getDefaultQueue().addTransactionObserver(transactionObserver); SKPaymentQueue.getDefaultQueue().addTransactionObserver(transactionObserver);
boolean result = super.didFinishLaunching(application, launchOptions);
new GameCenter().login(application.getKeyWindow()); new GameCenter().login(application.getKeyWindow());
return super.didFinishLaunching(application, launchOptions); return result;
} catch (Exception e) {
System.out.println(e.toString());
throw e;
}
} }
@Override @Override
@@ -31,41 +38,42 @@ public class IOSLauncher extends IOSApplication.Delegate {
} }
protected IOSApplication createApplication() { protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration(); IOSApplicationConfiguration config = new IOSApplicationConfiguration();
// config.colorFormat = GLKViewDrawableColorFormat.SRGBA8888; // config.colorFormat = GLKViewDrawableColorFormat.SRGBA8888;
// config.depthFormat = GLKViewDrawableDepthFormat._24; // config.depthFormat = GLKViewDrawableDepthFormat._24;
config.orientationPortrait = false; config.orientationPortrait = true;
config.orientationLandscape = true; config.orientationLandscape = true;
config.preferredFramesPerSecond = 30; config.preferredFramesPerSecond = 30;
config.useAccelerometer=false; config.useAccelerometer=false;
config.useCompass=false; config.useCompass=false;
System.out.println("application created."); System.out.println("application created.");
HashSet<String> products = new HashSet(); try {
products.add("fullgame"); HashSet<String> products = new HashSet();
SKProductsRequest request = new SKProductsRequest(products); products.add("fullgame");
request.setDelegate(new ProductDelegate()); SKProductsRequest request = new SKProductsRequest(products);
request.start(); request.setDelegate(new ProductDelegate());
request.start();
RT.var("clojure.core", "require").invoke(Symbol.intern("advent.core")); RT.var("clojure.core", "require").invoke(Symbol.intern("advent.core"));
RT.var("clojure.core", "require").invoke(Symbol.intern("advent.ios")); RT.var("clojure.core", "require").invoke(Symbol.intern("advent.ios"));
System.out.println("clojure loaded"); System.out.println("clojure loaded");
try { NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary();
NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary(); String version = infoDictionary.get(new NSString("CFBundleShortVersionString")).toString();
String version = infoDictionary.get(new NSString("CFBundleShortVersionString")).toString(); RT.var("advent.version", "version-override").bindRoot(version);
RT.var("advent.version", "version-override").bindRoot(version); Game game = (Game) RT.var("advent.core", "advent").deref();
Game game = (Game) RT.var("advent.core", "advent").deref(); System.out.println("game loaded");
System.out.println("game loaded"); return new IOSApplication(game, config);
return new IOSApplication(game, config); } catch (Exception e) {
} catch (Exception e) { System.out.println(e.toString());
e.printStackTrace(); e.printStackTrace();
} throw e;
return null; }
} }
public static void main(String[] argv) { public static void main(String[] argv) {
NSAutoreleasePool pool = new NSAutoreleasePool(); NSAutoreleasePool pool = new NSAutoreleasePool();
UIApplication.main(argv, null, IOSLauncher.class); UIApplication.main(argv, null, IOSLauncher.class);
pool.close(); pool.close();
} }
@Override @Override