Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Script : Dark's Custom Menu
- # Author : Nhat Nguyen ( Dark Sky )
- # Release Date : Feb 16th 2016
- # Version : 1.1
- #===============================================================================
- module CustomMenu
- #---------------------------------------------------------------------------
- Background_Image = "Background"
- CommandList_Image = "Command List"
- Gold_Image = "Gold"
- Main_Menu_Image = "Main Menu"
- Status_Image = ""
- Cursor_Image = "Select Actor"
- Actor_image_regex = /<custom_*face:\s*"(\w+)">/i
- #---------------------------------------------------------------------------
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_command_window
- create_gold_window
- create_status_window
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- alias dark_custom_menu create_command_window
- def create_command_window
- dark_custom_menu
- @command_window_sprite = Sprite.new
- @command_window_sprite.bitmap = Cache.picture(CustomMenu::CommandList_Image)
- @command_window.width = 140
- @command_window.x = 35
- @command_window.y = 110
- @command_window.opacity = 0
- @command_window.back_opacity = 0
- if @command_window.last_symbol != nil
- @command_window.select_last
- else
- @command_window.select(0)
- end
- @command_window.contents_width
- @command_window.create_contents
- @command_window.refresh
- end
- #--------------------------------------------------------------------------
- # * Create Gold Window
- #--------------------------------------------------------------------------
- alias dark_custom_menu_create_gold_window create_gold_window
- def create_gold_window
- dark_custom_menu_create_gold_window
- @gold_window.x = 64
- @gold_window.y += 3
- @gold_window.opacity = 0
- @gold_window.back_opacity = 0
- @gold_window_sprite = Sprite.new
- @gold_window_sprite.bitmap = Cache.picture(CustomMenu::Gold_Image)
- end
- #--------------------------------------------------------------------------
- # * Create Background
- #--------------------------------------------------------------------------
- def create_background
- @background_sprite = Sprite.new
- @background_sprite.bitmap = Cache.picture(CustomMenu::Background_Image)
- @main_menu_sprite = Sprite.new
- @main_menu_sprite.bitmap = Cache.picture(CustomMenu::Main_Menu_Image)
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_MenuStatus.new(@command_window.width, 0)
- @status_window.opacity = 0
- @status_window.x = 182 - 32
- @status_window.y = 62 - 12
- @status_window.back_opacity = 0
- @status_window_sprite = Sprite.new
- @status_window_sprite.bitmap = Cache.picture(CustomMenu::Status_Image)
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- alias dark_custom_menu_update update
- def update
- dark_custom_menu_update
- end
- end
- class Scene_ItemBase < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_actor_window
- create_background
- end
- end
- class Game_Actor < Game_Battler
- attr_reader :note
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias dark_custom_menu_initialize_game_actor initialize
- def initialize(actor_id)
- dark_custom_menu_initialize_game_actor(actor_id)
- @note = actor.note
- end
- end
- #==============================================================================
- # ** Window_MenuStatus
- #------------------------------------------------------------------------------
- # This window displays party member status on the menu screen.
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :pending_index # Pending position (for formation)
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, window_width, window_height)
- self.windowskin = Cache.system("Custom_Menu_Windowskin")
- @cursor_image = Sprite.new
- @cursor_image.bitmap = Cache.picture(CustomMenu::Cursor_Image)
- @cursor_image.x = Graphics.width - @cursor_image.width
- @cursor_image.y = 65
- @cursor_image.visible = false
- @face_images = []
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Item Height
- #--------------------------------------------------------------------------
- def item_height
- 41
- end
- #--------------------------------------------------------------------------
- # * Get Spacing for Items Arranged Side by Side
- #--------------------------------------------------------------------------
- def spacing
- return 17
- end
- #--------------------------------------------------------------------------
- # * Get Rectangle for Drawing Items
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height
- rect.x = index % col_max * (item_width + spacing)
- rect.y = index / col_max * (item_height+spacing+index-1.5)
- rect
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- actor = $game_party.members[index]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(index)
- if actor.note =~ CustomMenu::Actor_image_regex
- @face_images.push(Sprite.new)
- @face_images[index].bitmap = Cache.picture($1.to_s)
- @face_images[index].z = 0
- end
- draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
- end
- def draw_actor_simple_status(actor, x, y)
- draw_actor_name(actor, x + 12, y)
- draw_actor_icons(actor, x, y + line_height * 2)
- draw_actor_hp(actor, x + 80 , y + 8, 80)
- draw_actor_mp(actor, x + 170, y + 8, 80)
- draw_actor_tp(actor, x, y + 21, 60)
- end
- #--------------------------------------------------------------------------
- # * Draw TP
- #--------------------------------------------------------------------------
- def draw_actor_tp(actor, x, y, width = 124)
- change_color(system_color)
- draw_text(x, y, 30, line_height, Vocab::tp_a)
- change_color(tp_color(actor))
- draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Name
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, x, y, width = 112)
- change_color(hp_color(actor))
- contents.font.name = ["Chau Philomene One",Font.default_name]
- contents.font.out_color = Color.new(162,0,255)
- draw_text(x, y, width, line_height, actor.name)
- contents.font.out_color = Font.default_out_color
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- super
- $game_party.menu_actor = $game_party.members[index]
- end
- alias dark_custom_menu_dispose_menustatus dispose
- def dispose
- dark_custom_menu_dispose_menustatus
- bitmap_dispose
- end
- def bitmap_dispose
- @cursor_image.bitmap.dispose
- @cursor_image.dispose
- @face_images.each do |sprite|
- sprite.bitmap.dispose
- sprite.dispose
- end
- end
- #--------------------------------------------------------------------------
- # * Update Cursor Bitmap Position
- #--------------------------------------------------------------------------
- def update_cursor_bitmap
- @cursor_image.visible = self.active
- if @index != -1
- @cursor_image.visible = true
- @cursor_image.y = 65 + @index*19*3
- if @index == 2
- @cursor_image.y += 4
- end
- if @index == 3
- @cursor_image.y += 6
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- alias dark_custom_menu_refresh refresh
- def refresh
- dark_custom_menu_refresh
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- alias dark_custom_menu_update_menustatus update
- def update
- dark_custom_menu_update_menustatus
- update_cursor_bitmap if !@cursor_image.disposed?
- end
- end
- #==============================================================================
- # ** Window_MenuCommand
- #------------------------------------------------------------------------------
- # This command window appears on the menu screen.
- #==============================================================================
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Initialize Command Selection Position (Class Method)
- #--------------------------------------------------------------------------
- def self.init_command_position
- @@last_command_symbol = nil
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- select_last
- end
- #--------------------------------------------------------------------------
- # * Get Last Command Position
- #--------------------------------------------------------------------------
- def last_symbol
- return @@last_command_symbol
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- change_color(normal_color, command_enabled?(index))
- draw_text(item_rect_for_text(index), command_name(index), 1)
- end
- #--------------------------------------------------------------------------
- # * Make Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_main_commands
- add_original_commands
- add_save_command
- add_game_end_command
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment