UNPKG

xverse-components-room

Version:

xverse components room

165 lines (164 loc) 3.93 kB
import { ISnippet } from '@xverse/matrix-shared-types'; export type { IUpdateRoom } from './utils'; /** * @title 3D房间配置 */ export interface IRoomInfo { /** * @title 房间ID * @setter RoomIdSetter * @banExpression */ roomId: string; /** * @title 皮肤ID * @description 进入该3D房间要切换的 皮肤ID * @setter SkinIdSetter */ skinId?: string; /** * @title 路径ID * @description 进入该3D房间要切换的 PathId * @setter PathIdSetter */ pathId?: string; /** * @title 显隐规则ID(高阶) * @description PathId 如果拍了显隐规则,则必填 * @notExternal */ combinationId?: string; /** * @title 传送点 * @description 设置会覆盖默认的出生点 * @setter PointIdSetter */ pointId?: string; /** * @title 是否展示摇杆 * @default true */ joystick?: boolean; /** * @title 全景图的资产ID * @description 当开启全景图进房时需要绑定全景图的bomId * @setter AssetMediaSetter * @notExternal */ localTextureBomId?: string; /** * @title 全景图的分辨率 * @description 当开启全景图进房时,需要选择全景图的分辨率,默认8K * @default 8K * @notExternal */ localTextureResolution?: '4K' | '2K' | '8K'; /** * @title 是否保持当前在3D场景中的位置 * @default false * @notExternal */ keepCurrentPosition?: boolean; /** * @title 玩家自身显隐 * @default true * @description 玩家是否显示 */ playerVisibility?: boolean; /** * @title 控制玩家自身在别人设备的显隐 * @default true * @description false则表示玩家在别人设备上是隐藏不可见状态 */ syncVisibility?: boolean; /** * @title 是否展示其他玩家 * @default true * @description 如果不想展示其他玩家,可设置为false */ avatarVisibility?: boolean; } /** * @componentName Room * @title 3D房间 * @type 3D * @description 每个World包含多个房间, 每次只会展示一个房间 * @contributor 钟跃 * @parentWhitelist World * @hasChildren */ export interface IRoomProps { /** * @title 预加载组件 * @setter OwnChildComponentIdSetter */ preloadComponent?: React.ReactElement; /** * @title 3D房间配置 * @description 默认的roomInfo(包含pathId等) * @excludeKeys keepCurrentPosition */ defaultRoomInfo: IRoomInfo; /** * @title 进房开始事件 * @notExternal */ onBeforeEnter?: () => void; /** * @title 进房成功事件 */ onEnterSuccess?: () => void; /** * @title 进房失败事件 * @notExternal */ onEnterError?: (error: IRoomError | void) => void; /** * @title 改变3D开始事件 * @notExternal */ onBeforeChange3D?: () => void; /** * @title 改变3D成功事件 * @notExternal */ onChange3DSuccess?: () => void; /** * @title 改变3D失败事件 * @notExternal */ onChange3DError?: (error?: IRoomError | void) => void; /** * @title 重新排队事件 * @notExternal */ onReQueue?: () => void; } export declare enum ERoomErrorType { /** * room预加载失败 */ ROOM_PRELOAD_ERROR = 0, /** * room进房失败 */ ROOM_ENTER_ERROR = 1, /** * room 更新场景报错 */ ROOM_CHANGE_SCENE_ERROR = 2 } /** *@title Room 错误信息格式 */ export interface IRoomError { roomId?: string; type: ERoomErrorType; code?: number; message?: string | any; } export declare const snippet: ISnippet; export interface IChangeRoomCustomProps { key: string; roomInfo?: IRoomInfo; }