UltimaForum

Skrypty [VX] - Ring Menu

Parunu - Pią 09 Lip, 2010 15:38
Temat postu: Ring Menu
Informacje
Tak sobie pomyślałem... Cały czas spamie problemami, a nikomu nie pomogę, więc czas pomóc. O to Ring Menu znaleziony na rpgmakervx.net

screen
Spoiler:




Skrypt
Spoiler:

Kod:
#==============================================================================
# ** Ring Menu
#-------------------------------------------------------------------------------
# by Syvkal
# Version 1.1
# 06-23-08
#==============================================================================

   #===================================================#
   #  **  C O N F I G U R A T I O N   S Y S T E M  **  #
   #===================================================#
 
  # Amount of frames for Startup Animation
  STARTUP_FRAMES = 20
  # Amount of frames for Movement Animation
  MOVING_FRAMES = 15
  # Radius of the Menu Ring
  RING_R = 75
  # Disabled icon to display when disabled
  ICON_DISABLE= Cache::picture('Icon_Disable')
 
 
   #-------------D-O---N-O-T---T-O-U-C-H---------------#
   
  class Scene_Title < Scene_Base
    alias game_objects_original create_game_objects
    def create_game_objects
      game_objects_original
   
   #-------------D-O---N-O-T---T-O-U-C-H---------------#
 
  # As this script allows you to make a custom Menu I thought to make it easier
  # I would make it possible to add extra Menu Options from here
 
  # All you need to do is specify the Text to display, the icon and the command
  # The command must be in a STRING
  # Simply add to the array below :

  $game_ring_menu = [
 
   # Menu Option 0  eg. Item
   [Vocab::item, Cache::picture('Icon_Items'), "$scene = Scene_Item.new"],
   
   # Menu Option 1  eg. Skill
   [Vocab::skill, Cache::picture('Icon_Skills'), "start_actor_selection",
     "$scene = Scene_Skill.new(@status_window.index)"],
   
   # Menu Option 2  eg. Equip
   [Vocab::equip, Cache::picture('Icon_Equip'), "start_actor_selection",
     "$scene = Scene_Equip.new(@status_window.index)"],
   
   # Menu Option 3  eg. Status
   [Vocab::status, Cache::picture('Icon_Status'), "start_actor_selection",
     "$scene = Scene_Status.new(@status_window.index)"],
   
   #---------------------------------------------------#
   #  **      I N S E R T   M O R E   H E R E      **  #
   #---------------------------------------------------#
   
   # Preferably Insert your custom Menu Options Here
   # Otherwise the existing Menu Options will return to wrong point on the Menu
   
   # Menu Option 4  eg. Save
   ["Save Game", Cache::picture('Icon_Save'), "$scene = Scene_File.new(true, false, false)"],
   
   # Menu Option 5  eg. Load
   ["Load Game", Cache::picture('Icon_Load'), "$scene = Scene_File.new(false, false, false)"],
   
   # Menu Option 6  eg. End Game
   [Vocab::game_end, Cache::picture('Icon_End'), "$scene = Scene_End.new"]
   
   ] # <--- Do no Delete This
   
   #===================================================#
   #  **     E N D   C O N F I G U R A T I O N     **  #
   #===================================================#
  end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  Edited to add Ring Menu
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias initialize_original initialize
  alias start_selection_original start_actor_selection
  alias end_selection_original end_actor_selection
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0, move = true)
    @move = move
    initialize_original(menu_index)
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @gold_window = Window_Gold.new(0, 360)
    @location_window = Window_location.new(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @gold_window.dispose
    @status_window.dispose if @status_window
    @location_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    @gold_window.update
    @status_window.update if @status_window
    @location_window.update
    if @command_window.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    commands = []
    for i in 0...$game_ring_menu.size
      commands.push($game_ring_menu[i][0])
    end
    icons = []
    for i in 0...$game_ring_menu.size
      icons.push($game_ring_menu[i][1])
    end
    @command_window = Window_RingMenu.new(232, 164, commands, icons, @move, @menu_index)
    if $game_party.members.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
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_status_window
    names = []
    chars = []
    for i in 0...$game_party.members.size
      names[i] = $game_party.members[i].name
      chars[i] = $game_party.members[i]
    end
    @status_window = Window_RingMenu.new(255, 200, names, chars, true, $game_party.last_actor_index, true)
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  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
      eval($game_ring_menu[@command_window.index][2])
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @command_window.active = false
    @command_window.visible = false
    create_status_window
    if $game_party.last_actor_index < @status_window.item_max
      @status_window.index = $game_party.last_actor_index
    else
      @status_window.index = 0
    end
  end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    @command_window.active = true
    @command_window.visible = true
    @status_window.dispose if @status_window
    @status_window = nil
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      eval($game_ring_menu[@command_window.index][3])
    end
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  Edited to return to the menu properly when loading
#==============================================================================

class Scene_File
  alias return_scene_original return_scene
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      if @saving
        $scene = Scene_Menu.new($game_ring_menu.size - 3)
      else
        $scene = Scene_Menu.new($game_ring_menu.size - 2)
      end
    end
  end
end

#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
#  Edited to return to the menu properly due to loading being added
#==============================================================================

class Scene_End
  alias return_scene_original return_scene
  def return_scene
    $scene = Scene_Menu.new($game_ring_menu.size - 1)
  end
end

#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
#  This class shows the current map name.
#==============================================================================

class Window_location < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 160, (WLH*2) + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    $maps = load_data("Data/MapInfos.rvdata")
    @map_id = $game_map.map_id
    @currmap = $maps[@map_id].name
    self.contents.font.color = system_color
    self.contents.draw_text(0, -4, 128, 32, "Location :")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, -4+WLH, 128, 32, @currmap, 1)
  end
