Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # DSI Card Skin v1.2
- # -- Last Updated: 2017.07.23
- # -- Author: dsiver144
- # -- Level: Normal
- # -- Requires: n/a
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["DSI-CardSkin"] = true
- #==============================================================================
- # + Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2017.07.16 - Finish first version.
- # 2017.07.19 - Add 2 script calls.
- # 2017.07.23 - Fix the BGM issues.
- #==============================================================================
- # + Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ?? Materials/?f?? but above ?? Main. Remember to save.
- # *Put this below my Class Choosing script.
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # Script Call: open_skin_option_scene -> Open Skin Option Scene
- # unlock_card_skin(skill_id, skin_id_1, skin_id_2, ... skin_id_n)
- # - ex: unlock_card_skin(28, 1, 2) -> unlock extra skin #1, #2 for Earth Throw.
- # unlock_class_skin(class_id, skin_id_1, skin_id_2, ... skin_id_n)
- # - ex: unlock_class_skin(1, 2, 3) -> unlock extra skin #2, #3 for Earth Mage
- # class.
- #==============================================================================
- module DSIVER144
- module CARD_SKIN_SYSTEM
- SHOW_MENU_COMMAND = true
- end
- end
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # new method: open_deck_option_scene
- #--------------------------------------------------------------------------
- def open_skin_option_scene
- SceneManager.call(Scene_CardSkinOptions)
- end
- end # Game_Interpreter
- class Window_MenuCommand < Window_Command
- #---------------------------------------------------------------------------
- # overwritten method: add_main_commands
- #---------------------------------------------------------------------------
- alias_method(:dsi_card_skin_add_main_commands, :add_main_commands)
- def add_main_commands
- dsi_card_skin_add_main_commands
- if DSIVER144::CARD_SKIN_SYSTEM::SHOW_MENU_COMMAND
- add_command("Card Skin", :card_skin, main_commands_enabled)
- end
- end
- end # Window_MenuCommand
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # Adds a handler to access the card crafting system
- #--------------------------------------------------------------------------
- alias_method(:dsiver144_create_command_window_dsi_card_skin, :create_command_window)
- def create_command_window
- dsiver144_create_command_window_dsi_card_skin
- if DSIVER144::CARD_CRAFTING::SHOW_MENU_COMMAND
- @command_window.set_handler(:card_skin, method(:command_card_skin))
- end
- end
- #--------------------------------------------------------------------------
- # * new method: command_card_skin
- #--------------------------------------------------------------------------
- def command_card_skin
- $game_system.save_bgm
- SceneManager.call(Scene_CardSkinOptions)
- end
- end # Scene_Menu
- module DSIVER144
- module CARD_SKIN_SYSTEM
- OPTION_SCENE_BG = "MeteorG"
- OPTION_SCENE_BGM = ["Scene5",100,100]
- end # CLASS_ABILITY_SYSTEM
- end # DSIVER144
- class Scene_CardSkinOptions < Scene_Base
- include DSIVER144::CARD_SKIN_SYSTEM
- #--------------------------------------------------------------------------
- # * new method: start
- #--------------------------------------------------------------------------
- def start
- super
- play_card_skin_bgm
- create_background
- create_buttons
- end
- #-------------------------------------------------------------------------
- # * new method: play_card_library_bgm
- #-------------------------------------------------------------------------
- def play_card_skin_bgm
- RPG::BGM.new(*OPTION_SCENE_BGM).play
- end
- #-------------------------------------------------------------------------
- # * new method: stop_card_bgm
- #-------------------------------------------------------------------------
- def stop_card_skin_bgm
- RPG::BGM.stop
- $game_system.replay_bgm
- end
- #--------------------------------------------------------------------------
- # * Create Background
- #--------------------------------------------------------------------------
- def create_background
- @background_sprite = Sprite.new
- @background_sprite.bitmap = Cache.picture(OPTION_SCENE_BG)
- end
- #--------------------------------------------------------------------------
- # * Free Background
- #--------------------------------------------------------------------------
- def dispose_background
- @background_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * new method: create_buttons
- #--------------------------------------------------------------------------
- def create_buttons
- @button1 = Window_DeckOptionButton.new(0,0,"Change Card Skins")
- @button2 = Window_DeckOptionButton.new(0,0,"Change Deck Leader Skins")
- @button3 = Window_DeckOptionButton.new(0,0,"Exit")
- space_y = @button3.height + 20
- cal_height = (@button1.height + space_y)*2 + @button1.height
- start_y = 0.5*(Graphics.height - cal_height)
- for i in 1..3
- eval("@button#{i}.x = 0.5*(Graphics.width - @button1.width)")
- eval("@button#{i}.y = start_y + #{space_y*(i)} - 20")
- end
- @command_index = $menu_last_cursor_pos ? $menu_last_cursor_pos : 0
- @buttons = [@button1,@button2,@button3]
- instant_change_opacity
- end
- #--------------------------------------------------------------------------
- # * new method: instant_change_opacity
- #--------------------------------------------------------------------------
- def instant_change_opacity
- @buttons.each_with_index do |button, index|
- if @command_index == index
- button.opacity = 255
- button.contents_opacity = 255
- else
- button.opacity = 100
- button.contents_opacity = 100
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: update_button_opacity
- #--------------------------------------------------------------------------
- def update_button_opacity
- @buttons.each_with_index do |button, index|
- if @command_index == index
- if button.opacity < 255
- button.opacity += 10
- button.contents_opacity += 10
- elsif button.opacity > 255
- button.opacity = 255
- button.contents_opacity = 255
- end
- else
- if button.opacity > 100
- button.opacity -= 10
- button.contents_opacity -= 10
- elsif button.opacity < 100
- button.opacity = 100
- button.contents_opacity = 100
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: update_cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if Input.repeat?(:UP)
- @command_index -= 1
- Sound.play_cursor
- @command_index = 2 if @command_index < 0
- end
- if Input.repeat?(:DOWN)
- @command_index += 1
- Sound.play_cursor
- @command_index = 0 if @command_index > 2
- end
- if Input.trigger?(:B)
- Sound.play_cancel
- stop_card_skin_bgm
- return_scene
- end
- if Input.trigger?(:C)
- case @command_index
- when 0
- Sound.play_ok
- $menu_last_cursor_pos = @command_index
- SceneManager.call(Scene_SkinType)
- when 1
- Sound.play_ok
- $menu_last_cursor_pos = @command_index
- SceneManager.call(Scene_LeadSkinType)
- when 2
- Sound.play_cancel
- stop_card_skin_bgm
- return_scene
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: update
- #--------------------------------------------------------------------------
- def update
- super
- update_cursor
- update_button_opacity
- end
- #--------------------------------------------------------------------------
- # * new method: terminate
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_background
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement