Fixed and implemented new pause menu and Trainer Card scripts

This commit is contained in:
Maruno17
2024-08-22 22:26:57 +01:00
parent f4358e1542
commit 2c6fe70f0c
11 changed files with 587 additions and 430 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,350 @@
#===============================================================================
#
#===============================================================================
class UI::PauseMenuVisuals < UI::BaseVisuals
def initialize
@info_text_visible = false
# @help_text_visible = 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 = @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 show_menu
@sprites[:commands].visible = true
@sprites[:info_text].visible = @info_text_visible
# @sprites[:help_text].visible = @help_text_visible
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_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
if Input.trigger?(Input::USE)
idx = @sprites[:commands].index
$game_temp.menu_last_choice = idx
return @commands[0][idx]
end
return nil
end
end
#===============================================================================
#
#===============================================================================
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 initialize_commands
@commands ||= [[], []]
@commands[0].clear
@commands[1].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)
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
return nil
end
end
#===============================================================================
# Pause menu commands.
#===============================================================================
MenuHandlers.add(:pause_menu, :pokedex, {
"name" => _INTL("Pokédex"),
"order" => 10,
"condition" => proc { next $player.has_pokedex && $player.pokedex.accessible_dexes.length > 0 },
"effect" => proc { |menu|
pbPlayDecisionSE
if Settings::USE_CURRENT_REGION_DEX
pbFadeOutIn do
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)
screen.pbStartScreen
menu.refresh
end
elsif $player.pokedex.accessible_dexes.length == 1
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0]
pbFadeOutIn do
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)
screen.pbStartScreen
menu.refresh
end
else
pbFadeOutIn do
scene = PokemonPokedexMenu_Scene.new
screen = PokemonPokedexMenuScreen.new(scene)
screen.pbStartScreen
menu.refresh
end
end
next false
}
})
MenuHandlers.add(:pause_menu, :party, {
"name" => _INTL("Pokémon"),
"order" => 20,
"condition" => proc { next $player.party_count > 0 },
"effect" => proc { |menu|
pbPlayDecisionSE
hidden_move = nil
pbFadeOutIn do
sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene, $player.party)
hidden_move = sscreen.pbPokemonScreen
(hidden_move) ? menu.silent_end_screen : menu.refresh
end
next false if !hidden_move
$game_temp.in_menu = false
pbUseHiddenMove(hidden_move[0], hidden_move[1])
next true
}
})
MenuHandlers.add(:pause_menu, :bag, {
"name" => _INTL("Bag"),
"order" => 30,
"condition" => proc { next !pbInBugContest? },
"effect" => proc { |menu|
pbPlayDecisionSE
item = nil
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
item = screen.pbStartScreen
(item) ? menu.silent_end_screen : menu.refresh
end
next false if !item
$game_temp.in_menu = false
pbUseKeyItemInField(item)
next true
}
})
MenuHandlers.add(:pause_menu, :pokegear, {
"name" => _INTL("Pokégear"),
"order" => 40,
"condition" => proc { next $player.has_pokegear },
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn do
scene = PokemonPokegear_Scene.new
screen = PokemonPokegearScreen.new(scene)
screen.pbStartScreen
($game_temp.fly_destination) ? menu.silent_end_screen : menu.refresh
end
next pbFlyToNewLocation
}
})
MenuHandlers.add(:pause_menu, :town_map, {
"name" => _INTL("Town Map"),
"order" => 40,
"condition" => proc { next !$player.has_pokegear && $bag.has?(:TOWNMAP) },
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn do
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$game_temp.fly_destination = ret if ret
($game_temp.fly_destination) ? menu.silent_end_screen : menu.refresh
end
next pbFlyToNewLocation
}
})
MenuHandlers.add(:pause_menu, :trainer_card, {
"name" => proc { next $player.name },
"order" => 50,
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn do
UI::TrainerCard.new
menu.refresh
end
next false
}
})
MenuHandlers.add(:pause_menu, :save, {
"name" => _INTL("Save"),
"order" => 60,
"condition" => proc {
next $game_system && !$game_system.save_disabled && !pbInSafari? && !pbInBugContest?
},
"effect" => proc { |menu|
menu.hide_menu
scene = PokemonSave_Scene.new
screen = PokemonSaveScreen.new(scene)
if screen.pbSaveScreen
menu.silent_end_screen
next true
end
menu.refresh
menu.show_menu
next false
}
})
MenuHandlers.add(:pause_menu, :options, {
"name" => _INTL("Options"),
"order" => 70,
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn do
scene = PokemonOption_Scene.new
screen = PokemonOptionScreen.new(scene)
screen.pbStartScreen
pbUpdateSceneMap
menu.refresh
end
next false
}
})
MenuHandlers.add(:pause_menu, :debug, {
"name" => _INTL("Debug"),
"order" => 80,
"condition" => proc { next $DEBUG },
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn do
pbDebugMenu
menu.refresh
end
next false
}
})
MenuHandlers.add(:pause_menu, :quit_game, {
"name" => _INTL("Quit Game"),
"order" => 90,
"effect" => proc { |menu|
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.silent_end_screen
$scene = nil
next true
end
menu.refresh
menu.show_info
next false
}
})

View File

@@ -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
}
})

View 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