C# 클래스 NDream.AirConsole.AirConsole

상속: UnityEngine.MonoBehaviour
파일 보기 프로젝트 열기: AirConsole/airconsole-unity-plugin 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
androidTvGameVersion string
androidUIResizeMode AndroidUIResizeMode
autoScaleCanvas bool
browserStartMode StartMode
controllerHtml UnityEngine.Object
webViewLoadingSprite UnityEngine.Sprite

Private Properties

프로퍼티 타입 설명
AllocateDeviceSlots void
Awake void
GetDevice JToken
GetGameUrl string
InitWebView void
OnAdComplete void
OnAdShow void
OnApplicationPause void
OnApplicationQuit void
OnClose void
OnConnect void
OnCustomDeviceStateChange void
OnDeviceProfileChange void
OnDeviceStateChange void
OnDisable void
OnDisconnect void
OnGameEnd void
OnHighScoreStored void
OnHighScores void
OnLaunchApp void
OnMessage void
OnPersistentDataLoaded void
OnPersistentDataStored void
OnPremium void
OnReady void
OnSceneLoaded void
OnUnityWebviewPlatformReady void
OnUnityWebviewResize void
Start void
StopWebsocketServer void
Update void

공개 메소드들

메소드 설명
Broadcast ( object data ) : void

Sends a message to all devices.

ConvertDeviceIdToPlayerNumber ( int device_id ) : int

Returns the player number for a device_id, if the device_id is part of the active players previously set by the screen by calling setActivePlayers. Player numbers are zero based and are consecutive. If the device_id is not part of the active players, this function returns -1.

ConvertPlayerNumberToDeviceId ( int player_number ) : int

Returns the device_id of a player, if the player is part of the active players previously set by the screen by calling setActivePlayers. If fewer players are in the game than the passed in player_number or the active players have not been set by the screen, this function returns undefined.

GetControllerDeviceIds ( ) : List

Returns all controller device ids that have loaded your game.

GetCustomDeviceState ( int device_id = -1 ) : JToken

Gets the custom DeviceState of a device.

GetDeviceId ( ) : int

Returns the device_id of this device. Every device in a AirConsole session has a device_id. The screen always has device_id 0. You can use the AirConsole.SCREEN constant instead of 0. All controllers also get a device_id. You can NOT assume that the device_ids of controllers are consecutive or that they start at 1. DO NOT HARDCODE CONTROLLER DEVICE IDS! If you want to have a logic with "players numbers" (Player 0, Player 1, Player 2, Player 3) use the setActivePlayers helper function! You can hardcode player numbers, but not device_ids. Within an AirConsole session, devices keep the same device_id when they disconnect and reconnect. Different controllers will never get the same device_id in a session. Every device_id remains reserved for the device that originally got it. For more info read http:// developers.airconsole.com/#/guides/device_ids_and_states

GetMasterControllerDeviceId ( ) : int

Returns the device ID of the master controller.

GetNickname ( int device_id = -1 ) : string

Returns the nickname of a user.

GetPremiumDeviceIds ( ) : List

Returns all device Ids that are premium.

GetProfilePicture ( String uid, int size = 64 ) : string

Returns the url to a profile picture of a user.

GetProfilePicture ( int device_id = -1, int size = 64 ) : string

Returns the url to a profile picture of a user.

GetServerTime ( ) : long

Returns the current time on the game server. This allows you to have a synchronized clock: You can send the servertime in a message to know exactly at what point something happened on a device.

GetUID ( int device_id = -1 ) : string

Returns the globally unique id of a device.

GetUrl ( StartMode mode ) : string
IsAirConsoleUnityPluginReady ( ) : bool

Determines whether the AirConsole Unity Plugin is ready. Use onReady event instead if possible.

IsPremium ( int device_id = -1 ) : bool

Returns true if the device is premium

IsUserLoggedIn ( int device_id = -1 ) : bool

Returns true if a user is logged in.

Message ( int to, object data ) : void

Sends a message to another device.

NavigateHome ( ) : void

Request that all devices return to the AirConsole store.

NavigateTo ( string url ) : void

