some window stuff
This commit is contained in:
@@ -25,6 +25,7 @@ using StringTools;
|
||||
class ModsAssetLibrary extends AssetLibrary {
|
||||
public var folderPath:String;
|
||||
public var libName:String;
|
||||
public var useImageCache:Bool = false;
|
||||
|
||||
public function new(folderPath:String, libName:String) {
|
||||
this.folderPath = folderPath;
|
||||
@@ -89,7 +90,7 @@ class ModsAssetLibrary extends AssetLibrary {
|
||||
}
|
||||
|
||||
public override function getImage(id:String):Image {
|
||||
if (__isCacheValid(cachedImages, id))
|
||||
if (useImageCache && __isCacheValid(cachedImages, id))
|
||||
return cachedImages.get(id);
|
||||
else {
|
||||
if (!exists(id, "IMAGE")) {
|
||||
@@ -141,7 +142,7 @@ class ModsAssetLibrary extends AssetLibrary {
|
||||
return false;
|
||||
if (editedTimes[asset] == null) return false;
|
||||
if (editedTimes[asset] < FileSystem.stat(getPath(asset)).mtime.getTime()) return false;
|
||||
return true;
|
||||
return cache.exists(asset) && cache[asset] != null;
|
||||
}
|
||||
|
||||
private function __parseAsset(asset:String):Bool {
|
||||
|
||||
@@ -125,8 +125,8 @@ class ModsFolder {
|
||||
Assets.cache.clear();
|
||||
lime.utils.Assets.cache.clear();
|
||||
|
||||
if (currentModFolder == null) return;
|
||||
#if MOD_SUPPORT
|
||||
if (currentModFolder == null) return;
|
||||
var bmapsToRemove:Array<FlxGraphic> = [];
|
||||
@:privateAccess
|
||||
for(bmap in FlxG.bitmap._cache) {
|
||||
@@ -146,9 +146,28 @@ class ModsFolder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: add setting for cache clearing
|
||||
@:privateAccess
|
||||
for(libName=>lib in lime.utils.Assets.libraries) {
|
||||
var library = lib;
|
||||
if (library is openfl.utils.AssetLibrary) {
|
||||
var flLib = cast(library, openfl.utils.AssetLibrary);
|
||||
@:privateAccess
|
||||
if (flLib.__proxy != null) library = flLib.__proxy;
|
||||
}
|
||||
if (library is ModsAssetLibrary) {
|
||||
var modLib = cast(library, ModsAssetLibrary);
|
||||
@:privateAccess
|
||||
modLib.cachedBytes = [];
|
||||
@:privateAccess
|
||||
for(sound in modLib.cachedAudioBuffers)
|
||||
sound.dispose();
|
||||
|
||||
}
|
||||
}
|
||||
for(e in bmapsToRemove)
|
||||
FlxG.bitmap.remove(e);
|
||||
|
||||
#end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user