end

#==============================================================================
# ** Window_RingMenu
#------------------------------------------------------------------------------
#  This Window creates a Ring Menu system
#==============================================================================

class Window_RingMenu < Window_Base 
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :index
  attr_reader   :item_max
  #--------------------------------------------------------------------------
  # * Refresh Setup
  #--------------------------------------------------------------------------
  START = 1
  WAIT  = 2
  MOVER = 3
  MOVEL = 4
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(center_x, center_y, commands, items, move = true, index = 0, character = false)
    super(0, 0, 544, 416)
    self.contents = Bitmap.new(width-32, height-32)
    self.opacity = 0
    @move = move
    @char = character
    @startup = STARTUP_FRAMES
    @commands = commands
    @item_max = commands.size
    @index = index
    @items = items
    @disabled = []
    for i in 0...commands.size-1
      @disabled[i] = false
    end
    @cx = center_x
    @cy = center_y
    start_setup
    refresh
  end
  #--------------------------------------------------------------------------
  # * Start Setup
  #--------------------------------------------------------------------------
  def start_setup
    @mode = START
    @steps = @startup
  end
  #--------------------------------------------------------------------------
  # * Disable index
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    @disabled[index] = true
  end
  #--------------------------------------------------------------------------
  # * Determines if is moving
  #--------------------------------------------------------------------------
  def animation?
    return @mode != WAIT
  end
  #--------------------------------------------------------------------------
  # * Determine if cursor is moveable
  #--------------------------------------------------------------------------
  def cursor_movable?
    return false if (not visible or not active)
    return false if (@opening or @closing)
    return false if animation?
    return true
  end
  #--------------------------------------------------------------------------
  # * Move cursor right
  #--------------------------------------------------------------------------
  def cursor_right
    @index -= 1
    @index = @items.size - 1 if @index < 0
    @mode = MOVER
    @steps = MOVING_FRAMES
  end
  #--------------------------------------------------------------------------
  # * Move cursor left
  #--------------------------------------------------------------------------
  def cursor_left
    @index += 1
    @index = 0 if @index >= @items.size
    @mode = MOVEL
    @steps = MOVING_FRAMES
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if self.active
      if cursor_movable?
        last_index = @index
        if Input.repeat?(Input::DOWN) or Input.repeat?(Input::RIGHT)
          cursor_right
        end
        if Input.repeat?(Input::UP) or Input.repeat?(Input::LEFT)
          cursor_left
        end
        if @index != last_index
          Sound.play_cursor
        end
      end
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh   
    self.contents.clear
    case @mode
    when START
      refresh_start
    when WAIT
      refresh_wait
    when MOVER
      refresh_move(1)
    when MOVEL
      refresh_move(0)
    end
    rect = Rect.new(18, 196, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index], 1)
  end
  #--------------------------------------------------------------------------
  # * Refresh Start Period
  #--------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / @startup
    for i in 0...@item_max
      j = i - @index
      if @move
        r = RING_R - 1.0 * RING_R * @steps / @startup
        d = d1 * j + d2 * @steps
      else
        r = RING_R
        d = d1 * j
      end
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Wait Period
  #--------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index
      x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
      y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
      draw_item(x, y, i)
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Movement Period
  #--------------------------------------------------------------------------
  def refresh_move( mode )
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / MOVING_FRAMES
    d2 *= -1 if mode != 0
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = @cx + ( RING_R * Math.sin( d ) ).to_i
      y = @cy - ( RING_R * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(x, y, index)
    if @char
      if @index == index
        draw_character(@items[index].character_name, @items[index].character_index , x, y)
        if @mode == WAIT
          draw_actor_hp_ring(@items[index], @cx, @cy-16, 50, 6, 84, 270, true)
          draw_actor_mp_ring(@items[index], @cx, @cy-16, 50, 6, 84, 180, false)
          draw_actor_exp_ring(@items[index], @cx, @cy-16, 50, 6, 155, 12, false)
        end
      else
        draw_character(@items[index].character_name, @items[index].character_index , x, y, false)
      end
    else
      rect = Rect.new(0, 0, @items[index].width, @items[index].height)
      if @index == index
        self.contents.blt( x, y, @items[index], rect )
        if @disabled[@index]
          self.contents.blt( x, y, ICON_DISABLE, rect )
        end
      else
        self.contents.blt( x, y, @items[index], rect, 128 )
      end
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  Edited to allow disabled character icons
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Character Graphic
  #--------------------------------------------------------------------------
  def draw_character(character_name, character_index, x, y, enabled = true)
    return if character_name == nil
    bitmap = Cache.character(character_name)
    sign = character_name[/^[\!\$]./]
    if sign != nil and sign.include?('$')
      cw = bitmap.width / 3
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 12
      ch = bitmap.height / 8
    end
    n = character_index
    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 128)
  end
