* 处理 Spine 骨骼数据资源 * @param {Object} data Spine 数据 * @param {string} key 键名 (uuid)
(data, key)
| 662 | } |
| 663 | }; |
| 664 | |
| 665 | const seen = new WeakSet(); |
| 666 | if (Array.isArray(data)) { |
| 667 | data.forEach((item) => walk(item, seen)); |
| 668 | } else { |
| 669 | walk(data, seen); |
| 670 | } |
| 671 | }, |
| 672 | |
| 673 | /** |
| 674 | * 分发已还原数组中的根级资源类型(不把整表当场景) |
| 675 | */ |
| 676 | dispatchRestoredArray(data, key) { |
| 677 | if (!Array.isArray(data)) { |
| 678 | this.writeProcessedData(data, key); |
| 679 | return; |
| 680 | } |
| 681 | // If it looks like a scene/prefab document, handle as document |
| 682 | if (this.isDocumentArray(data)) { |
| 683 | this.processDocumentArray(data, key); |
| 684 | return; |
| 685 | } |
| 686 | for (let i = 0; i < data.length; i += 1) { |
| 687 | const item = data[i]; |
| 688 | if (!item || typeof item !== 'object' || Array.isArray(item)) continue; |
| 689 | if (!item.__type__) continue; |
| 690 | // Only dispatch top-level asset types, not every cc.Node inside a doc |
| 691 | if (this.typeHandlers.has(item.__type__)) { |
| 692 | this.dispatchAsset(item, key, data, i); |
| 693 | } |
| 694 | } |
| 695 | }, |
| 696 | |
| 697 | /** |
| 698 | * 旧 writeProcessedData:遍历并分发(测试仍依赖) |
| 699 | */ |
| 700 | writeProcessedData(data, key) { |
| 701 | if (!data || typeof data !== 'object') return; |
| 702 | |
| 703 | if (data.__type__) { |
| 704 | const handler = this.typeHandlers.get(data.__type__); |
| 705 | if (handler) handler(data, key, { parentData: data, index: null }); |
| 706 | return; |
| 707 | } |
| 708 | |
| 709 | for (const i in data) { |
nothing calls this directly
no outgoing calls
no test coverage detected