Code:procedure TArchiveManager.loadImages(const pvPath: string);var lvFileList: TStrings; i: Integer; lvKey: string; begin lvFileList:= TStringList.Create; try enumFileInRecursion(pvPath,lvFileList,'.png'); for i:= 0 to lvFileList.Count -1 do begin FLocker.lock(); try lvKey:= ChangeFileExt(ExtractFileName(lvFileList[i]), ''); FEngineImages.AddFromFile(lvFileList[i],lvKey); finally FLocker.unLock; end; end; finally lvFileList.Free; end; end; procedure onLoadGameData; begin gvArchiveManager.loadFiles('.\config','.aui,.amap',gvArchiveManager.FEngineConfigs); sleep(1000); gvArchiveManager.loadFiles('.\script','.lua',gvArchiveManager.FEngineScripts); sleep(1000); gvArchiveManager.loadFiles('.\sound','.ogg,.wav',gvArchiveManager.FEngineSounds); sleep(1000); gvArchiveManager.loadFonts('.\font'); sleep(1000); gvArchiveManager.loadImages('.\artres'); gvGameState:= tgsLoadingCompleted; end; procedure TArchiveManager.loadAll(); begin TThread.CreateAnonymousThread(onLoadGameData).Start; end;
Bookmarks