Copyright (c) 2024 Tencent. All rights reserved.
Module: TUILiveBattleManager @ TUIKitEngine
Function: Live-Battle APIs
TUILiveBattleObserver
|
| Callback for received the battle start. |
| Callback for received tht battle end. |
| Callback for received user notification of joined the battle. |
| Callback for received user notification of exited the battle. |
| Callback for received score update notification of battle user. |
| Callback for received the battle invitation |
| Callback for canceled the connection invitation |
| Callback for timeout the battle invitation |
| Callback for accpeted the battle invitation |
| Callback for rejected the battle invitation |
TUILiveBattleManager
|
| Add event callback |
| Remove event callback |
| Request battle invitation. |
| Cancel request about battle invitation. |
| Accept the battle invitaion. |
| Reject the battle invitaion. |
| Exit the battle |
StructType
|
| Battle User Info |
| Battle Config |
| Battle Info |
EnumType
|
| Battle Request Status |
| Battle Stopped Reason |
onBattleStarted:
Callback for received the battle start.
|
battleInfo | Battle information. |
onBattleEnded:reason:
Callback for received tht battle end.
|
battleInfo | Battle information. |
reason | The reason why the PK ended. |
onUserJoinBattle:battleUser:
onUserJoinBattle:battleUser:
- (void)onUserJoinBattle: | |
| |
Callback for received user notification of joined the battle.
|
battleId | Battle ID. |
battleUser | |
onUserExitBattle:battleUser:
onUserExitBattle:battleUser:
- (void)onUserExitBattle: | |
| |
Callback for received user notification of exited the battle.
|
battleId | Battle ID. |
battleUser | |
onBattleScoreChanged:battleUserList:
onBattleScoreChanged:battleUserList:
- (void)onBattleScoreChanged: | |
| |
Callback for received score update notification of battle user.
|
battleId | Battle ID. |
battleUserList | |
onBattleRequestReceived:inviter:invitee:
onBattleRequestReceived:inviter:invitee:
- (void)onBattleRequestReceived: | |
| |
| |
Callback for received the battle invitation
|
battleInfo | Battle information. |
invitee | |
inviter | |
onBattleRequestCancelled:inviter:invitee:
onBattleRequestCancelled:inviter:invitee:
- (void)onBattleRequestCancelled: | |
| |
| |
Callback for canceled the connection invitation
|
battleInfo | Battle information. |
invitee | |
inviter | |
onBattleRequestTimeout:inviter:invitee:
onBattleRequestTimeout:inviter:invitee:
- (void)onBattleRequestTimeout: | |
| |
| |
Callback for timeout the battle invitation
|
battleInfo | Battle information. |
invitee | |
inviter | |
onBattleRequestAccept:inviter:invitee:
onBattleRequestAccept:inviter:invitee:
- (void)onBattleRequestAccept: | |
| |
| |
Callback for accpeted the battle invitation
|
battleInfo | Battle information. |
invitee | |
inviter | |
onBattleRequestReject:inviter:invitee:
onBattleRequestReject:inviter:invitee:
- (void)onBattleRequestReject: | |
| |
| |
Callback for rejected the battle invitation
|
battleInfo | Battle information. |
invitee | |
inviter | |
addObserver:
Add event callback
|
observer | The instance being listened to. |
removeObserver:
Remove event callback
|
observer | The instance being listened to. |
requestBattle:roomIdList:timeout:onSuccess:onError:
requestBattle:roomIdList:timeout:onSuccess:onError:
| |
| (NSArray<NSString *> *)roomIdList |
| |
| (TUIBattleRequestBlock)onSuccess |
| |
Request battle invitation.
|
config | Battle configuration. |
roomIdList | The list of room IDs will be invited. |
timeout | Timeout time. |
cancelBattleRequest:userIdList:onSuccess:onError:
cancelBattleRequest:userIdList:onSuccess:onError:
- (void)cancelBattleRequest: | |
| (NSArray<NSString *> *)userIdList |
| (TUISuccessBlock)onSuccess |
| |
Cancel request about battle invitation.
|
battleId | Battle ID. |
roomIdList | The list of room IDs whose battle requests will be canceled. |
acceptBattle:onSuccess:onError:
acceptBattle:onSuccess:onError:
| |
| (TUISuccessBlock)onSuccess |
| |
Accept the battle invitaion.
rejectBattle:onSuccess:onError:
rejectBattle:onSuccess:onError:
| |
| (TUISuccessBlock)onSuccess |
| |
Reject the battle invitaion.
exitBattle:onSuccess:onError:
exitBattle:onSuccess:onError:
| |
| (TUISuccessBlock)onSuccess |
| |
TUIBattleCode
Battle Request Status
|
TUIBattleCodeUnknown | -1 | default. |
TUIBattleCodeSuccess | 0 | Request success. |
TUIBattleCodeRoomNotExist | 1 | Request Room not exist. |
TUIBattleCodeBattling | 2 | The room you are invited to join the battle is already joined battle. |
TUIBattleCodeBattlingOtherRoom | 3 | The room you are invited to battle to is battling with other rooms. |
TUIBattleCodeRoomExit | 4 | The room is exited. |
TUIBattleCodeRetry | 5 | An internal error occurs. You are advised to try again. |
TUIBattleStoppedReason
Battle Stopped Reason
|
TUIBattleStoppedReasonTimeOver | 0 | The Battle reaches the maximum duration and the timeout ends. |
TUIBattleStoppedReasonOtherExit | 1 | The rest of the users has exited. |
TUIBattleUser
Battle User Info
|
avatarUrl | The user avatar url of the battle user. |
roomId | The room id of the battle user. |
score | The score of the battle user. |
userId | The user id of the battle user. |
userName | The user name of the battle user. |
TUIBattleConfig
Battle Config
|
duration | The maximum duration of the battle (Unit: seconds). |
extensionInfo | The extension information of battle. |
needResponse | Whether the invited user needs to reply accept/reject. |
TUIBattleInfo
Battle Info
|
battleId | Battle ID. |
config | The configuration of battle. |
endTime | The timestamp marking the end of the battle (Unit: seconds). |
inviteeList | The people who are invited to join the battle. |
inviter | The person who requests the battle. |
startTime | The timestamp marking the start of the battle (Unit: seconds). |