查看: 2463|回复: 0

[RMVX发布] 标题画面和菜单出现额外选项,进入选项后居中显示图片

[复制链接]
梦石
0
星屑
1944
在线时间
404 小时
注册时间
2015-8-30
回帖
322
发表于 2016-1-20 21:02:44 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 有丘直方 于 2016-1-21 13:36 编辑

似乎没啥要说的。那就直接上效果图吧。
效果图.jpg
就是这样增加第四个选项。排序、文字、额外项目的数量什么的可以自己设置,只要不设置得出现错误就行。其实我觉得只要有点脚本基础的人都应该能自己设置吧,如果不会可以在回复里面问我。
自认为这个脚本应该大多用来放游戏介绍之类的吧,放版权信息也可以。
使用说明和一些废话啥的都放在脚本里面啦!
[pre lang="ruby" line="1"]=begin
大家好我是有丘直方啦!叫我“有丘”就好啦。
虽然是这里的新人,但是接触RMVX也有好几个月了吧。
嗯哼,是不是觉得我发个脚本啰嗦那么多?
这是我第一个在技术区发布的脚本,十分激动因此啰嗦那么多啊!
作为一个才学RGSS2大约才2个星期的人能做出这个脚本我也是很激动啊。
一个初中生难得寒假能有时间学学RGSS2……
(好像真的啰嗦多了。)
好吧那就这样……
啰嗦完毕……
=end

#==============================================================================
# 在标题画面和菜单插入另外内容的脚本  by 有丘直方
#------------------------------------------------------------------------------
# 使用方法:1.导入一幅图片到Graphics/Pictures/下,命名为Introduction。
#           2.将本脚本插入到main前。
#           3.设置下面的这个常量。
# 本脚本仅支持在标题画面和菜单增加选项并进入选项后居中显示图片的功能。
#==============================================================================

#--------------------------------------------------------------------------
# ● 常量
#--------------------------------------------------------------------------
TITLE = "游戏介绍"    # 标题画面和菜单额外的选项的内容

#==============================================================================
# ■ Scene_IntroductionTitle
#------------------------------------------------------------------------------
#  处理在标题画面游戏介绍画面的类。
#==============================================================================
class Scene_IntroductionTitle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_introduction_graphic
  end
  #--------------------------------------------------------------------------
  # ● 执行渐变
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(20)
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_introduction_graphic
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    if Input.trigger?(Input::B)
      title
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成图形
  #--------------------------------------------------------------------------
  def create_introduction_graphic
    @sprite = Sprite.new
    @sprite.bitmap = Bitmap.new("Graphics/Pictures/Introduction")
  end
  #--------------------------------------------------------------------------
  # ● 释放图形
  #--------------------------------------------------------------------------
  def dispose_introduction_graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 命令:返回标题画面
  #--------------------------------------------------------------------------
  def title
    Sound.play_cancel
    $scene = Scene_Title.new
  end
end

#==============================================================================
# ■ Scene_IntroductionMenu
#------------------------------------------------------------------------------
#  处理菜单的游戏介绍画面的类。
#==============================================================================
class Scene_IntroductionMenu < Scene_Base
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_introduction_graphic
  end
  #--------------------------------------------------------------------------
  # ● 执行渐变
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(20)
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_introduction_graphic
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    if Input.trigger?(Input::B)
      menu
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成图形
  #--------------------------------------------------------------------------
  def create_introduction_graphic
    @sprite = Sprite.new
    @sprite.bitmap = Bitmap.new("Graphics/Pictures/Introduction")
  end
  #--------------------------------------------------------------------------
  # ● 释放图形
  #--------------------------------------------------------------------------
  def dispose_introduction_graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 命令:返回菜单
  #--------------------------------------------------------------------------
  def menu
    Sound.play_cancel
    $scene = Scene_Menu.new(8)
  end
end

#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  处理标题画面的类。
#==============================================================================
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0    # 新的开始
        command_new_game
      when 1    # 继续游戏
        command_continue
      when 2    # 退出游戏
        command_shutdown
      when 3    # 另外选项
        $scene = Scene_IntroductionTitle.new
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成命令窗口
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::new_game
    s2 = Vocab::continue
    s3 = Vocab::shutdown
    s4 = TITLE
    @command_window = Window_Command.new(172, [s1, s2, s3, s4])
    @command_window.x = (544 - @command_window.width) / 2
    @command_window.y = 264
    if @continue_enabled                    # 如果「继续」有效
      @command_window.index = 1             # 将光标移至「继续游戏」
    else                                    # 否则则将「继续游戏」半透明化
      @command_window.draw_item(1, false)
    end
    @command_window.openness = 0
    @command_window.open
  end
  #--------------------------------------------------------------------------
  # ● 命令:游戏介绍
  #--------------------------------------------------------------------------
  def command_introduction
    Sound.play_decision
    $scene = Scene_Introduction.new
  end
end

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # ● 生成命令窗口
  #--------------------------------------------------------------------------
  def create_command_window
    s1  = Vocab::item
    s2  = Vocab::skill
    s3  = Vocab::equip
    s4  = Vocab::status
    s5  = Vocab::save
    s6  = TITLE
    s7 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    if $game_party.members.size == 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(4, 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_IntroductionMenu.new
      when 6        # 结束游戏
        $scene = Scene_End.new
      end
    end
  end
end
[/pre]
嗯哼就是这样啦……有BUG、建议什么的回复哦!
范例工程就不需要了吧……这个脚本很好用的。

评分

参与人数 1星屑 +200 收起 理由
怪蜀黍 + 200 新人奖励

查看全部评分

小仙女一枚~
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部