mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed and implemented new pause menu and Trainer Card scripts
This commit is contained in:
@@ -103,9 +103,7 @@ class Scene_Map
|
||||
$game_temp.in_menu = true
|
||||
$game_player.straighten
|
||||
$game_map.update
|
||||
sscene = PokemonPauseMenu_Scene.new
|
||||
sscreen = PokemonPauseMenu.new(sscene)
|
||||
sscreen.pbStartPokemonMenu
|
||||
UI::PauseMenu.new
|
||||
$game_temp.in_menu = false
|
||||
end
|
||||
|
||||
|
||||
@@ -3,19 +3,117 @@
|
||||
# This bitmap can't be changed to a different one.
|
||||
#===============================================================================
|
||||
class BitmapSprite < Sprite
|
||||
attr_reader :text_themes
|
||||
|
||||
def initialize(width, height, viewport = nil)
|
||||
super(viewport)
|
||||
self.bitmap = Bitmap.new(width, height)
|
||||
@text_themes = {}
|
||||
@initialized = true
|
||||
end
|
||||
|
||||
def dispose
|
||||
self.bitmap.dispose if !self.disposed?
|
||||
super
|
||||
end
|
||||
|
||||
def bitmap=(value)
|
||||
super(value) if !@initialized
|
||||
end
|
||||
|
||||
def dispose
|
||||
self.bitmap.dispose if !self.disposed?
|
||||
super
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def add_text_theme(id, base_color, shadow_color = nil)
|
||||
@text_themes[id] = [base_color, shadow_color]
|
||||
end
|
||||
|
||||
# TODO: Replaces def pbDrawTextPositions.
|
||||
def draw_themed_text(string, text_x, text_y, align = :left, theme = :default, outline = :shadow)
|
||||
string_size = self.bitmap.text_size(string)
|
||||
case align
|
||||
when :right
|
||||
text_x -= string_size.width
|
||||
when :center
|
||||
text_x -= (string_size.width / 2)
|
||||
end
|
||||
if !@text_themes[theme]
|
||||
theme = (@text_themes[:default]) ? :default : @text_themes.keys.first
|
||||
end
|
||||
case outline || :shadow
|
||||
when :shadow
|
||||
draw_shadowed_text(string, text_x, text_y, theme)
|
||||
when :outline
|
||||
draw_outlined_text(string, text_x, text_y, theme)
|
||||
when :none
|
||||
draw_plain_text(string, text_x, text_y, theme)
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Replaces def pbDrawShadowText.
|
||||
def draw_shadowed_text(string, text_x, text_y, theme)
|
||||
return if !@text_themes[theme]
|
||||
base_color, shadow_color = @text_themes[theme]
|
||||
string_size = self.bitmap.text_size(string)
|
||||
string_width = string_size.width + 1
|
||||
string_height = string_size.height + 1
|
||||
if shadow_color && shadow_color.alpha > 0
|
||||
self.bitmap.font.color = shadow_color
|
||||
self.bitmap.draw_text(text_x + 2, text_y, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x, text_y + 2, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x + 2, text_y + 2, string_width, string_height, string, 0)
|
||||
end
|
||||
if base_color && base_color.alpha > 0
|
||||
self.bitmap.font.color = base_color
|
||||
self.bitmap.draw_text(text_x, text_y, string_width, string_height, string, 0)
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Replaces def pbDrawOutlineText.
|
||||
def draw_outlined_text(string, text_x, text_y, theme)
|
||||
return if !@text_themes[theme]
|
||||
base_color, shadow_color = @text_themes[theme]
|
||||
string_size = self.bitmap.text_size(string)
|
||||
string_width = string_size.width + 1
|
||||
string_height = string_size.height + 1
|
||||
if shadow_color && shadow_color.alpha > 0
|
||||
self.bitmap.font.color = shadow_color
|
||||
self.bitmap.draw_text(text_x - 2, text_y - 2, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x, text_y - 2, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x + 2, text_y - 2, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x - 2, text_y, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x + 2, text_y, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x - 2, text_y + 2, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x, text_y + 2, string_width, string_height, string, 0)
|
||||
self.bitmap.draw_text(text_x + 2, text_y + 2, string_width, string_height, string, 0)
|
||||
end
|
||||
if base_color && base_color.alpha > 0
|
||||
self.bitmap.font.color = base_color
|
||||
self.bitmap.draw_text(text_x, text_y, string_width, string_height, string, 0)
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Replaces def pbDrawPlainText.
|
||||
def draw_plain_text(string, text_x, text_y, theme)
|
||||
return if !@text_themes[theme]
|
||||
base_color = @text_themes[theme][0]
|
||||
return if !base_color || base_color.alpha == 0
|
||||
string_size = self.bitmap.text_size(string)
|
||||
string_width = string_size.width + 1
|
||||
string_height = string_size.height + 1
|
||||
self.bitmap.font.color = base_color
|
||||
self.bitmap.draw_text(text_x, text_y, string_width, string_height, string, 0)
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# TODO: Replaces def pbDrawImagePositions.
|
||||
def draw_image(filename, image_x, image_y, src_x = 0, src_y = 0, src_width = -1, src_height = -1)
|
||||
src_bitmap = AnimatedBitmap.new(pbBitmapName(filename))
|
||||
src_width = (src_width >= 0) ? src_width : src_bitmap.width
|
||||
src_height = (src_height >= 0) ? src_height : src_bitmap.height
|
||||
src_rect = Rect.new(src_x, src_y, src_width, src_height)
|
||||
self.bitmap.blt(image_x, image_y, src_bitmap.bitmap, src_rect)
|
||||
src_bitmap.dispose
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ module UI
|
||||
#=============================================================================
|
||||
# The visuals class.
|
||||
#=============================================================================
|
||||
class BaseUIVisuals
|
||||
GRAPHICS_FOLDER = "Graphics/UI/"
|
||||
BACKGROUND_FILENAME = "bg"
|
||||
BLACK_TEXT_COLOR = Color.new(72, 72, 72)
|
||||
BLACK_TEXT_SHADOW_COLOR = Color.new(160, 160, 160)
|
||||
class BaseVisuals
|
||||
UI_FOLDER = "Graphics/UI/"
|
||||
@@graphics_folder = "" # Subfolder in UI_FOLDER
|
||||
@@background_filename = "bg"
|
||||
@@text_colors = { # These color themes are added to @sprites[:overlay]
|
||||
:default => [Color.new(72, 72, 72), Color.new(160, 160, 160)] # Base and shadow colour
|
||||
}
|
||||
|
||||
def initialize
|
||||
@bitmaps = {}
|
||||
@@ -29,17 +31,18 @@ module UI
|
||||
end
|
||||
|
||||
def initialize_background
|
||||
addBackgroundPlane(@sprites, :background, GRAPHICS_FOLDER + background_filename, @viewport)
|
||||
addBackgroundPlane(@sprites, :background, @@graphics_folder + background_filename, @viewport)
|
||||
@sprites[:background].z = -1000
|
||||
end
|
||||
|
||||
def background_filename
|
||||
return gendered_filename(BACKGROUND_FILENAME)
|
||||
return gendered_filename(@@background_filename)
|
||||
end
|
||||
|
||||
def initialize_overlay
|
||||
@sprites[:overlay] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites[:overlay].z = 1000
|
||||
@@text_colors.each_pair { |key, values| @sprites[:overlay].add_text_theme(key, *values) }
|
||||
pbSetSystemFont(@sprites[:overlay].bitmap)
|
||||
end
|
||||
|
||||
@@ -49,7 +52,7 @@ module UI
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def add_icon_sprite(key, x, y, filename = nil)
|
||||
@sprites[key] = IconSprite.new(x, y, :viewport)
|
||||
@sprites[key] = IconSprite.new(x, y, @viewport)
|
||||
@sprites[key].setBitmap(filename) if filename
|
||||
end
|
||||
|
||||
@@ -73,6 +76,10 @@ module UI
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def graphics_folder
|
||||
return UI_FOLDER + @@graphics_folder
|
||||
end
|
||||
|
||||
def gendered_filename(base_filename)
|
||||
return filename_with_appendix(base_filename, "_f") if $player.female?
|
||||
return base_filename
|
||||
@@ -81,7 +88,7 @@ module UI
|
||||
def filename_with_appendix(base_filename, appendix)
|
||||
if appendix && appendix != ""
|
||||
trial_filename = base_filename + appendix
|
||||
return trial_filename if pbResolveBitmap(GRAPHICS_FOLDER + trial_filename)
|
||||
return trial_filename if pbResolveBitmap(graphics_folder + trial_filename)
|
||||
end
|
||||
return base_filename
|
||||
end
|
||||
@@ -102,13 +109,23 @@ module UI
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def draw_text(string, text_x, text_y, align: :left, theme: :default, outline: :shadow, overlay: :overlay)
|
||||
@sprites[overlay].draw_themed_text(string, text_x, text_y, align, theme, outline)
|
||||
end
|
||||
|
||||
def draw_image(filename, image_x, image_y, src_x = 0, src_y = 0, src_width = -1, src_height = -1, overlay: :overlay)
|
||||
@sprites[overlay].draw_image(filename, image_x, image_y, src_x, src_y, src_width, src_height)
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Redraw everything on the screen.
|
||||
def refresh
|
||||
refresh_overlay
|
||||
end
|
||||
|
||||
def refresh_overlay
|
||||
@sprites[:overlay].bitmap.clear
|
||||
@sprites[:overlay].bitmap.clear if @sprites[:overlay]
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -146,14 +163,15 @@ module UI
|
||||
#=============================================================================
|
||||
# The logic class.
|
||||
#=============================================================================
|
||||
class BaseUIScreen
|
||||
class BaseScreen
|
||||
def initialize
|
||||
@disposed = false
|
||||
initialize_visuals
|
||||
main
|
||||
end
|
||||
|
||||
def initialize_visuals
|
||||
@visuals = UI::BaseUIVisuals.new
|
||||
@visuals = UI::BaseVisuals.new
|
||||
end
|
||||
|
||||
def start_screen
|
||||
@@ -161,8 +179,17 @@ module UI
|
||||
end
|
||||
|
||||
def end_screen
|
||||
return if @disposed
|
||||
@visuals.fade_out
|
||||
@visuals.dispose
|
||||
@disposed = true
|
||||
end
|
||||
|
||||
# Same as def end_screen but without fading out.
|
||||
def silent_end_screen
|
||||
return if @disposed
|
||||
@visuals.dispose
|
||||
@disposed = true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -181,6 +208,10 @@ module UI
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def refresh
|
||||
@visuals.refresh
|
||||
end
|
||||
|
||||
def main
|
||||
start_screen
|
||||
loop do
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
# TODO: This code is incomplete, in that all the MenuHandlers for the pause menu
|
||||
# assume the visuals class has def pbRefresh, def pbEndScene, def
|
||||
# pbHideMenu and def pbShowMenu.
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::PauseMenuVisuals < UI::BaseUIVisuals
|
||||
def initialize
|
||||
@info_state = false
|
||||
# @help_state = false
|
||||
super
|
||||
end
|
||||
|
||||
def initialize_background; end
|
||||
def initialize_overlay; end
|
||||
|
||||
def initialize_sprites
|
||||
# Pause menu
|
||||
@sprites[:commands] = Window_CommandPokemon.new([])
|
||||
@sprites[:commands].visible = false
|
||||
@sprites[:commands].viewport = @viewport
|
||||
# Info text box
|
||||
@sprites[:info_text] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites[:info_text].visible = false
|
||||
# Help text box
|
||||
# @sprites[:help_text] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
# @sprites[:help_text].visible = false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# commands is [[command IDs], [command names]].
|
||||
def set_commands(commands)
|
||||
@commands = commands
|
||||
cmd_window = @sprites[:commands]
|
||||
cmd_window = @commands[1]
|
||||
cmd_window.index = $game_temp.menu_last_choice
|
||||
cmd_window.resizeToFit(@commands)
|
||||
cmd_window.x = Graphics.width - cmd_window.width
|
||||
cmd_window.y = 0
|
||||
cmd_window.visible = true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def show_menu
|
||||
@sprites[:commands].visible = true
|
||||
@sprites[:info_text].visible = @info_state
|
||||
# @sprites[:help_text].visible = @help_state
|
||||
end
|
||||
|
||||
def hide_menu
|
||||
@sprites[:commands].visible = false
|
||||
@sprites[:info_text].visible = false
|
||||
# @sprites[:help_text].visible = false
|
||||
end
|
||||
|
||||
# Used in Safari Zone and Bug-Catching Contest to show extra information.
|
||||
def show_info(text)
|
||||
@sprites[:info_text].resizeToFit(text, Graphics.height)
|
||||
@sprites[:info_text].text = text
|
||||
@sprites[:info_text].visible = true
|
||||
@info_state = true
|
||||
end
|
||||
|
||||
# Unused.
|
||||
# def show_help(text)
|
||||
# @sprites[:help_text].resizeToFit(text, Graphics.height)
|
||||
# @sprites[:help_text].text = text
|
||||
# @sprites[:help_text].visible = true
|
||||
# pbBottomLeft(@sprites[:help_text])
|
||||
# @help_state = true
|
||||
# end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update_visuals
|
||||
pbUpdateSceneMap
|
||||
super
|
||||
end
|
||||
|
||||
def update_input
|
||||
if Input.trigger?(Input::BACK) || Input.trigger?(Input::ACTION)
|
||||
return :quit
|
||||
end
|
||||
if Input.trigger?(Input::USE)
|
||||
idx = @sprites[:commands].index
|
||||
return @commands[0][idx]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::PauseMenuScreen < UI::BaseUIScreen
|
||||
def initialize
|
||||
raise _INTL("Tried to open the pause menu when $player was not defined.") if !$player
|
||||
initialize_commands
|
||||
super
|
||||
end
|
||||
|
||||
def initialize_commands
|
||||
@commands ||= [[], []]
|
||||
@commands.clear
|
||||
@commands_hashes ||= {}
|
||||
@commands_hashes.clear
|
||||
MenuHandlers.each_available(:pause_menu) do |option, hash, name|
|
||||
@commands[0].push(option)
|
||||
@commands[1].push(name)
|
||||
@commands_hashes[option] = hash
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_visuals
|
||||
@visuals = UI::PauseMenuVisuals.new
|
||||
@visuals.set_commands(@commands)
|
||||
end
|
||||
|
||||
def start_screen
|
||||
pbSEPlay("GUI menu open")
|
||||
end
|
||||
|
||||
def end_screen
|
||||
pbPlayCloseMenuSE if !@silent_quit
|
||||
@visuals.dispose
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def perform_action(command)
|
||||
if @commands_hashes[command]["effect"].call(@visuals)
|
||||
@silent_quit = true
|
||||
return :quit
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
@@ -1,129 +1,159 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu_Scene
|
||||
def pbStartScene
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
|
||||
@sprites["cmdwindow"].visible = false
|
||||
@sprites["cmdwindow"].viewport = @viewport
|
||||
@sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites["infowindow"].visible = false
|
||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites["helpwindow"].visible = false
|
||||
@infostate = false
|
||||
@helpstate = false
|
||||
pbSEPlay("GUI menu open")
|
||||
class UI::PauseMenuVisuals < UI::BaseVisuals
|
||||
def initialize
|
||||
@info_text_visible = false
|
||||
# @help_text_visible = false
|
||||
super
|
||||
end
|
||||
|
||||
def pbShowInfo(text)
|
||||
@sprites["infowindow"].resizeToFit(text, Graphics.height)
|
||||
@sprites["infowindow"].text = text
|
||||
@sprites["infowindow"].visible = true
|
||||
@infostate = true
|
||||
def initialize_background; end
|
||||
def initialize_overlay; end
|
||||
|
||||
def initialize_sprites
|
||||
# Pause menu
|
||||
@sprites[:commands] = Window_CommandPokemon.new([])
|
||||
@sprites[:commands].visible = false
|
||||
@sprites[:commands].viewport = @viewport
|
||||
# Info text box
|
||||
@sprites[:info_text] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites[:info_text].visible = false
|
||||
# Help text box
|
||||
# @sprites[:help_text] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
# @sprites[:help_text].visible = false
|
||||
end
|
||||
|
||||
def pbShowHelp(text)
|
||||
@sprites["helpwindow"].resizeToFit(text, Graphics.height)
|
||||
@sprites["helpwindow"].text = text
|
||||
@sprites["helpwindow"].visible = true
|
||||
pbBottomLeft(@sprites["helpwindow"])
|
||||
@helpstate = true
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# commands is [[command IDs], [command names]].
|
||||
def set_commands(commands)
|
||||
@commands = commands
|
||||
cmd_window = @sprites[:commands]
|
||||
cmd_window.commands = @commands[1]
|
||||
cmd_window.index = $game_temp.menu_last_choice
|
||||
cmd_window.resizeToFit(@commands[1])
|
||||
cmd_window.x = Graphics.width - cmd_window.width
|
||||
cmd_window.y = 0
|
||||
cmd_window.visible = true
|
||||
end
|
||||
|
||||
def pbShowMenu
|
||||
@sprites["cmdwindow"].visible = true
|
||||
@sprites["infowindow"].visible = @infostate
|
||||
@sprites["helpwindow"].visible = @helpstate
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def show_menu
|
||||
@sprites[:commands].visible = true
|
||||
@sprites[:info_text].visible = @info_text_visible
|
||||
# @sprites[:help_text].visible = @help_text_visible
|
||||
end
|
||||
|
||||
def pbHideMenu
|
||||
@sprites["cmdwindow"].visible = false
|
||||
@sprites["infowindow"].visible = false
|
||||
@sprites["helpwindow"].visible = false
|
||||
def hide_menu
|
||||
@sprites[:commands].visible = false
|
||||
@sprites[:info_text].visible = false
|
||||
# @sprites[:help_text].visible = false
|
||||
end
|
||||
|
||||
def pbShowCommands(commands)
|
||||
ret = -1
|
||||
cmdwindow = @sprites["cmdwindow"]
|
||||
cmdwindow.commands = commands
|
||||
cmdwindow.index = $game_temp.menu_last_choice
|
||||
cmdwindow.resizeToFit(commands)
|
||||
cmdwindow.x = Graphics.width - cmdwindow.width
|
||||
cmdwindow.y = 0
|
||||
cmdwindow.visible = true
|
||||
loop do
|
||||
cmdwindow.update
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
if Input.trigger?(Input::BACK) || Input.trigger?(Input::ACTION)
|
||||
ret = -1
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
ret = cmdwindow.index
|
||||
$game_temp.menu_last_choice = ret
|
||||
break
|
||||
end
|
||||
# Used in Safari Zone and Bug-Catching Contest to show extra information.
|
||||
def show_info(text)
|
||||
@sprites[:info_text].resizeToFit(text, Graphics.height)
|
||||
@sprites[:info_text].text = text
|
||||
@sprites[:info_text].visible = true
|
||||
@info_text_visible = true
|
||||
end
|
||||
|
||||
# Unused.
|
||||
# def show_help(text)
|
||||
# @sprites[:help_text].resizeToFit(text, Graphics.height)
|
||||
# @sprites[:help_text].text = text
|
||||
# @sprites[:help_text].visible = true
|
||||
# pbBottomLeft(@sprites[:help_text])
|
||||
# @help_text_visible = true
|
||||
# end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update_visuals
|
||||
pbUpdateSceneMap
|
||||
super
|
||||
end
|
||||
|
||||
def update_input
|
||||
if Input.trigger?(Input::BACK) || Input.trigger?(Input::ACTION)
|
||||
return :quit
|
||||
end
|
||||
return ret
|
||||
if Input.trigger?(Input::USE)
|
||||
idx = @sprites[:commands].index
|
||||
$game_temp.menu_last_choice = idx
|
||||
return @commands[0][idx]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def pbEndScene
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbRefresh; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu
|
||||
def initialize(scene)
|
||||
@scene = scene
|
||||
class UI::PauseMenu < UI::BaseScreen
|
||||
def initialize
|
||||
raise _INTL("Tried to open the pause menu when $player was not defined.") if !$player
|
||||
initialize_commands
|
||||
super
|
||||
end
|
||||
|
||||
def pbShowMenu
|
||||
@scene.pbRefresh
|
||||
@scene.pbShowMenu
|
||||
end
|
||||
|
||||
def pbShowInfo; end
|
||||
|
||||
def pbStartPokemonMenu
|
||||
if !$player
|
||||
if $DEBUG
|
||||
pbMessage(_INTL("The player trainer was not defined, so the pause menu can't be displayed."))
|
||||
pbMessage(_INTL("Please see the documentation to learn how to set up the trainer player."))
|
||||
end
|
||||
return
|
||||
end
|
||||
@scene.pbStartScene
|
||||
# Show extra info window if relevant
|
||||
pbShowInfo
|
||||
# Get all commands
|
||||
command_list = []
|
||||
commands = []
|
||||
def initialize_commands
|
||||
@commands ||= [[], []]
|
||||
@commands[0].clear
|
||||
@commands[1].clear
|
||||
@commands_hashes ||= {}
|
||||
@commands_hashes.clear
|
||||
MenuHandlers.each_available(:pause_menu) do |option, hash, name|
|
||||
command_list.push(name)
|
||||
commands.push(hash)
|
||||
@commands[0].push(option)
|
||||
@commands[1].push(name)
|
||||
@commands_hashes[option] = hash
|
||||
end
|
||||
# Main loop
|
||||
end_scene = false
|
||||
loop do
|
||||
choice = @scene.pbShowCommands(command_list)
|
||||
if choice < 0
|
||||
pbPlayCloseMenuSE
|
||||
end_scene = true
|
||||
break
|
||||
end
|
||||
break if commands[choice]["effect"].call(@scene)
|
||||
end
|
||||
|
||||
def initialize_visuals
|
||||
@visuals = UI::PauseMenuVisuals.new
|
||||
@visuals.set_commands(@commands)
|
||||
show_info
|
||||
end
|
||||
|
||||
def hide_menu
|
||||
@visuals.hide_menu
|
||||
end
|
||||
|
||||
def show_menu
|
||||
@visuals.show_menu
|
||||
end
|
||||
|
||||
def show_info; end
|
||||
|
||||
def start_screen
|
||||
pbSEPlay("GUI menu open")
|
||||
end
|
||||
|
||||
def end_screen
|
||||
return if @disposed
|
||||
pbPlayCloseMenuSE
|
||||
silent_end_screen
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def refresh
|
||||
initialize_commands
|
||||
@visuals.set_commands(@commands)
|
||||
super
|
||||
end
|
||||
|
||||
def perform_action(command)
|
||||
if @commands_hashes[command]["effect"].call(self)
|
||||
# NOTE: Calling end_screen will have been done in the "effect" proc, so
|
||||
# there's no need to do anything special here to mark that this
|
||||
# screen has already been closed/disposed of.
|
||||
return :quit
|
||||
end
|
||||
@scene.pbEndScene if end_scene
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -142,7 +172,7 @@ MenuHandlers.add(:pause_menu, :pokedex, {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
screen = PokemonPokedexScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
menu.refresh
|
||||
end
|
||||
elsif $player.pokedex.accessible_dexes.length == 1
|
||||
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0]
|
||||
@@ -150,14 +180,14 @@ MenuHandlers.add(:pause_menu, :pokedex, {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
screen = PokemonPokedexScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
menu.refresh
|
||||
end
|
||||
else
|
||||
pbFadeOutIn do
|
||||
scene = PokemonPokedexMenu_Scene.new
|
||||
screen = PokemonPokedexMenuScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
menu.refresh
|
||||
end
|
||||
end
|
||||
next false
|
||||
@@ -175,7 +205,7 @@ MenuHandlers.add(:pause_menu, :party, {
|
||||
sscene = PokemonParty_Scene.new
|
||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
||||
hidden_move = sscreen.pbPokemonScreen
|
||||
(hidden_move) ? menu.pbEndScene : menu.pbRefresh
|
||||
(hidden_move) ? menu.silent_end_screen : menu.refresh
|
||||
end
|
||||
next false if !hidden_move
|
||||
$game_temp.in_menu = false
|
||||
@@ -195,7 +225,7 @@ MenuHandlers.add(:pause_menu, :bag, {
|
||||
scene = PokemonBag_Scene.new
|
||||
screen = PokemonBagScreen.new(scene, $bag)
|
||||
item = screen.pbStartScreen
|
||||
(item) ? menu.pbEndScene : menu.pbRefresh
|
||||
(item) ? menu.silent_end_screen : menu.refresh
|
||||
end
|
||||
next false if !item
|
||||
$game_temp.in_menu = false
|
||||
@@ -214,7 +244,7 @@ MenuHandlers.add(:pause_menu, :pokegear, {
|
||||
scene = PokemonPokegear_Scene.new
|
||||
screen = PokemonPokegearScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
($game_temp.fly_destination) ? menu.pbEndScene : menu.pbRefresh
|
||||
($game_temp.fly_destination) ? menu.silent_end_screen : menu.refresh
|
||||
end
|
||||
next pbFlyToNewLocation
|
||||
}
|
||||
@@ -231,7 +261,7 @@ MenuHandlers.add(:pause_menu, :town_map, {
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
$game_temp.fly_destination = ret if ret
|
||||
($game_temp.fly_destination) ? menu.pbEndScene : menu.pbRefresh
|
||||
($game_temp.fly_destination) ? menu.silent_end_screen : menu.refresh
|
||||
end
|
||||
next pbFlyToNewLocation
|
||||
}
|
||||
@@ -243,10 +273,8 @@ MenuHandlers.add(:pause_menu, :trainer_card, {
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn do
|
||||
scene = PokemonTrainerCard_Scene.new
|
||||
screen = PokemonTrainerCardScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
UI::TrainerCard.new
|
||||
menu.refresh
|
||||
end
|
||||
next false
|
||||
}
|
||||
@@ -259,15 +287,15 @@ MenuHandlers.add(:pause_menu, :save, {
|
||||
next $game_system && !$game_system.save_disabled && !pbInSafari? && !pbInBugContest?
|
||||
},
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
menu.hide_menu
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
if screen.pbSaveScreen
|
||||
menu.pbEndScene
|
||||
menu.silent_end_screen
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
menu.refresh
|
||||
menu.show_menu
|
||||
next false
|
||||
}
|
||||
})
|
||||
@@ -282,7 +310,7 @@ MenuHandlers.add(:pause_menu, :options, {
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
pbUpdateSceneMap
|
||||
menu.pbRefresh
|
||||
menu.refresh
|
||||
end
|
||||
next false
|
||||
}
|
||||
@@ -296,7 +324,7 @@ MenuHandlers.add(:pause_menu, :debug, {
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn do
|
||||
pbDebugMenu
|
||||
menu.pbRefresh
|
||||
menu.refresh
|
||||
end
|
||||
next false
|
||||
}
|
||||
@@ -306,17 +334,17 @@ MenuHandlers.add(:pause_menu, :quit_game, {
|
||||
"name" => _INTL("Quit Game"),
|
||||
"order" => 90,
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
menu.hide_menu
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to quit the game?"))
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
screen.pbSaveScreen
|
||||
menu.pbEndScene
|
||||
menu.silent_end_screen
|
||||
$scene = nil
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
menu.refresh
|
||||
menu.show_info
|
||||
next false
|
||||
}
|
||||
})
|
||||
@@ -1,126 +0,0 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::TrainerCardVisuals < UI::BaseUIVisuals
|
||||
GRAPHICS_FOLDER = "Graphics/UI/Trainer Card/"
|
||||
BADGE_SIZE = [32, 32] # [width, height] of a Gym Badge
|
||||
BADGE_SPACING = 16 # Size of gap between adjacent Gym Badges
|
||||
FIRST_BADGE_X = 72 # Left edge of the first Gym Badge
|
||||
FIRST_BADGE_Y = 310 # Top edge of the first Gym Badge
|
||||
BADGE_COUNT = 8 # Number of Gym Badges to show
|
||||
|
||||
def initialize_sprites
|
||||
# Trainer card
|
||||
add_icon_sprite(:card, 0, 0, GRAPHICS_FOLDER + gendered_filename(_INTL("trainer_card")))
|
||||
# Player sprite (coordinates are the bottom middle of the sprite)
|
||||
add_icon_sprite(:player, 400, 240, GameData::TrainerType.player_front_sprite_filename($player.trainer_type))
|
||||
if !@sprites[:player].bitmap
|
||||
raise _INTL("No trainer front sprite exists for the player character, expected a file at {1}.",
|
||||
"Graphics/Trainers/" + $player.trainer_type.to_s + ".png")
|
||||
end
|
||||
@sprites[:player].x -= @sprites[:player].bitmap.width / 2
|
||||
@sprites[:player].y -= @sprites[:player].bitmap.height
|
||||
@sprites[:player].z = 10
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def refresh_overlay
|
||||
super
|
||||
overlay = @sprites[:overlay].bitmap
|
||||
draw_ID(overlay)
|
||||
draw_stats(overlay)
|
||||
draw_badges(overlay)
|
||||
end
|
||||
|
||||
# Draws the player's name and ID number onto the overlay.
|
||||
def draw_ID(overlay)
|
||||
pbDrawTextPositions(overlay, [
|
||||
[_INTL("Name"), 34, 70, :left, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[$player.name, 302, 70, :right, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[_INTL("ID No."), 332, 70, :left, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[sprintf("%05d", $player.public_ID), 468, 70, :right, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR]
|
||||
])
|
||||
end
|
||||
|
||||
# Draws the player's money, Pokédex numbers, play time and start date onto the
|
||||
# overlay.
|
||||
def draw_stats(overlay)
|
||||
# Create money text
|
||||
money_text = _INTL("${1}", $player.money.to_s_formatted)
|
||||
# Create Pokédex stats text
|
||||
pokedex_text = sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count)
|
||||
# Create play time text
|
||||
total_secs = $stats.play_time.to_i
|
||||
hour = (total_secs / 60) / 60
|
||||
min = (total_secs / 60) % 60
|
||||
play_time = (hour > 0) ? _INTL("{1}h {2}m", hour, min) : _INTL("{1}m", min)
|
||||
# Create start date text
|
||||
$PokemonGlobal.startTime = Time.now if !$PokemonGlobal.startTime
|
||||
# TODO: Put this date the proper way round for non-United States of Americans.
|
||||
start_date = _INTL("{1} {2}, {3}",
|
||||
pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
|
||||
$PokemonGlobal.startTime.day,
|
||||
$PokemonGlobal.startTime.year)
|
||||
# Draw text
|
||||
pbDrawTextPositions(overlay, [
|
||||
[_INTL("Money"), 34, 118, :left, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[money_text, 302, 118, :right, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[_INTL("Pokédex"), 34, 166, :left, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[pokedex_text, 302, 166, :right, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[_INTL("Time"), 34, 214, :left, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[play_time, 302, 214, :right, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[_INTL("Started"), 34, 262, :left, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR],
|
||||
[start_date, 302, 262, :right, BLACK_TEXT_COLOR, BLACK_TEXT_SHADOW_COLOR]
|
||||
])
|
||||
end
|
||||
|
||||
# Draws the player's owned Gym Badges onto the overlay.
|
||||
def draw_badges(overlay)
|
||||
x = FIRST_BADGE_X
|
||||
region = pbGetCurrentRegion(0) # Get the current region
|
||||
BADGE_COUNT.times do |i|
|
||||
if $player.badges[i + (region * BADGE_COUNT)]
|
||||
pbDrawImagePositions(overlay, [
|
||||
[GRAPHICS_FOLDER + "icon_badges", x, FIRST_BADGE_Y, i * BADGE_SIZE[0], region * BADGE_SIZE[1], *BADGE_SIZE]
|
||||
])
|
||||
end
|
||||
x += BADGE_SIZE[0] + BADGE_SPACING
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::TrainerCardScreen < UI::BaseUIScreen
|
||||
def initialize_visuals
|
||||
@visuals = UI::TrainerCardVisuals.new
|
||||
end
|
||||
|
||||
def start_screen
|
||||
super
|
||||
pbSEPlay("GUI trainer card open")
|
||||
end
|
||||
|
||||
def end_screen
|
||||
pbPlayCloseMenuSE
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
MenuHandlers.add(:pause_menu, :new_trainer_card, {
|
||||
"name" => proc { next "New Trainer Card" },
|
||||
"order" => 55,
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn do
|
||||
UI::TrainerCardScreen.new
|
||||
menu.pbRefresh
|
||||
end
|
||||
next false
|
||||
}
|
||||
})
|
||||
104
Data/Scripts/016b_UI redesign/012_UI_TrainerCard.rb
Normal file
104
Data/Scripts/016b_UI redesign/012_UI_TrainerCard.rb
Normal file
@@ -0,0 +1,104 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::TrainerCardVisuals < UI::BaseVisuals
|
||||
@@graphics_folder = "Trainer Card/" # Subfolder in Graphics/UI
|
||||
BADGE_SIZE = [32, 32] # [width, height] of a Gym Badge
|
||||
BADGE_SPACING = 16 # Size of gap between adjacent Gym Badges
|
||||
FIRST_BADGE_X = 72 # Left edge of the first Gym Badge
|
||||
FIRST_BADGE_Y = 310 # Top edge of the first Gym Badge
|
||||
BADGE_COUNT = 8 # Number of Gym Badges to show
|
||||
|
||||
def initialize_sprites
|
||||
# Trainer card
|
||||
add_icon_sprite(:card, 0, 0, graphics_folder + gendered_filename(_INTL("trainer_card")))
|
||||
# Player sprite (coordinates are the bottom middle of the sprite)
|
||||
add_icon_sprite(:player, 400, 240, GameData::TrainerType.player_front_sprite_filename($player.trainer_type))
|
||||
if !@sprites[:player].bitmap
|
||||
raise _INTL("No trainer front sprite exists for the player character, expected a file at {1}.",
|
||||
"Graphics/Trainers/" + $player.trainer_type.to_s + ".png")
|
||||
end
|
||||
@sprites[:player].x -= @sprites[:player].bitmap.width / 2
|
||||
@sprites[:player].y -= @sprites[:player].bitmap.height
|
||||
@sprites[:player].z = 10
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def refresh_overlay
|
||||
super
|
||||
draw_ID
|
||||
draw_stats
|
||||
draw_badges
|
||||
end
|
||||
|
||||
# Draws the player's name and ID number onto the overlay.
|
||||
def draw_ID
|
||||
draw_text(_INTL("Name"), 34, 70)
|
||||
draw_text($player.name, 302, 70, align: :right)
|
||||
draw_text(_INTL("ID No."), 332, 70)
|
||||
draw_text(sprintf("%05d", $player.public_ID), 468, 70, align: :right)
|
||||
end
|
||||
|
||||
# Draws the player's money, Pokédex numbers, play time and start date onto the
|
||||
# overlay.
|
||||
def draw_stats
|
||||
# Create money text
|
||||
money_text = _INTL("${1}", $player.money.to_s_formatted)
|
||||
# Create Pokédex stats text
|
||||
pokedex_text = sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count)
|
||||
# Create play time text
|
||||
total_secs = $stats.play_time.to_i
|
||||
hour = (total_secs / 60) / 60
|
||||
min = (total_secs / 60) % 60
|
||||
play_time_text = (hour > 0) ? _INTL("{1}h {2}m", hour, min) : _INTL("{1}m", min)
|
||||
# Create start date text
|
||||
$PokemonGlobal.startTime = Time.now if !$PokemonGlobal.startTime
|
||||
# TODO: Put this date the proper way round for non-United States of Americans.
|
||||
start_date_text = _INTL("{1} {2}, {3}",
|
||||
pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
|
||||
$PokemonGlobal.startTime.day,
|
||||
$PokemonGlobal.startTime.year)
|
||||
# Draw text
|
||||
draw_text(_INTL("Money"), 34, 118)
|
||||
draw_text(money_text, 302, 118, align: :right)
|
||||
draw_text(_INTL("Pokédex"), 34, 166)
|
||||
draw_text(pokedex_text, 302, 166, align: :right)
|
||||
draw_text(_INTL("Time"), 34, 214)
|
||||
draw_text(play_time_text, 302, 214, align: :right)
|
||||
draw_text(_INTL("Started"), 34, 262)
|
||||
draw_text(start_date_text, 302, 262, align: :right)
|
||||
end
|
||||
|
||||
# Draws the player's owned Gym Badges onto the overlay.
|
||||
def draw_badges
|
||||
x = FIRST_BADGE_X
|
||||
region = pbGetCurrentRegion(0) # Get the current region
|
||||
BADGE_COUNT.times do |i|
|
||||
if $player.badges[i + (region * BADGE_COUNT)]
|
||||
draw_image(graphics_folder + "icon_badges", x, FIRST_BADGE_Y,
|
||||
i * BADGE_SIZE[0], region * BADGE_SIZE[1], *BADGE_SIZE)
|
||||
end
|
||||
x += BADGE_SIZE[0] + BADGE_SPACING
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::TrainerCard < UI::BaseScreen
|
||||
def initialize_visuals
|
||||
@visuals = UI::TrainerCardVisuals.new
|
||||
end
|
||||
|
||||
def start_screen
|
||||
super
|
||||
pbSEPlay("GUI trainer card open")
|
||||
end
|
||||
|
||||
def end_screen
|
||||
pbPlayCloseMenuSE
|
||||
super
|
||||
end
|
||||
end
|
||||
130
Data/Scripts/016c_UI_old/001_UI_old_PauseMenu.rb
Normal file
130
Data/Scripts/016c_UI_old/001_UI_old_PauseMenu.rb
Normal file
@@ -0,0 +1,130 @@
|
||||
=begin
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu_Scene
|
||||
def pbStartScene
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
|
||||
@sprites["cmdwindow"].visible = false
|
||||
@sprites["cmdwindow"].viewport = @viewport
|
||||
@sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites["infowindow"].visible = false
|
||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites["helpwindow"].visible = false
|
||||
@infostate = false
|
||||
@helpstate = false
|
||||
pbSEPlay("GUI menu open")
|
||||
end
|
||||
|
||||
def pbShowInfo(text)
|
||||
@sprites["infowindow"].resizeToFit(text, Graphics.height)
|
||||
@sprites["infowindow"].text = text
|
||||
@sprites["infowindow"].visible = true
|
||||
@infostate = true
|
||||
end
|
||||
|
||||
def pbShowHelp(text)
|
||||
@sprites["helpwindow"].resizeToFit(text, Graphics.height)
|
||||
@sprites["helpwindow"].text = text
|
||||
@sprites["helpwindow"].visible = true
|
||||
pbBottomLeft(@sprites["helpwindow"])
|
||||
@helpstate = true
|
||||
end
|
||||
|
||||
def pbShowMenu
|
||||
@sprites["cmdwindow"].visible = true
|
||||
@sprites["infowindow"].visible = @infostate
|
||||
@sprites["helpwindow"].visible = @helpstate
|
||||
end
|
||||
|
||||
def pbHideMenu
|
||||
@sprites["cmdwindow"].visible = false
|
||||
@sprites["infowindow"].visible = false
|
||||
@sprites["helpwindow"].visible = false
|
||||
end
|
||||
|
||||
def pbShowCommands(commands)
|
||||
ret = -1
|
||||
cmdwindow = @sprites["cmdwindow"]
|
||||
cmdwindow.commands = commands
|
||||
cmdwindow.index = $game_temp.menu_last_choice
|
||||
cmdwindow.resizeToFit(commands)
|
||||
cmdwindow.x = Graphics.width - cmdwindow.width
|
||||
cmdwindow.y = 0
|
||||
cmdwindow.visible = true
|
||||
loop do
|
||||
cmdwindow.update
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
if Input.trigger?(Input::BACK) || Input.trigger?(Input::ACTION)
|
||||
ret = -1
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
ret = cmdwindow.index
|
||||
$game_temp.menu_last_choice = ret
|
||||
break
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbEndScene
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbRefresh; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu
|
||||
def initialize(scene)
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbShowMenu
|
||||
@scene.pbRefresh
|
||||
@scene.pbShowMenu
|
||||
end
|
||||
|
||||
def pbShowInfo; end
|
||||
|
||||
def pbStartPokemonMenu
|
||||
if !$player
|
||||
if $DEBUG
|
||||
pbMessage(_INTL("The player trainer was not defined, so the pause menu can't be displayed."))
|
||||
pbMessage(_INTL("Please see the documentation to learn how to set up the trainer player."))
|
||||
end
|
||||
return
|
||||
end
|
||||
@scene.pbStartScene
|
||||
# Show extra info window if relevant
|
||||
pbShowInfo
|
||||
# Get all commands
|
||||
command_list = []
|
||||
commands = []
|
||||
MenuHandlers.each_available(:pause_menu) do |option, hash, name|
|
||||
command_list.push(name)
|
||||
commands.push(hash)
|
||||
end
|
||||
# Main loop
|
||||
end_scene = false
|
||||
loop do
|
||||
choice = @scene.pbShowCommands(command_list)
|
||||
if choice < 0
|
||||
pbPlayCloseMenuSE
|
||||
end_scene = true
|
||||
break
|
||||
end
|
||||
break if commands[choice]["effect"].call(@scene)
|
||||
end
|
||||
@scene.pbEndScene if end_scene
|
||||
end
|
||||
end
|
||||
=end
|
||||
@@ -1,3 +1,4 @@
|
||||
=begin
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -113,3 +114,4 @@ class PokemonTrainerCardScreen
|
||||
@scene.pbEndScene
|
||||
end
|
||||
end
|
||||
=end
|
||||
@@ -164,21 +164,36 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu
|
||||
alias __safari_pbShowInfo pbShowInfo unless method_defined?(:__safari_pbShowInfo)
|
||||
class UI::PauseMenu < UI::BaseScreen
|
||||
alias __safari_show_info show_info unless method_defined?(:__safari_show_info)
|
||||
|
||||
def pbShowInfo
|
||||
__safari_pbShowInfo
|
||||
def show_info
|
||||
__safari_show_info
|
||||
return if !pbInSafari?
|
||||
if Settings::SAFARI_STEPS <= 0
|
||||
@scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
|
||||
@visuals.show_info(_INTL("Balls: {1}", pbSafariState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
|
||||
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
|
||||
@visuals.show_info(_INTL("Steps: {1}/{2}\nBalls: {3}",
|
||||
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# class PokemonPauseMenu
|
||||
# alias __safari_pbShowInfo pbShowInfo unless method_defined?(:__safari_pbShowInfo)
|
||||
#
|
||||
# def pbShowInfo
|
||||
# __safari_pbShowInfo
|
||||
# return if !pbInSafari?
|
||||
# if Settings::SAFARI_STEPS <= 0
|
||||
# @scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
|
||||
# else
|
||||
# @scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
|
||||
# pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -188,15 +203,15 @@ MenuHandlers.add(:pause_menu, :quit_safari_game, {
|
||||
"order" => 60,
|
||||
"condition" => proc { next pbInSafari? },
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
menu.hide_menu
|
||||
if pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
|
||||
menu.pbEndScene
|
||||
menu.silent_end_screen
|
||||
pbSafariState.decision = 1
|
||||
pbSafariState.pbGoToStart
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
menu.refresh
|
||||
menu.show_menu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -408,23 +408,40 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu
|
||||
alias __bug_contest_pbShowInfo pbShowInfo unless method_defined?(:__bug_contest_pbShowInfo)
|
||||
class UI::PauseMenu < UI::BaseScreen
|
||||
alias __bug_contest_show_info show_info unless method_defined?(:__bug_contest_show_info)
|
||||
|
||||
def pbShowInfo
|
||||
__bug_contest_pbShowInfo
|
||||
def show_info
|
||||
__bug_contest_show_info
|
||||
return if !pbInBugContest?
|
||||
if pbBugContestState.lastPokemon
|
||||
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
|
||||
pbBugContestState.lastPokemon.speciesName,
|
||||
pbBugContestState.lastPokemon.level,
|
||||
pbBugContestState.ballcount))
|
||||
@visuals.show_info(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
|
||||
pbBugContestState.lastPokemon.speciesName,
|
||||
pbBugContestState.lastPokemon.level,
|
||||
pbBugContestState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
|
||||
@visuals.show_info(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# class PokemonPauseMenu
|
||||
# alias __bug_contest_pbShowInfo pbShowInfo unless method_defined?(:__bug_contest_pbShowInfo)
|
||||
#
|
||||
# def pbShowInfo
|
||||
# __bug_contest_pbShowInfo
|
||||
# return if !pbInBugContest?
|
||||
# if pbBugContestState.lastPokemon
|
||||
# @scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
|
||||
# pbBugContestState.lastPokemon.speciesName,
|
||||
# pbBugContestState.lastPokemon.level,
|
||||
# pbBugContestState.ballcount))
|
||||
# else
|
||||
# @scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -434,14 +451,14 @@ MenuHandlers.add(:pause_menu, :quit_bug_contest, {
|
||||
"order" => 60,
|
||||
"condition" => proc { next pbInBugContest? },
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
menu.hide_menu
|
||||
if pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
|
||||
menu.pbEndScene
|
||||
menu.silent_end_screen
|
||||
pbBugContestState.pbStartJudging
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
menu.refresh
|
||||
menu.show_menu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user