logo
On this page

ZegoRangeSceneItem

ZegoRangeSceneItem

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (BOOL)setEventHandler:(nullable id<ZegoRangeSceneItemEventHandler>) handler;
set range scene item event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRangeSceneItemEventHandler>The object used to receive range scene item callbacks.

Details

Set the callback function of the range scene item module.

  • When to call: After getting range scene item instance by [getRangeSceneItem].
  • Available since: 3.1.0

Return

The result of set range scene item event handler, true: success, false: fail.

createItem:callback:

createItem:callback:
- (int)createItem:(ZegoItemParam *) param callback:(nullable ZegoRangeSceneCreateItemCallback) callback;
Create item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
paramZegoItemParam *Item param.
callbacknullable ZegoRangeSceneCreateItemCallbackThe callback of create item.

Details

Create item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive login Scene success, before [logoutScene].
  • Caution: 1. Items belong to range scene, not a certain user. When a user successfully binds an item, it only means that the user has the temporary right to use the item. 2. An item is allowed to have one or more bound users, and the principle of first-come, first-served is followed when applying for bound items.
  1. When multiple users bind an item at the same time, their changes to the item follow the cas principle.
  2. When creating an item, it is allowed to specify whether to bind the item after the creation is successful.
  3. When the item is created successfully, users within the range of the item will receive the [onItemEnterView] callback notification.
  • Related APIs: Users can call [destroyItem] to destroy item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

destroyItem:callback:

destroyItem:callback:
- (int)destroyItem:(long long) itemID callback:(nullable ZegoRangeSceneDestroyItemCallback) callback;
Destroy item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
callbacknullable ZegoRangeSceneDestroyItemCallbackThe callback of destroy item.

Details

Destroy item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive after login Scene success , before [logoutScene].
  • Caution: When an item is destroyed, users within the range of the item will be notified by the [onItemLeaveView] callback.
  • Related APIs: Users can call [createItem] to create item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

bindItem:callback:

bindItem:callback:
- (int)bindItem:(long long) itemID callback:(nullable ZegoRangeSceneBindItemCallback) callback;
Bind item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
callbacknullable ZegoRangeSceneBindItemCallbackThe callback of bind item.

Details

Bind item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive after login Scene success, before [logoutScene].
  • Caution: When an item is successfully bound, users within the range of the item will be notified by the [onItemBindUpdate] callback.
  • Related APIs: Users can call [unbindItem] to unbind item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

unbindItem:callback:

unbindItem:callback:
- (int)unbindItem:(long long) itemID callback:(nullable ZegoRangeSceneUnbindItemCallback) callback;
Unbind item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
callbacknullable ZegoRangeSceneUnbindItemCallbackThe callback of unbind item.

Details

Unbind item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive [bindItem], before [logoutScene].
  • Caution: When an item is successfully unbound, users within the scope of the item will be notified by the [onItemUnbindUpdate] callback.
  • Related APIs: Users can call [bindItem] to bind item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateItemStatus:position:channel:status:callback:

updateItemStatus:position:channel:status:callback:
- (int)updateItemStatus:(long long) itemID position:(ZegoPosition *) position channel:(unsigned int) channel status:(NSData *) status callback:(nullable ZegoRangeSceneUpdateItemStatusCallback) callback;
Update item status.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
positionZegoPosition *Item's current location.
channelunsigned intThe channel to which the status belongs, starting from 0, cannot exceed the maximum channel number.
statusNSData *Current status data.
callbacknullable ZegoRangeSceneUpdateItemStatusCallbackThe callback of update item status.

Details

Developers can call this function to update the item status.

  • When to call: After [onBindItem], before [unbindItem].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateItemCommand:position:channel:command:callback:

updateItemCommand:position:channel:command:callback:
- (int)updateItemCommand:(long long) itemID position:(ZegoPosition *) position channel:(unsigned int) channel command:(NSData *) command callback:(nullable ZegoRangeSceneUpdateItemCommandCallback) callback;
Update item status.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
positionZegoPosition *Item's current location.
channelunsigned intThe channel to which the status belongs, starting from 0, cannot exceed the maximum channel number.
commandNSData *Next command data.
callbacknullable ZegoRangeSceneUpdateItemCommandCallbackThe callback of update item next command.

Details

Developers can call this function to update the item command.

  • When to call: After [onBindItem], before [unbindItem].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

Previous

zegorangesceneeventhandler

Next

zegorangesceneitemeventhandler

On this page

Back to top