Request that all devices load a game by url. Note that the custom DeviceStates are preserved. If you don't want that, override SetCustomDeviceState(null) on every device before calling this function.

ProcessJS ( string data ) : void
RequestHighScores ( string level_name, string level_version, List uids = null, List ranks = null, int total = -1, int top = -1 ) : void

Requests high score data of players (including global high scores and friends). Will call onHighScores when data was received.

RequestPersistentData ( List uids = null ) : void

Requests persistent data from the servers. Will call onPersistentDataLoaded when data was received.

SetActivePlayers ( int max_players = -1 ) : void

Takes all currently connected controllers and assigns them a player number. Can only be called by the screen. You don't have to use this helper function, but this mechanism is very convenient if you want to know which device is the first player, the second player, the third player ... The assigned player numbers always start with 0 and are consecutive. You can hardcode player numbers, but not device_ids. Once the screen has called setActivePlayers you can get the device_id of the first player by calling convertPlayerNumberToDeviceId(0), the device_id of the second player by calling convertPlayerNumberToDeviceId(1), ... You can also convert device_ids to player numbers by calling convertDeviceIdToPlayerNumber(device_id). You can get all device_ids that are active players by calling getActivePlayerDeviceIds(). The screen can call this function every time a game round starts.

SetCustomDeviceState ( object data ) : void

Sets the custom DeviceState of this device.

SetCustomDeviceStateProperty ( string key, object value ) : void

Sets a property in the custom DeviceState of this device.

ShowAd ( ) : void

Requests that AirConsole shows a multiscreen advertisment. onAdShow is called on all connected devices if an advertisement is shown (in this event please mute all sounds). onAdComplete is called on all connected devices when the advertisement is complete or no advertisement was shown.

ShowDefaultUI ( bool visible ) : void

Shows or hides the default UI.

StoreHighScore ( string level_name, string level_version, float score, List uids, Newtonsoft.Json.Linq.JObject data = null, string score_string = null ) : void

Stores a high score of the current user on the AirConsole servers. High scores may be returned to anyone. Do not include sensitive data. Only updates the high score if it was a higher or same score. Calls onHighScoreStored when the request is done. The name of the level the user was playing. This should be a human readable string because it appears in the high score sharing image. You can also just pass an empty string. The version of the level the user was playing. This is for your internal use. The score the user has achieved The UIDs of the users that achieved the high score. Custom high score data (e.g. can be used to implement Ghost modes or include data to verify that it is not a fake high score). A short human readable representation of the score. (e.g. "4 points in 3s"). Defaults to "X points" where x is the score converted to an integer.

StoreHighScore ( string level_name, string level_version, float score, string uid, Newtonsoft.Json.Linq.JObject data = null, string score_string = null ) : void

Stores a high score of the current user on the AirConsole servers. High scores may be returned to anyone. Do not include sensitive data. Only updates the high score if it was a higher or same score. Calls onHighScoreStored when the request is done. The name of the level the user was playing. This should be a human readable string because it appears in the high score sharing image. You can also just pass an empty string. The version of the level the user was playing. This is for your internal use. The score the user has achieved The UID of the user that achieved the high score. Custom high score data (e.g. can be used to implement Ghost modes or include data to verify that it is not a fake high score). A short human readable representation of the score. (e.g. "4 points in 3s"). Defaults to "X points" where x is the score converted to an integer.

StorePersistentData ( string key, JToken value, string uid = null ) : void

Stores a key-value pair persistently on the AirConsole servers. Storage is per game. Total storage can not exceed 1 MB per game and uid. Will call onPersistentDataStored when the request is done.

비공개 메소드들

