Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # [Xp/Vx-VxA] Button Reminder
- # Version 1.00
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- ($imported ||= {})[:drg_button_reminder] = 1.00
- module LiTTleDRAgo
- BUTTON_REMINDER_FONT_NAME1 = ["Finger Paint","Georgia","Arial"]
- BUTTON_REMINDER_FONT_NAME2 = ["Georgia","Arial"]
- BUTTON_REMINDER_FONT_SIZE1 = 20
- BUTTON_REMINDER_FONT_SIZE2 = 20
- BUTTON_REMINDER_FONT_COLOR1 = Color.blue
- BUTTON_REMINDER_FONT_COLOR2 = nil
- end
- text = "This Script needs Drago - Core Engine v1.39 or later"
- ($imported[:drg_core_engine] || 0) >= 1.39 || raise(text)
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # This class performs the map screen processing.
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # * Disable Button Reminder Sprite
- # Add your own condition to disable button reminder
- #--------------------------------------------------------------------------
- def disable_brsprite?
- return true if $game_map.interpreter.running?
- end
- #--------------------------------------------------------------------------
- # * Condition Button Reminder Sprite
- #--------------------------------------------------------------------------
- def condition_brsprite
- cond = {
- 'E Hotkey Change' => $mog_rgss3_ultima_hud && (hud = @spriteset.
- instance_variable_get(:@ultima_hud)).
- is_a?(Ultima_Hud) && !hud.can_auto_hide?,
- 'B/ESC Main Menu' => true, # always active
- 'Shift Run' => $game_switches[1] == true, # if switch 1 is on
- }
- return cond
- end
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias_sec_method :button_reminder_main, :main
- alias_sec_method :button_reminder_update, :update
- #--------------------------------------------------------------------------
- # * Main
- #--------------------------------------------------------------------------
- def main
- button_reminder_main
- @brsprite.each {|s| s.disposed? || s.dispose }
- end
- #--------------------------------------------------------------------------
- # * Update Frame
- #--------------------------------------------------------------------------
- def update
- button_reminder_update
- create_brsprite && update_brsprite && update_condition_brsprite
- end
- #--------------------------------------------------------------------------
- # * Create Button Reminder Sprite
- #--------------------------------------------------------------------------
- def create_brsprite
- @brsprite ||= []
- $game_system.button_reminder.each_with_index do |string,i|
- if @brsprite[i].not.is_a?(Sprite) || @brsprite[i].disposed?
- @brsprite[i] = Sprite.new
- @brsprite[i].instance_variable_set(:@words,string)
- words = string.words
- @brsprite[i].bitmap = Bitmap.new(a = Graphics.width, 32)
- @brsprite[i].x = a
- @brsprite[i].y = 42 + i * 24
- font = @brsprite[i].bitmap.font.dup
- text = words.shift
- fna1 = LiTTleDRAgo::BUTTON_REMINDER_FONT_NAME1
- fna2 = LiTTleDRAgo::BUTTON_REMINDER_FONT_NAME2
- @brsprite[i].bitmap.font.name = [fna2, font.name].flatten
- @brsprite[i].bitmap.font.size = LiTTleDRAgo::BUTTON_REMINDER_FONT_SIZE2
- if (color = LiTTleDRAgo::BUTTON_REMINDER_FONT_COLOR2)
- unless @brsprite[i].bitmap.font.respond_to?(:glow) &&
- (@brsprite[i].bitmap.font.glow = color)
- (@brsprite[i].bitmap.font.color = color)
- end
- end
- size = @brsprite[i].bitmap.text_size(w = " : #{words.join(' ')}").width
- @brsprite[i].bitmap.draw_text(0,0, a - 20, 32, w, 2)
- @brsprite[i].bitmap.font.name = [fna1, font.name].flatten
- @brsprite[i].bitmap.font.size = LiTTleDRAgo::BUTTON_REMINDER_FONT_SIZE1
- if (color = LiTTleDRAgo::BUTTON_REMINDER_FONT_COLOR1)
- unless @brsprite[i].bitmap.font.respond_to?(:glow) &&
- (@brsprite[i].bitmap.font.glow = color)
- (@brsprite[i].bitmap.font.color = color)
- end
- end
- @brsprite[i].bitmap.draw_text(0,0, a - size - 20, 32,text,2)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Update Button Reminder Sprite
- #--------------------------------------------------------------------------
- def update_brsprite
- @brsprite.each_index do |i|
- next if @brsprite[i].disposed?
- @brsprite[i].opacity += disable_brsprite? ? -10 : 10
- if @brsprite[i].instance_variable_get(:@words) ==
- $game_system.button_reminder[i]
- @brsprite[i].update
- @brsprite[i].x = [@brsprite[i].x - 8,0].max
- else
- @brsprite[i].update
- @brsprite[i].x = [@brsprite[i].x + 15,Graphics.width].min
- @brsprite[i].dispose if @brsprite[i].x >= Graphics.width
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Update Condition Button Reminder Sprite
- #--------------------------------------------------------------------------
- def update_condition_brsprite
- condition_brsprite.each do |key,value|
- if value && !button_reminder.include?(key)
- button_reminder << key
- elsif !value && button_reminder.include?(key)
- button_reminder.delete(key)
- end
- end
- end
- end
- #==============================================================================
- # ** Object
- #------------------------------------------------------------------------------
- # This class is superclass from all classes.
- #==============================================================================
- class Object
- #--------------------------------------------------------------------------
- # * Button Reminder
- #--------------------------------------------------------------------------
- define_inexist_method(:button_reminder) { $game_system.button_reminder }
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_sec_reader :button_reminder, "[]"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement