Access scenes in SceneManager, Open windows without freeze and blur filter

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
Hello,

so my questions are:

  • How can i access the instance i pushed to the SceneManager?
  • How can i display a window at the screen without freezing and filtering?
This is what i got until now:

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'toD') { switch (args[0]) { case 'show': SceneManager.push(Scene_toD); break; case 'config': SceneManager._scene.toDShowDialog(Number(args[1]),String(args[2])); break; case 'hide': SceneManager._scene.hideDialog(); break; } } }; function Scene_toD() { this.initialize.apply(this, arguments); } Scene_toD.prototype = Object.create(Scene_MenuBase.prototype); Scene_toD.prototype.constructor = Scene_toD; Scene_toD.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); }; Scene_toD.prototype.create = function() { Scene_MenuBase.prototype.create.call(this); this.todWindow = new Window_Base(20,20,500,100); this.todWindow.activate(); this.addWindow(this.todWindow); console.log(this) }; Scene_toD.prototype.showDialog = function(id, title) { this.todWindow.drawTextEx(title,5,5); this.todWindow.update(); } Scene_toD.prototype.hideDialog = function() { this.todWindow.close(); this.todWindow = null; };I am able to create window with

PluginCommand: toD show

but when im trying to set the text with

PluginCommand: toD config 1 Title

the text wont be displayed

Does someone have an idea how to do this?

---- Update 

I copied the Window_MapName class to get it working. The trick is adding the class to the Map Scene the window as child:

Code:
SceneManager._scene.addChild(win);
Code:
   var _Game_Interpreter_pluginCommand =            Game_Interpreter.prototype.pluginCommand;    Game_Interpreter.prototype.pluginCommand = function(command, args) {        _Game_Interpreter_pluginCommand.call(this, command, args);        if (command === 'toD') {            switch (args[0]) {                case 'show':                    showDialog(Number(args[1]),String(args[2]));                    break;                case 'hide':                    hideDialog();                    break;            }        }    };    var win = null;    function showDialog(id, title) {        win = new Window_toD_Title(title);        win.open();        console.log(SceneManager._scene)        SceneManager._scene.addChild(win);    }    function hideDialog() {        win.close();        win = null;    }    function Window_toD_Title(title) {        this.initialize.apply(this, arguments);        this.opacity = 0;        this._fadeInCount = 0;        this._fadeOutCount = 0;        this.textContent = title;        this.contentsOpacity = 0;        this.refresh();    }    Window_toD_Title.prototype = Object.create(Window_Base.prototype);    Window_toD_Title.prototype.constructor = Window_toD_Title;    Window_toD_Title.prototype.refresh = function() {        this.contents.clear();        var width = this.contentsWidth();        this.drawBackground(0, 0, width, this.lineHeight());        this.drawText(this.textContent, 0, 0, width, 'center');    };    Window_toD_Title.prototype.update = function() {        Window_Base.prototype.update.call(this);        if (this._fadeInCount > 0) {            this.contentsOpacity += 16;            this._fadeInCount--;        }        if (this._fadeOutCount > 0) {            this.contentsOpacity -= 16;            this._fadeOutCount--;        }    };    Window_toD_Title.prototype.fadeIn = function() {        this._fadeOutCount = 0;        this._fadeInCount = 25;    };    Window_toD_Title.prototype.fadeOut = function() {        this._fadeInCount = 0;        this._fadeOutCount = 25;    };    Window_toD_Title.prototype.open = function() {        this.refresh();        this.fadeIn();    };    Window_toD_Title.prototype.close = function() {        this.refresh();        this.fadeOut();    };    Window_toD_Title.prototype.drawBackground = function(x, y, width, height) {        var color1 = this.dimColor1();        var color2 = this.dimColor2();        this.contents.gradientFillRect(x, y, width / 2, height, color2, color1);        this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);    };    Window_toD_Title.prototype.initialize = function() {        Window_Base.prototype.initialize.call(this, 0, 0, 100, 100);        console.log(this)        this.refresh();    };
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top