Exemplo n.º 1
0
 public JobMetaLoader(string path, bool preloadThumbnail = true)
 {
     thumbnailBytes        = null;
     thumbnailHandle       = default;
     this.path             = path;
     ptr                   = JobMetaLoaderInternal.Create(path);
     this.preloadThumbnail = preloadThumbnail;
 }
 private static void MallocStatus1(JobMetaLoaderInternal *answer)
 {
     answer->ReadCommandPtr = new IntPtr(UnsafeUtility.Malloc(sizeof(ReadCommand), 4, Allocator.Persistent));
     answer->ReadHandlePtr  = new IntPtr(UnsafeUtility.Malloc(sizeof(ReadHandle), 4, Allocator.Persistent));
     answer->MagicBytePtr   = new IntPtr(UnsafeUtility.Malloc(20, 4, Allocator.Persistent));
     answer->InterpretMagicAndLoadJsonJobPtr  = new IntPtr(UnsafeUtility.Malloc(sizeof(InterpretMagicAndLoadJsonJob), 4, Allocator.Persistent));
     answer->InterpretMetaAndLoadBinaryJobPtr = new IntPtr(UnsafeUtility.Malloc(sizeof(InterpretMetaAndLoadBinaryJob), 4, Allocator.Persistent));
     answer->QuickMetaStructDataStockPtr      = new IntPtr(UnsafeUtility.Malloc(sizeof(QuickMetaStruct.DataStock), 4, Allocator.Persistent));
 }
 private static void InitializePath(string path, JobMetaLoaderInternal *answer)
 {
     answer->PathCharCount = path.Length;
     answer->Path          = new IntPtr(UnsafeUtility.Malloc(sizeof(char) * answer->PathCharCount, 2, Allocator.Persistent));
     fixed(char *ptr = path)
     {
         UnsafeUtility.MemCpy((void *)answer->Path, ptr, answer->PathCharCount * sizeof(char));
     }
 }
 private static void StartReadMagicBytes(string path, JobMetaLoaderInternal *answer)
 {
     answer->ReadCommandReference = new ReadCommand
     {
         Buffer = (void *)answer->MagicBytePtr,
         Offset = 0L,
         Size   = 20L,
     };
     answer->ReadHandleReference = AsyncReadManager.Read(path, (ReadCommand *)answer->ReadCommandPtr, 1);
 }
 public InterpretMetaAndLoadBinaryJob(JobMetaLoaderInternal *loader)
 {
     this.loader = new IntPtr(loader);
 }
 private static void ScheduleJob(JobMetaLoaderInternal *answer)
 {
     answer->InterpretMagicAndLoadJsonJobHandle  = (answer->InterpretMagicAndLoadJsonJobReference = new InterpretMagicAndLoadJsonJob(answer)).Schedule(answer->ReadHandleReference.JobHandle);
     answer->InterpretMetaAndLoadBinaryJobHandle = (answer->InterpretMetaAndLoadBinaryJobReference = new InterpretMetaAndLoadBinaryJob(answer)).Schedule(answer->InterpretMagicAndLoadJsonJobHandle);
 }