Skip to content

Instantly share code, notes, and snippets.

@Majirefy
Majirefy / font.css
Created April 13, 2017 05:56
Custom Font CSS File
@font-face {
font-family: 'SongTi';
src: url('font.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@Majirefy
Majirefy / initialize.sh
Created April 13, 2017 05:52
Initialize TypeScript Project
node_modules/.bin/tsc --init
node_modules/.bin/tslint --init
@Majirefy
Majirefy / install.sh
Created April 13, 2017 05:08
Install Package
npm install --save-dev browserify browserify-shim http-server phaser-ce tsify tslint typescript webfontloader
UIAlertView alert = UIAlertView.alloc().init();
alert.setTitle("Info");
alert.setMessage("In order to see the global High Score, please login to GameCenter (Settings -> GameCenter)");
alert.addButtonWithTitle("Ok");
alert.show();
GKLocalPlayer.localPlayer().isAuthenticated();
GKScore gkScore = GKScore.alloc();
gkScore = gkScore.initWithLeaderboardIdentifier("my.identifier");
gkScore.setValue(42);
NSArray<GKScore> nsArray = (NSArray<GKScore>) NSArray.arrayWithObject(gkScore);
GKScore.reportScoresWithCompletionHandler(nsArray, new GKScore.Block_reportScoresWithCompletionHandler() {
@Override
public void call_reportScoresWithCompletionHandler(NSError nsError) {
if (nsError != null) {
//submitted score not successfully
} else {
static {
try {
Class.forName(GKScore.class.getName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
if (!loading) {
GKLeaderboard.loadLeaderboardsWithCompletionHandler(new CompletionHandler());
}
private boolean loading = false;
private class CompletionHandler implements GKLeaderboard.Block_loadLeaderboardsWithCompletionHandler {
@Override
public void call_loadLeaderboardsWithCompletionHandler(
NSArray<? extends GKLeaderboard> leaderboards, NSError nsError) {
//content below...
}
}
loading = true;
if (nsError != null) {
GKLocalPlayer localPlayer = GKLocalPlayer.localPlayer();
localPlayer.setAuthenticateHandler(new GKLocalPlayer.Block_setAuthenticateHandler() {
@Override
public void call_setAuthenticateHandler(UIViewController viewController, NSError nsError) {
if (viewController != null) {
iosApplication.getUIWindow().rootViewController().showDetailViewControllerSender(viewController, null);
} else if (localPlayer.isAuthenticated()) {
localPlayer.generateIdentityVerificationSignatureWithCompletionHandler(
new GKLocalPlayer.Block_generateIdentityVerificationSignatureWithCompletionHandler() {
@Override