Is there a way to close all windows of a specific type (or name) currently on screen with a short code snippet?
Best regards!
Best regards!
for (var i in SceneManager._scene._windowLayer.children) {
if (SceneManager._scene._windowLayer.children[i].constructor == Window_Help) {
SceneManager._scene._windowLayer.children[i].hide()
}
}
//this first line may cause errors if a scene doesn't have a window layer!!
// use with caution!
var windows = SceneManager._scene._windowLayer.children;
var winTypes = ["Window_Equip", "Window_Gold"];
if (windows) {
windows.forEach(function (element) {
if (windTypes.contains(typeof element)) {
element.close();
}
});
}
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/delete-all-windows-of-a-specific-type.103876/