Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
- # :: 1-Man Menu System [RPG Maker VX Ace]
- # Version 1.00
- #------------------------------------------------------------------------------
- # This script changes the default menu system found in RPG Maker VX Ace, it
- # is designed for games that only ever have a single active party member.
- #==============================================================================
- # ; Version History
- #------------------------------------------------------------------------------
- # Version 1.00 ------------------------------------------------- (08-11-2012)
- # - Initial version
- # - Author: Legacy
- #
- #==============================================================================
- # ; Instructions
- #------------------------------------------------------------------------------
- # To instal the script, open you script editor and paste this script on
- # a new section bellow the Materials section.
- #==============================================================================
- # * Known Issues
- #------------------------------------------------------------------------------
- # This script was designed for use with RPG Maker VX Ace, it is unlikely to
- # run on RPG Maker VX without adjustment.
- #
- # This script may be incompatible with more than one active party member.
- #==============================================================================
- # * Contact
- #------------------------------------------------------------------------------
- # Legacy, the author of this script, can be contacted through his
- # website, found at http://www.legacy-studios.org/
- #
- # You may also find Legacy at http://www.rpgrevolution.com/
- #==============================================================================
- # * Usage
- #------------------------------------------------------------------------------
- # This script may be used with the following terms and conditions:
- #
- # 1. This script is free to use in any noncommercial project. If you wish to
- # use this script in a commercial (paid) project, please contact
- # Legacy at his website.
- # 2. This script may only be hosted at the following domains:
- # http://www.legacy-studios.org
- # http://www.save-point.org
- # http://www.rpgrevolution.com
- # http://www.rpgmakerweb.com
- # 3. If you wish to host this script elsewhere, please contact Legacy.
- # 4. If you wish to translate this script, please contact Legacy. He
- # will need the web address that you plan to host the script at, as well
- # as the language this script is being translated to.
- # 5. This header must remain intact at all times.
- # 6. Legacy remains the sole owner of this code. He may modify or
- # revoke this license at any time, for any reason.
- # 7. Any code derived from code within this script is owned by Legacy,
- # and you must have his permission to publish, host, or distribute his
- # code.
- # 8. This license applies to all code derived from the code within this
- # script.
- # 9. If you use this script within your project, you must include visible
- # credit to Legacy, within reason.
- #≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
- $imported = {} if $imported == nil
- $imported['Legacy_MainMenu'] = 1.00
- #==============================================================================
- # :: Window_HorzMenuCommand
- #------------------------------------------------------------------------------
- # This command window appears on the menu screen.
- #==============================================================================
- class Window_HorzMenuCommand < Window_HorzCommand
- #--------------------------------------------------------------------------
- # ; Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(100, 0)
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # ; Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 380
- end
- #--------------------------------------------------------------------------
- # ; Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- return 1
- end
- #--------------------------------------------------------------------------
- # ; Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_main_commands
- add_save_command
- end
- #--------------------------------------------------------------------------
- # ; Add Main Commands to List
- #--------------------------------------------------------------------------
- def add_main_commands
- add_command(Vocab::item, :item, main_commands_enabled)
- add_command(Vocab::skill, :skill, main_commands_enabled)
- add_command(Vocab::equip, :equip, main_commands_enabled)
- end
- #--------------------------------------------------------------------------
- # ; Add Save to Command List
- #--------------------------------------------------------------------------
- def add_save_command
- add_command(Vocab::save, :save, save_enabled)
- end
- #--------------------------------------------------------------------------
- # ; Get Activation State of Main Commands
- #--------------------------------------------------------------------------
- def main_commands_enabled
- $game_party.exists
- end
- #--------------------------------------------------------------------------
- # ; Get Activation State of Save
- #--------------------------------------------------------------------------
- def save_enabled
- !$game_system.save_disabled
- end
- #--------------------------------------------------------------------------
- # ; Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- super
- end
- end
- #==============================================================================
- # ** Window_ItemCategory
- #------------------------------------------------------------------------------
- # This window is for selecting a category of normal items and equipment
- # on the item screen or shop screen.
- #==============================================================================
- class Window_ItemCategory < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :item_window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 380
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 4
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- @item_window.category = current_symbol if @item_window
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::item, :item)
- add_command(Vocab::weapon, :weapon)
- add_command(Vocab::armor, :armor)
- add_command(Vocab::key_item, :key_item)
- end
- #--------------------------------------------------------------------------
- # * Set Item Window
- #--------------------------------------------------------------------------
- def item_window=(item_window)
- @item_window = item_window
- update
- end
- end
- #==============================================================================
- # ** Window_ItemList
- #------------------------------------------------------------------------------
- # This window displays a list of party items on the item screen.
- #==============================================================================
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @category = :none
- @data = []
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Set Category
- #--------------------------------------------------------------------------
- def category=(category)
- return if @category == category
- @category = category
- refresh
- self.oy = 0
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # * Get Item
- #--------------------------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Selection Item
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # * Include in Item List?
- #--------------------------------------------------------------------------
- def include?(item)
- case @category
- when :item
- item.is_a?(RPG::Item) && !item.key_item?
- when :weapon
- item.is_a?(RPG::Weapon)
- when :armor
- item.is_a?(RPG::Armor)
- when :key_item
- item.is_a?(RPG::Item) && item.key_item?
- else
- false
- end
- end
- #--------------------------------------------------------------------------
- # * Display in Enabled State?
- #--------------------------------------------------------------------------
- def enable?(item)
- $game_party.usable?(item)
- end
- #--------------------------------------------------------------------------
- # * Create Item List
- #--------------------------------------------------------------------------
- def make_item_list
- @data = $game_party.all_items.select {|item| include?(item) }
- @data.push(nil) if include?(nil)
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select(@data.index($game_party.last_item.object) || 0)
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 2
- draw_item_name(item, rect.x, rect.y, enable?(item))
- rect.x += 4
- draw_item_number(rect, item)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Number of Items
- #--------------------------------------------------------------------------
- def draw_item_number(rect, item)
- draw_text(rect, sprintf("x%2d", $game_party.item_number(item)), 2)
- end
- #--------------------------------------------------------------------------
- # * Update Help Text
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item)
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- end
- #==============================================================================
- # ** Window_ActorStatus
- #------------------------------------------------------------------------------
- # This window displays party member status on the menu screen.
- #==============================================================================
- class Window_ActorStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ; Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :pending_index # Pending position (for formation)
- #--------------------------------------------------------------------------
- # ; Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 380, 320)
- @pending_index = -1
- @actor = $game_party.members[0]
- self.opacity = 180
- refresh
- end
- #--------------------------------------------------------------------------
- # ; Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- return 1
- end
- #--------------------------------------------------------------------------
- # ; Get Item Height
- #--------------------------------------------------------------------------
- def item_height
- (height - standard_padding * 2) / 4
- end
- #--------------------------------------------------------------------------
- # ; Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- enabled = $game_party.battle_members.include?(@actor)
- rect = item_rect(index)
- draw_item_background(index)
- draw_actor_name(@actor, x - 100, y - 50)
- draw_actor_level(@actor, x + 40, y - 50)
- draw_actor_class(@actor, x + 140, y - 50)
- draw_actor_face(@actor, rect.x + 20, rect.y + 25, enabled)
- draw_actor_icons(@actor, x - 80, y + (line_height * 2) + 28)
- draw_actor_hp(@actor, x - 100 , y + (line_height * 1) + 75)
- draw_actor_mp(@actor, x - 100, y + (line_height * 2) + 75)
- draw_parameters(150, y - 10)
- draw_exp_info(155, 200)
- end
- #--------------------------------------------------------------------------
- # ; Draw Parameters
- #--------------------------------------------------------------------------
- def draw_parameters(x, y)
- 6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
- end
- #--------------------------------------------------------------------------
- # * Draw Experience Information
- #--------------------------------------------------------------------------
- def draw_exp_info(x, y)
- s1 = @actor.max_level? ? "-------" : @actor.exp
- s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- change_color(system_color)
- draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
- draw_text(x, y + line_height * 2, 180, line_height, s_next)
- change_color(normal_color)
- draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
- draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
- end
- #--------------------------------------------------------------------------
- # ; Draw Background for Item
- #--------------------------------------------------------------------------
- def draw_item_background(index)
- if index == @pending_index
- contents.fill_rect(item_rect(index), pending_color)
- end
- end
- #--------------------------------------------------------------------------
- # ; Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- super
- $game_party.menu_actor = @actor
- end
- #--------------------------------------------------------------------------
- # ; Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select($game_party.menu_actor.index || 0)
- end
- end
- #==============================================================================
- # ** Window_MenuStatus
- #------------------------------------------------------------------------------
- # This window displays party member status on the menu screen.
- #==============================================================================
- class Window_Legacy_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :pending_index # Pending position (for formation)
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 150, 315)
- @pending_index = -1
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- $game_party.members.size
- end
- #--------------------------------------------------------------------------
- # * Get Item Height
- #--------------------------------------------------------------------------
- def item_height
- (height - standard_padding * 2) / 4
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- actor = $game_party.members[index]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(index)
- draw_item_background(index)
- draw_actor_name(actor, x - 100, y - 50)
- draw_actor_level(actor, x - 35, y - 50)
- draw_actor_face(actor, rect.x + 20, rect.y + 25, enabled)
- draw_actor_icons(actor, x - 80, y + (line_height * 2) + 28)
- draw_actor_hp(actor, x - 100 , y + 100)
- draw_actor_mp(actor, x - 100 , y + 125)
- end
- #--------------------------------------------------------------------------
- # * Draw Background for Item
- #--------------------------------------------------------------------------
- def draw_item_background(index)
- if index == @pending_index
- contents.fill_rect(item_rect(index), pending_color)
- end
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- super
- $game_party.menu_actor = $game_party.members[index]
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select($game_party.menu_actor.index || 0)
- end
- #--------------------------------------------------------------------------
- # * Set Pending Position (for Formation)
- #--------------------------------------------------------------------------
- def pending_index=(index)
- last_pending_index = @pending_index
- @pending_index = index
- redraw_item(@pending_index)
- redraw_item(last_pending_index)
- end
- end
- #==============================================================================
- # ** Legacy_Window_MenuActor
- #------------------------------------------------------------------------------
- # This window is for selecting actors that will be the target of item or
- # skill use.
- #==============================================================================
- class Window_Legacy_MenuActor < Window_Legacy_MenuStatus
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(100, 47)
- self.visible = true
- self.height = 320
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- $game_party.target_actor = $game_party.members[index]
- call_ok_handler
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select($game_party.target_actor.index || 0)
- end
- #--------------------------------------------------------------------------
- # * Set Position of Cursor for Item
- #--------------------------------------------------------------------------
- def select_for_item(item)
- @cursor_fix = item.for_user?
- @cursor_all = item.for_all?
- if @cursor_fix
- select($game_party.menu_actor.index)
- elsif @cursor_all
- select(0)
- else
- select_last
- end
- end
- #--------------------------------------------------------------------------
- # * Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- cursor_rect.empty
- end
- end
- #==============================================================================
- # ** Window_Location
- #------------------------------------------------------------------------------
- # This window displays the map name.
- #==============================================================================
- class Window_Location < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 240, fitting_height(1))
- self.opacity = 180
- refresh
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text(contents.rect, $game_map.display_name, 1)
- end
- end
- #==============================================================================
- # ** Window_HorzSkillCommand
- #------------------------------------------------------------------------------
- # This window is for selecting commands (special attacks, magic, etc.) on the
- # skill screen.
- #==============================================================================
- class Window_HorzSkillCommand < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :skill_window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y)
- @actor = nil
- self.height = 48
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Get Spacing for Items Arranged Side by Side
- #--------------------------------------------------------------------------
- def spacing
- return 8
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- select_last
- end
- #--------------------------------------------------------------------------
- # * Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- return 1
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- return unless @actor
- @actor.added_skill_types.sort.each do |stype_id|
- name = $data_system.skill_types[stype_id]
- add_command(name, :skill, true, stype_id)
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- @skill_window.stype_id = current_ext if @skill_window
- end
- #--------------------------------------------------------------------------
- # * Set Skill Window
- #--------------------------------------------------------------------------
- def skill_window=(skill_window)
- @skill_window = skill_window
- update
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- skill = @actor.last_skill.object
- if skill
- select_ext(skill.stype_id)
- else
- select(0)
- end
- end
- end
- #==============================================================================
- # ** Window_SkillStatus
- #------------------------------------------------------------------------------
- # This window displays the skill user's status on the skill screen.
- #==============================================================================
- class Window_SkillStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 180, 320)
- @actor = nil
- self.opacity = 180
- self.visible = true
- end
- #--------------------------------------------------------------------------
- # * Actor Settings
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @actor
- draw_actor_name(@actor, 5, 0)
- draw_actor_level(@actor, 75, 0)
- draw_actor_face(@actor, 20, 25)
- draw_actor_icons(@actor, 20, 125)
- draw_actor_hp(@actor, 5 , 150)
- draw_actor_mp(@actor, 5 , 175)
- end
- end
- #==============================================================================
- # ** Window_SkillList
- #------------------------------------------------------------------------------
- # This window is for displaying a list of available skills on the skill window.
- #==============================================================================
- class Window_SkillList < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @actor = nil
- @stype_id = 0
- @data = []
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- self.oy = 0
- end
- #--------------------------------------------------------------------------
- # * Set Skill Type ID
- #--------------------------------------------------------------------------
- def stype_id=(stype_id)
- return if @stype_id == stype_id
- @stype_id = stype_id
- refresh
- self.oy = 0
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # * Get Skill
- #--------------------------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Selection Item
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # * Include in Skill List?
- #--------------------------------------------------------------------------
- def include?(item)
- item && item.stype_id == @stype_id
- end
- #--------------------------------------------------------------------------
- # * Display Skill in Active State?
- #--------------------------------------------------------------------------
- def enable?(item)
- @actor && @actor.usable?(item)
- end
- #--------------------------------------------------------------------------
- # * Create Skill List
- #--------------------------------------------------------------------------
- def make_item_list
- @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select(@data.index(@actor.last_skill.object) || 0)
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if skill
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(skill, rect.x, rect.y, enable?(skill))
- draw_skill_cost(rect, skill)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Skill Use Cost
- #--------------------------------------------------------------------------
- def draw_skill_cost(rect, skill)
- if @actor.skill_tp_cost(skill) > 0
- change_color(tp_cost_color, enable?(skill))
- draw_text(rect, @actor.skill_tp_cost(skill), 2)
- elsif @actor.skill_mp_cost(skill) > 0
- change_color(mp_cost_color, enable?(skill))
- draw_text(rect, @actor.skill_mp_cost(skill), 2)
- end
- end
- #--------------------------------------------------------------------------
- # * Update Help Text
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item)
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- end
- #==============================================================================
- # ** Window_EquipStatus
- #------------------------------------------------------------------------------
- # This window displays actor parameter changes on the equipment screen.
- #==============================================================================
- class Window_EquipStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 180, 320)
- @actor = nil
- @temp_actor = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- return 7
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- if !@actor.nil?
- draw_actor_name(@actor, 4, 0)
- draw_actor_level(@actor, 100, 0)
- draw_actor_face(@actor, 25, 30)
- end
- 6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
- end
- #--------------------------------------------------------------------------
- # * Set Temporary Actor After Equipment Change
- #--------------------------------------------------------------------------
- def set_temp_actor(temp_actor)
- return if @temp_actor == temp_actor
- @temp_actor = temp_actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(x, y, param_id)
- draw_param_name(x + 4, y + 115, param_id)
- draw_current_param(x + 45, y + 115, param_id) if @actor
- draw_right_arrow(x + 85, y + 115)
- draw_new_param(x + 115, y + 115, param_id) if @temp_actor
- end
- #--------------------------------------------------------------------------
- # * Draw Parameter Name
- #--------------------------------------------------------------------------
- def draw_param_name(x, y, param_id)
- change_color(system_color)
- draw_text(x, y, 80, line_height, Vocab::param(param_id))
- end
- #--------------------------------------------------------------------------
- # * Draw Current Parameter
- #--------------------------------------------------------------------------
- def draw_current_param(x, y, param_id)
- change_color(normal_color)
- draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Right Arrow
- #--------------------------------------------------------------------------
- def draw_right_arrow(x, y)
- change_color(system_color)
- draw_text(x, y, 22, line_height, "→", 1)
- end
- #--------------------------------------------------------------------------
- # * Draw Post-Equipment Change Parameter
- #--------------------------------------------------------------------------
- def draw_new_param(x, y, param_id)
- new_value = @temp_actor.param(param_id)
- change_color(param_change_color(new_value - @actor.param(param_id)))
- draw_text(x, y, 32, line_height, new_value, 2)
- end
- end
- #==============================================================================
- # ** Window_SaveFile
- #------------------------------------------------------------------------------
- # This window displays save files on the save and load screens.
- #==============================================================================
- class Window_SaveFile < Window_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :selected # selected
- #--------------------------------------------------------------------------
- # * Object Initialization
- # index : index of save files
- #--------------------------------------------------------------------------
- def initialize(height, index)
- super(90, (index * height) - 100, 360, height)
- @file_index = index
- refresh
- @selected = false
- self.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- change_color(normal_color)
- name = Vocab::File + " #{@file_index + 1}"
- draw_text(4, 0, 200, line_height, name)
- @name_width = text_size(name).width
- draw_party_characters(152, 58)
- draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Party Characters
- #--------------------------------------------------------------------------
- def draw_party_characters(x, y)
- header = DataManager.load_header(@file_index)
- return unless header
- header[:characters].each_with_index do |data, i|
- draw_character(data[0], data[1], x + i * 48, y)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Play Time
- #--------------------------------------------------------------------------
- def draw_playtime(x, y, width, align)
- header = DataManager.load_header(@file_index)
- return unless header
- draw_text(x, y, width, line_height, header[:playtime_s], 2)
- end
- #--------------------------------------------------------------------------
- # * Set Selected
- #--------------------------------------------------------------------------
- def selected=(selected)
- @selected = selected
- update_cursor
- end
- #--------------------------------------------------------------------------
- # * Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if @selected
- cursor_rect.set(0, 0, @name_width + 8, line_height)
- else
- cursor_rect.empty
- end
- end
- end
- #==============================================================================
- # :: Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ; Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_command_window
- create_location_window
- create_gold_window
- create_status_window
- end
- #--------------------------------------------------------------------------
- # ; Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_HorzMenuCommand.new
- @command_window.height = 48
- @command_window.set_handler(:item, method(:command_item))
- @command_window.set_handler(:skill, method(:command_personal))
- @command_window.set_handler(:equip, method(:command_personal))
- @command_window.set_handler(:save, method(:command_save))
- @command_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ; Create Gold Window
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = 385
- @gold_window.y = Graphics.height - @gold_window.height
- @gold_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # ; Create Status Window
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_ActorStatus.new(100, 48)
- end
- #--------------------------------------------------------------------------
- # ; Create Location Window
- #--------------------------------------------------------------------------
- def create_location_window
- @location_window = Window_Location.new
- @location_window.x = 0
- @location_window.y = Graphics.height - @location_window.height
- @location_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # ; [Item] Command
- #--------------------------------------------------------------------------
- def command_item
- SceneManager.call(Scene_Legacy_Item)
- end
- #--------------------------------------------------------------------------
- # ; [Skill], [Equipment] and [Status] Commands
- #--------------------------------------------------------------------------
- def command_personal
- case @command_window.current_symbol
- when :skill
- SceneManager.call(Scene_Legacy_Skill)
- when :equip
- SceneManager.call(Scene_Equip)
- end
- end
- #--------------------------------------------------------------------------
- # ; [Save] Command
- #--------------------------------------------------------------------------
- def command_save
- SceneManager.call(Scene_Save)
- end
- end
- #==============================================================================
- # ** Scene_ItemBase
- #------------------------------------------------------------------------------
- # This class performs common processing for the item screen and skill screen.
- #==============================================================================
- class Scene_Legacy_ItemBase < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_actor_window
- end
- #--------------------------------------------------------------------------
- # * Create Actor Window
- #--------------------------------------------------------------------------
- def create_actor_window
- @actor_window = Window_Legacy_MenuActor.new
- @actor_window.set_handler(:ok, method(:on_actor_ok))
- @actor_window.set_handler(:cancel, method(:on_actor_cancel))
- end
- #--------------------------------------------------------------------------
- # * Get Currently Selected Item
- #--------------------------------------------------------------------------
- def item
- @item_window.item
- end
- #--------------------------------------------------------------------------
- # * Get Item's User
- #--------------------------------------------------------------------------
- def user
- $game_party.movable_members.max_by {|member| member.pha }
- end
- #--------------------------------------------------------------------------
- # * Determine if Cursor Is in Left Column
- #--------------------------------------------------------------------------
- def cursor_left?
- @item_window.index % 1 == 0
- end
- #--------------------------------------------------------------------------
- # * Hide Subwindow
- #--------------------------------------------------------------------------
- def hide_sub_window(window)
- @viewport.rect.x = @viewport.ox = 0
- @viewport.rect.width = Graphics.width
- window.hide.deactivate
- activate_item_window
- end
- #--------------------------------------------------------------------------
- # * Actor [OK]
- #--------------------------------------------------------------------------
- def on_actor_ok
- if item_usable?
- use_item
- else
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # * Actor [Cancel]
- #--------------------------------------------------------------------------
- def on_actor_cancel
- activate_item_window
- end
- #--------------------------------------------------------------------------
- # * Confirm Item
- #--------------------------------------------------------------------------
- def determine_item
- if item.for_friend?
- @actor_window.show.activate
- @actor_window.select_for_item(item)
- else
- use_item
- activate_item_window
- end
- end
- #--------------------------------------------------------------------------
- # * Activate Item Window
- #--------------------------------------------------------------------------
- def activate_item_window
- @item_window.refresh
- @item_window.activate
- end
- #--------------------------------------------------------------------------
- # * Get Array of Actors Targeted by Item Use
- #--------------------------------------------------------------------------
- def item_target_actors
- if !item.for_friend?
- []
- elsif item.for_all?
- $game_party.members
- else
- [$game_party.members[@actor_window.index]]
- end
- end
- #--------------------------------------------------------------------------
- # * Determine if Item is Usable
- #--------------------------------------------------------------------------
- def item_usable?
- user.usable?(item) && item_effects_valid?
- end
- #--------------------------------------------------------------------------
- # * Determine if Item Is Effective
- #--------------------------------------------------------------------------
- def item_effects_valid?
- item_target_actors.any? do |target|
- target.item_test(user, item)
- end
- end
- #--------------------------------------------------------------------------
- # * Use Item on Actor
- #--------------------------------------------------------------------------
- def use_item_to_actors
- item_target_actors.each do |target|
- item.repeats.times { target.item_apply(user, item) }
- end
- end
- #--------------------------------------------------------------------------
- # * Use Item
- #--------------------------------------------------------------------------
- def use_item
- play_se_for_item
- user.use_item(item)
- use_item_to_actors
- check_common_event
- check_gameover
- @actor_window.refresh
- end
- #--------------------------------------------------------------------------
- # * Determine if Common Event Is Reserved
- # Transition to the map screen if the event call is reserved.
- #--------------------------------------------------------------------------
- def check_common_event
- SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?
- end
- end
- #==============================================================================
- # ** Scene_Item
- #------------------------------------------------------------------------------
- # This class performs the item screen processing.
- #==============================================================================
- class Scene_Legacy_Item < Scene_Legacy_ItemBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_category_window
- create_item_window
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- update_basic
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new(1)
- @help_window.viewport = @viewport
- @help_window.y = 365
- @help_window.height = 50
- @help_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Create Category Window
- #--------------------------------------------------------------------------
- def create_category_window
- @category_window = Window_ItemCategory.new
- @category_window.viewport = @viewport
- @category_window.help_window = @help_window
- @category_window.x = 100
- @category_window.y = 0
- @category_window.width = 380
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * Create Item Window
- #--------------------------------------------------------------------------
- def create_item_window
- @item_window = Window_ItemList.new(250, 47, 230, 318)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @category_window.item_window = @item_window
- end
- #--------------------------------------------------------------------------
- # * Category [OK]
- #--------------------------------------------------------------------------
- def on_category_ok
- @item_window.activate
- @item_window.select_last
- end
- #--------------------------------------------------------------------------
- # * Item [OK]
- #--------------------------------------------------------------------------
- def on_item_ok
- $game_party.last_item.object = item
- determine_item
- end
- #--------------------------------------------------------------------------
- # * Item [Cancel]
- #--------------------------------------------------------------------------
- def on_item_cancel
- @item_window.unselect
- @category_window.activate
- end
- #--------------------------------------------------------------------------
- # * Play SE When Using Item
- #--------------------------------------------------------------------------
- def play_se_for_item
- Sound.play_use_item
- end
- #--------------------------------------------------------------------------
- # * Use Item
- #--------------------------------------------------------------------------
- def use_item
- super
- @item_window.redraw_current_item
- @item_window.refresh
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #------------------------------------------------------------------------------
- # This class performs skill screen processing. Skills are handled as items for
- # the sake of process sharing.
- #==============================================================================
- class Scene_Legacy_Skill < Scene_Legacy_ItemBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_command_window
- create_item_window
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new(1)
- @help_window.viewport = @viewport
- @help_window.y = 367
- @help_window.height = 50
- @help_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_HorzSkillCommand.new(100, 0)
- @command_window.width = 150
- @command_window.viewport = @viewport
- @command_window.help_window = @help_window
- @command_window.actor = @actor
- @command_window.set_handler(:skill, method(:command_skill))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- end
- #--------------------------------------------------------------------------
- # * Create Item Window
- #--------------------------------------------------------------------------
- def create_item_window
- @item_window = Window_SkillList.new(250, 0, 245, 367)
- @item_window.actor = @actor
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @command_window.skill_window = @item_window
- end
- #--------------------------------------------------------------------------
- # * Get Skill's User
- #--------------------------------------------------------------------------
- def user
- @actor
- end
- #--------------------------------------------------------------------------
- # * [Skill] Command
- #--------------------------------------------------------------------------
- def command_skill
- @item_window.activate
- @item_window.select_last
- end
- #--------------------------------------------------------------------------
- # * Item [OK]
- #--------------------------------------------------------------------------
- def on_item_ok
- @actor.last_skill.object = item
- determine_item
- end
- #--------------------------------------------------------------------------
- # * Item [Cancel]
- #--------------------------------------------------------------------------
- def on_item_cancel
- @item_window.unselect
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # * Play SE When Using Item
- #--------------------------------------------------------------------------
- def play_se_for_item
- Sound.play_use_skill
- end
- #--------------------------------------------------------------------------
- # * Use Item
- #--------------------------------------------------------------------------
- def use_item
- super
- @actor_window.refresh
- @item_window.refresh
- end
- #--------------------------------------------------------------------------
- # * Change Actors
- #--------------------------------------------------------------------------
- def on_actor_change
- @command_window.actor = @actor
- @actor_window.actor = @actor
- @item_window.actor = @actor
- @command_window.activate
- end
- end
- #==============================================================================
- # ** Scene_Equip
- #------------------------------------------------------------------------------
- # This class performs the equipment screen processing.
- #==============================================================================
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_status_window
- create_command_window
- create_slot_window
- create_item_window
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new(1)
- @help_window.viewport = @viewport
- @help_window.y = 367
- @help_window.height = 50
- @help_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_EquipStatus.new(20, 48)
- @status_window.viewport = @viewport
- @status_window.actor = @actor
- @status_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_EquipCommand.new(100, 0, 380)
- @command_window.opacity = 180
- @command_window.viewport = @viewport
- @command_window.help_window = @help_window
- @command_window.set_handler(:equip, method(:command_equip))
- @command_window.set_handler(:optimize, method(:command_optimize))
- @command_window.set_handler(:clear, method(:command_clear))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- end
- #--------------------------------------------------------------------------
- # * Create Slot Window
- #--------------------------------------------------------------------------
- def create_slot_window
- @slot_window = Window_EquipSlot.new(200, 48, 320)
- @slot_window.opacity = 180
- @slot_window.viewport = @viewport
- @slot_window.help_window = @help_window
- @slot_window.status_window = @status_window
- @slot_window.actor = @actor
- @slot_window.set_handler(:ok, method(:on_slot_ok))
- @slot_window.set_handler(:cancel, method(:on_slot_cancel))
- end
- #--------------------------------------------------------------------------
- # * Create Item Window
- #--------------------------------------------------------------------------
- def create_item_window
- @item_window = Window_EquipItem.new(200, 192, 320, 175)
- @item_window.opacity = 180
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.status_window = @status_window
- @item_window.actor = @actor
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @slot_window.item_window = @item_window
- end
- #--------------------------------------------------------------------------
- # * [Change Equipment] Command
- #--------------------------------------------------------------------------
- def command_equip
- @slot_window.activate
- @slot_window.select(0)
- end
- #--------------------------------------------------------------------------
- # * [Ultimate Equipment] Command
- #--------------------------------------------------------------------------
- def command_optimize
- Sound.play_equip
- @actor.optimize_equipments
- @status_window.refresh
- @slot_window.refresh
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # * [Remove All] Command
- #--------------------------------------------------------------------------
- def command_clear
- Sound.play_equip
- @actor.clear_equipments
- @status_window.refresh
- @slot_window.refresh
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # * Slot [OK]
- #--------------------------------------------------------------------------
- def on_slot_ok
- @item_window.activate
- @item_window.select(0)
- end
- #--------------------------------------------------------------------------
- # * Slot [Cancel]
- #--------------------------------------------------------------------------
- def on_slot_cancel
- @slot_window.unselect
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # * Item [OK]
- #--------------------------------------------------------------------------
- def on_item_ok
- Sound.play_equip
- @actor.change_equip(@slot_window.index, @item_window.item)
- @slot_window.activate
- @slot_window.refresh
- @item_window.unselect
- @item_window.refresh
- end
- #--------------------------------------------------------------------------
- # * Item [Cancel]
- #--------------------------------------------------------------------------
- def on_item_cancel
- @slot_window.activate
- @item_window.unselect
- end
- #--------------------------------------------------------------------------
- # * Change Actors
- #--------------------------------------------------------------------------
- def on_actor_change
- @status_window.actor = @actor
- @slot_window.actor = @actor
- @item_window.actor = @actor
- @command_window.activate
- end
- end
- #==============================================================================
- # ** Scene_File
- #------------------------------------------------------------------------------
- # This class performs common processing for the save screen and load screen.
- #==============================================================================
- class Scene_File < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_savefile_viewport
- create_savefile_windows
- init_selection
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super
- @savefile_viewport.dispose
- @savefile_windows.each {|window| window.dispose }
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- @savefile_windows.each {|window| window.update }
- update_savefile_selection
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new(1)
- @help_window.set_text(help_window_text)
- @help_window.y = 367
- @help_window.height = 50
- @help_window.opacity = 180
- end
- #--------------------------------------------------------------------------
- # * Get Help Window Text
- #--------------------------------------------------------------------------
- def help_window_text
- return ""
- end
- #--------------------------------------------------------------------------
- # * Create Save File Viewport
- #--------------------------------------------------------------------------
- def create_savefile_viewport
- @savefile_viewport = Viewport.new
- @savefile_viewport.rect.y = @help_window.height
- @savefile_viewport.rect.height -= @help_window.height
- end
- #--------------------------------------------------------------------------
- # * Create Save File Window
- #--------------------------------------------------------------------------
- def create_savefile_windows
- @savefile_windows = Array.new(item_max) do |i|
- Window_SaveFile.new(savefile_height, i)
- end
- @savefile_windows.each {|window| window.viewport = @savefile_viewport }
- end
- #--------------------------------------------------------------------------
- # * Initialize Selection State
- #--------------------------------------------------------------------------
- def init_selection
- @index = first_savefile_index
- @savefile_windows[@index].selected = true
- self.top_index = @index - visible_max / 2
- ensure_cursor_visible
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- return 3
- end
- #--------------------------------------------------------------------------
- # * Get Number of Save Files to Show on Screen
- #--------------------------------------------------------------------------
- def visible_max
- return 4
- end
- #--------------------------------------------------------------------------
- # * Get Height of Save File Window
- #--------------------------------------------------------------------------
- def savefile_height
- return 100
- end
- #--------------------------------------------------------------------------
- # * Get File Index to Select First
- #--------------------------------------------------------------------------
- def first_savefile_index
- return 0
- end
- #--------------------------------------------------------------------------
- # * Get Current Index
- #--------------------------------------------------------------------------
- def index
- @index
- end
- #--------------------------------------------------------------------------
- # * Get Top Index
- #--------------------------------------------------------------------------
- def top_index
- @savefile_viewport.oy / savefile_height
- end
- #--------------------------------------------------------------------------
- # * Set Top Index
- #--------------------------------------------------------------------------
- def top_index=(index)
- index = 0 if index < 0
- index = item_max - visible_max if index > item_max - visible_max
- @savefile_viewport.oy = index * savefile_height
- end
- #--------------------------------------------------------------------------
- # * Get Bottom Index
- #--------------------------------------------------------------------------
- def bottom_index
- top_index + visible_max - 1
- end
- #--------------------------------------------------------------------------
- # * Set Bottom Index
- #--------------------------------------------------------------------------
- def bottom_index=(index)
- self.top_index = index - (visible_max - 1)
- end
- #--------------------------------------------------------------------------
- # * Update Save File Selection
- #--------------------------------------------------------------------------
- def update_savefile_selection
- return on_savefile_ok if Input.trigger?(:C)
- return on_savefile_cancel if Input.trigger?(:B)
- update_cursor
- end
- #--------------------------------------------------------------------------
- # * Save File [OK]
- #--------------------------------------------------------------------------
- def on_savefile_ok
- end
- #--------------------------------------------------------------------------
- # * Save File [Cancel]
- #--------------------------------------------------------------------------
- def on_savefile_cancel
- Sound.play_cancel
- return_scene
- end
- #--------------------------------------------------------------------------
- # * Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- last_index = @index
- cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
- cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
- cursor_pagedown if Input.trigger?(:R)
- cursor_pageup if Input.trigger?(:L)
- if @index != last_index
- Sound.play_cursor
- @savefile_windows[last_index].selected = false
- @savefile_windows[@index].selected = true
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Down
- #--------------------------------------------------------------------------
- def cursor_down(wrap)
- @index = (@index + 1) % item_max if @index < item_max - 1 || wrap
- ensure_cursor_visible
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Up
- #--------------------------------------------------------------------------
- def cursor_up(wrap)
- @index = (@index - 1 + item_max) % item_max if @index > 0 || wrap
- ensure_cursor_visible
- end
- #--------------------------------------------------------------------------
- # * Move Cursor One Page Down
- #--------------------------------------------------------------------------
- def cursor_pagedown
- if top_index + visible_max < item_max
- self.top_index += visible_max
- @index = [@index + visible_max, item_max - 1].min
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor One Page Up
- #--------------------------------------------------------------------------
- def cursor_pageup
- if top_index > 0
- self.top_index -= visible_max
- @index = [@index - visible_max, 0].max
- end
- end
- #--------------------------------------------------------------------------
- # * Scroll Cursor to Position Within Screen
- #--------------------------------------------------------------------------
- def ensure_cursor_visible
- self.top_index = index if index < top_index
- self.bottom_index = index if index > bottom_index
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement