Project1
标题: [已解决]}一个场景两个定义两命令窗口光标移动不动 [打印本页]
作者: 金芒芒 时间: 2024-7-3 15:07
标题: [已解决]}一个场景两个定义两命令窗口光标移动不动
本帖最后由 金芒芒 于 2024-7-5 16:43 编辑
#==============================================================================
# ■ Scene_chuzhan
#------------------------------------------------------------------------------
# 处理菜单画面的类。
#==============================================================================
class Scene_chuzhan
#--------------------------------------------------------------------------
# ● 初始化对像
# chuzhan_index : 命令光标的初期位置
#--------------------------------------------------------------------------
def initialize(chuzhan_index = 0)
@chuzhan_index = chuzhan_index
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成地图背景
@chezhan_TransparentBackground = Spriteset_Map.new
# 生成出战菜单选项
@chezhan_IndexCommand = Window_chuzhanCommand.new
@chezhan_IndexCommand.index = @chuzhan_index
# 生成阵位列表
@zhenwei_IndexCommand = Window_zhenweiCommand.new
# @zhenwei_IndexCommand.index = @zhenwei_index
# 冻结
Graphics.transition
# 不切换场景就一直循环
update while $scene == self
# 渐变
Graphics.freeze
@chezhan_IndexCommand.dispose
@zhenwei_IndexCommand.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
Graphics.update
Input.update
# return chezhanUpdate_IndexCommand if @chezhan_IndexCommand.active
# return zhenweiUpdate_IndexCommand if @zhenwei_IndexCommand.active
end
#--------------------------------------------------------------------------
# ● 刷新画面 (命令窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_chezhan_IndexCommand
@chezhan_IndexCommand.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @chezhan_IndexCommand.index
when 0 # 队组1出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品画面
# $game_switches[队伍1] = true #/ false
$game_switches[20] = true
$game_switches[21] = false
$game_switches[22] = false
$game_switches[23] = false
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
$scene = Scene_chuzhan.new
when 1 # 队组2出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$game_switches[20] = false
$game_switches[21] = true
$game_switches[22] = false
$game_switches[23] = false
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
# $scene = Scene_chuzhan.new
when 2 # 队组3出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$game_switches[20] = false
$game_switches[21] = false
$game_switches[22] = true
$game_switches[23] = false
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
when 3 # 队组4出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$game_switches[20] = false
$game_switches[21] = false
$game_switches[22] = false
$game_switches[23] = true
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
when 4 # 队组5出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$game_switches[20] = false
$game_switches[21] = false
$game_switches[22] = false
$game_switches[23] = false
$game_switches[24] = true
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (命令窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_zhenwei_IndexCommand
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @command_window.index
when 0 # 队组1出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品画面
# $出战1=[]
if $game_switches[20] == true
$出战1=[9.13]
p $出战1
end
if $game_switches[21] == true
$出战2=[9.113]
p $出战2
end
$scene = Scene_chuzhan.new(1)
when 1 # 队组2出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$出战2=[]
$scene = Scene_chuzhan.new(2)
when 2 # 队组3出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$出战3=[]
$scene = Scene_chuzhan.new(3)
when 3 # 队组4出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$出战4=[]
# 激活状态窗口
$scene = Scene_chuzhan.new(4)
when 4 # 队组5出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$出战5=[]
# 队组4出生点
$scene = Scene_chuzhan.new(5)
when 5
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(6)
when 6
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(7)
when 7
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(8)
when 8
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(9)
when 9
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(0)
end
return
end
end
end
#==============================================================================
# ■ Scene_chuzhan
#------------------------------------------------------------------------------
# 处理菜单画面的类。
#==============================================================================
class Scene_chuzhan
#--------------------------------------------------------------------------
# ● 初始化对像
# chuzhan_index : 命令光标的初期位置
#--------------------------------------------------------------------------
def initialize(chuzhan_index = 0)
@chuzhan_index = chuzhan_index
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成地图背景
@chezhan_TransparentBackground = Spriteset_Map.new
# 生成出战菜单选项
@chezhan_IndexCommand = Window_chuzhanCommand.new
@chezhan_IndexCommand.index = @chuzhan_index
# 生成阵位列表
@zhenwei_IndexCommand = Window_zhenweiCommand.new
# @zhenwei_IndexCommand.index = @zhenwei_index
# 冻结
Graphics.transition
# 不切换场景就一直循环
update while $scene == self
# 渐变
Graphics.freeze
@chezhan_IndexCommand.dispose
@zhenwei_IndexCommand.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
Graphics.update
Input.update
# return chezhanUpdate_IndexCommand if @chezhan_IndexCommand.active
# return zhenweiUpdate_IndexCommand if @zhenwei_IndexCommand.active
end
#--------------------------------------------------------------------------
# ● 刷新画面 (命令窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_chezhan_IndexCommand
@chezhan_IndexCommand.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @chezhan_IndexCommand.index
when 0 # 队组1出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品画面
# $game_switches[队伍1] = true #/ false
$game_switches[20] = true
$game_switches[21] = false
$game_switches[22] = false
$game_switches[23] = false
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
$scene = Scene_chuzhan.new
when 1 # 队组2出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$game_switches[20] = false
$game_switches[21] = true
$game_switches[22] = false
$game_switches[23] = false
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
# $scene = Scene_chuzhan.new
when 2 # 队组3出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$game_switches[20] = false
$game_switches[21] = false
$game_switches[22] = true
$game_switches[23] = false
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
when 3 # 队组4出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$game_switches[20] = false
$game_switches[21] = false
$game_switches[22] = false
$game_switches[23] = true
$game_switches[24] = false
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
when 4 # 队组5出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$game_switches[20] = false
$game_switches[21] = false
$game_switches[22] = false
$game_switches[23] = false
$game_switches[24] = true
@chezhan_IndexCommand.active = false
@zhenwei_IndexCommand.active = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (命令窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_zhenwei_IndexCommand
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @command_window.index
when 0 # 队组1出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品画面
# $出战1=[]
if $game_switches[20] == true
$出战1=[9.13]
p $出战1
end
if $game_switches[21] == true
$出战2=[9.113]
p $出战2
end
$scene = Scene_chuzhan.new(1)
when 1 # 队组2出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$出战2=[]
$scene = Scene_chuzhan.new(2)
when 2 # 队组3出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
$出战3=[]
$scene = Scene_chuzhan.new(3)
when 3 # 队组4出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$出战4=[]
# 激活状态窗口
$scene = Scene_chuzhan.new(4)
when 4 # 队组5出生点
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$出战5=[]
# 队组4出生点
$scene = Scene_chuzhan.new(5)
when 5
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(6)
when 6
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(7)
when 7
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(8)
when 8
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(9)
when 9
$game_system.se_play($data_system.decision_se)
$出战=[]
$scene = Scene_chuzhan.new(0)
end
return
end
end
end
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# 菜单的命令选择行窗口。
#==============================================================================
class Window_chuzhanCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize
width = 480 - 64
s1 = "出战1"
s2 = "出战2"
s3 = "出战3"
s4 = "出战4"
s5 = "出战5"
commands = [s1, s2, s3, s4, s5]
# 由命令的个数计算出窗口的高
super(32, 32, 160, 160)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(self.width - 32, commands.size / 2 * 32)
self.back_opacity /= 2
@column_max = 2
@i = -1000
@title_self_window = Window_Base.new(32 - 8, 32 - 8, 96, 24)
@title_self_window.back_opacity /= 2
@title_self_text = Sprite.new
@title_self_text.bitmap = Bitmap.new(640, 480)
@title_self_text.bitmap.clear
@title_self_text.bitmap.font.size -=4
@title_self_text.bitmap.font.name = "宋体"
@title_self_text.bitmap.font.color = Color.new(0, 0, 0)
@title_self_text.bitmap.draw_text(32 - 8, 32 - 12, 96, 32, "菜单选项", 1)
@title_self_text.bitmap.font.color = Color.new(128, 255, 128)
@title_self_text.bitmap.draw_text(32 - 8 - 1, 32 - 12 - 1, 96, 32, "菜单选项", 1)
@title_self_text.z = 1000
refresh
self.index = 0
end
def item
return @commands[self.index] == nil ? "" : @commands[self.index]
end
def dispose
super
if @title_self_text.bitmap != nil
@title_self_text.bitmap.dispose
end
@title_self_text.dispose
@title_self_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
if self.index == i
draw_item(i, normal_color, true)
else
draw_item(i, normal_color, false)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color, flg)
self.contents.font.color = color
rect = Rect.new(index % 2 * 72, index / 2 * 32, (self.width - 32) / 2, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
if flg
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = Color.new(0, 0, 0)
self.contents.draw_text(rect, @commands[index], 1)
rect = Rect.new(index % 2 * 72 - 1, index / 2 * 32 - 1, (self.width - 32) / 2, 32)
self.contents.font.color = Color.new(255, 255, 225)
self.contents.draw_text(rect, @commands[index], 1)
end
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index % 2 * 72, @index / 2 * 32, (self.width - 32) / 2, 32)
end
end
def update
super
if self.index != @i
@i = self.index
refresh
end
end
end
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# 菜单的命令选择行窗口。
#==============================================================================
class Window_chuzhanCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize
width = 480 - 64
s1 = "出战1"
s2 = "出战2"
s3 = "出战3"
s4 = "出战4"
s5 = "出战5"
commands = [s1, s2, s3, s4, s5]
# 由命令的个数计算出窗口的高
super(32, 32, 160, 160)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(self.width - 32, commands.size / 2 * 32)
self.back_opacity /= 2
@column_max = 2
@i = -1000
@title_self_window = Window_Base.new(32 - 8, 32 - 8, 96, 24)
@title_self_window.back_opacity /= 2
@title_self_text = Sprite.new
@title_self_text.bitmap = Bitmap.new(640, 480)
@title_self_text.bitmap.clear
@title_self_text.bitmap.font.size -=4
@title_self_text.bitmap.font.name = "宋体"
@title_self_text.bitmap.font.color = Color.new(0, 0, 0)
@title_self_text.bitmap.draw_text(32 - 8, 32 - 12, 96, 32, "菜单选项", 1)
@title_self_text.bitmap.font.color = Color.new(128, 255, 128)
@title_self_text.bitmap.draw_text(32 - 8 - 1, 32 - 12 - 1, 96, 32, "菜单选项", 1)
@title_self_text.z = 1000
refresh
self.index = 0
end
def item
return @commands[self.index] == nil ? "" : @commands[self.index]
end
def dispose
super
if @title_self_text.bitmap != nil
@title_self_text.bitmap.dispose
end
@title_self_text.dispose
@title_self_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
if self.index == i
draw_item(i, normal_color, true)
else
draw_item(i, normal_color, false)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color, flg)
self.contents.font.color = color
rect = Rect.new(index % 2 * 72, index / 2 * 32, (self.width - 32) / 2, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
if flg
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = Color.new(0, 0, 0)
self.contents.draw_text(rect, @commands[index], 1)
rect = Rect.new(index % 2 * 72 - 1, index / 2 * 32 - 1, (self.width - 32) / 2, 32)
self.contents.font.color = Color.new(255, 255, 225)
self.contents.draw_text(rect, @commands[index], 1)
end
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index % 2 * 72, @index / 2 * 32, (self.width - 32) / 2, 32)
end
end
def update
super
if self.index != @i
@i = self.index
refresh
end
end
end
[/pre]#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# 菜单的命令选择行窗口。
#==============================================================================
class Window_zhenweiCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize
width = 480 - 64
s1 = "阵位1"
s2 = "阵位2"
s3 = "阵位3"
s4 = "阵位4"
s5 = "阵位5"
s6 = "阵位6"
s7 = "阵位7"
s8 = "阵位8"
s9 = "阵位9"
s10 = "阵位10"
commands = [s1, s2, s3, s4, s5,s6,s7,s8,s9,s10]
# 由命令的个数计算出窗口的高
super(32+160, 32, 160, 160)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(self.width - 32, commands.size / 2 * 32)
self.back_opacity /= 2
@column_max = 2
@i = -1000
@title_self_window = Window_Base.new(32 - 8, 32 - 8, 96, 24)
@title_self_window.back_opacity /= 2
@title_self_text = Sprite.new
@title_self_text.bitmap = Bitmap.new(640, 480)
@title_self_text.bitmap.clear
@title_self_text.bitmap.font.size -=4
@title_self_text.bitmap.font.name = "宋体"
@title_self_text.bitmap.font.color = Color.new(0, 0, 0)
@title_self_text.bitmap.draw_text(32 - 8, 32 - 12, 96, 32, "菜单选项", 1)
@title_self_text.bitmap.font.color = Color.new(128, 255, 128)
@title_self_text.bitmap.draw_text(32 - 8 - 1, 32 - 12 - 1, 96, 32, "菜单选项", 1)
@title_self_text.z = 1000
refresh
self.index = 0
end
def item
return @commands[self.index] == nil ? "" : @commands[self.index]
end
def dispose
super
if @title_self_text.bitmap != nil
@title_self_text.bitmap.dispose
end
@title_self_text.dispose
@title_self_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
if self.index == i
draw_item(i, normal_color, true)
else
draw_item(i, normal_color, false)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color, flg)
self.contents.font.color = color
rect = Rect.new(index % 2 * 72, index / 2 * 32, (self.width - 32) / 2, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
if flg
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = Color.new(0, 0, 0)
self.contents.draw_text(rect, @commands[index], 1)
rect = Rect.new(index % 2 * 72 - 1, index / 2 * 32 - 1, (self.width - 32) / 2, 32)
self.contents.font.color = Color.new(255, 255, 225)
self.contents.draw_text(rect, @commands[index], 1)
end
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index % 2 * 72, @index / 2 * 32, (self.width - 32) / 2, 32)
end
end
def update
super
if self.index != @i
@i = self.index
refresh
end
end
end
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# 菜单的命令选择行窗口。
#==============================================================================
class Window_zhenweiCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize
width = 480 - 64
s1 = "阵位1"
s2 = "阵位2"
s3 = "阵位3"
s4 = "阵位4"
s5 = "阵位5"
s6 = "阵位6"
s7 = "阵位7"
s8 = "阵位8"
s9 = "阵位9"
s10 = "阵位10"
commands = [s1, s2, s3, s4, s5,s6,s7,s8,s9,s10]
# 由命令的个数计算出窗口的高
super(32+160, 32, 160, 160)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(self.width - 32, commands.size / 2 * 32)
self.back_opacity /= 2
@column_max = 2
@i = -1000
@title_self_window = Window_Base.new(32 - 8, 32 - 8, 96, 24)
@title_self_window.back_opacity /= 2
@title_self_text = Sprite.new
@title_self_text.bitmap = Bitmap.new(640, 480)
@title_self_text.bitmap.clear
@title_self_text.bitmap.font.size -=4
@title_self_text.bitmap.font.name = "宋体"
@title_self_text.bitmap.font.color = Color.new(0, 0, 0)
@title_self_text.bitmap.draw_text(32 - 8, 32 - 12, 96, 32, "菜单选项", 1)
@title_self_text.bitmap.font.color = Color.new(128, 255, 128)
@title_self_text.bitmap.draw_text(32 - 8 - 1, 32 - 12 - 1, 96, 32, "菜单选项", 1)
@title_self_text.z = 1000
refresh
self.index = 0
end
def item
return @commands[self.index] == nil ? "" : @commands[self.index]
end
def dispose
super
if @title_self_text.bitmap != nil
@title_self_text.bitmap.dispose
end
@title_self_text.dispose
@title_self_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
if self.index == i
draw_item(i, normal_color, true)
else
draw_item(i, normal_color, false)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color, flg)
self.contents.font.color = color
rect = Rect.new(index % 2 * 72, index / 2 * 32, (self.width - 32) / 2, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
if flg
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = Color.new(0, 0, 0)
self.contents.draw_text(rect, @commands[index], 1)
rect = Rect.new(index % 2 * 72 - 1, index / 2 * 32 - 1, (self.width - 32) / 2, 32)
self.contents.font.color = Color.new(255, 255, 225)
self.contents.draw_text(rect, @commands[index], 1)
end
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index % 2 * 72, @index / 2 * 32, (self.width - 32) / 2, 32)
end
end
def update
super
if self.index != @i
@i = self.index
refresh
end
end
end
-
阵位.png
(79.39 KB, 下载次数: 110)
作者: 金芒芒 时间: 2024-7-5 16:42
| 欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |