Skip to content

Commit

Permalink
Updated to be used with Godot 3.4.3, updated gradle and Kotlin version
Browse files Browse the repository at this point in the history
  • Loading branch information
oneseedfruit committed Mar 26, 2022
1 parent a95bb72 commit 5b502ce
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ captures/
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
.idea/vcs.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
Expand Down
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

17 changes: 0 additions & 17 deletions Changelog.md

This file was deleted.

15 changes: 7 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "30.0.1"
compileSdkVersion 32
buildToolsVersion "30.0.3"

defaultConfig {
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 32
versionCode 1
versionName "1.0"
}
Expand All @@ -34,11 +33,11 @@ android {
}

dependencies {
compileOnly project(":godot-lib")
compileOnly fileTree(dir:"libs", include:["godot-lib.aar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.android.gms:play-services-games:21.0.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.gms:play-services-games:22.0.1'
implementation 'com.google.android.gms:play-services-auth:20.1.0'
implementation 'com.google.code.gson:gson:2.9.0'

testImplementation 'junit:junit:4.13.2'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ class PlayGameServicesGodot(godot: Godot) : GodotPlugin(godot), AchievementsList

override fun onMainActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == SignInController.RC_SIGN_IN) {
val googleSignInResult = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
signInController.onSignInActivityResult(googleSignInResult)
if (data != null) {
val googleSignInResult = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
signInController.onSignInActivityResult(googleSignInResult)
}
} else if (requestCode == SavedGamesController.RC_SAVED_GAMES) {
if (data != null) {
if (data.hasExtra(SnapshotsClient.EXTRA_SNAPSHOT_METADATA)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ class PlayerInfoController(
val player = task.result
if (task.isSuccessful && player != null) {
val levelInfo = player.levelInfo
val playerLevelInfo = if (levelInfo != null) {
val playerLevelInfo = if (levelInfo !== null) {
PlayerLevelInfo(
levelInfo.currentXpTotal,
levelInfo.lastLevelUpTimestamp,
if (levelInfo.currentLevel != null) PlayerLevel(
PlayerLevel(
levelInfo.currentLevel.levelNumber,
levelInfo.currentLevel.minXp,
levelInfo.currentLevel.maxXp
) else null,
if (levelInfo.nextLevel != null) PlayerLevel(
),
PlayerLevel(
levelInfo.nextLevel.levelNumber,
levelInfo.nextLevel.minXp,
levelInfo.nextLevel.maxXp
) else null
)
)
} else {
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class LeaderboardsController(

var collection = COLLECTION_PUBLIC

if (leaderboardCollection.toLowerCase(Locale.ROOT).contains("friends")) {
if (leaderboardCollection.lowercase(Locale.ROOT).contains("friends")) {
collection = COLLECTION_FRIENDS
}

var finalSpan = TIME_SPAN_ALL_TIME;

if (span.toLowerCase(Locale.ROOT).contains("weekly")) {
if (span.lowercase(Locale.ROOT).contains("weekly")) {
finalSpan = TIME_SPAN_WEEKLY
} else if (span.toLowerCase(Locale.ROOT).contains("daily")) {
} else if (span.lowercase(Locale.ROOT).contains("daily")) {
finalSpan = TIME_SPAN_DAILY
}

Expand All @@ -55,7 +55,9 @@ class LeaderboardsController(

if (lbScore != null) {
val score = lbScore.get();
Log.i("godot", "-------------------\n\n THE RESULT:\n ${score.rank}\n\n")
if (score != null) {
Log.i("godot", "-------------------\n\n THE RESULT:\n ${score.rank}\n\n")
}

if (score != null) {
leaderboardScore.rank = score.rank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class SavedGamesController(
data: ByteArray?,
desc: String
) {
snapshot.snapshotContents.writeBytes(data)
if (data != null) {
snapshot.snapshotContents.writeBytes(data)
}
val metadataChange = SnapshotMetadataChange.Builder()
.setDescription(desc)
.build()
Expand Down
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.31'
ext {
agp_version = '7.1.2'
}
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "com.android.tools.build:gradle:$agp_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -17,7 +20,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
2 changes: 0 additions & 2 deletions godot-lib/build.gradle

This file was deleted.

6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jul 23 22:14:23 EEST 2020
#Sat Mar 26 08:33:05 MYT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app', ':godot-lib'
include ':app'

0 comments on commit 5b502ce

Please sign in to comment.