devchenxip
20-06-2016, 10:21 AM
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',gvArc hiveManager.FEngineScripts);
sleep(1000);
gvArchiveManager.loadFiles('.\sound','.ogg,.wav',g vArchiveManager.FEngineSounds);
sleep(1000);
gvArchiveManager.loadFonts('.\font');
sleep(1000);
gvArchiveManager.loadImages('.\artres');
gvGameState:= tgsLoadingCompleted;
end;
procedure TArchiveManager.loadAll();
begin
TThread.CreateAnonymousThread(onLoadGameData).Star t;
end;
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',gvArc hiveManager.FEngineScripts);
sleep(1000);
gvArchiveManager.loadFiles('.\sound','.ogg,.wav',g vArchiveManager.FEngineSounds);
sleep(1000);
gvArchiveManager.loadFonts('.\font');
sleep(1000);
gvArchiveManager.loadImages('.\artres');
gvGameState:= tgsLoadingCompleted;
end;
procedure TArchiveManager.loadAll();
begin
TThread.CreateAnonymousThread(onLoadGameData).Star t;
end;