0
我正在構建一個包含幾個迷你遊戲的遊戲。每個迷你遊戲都有自己的屏幕。正確的資產處置與LibGdx AssetManager
現在我在啓動應用程序時加載所有資產,而不是每個迷你遊戲的特定資產。
我的問題是,使用AssetManager,當從一個迷你遊戲切換到另一個迷你遊戲時,我將如何最好地處理資產? manager.dispose()
將無法工作,因爲這將處理所有內容,並且只在應用程序啓動時才加載。
目前我HANDELING這樣的:
atlas = GdxAssetManager.manager.get(GdxAssetManager.runner, TextureAtlas.class);
然後,當迷你遊戲結束了,我回去給我把這個菜單:
public void dispose(){
for(int i = 0; i < obstacles.size; i++){
obstacles.get(i).dispose(); //unload the assets from each object in this array
}
GdxAssetManager.manager.unload(GdxAssetManager.runner); //unload the atlas in example code above
scoreHandler.dispose(); //unloading object assets
}
我已經考慮過這種方法,認爲這是我將要使用的方法,我添加的迷你遊戲越多,它就越不會加載app上的所有資源 - 開始 – WEDEBE
但是,這確實會產生問題,即您將處理菜單屏幕資產。這可能不是最佳 – WEDEBE
@WEDEBE那麼你可以不使用manager.clear()並使用manager.unload你加載的任何資產。創建一個字符串列表並使用這些字符串來記錄您的文件名 – Fish