Project1
标题:
写了个窗口 按esc退不出去 求解
[打印本页]
作者:
fox1313304
时间:
2016-8-19 19:10
标题:
写了个窗口 按esc退不出去 求解
我就想问问这个窗口的“按esc返回地图场景”怎么写
#encoding:utf-8
#==============================================================================
# ■ 积分查询窗口
#------------------------------------------------------------------------------
# 作者:季寒
# 版本:1.0
#==============================================================================
class Window_JHScorePoint < Window_Base
def initialize(x,y,width,height)
super(0,0,330,360)#这里是积分窗口的x,y,宽,高
refresh
end
def update
super
refresh
end
def refresh
self.contents.clear
self.contents_opacity = 255
self.contents.font.size=18 #字体大小
@Jhnumy=32 #积分内容的行距
@JHnumx=25 #图标离变量的距离
#以下为变量的具体内容 125是图标的编号 第二行最后是变量的编号
draw_icon(125, 0, @Jhnumy*0, enabled = true)
draw_text_ex(@JHnumx,@Jhnumy*0,"\\c[1]积分1:\\c[0]#{$game_variables[1]}")
draw_icon(125, 0, @Jhnumy*1, enabled = true)
draw_text_ex(@JHnumx,@Jhnumy*1,"\\c[1]积分2:\\c[0]#{$game_variables[2]}")
draw_icon(125, 0, @Jhnumy*2, enabled = true)
draw_text_ex(@JHnumx,@Jhnumy*2,"\\c[1]积分3:\\c[0]#{$game_variables[3]}")
draw_icon(125, 0, @Jhnumy*3, enabled = true)
draw_text_ex(@JHnumx,@Jhnumy*3,"\\c[1]积分4:\\c[0]#{$game_variables[4]}")
draw_icon(125, 0, @Jhnumy*4, enabled = true)
draw_text_ex(@JHnumx,@Jhnumy*4,"\\c[1]积分5:\\c[0]#{$game_variables[5]}")
draw_icon(125, 0, @Jhnumy*5, enabled = true)
draw_text_ex(@JHnumx,@Jhnumy*5,"\\c[1]积分6:\\c[0]#{$game_variables[6]}")
end
end
class Window_JHMsg < Window_Base
def initialize(x,y,width,height)
super(0,360,330,416-360)#消息显示窗口的x,y,宽,高
refresh
end
def update
super
refresh
end
def refresh
self.contents.clear
self.contents_opacity = 255
self.contents.font.size=20
draw_text_ex(0,0,"\\c[1]积分NPC:\\c[0]哟~~~hohoho") #窗口里的内容
end
end
class Window_JHPic < Window_Base
def initialize(x,y,width,height)
super(330,0,544-330,416) #立绘窗口的x y 宽 高
refresh
end
def update
super
refresh
end
def refresh
end
end
class ScorePoint < Scene_MenuBase
def start
super
create_scorepoint_window
create_message_window
create_pic_window
create_background
end
def create_background
x=0
y=0
width=544
height=416
bitmap = Bitmap.new("Graphics/System/bg")
@bg_sprite = Sprite.new(Viewport.new(x,y,bitmap.width,bitmap.height))
@bg_sprite.bitmap = bitmap
end
def create_scorepoint_window
@scorepoint_window = Window_JHScorePoint.new(0,0,0,0)
end
def create_message_window
@message_window = Window_JHMsg.new(0,0,0,0)
end
def create_pic_window
@create_pic_window=Window_JHPic.new(0,0,0,0)
@create_pic_window.opacity=0
x=330
y=0
width=194
height=416
bitmap = Bitmap.new("Graphics/Pictures/npc")
end
end
复制代码
QQ图片20160819190848.png
(89.66 KB, 下载次数: 18)
下载附件
保存到相册
2016-8-19 19:09 上传
作者:
cinderelmini
时间:
2016-8-19 19:17
本帖最后由 cinderelmini 于 2016-8-19 19:18 编辑
唔。。。没有Window_Selectable类的话,好像得自己写update监视按键的样子……
在这个Scene里再定义一下update试试看↓
class ScorePoint < Scene_MenuBase
def update
super
if Input.trigger?(:B)
Sound.play_buzzer
return_scene
end
end
end
复制代码
PS:顺便就是如果新建的viewport是全屏的话可以不填参数直接Viewport.new
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1