總覽
遊戲控制作業的 GCKCastChannel 子類別。
如需委派通訊協定,請參閱 GCKGameManagerChannelDelegate。
- Deprecated:
- 遊戲管理員 API 已停止支援,並將在日後推出的版本中移除。
沿用 GCKCastChannel。
執行個體方法摘要 | |
(instancetype) | - initWithSessionID: |
指定初始化器。更多... | |
(instancetype) | - init |
無法使用預設初始化程式。更多... | |
(NSInteger) | - sendPlayerAvailableRequest: |
傳送要求給接收器,將這個傳送器上最後使用的播放器設為 GCKPlayerStateAvailable 狀態。更多... | |
(NSInteger) | - sendPlayerAvailableRequest:playerID: |
傳送要求給接收器,將播放器設為 GCKPlayerStateAvailable 狀態。更多... | |
(NSInteger) | - sendPlayerReadyRequest: |
傳送要求給接收器,將這個傳送器上最後使用的播放器設為 GCKPlayerStateReady 狀態。更多... | |
(NSInteger) | - sendPlayerReadyRequest:playerID: |
傳送要求給接收器,將播放器設為 GCKPlayerStateReady 狀態。更多... | |
(NSInteger) | - sendPlayerPlayingRequest: |
傳送要求給接收器,將這個傳送器上最後使用的播放器設為 GCKPlayerStatePlaying 狀態。更多... | |
(NSInteger) | - sendPlayerPlayingRequest:playerID: |
傳送要求給接收器,將播放器設為 GCKPlayerStatePlaying 狀態。更多... | |
(NSInteger) | - sendPlayerIdleRequest: |
傳送要求給接收器,將這個傳送器上最後使用的播放器設為 GCKPlayerStateIdle 狀態。更多... | |
(NSInteger) | - sendPlayerIdleRequest:playerID: |
傳送要求給接收器,將播放器設為 GCKPlayerStateIdle 狀態。更多... | |
(NSInteger) | - sendPlayerQuitRequest: |
傳送要求給接收器,將這個傳送器上最後使用的播放器設為 GCKPlayerStateQuit 狀態。更多... | |
(NSInteger) | - sendPlayerQuitRequest:playerID: |
傳送要求給接收器,將播放器設為 GCKPlayerStateQuit 狀態。更多... | |
(NSInteger) | - sendGameRequest: |
將遊戲專屬訊息傳送給接收者。更多... | |
(NSInteger) | - sendGameRequest:playerID: |
將遊戲專屬訊息傳送給接收者。更多... | |
(void) | - sendGameMessage: |
將遊戲專屬訊息傳送給接收者。更多... | |
(void) | - sendGameMessage:playerID: |
將遊戲專屬訊息傳送給接收者。更多... | |
(instancetype) | - initWithNamespace: |
指定初始化器。更多... | |
(void) | - didReceiveTextMessage: |
當這個管道收到簡訊時,系統會呼叫此方法。更多... | |
(BOOL) | - sendTextMessage: |
在這個管道中傳送簡訊。更多... | |
(BOOL) | - sendTextMessage:error: |
在這個管道中傳送簡訊。更多... | |
(NSInteger) | - generateRequestID |
為新訊息產生要求 ID。更多... | |
(NSNumber *__nullable) | - generateRequestNumber |
這項便利方法會將 generateRequestID 的結果包裝在 NSNumber 中。更多... | |
(void) | - didConnect |
連線至這個管道時呼叫,表示現在可以透過這個管道與 Cast 裝置交換訊息。更多... | |
(void) | - didDisconnect |
Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel. 更多... | |
房源摘要 | |
id< GCKGameManagerChannelDelegate > | delegate |
接收 GCKGameManagerChannel 通知的委派對象。更多... | |
GCKGameManagerState * | currentState |
遊戲管理工具的目前狀態。更多... | |
NSString * | lastUsedPlayerID |
這個工作階段中使用的最後一個可控制的播放器 ID。更多... | |
BOOL | isInitialConnectionEstablished |
這個頻道是否已連結至接收端的遊戲管理工具,以及我們是否已準備好與其互動。更多... | |
NSString * | protocolNamespace |
頻道的命名空間。更多... | |
BOOL | isConnected |
這個標記用於指出頻道目前是否已連結。更多... | |
GCKDeviceManager * | deviceManager |
這個頻道註冊的裝置管理員 (如有)。更多... | |
方法詳細資料
- (instancetype) initWithSessionID: | (NSString *) | castSessionID |
指定初始化器。
自動連線至接收者的遊戲管理員。
- Parameters
-
castSessionID The Session ID corresponding to the currently connected Game Manager.
- (instancetype) init |
無法使用預設初始化程式。
實作 GCKCastChannel。
- (NSInteger) sendPlayerAvailableRequest: | (id __nullable) | extraData |
向接收器傳送要求,將這個傳送器上最後使用的播放器設為 GCKPlayerStateAvailable 狀態。
如果這不是該播放器的有效轉場效果,系統會在 GCKGameManagerChannelDelegate 中觸發錯誤。如果沒有上次使用的播放器,當接收器回應這項要求時,系統會註冊新播放器,並將其播放器 ID 設為上次使用的播放器 ID。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- 另請參閱
- lastUsedPlayerID
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerAvailableRequest: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
向接收器傳送要求,將播放器設為 GCKPlayerStateAvailable 狀態。
如果這不是該播放器的有效轉場效果,系統會在 GCKGameManagerChannelDelegate 中觸發錯誤。如果玩家 ID 是 nil
,系統會註冊新玩家,並在接收者回應這項要求時,將玩家 ID 設為上次使用的玩家 ID。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The player ID of the player whose state is to be changed.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerReadyRequest: | (id __nullable) | extraData |
向接收器傳送要求,將這個傳送器上最後使用的播放器設為 GCKPlayerStateReady 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- 另請參閱
- lastUsedPlayerID
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerReadyRequest: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
向接收器傳送要求,將播放器設為 GCKPlayerStateReady 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The player ID of the player to change the state.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerPlayingRequest: | (id __nullable) | extraData |
向接收器傳送要求,將這個傳送器上最後使用的播放器設為 GCKPlayerStatePlaying 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- 另請參閱
- lastUsedPlayerID
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerPlayingRequest: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
向接收器傳送要求,將播放器設為 GCKPlayerStatePlaying 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The player ID of the player to change the state.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerIdleRequest: | (id __nullable) | extraData |
向接收器傳送要求,將這個傳送器上最後使用的播放器設為 GCKPlayerStateIdle 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的遊戲管理工具,請透過 GCKGameManagerChannel::gameManagerChannel:requestDidFailWithID:error: 委派回呼傳送訊息。
- 另請參閱
- lastUsedPlayerID
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerIdleRequest: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
向接收器傳送要求,將播放器設為 GCKPlayerStateIdle 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The player ID of the player to change the state.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerQuitRequest: | (id __nullable) | extraData |
向接收器傳送要求,將這個傳送器上最後使用的播放器設為 GCKPlayerStateQuit 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- 另請參閱
- lastUsedPlayerID
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendPlayerQuitRequest: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
向接收器傳送要求,將播放器設為 GCKPlayerStateQuit 狀態。
如果這不是該玩家的有效轉移,或沒有上次使用的玩家 ID,GCKGameManagerChannelDelegate 會觸發錯誤。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的遊戲管理工具,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The player ID of the player to change the state.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendGameRequest: | (id __nullable) | extraData |
將遊戲專屬訊息傳送給接收者。
訊息內容完全由應用程式決定。訊息會來自 lastUsedPlayerID。接收者會透過 GCKGameManagerChannelDelegate 將回覆傳送給寄件者。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端 GameManager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (NSInteger) sendGameRequest: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
將遊戲專屬訊息傳送給接收者。
訊息內容完全由應用程式決定。訊息會來自 playerID
。如果 playerID
是 nil
,就會使用 lastUsedPlayerID。接收者會透過 GCKGameManagerChannelDelegate 將回覆傳送給寄件者。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The id of the controllable player sending this message.
- 傳回
- 要求 ID,或 kGCKInvalidRequestID (如果無法傳送要求)。
- (void) sendGameMessage: | (id __nullable) | extraData |
將遊戲專屬訊息傳送給接收者。
訊息內容完全由應用程式決定。訊息會來自 lastUsedPlayerID。這是「傳送後即忘」的方法,無法保證訊息已傳送,且接收者不會回覆寄件者。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- (void) sendGameMessage: | (id __nullable) | extraData | |
playerID: | (NSString *) | playerID | |
將遊戲專屬訊息傳送給接收者。
訊息內容完全由應用程式決定。訊息會來自指定的本機玩家 ID。這是「即發即忘」的方法,無法保證訊息會傳送成功,且接收者不會回覆訊息給寄件者。只有在 gameManagerChannelDidConnect: (GCKGameManagerChannelDelegate-p) 委派回呼已傳送訊息後,才能呼叫這個方法。如果 GCKGameManagerChannel 尚未連線至接收端的 Game Manager,則會傳送訊息給 gameManagerChannel:requestDidFailWithID:error: (GCKGameManagerChannelDelegate-p) 委派回呼。
- Parameters
-
extraData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.playerID The ID of the controllable player sending this message.
- (instancetype) initWithNamespace: | (NSString *) | protocolNamespace |
指定初始化器。
使用指定命名空間建構新的 GCKCastChannel。
- Parameters
-
protocolNamespace The namespace.
實作於 GCKGenericChannel。
- (void) didReceiveTextMessage: | (NSString *) | message |
當這個管道收到簡訊時,系統會呼叫此方法。
預設實作是免人工管理。
- Parameters
-
message The message.
- (BOOL) sendTextMessage: | (NSString *) | message |
透過這個管道傳送簡訊。
- Parameters
-
message The message.
- 傳回 如果訊息無法傳送 (因為管道未連線,或傳送緩衝區目前過於飽和),則為
NO
。YES
- Deprecated:
- 使用 sendTextMessage:error:,其中提供詳細的錯誤資訊。
- (BOOL) sendTextMessage: | (NSString *) | message | |
error: | (GCKError *__nullable *__nullable) | error | |
透過這個管道傳送簡訊。
- Parameters
-
message The message. error A pointer at which to store the error result. May be nil
.
- 傳回 如果訊息傳送成功,系統會顯示
YES
;如果無法傳送,則會顯示NO
。
- (NSInteger) generateRequestID |
為新訊息產生要求 ID。
- 傳回
- 產生的 ID,或 kGCKInvalidRequestID (如果頻道目前未連結)。
- (NSNumber * __nullable) generateRequestNumber |
這項便利方法會將 generateRequestID 的結果包裝在 NSNumber 中。
- 傳回
- 產生的 ID,或
nil
(如果頻道目前未連結)。
- (void) didConnect |
連線至這個管道時呼叫,表示現在可以透過這個管道與 Cast 裝置交換訊息。
預設實作是免人工管理。
- (void) didDisconnect |
這個管道已中斷連線時呼叫,表示無法再透過這個管道與 Cast 裝置交換訊息。
預設實作是免人工管理。
資源詳細資料
|
readwritenonatomicweak |
可接收「GCKGameManagerChannel」通知的代表。
|
readnonatomicstrong |
遊戲管理工具的目前狀態。
|
readnonatomiccopy |
|
readnonatomicassign |
這個頻道是否已連結至接收者的遊戲管理工具,以及我們是否已準備好與該頻道互動。
這個方法會從建立這個管道的時間點傳回 NO
。
- 傳回
YES
如果這個頻道已連線至接收端的遊戲管理員,且準備好互動;NO
否則。
|
readnonatomiccopyinherited |
頻道的命名空間。
|
readnonatomicassigninherited |
這個標記用於指出頻道目前是否已連結。
|
readnonatomicweakinherited |
這個頻道註冊的裝置管理員 (如有)。
- Deprecated:
- 如果這個管道未向已淘汰的 GCKDeviceManager 類別註冊,則為
nil
。