ParseResult.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.ParseResult = exports.PrefabInfo = exports.NodeInfo = exports.ComInfo = void 0;
  4. class ComInfo {
  5. constructor() {
  6. this.comName = '';
  7. this.propertyName = '';
  8. }
  9. }
  10. exports.ComInfo = ComInfo;
  11. ;
  12. class NodeInfo {
  13. constructor() {
  14. this.nodePath = '';
  15. this.coms = [];
  16. }
  17. }
  18. exports.NodeInfo = NodeInfo;
  19. ;
  20. class PrefabInfo {
  21. constructor() {
  22. this.PATH = '';
  23. this.URL = '';
  24. this.UUID = '';
  25. this.nodes = new Map();
  26. }
  27. async initURLAndUUID(fullPath) {
  28. this.PATH = fullPath;
  29. this.UUID = await Editor.Message.request('asset-db', 'query-uuid', this.PATH);
  30. this.URL = await Editor.Message.request('asset-db', 'query-url', this.UUID);
  31. }
  32. putNodesInfo(nodePath, comInfo) {
  33. if (!this.nodes.has(nodePath)) {
  34. let nodeInfo = new NodeInfo;
  35. nodeInfo.nodePath = nodePath;
  36. this.nodes.set(nodePath, nodeInfo);
  37. }
  38. let nodeInfo = this.nodes.get(nodePath);
  39. nodeInfo.coms.push(comInfo);
  40. }
  41. dump() {
  42. console.log('[seek miss] ' + this.URL);
  43. for (let ele of this.nodes) {
  44. console.log('[seek miss] ----->' + ele[0]);
  45. let v = ele[1];
  46. for (let comInfo of v.coms) {
  47. console.log('[seek miss] ------------>' + comInfo.comName + " => " + comInfo.propertyName);
  48. }
  49. }
  50. }
  51. }
  52. exports.PrefabInfo = PrefabInfo;
  53. class ParseResult {
  54. constructor() {
  55. this._uuidMissedMap = new Map();
  56. }
  57. async getPrefabInfoByFullPath(fullPath) {
  58. if (!this._uuidMissedMap.has(fullPath)) {
  59. let prefabInfo = new PrefabInfo();
  60. await prefabInfo.initURLAndUUID(fullPath);
  61. this._uuidMissedMap.set(fullPath, prefabInfo);
  62. }
  63. return this._uuidMissedMap.get(fullPath);
  64. }
  65. }
  66. exports.ParseResult = ParseResult;