Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Skrypt na Pseudo 3d menu
Autor Wiadomość
The Big Master 




Preferowany:
RPG Maker XP

Pomógł: 6 razy
Dołączył: 19 Gru 2012
Posty: 81
Skąd: Masz taki nr. IQ ?
Wysłany: Nie 20 Sty, 2013 18:34
Skrypt na Pseudo 3d menu
~ Ring Meny (Pseudo) 3d ~


Krótki opis:
tworzy menu w wersji koła ala 3d

Autor:
Gab

Tłumaczenie:
GuGuś

Kompatybilność:
RPG Maker VX Ace

Skrypt:
Spoiler:

Kod:
#=============================================================================
# Gab Ring Menu 3D
#-----------------------------------------------------------------------------
# Autor: Gab!
# Data:  28/11/12
#-----------------------------------------------------------------------------
# Deixa o menu com perspectiva 3D.
#=============================================================================

module Gab
  module RingMenu3D
#=============================================================================
# * Konfiguracja
#=============================================================================

    # ID Ikond
    ICONS = [
      192, # Plecak
      112, # Zdolności
      169, # Ekwipunek
       14, # Status
       12, # Formacja
      117, # Zapisz
      121  # Wyjdź
    ]
   
    # Fonte
    FNAME  = "Comic Sans MS"       # nazwa
    FSIZE  = 19                   # Rozmiar
    FCOLOR = [255, 255, 255, 200] # Cor (R,G,B,A)
   
    # Raios
    R1 = 90 # W tym celu nastąpi,
    R2 = 20 # Konieczne jest aby R1 > R2.
   
 Ikony # motion precyzyjne (większe, wolniej)
     # Sugerowane wartości:
     # 1 = Snapshot
     # 5 = szybkie
     # 10 = średnia
     # 20 = powolne
     MV = 10
   
    # Częstotliwość ruchu znaków (większe, wolniej)
    CFREQ = 15
   
    # BGM (Pozostaw puste, aby usunąć)
    BGM = "Battle3"
   
    # BGS (Pozostaw puste, aby usunąć)
    BGS = "Clock"
   
    # Audio znikną w czasie, aby opuścić scenę (milisekundy)
    AudioFade = 1000
   
    # Janelas adicionais
    Windows = {
      mapName: [ # Nazwa mapy
        true,    # Show?
           0,    # Pozycja X
           0,    # Pozycja Y
         400,    # Szerokość
         231,    # Ikona
           0,    # Nieprzezroczystość
      ],
     
      time: [    # Czas Gry
        true,    # Show?
           0,    # Pozycja X
          34,    # Pozycja Y
         160,    # Szerokość
         280,    # Ikona
           0,    # Nieprzezroczystość
      ],
     
      gold: [    # Pieniądze
        true,    # Show?
           0,    # Pozycja X
          68,    # Pozycja Y
         160,    # Szerokość
         361,    # Ikona
           0,    # Nieprzezroczystość
      ]
    }
   
#=============================================================================
# * FIM DA CONFIGURAÇÃO
#=============================================================================
  end
end

Object.send(:remove_const, :Scene_Menu)
class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # ** Base para as janelas do menu
  #--------------------------------------------------------------------------
  class MenuWindow < Window_Base
    def initialize(x, y, width, icon, opacity)
      super(x, y, width, fitting_height(1))
      @icon  = icon
      self.opacity = opacity
      self.contents.font.name    = Gab::RingMenu3D::FNAME
      self.contents.font.size    = Gab::RingMenu3D::FSIZE
      self.contents.font.color   = Color.new(*Gab::RingMenu3D::FCOLOR)
      self.contents.font.outline = false
      self.contents.font.shadow  = true
     
      draw_icon(@icon, 0, 0)
      @clear_rect = Rect.new(30, 0, contents.width - 31, contents.height)
     
      refresh
    end
   
    def refresh
      self.contents.clear_rect(@clear_rect)
      text_size = self.contents.width - 32
      self.contents.draw_text(30, 0, text_size, self.contents.height, text, align)
    end
   
    def align
      return 2
    end
   
    def update
      super
      refresh if (Graphics.frame_count % Graphics.frame_rate) == 0
    end
   
    def text
      return ""
    end
  end
 
  #--------------------------------------------------------------------------
  # ** Nome do mapa
  #--------------------------------------------------------------------------
  class MenuWindowMapName < MenuWindow
    def text
      $game_map.display_name
    end
   
    def align
      return 0
    end
  end
 
  #--------------------------------------------------------------------------
  # ** Tempo de jogo
  #--------------------------------------------------------------------------
  class MenuWindowTime < MenuWindow
    def text
      total_sec = Graphics.frame_count / Graphics.frame_rate
      hour = total_sec / 60 / 60
      min  = total_sec / 60 % 60
      sec  = total_sec % 60
      sprintf("%02d:%02d:%02d", hour, min, sec)
    end
  end
 
  #--------------------------------------------------------------------------
  # ** Dinheiro
  #--------------------------------------------------------------------------
  class MenuWindowGold < MenuWindow
    def text
      $game_party.gold.to_s
    end
  end
 
  #--------------------------------------------------------------------------
  # * Inicializaç&#227;o do processo
  #--------------------------------------------------------------------------
  def start
    super
   
    @vocabulary = [
      Vocab::item,
      Vocab::skill,
      Vocab::equip,
      Vocab::status,
      Vocab::formation,
      Vocab::save,
      Vocab::game_end
    ]
   
    @actorsNames = $game_party.members.map{|actor| actor.name}
   
    create_background
   
    @sprite     = Sprite_Character.new(@main_viewport, $game_player)
    @index      = 0
    @actorIndex = 0
    @stage      = 0
    @pattern    = 1
    @actor1     = nil
    @actor2     = nil
   
    @bgm = RPG::BGM.new(Gab::RingMenu3D::BGM)
    @bgs = RPG::BGS.new(Gab::RingMenu3D::BGS)
   
    @bgm.play
    @bgs.play
   
    precalculus
    create_icons
    create_legend
    create_actor_selection
    create_windows
  end
  #--------------------------------------------------------------------------
  # * Finalizaç&#227;o do processo
  #--------------------------------------------------------------------------
  def terminate
    super
    RPG::BGM.fade(Gab::RingMenu3D::AudioFade)
    RPG::BGS.fade(Gab::RingMenu3D::AudioFade)
    dispose_background
    @icons.each(&:dispose)
    @actors.each(&:dispose)
    @windows.each(&:dispose)
    @sprite.dispose
    @legend.dispose
    Input.update
    $game_map.autoplay
  end
  #--------------------------------------------------------------------------
  # * Disposiç&#227;o do plano de fundo
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Criaç&#227;o do plano de fundo
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # * Pré-calculo
  #--------------------------------------------------------------------------
  def precalculus
    @elIcons        = 2 * Math::PI / Gab::RingMenu3D::ICONS.size
    @basePointIcons = @sprite.y + Gab::RingMenu3D::R2 * (Math.sin(-@elIcons) - 0.5)
    @maxDifIcons    = @sprite.y + Gab::RingMenu3D::R2 * Math.sin(Math::PI - @elIcons) - @basePointIcons
    @moveTimesIcons = @elIcons / Gab::RingMenu3D::MV
    @addIcons       = 0
   
    @elActors        = 2 * Math::PI / $game_party.members.size
    @basePointActors = @sprite.y + (Gab::RingMenu3D::R2 + 24) * Math.sin(-@elIcons)
    @maxDifActors    = @sprite.y + (Gab::RingMenu3D::R2 + 24) * Math.sin(Math::PI - @elActors) - @basePointActors
    @moveTimesActors = @elActors / Gab::RingMenu3D::MV
    @addActors       = 0
  end
  #--------------------------------------------------------------------------
  # * Criaç&#227;o dos ícones
  #--------------------------------------------------------------------------
  def create_icons
    iconset = Cache.system("Iconset")
    @icons  = []
   
    Gab::RingMenu3D::ICONS.each_with_index{|icon_index, index|
      sprite          = Sprite.new
      sprite.bitmap   = iconset
      sprite.src_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      sprite.ox       = sprite.width / 2
      sprite.oy       = sprite.height / 2
     
      @icons << sprite
    }
   
    @icons[4].tone = Tone.new(0, 0, 0, 255) if $game_party.members.size <= 1
    @icons[5].tone = Tone.new(0, 0, 0, 255) if $game_system.save_disabled
   
    adjust_icons
  end
  #--------------------------------------------------------------------------
  # * Cria a legenda
  #--------------------------------------------------------------------------
  def create_legend
    base, c = Bitmap.new(1, 1), nil
    base.font.name  = Gab::RingMenu3D::FNAME
    base.font.size  = Gab::RingMenu3D::FSIZE
    base.font.color = Color.new(*Gab::RingMenu3D::FCOLOR)
   
    maxLen = (@vocabulary + @actorsNames).inject(0){|a, b|
      c = base.text_size(b)
      c.width > a ? c.width : a
    }
   
    @legend = Sprite.new
    @legend.bitmap = Bitmap.new(maxLen + 5, c.height)
    @legend.bitmap.font.name  = Gab::RingMenu3D::FNAME
    @legend.bitmap.font.size  = Gab::RingMenu3D::FSIZE
    @legend.bitmap.font.color = Color.new(*Gab::RingMenu3D::FCOLOR)
    @legend.ox = @legend.width  / 2
    @legend.oy = @legend.height / 2
    @legend.x  = @icons.first.x
    @legend.y  = @icons.first.y + @icons.first.height
   
    base.dispose
   
    legend_refresh
  end
  #--------------------------------------------------------------------------
  # * Cria seleç&#227;o de atores
  #--------------------------------------------------------------------------
  def create_actor_selection
    @actors = $game_party.members.map{|char|
      actor = Sprite.new
      actor.bitmap = Cache.character(char.character_name)
      sign = char.character_name[/^[\!\$]./]
      if sign && sign.include?('$')
        cw = actor.bitmap.width / 3
        ch = actor.bitmap.height / 4
      else
        cw = actor.bitmap.width / 12
        ch = actor.bitmap.height / 8
      end
     
      actor.ox = cw / 2
      actor.oy = ch
     
      actor.x = @sprite.x + 1.5 * Gab::RingMenu3D::R1
      actor.instance_variable_set(:@charData, [char, cw, ch])
     
      actor
    }
   
    adjust_actors
    update_actors_src
  end
  #--------------------------------------------------------------------------
  # * Cria janelas
  #--------------------------------------------------------------------------
  def create_windows
    windows = Gab::RingMenu3D::Windows
    @windows = []
   
    @windows << MenuWindowMapName.new(*windows[:mapName][1,5]) if windows[:mapName][0]
    @windows << MenuWindowTime.new(*windows[:time][1,5])       if windows[:time][0]
    @windows << MenuWindowGold.new(*windows[:gold][1,5])       if windows[:gold][0]
  end
  #--------------------------------------------------------------------------
  # * Posicionamento e ajuste de opacidade dos ícones
  #--------------------------------------------------------------------------
  def adjust_icons
    el = 2 * Math::PI / @icons.size
    t  = @addIcons - el
   
    @icons.each{|sprite|
      t += el
      sprite.x       = @sprite.x + Math.sin(t) * Gab::RingMenu3D::R1
      sprite.y       = @sprite.y + Gab::RingMenu3D::R2 * (Math.cos(t) - 0.5)
      dif            = (sprite.y - @basePointIcons) / @maxDifIcons
      sprite.opacity = @stage == 0 ? 127 + 255 * dif : 0
      sprite.zoom_x  = sprite.zoom_y = [0.5 + dif, 1].min
    }
  end
  #--------------------------------------------------------------------------
  # * Posicionamento e ajuste de opacidade dos atores
  #--------------------------------------------------------------------------
  def adjust_actors
    el = 2 * Math::PI / @actors.size
    t  = @addActors - el
   
    @actors.each{|sprite|
      t += el
      sprite.x       = @sprite.x + Math.sin(t) * (Gab::RingMenu3D::R1 + 24)
      sprite.y       = @sprite.y + (Gab::RingMenu3D::R2 + 24) * Math.cos(t)
      dif            = (sprite.y - @basePointActors) / @maxDifActors
      sprite.opacity = @stage != 0 ? 127 + 255 * dif : 0
      sprite.zoom_x  = sprite.zoom_y = [0.5 + dif, 1].min
    }
  end
  #--------------------------------------------------------------------------
  # * Movimento dos ícones
  #--------------------------------------------------------------------------
  def rotateIcons(dir)
    @moveTimesIcons *= -1 if dir == :right
   
    Sound.play_cursor
   
    Gab::RingMenu3D::MV.times{|sprite|
      @addIcons += @moveTimesIcons
      @addIcons %= Math::PI * 2
      adjust_icons
      Graphics.update
    }
   
    if dir == :right
      @moveTimesIcons *= -1
      @index += 1
    else
      @index -= 1
    end
    @index %= @icons.size
   
    legend_refresh
  end
  #--------------------------------------------------------------------------
  # * Movimento dos atores
  #--------------------------------------------------------------------------
  def rotateActors(dir)
    @moveTimesActors *= -1 if dir == :right
   
    Sound.play_cursor
   
    Gab::RingMenu3D::MV.times{|sprite|
      @addActors += @moveTimesActors
      @addActors %= Math::PI * 2
      adjust_actors
      Graphics.update
    }
   
    if dir == :right
      @moveTimesActors *= -1
      @actorIndex += 1
    else
      @actorIndex -= 1
    end
    @actorIndex %= @actors.size
   
    legend_refresh
  end
  #--------------------------------------------------------------------------
  # * Atualiza legenda
  #--------------------------------------------------------------------------
  def legend_refresh
    @legend.bitmap.clear
    text = @stage == 0 ? @vocabulary[@index] : @actorsNames[@actorIndex]
    @legend.bitmap.draw_text(@legend.bitmap.rect, text, 1)
    @legend.update
  end
  #--------------------------------------------------------------------------
  # * Atualizaç&#227;o Base
  #--------------------------------------------------------------------------
  def update
    super
   
    @windows.each(&:update)
   
    case @stage
    when 0
      update_main_input
    when 1, 2
      @stage == 1 ? update_actors_input : update_formation_input

      if (Graphics.frame_count % Gab::RingMenu3D::CFREQ) == 0
        @pattern = (@pattern + 1) % 3
      end
      update_actors_src
    end
  end
  #--------------------------------------------------------------------------
  # * Atualizaç&#227;o de input padr&#227;o
  #--------------------------------------------------------------------------
  def update_main_input
    if Input.repeat?(:LEFT)
      rotateIcons(:left)
    elsif Input.repeat?(:RIGHT)
      rotateIcons(:right)
    elsif Input.trigger?(:B)
      Sound.play_cancel
      process_return
    elsif Input.trigger?(:C)
      process_confirm
    end
  end
  #--------------------------------------------------------------------------
  # * Atualizaç&#227;o de entrada na seleç&#227;o de ator
  #--------------------------------------------------------------------------
  def update_actors_input
    if Input.repeat?(:LEFT)
      rotateActors(:left)
    elsif Input.repeat?(:RIGHT)
      rotateActors(:right)
    elsif Input.trigger?(:B)
      Sound.play_cancel
      process_return
    elsif Input.trigger?(:C)
      Sound.play_ok
      process_special_confirm
    end
  end
  #--------------------------------------------------------------------------
  # * Atualizaç&#227;o de entrada na seleç&#227;o de ator
  #--------------------------------------------------------------------------
  def update_actors_input
    if Input.repeat?(:LEFT)
      rotateActors(:left)
    elsif Input.repeat?(:RIGHT)
      rotateActors(:right)
    elsif Input.trigger?(:B)
      Sound.play_cancel
      process_return
    elsif Input.trigger?(:C)
      Sound.play_ok
      process_special_confirm
    end
  end
  #--------------------------------------------------------------------------
  # * Atualizaç&#227;o de troca de formaç&#227;o
  #--------------------------------------------------------------------------
  def update_formation_input
    if Input.repeat?(:LEFT)
      rotateActors(:left)
    elsif Input.repeat?(:RIGHT)
      rotateActors(:right)
    elsif Input.trigger?(:B)
      Sound.play_cancel
      process_return
    elsif Input.trigger?(:C)
      process_formation_confirm
    end
  end
  #--------------------------------------------------------------------------
  # * Processa confirmaç&#227;o
  #--------------------------------------------------------------------------
  def process_confirm
    case @index
    when 0 # Item
      Sound.play_ok
      SceneManager.call(Scene_Item)
    when 1, 2, 3, 4 # Skill, Equip, Status, Formaç&#227;o
      return Sound.play_buzzer if ($game_party.members.size <= 1 && @index == 4)
      Sound.play_ok
      @stage = @index == 4 ? 2 : 1
      adjust_actors
      adjust_icons
      legend_refresh
      @legend.y -= 28
    when 5 # Save
      if ($game_system.save_disabled)
        Sound.play_buzzer
      else
        SceneManager.call(Scene_Save)
        Sound.play_ok
      end
    when 6 # Sair
      Sound.play_ok
      SceneManager.call(Scene_End)
    end
  end
  #--------------------------------------------------------------------------
  # * Processa confirmaç&#227;o das opç&#245;es que requerem seleç&#227;o de ator
  #--------------------------------------------------------------------------
  def process_special_confirm
    $game_party.menu_actor = $game_party.members[@actorIndex]
   
    case @index
    when 1 # Skill
      SceneManager.call(Scene_Skill)
    when 2 # Equip
      SceneManager.call(Scene_Equip)
    when 3 # Status
      SceneManager.call(Scene_Status)     
    end
  end
  #--------------------------------------------------------------------------
  # * Processa confirmaç&#227;o de troca de formaç&#227;o
  #--------------------------------------------------------------------------
  def process_formation_confirm
    if @actor1.nil?
      @actor1 = @actorIndex
      @actors[@actor1].tone = Tone.new(150, 150, 150, 0)
      Sound.play_ok
    else
      return Sound.play_buzzer if @actor1 == @actorIndex
      Sound.play_ok
     
      $game_party.swap_order(@actor1, @actorIndex)
      @actorsNames = $game_party.members.map{|actor| actor.name}
     
      @sprite.dispose
      @sprite     = Sprite_Character.new(@main_viewport, $game_player)
      @actors.each(&:dispose)
      create_actor_selection
     
      @actors[@actor1].tone = Tone.new(0, 0, 0, 0)
     
      @stage      = 0
      @actor1     = nil
     
      adjust_icons
      adjust_actors
      legend_refresh
      @legend.y += 28
    end
  end
  #--------------------------------------------------------------------------
  # * Processa retorno
  #--------------------------------------------------------------------------
  def process_return
    case @stage
    when 0
      return_scene
    when 1
      case @index
      when 1, 2, 3
        @stage = 0
        adjust_actors
        adjust_icons
        legend_refresh
        @legend.y += 28
      when 4
        if !@actor1.nil?
          @actors[@actor1].tone = Tone.new(0, 0, 0, 0)
          return @actor1 = nil
        end
     
        @stage = 0
        adjust_actors
        adjust_icons
        legend_refresh
        @legend.y += 28
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Atualiza characters
  #--------------------------------------------------------------------------
  def update_actors_src
    @actors.each{|sprite|
      char, cw, ch = sprite.instance_variable_get(:@charData)
      index = char.character_index
      sx = (index % 4 * 3 + @pattern) * cw
      sy = (index / 4 * 4) * ch
      sprite.src_rect.set(sx, sy, cw, ch)
    }
  end