메소드 설명
AllocateDeviceSlots ( int i ) : void
Awake ( ) : void
GetDevice ( int deviceId ) : JToken
GetGameUrl ( string url ) : string
InitWebView ( ) : void
OnAdComplete ( Newtonsoft.Json.Linq.JObject msg ) : void
OnAdShow ( Newtonsoft.Json.Linq.JObject msg ) : void
OnApplicationPause ( bool pauseStatus ) : void
OnApplicationQuit ( ) : void
OnClose ( ) : void
OnConnect ( Newtonsoft.Json.Linq.JObject msg ) : void
OnCustomDeviceStateChange ( Newtonsoft.Json.Linq.JObject msg ) : void
OnDeviceProfileChange ( Newtonsoft.Json.Linq.JObject msg ) : void
OnDeviceStateChange ( Newtonsoft.Json.Linq.JObject msg ) : void
OnDisable ( ) : void
OnDisconnect ( Newtonsoft.Json.Linq.JObject msg ) : void
OnGameEnd ( Newtonsoft.Json.Linq.JObject msg ) : void
OnHighScoreStored ( Newtonsoft.Json.Linq.JObject msg ) : void
OnHighScores ( Newtonsoft.Json.Linq.JObject msg ) : void
OnLaunchApp ( Newtonsoft.Json.Linq.JObject msg ) : void
OnMessage ( Newtonsoft.Json.Linq.JObject msg ) : void
OnPersistentDataLoaded ( Newtonsoft.Json.Linq.JObject msg ) : void
OnPersistentDataStored ( Newtonsoft.Json.Linq.JObject msg ) : void
OnPremium ( Newtonsoft.Json.Linq.JObject msg ) : void
OnReady ( Newtonsoft.Json.Linq.JObject msg ) : void
OnSceneLoaded ( Scene scene, LoadSceneMode sceneMode ) : void
OnUnityWebviewPlatformReady ( Newtonsoft.Json.Linq.JObject msg ) : void
OnUnityWebviewResize ( Newtonsoft.Json.Linq.JObject msg ) : void
Start ( ) : void
StopWebsocketServer ( ) : void
Update ( ) : void

메소드 상세

Broadcast() 공개 메소드

Sends a message to all devices.
public Broadcast ( object data ) : void
data object The message to send.
리턴 void

ConvertDeviceIdToPlayerNumber() 공개 메소드

Returns the player number for a device_id, if the device_id is part of the active players previously set by the screen by calling setActivePlayers. Player numbers are zero based and are consecutive. If the device_id is not part of the active players, this function returns -1.
public ConvertDeviceIdToPlayerNumber ( int device_id ) : int
device_id int Device id.
리턴 int

ConvertPlayerNumberToDeviceId() 공개 메소드

Returns the device_id of a player, if the player is part of the active players previously set by the screen by calling setActivePlayers. If fewer players are in the game than the passed in player_number or the active players have not been set by the screen, this function returns undefined.
public ConvertPlayerNumberToDeviceId ( int player_number ) : int
player_number int Player Number.
리턴 int

GetControllerDeviceIds() 공개 메소드

Returns all controller device ids that have loaded your game.
public GetControllerDeviceIds ( ) : List
리턴 List

GetCustomDeviceState() 공개 메소드

Gets the custom DeviceState of a device.
public GetCustomDeviceState ( int device_id = -1 ) : JToken
device_id int The device ID of which you want the custom state. Default is this device.
리턴 JToken

GetDeviceId() 공개 메소드

Returns the device_id of this device. Every device in a AirConsole session has a device_id. The screen always has device_id 0. You can use the AirConsole.SCREEN constant instead of 0. All controllers also get a device_id. You can NOT assume that the device_ids of controllers are consecutive or that they start at 1. DO NOT HARDCODE CONTROLLER DEVICE IDS! If you want to have a logic with "players numbers" (Player 0, Player 1, Player 2, Player 3) use the setActivePlayers helper function! You can hardcode player numbers, but not device_ids. Within an AirConsole session, devices keep the same device_id when they disconnect and reconnect. Different controllers will never get the same device_id in a session. Every device_id remains reserved for the device that originally got it. For more info read http:// developers.airconsole.com/#/guides/device_ids_and_states
public GetDeviceId ( ) : int
리턴 int

GetMasterControllerDeviceId() 공개 메소드

Returns the device ID of the master controller.
public GetMasterControllerDeviceId ( ) : int
리턴 int

GetNickname() 공개 메소드

Returns the nickname of a user.
public GetNickname ( int device_id = -1 ) : string
device_id int The device id for which you want the nickname. Default is this device. Screens don't have nicknames.
리턴 string

GetPremiumDeviceIds() 공개 메소드