end



Wymagana grafika
Wszystkie zamieszczone grafiki poniżej wkleić do foleru Graphics\Pictures (jeśli nie ma takiego, należy utworzyć)

Wkleić pod nazwą Icon_Disable


Wkleić po nazwą Icon_End


Wkleić po nazwą Icon_Equip


Wkleić po nazwą Icon_Items


Wkleić pod nazwą Icon_Load


Wkleić pod nazwą Icon_Save


Wkleić pod nazwą Icon_Skills


Wkleić pod nazwą Icon_Status



Demo
Niepotrzebne...

End!

PS. Proszę Ayene o poprawienie moich błędów i edytując post.

cj2 - Pią 09 Lip, 2010 15:56

Przyda się, dzięki , tyle że autor skoro zrobił ikonki z ikonek , nie pomyślał o określeniu tych ikonek normalnych, tylko musiał zrobić nowe ;-/
#edit
Nie ma normalnie komendy save game ani load game, więc proszę przetłumaczone komendy:
Spoiler:

Kod:
#==============================================================================
# ** Ring Menu
#-------------------------------------------------------------------------------
# by Syvkal
# Version 1.1
# 06-23-08
#==============================================================================

#===================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#===================================================#

# Amount of frames for Startup Animation
STARTUP_FRAMES = 20
# Amount of frames for Movement Animation
MOVING_FRAMES = 15
# Radius of the Menu Ring
RING_R = 75
# Disabled icon to display when disabled
ICON_DISABLE= Cache::picture('Icon_Disable')


#-------------D-O---N-O-T---T-O-U-C-H---------------#

class Scene_Title < Scene_Base
alias game_objects_original create_game_objects
def create_game_objects
game_objects_original

#-------------D-O---N-O-T---T-O-U-C-H---------------#

# As this script allows you to make a custom Menu I thought to make it easier
# I would make it possible to add extra Menu Options from here

# All you need to do is specify the Text to display, the icon and the command
# The command must be in a STRING
# Simply add to the array below :

$game_ring_menu = [

# Menu Option 0 eg. Item
[Vocab::item, Cache::picture('Icon_Items'), "$scene = Scene_Item.new"],

# Menu Option 1 eg. Skill
[Vocab::skill, Cache::picture('Icon_Skills'), "start_actor_selection",
"$scene = Scene_Skill.new(@status_window.index)"],

# Menu Option 2 eg. Equip
[Vocab::equip, Cache::picture('Icon_Equip'), "start_actor_selection",
"$scene = Scene_Equip.new(@status_window.index)"],

# Menu Option 3 eg. Status
[Vocab::status, Cache::picture('Icon_Status'), "start_actor_selection",
"$scene = Scene_Status.new(@status_window.index)"],

#---------------------------------------------------#
# ** I N S E R T M O R E H E R E ** #
#---------------------------------------------------#

# Preferably Insert your custom Menu Options Here
# Otherwise the existing Menu Options will return to wrong point on the Menu

# Menu Option 4 eg. Save
["Zapisz grę", Cache::picture('Icon_Save'), "$scene = Scene_File.new(true, false, false)"],

# Menu Option 5 eg. Load
["Załaduj grę", Cache::picture('Icon_Load'), "$scene = Scene_File.new(false, false, false)"],

# Menu Option 6 eg. End Game
[Vocab::game_end, Cache::picture('Icon_End'), "$scene = Scene_End.new"]

] # <--- Do no Delete This

#===================================================#
# ** E N D C O N F I G U R A T I O N ** #
#===================================================#
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# Edited to add Ring Menu
#==============================================================================

class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias initialize_original initialize
alias start_selection_original start_actor_selection
alias end_selection_original end_actor_selection
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0, move = true)
@move = move
initialize_original(menu_index)
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@gold_window = Window_Gold.new(0, 360)
@location_window = Window_location.new(0, 0)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@gold_window.dispose
@status_window.dispose if @status_window
@location_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@gold_window.update
@status_window.update if @status_window
@location_window.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
commands = []
for i in 0...$game_ring_menu.size
commands.push($game_ring_menu[i][0])
end
icons = []
for i in 0...$game_ring_menu.size
icons.push($game_ring_menu[i][1])
end
@command_window = Window_RingMenu.new(232, 164, commands, icons, @move, @menu_index)
if $game_party.members.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
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_status_window
names = []
chars = []
for i in 0...$game_party.members.size
names[i] = $game_party.members[i].name
chars[i] = $game_party.members[i]
end
@status_window = Window_RingMenu.new(255, 200, names, chars, true, $game_party.last_actor_index, true)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
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
eval($game_ring_menu[@command_window.index][2])
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@command_window.visible = false
create_status_window
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@command_window.visible = true
@status_window.dispose if @status_window
@status_window = nil
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
eval($game_ring_menu[@command_window.index][3])
end
end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# Edited to return to the menu properly when loading
#==============================================================================

class Scene_File
alias return_scene_original return_scene
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
if @saving
$scene = Scene_Menu.new($game_ring_menu.size - 3)
else
$scene = Scene_Menu.new($game_ring_menu.size - 2)
end
end
end
end

#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# Edited to return to the menu properly due to loading being added
#==============================================================================

class Scene_End
alias return_scene_original return_scene
def return_scene
$scene = Scene_Menu.new($game_ring_menu.size - 1)
end
end

#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
# This class shows the current map name.
#==============================================================================

class Window_location < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, (WLH*2) + 32)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
$maps = load_data("Data/MapInfos.rvdata")
@map_id = $game_map.map_id
@currmap = $maps[@map_id].name
self.contents.font.color = system_color
self.contents.draw_text(0, -4, 128, 32, "Location :")
self.contents.font.color = normal_color
self.contents.draw_text(0, -4+WLH, 128, 32, @currmap, 1)
end
end

#==============================================================================
# ** Window_RingMenu
#------------------------------------------------------------------------------
# This Window creates a Ring Menu system
#==============================================================================

class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :index
attr_reader :item_max
#--------------------------------------------------------------------------
# * Refresh Setup
#--------------------------------------------------------------------------
START = 1
WAIT = 2
MOVER = 3
MOVEL = 4
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(center_x, center_y, commands, items, move = true, index = 0, character = false)
super(0, 0, 544, 416)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 0
@move = move
@char = character
@startup = STARTUP_FRAMES
@commands = commands
@item_max = commands.size
@index = index
@items = items
@disabled = []
for i in 0...commands.size-1
@disabled[i] = false
end
@cx = center_x
@cy = center_y
start_setup
refresh
end
#--------------------------------------------------------------------------
# * Start Setup
#--------------------------------------------------------------------------
def start_setup
@mode = START
@steps = @startup
end
#--------------------------------------------------------------------------
# * Disable index
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# * Determines if is moving
#--------------------------------------------------------------------------
def animation?
return @mode != WAIT
end
#--------------------------------------------------------------------------
# * Determine if cursor is moveable
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (@opening or @closing)
return false if animation?
return true
end
#--------------------------------------------------------------------------
# * Move cursor right
#--------------------------------------------------------------------------
def cursor_right
@index -= 1
@index = @items.size - 1 if @index < 0
@mode = MOVER
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# * Move cursor left
#--------------------------------------------------------------------------
def cursor_left
@index += 1
@index = 0 if @index >= @items.size
@mode = MOVEL
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if self.active
if cursor_movable?
last_index = @index
if Input.repeat?(Input::DOWN) or Input.repeat?(Input::RIGHT)
cursor_right
end
if Input.repeat?(Input::UP) or Input.repeat?(Input::LEFT)
cursor_left
end
if @index != last_index
Sound.play_cursor
end
end
refresh
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case @mode
when START
refresh_start
when WAIT
refresh_wait
when MOVER
refresh_move(1)
when MOVEL
refresh_move(0)
end
rect = Rect.new(18, 196, self.contents.width-32, 32)
self.contents.draw_text(rect, @commands[@index], 1)
end
#--------------------------------------------------------------------------
# * Refresh Start Period
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / @startup
for i in 0...@item_max
j = i - @index
if @move
r = RING_R - 1.0 * RING_R * @steps / @startup
d = d1 * j + d2 * @steps
else
r = RING_R
d = d1 * j
end
x = @cx + ( r * Math.sin( d ) ).to_i
y = @cy - ( r * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = WAIT
end
end
#--------------------------------------------------------------------------
# * Refresh Wait Period
#--------------------------------------------------------------------------
def refresh_wait
d = 2.0 * Math::PI / @item_max
for i in 0...@item_max
j = i - @index
x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
draw_item(x, y, i)
end
end
#--------------------------------------------------------------------------
# * Refresh Movement Period
#--------------------------------------------------------------------------
def refresh_move( mode )
d1 = 2.0 * Math::PI / @item_max
d2 = d1 / MOVING_FRAMES
d2 *= -1 if mode != 0
for i in 0...@item_max
j = i - @index
d = d1 * j + d2 * @steps
x = @cx + ( RING_R * Math.sin( d ) ).to_i
y = @cy - ( RING_R * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = WAIT
end
end
#--------------------------------------------------------------------------
# * Draw Item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# index : item number
#--------------------------------------------------------------------------
def draw_item(x, y, index)
if @char
if @index == index
draw_character(@items[index].character_name, @items[index].character_index , x, y)
if @mode == WAIT
draw_actor_hp_ring(@items[index], @cx, @cy-16, 50, 6, 84, 270, true)
draw_actor_mp_ring(@items[index], @cx, @cy-16, 50, 6, 84, 180, false)
draw_actor_exp_ring(@items[index], @cx, @cy-16, 50, 6, 155, 12, false)
end
else
draw_character(@items[index].character_name, @items[index].character_index , x, y, false)
end
else
rect = Rect.new(0, 0, @items[index].width, @items[index].height)
if @index == index
self.contents.blt( x, y, @items[index], rect )
if @disabled[@index]
self.contents.blt( x, y, ICON_DISABLE, rect )
end
else
self.contents.blt( x, y, @items[index], rect, 128 )
end
end
end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# Edited to allow disabled character icons
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Character Graphic
#--------------------------------------------------------------------------
def draw_character(character_name, character_index, x, y, enabled = true)
return if character_name == nil
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 128)
end
end


FilipsO - Pią 09 Lip, 2010 20:29

Pare rzeczy ma takie same ikonki, nie podoba mi się.
Parunu - Sob 10 Lip, 2010 09:02

Ikonki można zmieniać, jak wam się chcę. Wystarczy np. zamiast ikonki Icon_Equip, wstawić inną, pod tą samą nazwą. (tak mi się przynajmniej zdaje :shock: )
CreeperCrisis - Sob 10 Lip, 2010 10:33

Parunu ma racje. :-) Przecież to jest logiczne, że można zmieniać ikony. :-)
sitax5 - Pon 19 Lip, 2010 20:35

