Project1
标题:
呼叫主菜单报错
[打印本页]
作者:
青岚明月
时间:
2010-10-24 10:28
标题:
呼叫主菜单报错
偶正在借用那个仙剑三式菜单,复制完数据后,进入游戏,发现不能呼叫出菜单,直接报错
BGM SFX Window 第十八行有错,不明白其意义,所以拿来问问。请各位帮帮忙吧。顺便一说,之前的截图存档也有问题,是我没有完全复制他的数据吗?【我直接删掉了截图存档了。。】
作者:
青岚明月
时间:
2010-10-24 10:28
本帖最后由 fux2 于 2010-11-5 07:38 编辑
这个是脚本
#==============================================================================
# ■ Window_CurrentBGM_Volume
#==============================================================================
class Window_CurrentBGM_Volume < Window_Base
def initialize
super(575, 100, 90, 96)
self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
self.opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
refresh
end
def refresh
self.contents.clear
self.contents.font.size = 20
# self.contents.font.color = zise_color
# self.contents.draw_text(-0, 0, 160, 32, "BGM")
self.contents.font.color = zise_color #【这里有错。。。】
self.contents.draw_text(-90, 25, 135, 32, $game_system.bgm_volume.to_s + "%", 2.9)
end
end
#==============================================================================
# ■ Window_BGM_Volume
#==============================================================================
class Window_BGM_Volume < Window_Selectable
def initialize(width, commands)
#super(500, 110, commands.size * 32 + 32, width)
super(0, 0, 335, 40)
#@item_max = commands.size
@item_max = 7
@column_max = commands.size
@commands = commands
self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
self.opacity = 0
self.contents = Bitmap.new(@item_max * 32, height - 32)
self.back_opacity = 160
refresh
self.index = 0
end
def refresh
self.contents.clear
self.contents.font.size = 20
for i in 0...@column_max #@item_max
draw_item(i, normal_color)
end
end
def draw_item(index, color)
self.contents.font.color = color
#rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
rect = Rect.new(32 * index,4 ,32 , self.contents.width - 8)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
def disable_item(index)
draw_item(index, disabled_color)
end
end
class Window_BGM_Volume < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽
cursor_width = 38 #600 / (@column_max + 1) - 32 - 32
# 计算光标坐标
#y = @index % @column_max * (cursor_width) + 10
#x = @index / @column_max * 32 - self.oy+270
#==============暂加,给x,q赋值===================
x=15
q=20
#==============================================
for i in 0...(@index+1)
x= i* 38
y = 0 #i*80
# 更新光标矩形
self.cursor_rect.set(x, y, cursor_width, 20)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 可以移动光标的情况下
if self.active and @item_max > 0 and @index >= 0
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 列数不是 1 并且方向键的下的按下状态不是重复的情况、
# 或光标位置在(项目数-列数)之前的情况下
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# 光标向下移动
@index = (@index + @column_max) % @item_max
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 列数不是 1 并且方向键的下的按下状态不是重复的情况、
# 或光标位置在列之后的情况下
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
# 光标向上移动
@index = (@index - @column_max + @item_max) % @item_max
end
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
if @column_max >= 2 and @index < @item_max - 1
# 光标向右移动
@index += 1
end
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 列数为 2 以上并且、光标位置在 0 之后的情况下
if @column_max >= 2 and @index > 0
# 光标向左移动
@index -= 1
end
end
# R 键被按下的情况下
if Input.repeat?(Input::R)
# 显示的最后行在数据中最后行上方的情况下
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# 光标向后移动一页
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# L 键被按下的情况下
if Input.repeat?(Input::L)
# 显示的开头行在位置 0 之后的情况下
if self.top_row > 0
# 光标向前移动一页
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
# 刷新光标矩形
update_cursor_rect
end
end
#==============================================================================
# ■ Window_CurrentSFX_Volume
#==============================================================================
class Window_CurrentSFX_Volume < Window_Base
def initialize
#super(460, 224, 180, 96)
super(575, 100, 90, 96)
self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
self.opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
refresh
end
def refresh
self.contents.font.size = 20
self.contents.clear
#self.contents.font.color = zise_color
#self.contents.draw_text(-0, 0, 160, 32, "S E")
self.contents.font.color = zise_color
self.contents.draw_text(-90, 25, 135, 32, $game_system.se_volume.to_s + "%", 2.9)
end
end
#==============================================================================
# ■ Window_SFX_Volume
#==============================================================================
class Window_SFX_Volume < Window_Selectable
def initialize(width, commands)
#super(380, 64, width, commands.size * 32 + 32)
super(0, 0, 335, 40)
# self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
self.opacity = 180
@item_max = 7
@column_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.back_opacity = 160
refresh
self.index = 0
end
def refresh
self.contents.clear
self.contents.font.size = 20
for i in 0...@column_max
draw_item(i, normal_color)
end
end
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(32 * index,4 ,32 , self.contents.width - 8)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
def disable_item(index)
draw_item(index, disabled_color)
end
end
class Window_SFX_Volume < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽
cursor_width = 38 #600 / (@column_max + 1) - 32 - 32
# 计算光标坐标
#y = @index % @column_max * (cursor_width) + 10
#x = @index / @column_max * 32 - self.oy+270
#==============暂加,给x,q赋值===================
x=15
q=20
#==============================================
for i in 0...(@index+1)
x= i* 38
y = 0 #i*80
# 更新光标矩形
self.cursor_rect.set(x, y, cursor_width, 20)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 可以移动光标的情况下
if self.active and @item_max > 0 and @index >= 0
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 列数不是 1 并且方向键的下的按下状态不是重复的情况、
# 或光标位置在(项目数-列数)之前的情况下
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# 光标向下移动
@index = (@index + @column_max) % @item_max
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 列数不是 1 并且方向键的下的按下状态不是重复的情况、
# 或光标位置在列之后的情况下
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
# 光标向上移动
@index = (@index - @column_max + @item_max) % @item_max
end
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
if @column_max >= 2 and @index < @item_max - 1
# 光标向右移动
@index += 1
end
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 列数为 2 以上并且、光标位置在 0 之后的情况下
if @column_max >= 2 and @index > 0
# 光标向左移动
@index -= 1
end
end
# R 键被按下的情况下
if Input.repeat?(Input::R)
# 显示的最后行在数据中最后行上方的情况下
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# 光标向后移动一页
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# L 键被按下的情况下
if Input.repeat?(Input::L)
# 显示的开头行在位置 0 之后的情况下
if self.top_row > 0
# 光标向前移动一页
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
# 刷新光标矩形
update_cursor_rect
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1