Project1
标题: 模仿别的脚本写了个统计的页面,结果出现问题,求教一下 [打印本页]
作者: 踢腿水上飘 时间: 2017-2-27 16:09
标题: 模仿别的脚本写了个统计的页面,结果出现问题,求教一下
模仿别的脚本写了个统计的页面,可以进入统计界面了,但是退不出来,而且文字都挤在一起了,求教是什么问题,咋改呀?
效果如题,在这里按ESC也退不出去,而且文字都挤在一起了
另外,窗口的内容没法往下滚动,如果项目多了,下面的就显示不出来了
麻烦高手帮忙解决这个问题呀~
#==============================================================================
# ** Window_Tongji
#==============================================================================
class Window_Tongji < Window_Selectable
#----------------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
refresh
end
#----------------------------------------------------------------------------
# * 刷新画面
#----------------------------------------------------------------------------
def update
super
refresh
end
#----------------------------------------------------------------------------
# * 更新内容
#----------------------------------------------------------------------------
def refresh
self.contents.clear
draw_text(x, y, 640, line_height, "统计", 1)
draw_text(x, y, 350, line_height*3, "破敌数", 0)
draw_text(x, y, 550, line_height*3, $game_variables[21], 2)
draw_text(x, y, 350, line_height*4, "测试1", 0)
draw_text(x, y, 550, line_height*4, $game_variables[21], 2)
draw_text(x, y, 350, line_height*5, "测试2", 0)
draw_text(x, y, 550, line_height*5, $game_variables[21], 2)
draw_text(x, y, 350, line_height*6, "测试3", 0)
draw_text(x, y, 550, line_height*6, $game_variables[21], 2)
draw_text(x, y, 350, line_height*7, "测试4", 0)
draw_text(x, y, 550, line_height*7, $game_variables[21], 2)
draw_text(x, y, 350, line_height*8, "测试5", 0)
draw_text(x, y, 550, line_height*8, $game_variables[21], 2)
end
end
#----------------------------------------------------------------------------
# * 呼叫界面
#----------------------------------------------------------------------------
class Call_Tongji < Scene_Base
def start
super
create_tongji_window
end
#----------------------------------------------------------------------------
# * 创建统计窗口
#----------------------------------------------------------------------------
def create_tongji_window
@tongji_window = Window_Tongji.new
@tongji_window.set_handler(:cancel,method(:return_scene))
end
end
#==============================================================================
# ** Window_Tongji
#==============================================================================
class Window_Tongji < Window_Selectable
#----------------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
refresh
end
#----------------------------------------------------------------------------
# * 刷新画面
#----------------------------------------------------------------------------
def update
super
refresh
end
#----------------------------------------------------------------------------
# * 更新内容
#----------------------------------------------------------------------------
def refresh
self.contents.clear
draw_text(x, y, 640, line_height, "统计", 1)
draw_text(x, y, 350, line_height*3, "破敌数", 0)
draw_text(x, y, 550, line_height*3, $game_variables[21], 2)
draw_text(x, y, 350, line_height*4, "测试1", 0)
draw_text(x, y, 550, line_height*4, $game_variables[21], 2)
draw_text(x, y, 350, line_height*5, "测试2", 0)
draw_text(x, y, 550, line_height*5, $game_variables[21], 2)
draw_text(x, y, 350, line_height*6, "测试3", 0)
draw_text(x, y, 550, line_height*6, $game_variables[21], 2)
draw_text(x, y, 350, line_height*7, "测试4", 0)
draw_text(x, y, 550, line_height*7, $game_variables[21], 2)
draw_text(x, y, 350, line_height*8, "测试5", 0)
draw_text(x, y, 550, line_height*8, $game_variables[21], 2)
end
end
#----------------------------------------------------------------------------
# * 呼叫界面
#----------------------------------------------------------------------------
class Call_Tongji < Scene_Base
def start
super
create_tongji_window
end
#----------------------------------------------------------------------------
# * 创建统计窗口
#----------------------------------------------------------------------------
def create_tongji_window
@tongji_window = Window_Tongji.new
@tongji_window.set_handler(:cancel,method(:return_scene))
end
end
作者: 魔法丶小肉包 时间: 2017-2-27 17:05
本帖最后由 魔法丶小肉包 于 2017-2-27 17:09 编辑
帮楼主改了一下脚本,看一下吧w 默认不翻页,1号开关打开时按上下键翻页,注意此时2号变量的值为文本行数,若不设置则什么都不会显示。
2号变量配合1号开关一起使用,不翻页的情况是考虑到文本未满一页,如超过一页则打开1号开关即可,有多少行文本就2号变量设置多少
#==============================================================================
# ** Window_Tongji
#==============================================================================
class Window_Tongji < Window_Selectable
#----------------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
refresh
activate
end
def contents_height
$game_switches[1]?$game_variables[2] * 24 : super
end
#----------------------------------------------------------------------------
# * 刷新画面
#----------------------------------------------------------------------------
def update
super
refresh
if Input.trigger?(:UP)
if self.oy <= 0
self.oy = 0
else
self.oy -= 24
end
end
if Input.trigger?(:DOWN)
if $game_switches[1]
if self.oy >= contents_height - (416-125)
self.oy = contents_height - (416-125)
else
self.oy += 24
end
end
end
end
#----------------------------------------------------------------------------
# * 更新内容
#----------------------------------------------------------------------------
def refresh
self.contents.clear
draw_text(x, y, 640, line_height, "统计", 1)
draw_text(x, y, 350, line_height*3, "破敌数", 0)
draw_text(x, y+line_height*0, 550, line_height*3, $game_variables[21], 2)
draw_text(x, y+line_height*1, 350, line_height*4, "测试1", 0)
draw_text(x, y+line_height*1, 550, line_height*4, $game_variables[21], 2)
draw_text(x, y+line_height*2, 350, line_height*5, "测试2", 0)
draw_text(x, y+line_height*2, 550, line_height*5, $game_variables[21], 2)
draw_text(x, y+line_height*3, 350, line_height*6, "测试3", 0)
draw_text(x, y+line_height*3, 550, line_height*6, $game_variables[21], 2)
draw_text(x, y+line_height*4, 350, line_height*7, "测试4", 0)
draw_text(x, y+line_height*4, 550, line_height*7, $game_variables[21], 2)
draw_text(x, y+line_height*5, 350, line_height*8, "测试5", 0)
draw_text(x, y+line_height*5, 550, line_height*8, $game_variables[21], 2)
end
end
#----------------------------------------------------------------------------
# * 呼叫界面
#----------------------------------------------------------------------------
class Call_Tongji < Scene_Base
def start
super
create_tongji_window
end
#----------------------------------------------------------------------------
# * 创建统计窗口
#----------------------------------------------------------------------------
def create_tongji_window
@tongji_window = Window_Tongji.new
@tongji_window.set_handler(:cancel,method(:return_scene))
end
end
#==============================================================================
# ** Window_Tongji
#==============================================================================
class Window_Tongji < Window_Selectable
#----------------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
refresh
activate
end
def contents_height
$game_switches[1]?$game_variables[2] * 24 : super
end
#----------------------------------------------------------------------------
# * 刷新画面
#----------------------------------------------------------------------------
def update
super
refresh
if Input.trigger?(:UP)
if self.oy <= 0
self.oy = 0
else
self.oy -= 24
end
end
if Input.trigger?(:DOWN)
if $game_switches[1]
if self.oy >= contents_height - (416-125)
self.oy = contents_height - (416-125)
else
self.oy += 24
end
end
end
end
#----------------------------------------------------------------------------
# * 更新内容
#----------------------------------------------------------------------------
def refresh
self.contents.clear
draw_text(x, y, 640, line_height, "统计", 1)
draw_text(x, y, 350, line_height*3, "破敌数", 0)
draw_text(x, y+line_height*0, 550, line_height*3, $game_variables[21], 2)
draw_text(x, y+line_height*1, 350, line_height*4, "测试1", 0)
draw_text(x, y+line_height*1, 550, line_height*4, $game_variables[21], 2)
draw_text(x, y+line_height*2, 350, line_height*5, "测试2", 0)
draw_text(x, y+line_height*2, 550, line_height*5, $game_variables[21], 2)
draw_text(x, y+line_height*3, 350, line_height*6, "测试3", 0)
draw_text(x, y+line_height*3, 550, line_height*6, $game_variables[21], 2)
draw_text(x, y+line_height*4, 350, line_height*7, "测试4", 0)
draw_text(x, y+line_height*4, 550, line_height*7, $game_variables[21], 2)
draw_text(x, y+line_height*5, 350, line_height*8, "测试5", 0)
draw_text(x, y+line_height*5, 550, line_height*8, $game_variables[21], 2)
end
end
#----------------------------------------------------------------------------
# * 呼叫界面
#----------------------------------------------------------------------------
class Call_Tongji < Scene_Base
def start
super
create_tongji_window
end
#----------------------------------------------------------------------------
# * 创建统计窗口
#----------------------------------------------------------------------------
def create_tongji_window
@tongji_window = Window_Tongji.new
@tongji_window.set_handler(:cancel,method(:return_scene))
end
end
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |