O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

[TSDA] Menu com Roleta

Iniciado por thiago_d_d, 18/12/2012 às 22:15

18/12/2012 às 22:15 Última edição: 20/01/2017 às 10:08 por King Gerar


Script de Menu com Roleta


[info float=left border=#6587E4]
Informações:
--------------------------------------------------
.
• Autor: thiago_d_d
• Versão: 1.0
• Incompatibilidade: Desprezívell
• Lag gerado: Desprezível
• Customizável: Sim
• Requer Recursos Extras: Sim
[/info][box class=catbg2]
Resumo
[/box][box class=catbg4]Um menu especial e compacto. Nele é mostrado nome do mapa, tempo de jogo e passos, assim como uma nova opção: "Som". Com essa opção, é possível mudar o volume das músicas no jogo, assim como tocar músicas de testes.Além disso, como o próprio nome diz, a seleção de personagens e feita por uma roleta.Além disso tudo, possui mais algumas customizações(vide script).[/box]


[box class=catbg2]
Instalação e configuração
[/box]
Cole o seguinte script acima de Main. Não se esqueça de ler as intruções contidas no script:
#=======================================================
# * MRM - Comunidade RPG Maker!
#   www.mundorpgmaker.com
# * GRM - Comunidade RPG Maker!
#   www.galaxiarpgmaker.com.br
#
# [TSDA] Menu com Roleta
#   --> Versão 1.0
# Última atualização: 11/12/2010
# ----Créditos
#     thiago_d_d - por fazer o script
#     Madajuv - pelo script de HQ
#=======================================================
# * Características
#=======================================================
# Esse script implementa um novo menu.Características:
#   - fundo
#   - roleta para escolher personagens
#   - tempo de jogo, passos, ouro e mapa
#   - menu "sons"
#   - mensagem quando o menu fica ligado muito tempo
#=======================================================
# * Como usar
#=======================================================
# Cole o script acima de Main e delete os saves do seu
# jogo.
#   Edite também as linhas 34 a 46, que dizem
#   respeito a:
#  - Nome do gráfico de fundo(na pasta Pictures)
#  - Nome das músicas que podem ser tocadas no menu.
# Se for usar o balão de fala, configure também o modulo
# FUKI.
#=======================================================
module TSDA
  ROULETTE_MENU_BACKGROUND = "001-Title01"
  MENU_MUSIC = [
  "012-Theme01",
  "013-Theme02",
  "014-Theme03"
  ]
  #Mostrar mensagem quando o menu ficar muito tempo
  #na tela?
  WARN = true
  #Tempo da ação acima
  FRAME_WAIT = 200
  #Mensagem a ser exibida
  PERS_MESSAGE_MENU = "Ande logo..."
end
module FUKI
  # Nome do arquivo windowskin para a janela de mensagem.
  FUKI_SKIN_NAME = "Quadrinhos"
  # Nome do arquivo windowskin para a janela do nome.
  NAME_SKIN_NAME = "Quadrinhos"
  MES_FONT_SIZE = 22    # Tamanho da fonte do texto da mensagem.
  NAME_FONT_SIZE = 20   # Tamanho da fonte do nome.
  # Definição das cores das fontes.
  FUKI_COLOR = Color.new(0, 0, 0, 255)  # Mensagem
  NAME_COLOR = Color.new(255, 0, 0, 255)  # Nome
  FUKI_OPACITY = 255    #Transparência da janela de balões.
  MES_OPACITY = 160     #Transparência da janela normal.
  NAME_OPACITY = 160    #Transparência da janela do nome.
  NAME_SHIFT_X = 0    #Posição X da janela de nome.
  NAME_SHIFT_Y = 16   #Posição Y da janela de nome.
  POS_FIX = true #Posição fixa ao evento.
  CORNER_SHIFT = false #Não modifique.
  SHIFT_PIXEL = 4      #Não modifique.
  CHARACTOR_HEIGHT = 48  #Tamanho do Chars.
  POP_SHIFT_TOP = -24     #Posição da seta de indicação(cima).
  POP_SHIFT_UNDER = -24 #Posição da seta de indicação(baixo).
  MES_SPEED = 1 #Velocidade padrão do texto.
end
#-------------------------------------------------------------------
# Fim da Edição
#==============================================================================
class Window_FukiMessageMenu < Window_Selectable
  def initialize
    super(80, 304, 480, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.z = 9998
    @fade_in = false
    @fade_out = false
    @contents_showing = false
    @cursor_width = 0
    self.active = false
    self.index = -1
    @w = 0
    @h = 0
    @wait = 0
    @dx = 0
    @dy = 0
    $mes_speed = FUKI::MES_SPEED
  end
  def refresh_create
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = FUKI::MES_FONT_SIZE
    get_windowsize
    w = 200
    h = 56
    set_fukidasi(self.x, self.y, w, h)
    set_namewindow
    @dx = @dy = 0
    @cursor_width = 0
    @contents_drawing = true
    if $mes_speed == 0
      while $game_temp.message_text != ""
        draw_massage
      end
      draw_opt_text
      @contents_showing_end = true
      @contents_drawing = false
    else
      refresh_drawtext
    end
  end
  def refresh_drawtext
    if $game_temp.message_text != nil
      if @wait > 0
        @wait -= 1
      elsif @wait == 0
        draw_massage
        @wait = $mes_speed
      end
    end
    if $game_temp.message_text == ""
      draw_opt_text
      @contents_showing_end = true
      @contents_drawing = false
    end
  end
  def get_windowsize
    x = y = 0
    @h = @w = 0
    @cursor_width = 0
    if $game_temp.choice_start == 0
      x = 16
    end
    if $game_temp.message_text != nil
    text = $game_temp.message_text.clone
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      text.gsub!(/\\\\/) { "\000" }
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
      text.gsub!(/\\[Gg]/) { "\002" }
      while ((c = text.slice!(/./m)) != nil)
        if c == "\000"
          c = "\\"
        end
        if c == "\001" or c == "\002"
          next
        end
        if c == "\n"
          y += 1
          @h = y
          @w = x > @w ? x : @w
          if y >= $game_temp.choice_start
            @w = x + 8 > @w ? x + 8 : @w
          end
          x = 0
          if y >= $game_temp.choice_start
            x = 8
          end
          next
        end
        x += self.contents.text_size(c).width
      end
    end
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @h += 1
      x = digits_max * self.contents.font.size + 16
      @w = x > @w ? x : @w
    end
  end
  def draw_massage
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      if ((c = text.slice!(/./m)) != nil)
        if @dy >= $game_temp.choice_start
          @dx = 8
          self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
          @dx += self.contents.text_size(c).width
          while ((c = text.slice!(/./m)) != "\n")
            self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
            @dx += self.contents.text_size(c).width
          end
          if c == "\n"
            @cursor_width = [@cursor_width, @dx].max
            @dy += 1
            @dx = 0
          end
          return
        end
        self.contents.font.size = FUKI::MES_FONT_SIZE
        font_size = self.contents.font.size
        self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
        @dx += self.contents.text_size(c).width
      end
    end
  end
  def refresh
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      while ((c = text.slice!(/./m)) != nil)
        self.contents.font.size = FUKI::MES_FONT_SIZE
        font_size = self.contents.font.size
        self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
        @dx += self.contents.text_size(c).width
      end
    end
  end
  def draw_opt_text
    if $game_temp.choice_max > 0
      @item_max = $game_temp.choice_max
      self.active = true
      self.index = 0
    end
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
  end
  def set_fukidasi(x, y, width, height)
    self.pause = false
    pos = get_fuki_pos(width, height)
    x = pos[0]
    y = pos[1]
    skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
    self.windowskin = RPG::Cache.windowskin(skin)
    self.x = x
    self.y = y
    self.height = height
    self.width = width
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = FUKI::FUKI_OPACITY
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = FUKI::MES_FONT_SIZE
    if $game_system.message_frame == 0
      tale_pos = get_tale_pos
      @tale = Sprite.new
      case @message_position
        when 0
          @tale.bitmap = RPG::Cache.windowskin(skin + "-top")
          @tale.x = tale_pos[0]
          @tale.y = tale_pos[1]
          @tale.z = self.z + 1
        when 1
          @tale.dispose
          @tale = nil
        when 2
          @tale.bitmap = RPG::Cache.windowskin(skin + "-under")
          @tale.x = tale_pos[0]
          @tale.y = tale_pos[1]
          @tale.z = self.z + 1
        end
      end
  end
  def get_fuki_pos(width, height)
    return[183,60]
  end
  def get_tale_pos
    @message_position = 0
    return[223,100]
  end
  def set_namewindow
    if $mes_name == nil or $mes_name == ""
      return
    else
      mes_name = $mes_name
      name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
      name_height = FUKI::NAME_FONT_SIZE
      name_x = self.x + FUKI::NAME_SHIFT_X
      name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
      @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
      skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
      @name_win.windowskin = RPG::Cache.windowskin(skin)
      @name_win.back_opacity = FUKI::NAME_OPACITY
      @name_win.z = self.z + 1
      @name_contents = Sprite.new
      @name_contents.x = name_x + 12
      @name_contents.y = name_y + 8
      @name_contents.bitmap = Bitmap.new(name_width, name_height)
      @name_contents.z = @name_win.z + 2
      nil_color = Color.new(0,0,0,0)
      if FUKI::NAME_COLOR != nil_color
        @name_contents.bitmap.font.color = FUKI::NAME_COLOR
      else
        @name_contents.bitmap.font.color = normal_color
      end
      @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
      rect = @name_contents.bitmap.text_size(mes_name)
      @name_win.width = rect.width + 32
      @name_contents.bitmap.draw_text(rect, mes_name)
    end
  end
  def del_fukidasi
    if @tale != nil
      @tale.dispose
      @tale = nil
    end
    if @name_win != nil
      @name_win.dispose
      @name_win = nil
      @name_contents.dispose
      @name_contents = nil
    end
    self.opacity = 0
    self.x = 80
    self.width = 480
    self.height = 160
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, height - 32)
    self.pause = true
  end
  def get_character(parameter)
      case parameter
    when -1
      return $game_player
    when 0
      events = $game_map.events
      return events == nil ? nil : events[$active_event_id]
    else
      events = $game_map.events
      return events == nil ? nil : events[parameter]
    end
  end
  def reset_window
    if $game_temp.in_battle
      self.y = 16
    else
      case $game_system.message_position
      when 0
        self.y = 16
      when 1
        self.y = 160
      when 2
        self.y = 304
      end
    end
    if $game_system.message_frame == 0
      self.opacity = 255
    else
      self.opacity = 0
    end
    self.back_opacity = FUKI::MES_OPACITY
  end
  def update
    super
    if @tale != nil
      pos = get_fuki_pos(self.width, self.height)
      self.x = pos[0]
      self.y = pos[1]
      tale_pos = get_tale_pos
      @tale.x = tale_pos[0]
      @tale.y = tale_pos[1]
      if @name_win != nil
        name_height = FUKI::NAME_FONT_SIZE
        @name_win.x = self.x + FUKI::NAME_SHIFT_X
        @name_win.y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
        @name_contents.x = @name_win.x + 12
        @name_contents.y = @name_win.y + 8
      end
    end
    if @fade_in
      self.contents_opacity += 24
      if @name_win != nil
        @name_win.opacity += 24
      end
      if @tale != nil
        @tale.opacity += 24
      end
      if @input_number_window != nil
        @input_number_window.contents_opacity += 24
      end
      if self.contents_opacity == 255
        @fade_in = false
      end
      return
    end
    if @contents_drawing
      if Input.trigger?(Input::C)
        refresh
        return
      end
      refresh_drawtext
      return
    end
    if @contents_showing_end
      if $game_temp.choice_max == 0 and @tale == nil
        self.pause = true
      else
        self.pause = false
      end
      if Input.trigger?(Input::B)
        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
          $game_system.se_play($data_system.cancel_se)
          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
          terminate_message
        end
      end
      return
    end
    if @fade_out == false and $game_temp.message_text != nil
      @contents_showing = true
      $game_temp.message_window_showing = true
      reset_window
      refresh_create
      if @name_win != nil
        @name_win.opacity = 0
      end
      if @tale != nil
        @tale.opacity = 0
      end
      Graphics.frame_reset
      self.visible = true
      self.contents_opacity = 0
      if @input_number_window != nil
        @input_number_window.contents_opacity = 0
      end
      @fade_in = true
      return
    end
    if self.visible
      @fade_out = true
      self.opacity -= 48
      if @name_win != nil
        @name_win.opacity -= 48
      end
      if @tale != nil
        @tale.opacity -= 48
      end
      if self.opacity == 0
        self.visible = false
        @fade_out = false
        $game_temp.message_window_showing = false
        del_fukidasi
      end
      return
    end
  end
  def dispose
    terminate_message
    $game_temp.message_window_showing = true
    if @input_number_window != nil
      @input_number_window.dispose
    end
    super
  end
  def terminate_message
    self.active = false
    self.pause = false
    self.index = -1
    self.contents.clear
    @contents_showing = false
    @contents_showing_end = false
    if $game_temp.message_proc != nil
      $game_temp.message_proc.call
    end
    $game_temp.message_text = nil
    $game_temp.message_proc = nil
    $game_temp.choice_start = 99
    $game_temp.choice_max = 0
    $game_temp.choice_cancel_type = 0
    $game_temp.choice_proc = nil
    $game_temp.num_input_start = 99
    $game_temp.num_input_variable_id = 0
    $game_temp.num_input_digits_max = 0
    if @gold_window != nil
      @gold_window.dispose
      @gold_window = nil
    end
  end
  def update_cursor_rect
    if @index >= 0
      n = $game_temp.choice_start + @index
      self.cursor_rect.set(8, n * 32, @cursor_width, 32)
    else
      self.cursor_rect.empty
    end
  end
  def normal_color
    nil_color = Color.new(0,0,0,0)
    if FUKI::FUKI_COLOR != nil_color
      color = FUKI::FUKI_COLOR
    else
      color = super
    end
    return color
  end
end
class Music_Info
  attr_accessor    :music_index
  attr_accessor    :music_vol
  attr_accessor    :sound_vol
  def initialize
    @music_index = 0
    @music_vol = 100
    @sound_vol = 100
  end
end
class Scene_End
  def update
    @command_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(6)
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        command_to_title
      when 1
        command_shutdown
      when 2
        command_cancel
      end
      return
    end
  end
  def command_cancel
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Menu.new(6)
  end
end
class Scene_Title
  alias rou_menu_command_new_game command_new_game
  def command_new_game
    rou_menu_command_new_game
    $game_music_info = Music_Info.new
  end
end
class Scene_Save
  alias rou_menu_write_save_data write_save_data
  def write_save_data(file)
    rou_menu_write_save_data(file)
    Marshal.dump($game_music_info, file)
  end
end
class Scene_Load
  alias rou_menu_read_save_data read_save_data
  def read_save_data(file)
    rou_menu_read_save_data(file)
    $game_music_info        = Marshal.load(file)
  end
end
class Game_System
  attr_accessor       :playing_bgm
  alias old_bgm_play bgm_play
  def bgm_play(bgm)
    if $game_music_info.nil?
      old_bgm_play(bgm)
      return
    end
    @playing_bgm = bgm
    if bgm != nil and bgm.name != ""
      Audio.bgm_play("Audio/BGM/" + bgm.name, $game_music_info.music_vol, bgm.pitch)
    else
      Audio.bgm_stop
    end
    Graphics.frame_reset
  end
  alias old_se_play se_play
  def se_play(se)
    if $game_music_info.nil?
      old_se_play(se)
      return
    end
    if se != nil and se.name != ""
      Audio.se_play("Audio/SE/" + se.name, $game_music_info.sound_vol, se.pitch)
    end
  end
  alias old_me_play me_play
  def me_play(me)
    if $game_music_info.nil?
      old_me_play(me)
      return
    end
    if me != nil and me.name != ""
      Audio.me_play("Audio/ME/" + me.name, $game_music_info.sound_vol, me.pitch)
    else
      Audio.me_stop
    end
    Graphics.frame_reset
  end
  alias old_bgs_play bgs_play
  def bgs_play(bgs)
    if $game_music_info.nil?
      old_bgs_play(bgs)
      return
    end
    @playing_bgs = bgs
    if bgs != nil and bgs.name != ""
      Audio.bgs_play("Audio/BGS/" + bgs.name, $game_music_info.sound_vol, bgs.pitch)
    else
      Audio.bgs_stop
    end
    Graphics.frame_reset
  end
end
class Window_SPRMenu < Window_Base
 
end
class Scene_Menu
  include TSDA
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Salvar"
    s6 = "Sair"
    s7 = "Som"
    @frame_count = 0
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s7, s6])
    @command_window.index = @menu_index
    @command_window.x = 0
    @command_window.y = 0
    @gold_window = Window_Gold.new
    @gold_window.y = 416
    @gold_window.x = 240
    @message_window = Window_FukiMessageMenu.new
    @message_window.x = 160
    @char_window = Window_ShowFActorTh.new
    @info_window = Window_ShowInfoTh.new
    @roulette_window = Window_RouletteTh.new
    @background = Sprite.new
    @background.bitmap = RPG::Cache.picture(ROULETTE_MENU_BACKGROUND)
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @gold_window.dispose
    @char_window.dispose
    @info_window.dispose
    @roulette_window.dispose
    @message_window.del_fukidasi
    @message_window.dispose
  end
  def message_show
    $game_temp.message_text = PERS_MESSAGE_MENU.clone
    $game_temp.message_proc = Proc.new {}
  end
  def update
    @gold_window.update
    @char_window.update
    @info_window.update
    @message_window.update
    @roulette_window.update
    if WARN
      if @frame_count <= FRAME_WAIT + 200
        @frame_count += 1
      end
      if @frame_count == FRAME_WAIT
        message_show
      end
      if @frame_count == FRAME_WAIT + 200
        @message_window.del_fukidasi
        @message_window.dispose
        @message_window = Window_FukiMessageMenu.new
        @frame_count = 0
      end
    end
    if @roulette_window.moving
      return
    end
    if @transition
      if @roulette_window.y > -320
        @roulette_window.y -= 10
      else
        if @sound
          @roulette_window.phase = 2
        elsif @roulette_window.phase == 0
          @roulette_window.phase = 1
        else
          @roulette_window.phase = 0
        end
        @roulette_window.refresh
        @transition2 = true
        @transition = false
      end
      return
    end
    if @transition2
      if @roulette_window.y < 16
        @roulette_window.y += 10
      else
        @transition2 = false
      end
      return
    end
    @command_window.update
    if @command_window.active
      if Input.trigger?(Input::C)
        if $game_party.actors.size == 0 and @command_window.index < 4
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        case @command_window.index
        when 0
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Item.new
        when 1
          $game_system.se_play($data_system.decision_se)
          @roulette_window.index = 0
          @command_window.active = false
          @transition = true
        when 2
          $game_system.se_play($data_system.decision_se)
          @roulette_window.index = 0
          @command_window.active = false
          @transition = true
        when 3
          $game_system.se_play($data_system.decision_se)
          @roulette_window.index = 0
          @command_window.active = false
          @transition = true
        when 4
          if $game_system.save_disabled
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Save.new
        when 6
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_End.new
        when 5
          $game_system.se_play($data_system.decision_se)
          @roulette_window.index = 0
          @command_window.active = false
          @sound = true
          @transition = true
        end
        return
      elsif Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
    else
      if @roulette_window.phase == 1
        index = @roulette_window.index
        size = $game_party.actors.size
        if (index <= (size - 1) and
          Input.trigger?(Input::DOWN) and $game_party.actors.size > 1)
          $game_system.se_play($data_system.cursor_se)
          @roulette_window.moving = true
          @roulette_window.move_counter = 20
          @roulette_window.last_index = index
          @roulette_window.index = (index + 1) % size
        end
        if (index >= 0 and
          Input.trigger?(Input::UP) and $game_party.actors.size > 1)
          $game_system.se_play($data_system.cursor_se)
          @roulette_window.moving = true
          @roulette_window.move_counter = 20
          @roulette_window.last_index = index
          @roulette_window.index = (index + size - 1) % size
        end
        if Input.trigger?(Input::C)
          case @command_window.index
          when 1
            if $game_party.actors[@roulette_window.index].restriction >= 2
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            $game_system.se_play($data_system.decision_se)
            $scene = Scene_Skill.new(@roulette_window.index)
          when 2
            $game_system.se_play($data_system.decision_se)
            $scene = Scene_Equip.new(@roulette_window.index)
          when 3
            $game_system.se_play($data_system.decision_se)
            $scene = Scene_Status.new(@roulette_window.index)
          end
          return
        elsif Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          @command_window.active = true
          @sound = false
          @transition = true
        end
      else
        index = @roulette_window.index
        if Input.repeat?(Input::DOWN)
          if (Input.trigger?(Input::DOWN)) or
             index < 2
            $game_system.se_play($data_system.cursor_se)
            @roulette_window.index = (index + 1) % 3
          end
        end
        if Input.repeat?(Input::UP)
          if (Input.trigger?(Input::UP)) or
             index > 0
            $game_system.se_play($data_system.cursor_se)
            @roulette_window.index = (index + 2) % 3
          end
        end
        if Input.repeat?(Input::RIGHT)
          case @roulette_window.index
          when 0
            v = $game_music_info.music_index
            max = MENU_MUSIC.size - 1
          when 1
            v = $game_music_info.music_vol
            max = 100
          when 2
            v = $game_music_info.sound_vol
            max = 100
          end
          if (Input.trigger?(Input::RIGHT)) or
            v < max
            $game_system.se_play($data_system.cursor_se)
            case @roulette_window.index
            when 0
              $game_music_info.music_index = ($game_music_info.music_index + 1) % MENU_MUSIC.size
            when 1
              $game_music_info.music_vol = ($game_music_info.music_vol + 1) % 101
              unless $game_system.playing_bgm.nil?
                $game_system.bgm_play(RPG::AudioFile.new($game_system.playing_bgm.name,$game_music_info.music_vol,100))
              end
            when 2
              $game_music_info.sound_vol = ($game_music_info.sound_vol + 1) % 101
              unless $game_system.playing_bgm.nil?
                $game_system.bgm_play(RPG::AudioFile.new($game_system.playing_bgm.name,$game_music_info.music_vol,100))
              end
            end
            @roulette_window.refresh
          end
        end
        if Input.repeat?(Input::LEFT)
          case @roulette_window.index
          when 0
            v = $game_music_info.music_index
          when 1
            v = $game_music_info.music_vol
          when 2
            v = $game_music_info.sound_vol
          end
          if (Input.trigger?(Input::LEFT)) or
             v > 0
            $game_system.se_play($data_system.cursor_se)
            case @roulette_window.index
            when 0
              $game_music_info.music_index = ($game_music_info.music_index + MENU_MUSIC.size - 1) % MENU_MUSIC.size
            when 1
              $game_music_info.music_vol = ($game_music_info.music_vol + 100) % 101
              unless $game_system.playing_bgm.nil?
                $game_system.bgm_play(RPG::AudioFile.new($game_system.playing_bgm.name,$game_music_info.music_vol,100))
              end
            when 2
              $game_music_info.sound_vol = ($game_music_info.sound_vol + 100) % 101
              unless $game_system.playing_bgm.nil?
                $game_system.bgm_play(RPG::AudioFile.new($game_system.playing_bgm.name,$game_music_info.music_vol,100))
              end
            end
            @roulette_window.refresh
          end
        end
        if Input.trigger?(Input::C) and @roulette_window.index == 0
          $game_system.se_play($data_system.decision_se)
          $game_system.bgm_stop
          $game_system.bgm_play(RPG::AudioFile.new(MENU_MUSIC[$game_music_info.music_index],$game_music_info.music_vol,100))
        elsif Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          @command_window.active = true
          @sound = false
          @transition = true
        end
      end
    end
  end
