I have two Window_Command. One is activated, the other is deactivated.
Here is my sample code:
How will I activate
Here is my sample code:
JavaScript:
Input.keyMapper["71"] = "openTest";
_alias_scene_map_updatetest = Scene_Map.prototype.update;
Scene_Map.prototype.update = function()
{
_alias_scene_map_updatetest.call(this);
if(Input.isTriggered("openTest")) SceneManager.push(SceneTest);
}
class WindowTest extends Window_Base
{
constructor(rect)
{
super(rect);
}
}
class SceneTest extends Scene_MenuBase
{
create()
{
super.create();
var rect = new Rectangle(0, 0, 100, 100);
this._customWindow = new WindowTest(rect);
this._customWindow.drawText("Box", 0, 0);
this.addWindow(this._customWindow);
var rect1 = new Rectangle(0, 200, 200, 200);
this._customCommandWindow = new SampleCommand(rect1);
this._customCommandWindow.setHandler("sampleCommand", this.sampleCommand.bind(this));
this._customCommandWindow.setHandler("sampleCommand", this.sampleCommand.bind(this));
this._customCommandWindow.setHandler("sampleCommand", this.sampleCommand.bind(this));
this.addWindow(this._customCommandWindow);
this._customCommandWindow.activate();
this._customCommandWindow.select(0);
var rect1 = new Rectangle(300, 200, 200, 200);
this._anotherCommandWindow = new AnotherCommand(rect1);
this._anotherCommandWindow.setHandler("anotherCommand", this.anotherCommand.bind(this));
this._anotherCommandWindow.setHandler("anotherCommand", this.anotherCommand.bind(this));
this._anotherCommandWindow.setHandler("anotherCommand", this.anotherCommand.bind(this));
this.addWindow(this._anotherCommandWindow);
this._anotherCommandWindow.deactivate();
}
sampleCommand()
{
console.log('sample');
this._customCommandWindow.activate();
}
anotherCommand()
{
console.log('another');
this._anotherCommandWindow.activate();
}
}
class SampleCommand extends Window_Command
{
constructor(rect)
{
super(rect);
}
makeCommandList()
{
this.addCommand ("Sample Command A1", "sampleCommand");
this.addCommand ("Sample Command A2", "sampleCommand");
this.addCommand ("Sample Command A3", "sampleCommand");
}
}
class AnotherCommand extends Window_Command
{
constructor(rect)
{
super(rect);
}
makeCommandList()
{
this.addCommand ("Another Command A1", "anotherCommand");
this.addCommand ("Another Command A2", "anotherCommand");
this.addCommand ("Another Command A3", "anotherCommand");
}
update()
{
super.update();
}
}
SceneTest.prototype.update = function()
{
Scene_MenuBase.prototype.update.call(this);
if(Input.isTriggered("cancel")) SceneManager.pop();
}
How will I activate
_anotherCommandWindow if the mouse pointer hovers over it?