Project1

标题: 横版的游戏菜单(似乎没人干的事^) [打印本页]

作者: 315362463    时间: 2007-6-10 00:03
标题: 横版的游戏菜单(似乎没人干的事^)
#==============================================================================
# ■ 这个没有任何含金量的脚本来自一位扬州邗江中学的学生:胡鹏伟
#    愿结识更多的rmer,加qq:315362463
#  
#==============================================================================
#==============================================================================
# ■ Window_Title
#------------------------------------------------------------------------------
#  标题画面的窗口。
#==============================================================================

class Window_Title < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
   def initialize
    super(160, 350, 320, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    @commands = ["开始游戏", "结束游戏"]
    @item_max = 2
    @column_max = 2
    draw_item(0, normal_color)
    draw_item(1, normal_color)
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目标号
  #     color : 文字颜色
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(index * 160 + 4, 0, 128 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
  #--------------------------------------------------------------------------
  # ● 更新光标矩形
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(index * 160, 0, 128, 32)
  end
end

上面是新的窗口,scene_title也要改一点
  # 生成命令窗口
   # s1 = "新游戏"
    #s2 = "继续"
    #s3 = "退出"
    #@command_window = Window_Command.new(192, [s1, s2, s3])
    #@command_window.back_opacity = 160
    #@command_window.x = 320 - @command_window.width / 2
    #@command_window.y = 288
    # 判定继续的有效性
    # 存档文件一个也不存在的时候也调查
    # 有効为 @continue_enabled 为 true、無効为 false
   # @continue_enabled = false
   # for i in 0..3
     # if FileTest.exist?("Save#{i+1}.rxdata")
     #   @continue_enabled = true
      #end
   # end
    # 继续为有效的情况下、光标停止在继续上
    # 无效的情况下、继续的文字显示为灰色
   # if @continue_enabled
    #  @command_window.index = 1
   # else
   #   @command_window.disable_item(1)
   # end
替换为
   # 生成标题图形
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    @command_window_title=Window_Title.new
还有后面的update部分
作者: 315362463    时间: 2007-6-10 00:03
标题: 横版的游戏菜单(似乎没人干的事^)
#==============================================================================
# ■ 这个没有任何含金量的脚本来自一位扬州邗江中学的学生:胡鹏伟
#    愿结识更多的rmer,加qq:315362463
#  
#==============================================================================
#==============================================================================
# ■ Window_Title
#------------------------------------------------------------------------------
#  标题画面的窗口。
#==============================================================================

class Window_Title < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
   def initialize
    super(160, 350, 320, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    @commands = ["开始游戏", "结束游戏"]
    @item_max = 2
    @column_max = 2
    draw_item(0, normal_color)
    draw_item(1, normal_color)
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目标号
  #     color : 文字颜色
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(index * 160 + 4, 0, 128 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
  #--------------------------------------------------------------------------
  # ● 更新光标矩形
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(index * 160, 0, 128, 32)
  end
end

上面是新的窗口,scene_title也要改一点
  # 生成命令窗口
   # s1 = "新游戏"
    #s2 = "继续"
    #s3 = "退出"
    #@command_window = Window_Command.new(192, [s1, s2, s3])
    #@command_window.back_opacity = 160
    #@command_window.x = 320 - @command_window.width / 2
    #@command_window.y = 288
    # 判定继续的有效性
    # 存档文件一个也不存在的时候也调查
    # 有効为 @continue_enabled 为 true、無効为 false
   # @continue_enabled = false
   # for i in 0..3
     # if FileTest.exist?("Save#{i+1}.rxdata")
     #   @continue_enabled = true
      #end
   # end
    # 继续为有效的情况下、光标停止在继续上
    # 无效的情况下、继续的文字显示为灰色
   # if @continue_enabled
    #  @command_window.index = 1
   # else
   #   @command_window.disable_item(1)
   # end
替换为
   # 生成标题图形
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    @command_window_title=Window_Title.new
还有后面的update部分
作者: 七夕小雨    时间: 2007-6-11 06:57
这个不是只有标题才能用么……

现在标题都流行使用事件作……你这个不流行了~{/hx}
作者: gpra8764    时间: 2007-6-15 22:02
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1