@zeewain/3d-avatar-sdk 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +6 -5
  2. package/dist/assets/Build/webgl.data.unityweb +0 -0
  3. package/dist/assets/Build/webgl.framework.js.unityweb +0 -0
  4. package/dist/assets/Build/webgl.wasm.unityweb +0 -0
  5. package/dist/examples/test-umd/index.html +762 -0
  6. package/dist/examples/test-vue2/.eslintignore +45 -0
  7. package/dist/examples/test-vue2/.eslintrc.js +174 -0
  8. package/dist/examples/test-vue2/.stylelintignore +50 -0
  9. package/dist/examples/test-vue2/.stylelintrc.js +79 -0
  10. package/dist/examples/test-vue2/README.md +139 -0
  11. package/dist/examples/test-vue2/babel.config.js +14 -0
  12. package/dist/examples/test-vue2/package.json +53 -0
  13. package/dist/examples/test-vue2/pnpm-lock.yaml +8776 -0
  14. package/dist/examples/test-vue2/public/index.html +19 -0
  15. package/dist/examples/test-vue2/setup.js +170 -0
  16. package/dist/examples/test-vue2/src/App.vue +943 -0
  17. package/dist/examples/test-vue2/src/components/BroadcastAPI.vue +666 -0
  18. package/dist/examples/test-vue2/src/components/CameraAPI.vue +414 -0
  19. package/dist/examples/test-vue2/src/components/GlobalConfig.vue +200 -0
  20. package/dist/examples/test-vue2/src/components/InfoCards.vue +294 -0
  21. package/dist/examples/test-vue2/src/components/InitAPI.vue +334 -0
  22. package/dist/examples/test-vue2/src/components/LogPanel.vue +249 -0
  23. package/dist/examples/test-vue2/src/components/MotionControlAPI.vue +400 -0
  24. package/dist/examples/test-vue2/src/components/UnityPreview.vue +201 -0
  25. package/dist/examples/test-vue2/src/main.js +16 -0
  26. package/dist/examples/test-vue2/vue.config.js +41 -0
  27. package/dist/examples/test-vue3/.eslintrc +3 -0
  28. package/dist/examples/test-vue3/.stylelintignore +3 -0
  29. package/dist/examples/test-vue3/.stylelintrc +48 -0
  30. package/dist/examples/test-vue3/README.md +236 -0
  31. package/dist/examples/test-vue3/env.d.ts +8 -0
  32. package/dist/examples/test-vue3/index.html +95 -0
  33. package/dist/examples/test-vue3/package.json +55 -0
  34. package/dist/examples/test-vue3/pnpm-lock.yaml +4636 -0
  35. package/dist/examples/test-vue3/setup.js +167 -0
  36. package/dist/examples/test-vue3/src/App.vue +962 -0
  37. package/dist/examples/test-vue3/src/components/BroadcastAPI.vue +636 -0
  38. package/dist/examples/test-vue3/src/components/CameraAPI.vue +376 -0
  39. package/dist/examples/test-vue3/src/components/GlobalConfig.vue +213 -0
  40. package/dist/examples/test-vue3/src/components/InfoCards.vue +288 -0
  41. package/dist/examples/test-vue3/src/components/InitAPI.vue +339 -0
  42. package/dist/examples/test-vue3/src/components/LogPanel.vue +236 -0
  43. package/dist/examples/test-vue3/src/components/MotionControlAPI.vue +373 -0
  44. package/dist/examples/test-vue3/src/components/UnityPreview.vue +189 -0
  45. package/dist/examples/test-vue3/src/main.ts +12 -0
  46. package/dist/examples/test-vue3/src/types.ts +9 -0
  47. package/dist/examples/test-vue3/tsconfig.json +44 -0
  48. package/dist/examples/test-vue3/tsconfig.node.json +14 -0
  49. package/dist/examples/test-vue3/vite.config.ts +75 -0
  50. package/dist/index.d.ts +142 -132
  51. package/dist/index.es5.js +93 -41
  52. package/dist/index.es5.umd.js +93 -41
  53. package/dist/index.esm.js +101 -42
  54. package/dist/index.umd.cjs +101 -42
  55. package/package.json +4 -3
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <el-card class="unity-preview" shadow="hover">
3
+ <template #header>
4
+ <div class="card-header">
5
+ <span>Unity 预览</span>
6
+ <el-tag v-if="sdkStatus.unityLoaded" type="success" size="default">已加载</el-tag>
7
+ <el-tag v-else type="info" size="default">未加载</el-tag>
8
+ </div>
9
+ </template>
10
+
11
+ <div class="unity-container-wrapper" v-loading="sdkStatus.unityLoaded && !sdkStatus.avatarLoaded && loadingProgress === 1" element-loading-text="数字人加载中,请稍候..." element-loading-background="rgba(0, 0, 0, 0)">
12
+ <div id="unity-container" class="unity-container">
13
+ <div v-if="!sdkStatus.unityLoaded" class="unity-tip">
14
+ <i class="el-icon-monitor"></i>
15
+ <p>Unity 内容将在此处加载...</p>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="unity-controls">
21
+ <el-button-group>
22
+ <el-button
23
+ type="warning"
24
+ size="default"
25
+ icon="close"
26
+ :disabled="!sdkStatus.avatarLoaded"
27
+ @click="handleUnloadAvatar"
28
+ >
29
+ 卸载Avatar
30
+ </el-button>
31
+ <el-button
32
+ type="danger"
33
+ size="default"
34
+ icon="delete"
35
+ :disabled="!sdkStatus.unityLoaded"
36
+ @click="handleDestroySDK"
37
+ >
38
+ 销毁实例
39
+ </el-button>
40
+ </el-button-group>
41
+ </div>
42
+
43
+ <!-- 加载进度显示 -->
44
+ <div v-if="loadingProgress > 0 && loadingProgress < 1" class="loading-progress">
45
+ <el-progress
46
+ :percentage="Math.round(loadingProgress * 100)"
47
+ :stroke-width="6"
48
+ text-inside
49
+ />
50
+ <p class="progress-text">Unity 加载中,请稍候...</p>
51
+ </div>
52
+ </el-card>
53
+ </template>
54
+
55
+ <script setup lang="ts">
56
+ import { defineProps, defineEmits } from 'vue';
57
+
58
+ interface ISDKStatus {
59
+ unityLoaded: boolean;
60
+ avatarLoaded: boolean;
61
+ }
62
+
63
+ const props = defineProps<{
64
+ sdkStatus: ISDKStatus;
65
+ loadingProgress: number;
66
+ }>();
67
+
68
+ const emit = defineEmits<{
69
+ (e: 'unload-avatar'): void;
70
+ (e: 'destroy-sdk'): void;
71
+ }>();
72
+
73
+ function handleUnloadAvatar() {
74
+ emit('unload-avatar');
75
+ }
76
+
77
+ function handleDestroySDK() {
78
+ emit('destroy-sdk');
79
+ }
80
+ </script>
81
+
82
+ <style lang="scss" scoped>
83
+ // Unity预览
84
+ .unity-preview {
85
+ position: relative;
86
+ display: flex;
87
+ width: 100%;
88
+ height: 100%;
89
+ overflow: hidden;
90
+ flex-direction: column;
91
+ .card-header {
92
+ display: flex;
93
+ justify-content: space-between;
94
+ align-items: center;
95
+ font-weight: 600;
96
+ }
97
+ :deep(.el-card__body) {
98
+ display: flex;
99
+ width: 100%;
100
+ height: 100%;
101
+ flex-direction: column;
102
+ box-sizing: border-box;
103
+ }
104
+ .unity-container-wrapper {
105
+ position: relative;
106
+ width: 100%;
107
+ max-height: 600px; // 添加最大高度限制
108
+ margin-bottom: 15px;
109
+ overflow: hidden; // 防止内容溢出
110
+ flex: 1;
111
+ }
112
+ .unity-container {
113
+ position: relative;
114
+ width: 100%;
115
+ height: 100%;
116
+ max-height: 100%; // 确保不超过父容器
117
+ overflow: hidden;
118
+ background-color: #000;
119
+ border-radius: 4px;
120
+ }
121
+ .unity-tip {
122
+ position: absolute;
123
+ top: 50%;
124
+ left: 50%;
125
+ color: white; // 确保在黑色背景上文字可见
126
+ text-align: center;
127
+ transform: translate(-50%, -50%);
128
+ i {
129
+ margin-bottom: 10px;
130
+ font-size: 48px;
131
+ }
132
+ p {
133
+ margin: 0;
134
+ font-size: 14px;
135
+ }
136
+ }
137
+ .unity-controls {
138
+ display: flex;
139
+ justify-content: center;
140
+ padding-top: 10px;
141
+ }
142
+ .loading-progress {
143
+ position: absolute;
144
+ top: 50%;
145
+ left: 50%;
146
+ width: 80%;
147
+ transform: translate(-50%, -50%);
148
+ text-align: center;
149
+ z-index: 10;
150
+ .progress-text {
151
+ color: white;
152
+ margin-top: 10px;
153
+ font-size: 14px;
154
+ }
155
+ }
156
+ }
157
+
158
+ // 移动端优化
159
+ @media screen and (width <= 768px) {
160
+ .unity-preview {
161
+ .unity-container-wrapper {
162
+ height: 250px;
163
+ max-height: 250px; // 确保移动端不会超过设定高度
164
+ flex: none;
165
+ overflow: hidden; // 防止内容溢出
166
+ }
167
+ .unity-controls {
168
+ .el-button-group {
169
+ display: flex;
170
+ flex-direction: column;
171
+ .el-button {
172
+ margin: 2px 0;
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+
179
+ // 平板端优化
180
+ @media screen and (width <= 992px) and (width > 768px) {
181
+ .unity-preview {
182
+ .unity-container-wrapper {
183
+ height: 300px; // 平板端适中高度
184
+ max-height: 300px; // 确保平板端不会超过设定高度
185
+ overflow: hidden; // 防止内容溢出
186
+ }
187
+ }
188
+ }
189
+ </style>
@@ -0,0 +1,12 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+
4
+ // Element Plus 样式
5
+ import 'element-plus/dist/index.css'
6
+
7
+ // 创建Vue应用实例
8
+ const app = createApp(App)
9
+
10
+ // 挂载应用
11
+ app.mount('#app')
12
+
@@ -0,0 +1,9 @@
1
+ export interface IGlobalConfig {
2
+ token: string;
3
+ avatarCode: string;
4
+ env: 'dev' | 'test' | 'prod' | 'custom';
5
+ webglPath?:string;
6
+ apiBaseUrl?:string;
7
+ resourcesUrl?:string;
8
+ idleMotionListString?:string;
9
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "Node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "esModuleInterop": true,
13
+ "lib": [
14
+ "ESNext",
15
+ "DOM"
16
+ ],
17
+ "skipLibCheck": true,
18
+ "baseUrl": "./",
19
+ "paths": {
20
+ "@/*": [
21
+ "src/*"
22
+ ],
23
+ "#/*": [
24
+ "typings/*"
25
+ ]
26
+ },
27
+ "types": [
28
+ "vite/client", // https://cn.vitejs.dev/guide/features.html#typescript-compiler-options
29
+ "element-plus/global",
30
+ ]
31
+ },
32
+ "include": [
33
+ "src/**/*.ts",
34
+ "src/**/*.d.ts",
35
+ "src/**/*.tsx",
36
+ "src/**/*.vue",
37
+ "typings/**/*.d.ts"
38
+ ],
39
+ "references": [
40
+ {
41
+ "path": "./tsconfig.node.json"
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "esModuleInterop": true,
7
+ "resolveJsonModule": true
8
+ },
9
+ "include": [
10
+ "package.json",
11
+ "vite.config.ts",
12
+ "vite/**/*.ts"
13
+ ]
14
+ }
@@ -0,0 +1,75 @@
1
+ import { resolve } from 'path';
2
+ import { URL, fileURLToPath } from 'node:url';
3
+ import { defineConfig, loadEnv } from 'vite';
4
+ import vue from '@vitejs/plugin-vue';
5
+ import AutoImport from 'unplugin-auto-import/vite';
6
+ import Components from 'unplugin-vue-components/vite';
7
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
8
+
9
+ // https://vitejs.dev/config/
10
+ export default defineConfig(({ mode, command }) =>
11
+ {
12
+ // 加载环境变量
13
+ const env = loadEnv(mode, process.cwd(), '');
14
+
15
+ // 检查是否使用本地SDK开发模式
16
+ const useLocalSDK = env.VITE_USE_LOCAL_SDK === 'true';
17
+ const localSDKPath = resolve(fileURLToPath(new URL('.', import.meta.url)), '../../dist/index.esm.js');
18
+
19
+ console.log('🔧 Vite 配置信息:');
20
+ console.log(` - 运行模式: ${mode}`);
21
+ console.log(` - 使用本地 SDK: ${useLocalSDK ? '✅ 是' : '❌ 否'}`);
22
+ if (useLocalSDK)
23
+ {
24
+ console.log(` - 本地 SDK 路径: ${localSDKPath}`);
25
+ console.log(' - 运行模式: 开发模式');
26
+ }
27
+ else
28
+ {
29
+ console.log(' - 运行模式: npm包模式');
30
+ }
31
+
32
+ return {
33
+ base: env.VITE_PUBLIC_PATH || './',
34
+ plugins: [
35
+ vue(),
36
+ AutoImport({
37
+ resolvers: [ElementPlusResolver()],
38
+ imports: [
39
+ 'vue',
40
+ '@vueuse/core'
41
+ ],
42
+ dts: true
43
+ }),
44
+ Components({
45
+ resolvers: [ElementPlusResolver()],
46
+ dts: true
47
+ })
48
+ ],
49
+ resolve: {
50
+ alias: {
51
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
52
+ // 如果启用本地开发模式,将 SDK 指向本地构建版本
53
+ ...(useLocalSDK && {
54
+ '@zeewain/3d-avatar-sdk': localSDKPath
55
+ })
56
+ }
57
+ },
58
+ server: {
59
+ open: true,
60
+ port: 20054,
61
+ proxy: {
62
+ '/proxy': {
63
+ target: env.VITE_APP_API_BASEURL,
64
+ changeOrigin: command === 'serve' && env.VITE_OPEN_PROXY === 'true',
65
+ rewrite: path => path.replace(/\/proxy/, '')
66
+ }
67
+ }
68
+
69
+ },
70
+ build: {
71
+ outDir: mode === 'production' ? 'dist' : `dist-${mode}`,
72
+ sourcemap: false,
73
+ }
74
+ }
75
+ });
package/dist/index.d.ts CHANGED
@@ -27,40 +27,6 @@ interface IUnityInstance {
27
27
  SetFullscreen?(fullscreen: boolean): void;
28
28
  }
29
29
 
30
- /**
31
- * @fileoverview SDK配置接口定义
32
- * @description 定义SDK实例初始化所需的配置参数
33
- */
34
- /**
35
- * SDK配置接口
36
- * @interface IAvatarSDKConfig
37
- * @description 定义SDK实例初始化所需的配置参数
38
- */
39
- interface IAvatarSDKConfig {
40
- /** 全局用户认证令牌 */
41
- token?: string;
42
- /** 运行环境 */
43
- env?: 'dev' | 'test' | 'prod' | 'custom';
44
- /** api接口地址,仅当env为custom时有效 */
45
- apiUrl?: string;
46
- /** AB资源文件地址 */
47
- resourcesUrl?: string;
48
- /** Unity加载器脚本URL */
49
- loaderUrl: string;
50
- /** Unity数据文件URL */
51
- dataUrl: string;
52
- /** Unity框架文件URL */
53
- frameworkUrl: string;
54
- /** Unity代码文件URL */
55
- codeUrl: string;
56
- /** 容器DOM元素ID,可选,默认为'unity-container' */
57
- containerId?: string;
58
- /** 待机动作编码列表,随机播放(排重方式)可选 */
59
- idleMotionList?: string[];
60
- /** 3D渲染引擎加载进度回调函数,可选 */
61
- onProgress?: (progress: number) => void;
62
- }
63
-
64
30
  /**
65
31
  * @fileoverview Unity服务基础类型定义
66
32
  * @description 定义Unity服务的通用接口和类型,为所有Unity服务提供统一的基础类型
@@ -175,94 +141,6 @@ interface IUnityLogger {
175
141
  error(message: string, error?: Error, data?: any): void;
176
142
  }
177
143
 
178
- /**
179
- * @fileoverview Avatar API接口定义
180
- * @description 定义数字人控制API的核心接口、类型和枚举
181
- */
182
-
183
- /**
184
- * Avatar操作类型枚举
185
- * @enum {string}
186
- * @description 定义Avatar服务支持的操作类型
187
- */
188
- declare enum AvatarOperationType {
189
- INITIALIZE_AVATAR = "initializeAvatar",
190
- PLAY_MOTION = "playMotion",
191
- GET_CURRENT_MOTION = "getCurrentMotion",
192
- UNLOAD_AVATAR = "unloadAvatar",
193
- SET_CAMERA = "setCamera"
194
- }
195
- /**
196
- * Avatar摄像机类型枚举
197
- * @enum {string}
198
- * @description 定义Avatar支持的摄像机类型
199
- */
200
- declare enum AvatarCameraType {
201
- WHOLE = "whole",
202
- HALF = "half",
203
- FACE = "face"
204
- }
205
- /**
206
- * Avatar回调响应接口
207
- * @interface IAvatarCallbackResponse
208
- * @extends {IUnityCallbackResponse}
209
- * @description 定义Avatar操作的回调响应格式,扩展基础响应接口
210
- */
211
- interface IAvatarCallbackResponse extends IUnityCallbackResponse {
212
- data?: {
213
- /** 动作ID,可选 */
214
- motionId?: string;
215
- /** 动作剩余时间,可选 */
216
- motionRemainingTime?: number;
217
- };
218
- }
219
- /**
220
- * Avatar API接口
221
- * @interface IAvatarAPI
222
- * @description 定义数字人控制API的核心接口,包含数字人初始化、动作控制、摄像机设置等功能
223
- */
224
- interface IAvatarAPI {
225
- /**
226
- * 初始化数字人
227
- * @param avatarCode - 数字人编码
228
- * @param cameraType - 摄像机类型,默认为'whole'
229
- * @returns Promise<IAvatarCallbackResponse> 初始化操作的Promise
230
- */
231
- initializeAvatar(avatarCode: string, cameraType?: AvatarCameraType): Promise<IAvatarCallbackResponse>;
232
- /**
233
- * 播放数字人动作
234
- * @param clipCode - 动作编码
235
- * @returns Promise<IAvatarCallbackResponse> 播放操作的Promise
236
- */
237
- playMotion(clipCode: string): Promise<IAvatarCallbackResponse>;
238
- /**
239
- * 获取当前播放的动作信息
240
- * @param getRemainingTime - 是否获取剩余时间
241
- * @returns Promise<IAvatarCallbackResponse> 获取操作的Promise
242
- */
243
- getCurrentMotion(getRemainingTime: boolean): Promise<IAvatarCallbackResponse>;
244
- /**
245
- * 卸载数字人
246
- * @returns Promise<IAvatarCallbackResponse> 卸载操作的Promise
247
- */
248
- unloadAvatar(): Promise<IAvatarCallbackResponse>;
249
- /**
250
- * 设置摄像机类型
251
- * @param cameraType - 摄像机类型
252
- * @returns Promise<IAvatarCallbackResponse> 设置操作的Promise
253
- */
254
- setCamera(cameraType: AvatarCameraType): Promise<IAvatarCallbackResponse>;
255
- /**
256
- * 批量执行Avatar操作
257
- * @param operations - 操作数组
258
- * @returns Promise<IAvatarCallbackResponse[]> 返回所有操作的结果
259
- */
260
- batchExecute(operations: Array<{
261
- method: keyof IAvatarAPI;
262
- params: any[];
263
- }>): Promise<IAvatarCallbackResponse[]>;
264
- }
265
-
266
144
  /**
267
145
  * @fileoverview 流式播报服务接口定义
268
146
  * @description 定义流式播报服务相关的类型、接口和枚举
@@ -436,6 +314,133 @@ interface IBroadcastAPI {
436
314
  destroy(): void;
437
315
  }
438
316
 
317
+ /**
318
+ * @fileoverview SDK配置接口定义
319
+ * @description 定义SDK实例初始化所需的配置参数
320
+ */
321
+
322
+ /**
323
+ * SDK配置接口
324
+ * @interface IAvatarSDKConfig
325
+ * @description 定义SDK实例初始化所需的配置参数
326
+ */
327
+ interface IAvatarSDKConfig {
328
+ /** 全局用户认证令牌 */
329
+ token?: string;
330
+ /** 运行环境 */
331
+ env?: 'dev' | 'test' | 'prod' | 'custom';
332
+ /** api接口地址,仅当env为custom时有效 */
333
+ apiUrl?: string;
334
+ /** 资源文件地址,仅当env为custom时有效 */
335
+ assetsUrl?: string;
336
+ /** AB资源文件地址 */
337
+ resourcesUrl?: string;
338
+ /** Unity加载器脚本URL */
339
+ loaderUrl: string;
340
+ /** Unity数据文件URL */
341
+ dataUrl: string;
342
+ /** Unity框架文件URL */
343
+ frameworkUrl: string;
344
+ /** Unity代码文件URL */
345
+ codeUrl: string;
346
+ /** 容器DOM元素ID,可选,默认为'unity-container' */
347
+ containerId?: string;
348
+ /** 待机动作编码列表,随机播放(排重方式)可选 */
349
+ idleMotionList?: string[];
350
+ /** 3D渲染引擎加载进度回调函数,可选 */
351
+ onProgress?: (progress: number) => void;
352
+ /** 播报回调函数,可选 */
353
+ broadcastCallbacks?: IBroadcastCallbacks;
354
+ }
355
+
356
+ /**
357
+ * @fileoverview Avatar API接口定义
358
+ * @description 定义数字人控制API的核心接口、类型和枚举
359
+ */
360
+
361
+ /**
362
+ * Avatar操作类型枚举
363
+ * @enum {string}
364
+ * @description 定义Avatar服务支持的操作类型
365
+ */
366
+ declare enum AvatarOperationType {
367
+ INITIALIZE_AVATAR = "initializeAvatar",
368
+ PLAY_MOTION = "playMotion",
369
+ GET_CURRENT_MOTION = "getCurrentMotion",
370
+ UNLOAD_AVATAR = "unloadAvatar",
371
+ SET_CAMERA = "setCamera"
372
+ }
373
+ /**
374
+ * Avatar摄像机类型枚举
375
+ * @enum {string}
376
+ * @description 定义Avatar支持的摄像机类型
377
+ */
378
+ declare enum AvatarCameraType {
379
+ WHOLE = "whole",
380
+ HALF = "half",
381
+ FACE = "face"
382
+ }
383
+ /**
384
+ * Avatar回调响应接口
385
+ * @interface IAvatarCallbackResponse
386
+ * @extends {IUnityCallbackResponse}
387
+ * @description 定义Avatar操作的回调响应格式,扩展基础响应接口
388
+ */
389
+ interface IAvatarCallbackResponse extends IUnityCallbackResponse {
390
+ data?: {
391
+ /** 动作ID,可选 */
392
+ motionId?: string;
393
+ /** 动作剩余时间,可选 */
394
+ motionRemainingTime?: number;
395
+ };
396
+ }
397
+ /**
398
+ * Avatar API接口
399
+ * @interface IAvatarAPI
400
+ * @description 定义数字人控制API的核心接口,包含数字人初始化、动作控制、摄像机设置等功能
401
+ */
402
+ interface IAvatarAPI {
403
+ /**
404
+ * 初始化数字人
405
+ * @param avatarCode - 数字人编码
406
+ * @param cameraType - 摄像机类型,默认为'whole'
407
+ * @returns Promise<IAvatarCallbackResponse> 初始化操作的Promise
408
+ */
409
+ initializeAvatar(avatarCode: string, cameraType?: AvatarCameraType): Promise<IAvatarCallbackResponse>;
410
+ /**
411
+ * 播放数字人动作
412
+ * @param clipCode - 动作编码
413
+ * @returns Promise<IAvatarCallbackResponse> 播放操作的Promise
414
+ */
415
+ playMotion(clipCode: string): Promise<IAvatarCallbackResponse>;
416
+ /**
417
+ * 获取当前播放的动作信息
418
+ * @param getRemainingTime - 是否获取剩余时间
419
+ * @returns Promise<IAvatarCallbackResponse> 获取操作的Promise
420
+ */
421
+ getCurrentMotion(getRemainingTime: boolean): Promise<IAvatarCallbackResponse>;
422
+ /**
423
+ * 卸载数字人
424
+ * @returns Promise<IAvatarCallbackResponse> 卸载操作的Promise
425
+ */
426
+ unloadAvatar(): Promise<IAvatarCallbackResponse>;
427
+ /**
428
+ * 设置摄像机类型
429
+ * @param cameraType - 摄像机类型
430
+ * @returns Promise<IAvatarCallbackResponse> 设置操作的Promise
431
+ */
432
+ setCamera(cameraType: AvatarCameraType): Promise<IAvatarCallbackResponse>;
433
+ /**
434
+ * 批量执行Avatar操作
435
+ * @param operations - 操作数组
436
+ * @returns Promise<IAvatarCallbackResponse[]> 返回所有操作的结果
437
+ */
438
+ batchExecute(operations: Array<{
439
+ method: keyof IAvatarAPI;
440
+ params: any[];
441
+ }>): Promise<IAvatarCallbackResponse[]>;
442
+ }
443
+
439
444
  /**
440
445
  * @fileoverview 统一的3D数字人SDK入口类
441
446
  * @description 提供统一的SDK接口,内部通过组合模式调用各个服务模块
@@ -716,7 +721,6 @@ declare class AvatarService extends UnityBaseService<AvatarOperationType> implem
716
721
  protected get callbackFunctionName(): string;
717
722
  /**
718
723
  * 构造函数
719
- * @param unityInstance - Unity实例对象
720
724
  * @param config - 可选的服务配置,用于覆盖默认配置
721
725
  * @description 初始化Avatar API,设置Unity实例和配置
722
726
  * @example
@@ -952,13 +956,6 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
952
956
  destroy(): void;
953
957
  /** 全局回调函数名称 */
954
958
  protected get callbackFunctionName(): string;
955
- /**
956
- * 获取API基础URL
957
- * @returns string 返回当前环境的API基础URL
958
- * @description 根据当前环境配置获取API基础URL
959
- * @private
960
- */
961
- private getApiBaseUrl;
962
959
  /**
963
960
  * 获取播报API路径
964
961
  * @param type - 播报类型
@@ -983,6 +980,13 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
983
980
  * @private
984
981
  */
985
982
  private handleError;
983
+ /**
984
+ * 处理播报错误
985
+ * @param errorCode - 错误码
986
+ * @description 处理播报过程中的错误
987
+ * @private
988
+ */
989
+ private handleBroadcastError;
986
990
  }
987
991
 
988
992
  /**
@@ -1016,7 +1020,7 @@ declare enum NetworkErrorCode {
1016
1020
  CONNECTION_FAILED = 1001,
1017
1021
  /** 请求超时 */
1018
1022
  REQUEST_TIMEOUT = 1002,
1019
- /** 服务器错误 */
1023
+ /** 服务错误 */
1020
1024
  SERVER_ERROR = 1003,
1021
1025
  /** 未授权访问 */
1022
1026
  UNAUTHORIZED = 1004
@@ -1036,7 +1040,13 @@ declare enum OperationErrorCode {
1036
1040
  /** 操作超时 */
1037
1041
  OPERATION_TIMEOUT = 2004,
1038
1042
  /** 操作被取消 */
1039
- OPERATION_CANCELLED = 2005
1043
+ OPERATION_CANCELLED = 2005,
1044
+ /** 用户权益额度不存在 */
1045
+ BROADCAST_EQUITY_NOT_EXIST = 2006,
1046
+ /** 用户权益额度不足 */
1047
+ BROADCAST_EQUITY_NOT_ENOUGH = 2007,
1048
+ /** 用户权益额度冻结失败 */
1049
+ BROADCAST_EQUITY_FREEZE_FAILED = 2008
1040
1050
  }
1041
1051
  /**
1042
1052
  * 资源错误码 (3xxx)