class Window_smap_Command < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(width, commands)
super(132, 64, width*2, 96)
@item_max = 10
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
$cw_index = 0
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index].to_s)
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
def able_item(index)
draw_item(index, normal_color)
end
end
class Window_Base < Window
def draw_smap(actor, x, y)
bitmap=Bitmap.new("Graphics/Pictures/smap4")
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x-192, y+40, bitmap, src_rect)
x = 83
y = 64
end
end
#==============================================================================
class Window_smap < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 360, 240)
self.contents = Bitmap.new(width + 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_smap(@actor, 160, -40)
end
end
class Scene_smap
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
# menu_index : 选项起始位置
#--------------------------------------------------------------------------
def initialize(actor_index = 0 , menu_index = 0)
@actor_index = actor_index
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
s1 = "地图1"
s2 = "地图2"
s3 = "地图3"
s4 = "地图4"
s5 = "地图5"
s6 = "地图6"
s7 = "地图7"
s8 = "地图8"
s9 = "地图9"
s10 = "退出"
@command_window = Window_smap_Command.new(180, [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10])
@command_window.index = @menu_index
@smap_window = Window_smap.new(@actor)
#XXOO右窗口的坐标
@smap_window.x = 132
@smap_window.y = 180
@cursor_index = @command_window.index
# 执行过渡 渐变图形的文件位置 自己设定
Graphics.transition
# 主循环
loop do# 刷新游戏画面
Graphics.update
Input.update # 刷新输入信息
update# 刷新画面
if $scene != self # 如果切换画面就中断循环
break
end
end
# 准备过渡
Graphics.freeze# 释放窗口
@command_window.dispose
@smap_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@command_window.update
if @cursor_index != @command_window.index
$cw_index = @command_window.index
@smap_window.refresh
@cursor_index = @command_window.index
end
# 选项明暗判断
@smap_window.update
#=============================================================
# 按下 B 键的情况下
#=============================================================
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@command_window.index = 9
return
end
end
end