查看: 2719|回复: 10

[有事请教] 学习JS遇到难题,请教。

[复制链接]
梦石
0
星屑
6379
在线时间
608 小时
注册时间
2017-9-27
回帖
205
发表于 2019-7-15 19:32:41 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
大概写了这么一个场景窗口
为何指令无法移动,光标也不闪动呢?


[pre lang="javascript"]//命令窗口
function Window_ThmlList() {
    this.initialize.apply(this, arguments);
}

Window_ThmlList.prototype = Object.create(Window_Command.prototype);
Window_ThmlList.prototype.initialize = function(x, y, width, height) {
    Window_Command.prototype.initialize.call(this, x, y, width, height);
};

Window_ThmlList.prototype.windowWidth = function() {
    return 120;
};

Window_ThmlList.prototype.numVisibleRows = function() {
    return 2;
};
Window_ThmlList.prototype.makeCommandList = function() {
        this.addCommand("加入", 'jiaru',true);
        this.addCommand("离开", 'likai',true);
};

//状态窗口
function Window_ThztList() {
    this.initialize.apply(this, arguments);
}

Window_ThztList.prototype = Object.create(Window_Selectable.prototype);
Window_ThztList.prototype.initialize = function(x, y, width, height) {
    Window_Selectable.prototype.initialize.call(this, x, y, width, height);
};


//仓库窗口
function Window_ThjlList() {
    this.initialize.apply(this, arguments);
}

Window_ThjlList.prototype = Object.create(Window_Selectable.prototype);
Window_ThjlList.prototype.initialize = function(x, y, width, height) {
    Window_Selectable.prototype.initialize.call(this, x, y, width, height);
};

//队伍窗口
function Window_ThlgList() {
    this.initialize.apply(this, arguments);
}

Window_ThlgList.prototype = Object.create(Window_Selectable.prototype);
Window_ThlgList.prototype.initialize = function(x, y, width, height) {
    Window_Selectable.prototype.initialize.call(this, x, y, width, height);
};

//场景设定
function Scene_Thcz() {
    this.initialize.apply(this, arguments);
}
Scene_Thcz.prototype.constructor = Scene_Thcz;

Scene_Thcz.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Thcz.prototype.initialize = function() {
    Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Thcz.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createThmlListWindow();
    this._command2Window = new Window_ThjlList(120, 228, 120, 276);
    this._command3Window = new Window_ThztList(240, 120, 464, 384);
    this.addWindow(this._command2Window);
    this.addWindow(this._command3Window);
};

Scene_Thcz.prototype.update = function() {
        this._command1Window.activate();
    //this._command1Window.refresh();
    if (Input.isTriggered('escape') || Input.isTriggered('cancel')) {
        this._command1Window.hide();
        this._command2Window.hide();
        this._command3Window.hide();
        SceneManager.goto(Scene_Map);
   }
};

Scene_Thcz.prototype.createThmlListWindow = function() {
    this._command1Window = new Window_ThmlList(120, 120);
    this._command1Window.setHandler('jiaru',  this.commandTh1.bind(this));
    this._command1Window.setHandler('likai',  this.commandTh2.bind(this));
    this._command1Window.setHandler('cancel', this.popScene.bind(this));
    this.addWindow(this._command1Window);
};

Scene_Thcz.prototype.commandTh1 = function() {
        this._command2Window.activate();
    this._command2indow.selectLast();
        this._command1Window.drawText("武器",0,0,100,'left')
};

Scene_Thcz.prototype.commandTh2 = function() {

};


[/pre]

老黄鸡

梦石
4
星屑
45739
在线时间
7952 小时
注册时间
2009-7-6
回帖
13338

MZ评测员RM创作大赛01组委会开拓者贵宾

发表于 2019-7-15 19:44:50 | 显示全部楼层
窗口有激活和非激活状态,有的窗口在初始化的时候并没有激活(比如2级窗口)
你调用window.activate()就可以了

点评

好的,谢谢指导。  发表于 2019-7-17 08:37
代码上使用debugger来手动触发断点,不明白的话可以百度js debugger  发表于 2019-7-17 04:50
F12或F8开控制台,source标签内在源码行数上点击下断点,这都是调试常识了  发表于 2019-7-17 04:49
按F12开控制台,断点的话...我猜是用console.log("输出内容");输出点什么  发表于 2019-7-16 12:42
问题解决了,不过不知道你说的断点是啥。。。MV版的控制台也不知道在哪。。  发表于 2019-7-16 10:25

评分

参与人数 1赞 +1 收起 理由
天浩 + 1 我很赞同

查看全部评分

RGDirect - DirectX驱动的RGSS,点我了解.
(排满,暂停)RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部