Returns all device Ids that are premium.
public GetPremiumDeviceIds ( ) : List
리턴 List

GetProfilePicture() 공개 메소드

Returns the url to a profile picture of a user.
public GetProfilePicture ( String uid, int size = 64 ) : string
uid String The uid for which you want a profile picture. Screens don't have profile pictures.
size int The size of in pixels of the picture. Default is 64.
리턴 string

GetProfilePicture() 공개 메소드

Returns the url to a profile picture of a user.
public GetProfilePicture ( int device_id = -1, int size = 64 ) : string
device_id int The device id for which you want a profile picture. Defaults to this device. Screens don't have profile pictures.
size int The size of in pixels of the picture. Default is 64.
리턴 string

GetServerTime() 공개 메소드

Returns the current time on the game server. This allows you to have a synchronized clock: You can send the servertime in a message to know exactly at what point something happened on a device.
public GetServerTime ( ) : long
리턴 long

GetUID() 공개 메소드

Returns the globally unique id of a device.
public GetUID ( int device_id = -1 ) : string
device_id int The device id for which you want the uid. Default is this device.
리턴 string

GetUrl() 공개 정적인 메소드

public static GetUrl ( StartMode mode ) : string
mode StartMode
리턴 string

IsAirConsoleUnityPluginReady() 공개 메소드

Determines whether the AirConsole Unity Plugin is ready. Use onReady event instead if possible.
public IsAirConsoleUnityPluginReady ( ) : bool
리턴 bool

IsPremium() 공개 메소드

Returns true if the device is premium
public IsPremium ( int device_id = -1 ) : bool
device_id int The device_id that should be checked. Only controllers can be premium. Default is this device.
리턴 bool

IsUserLoggedIn() 공개 메소드

Returns true if a user is logged in.
public IsUserLoggedIn ( int device_id = -1 ) : bool
device_id int
리턴 bool

Message() 공개 메소드

Sends a message to another device.
public Message ( int to, object data ) : void
to int The device ID to send the message to.
data object The data to send.
리턴 void

NavigateHome() 공개 메소드

Request that all devices return to the AirConsole store.
public NavigateHome ( ) : void
리턴 void

NavigateTo() 공개 메소드

Request that all devices load a game by url. Note that the custom DeviceStates are preserved. If you don't want that, override SetCustomDeviceState(null) on every device before calling this function.
public NavigateTo ( string url ) : void
url string
리턴 void

ProcessJS() 공개 메소드

public ProcessJS ( string data ) : void
data string
리턴 void

RequestHighScores() 공개 메소드

Requests high score data of players (including global high scores and friends). Will call onHighScores when data was received.
public RequestHighScores ( string level_name, string level_version, List uids = null, List ranks = null, int total = -1, int top = -1 ) : void
level_name string The name of the level.
level_version string The version of the level.
uids List An array of UIDs of the users should be included in the result. Default is all connected controllers.
ranks List An array of high score rank types. High score rank types can include data from across the world, only a specific area or a users friends. Valid array entries are "world", "country", "region", "city", "friends". Default is ["world"].
total int Amount of high scores to return per rank type. Default is 8.
top int Amount of top high scores to return per rank type. top is part of total. Default is 5.
리턴 void

RequestPersistentData() 공개 메소드

Requests persistent data from the servers. Will call onPersistentDataLoaded when data was received.
public RequestPersistentData ( List uids = null ) : void
uids List The uids for which you would like to request the persistent data. Default is this device.
리턴 void

SetActivePlayers() 공개 메소드

Takes all currently connected controllers and assigns them a player number. Can only be called by the screen. You don't have to use this helper function, but this mechanism is very convenient if you want to know which device is the first player, the second player, the third player ... The assigned player numbers always start with 0 and are consecutive. You can hardcode player numbers, but not device_ids. Once the screen has called setActivePlayers you can get the device_id of the first player by calling convertPlayerNumberToDeviceId(0), the device_id of the second player by calling convertPlayerNumberToDeviceId(1), ... You can also convert device_ids to player numbers by calling convertDeviceIdToPlayerNumber(device_id). You can get all device_ids that are active players by calling getActivePlayerDeviceIds(). The screen can call this function every time a game round starts.
public SetActivePlayers ( int max_players = -1 ) : void
max_players int
리턴 void

