mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 21:54:58 +00:00
Rewrote summary screen code
This commit is contained in:
@@ -465,9 +465,8 @@ class Battle::Scene
|
||||
def pbForgetMove(pkmn, moveToLearn)
|
||||
ret = -1
|
||||
pbFadeOutIn do
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
|
||||
screen = UI::PokemonSummary.new([pkmn], 0, mode: :choose_move, new_move: moveToLearn)
|
||||
ret = screen.result
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -63,9 +63,7 @@ module Battle::CatchAndStoreMixin
|
||||
break
|
||||
when 2 # See X's summary
|
||||
pbFadeOutIn do
|
||||
summary_scene = PokemonSummary_Scene.new
|
||||
summary_screen = PokemonSummaryScreen.new(summary_scene, true)
|
||||
summary_screen.pbStartScreen([pkmn], 0)
|
||||
screen = UI::PokemonSummary.new(pkmn, mode: :in_battle)
|
||||
end
|
||||
when 3 # Check party
|
||||
@scene.pbPartyScreen(0, true, 2)
|
||||
|
||||
@@ -632,9 +632,8 @@ end
|
||||
def pbForgetMove(pkmn, moveToLearn)
|
||||
ret = -1
|
||||
pbFadeOutIn do
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
|
||||
screen = UI::PokemonSummary.new([pkmn], 0, mode: :choose_move, new_move: moveToLearn)
|
||||
ret = screen.result
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -702,9 +702,7 @@ class PokemonParty_Scene
|
||||
|
||||
def pbSummary(pkmnid, inbattle = false)
|
||||
oldsprites = pbFadeOutAndHide(@sprites)
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene, inbattle)
|
||||
screen.pbStartScreen(@party, pkmnid)
|
||||
UI::PokemonSummary.new(@party, pkmnid)
|
||||
yield if block_given?
|
||||
pbRefresh
|
||||
pbFadeInAndShow(@sprites, oldsprites)
|
||||
|
||||
@@ -1246,16 +1246,16 @@ class PokemonStorageScene
|
||||
|
||||
def pbSummary(selected, heldpoke)
|
||||
oldsprites = pbFadeOutAndHide(@sprites)
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
if heldpoke
|
||||
screen.pbStartScreen([heldpoke], 0)
|
||||
UI::PokemonSummary.new(heldpoke)
|
||||
elsif selected[0] == -1
|
||||
@selection = screen.pbStartScreen(@storage.party, selected[1])
|
||||
screen = UI::PokemonSummary.new(@storage.party, selected[1])
|
||||
@selection = screen.result
|
||||
pbPartySetArrow(@sprites["arrow"], @selection)
|
||||
pbUpdateOverlay(@selection, @storage.party)
|
||||
else
|
||||
@selection = screen.pbStartScreen(@storage.boxes[selected[0]], selected[1])
|
||||
screen = UI::PokemonSummary.new(@storage.boxes[selected[0]], selected[1])
|
||||
@selection = screen.result
|
||||
pbSetArrow(@sprites["arrow"], @selection)
|
||||
pbUpdateOverlay(@selection)
|
||||
end
|
||||
|
||||
@@ -95,7 +95,7 @@ class MoveRelearner_Scene
|
||||
textpos.push([accuracy == 0 ? "---" : "#{accuracy}%", 468, 184, :center,
|
||||
Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
imagepos.push(["Graphics/UI/category", 436, 116, 0, category * CATEGORY_ICON_SIZE[1], *CATEGORY_ICON_SIZE])
|
||||
imagepos.push(["Graphics/UI/category", 436, 116, 0, category * GameData::Move::CATEGORY_ICON_SIZE[1], *GameData::Move::CATEGORY_ICON_SIZE])
|
||||
if @sprites["commands"].index < @moves.length - 1
|
||||
imagepos.push(["Graphics/UI/Move Reminder/buttons", 48, 350, 0, 0, 76, 32])
|
||||
end
|
||||
|
||||
@@ -1232,9 +1232,7 @@ class PurifyChamberScene
|
||||
def pbSummary(pos, heldpkmn)
|
||||
if heldpkmn
|
||||
oldsprites = pbFadeOutAndHide(@sprites)
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
screen.pbStartScreen([heldpkmn], 0)
|
||||
UI::PokemonSummary.new(heldpkmn)
|
||||
pbFadeInAndShow(@sprites, oldsprites)
|
||||
return
|
||||
end
|
||||
@@ -1251,9 +1249,8 @@ class PurifyChamberScene
|
||||
end
|
||||
return if party.length == 0
|
||||
oldsprites = pbFadeOutAndHide(@sprites)
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
selection = screen.pbStartScreen(party, startindex)
|
||||
screen = UI::PokemonSummary.new(party, startindex)
|
||||
selection = screen.result
|
||||
@sprites["setview"].cursor = indexes[selection]
|
||||
pbFadeInAndShow(@sprites, oldsprites)
|
||||
end
|
||||
|
||||
@@ -3,11 +3,11 @@ module UI
|
||||
# The visuals class.
|
||||
#=============================================================================
|
||||
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
|
||||
UI_FOLDER = "Graphics/UI/"
|
||||
GRAPHICS_FOLDER = "" # Subfolder in UI_FOLDER
|
||||
BACKGROUND_FILENAME = "bg"
|
||||
TEXT_COLOR_THEMES = { # These color themes are added to @sprites[:overlay]
|
||||
:default => [Color.new(72, 172, 72), Color.new(160, 160, 160)] # Base and shadow colour
|
||||
}
|
||||
|
||||
def initialize
|
||||
@@ -17,7 +17,8 @@ module UI
|
||||
initialize_bitmaps
|
||||
initialize_background
|
||||
initialize_overlay
|
||||
# TODO: Initialize message box (and dialogue box?) for messages to use.
|
||||
initialize_message_box
|
||||
# TODO: Initialize dialogue box for messages to use?
|
||||
initialize_sprites
|
||||
refresh
|
||||
end
|
||||
@@ -31,19 +32,21 @@ module UI
|
||||
end
|
||||
|
||||
def initialize_background
|
||||
addBackgroundPlane(@sprites, :background, @@graphics_folder + background_filename, @viewport)
|
||||
addBackgroundPlane(@sprites, :background, self.class::GRAPHICS_FOLDER + background_filename, @viewport)
|
||||
@sprites[:background].z = -1000
|
||||
end
|
||||
|
||||
def background_filename
|
||||
return gendered_filename(@@background_filename)
|
||||
def initialize_overlay
|
||||
add_overlay(:overlay)
|
||||
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)
|
||||
def initialize_message_box
|
||||
@sprites[:message_box] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites[:message_box].viewport = @viewport
|
||||
@sprites[:message_box].z = 2000
|
||||
@sprites[:message_box].visible = false
|
||||
@sprites[:message_box].letterbyletter = true
|
||||
pbBottomLeftLines(@sprites[:message_box], 2)
|
||||
end
|
||||
|
||||
def initialize_sprites
|
||||
@@ -51,6 +54,13 @@ module UI
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def add_overlay(key)
|
||||
@sprites[key] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites[key].z = 1000
|
||||
self.class::TEXT_COLOR_THEMES.each_pair { |key, values| @sprites[key].add_text_theme(key, *values) }
|
||||
pbSetSystemFont(@sprites[key].bitmap)
|
||||
end
|
||||
|
||||
def add_icon_sprite(key, x, y, filename = nil)
|
||||
@sprites[key] = IconSprite.new(x, y, @viewport)
|
||||
@sprites[key].setBitmap(filename) if filename
|
||||
@@ -77,7 +87,11 @@ module UI
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def graphics_folder
|
||||
return UI_FOLDER + @@graphics_folder
|
||||
return UI_FOLDER + self.class::GRAPHICS_FOLDER
|
||||
end
|
||||
|
||||
def background_filename
|
||||
return gendered_filename(self.class::BACKGROUND_FILENAME)
|
||||
end
|
||||
|
||||
def gendered_filename(base_filename)
|
||||
@@ -96,21 +110,124 @@ module UI
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def show_message(text)
|
||||
pbMessage(text) { update_visuals }
|
||||
@sprites[:message_box].text = text
|
||||
@sprites[:message_box].visible = true
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
update_visuals
|
||||
if @sprites[:message_box].busy?
|
||||
if Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE if @sprites[:message_box].pausing?
|
||||
@sprites[:message_box].resume
|
||||
end
|
||||
elsif Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
|
||||
break
|
||||
end
|
||||
end
|
||||
@sprites[:message_box].visible = false
|
||||
end
|
||||
|
||||
def show_confirm_message(text)
|
||||
return pbConfirmMessage(text) { update_visuals }
|
||||
ret = false
|
||||
@sprites[:message_box].text = text
|
||||
@sprites[:message_box].visible = true
|
||||
using(cmd_window = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
|
||||
cmd_window.z = @viewport.z + 1
|
||||
cmd_window.visible = false
|
||||
pbBottomRight(cmd_window)
|
||||
cmd_window.y -= @sprites[:message_box].height
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
update_visuals
|
||||
cmd_window.visible = true if !@sprites[:message_box].busy?
|
||||
cmd_window.update
|
||||
if !@sprites[:message_box].busy?
|
||||
if Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
ret = false
|
||||
break
|
||||
elsif Input.trigger?(Input::USE) && @sprites[:message_box].resume
|
||||
pbPlayDecisionSE
|
||||
ret = (cmd_window.index == 0)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@sprites[:message_box].visible = false
|
||||
return ret
|
||||
end
|
||||
|
||||
def show_choice_message(text, options, cancel_index)
|
||||
return pbMessage(text, options, cancel_index) { update_visuals }
|
||||
def show_choice_message(text, options, index = 0)
|
||||
ret = -1
|
||||
commands = options
|
||||
commands = options.values if options.is_a?(Hash)
|
||||
@sprites[:message_box].text = text
|
||||
@sprites[:message_box].visible = true
|
||||
using(cmd_window = Window_CommandPokemon.new(commands)) do
|
||||
cmd_window.z = @viewport.z + 1
|
||||
cmd_window.visible = false
|
||||
cmd_window.index = index
|
||||
pbBottomRight(cmd_window)
|
||||
cmd_window.y -= @sprites[:message_box].height
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
update_visuals
|
||||
cmd_window.visible = true if !@sprites[:message_box].busy?
|
||||
cmd_window.update
|
||||
if !@sprites[:message_box].busy?
|
||||
if Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
ret = -1
|
||||
break
|
||||
elsif Input.trigger?(Input::USE) && @sprites[:message_box].resume
|
||||
pbPlayDecisionSE
|
||||
ret = cmd_window.index
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@sprites[:message_box].visible = false
|
||||
ret = options.keys[ret] if options.is_a?(Hash)
|
||||
return ret
|
||||
end
|
||||
|
||||
def show_choice(options, index = 0)
|
||||
ret = -1
|
||||
commands = options
|
||||
commands = options.values if options.is_a?(Hash)
|
||||
using(cmd_window = Window_CommandPokemon.new(commands)) do
|
||||
cmd_window.z = @viewport.z + 1
|
||||
cmd_window.index = index
|
||||
pbBottomRight(cmd_window)
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
update_visuals
|
||||
cmd_window.update
|
||||
if Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
ret = -1
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
ret = cmd_window.index
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
ret = options.keys[ret] if options.is_a?(Hash)
|
||||
return ret
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
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)
|
||||
@sprites[overlay].draw_themed_text(string.to_s, 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)
|
||||
@@ -141,10 +258,10 @@ module UI
|
||||
return nil
|
||||
end
|
||||
|
||||
def update
|
||||
update_visuals
|
||||
return update_input
|
||||
end
|
||||
# def update
|
||||
# update_visuals
|
||||
# return update_input
|
||||
# end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -153,7 +270,8 @@ module UI
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
ret = update
|
||||
update_visuals
|
||||
ret = update_input
|
||||
break if ret
|
||||
end
|
||||
return ret
|
||||
@@ -164,9 +282,12 @@ module UI
|
||||
# The logic class.
|
||||
#=============================================================================
|
||||
class BaseScreen
|
||||
attr_reader :result
|
||||
|
||||
def initialize
|
||||
@disposed = false
|
||||
initialize_visuals
|
||||
# TODO: Call main separately, not here?
|
||||
main
|
||||
end
|
||||
|
||||
@@ -198,20 +319,32 @@ module UI
|
||||
@visuals.show_message(text)
|
||||
end
|
||||
|
||||
alias pbDisplay show_message
|
||||
|
||||
def show_confirm_message(text)
|
||||
return @visuals.show_confirm_message(text)
|
||||
end
|
||||
|
||||
def show_choice_message(text, options, cancel_index)
|
||||
return @visuals.show_choice_message(text, options, cancel_index)
|
||||
alias pbConfirm show_confirm_message
|
||||
|
||||
def show_choice_message(text, options, initial_index = 0)
|
||||
return @visuals.show_choice_message(text, options, initial_index)
|
||||
end
|
||||
|
||||
def show_choice(options, initial_index = 0)
|
||||
return @visuals.show_choice(options, initial_index)
|
||||
end
|
||||
|
||||
alias pbShowCommands show_choice
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def refresh
|
||||
@visuals.refresh
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def main
|
||||
start_screen
|
||||
loop do
|
||||
|
||||
1240
Data/Scripts/016b_UI redesign/006_UI_Summary.rb
Normal file
1240
Data/Scripts/016b_UI redesign/006_UI_Summary.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,13 @@
|
||||
#
|
||||
#===============================================================================
|
||||
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
|
||||
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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
=begin
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -75,12 +76,23 @@ class RibbonSelectionSprite < MoveSelectionSprite
|
||||
@spriteVisible = value if !@updating
|
||||
end
|
||||
|
||||
def recheck_visibility
|
||||
@updating = true
|
||||
self.visible = @spriteVisible && @index >= 0 &&
|
||||
@index < UI::PokemonSummaryVisuals::RIBBON_COLUMNS * UI::PokemonSummaryVisuals::RIBBON_ROWS
|
||||
@updating = false
|
||||
end
|
||||
|
||||
def refresh
|
||||
recheck_visibility
|
||||
cols = UI::PokemonSummaryVisuals::RIBBON_COLUMNS
|
||||
offset_x = UI::PokemonSummaryVisuals::RIBBON_SIZE[0] + UI::PokemonSummaryVisuals::RIBBON_SPACING_X
|
||||
offset_y = UI::PokemonSummaryVisuals::RIBBON_SIZE[1] + UI::PokemonSummaryVisuals::RIBBON_SPACING_Y
|
||||
self.x = UI::PokemonSummaryVisuals::RIBBON_X - 2 + ((self.index % cols) * offset_x)
|
||||
self.y = UI::PokemonSummaryVisuals::RIBBON_Y - 2 + ((self.index / cols) * offset_y)
|
||||
self.bitmap = @movesel.bitmap
|
||||
w = @movesel.width
|
||||
h = @movesel.height / 2
|
||||
self.x = 228 + ((self.index % 4) * 68)
|
||||
self.y = 76 + ((self.index / 4).floor * 68)
|
||||
self.bitmap = @movesel.bitmap
|
||||
if self.preselected
|
||||
self.src_rect.set(0, h, w, h)
|
||||
else
|
||||
@@ -89,11 +101,9 @@ class RibbonSelectionSprite < MoveSelectionSprite
|
||||
end
|
||||
|
||||
def update
|
||||
@updating = true
|
||||
super
|
||||
self.visible = @spriteVisible && @index >= 0 && @index < 12
|
||||
recheck_visibility
|
||||
@movesel.update
|
||||
@updating = false
|
||||
refresh
|
||||
end
|
||||
end
|
||||
@@ -839,7 +849,7 @@ class PokemonSummary_Scene
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
# Draw selected move's damage category icon
|
||||
imagepos = [["Graphics/UI/category", 166, 124,
|
||||
0, selected_move.display_category(@pokemon) * CATEGORY_ICON_SIZE[1], *CATEGORY_ICON_SIZE]]
|
||||
0, selected_move.display_category(@pokemon) * GameData::Move::CATEGORY_ICON_SIZE[1], *GameData::Move::CATEGORY_ICON_SIZE]]
|
||||
pbDrawImagePositions(overlay, imagepos)
|
||||
# Draw selected move's description
|
||||
drawTextEx(overlay, 4, 224, 230, 5, selected_move.description, base, shadow)
|
||||
@@ -1367,6 +1377,7 @@ class PokemonSummaryScreen
|
||||
return ret
|
||||
end
|
||||
|
||||
# Unused.
|
||||
def pbStartChooseMoveScreen(party, partyindex, message)
|
||||
ret = -1
|
||||
@scene.pbStartForgetScene(party, partyindex, nil)
|
||||
@@ -1388,9 +1399,8 @@ def pbChooseMove(pokemon, variableNumber, nameVarNumber)
|
||||
return if !pokemon
|
||||
ret = -1
|
||||
pbFadeOutIn do
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
ret = screen.pbStartForgetScreen([pokemon], 0, nil)
|
||||
screen = UI::PokemonSummary.new(pokemon, mode: :choose_move)
|
||||
ret = screen.result
|
||||
end
|
||||
$game_variables[variableNumber] = ret
|
||||
if ret >= 0
|
||||
@@ -1400,3 +1410,4 @@ def pbChooseMove(pokemon, variableNumber, nameVarNumber)
|
||||
end
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
=end
|
||||
@@ -146,9 +146,8 @@ class BattleSwapScene
|
||||
|
||||
def pbSummary(list, index)
|
||||
visibleSprites = pbFadeOutAndHide(@sprites) { pbUpdate }
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
@sprites["list"].index = screen.pbStartScreen(list, index)
|
||||
screen = UI::PokemonSummary.new(list, index)
|
||||
@sprites["list"].index = screen.result
|
||||
pbFadeInAndShow(@sprites, visibleSprites) { pbUpdate }
|
||||
end
|
||||
|
||||
|
||||
@@ -335,9 +335,7 @@ def pbDebugDayCare
|
||||
[_INTL("Summary"), _INTL("Withdraw"), _INTL("Cancel")], 3)
|
||||
when 0 # Summary
|
||||
pbFadeOutIn do
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene, false)
|
||||
screen.pbStartScreen([pkmn], 0)
|
||||
UI::PokemonSummary.new(pkmn)
|
||||
need_refresh = true
|
||||
end
|
||||
when 1 # Withdraw
|
||||
|
||||
Reference in New Issue
Block a user