Project1
标题:
VX菜单重新排版
[打印本页]
作者:
仲秋启明
时间:
2008-7-14 04:15
标题:
VX菜单重新排版
一款重新排版的菜单,还算不错,对于不愿意更改菜单的新手来说可以替换掉原菜单
更改方法:见脚本
脚本内容
#==============================================================================
# VX菜单重新排版 by 仲秋启明
#------------------------------------------------------------------------------
#同伴窗口可以使用左右键
#如插入菜单背景音,可在第247行插入
#更改图标在第118行
#金钱图标在第203行定义
class Window_Base < Window
#--------------------------------------------------------------------------
# ● HP的描画
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 90)
draw_actor_hp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
self.contents.font.color = hp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.hp, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.hp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxhp, 2)
end
end
#--------------------------------------------------------------------------
# ● HP矩形的描画
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 90)
gw = width * actor.hp / actor.maxhp
gc1 = hp_gauge_color1
gc2 = hp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
#--------------------------------------------------------------------------
# ● SP的描画
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 90)
draw_actor_mp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a)
self.contents.font.color = mp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.mp, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.mp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxmp, 2)
end
end
#--------------------------------------------------------------------------
# ● MP矩形的描画
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_mp_gauge(actor, x, y, width = 90)
gw = width * actor.mp / [actor.maxmp, 1].max
gc1 = mp_gauge_color1
gc2 = mp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
end
#==============================================================================
# ■ Window_ActorCommand
#------------------------------------------------------------------------------
# 菜单画面显示角色指令的窗口。
#==============================================================================
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :commands # 命令
WLH = 28
#--------------------------------------------------------------------------
# ● 初始化对象
# width : 窗口的宽
# commands : 命令字符串序列
# column_max : 行数 (2 行以上时选择)
# row_max : 列数 (0:列数加起来)
# spacing : 选项横向排列时间隔空白宽度
#--------------------------------------------------------------------------
def initialize(width = 128, commands = [], column_max = 1, row_max = 8, spacing = 32)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(0, 0, width, row_max * 32 + 32, spacing)
@commands = commands
@item_max = commands.size
@column_max = column_max
@remember_index = -1
self.index = 0
self.y = (Graphics.height - self.height) / 2 - 8
update
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@icon_list = [144, 128, 52, 137, 158, 189]
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# enabled : 有效标记录。是false 的时候半透明绘画
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
draw_icon(@icon_list[index], rect.x, rect.y, true) if index == self.index
self.contents.font.color = normal_color
if !enabled or self.index != index
self.contents.font.color.alpha = 64
else
self.contents.font.color.alpha = 255
end
rect.x += 26
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# ● 获取项目描画矩形
# index : 项目编号
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# ● 刷新类型
#--------------------------------------------------------------------------
def update
super
@remember_index = self.index if self.index == -1
if @remember_index != self.index
@remember_index = self.index
refresh
end
end
end
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# 显示菜单画面和同伴状态的窗口。
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 544, 416)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for actor in $game_party.members
draw_actor_face(actor,actor.index * 96 + 2,42, 92)
x = actor.index * 96 + WLH / 2
y = 144
draw_actor_name(actor, x, y)
draw_actor_class(actor, x , y+60)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x , y )
draw_actor_hp(actor, x -10, y +60+ WLH*1)
draw_actor_mp(actor, x -10, y +60+ WLH*2)
end
draw_icon(252 - 58, 384+5, 284-32)
end
#--------------------------------------------------------------------------
# ● 更新光标
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # 没有光标
self.cursor_rect.empty
elsif @index < @item_max # 普通
self.cursor_rect.set(@index * 96,30, 96,264)
elsif @index >= 100 # 自己
self.cursor_rect.set((@index - 100) * 96,30,96,264)
else # 全体
self.cursor_rect.set(0, 3, @item_max * 96, 264)
end
if Input.trigger?(Input::LEFT)
@index-=1
else
if Input.trigger?(Input::RIGHT)
@index+=1
end
if @index>3
return @index=0
else
if @index<-1
return @index=3
end
end
end
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 处理菜单画面的类。
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# menu_index : 指令光标初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@gold_window = Window_Gold.new(384, 284-32)
@status_window = Window_MenuStatus.new(0, 0)
@status_window.opacity = 0
@gold_window.opacity = 0
@command_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@gold_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "查看物品"
s2 = "使用特技"
s3 = "更换装备"
s4 = "查看状态"
s5 = "存储档案"
s6 = "结束游戏"
@command_window = Window_MenuCommand.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.x = 384
@command_window.y = 40
if $game_party.members.size == 0 # 同伴人数为 0 的情况下
@command_window.draw_item(0, false) # 物品无效化
@command_window.draw_item(1, false) # 特技无效化
@command_window.draw_item(2, false) # 装备无效化
@command_window.draw_item(3, false) # 状态无效化
end
if $game_system.save_disabled # 禁止存档的情况下
@command_window.draw_item(5, false) # 存档无效化
end
end
#--------------------------------------------------------------------------
# ● 更新指令选择
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # 物品
$scene = Scene_Item.new
when 1,2,3 # 特技、装备、状态
start_actor_selection
when 4 # 存档
$scene = Scene_File.new(true, false, false)
when 5 # 游戏结束
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# ● アクター選択の開始
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● アクター選択の終了
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# ● アクター選択の更新
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # スキル
$scene = Scene_Skill.new(@status_window.index)
when 2 # 装備
$scene = Scene_Equip.new(@status_window.index)
when 3 # ステータス
$scene = Scene_Status.new(@status_window.index)
end
end
end
end
复制代码
截图:
如不能显示,点击图片
作者:
越前リョーマ
时间:
2008-7-14 04:32
截图呢……
作者:
仲秋启明
时间:
2008-7-14 04:55
截图已更新
作者:
火鸡三毛老大
时间:
2008-7-14 05:15
脚本请用 HTML 框
图片请用 6RFTP 上传
作者:
越前リョーマ
时间:
2008-7-14 22:13
以下引用
火鸡三毛老大于2008-7-13 21:15:58
的发言:
脚本请用 HTML 框
图片请用 6RFTP 上传
是论坛附件……
话说点开图也看不见……
作者:
暴风龙
时间:
2008-7-17 06:43
提示:
作者被禁止或删除 内容自动屏蔽
作者:
追梦使者
时间:
2008-7-24 04:10
看不到……
作者:
火鸡三毛老大
时间:
2008-7-24 21:33
其实这个排版还是不错的...
作者:
Beside
时间:
2008-7-24 21:59
发个图上来
作者:
yooucs
时间:
2008-7-25 00:09
<?xml version="1.0" encoding="UTF-8" ?>
- <result>
<code>FA_INVALID_SESSION</code>
<messages />
</result>
脚本出错了otl...
作者:
暧幺
时间:
2008-10-12 10:10
提示:
作者被禁止或删除 内容自动屏蔽
作者:
drgdrg
时间:
2008-10-12 10:16
图片点进去是一堆代码- -
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1