end

class Window_ShowFActorTh < Window_Base
  def initialize
    super(204,112,160,192)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    actor = $game_party.actors[0]
    draw_actor_graphic(actor, 16, 64)
    draw_actor_class(actor, 32, 32)
    draw_actor_level (actor,32,0)
    draw_actor_name(actor,0 , 64)
    draw_actor_hp(actor, 0, 96)
    draw_actor_sp(actor, 0, 128)
  end
end

class Window_ShowInfoTh < Window_Base
  def initialize
    super(112,320,416,96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Tempo de Jogo")
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, text, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(134, 0, 120, 32, "Local")
    text = $game_map.map_name
    self.contents.font.color = normal_color
    self.contents.draw_text(134, 32, 120, 32, text, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(264, 0, 120, 32, "Passos")
    text = $game_party.steps.to_s
    self.contents.font.color = normal_color
    self.contents.draw_text(264, 32, 120, 32, text, 2)
  end
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end

class Window_RouletteTh < Window_Base
  include TSDA
  attr_accessor      :phase
  attr_accessor      :index
  attr_accessor      :moving
  attr_accessor      :move_counter
  attr_accessor      :direction
  attr_accessor      :last_index
  def initialize
    super(406, 16,192,288)
    self.contents = Bitmap.new(width - 32, height - 32)
    @moving = false
    @move_counter = 0
    @direction = 0
    @positions = []
    @rates = []
    @phase = 0
    @index = 0
    @extra = false
    @extra_id = 0
    @extra_position = []
    @extra_rate = 0
    @moving = false
    @last_index = 0
    refresh
  end
  def update
    super
    if @moving
      if @move_counter == 0
        @moving = false
        return
      end
      calc_pos
      refresh
      @move_counter -= 1
    end
    if @phase == 2
      update_cursor_rect
    end
  end
  def refresh
    self.contents.clear
    if @phase == 0
      refresh_actors
    elsif @phase == 1
      refresh_roulette
    else
      refresh_sound
    end
  end
  def refresh_sound
    self.contents.font.color = system_color
    self.contents.draw_text(0,0, 160, 32, "Música")
    self.contents.font.color = normal_color
    self.contents.draw_text(0,32, 160, 32, MENU_MUSIC[$game_music_info.music_index], 1)
    self.contents.font.color = system_color
    self.contents.draw_text(0,64, 160, 32, "Vol. Música")
    self.contents.font.color = normal_color
    self.contents.draw_text(0,96, 160, 32, "<" + $game_music_info.music_vol.to_s + ">",1)
    self.contents.font.color = system_color
    self.contents.draw_text(0,128, 160, 32, "Vol. Efeitos Sonoros")
    self.contents.font.color = normal_color
    self.contents.draw_text(0,160, 160, 32, "<" + $game_music_info.sound_vol.to_s + ">",1)
  end
  def refresh_actors
    for i in 1...$game_party.actors.size
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, 16, (i - 1) * 64 + 64)
      draw_actor_name(actor,32 , (i - 1) * 64)
      draw_actor_hp(actor,32,(i - 1) * 64 + 32)
    end
  end
  def phase=(value)
    @phase = value
    if value == 1
      calc_pos
      update_cursor_rect
    else
      self.cursor_rect.set(0,0, 0, 0)
    end
  end
  def update_cursor_rect
    if @phase == 0
      super
    elsif @phase == 1
      self.cursor_rect.set(55,91, 50, 74)
    else
      self.cursor_rect.set(0,@index * 64 + 32, 160, 32)
    end
  end
  def calc_pos
    if @moving
      if $game_party.actors.size == 3
        @extra = true
        if @positions[@index][1] > @positions[@last_index][1]
          @positions[@last_index][0] = 56 - (0.4 * (@move_counter - 21))
          @rates[@last_index] = 1.5 + (0.025 * (@move_counter - 21))
          @positions[@last_index][1] = 92 + (3.4 * (@move_counter - 21))
          @positions[@index][0] = 64 + (0.4 * (@move_counter - 21))
          @rates[@index] = 1 - (0.025 * (@move_counter - 21))
          @positions[@index][1] = 184 + (4.6 * (@move_counter - 21))
          if $game_party.actors.size != 2
            size = $game_party.actors.size
            forward = (@index + 1) % size
            @extra_id = (@last_index + size - 1) % size
            @positions[forward][0] = 96 + (1.6 * (@move_counter - 21))
            @positions[forward][1] = 256 + (3.6 * (@move_counter - 21))
            @rates[forward] = (-0.05 * (@move_counter - 21))
            @extra_position[0] = 64  - (1.6 * (@move_counter - 21))
            @extra_position[1] = 24 + (2.4 * (@move_counter - 21))
            @extra_rate = 1 + (0.05 * (@move_counter - 21))
          end
        else
          @positions[@last_index][0] = 56 - (0.4 * (@move_counter - 21))
          @rates[@last_index] = 1.5 + (0.025 * (@move_counter - 21))
          @positions[@last_index][1] = 92 - (4.6 * (@move_counter - 21))
          @positions[@index][0] = 64 + (0.4 * (@move_counter - 21))
          @rates[@index] = 1 - (0.025 * (@move_counter - 21))
          @positions[@index][1] = 24 - (3.4 * (@move_counter - 21))
          if $game_party.actors.size != 2
            size = $game_party.actors.size
            @extra_id = (@last_index + 1) % size
            backward = (@index + size - 1) % size
            @extra_position[0] = 64 - (1.6 * (@move_counter - 21))
            @extra_position[1] = 184 - (3.6 * (@move_counter - 21))
            @extra_rate = 1 + (0.05 * (@move_counter - 21))
            @positions[backward][0] = 96  + (1.6 * (@move_counter - 21))
            @positions[backward][1] = -24 - (2.4 * (@move_counter - 21))
            @rates[backward] = (-0.05 * (@move_counter - 21))
          end
        end
      else
        if @positions[@index][1] > @positions[@last_index][1]
          @positions[@last_index][0] = 56 - (0.4 * (@move_counter - 21))
          @rates[@last_index] = 1.5 + (0.025 * (@move_counter - 21))
          @positions[@last_index][1] = 92 + (3.4 * (@move_counter - 21))
          @positions[@index][0] = 64 + (0.4 * (@move_counter - 21))
          @rates[@index] = 1 - (0.025 * (@move_counter - 21))
          @positions[@index][1] = 184 + (4.6 * (@move_counter - 21))
          if $game_party.actors.size != 2
            size = $game_party.actors.size
            forward = (@index + 1) % size
            backward = (@last_index + size - 1) % size
            @positions[forward][0] = 96 + (1.6 * (@move_counter - 21))
            @positions[forward][1] = 256 + (3.6 * (@move_counter - 21))
            @rates[forward] = (-0.05 * (@move_counter - 21))
            @positions[backward][0] = 64  - (1.6 * (@move_counter - 21))
            @positions[backward][1] = 24 + (2.4 * (@move_counter - 21))
            @rates[backward] = 1 + (0.05 * (@move_counter - 21))
          end
        else
          @positions[@last_index][0] = 56 - (0.4 * (@move_counter - 21))
          @rates[@last_index] = 1.5 + (0.025 * (@move_counter - 21))
          @positions[@last_index][1] = 92 - (4.6 * (@move_counter - 21))
          @positions[@index][0] = 64 + (0.4 * (@move_counter - 21))
          @rates[@index] = 1 - (0.025 * (@move_counter - 21))
          @positions[@index][1] = 24 - (3.4 * (@move_counter - 21))
          if $game_party.actors.size != 2
            size = $game_party.actors.size
            forward = (@last_index + 1) % size
            backward = (@index + size - 1) % size
            @positions[forward][0] = 64 - (1.6 * (@move_counter - 21))
            @positions[forward][1] = 184 - (3.6 * (@move_counter - 21))
            @rates[forward] = 1 + (0.05 * (@move_counter - 21))
            @positions[backward][0] = 96  + (1.6 * (@move_counter - 21))
            @positions[backward][1] = -24 - (2.4 * (@move_counter - 21))
            @rates[backward] = (-0.05 * (@move_counter - 21))
          end
        end
      end
      return
    end
    @positions = []
    @rates = []
    for i in 0...$game_party.actors.size
      if @index == 0 and i == $game_party.actors.size - 1 and
        $game_party.actors.size >= 3
        @positions[i] = [64,24]
        @rates[i] = 1
        next
      end
      if @index == $game_party.actors.size - 1 and i == 0 and
        $game_party.actors.size >= 3
        @positions[i] = [64,184]
        @rates[i] = 1
        next
      end
      case i - @index
      when 0
        @positions[i] = [56, 92]
        @rates[i] = 1.5
      when -1
        @positions[i] = [64,24]
        @rates[i] = 1
      when 1
        @positions[i] = [64,184]
        @rates[i] = 1
      else
        @positions[i] = [0,0]
        @rates[i] = 0
      end
    end
  end
  def refresh_roulette
    for i in 0...$game_party.actors.size
      unless @positions[i].nil?
        actor = $game_party.actors[i]
        draw_actor_graphic_roulette(actor, @positions[i][0],
        @positions[i][1],@rates[i])
      end
    end
    if @extra == true
      actor = $game_party.actors[@extra_id]
      draw_actor_graphic_roulette(actor, @extra_position[0],
      @extra_position[1],@extra_rate)
      @extra = false
    end
  end
  def draw_actor_graphic_roulette(actor, x, y,rate = 1)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bitmap.width / 4
    ch = bitmap.height / 4
    src_rect = Rect.new(0, 0, cw, ch)
    dest_rect = Rect.new(x,y,cw * rate,ch * rate)
    self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  end
end
class Game_Map
  alias initialize_map_name_th initialize
  def initialize
    @map_info = load_data("Data/MapInfos.rxdata")
    initialize_map_name_th
  end
  def map_name
    return @map_info[@map_id].name
  end
end



[box class=catbg2]
Demo e Imagens
[/box]
Não há necessidade de Demo.





[box class=catbg2]
Créditos
[/box]

  • thiago_d_d por fazer o script
  • Madajuv pelo script de HQ