end


Screeny:
Spoiler:




Dodatkowe informacje:
Skrypt został znaleziony w Internecie.
________________________
Siema

Gość, Jeżeli ci Pomogłem, możesz mi dać .
_______________________________________________________________
Niestety, padł mi komp z Projektami, więc przez pewien czas niestety nici z Projektów :C
 
 
 
Konfundus 




Preferowany:
RPG Maker VX

Pomógł: 1 raz
Dołączył: 15 Paź 2011
Posty: 39
Skąd: Verra w Helladonie
Wysłany: Pon 21 Sty, 2013 17:37
Hmm... Mnie raczej przypasowałby do projektu ten skrypt, lecz nie 3D, ale na płaszczyźnie. Ale ciekawe, ciekawe. ;]
 
 
 
XDOskarXD 



Preferowany:
RPG Maker VXAce

Dołączył: 16 Gru 2012
Posty: 24
Skąd: z Jarkendaru
Wysłany: Pią 08 Lut, 2013 21:05
Ja żal dasz ikonki?Bez nich nie zadziała znawco wielki.Skrypt bez sensu jeżeli nie działa
________________________
Nazywam się Megow nie XDOskarXD
 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Pią 08 Lut, 2013 21:24
XDOskarXD, skrypt działa bez żadnych dodatkowych grafik...
________________________


 
 
 
XDOskarXD 



Preferowany:
RPG Maker VXAce

Dołączył: 16 Gru 2012
Posty: 24
Skąd: z Jarkendaru
Wysłany: Sob 09 Lut, 2013 07:50
Ayene co,robię nie tak?wkleiłem skrypt nad Main(chyba tam się
wkleja większość skryptów)i nie działa :cry: jak uruchamiam projekt wyskakuję takie coś
http://img688.imageshack....wytywanie2z.png
________________________
Nazywam się Megow nie XDOskarXD
 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene