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>
<string>????</string>
<key>CFBundleVersion</key>
<string>141</string>
<string>146</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<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. */
public void login (final UIWindow window) {
try {
GKLocalPlayer.getLocalPlayer().setAuthenticateHandler(new VoidBlock2<UIViewController, NSError>() {
@Override
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 (viewController != null) {
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) {

View File

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