搜索附件  

简易设置菜单.rar

 

简陋设置菜单(几乎可用于所有游戏):
这个是支持子选项窗口的一个范例工程

效果图:


确实很简陋...!
(使用前确定有支持子选项的窗口)
使用方法:地图上按下F8 或者调用$scene = Scene_Set.new

脚本如下:[code]#==============================================================================#                           简易设置菜单#              ISA#                      主要是示范 如何用 Window_Folder# 把你的大名及信息写到这... \n 表示换行(用的是print 别骂我,我的确很懒...)Info = "简易设置菜单 + 子选择窗口 -by 沙漠.灰 \n      版本: v0.5 "# 是否允许修改帧速(true=是  false=否)RunSpeed = true#==============================================================================# ■ Scene_Map#------------------------------------------------------------------------------#  处理地图画面的类。#==============================================================================class Scene_Map  alias isa_dust_update update  def update    isa_dust_update    # 按 F8 调出设置菜单    if Input.trigger?(Input::F8)      # 不是在事件执行中或菜单禁止中      unless $game_system.map_interpreter.running? or             $game_system.menu_disabled        $scene = Scene_Set.new      end    end  endend#==============================================================================# ■ Scene_Set#------------------------------------------------------------------------------#   主要是示范 如何用 Window_Folder#==============================================================================class Scene_Set  #--------------------------------------------------------------------------  # ● 主处理  #--------------------------------------------------------------------------  def main    @temp=[$game_system.bgm_v,$game_system.bgs_v,$game_system.me_v,$game_system.se_v]    @temp_dup = @temp.dup    @graphics_frame_rate = Graphics.frame_rate    # 生成活动块    @spriteset = Spriteset_Map.new    commands = [["游戏设置","音量设置(按左右键)","游戏加速(退出游戏无效)","版本信息"],"直接退出","保存退出"]    @folder_window = Window_Folder.new(50,96,370,32*7,commands)    @folder_window.disable_item([0,2]) unless RunSpeed    17.times{@folder_window.not_really_move("left ")}    # 生成窗口    window 0    # 执行过渡    Graphics.transition    17.times{Graphics.update;@folder_window.not_really_move("right")}    # 主循环    loop do      # 刷新游戏画面      Graphics.update      # 刷新输入信息      Input.update      # 刷新画面      update      # 如果画面被切换的话就中断循环      if $scene != self        break      end    end    17.times{Graphics.update;@folder_window.not_really_move("left ")}    # 准备过渡    Graphics.freeze    # 释放窗口    @spriteset.dispose    @set_window.dispose    @folder_window.dispose  end  #--------------------------------------------------------------------------  # ● 生成窗口  #--------------------------------------------------------------------------  def window(index)    @set_window_index = index    if index == 0      @set_window.dispose if @set_window != nil      @set_window = Window_Command.new(192, ["BGM","BGS","ME","SE",])      @set_window.x = 420      @set_window.y = 96+32      @set_window.index = -1      4.times{|i|draw(i,@temp)}      17.times{@set_window.not_really_move("left ")}      @set_window.visible = @set_window.active = false    else      @set_window.dispose if @set_window != nil      @set_window = Window_Command.new(192, ["帧率"])      @set_window.x = 420      @set_window.y = 96+32*2      @set_window.index = -1      draw(0,Graphics.frame_rate)      17.times{@set_window.not_really_move("left ")}      @set_window.visible = @set_window.active = false    end  end  #--------------------------------------------------------------------------  # ● 描绘 数字  #--------------------------------------------------------------------------  def draw(index,val)    rect = Rect.new(4+32*2, 32 * index, @set_window.contents.width - 82, 32)    @set_window.contents.fill_rect(rect, Color.new(0, 0, 0, 0))    @set_window.contents.draw_text(rect, val.to_s,2)  end  #--------------------------------------------------------------------------  # ● 刷新画面  #--------------------------------------------------------------------------  def update    @set_window.update    @folder_window.update    if @folder_window.active      # C键被按下的情况下,并且@folder_window不是在移动      if Input.trigger?(Input::C) and @folder_window.c        if @folder_window.index == [0,2] && !RunSpeed          # 演奏冻结 SE          $game_system.se_play($data_system.buzzer_se)          return        else          # 演奏确定 SE          $game_system.se_play($data_system.decision_se)        end        case @folder_window.index[0]        when 0 # 游戏设置          case @folder_window.index[1]          when 1 # 音量设置            @folder_window.active = false            @set_window.active = @set_window.visible = true            17.times{Graphics.update;@set_window.not_really_move("right")}            @set_window.index = 0          when 2 # 游戏加速            window 1            @folder_window.active = false            @set_window.active = @set_window.visible = true            17.times{Graphics.update;@set_window.not_really_move("right")}            @set_window.index = 0          when 3 # 版本信息            print Info            return          end        when 2 # 保存&退出          $scene = Scene_Map.new        when 1 # 直接退出          Graphics.frame_rate = @graphics_frame_rate          $game_system.bgm_v,$game_system.bgs_v,$game_system.me_v,$game_system.se_v=@temp_dup          $game_system.bgm_play($game_system.playing_bgm)          $scene = Scene_Map.new        end      end    elsif @set_window.active      if Input.trigger?(Input::B) or Input.trigger?(Input::C)        # 演奏确定 SE        $game_system.se_play($data_system.decision_se)        @folder_window.active = true        @set_window.index = -1        17.times{Graphics.update;@set_window.not_really_move("left ")}        @set_window.active = @set_window.visible = false        window 0      end      if Input.repeat?(Input::LEFT)        if @set_window_index == 0          @temp[@set_window.index] = [@temp[@set_window.index]-1,0].max          draw(@set_window.index,@temp[@set_window.index])          $game_system.bgm_v,$game_system.bgs_v,$game_system.me_v,$game_system.se_v=@temp          $game_system.se_play($data_system.cursor_se)          $game_system.bgm_play($game_system.playing_bgm)        else          draw(0,Graphics.frame_rate -= 1)          $game_system.se_play($data_system.cursor_se)        end      end      if Input.repeat?(Input::RIGHT)        if @set_window_index == 0          @temp[@set_window.index] = [@temp[@set_window.index]+1,100].min          draw(@set_window.index,@temp[@set_window.index])          $game_system.bgm_v,$game_system.bgs_v,$game_system.me_v,$game_system.se_v=@temp          $game_system.se_play($data_system.cursor_se)          $game_system.bgm_play($game_system.playing_bgm)        else          draw(0,Graphics.frame_rate += 1)        end      end    end # of @folder_window.active  end # of def updateend # of class#==============================================================================# ■ Window_Base#------------------------------------------------------------------------------#  游戏中全部窗口的超级类。#==============================================================================class Window_Base < Window  #--------------------------------------------------------------------------  # ● 初始化  #--------------------------------------------------------------------------  alias isa_dust_initialize initialize  def initialize(*a)    isa_dust_initialize(*a)    @move_count = 0    @move_to_x  = 0    @move_to_y  = 0  end  #--------------------------------------------------------------------------  # ● 伪 移动  #--------------------------------------------------------------------------  def not_really_move(d="right")    d == "right" ? d = 1 : d = -1    self.x        += d * 5    self.ox       += d * 5    self.width    -= d * 5    self.opacity  += d * 15    self.contents_opacity += d * 15  end  #--------------------------------------------------------------------------  # ● 真 移动  #--------------------------------------------------------------------------  def move_to(x,y,count)    @move_to_x = x    @move_to_y = y    @move_count= count  end  #--------------------------------------------------------------------------  # ● 刷新  #--------------------------------------------------------------------------  alias isa_dust_update update  def update    isa_dust_update    # 移动完毕时,直接返回    return if @move_count

QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

GMT+8, 2024-9-21 16:29 , Processed in 0.040945 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.