oco chodzi:
Spoiler:


Ayene - Wto 20 Lip, 2010 06:57

Ikony, które umieściłeś w folderze powinny się nazywać np. 'Icon_Disable', a nie 'icondisable'. Pozmieniaj nazwy, tak jak to zostało napisane w instrukcji w pierwszym poście.
Angius - Pon 27 Gru, 2010 14:47

Mam takie pytanko, bo wolę nie wrzucać w ciemno... Będzie działał z menu jednoosobowym?

Edit: Żre się tylko z ekwipunkiem (to, co założone), statusem i skillami. Wyskakuje takie coś:


Wybaczcie doublepost, ale... Wie ktoś co zrobić, żeby się nie żarły? Albo jak usunąć wybór bohatera?

//edit
Mam:
Spoiler:

Cytat:
Dzień i noc
Thomas Edison
Opcje w menu
HP przeciwników w trakcie walki
Rozdawanie punktów co poziom
Menu zapisu i wczytania
Kategorie przedmiotów
Ring Menu w walce
Bestiariusz
Folder zapisu
Menu jednoosobowe
Ring Menu


tracersgta - Pon 17 Sty, 2011 18:01

Najprawdopodobniej gryzie się z bestariuszem, rozdawaniem pkt. co poziom i menu jednoosobowym... wszystko to działa w menu.
bartek2940 - Pon 17 Sty, 2011 19:16

To tak, skrypt fajny, mam zamiar zrobić sobie nowe ikonki, potem może wrzucę, ale mam problem:
Gdy próbuję włączyć podmenu takie jak przedmioty, czy ekwipunek itd. to wyskakuje mi error (znajdziecie go na dole odpowiedzi). Było tak zarówno z oryginalnym skryptem i tym z prze tłumaczonym zapisem i wczytaniem. (oba są tutaj, trochę wyżej an stronie.)
PS.Gdy zapisywałem, to zapisało.

A oto mój error:


Jakby nie wchodził to to jest to samo:
http://img717.imageshack....51/errorlvs.jpg

tracersgta - Pon 17 Sty, 2011 19:45

Miałem podobnie. Powodem był skrypt "Dodawanie punktów co poziom". Korzystasz z jakiegoś skryptu gdzie coś pojawia się w menu(np. Bestariusz)?
bartek2940 - Pon 17 Sty, 2011 20:03

Chyba masz rację!
Używam ikony złotej monety w menu!
Bez niej działa, ale czy można by ją "wpleść" do tego skryptu? Bo bardzao lubię ten skrypt z monetą? :papa:

Angius - Wto 18 Sty, 2011 16:22

Hmm... Teoretycznie w kodzie ring menu nie ma odwołania do bestiariusza i rozdawania punktów, a też i je wyłączyłem z poziomu skryptu. Może się żreć z jednoosobowym, to fakt, ale i bez jednoosobowego dzieje się to samo...
Drawestien - Wto 18 Sty, 2011 22:35