SetCustomDeviceState() 공개 메소드

Sets the custom DeviceState of this device.
public SetCustomDeviceState ( object data ) : void
data object The custom data to set.
리턴 void

SetCustomDeviceStateProperty() 공개 메소드

Sets a property in the custom DeviceState of this device.
public SetCustomDeviceStateProperty ( string key, object value ) : void
key string
value object
리턴 void

ShowAd() 공개 메소드

Requests that AirConsole shows a multiscreen advertisment. onAdShow is called on all connected devices if an advertisement is shown (in this event please mute all sounds). onAdComplete is called on all connected devices when the advertisement is complete or no advertisement was shown.
public ShowAd ( ) : void
리턴 void

ShowDefaultUI() 공개 메소드

Shows or hides the default UI.
public ShowDefaultUI ( bool visible ) : void
visible bool Whether to show or hide the default UI.
리턴 void

StoreHighScore() 공개 메소드

Stores a high score of the current user on the AirConsole servers. High scores may be returned to anyone. Do not include sensitive data. Only updates the high score if it was a higher or same score. Calls onHighScoreStored when the request is done. The name of the level the user was playing. This should be a human readable string because it appears in the high score sharing image. You can also just pass an empty string. The version of the level the user was playing. This is for your internal use. The score the user has achieved The UIDs of the users that achieved the high score. Custom high score data (e.g. can be used to implement Ghost modes or include data to verify that it is not a fake high score). A short human readable representation of the score. (e.g. "4 points in 3s"). Defaults to "X points" where x is the score converted to an integer.
public StoreHighScore ( string level_name, string level_version, float score, List uids, Newtonsoft.Json.Linq.JObject data = null, string score_string = null ) : void
level_name string
level_version string
score float
uids List
data Newtonsoft.Json.Linq.JObject
score_string string
리턴 void

StoreHighScore() 공개 메소드

Stores a high score of the current user on the AirConsole servers. High scores may be returned to anyone. Do not include sensitive data. Only updates the high score if it was a higher or same score. Calls onHighScoreStored when the request is done. The name of the level the user was playing. This should be a human readable string because it appears in the high score sharing image. You can also just pass an empty string. The version of the level the user was playing. This is for your internal use. The score the user has achieved The UID of the user that achieved the high score. Custom high score data (e.g. can be used to implement Ghost modes or include data to verify that it is not a fake high score). A short human readable representation of the score. (e.g. "4 points in 3s"). Defaults to "X points" where x is the score converted to an integer.
public StoreHighScore ( string level_name, string level_version, float score, string uid, Newtonsoft.Json.Linq.JObject data = null, string score_string = null ) : void
level_name string
level_version string
score float
uid string
data Newtonsoft.Json.Linq.JObject
score_string string
리턴 void

StorePersistentData() 공개 메소드

Stores a key-value pair persistently on the AirConsole servers. Storage is per game. Total storage can not exceed 1 MB per game and uid. Will call onPersistentDataStored when the request is done.
public StorePersistentData ( string key, JToken value, string uid = null ) : void
key string The key of the data entry.
value JToken The value of the data entry.
uid string The uid for which the data should be stored. Default is this device.
리턴 void

프로퍼티 상세

androidTvGameVersion 공개적으로 프로퍼티

public string androidTvGameVersion
리턴 string

androidUIResizeMode 공개적으로 프로퍼티

public AndroidUIResizeMode androidUIResizeMode
리턴 AndroidUIResizeMode

autoScaleCanvas 공개적으로 프로퍼티

public bool autoScaleCanvas
리턴 bool

browserStartMode 공개적으로 프로퍼티

public StartMode browserStartMode
리턴 StartMode

controllerHtml 공개적으로 프로퍼티

public Object,UnityEngine controllerHtml
리턴 UnityEngine.Object

webViewLoadingSprite 공개적으로 프로퍼티

public Sprite,UnityEngine webViewLoadingSprite
리턴 UnityEngine.Sprite