Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Phaser-清除加载状态和引导状态缓存DOM_Jquery_Image_Caching_Phaser Framework - Fatal编程技术网

Jquery Phaser-清除加载状态和引导状态缓存DOM

Jquery Phaser-清除加载状态和引导状态缓存DOM,jquery,image,caching,phaser-framework,Jquery,Image,Caching,Phaser Framework,我和你玩游戏。我想清除所有loadState和bootState缓存DOM,以删除图像链接 我实际上使用了Phaser.Cache来删除GameDOM中的所有缓存,它可以工作,但是loadState和bootState缓存仍然存在 当我使用Phaser.Cache时 game.cache = new Phaser.Cache(game); game.load.reset(); game.load.removeAll(); 清除游戏缓存结果 图像对象{{uu默认值={…},{uu缺少={…} _

我和你玩游戏。我想清除所有
loadState
bootState
缓存DOM,以删除图像链接

我实际上使用了
Phaser.Cache
来删除
Game
DOM中的所有缓存,它可以工作,但是
loadState
bootState
缓存仍然存在

当我使用Phaser.Cache时

game.cache = new Phaser.Cache(game);
game.load.reset();
game.load.removeAll();
清除
游戏
缓存结果

图像对象{{uu默认值={…},{uu缺少={…} __默认对象{key=“\u default”,data=img,base={…},plus…} __缺少对象{key=“\u缺少”,数据=img,基={…},加上…}

但是
loadState
bootState
缓存仍然存在

game.cache = new Phaser.Cache(game);
game.load.reset();
game.load.removeAll();
图像对象{{uu默认值={…},{uu缺少={…}, 背景2={…},加上…} __默认对象{key=“\u default”,data=img,base={…},plus…} __缺少对象{key=“\u missing”,data=img,base={…},加上…}背景对象{key=“background”, url=“data:image/jpeg;base64,/…q0xYqtMOKrDFiqz0sVf/9k=”,data=img, 加上…}


您需要清除每个状态

game.state.clearCurrentState(); 
phaser博士说:

此方法通过调用其关闭回调来清除当前状态。 该过程还将删除任何活动的tweens,重置相机,重置 输入,清除物理,删除计时器,如果设置,则清除世界和 缓存也是

你也可以使用

game.state.destroy(); // Removes all StateManager callback references to the State object, nulls the game reference and clears the States object

谢谢你的回复。此解决方案清除并重置我的所有游戏对象。我想保持所有对象的创建,只清理缓存状态。使用
game.cache=new Phaser.cache(游戏);game.load.reset();game.load.removeAll()仅清除缓存。你有办法做到这一点吗?我想你不能用移相器。