Fajne,ale baardzo gryzie.
Angius - Sob 12 Mar, 2011 15:55

Dobra, rozwiązałem problem, po prostu... Wyłączyłem linijki, w których wyskakiwał error. I wszystko śmiga :)

Nie wiem tylko jak usunąć wybór bohatera... Mam jednego, więc pierścień z wyborem nie jest mi potrzebny.

Ogr78 - Nie 06 Lis, 2011 12:35

Help! mam taki maly problem bo mam skrypt na opcje w menu mam jeszcze punkty co poziom co mam zrobic?
Angius - Nie 06 Lis, 2011 14:11

Hmm, pomyślmy... Lećmy od góry skryptu.
Mamy sekcję "Insert More Here", otwieramy słownik, tłumaczymy to sobie. Wiemy już, że to oznacza "Wstaw więcej tutaj", czyli to jest to miejsce, którego szukaliśmy!
Mamy na przykład taką linijkę:
Kod:
# Menu Option 5  eg. Load
   ["Load Game", Cache::picture('Icon_Load'), "$scene = Scene_File.new(false, false, false)"],

Kopiujemy ją i wklejamy niżej. Teraz trzeba ją edytować.
Widzimy, że wyżej pod pozycją "items" nie ma tych wszystkich false, znaczy, można je wywalić. Nasza linijka wygląda więc tak:
Kod:
# Menu Option 5  eg. Load
   ["Load Game", Cache::picture('Icon_Load'), "$scene = Scene_File.new"],

Ok, znów chwytamy za słownik i tłumaczymy "Load Game", wiemy, że znaczy to "wczytaj grę", czyli jest to chyba wyświetlana nazwa komendy! Jeśli chcemy dać skrypt Poziom+ musimy to odpowiednio zmienić:
Kod:
# Menu Option 5  eg. Load
   ["Poziom+", Cache::picture('Icon_Load'), "$scene = Scene_File.new"],

Tłumaczymy następny kawałek. "Picture" oznacza "obrazek", więc najprawdopodobniej chodzi o obrazek tej pozycji w menu. Robimy obrazek, wrzucamy do graphics/pictures i nazywamy np. "Icon_Level.png". To ważne, by rozszerzenie było właśnie PNG!
Teraz edytujmy tę linijkę tak, by to nasz obrazek się wyświetlał, musimy więc zastąpić "Icon_Load" przez "Icon_Level":
Kod:
# Menu Option 5  eg. Load
   ["Load Game", Cache::picture('Icon_Level'), "$scene = Scene_File.new"],

Teraz sprawdzamy skrypt na punkty co poziom by zobaczyć, jaką linijką się go wywołuje. Odnajdujemy post Ayene, w którym jest podana taka oto linijka:
Kod:
$scene = Scene_RequiemUpgrade.new(0, true)

Szukamy podobnego elementu w naszej linijce w RingMenu, widać ją chyba od razu. Musimy teraz podmienić te elementy:
Kod:
# Menu Option 5  eg. Load
   ["Load Game", Cache::picture('Icon_Level'), "$scene = Scene_RequiemUpgrade.new(0, true)"],

Brawo! Właśnie dodaliśmy nową opcję w RingMenu!

Trzeba dodać, że w ten sposób można tu wrzucać każdy inny skrypt - bestiariusz, mapę świata, system teleportów, SynthShop, co tylko nam się wymarzy.

Ogr78 - Nie 06 Lis, 2011 14:20

Dzieki Angius,
Vrona - Sro 09 Lis, 2011 16:33

Dobry skrypt,a dzięki opcji "Insert More Here" i mini-tutkowi Angiusa stworzyłem sobie dodatkową opcję.
MrQubo - Sro 30 Sty, 2013 19:45

Jako, że wiem iż niektórzy mogli się tego nie domyślić, to proszę:
Linijka 287: self.contents.draw_text(0, -4, 128, 32, "Location :")
Zmieniacie nazwę w "Location :" (NIE USUWACIE CUDZYSŁOWÓW (Aż w słowniku patrzyłem :mrgreen: )) i już :-)


Powered by phpBB modified by Przemo © 2003 phpBB Group