Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Kadafi - Save Notification
- # Version : 1.0
- # Contact : http://forums.rpgmakerweb.com/index.php?/user/33654-kadafi/
- #==============================================================================
- ($imported ||= {})[:Kadafi_SaveNotif] = true
- #==============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2016.10.04 - Finished script
- #==============================================================================
- =begin
- Introduction :
- This script create a save notification.
- How to Use :
- Edit the configuration below.
- Terms of Use :
- 1. Credit me as Kadafi (Optional)
- =end
- #==============================================================================
- # Configuration
- #==============================================================================
- module Kadafi
- #--------------------------------------------------------------------------
- # * Notification Window Width in Scene_Map
- #--------------------------------------------------------------------------
- SaveNotifWindow_Width = 256
- #--------------------------------------------------------------------------
- # * Notification Vocab
- #--------------------------------------------------------------------------
- SaveNotif_Vocab = "Game Saved"
- #--------------------------------------------------------------------------
- # * Notification Window Show Count
- #--------------------------------------------------------------------------
- SaveNotif_ShowCount = 30 # Frames / 60s
- end
- #==============================================================================
- # Don't edit below this line unless you know what to do.
- #==============================================================================
- #==============================================================================
- # ** Game_Map
- #==============================================================================
- class Game_Map
- attr_reader :save_notif
- attr_accessor :save_notif
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias old_initialize_1 initialize
- def initialize
- old_initialize_1
- @save_notif = false
- end
- #--------------------------------------------------------------------------
- # * Show Item Use Notification
- #--------------------------------------------------------------------------
- def save_notification
- @save_notif = true
- end
- end
- #==============================================================================
- # ** Window_SaveNotification
- #==============================================================================
- class Window_SaveNotification < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, fitting_height(1))
- update_placement
- @notif = ""
- @fade = false
- @show_count = 0
- refresh
- hide
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.x = (Graphics.width - width) / 2
- self.y = Graphics.height - height
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return Kadafi::EquipSkillNotifWindow_Width
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- text = Kadafi::SaveNotif_Vocab
- draw_text(0 - line_height / 2, 0, width, line_height, text, 1)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- if open? && @show_count > 0
- @show_count -= 1
- if @show_count == 0
- @fade = true
- end
- end
- if @fade
- self.opacity -= 1
- self.contents_opacity -= 1
- if self.opacity == 0
- @fade = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Show Notification
- #--------------------------------------------------------------------------
- def show_notification
- self.opacity = 255
- self.contents_opacity = 255
- @show_count = Kadafi::SaveNotif_ShowCount
- refresh
- show
- end
- end
- #==============================================================================
- # ** Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- alias old_start start
- def start
- old_start
- create_savenotif_window
- end
- #--------------------------------------------------------------------------
- # * Create Notification Window
- #--------------------------------------------------------------------------
- def create_savenotif_window
- @savenotif_window = Window_SaveNotification.new
- end
- #--------------------------------------------------------------------------
- # * Show Item Use Notification
- #--------------------------------------------------------------------------
- def show_savenotif
- @savenotif_window.show_notification
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- alias old_update_1 update
- def update
- old_update_1
- if $game_map.save_notif
- show_savenotif
- $game_map.save_notif = false
- end
- end
- end
- #==============================================================================
- # ** Scene_Save
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # * Processing When Save Is Successful
- #--------------------------------------------------------------------------
- alias old_on_save_success_1 on_save_success
- def on_save_success
- old_on_save_success_1
- $game_map.save_notification
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement