Skip to content

Commit

Permalink
Add class names to plugin autoloads
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Ibáñez Sánchez <jacobibanez@jacobibanez.com>
  • Loading branch information
Iakobs committed Dec 29, 2023
1 parent c847c57 commit 92adb37
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name PlayGamesAchievementsClient
extends Node
## Client with achievements functionality.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name PlayGamesEntryPoint
extends Node
## Main Autoload of the plugin, which contains a reference to the android plugin itself.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name PlayGamesLeaderboardsClient
extends Node
## Client with leaderboards functionality.
##
Expand Down Expand Up @@ -173,7 +174,7 @@ class Score:
var score_tag: String ## Optional score tag associated with this score.
var timestamp_millis: int ## Timestamp (in milliseconds from epoch) at which this score was achieved.

## Constructor that creates a Score froma [Dictionary] containing the properties.
## Constructor that creates a Score from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("displayRank"): display_rank = dictionary.displayRank
if dictionary.has("displayScore"): display_score = dictionary.displayScore
Expand Down
4 changes: 4 additions & 0 deletions plugin/export_scripts_template/autoloads/players_client.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name PlayGamesPlayersClient
extends Node
## Client with player functionality.
##
Expand Down Expand Up @@ -148,6 +149,7 @@ class Player:
var has_hi_res_image: bool ## Whether this player has a hi-res profile image to display.
var has_icon_image: bool ## Whether this player has an icon-size profile image to display.

## Constructor that creates a Player from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("bannerImageLandscapeUri"): banner_image_landscape_uri = dictionary.bannerImageLandscapeUri
if dictionary.has("bannerImagePortraitUri"): banner_image_portrait_uri = dictionary.bannerImagePortraitUri
Expand Down Expand Up @@ -190,6 +192,7 @@ class PlayerLevelInfo:
var next_level: PlayerLevel ## The player's next level object.
var is_max_level: bool ## True if the player reached the maximum level ([member PlayerLevelInfo.current_level] is the same as [member PlayerLevelInfo.next_level]).

## Constructor that creates a PlayerLevelInfo from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("currentLevel"): current_level = PlayerLevel.new(dictionary.currentLevel)
if dictionary.has("currentXpTotal"): current_xp_total = dictionary.currentXpTotal
Expand All @@ -214,6 +217,7 @@ class PlayerLevel:
var max_xp: int ## The maximum XP value represented by this level, exclusive.
var min_xp: int ## The minimum XP value needed to attain this level, inclusive.

## Constructor that creates a PlayerLevel from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("levelNumber"): level_number = dictionary.levelNumber
if dictionary.has("maxXp"): max_xp = dictionary.maxXp
Expand Down
1 change: 1 addition & 0 deletions plugin/export_scripts_template/autoloads/sign_in_client.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name PlayGamesSignInClient
extends Node
## Client with sign in functionality.
##
Expand Down
5 changes: 5 additions & 0 deletions plugin/export_scripts_template/autoloads/snapshots_client.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name PlayGamesSnapshotsClient
extends Node
## Client with save and load games functionality.
##
Expand Down Expand Up @@ -86,6 +87,7 @@ class Snapshot:
var content: PackedByteArray ## A [PackedByteArray] with the contents of the snapshot.
var metadata: SnapshotMetadata ## The metadata of the snapshot.

## Constructor that creates a Snapshot from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("content"): content = dictionary.content
if dictionary.has("metadata"): metadata = SnapshotMetadata.new(dictionary.metadata)
Expand All @@ -104,6 +106,7 @@ class SnapshotConflict:
var conflicting_snapshot: Snapshot ## The modified version of the Snapshot in the case of a conflict. This may not be the same as the version that you tried to save.
var server_snapshot: Snapshot ## The most-up-to-date version of the Snapshot known by Google Play games services to be accurate for the player’s device.

## Constructor that creates a SnapshotConflict from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("conflictId"): conflict_id = dictionary.conflictId
if dictionary.has("conflictingSnapshot"): conflicting_snapshot = Snapshot.new(dictionary.conflictingSnapshot)
Expand Down Expand Up @@ -133,6 +136,7 @@ class SnapshotMetadata:
var device_name: String ## The name of the device that wrote this snapshot, if known.
var cover_image_uri: String ## The snapshot cover image.

## Constructor that creates a SnapshotMetadata from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("snapshotId"): snapshot_id = dictionary.snapshotId
if dictionary.has("uniqueName"): unique_name = dictionary.uniqueName
Expand Down Expand Up @@ -182,6 +186,7 @@ class Game:
var icon_image_uri: String ## The game's icon.
var featured_image_uri: String ## The game's featured (banner) image from Google Play.

## Constructor that creates a Game from a [Dictionary] containing the properties.
func _init(dictionary: Dictionary) -> void:
if dictionary.has("areSnapshotsEnabled"): are_snapshots_enabled = dictionary.areSnapshotsEnabled
if dictionary.has("achievementTotalCount"): achievement_total_count = dictionary.achievementTotalCount
Expand Down

0 comments on commit 92adb37

Please sign in to comment.