GameState
class GameState : Parcelable
kotlin.Any | |
↳ | android.app.GameState |
State of the game passed to the GameManager. This includes a top-level state for the game (indicating if the game can be interrupted without interfering with content that can't be paused). Since content can be loaded in any state, it includes an independent boolean flag to indicate loading status. Free-form metadata (as a Bundle) and a string description can also be specified by the application.
Summary
Constants | |
---|---|
static Int |
Indicates that the current content shown is not gameplay related. |
static Int |
Indicates if the game is in active, but interruptible, game play. |
static Int |
Indicates if the game is in active user play mode, which is real time and cannot be interrupted. |
static Int |
No mode means that the game is not in active play, for example the user is using the game menu. |
static Int |
Default Game mode is unknown. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
Create a GameState with the specified loading status. |
|
Create a GameState with the given state variables. |
Public methods | |
---|---|
Int | |
Int |
getLabel() |
Int |
getMode() |
Int | |
Boolean | |
Unit |
writeToParcel(parcel: Parcel, flags: Int) Flatten this object in to a Parcel. |
Properties | |
---|---|
static Parcelable.Creator<GameState!> |
Implement the parcelable interface. |
Constants
MODE_CONTENT
static val MODE_CONTENT: Int
Indicates that the current content shown is not gameplay related. For example it can be an ad, a web page, a text, or a video.
Value: 4
MODE_GAMEPLAY_INTERRUPTIBLE
static val MODE_GAMEPLAY_INTERRUPTIBLE: Int
Indicates if the game is in active, but interruptible, game play.
Value: 2
MODE_GAMEPLAY_UNINTERRUPTIBLE
static val MODE_GAMEPLAY_UNINTERRUPTIBLE: Int
Indicates if the game is in active user play mode, which is real time and cannot be interrupted.
Value: 3
MODE_NONE
static val MODE_NONE: Int
No mode means that the game is not in active play, for example the user is using the game menu.
Value: 1
MODE_UNKNOWN
static val MODE_UNKNOWN: Int
Default Game mode is unknown.
Value: 0
Public constructors
GameState
GameState(
isLoading: Boolean,
mode: Int)
Create a GameState with the specified loading status.
Parameters | |
---|---|
isLoading |
Boolean: Whether the game is in the loading state. |
mode |
Int: The game state mode of type @GameStateMode. Value is android.app.GameState#MODE_UNKNOWN , android.app.GameState#MODE_NONE , android.app.GameState#MODE_GAMEPLAY_INTERRUPTIBLE , android.app.GameState#MODE_GAMEPLAY_UNINTERRUPTIBLE , or android.app.GameState#MODE_CONTENT |
GameState
GameState(
isLoading: Boolean,
mode: Int,
label: Int,
quality: Int)
Create a GameState with the given state variables.
Parameters | |
---|---|
isLoading |
Boolean: Whether the game is in the loading state. |
mode |
Int: The game state mode. Value is android.app.GameState#MODE_UNKNOWN , android.app.GameState#MODE_NONE , android.app.GameState#MODE_GAMEPLAY_INTERRUPTIBLE , android.app.GameState#MODE_GAMEPLAY_UNINTERRUPTIBLE , or android.app.GameState#MODE_CONTENT |
label |
Int: An optional developer-supplied enum e.g. for the current level. |
quality |
Int: An optional developer-supplied enum, e.g. for the current quality level. |
Public methods
describeContents
fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getLabel
fun getLabel(): Int
Return | |
---|---|
Int |
The developer-supplied enum, e.g. to indicate level or scene. The default value (if not supplied) is -1. |
getMode
fun getMode(): Int
getQuality
fun getQuality(): Int
Return | |
---|---|
Int |
The developer-supplied enum, e.g. to indicate the current quality level. The default value (if not suplied) is -1. |
isLoading
fun isLoading(): Boolean
Return | |
---|---|
Boolean |
If the game is loading assets/resources/compiling/etc. |
writeToParcel
fun writeToParcel(
parcel: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
parcel |
Parcel: This value cannot be null . |
Properties
CREATOR
static val CREATOR: Parcelable.Creator<GameState!>
Implement the parcelable interface.