查看: 3160|回复: 10

[有事请教] 写了一个界面

[复制链接]
梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
发表于 2021-8-17 13:12:26 | 显示全部楼层 |阅读模式

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

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

×
我写了一个界面,但载入之后就无法退出了,是缺什么退出代码吗
梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-8-17 13:42:06 | 显示全部楼层
你少了个关闭窗口
例如我这个 一个确认另外一个是关闭 你看看你有没有关闭的那个
关闭
itemStandbySelectionWindow.setHandler('cancel', this.onItemStandbySelectionCancel.bind(this));
确认
itemStandbySelectionWindow.setHandler('ok', this.onItemStandbySelection.bind(this));

Scene_Battle.prototype.createItemStandbySelectionWindow = function () {
    const rect = this.standyWindowRect();
    const itemStandbySelectionWindow = new Window_Standby_Actor(rect);
    itemStandbySelectionWindow.setHandler('cancel', this.onItemStandbySelectionCancel.bind(this));
    itemStandbySelectionWindow.setHandler('ok', this.onItemStandbySelection.bind(this));
    this.addWindow(itemStandbySelectionWindow);
    this._itemStandbySelectionWindow = itemStandbySelectionWindow;
};
回复

使用道具 举报

梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
 楼主| 发表于 2021-8-17 14:07:57 | 显示全部楼层
MH-Pride 发表于 2021-8-17 13:42
你少了个关闭窗口
例如我这个 一个确认另外一个是关闭 你看看你有没有关闭的那个
关闭

写了
this._statusWindow.setHandler("cancel", this.onjjseeCancel.bind(this));

    Scene_Menu.prototype.onjjseeCancel = function () {
        this._statusWindow.deselect();
        this._commandWindow.activate();
    };
回复

使用道具 举报

梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
 楼主| 发表于 2021-8-17 14:09:57 | 显示全部楼层
MH-Pride 发表于 2021-8-17 13:42
你少了个关闭窗口
例如我这个 一个确认另外一个是关闭 你看看你有没有关闭的那个
关闭

我看其他菜单界面都可以使用鼠标右键什么的退出窗口,我的就不行
回复

使用道具 举报

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-8-17 22:21:16 | 显示全部楼层
itemStandbySelectionWindow.setHandler('cancel', this.onItemStandbySelectionCancel.bind(this));
Scene_Battle.prototype.onItemStandbySelectionCancel = function () {
        this._itemStandbySelectionWindow.close();
        this._actorCommandWindow.activate()
}
那个当然不行 你少了关闭或者隐藏
this._statusWindow.deselect(); 这个是取消选择
Scene_Menu.prototype.onjjseeCancel = function () {
        this._statusWindow.deselect();
      //加上关闭
       this._statusWindow.close()
       //或者隐藏都行
       this._statusWindow.hide()
        this._commandWindow.activate();
    };
回复

使用道具 举报

梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
 楼主| 发表于 2021-8-17 22:58:52 | 显示全部楼层
MH-Pride 发表于 2021-8-17 22:21
itemStandbySelectionWindow.setHandler('cancel', this.onItemStandbySelectionCancel.bind(this));
Scene ...

但还是关闭不了,不知道为啥
回复

使用道具 举报

梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
 楼主| 发表于 2021-8-17 23:05:58 | 显示全部楼层
MH-Pride 发表于 2021-8-17 22:21
itemStandbySelectionWindow.setHandler('cancel', this.onItemStandbySelectionCancel.bind(this));
Scene ...

关是可以关了,但他没有返回菜单界面,我是在菜单界面新增的一个选项,点那个选项后会进入我写的界面,但是关了之后,窗口是关了,但没有返回菜单界面
回复

使用道具 举报

梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
 楼主| 发表于 2021-8-17 23:23:15 | 显示全部楼层
MH-Pride 发表于 2021-8-17 22:21
itemStandbySelectionWindow.setHandler('cancel', this.onItemStandbySelectionCancel.bind(this));
Scene ...

改成功了,看了一下其他界面的代码,发现只要改成这样就可以了   
this._statusWindow.setHandler("cancel", this.popScene.bind(this));
回复

使用道具 举报

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-8-17 23:43:16 | 显示全部楼层
this.popScene 是返回到游戏界面
我那个是关闭当前界面,如果是多个界面层popScene会全部退出
我看到你有this._commandWindow.activate();以为你还有一个界面
回复

使用道具 举报

梦石
0
星屑
1057
在线时间
98 小时
注册时间
2021-7-16
回帖
15
 楼主| 发表于 2021-8-18 00:32:12 | 显示全部楼层
MH-Pride 发表于 2021-8-17 23:43
this.popScene 是返回到游戏界面
我那个是关闭当前界面,如果是多个界面层popScene会全部退出
我看到你有th ...

那  this._commandWindow.activate();这个是啥意思
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部