#==============================================================================
# +++ MOG - Monogatari (物語) (v1.3) +++
#==============================================================================
# By Moghunter
# [url]http://www.atelier-rgss.com/[/url]
#==============================================================================
# Sistema avançado de menu, voltado para scripters que desejam saber sobre
# técnicas de manipulação de sprites e janelas.
#==============================================================================
#==============================================================================
# Version History.
#==============================================================================
# 1.3 - Corrigido o bug do som da Scene Skill.
# 1.2 - Compatibilidade com Third Party scripts.
# - Scene File incorporado ao sistema Monogatari, melhorando a performance.
#==============================================================================
#==============================================================================
# NOTA - Como este é um script para apresentar técnicas de RGSS, não foram
# adicionados comentários explicativos no modulo de configuração
#==============================================================================
#==============================================================================
# ■ MAIN MENU
#==============================================================================
module MOG_MENU
NUMBER_OF_PARTICLES = 20
BACKGROUND_SCROLL_SPEED = [1,0]
COMMAND_POSITION = [32, 84]
COMMAND_POSITION_2 = [10,100]
COMMAND_SPACE = 4
COMMAND_NAME_POSITION = [0,0]
COMMAND_NAME_POSITION_2 = [220,48]
ACTOR_SPACE = 100
ACTOR_POSITION = [240,0]
ACTOR_LAYOUT_POSITON = [0,275]
ACTOR_HP1_POSITON = [28,315]
ACTOR_HP2_POSITON = [50,330]
ACTOR_MP1_POSITON = [28,346]
ACTOR_MP2_POSITON = [50,361]
ACTOR_HP_METER_POSITON = [29,329]
ACTOR_MP_METER_POSITON = [29,360]
ACTOR_LEVEL_POSITON = [30,290]
ACTOR_STATES_POSITION = [63,283]
MEMBERS_FACE_POSITION =[150,55]
MEMBERS_FACE_SPACE = 64
MEMBERS_ARROW_LAYOUT_POSITION = [217,40]
MEMBERS_ARROW_1_POSITION = [180,40]
MEMBERS_ARROW_2_POSITION = [300,40]
TIME_NUMBER_POS = [415,10]
GOLD_NUMBER_POS = [170,388]
LOCATION_POS = [330,380]
end
#==============================================================================
# ■ MOG_MENU ITEM
#==============================================================================
module MOG_MENU_ITEM
NUMBER_OF_PARTICLES = 20
BACKGROUND_SCROLL_SPEED = [0,0]
COMMAND_POSITION = [0, 69]
BUTTON_POSITION = [210, 30]
BUTTON_SPACE = 90
end
#==============================================================================
# ■ MOG_MENU SKILL
#==============================================================================
module MOG_MENU_SKILL
NUMBER_OF_PARTICLES = 20
BACKGROUND_SCROLL_SPEED = [0,0]
end
#==============================================================================
# ■ MOG_ACTOR SKILL STATUS
#==============================================================================
module MOG_ACTOR_SKILL_STATUS
MEMBERS_SPACE = 80
LAYOUT_POSITION = [155,0]
PAR_POSITION = [0,0]
FACE_POSITION = [-13,-3]
HP_METER_POSITION = [158,15]
MP_METER_POSITION = [177,35]
STATES_POSITION = [71,36]
STATES_SCROLLING_ANIMATION = true
NAME_POSITION = [105,34]
FONT_NAME = "楷体"
FONT_SIZE = 14
FONT_BOLD = true
end
#==============================================================================
# ■ MOG_MENU EQUIP
#==============================================================================
module MOG_MENU_EQUIP
NUMBER_OF_PARTICLES = 30
BACKGROUND_SCROLL_SPEED = [0,0]
FONT_NAME = "楷体"
FONT_SIZE = 15
FONT_BOLD = true
FONT_ITALIC = false
end
#==============================================================================
# ■ MOG_MENU STATUS
#==============================================================================
module MOG_MENU_STATUS
NUMBER_OF_PARTICLES = 30
BACKGROUND_SCROLL_SPEED = [1,0]
end
#==============================================================================
# ■ MOG MENU PARTY
#==============================================================================
module MOG_MENU_PARTY
NUMBER_OF_PARTICLES = 20
BACKGROUND_SCROLL_SPEED = [0,0]
end
#==============================================================================
# ■ MOG MENU SAVE
#==============================================================================
module MOG_MENU_SAVE
FILES_MAX = 9
NUMBER_OF_PARTICLES = 20
BACKGROUND_SCROLL_SPEED = [1,0]
end
#==============================================================================
# ■ MOG MENU END
#==============================================================================
module MOG_MENU_END
NUMBER_OF_PARTICLES = 20
BACKGROUND_SCROLL_SPEED = [0,0]
end
#==============================================================================
# ■ MOG ACTOR MENU STATUS
#==============================================================================
module MOG_ACTOR_MENU_STATUS
LAYOUT_POSITION = [385,115]
FACE_POSITION = [48,-32]
PAR_POSITION = [5,64]
STATES_POSITION = [15,25]
STATES_SCROLLING_ANIMATION = false
NAME_POSITION = [10,60]
FONT_NAME = "方正粗圆简体"
FONT_SIZE = 16
FONT_BOLD = true
end
#==============================================================================
# ■ MOG MEMBERS LAYOUT
#==============================================================================
module MOG_MEMBERS_LAYOUT
MEMBERS_SPACE = 80
LAYOUT_POSITION = [3,160]
PAR_POSITION = [0,0]
FACE_POSITION = [0,-2]
HP_METER_POSITION = [12,37]
MP_METER_POSITION = [86,37]
SCOPE_TEXT_POSITION = [0,170]
ARROW_1_POSITION = [50,55]
ARROW_2_POSITION = [50,4]
NAME_POSITION = [42,38]
FONT_NAME = "方正粗圆简体"
FONT_SIZE = 18
FONT_BOLD = true
end
#==============================================================================
# ■ MOG MENU BASE
#==============================================================================
module MOG_MENU_BASE
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :menu_index
attr_accessor :actor_menu_temp
attr_accessor :item_scope
attr_accessor :temp_actor_equip
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_menu_index_initialize initialize
def initialize
@menu_index = 0
@actor_menu_temp = -1
@item_scope = 0
@temp_actor_equip = nil
mog_menu_index_initialize
end
end
#==============================================================================
# ■ Scene Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● Update Call Menu
#--------------------------------------------------------------------------
alias mog_menu_monogatari_update_call_menu update_call_menu
def update_call_menu
if $game_party.members.size == 0
@call_menu = false
return
end
mog_menu_monogatari_update_call_menu
end
#--------------------------------------------------------------------------
# ● Call Menu
#--------------------------------------------------------------------------
alias mog_menu_monogatari_call_menu call_menu
def call_menu
$game_temp.menu_index = 0
mog_menu_monogatari_call_menu
end
end
#==============================================================================
# ■ Window Command
#==============================================================================
class Window_Command < Window_Selectable
attr_reader :list
end
#==============================================================================
# ■ Game Party
#==============================================================================
class Game_Party < Game_Unit
attr_accessor :menu_actor_id
end
#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● gain Tp
#--------------------------------------------------------------------------
def gain_tp(actor_id,value)
return if $game_party.members[actor_id] == nil
$game_party.members[actor_id].tp += value.truncate
end
#--------------------------------------------------------------------------
# ● Lose Tp
#--------------------------------------------------------------------------
def lose_tp(actor_id,value)
return if $game_party.members[actor_id] == nil
$game_party.members[actor_id].tp -= value.truncate
end
end
#==============================================================================
# ■ Cache
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# ● Menu
#--------------------------------------------------------------------------
def self.menu(filename)
load_bitmap("Graphics/Menus/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Main
#--------------------------------------------------------------------------
def self.menu_main(filename)
load_bitmap("Graphics/Menus/Main/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Item
#--------------------------------------------------------------------------
def self.menu_item(filename)
load_bitmap("Graphics/Menus/Item/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Skill
#--------------------------------------------------------------------------
def self.menu_skill(filename)
load_bitmap("Graphics/Menus/Skill/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Equip
#--------------------------------------------------------------------------
def self.menu_equip(filename)
load_bitmap("Graphics/Menus/Equip/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Status
#--------------------------------------------------------------------------
def self.menu_status(filename)
load_bitmap("Graphics/Menus/Status/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Save
#--------------------------------------------------------------------------
def self.menu_save(filename)
load_bitmap("Graphics/Menus/Save/", filename)
end
#--------------------------------------------------------------------------
# ● Menu Party
#--------------------------------------------------------------------------
def self.menu_party(filename)
load_bitmap("Graphics/Menus/Party/", filename)
end
#--------------------------------------------------------------------------
# ● Menu End
#--------------------------------------------------------------------------
def self.menu_end(filename)
load_bitmap("Graphics/Menus/End/", filename)
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :pre_cache_main_menu
attr_accessor :pre_cache_actor_menu
attr_accessor :pre_cache_item_menu
attr_accessor :pre_cache_skill_menu
attr_accessor :pre_cache_equip_menu
attr_accessor :pre_cache_status_menu
attr_accessor :pre_cache_party_menu
attr_accessor :pre_cache_file_menu
attr_accessor :pre_cache_end_menu
attr_accessor :pre_cache_icon
attr_accessor :pre_symbol
#--------------------------------------------------------------------------
# ● Pre Cache Atelier Menu
#--------------------------------------------------------------------------
def pre_cache_atelier_menu
@pre_cache_main_menu = []
@pre_cache_item_menu = []
@pre_cache_skill_menu = []
@pre_cache_equip_menu = []
@pre_cache_status_menu = []
@pre_cache_party_menu = []
@pre_cache_file_menu = []
@pre_cache_end_menu = []
@pre_symbol = ""
execute_pre_cache_icon if can_pre_cache_icon?
execute_pre_cache_actor
execute_pre_cache_main_menu
execute_pre_cache_item_menu
execute_pre_cache_skill_menu
execute_pre_cache_equip_menu
execute_pre_cache_status_menu
execute_pre_cache_file_menu
execute_pre_cache_party_menu
execute_pre_cache_end_menu
end
#--------------------------------------------------------------------------
# ● Pre Cache Icon
#--------------------------------------------------------------------------
def execute_pre_cache_icon
@pre_cache_icon = Cache.system("Iconset")
end
#--------------------------------------------------------------------------
# ● Can Pre Cache Menu?
#--------------------------------------------------------------------------
def can_pre_cache_icon?
return true if @pre_cache_icon == nil
return true if @pre_cache_icon.disposed? rescue return false
return false
end
end
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_atelier_menu_initialize initialize
def initialize
$game_temp.pre_cache_atelier_menu if $game_temp.can_pre_cache_icon?
mog_atelier_menu_initialize
end
end
#==============================================================================
# ■ Particles_Menu
#==============================================================================
class Particles_Menu < Sprite
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
@speed_x = 0
@speed_y = 0
@speed_a = 0
self.bitmap = Cache.menu("Particles")
self.blend_type = 0
self.z = 1
reset_setting(true)
end
#--------------------------------------------------------------------------
# ● Reset Setting
#--------------------------------------------------------------------------
def reset_setting(initial = false)
zoom = (50 + rand(100)) / 100.1
self.zoom_x = zoom
self.zoom_y = zoom
self.x = rand(576) - 160
self.y = initial == true ? rand(480) : 512
self.opacity = 0
@speed_y = -(1 + rand(3))
@speed_x = (1 + rand(2))
@speed_a = (1 + rand(2))
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
super
self.bitmap.dispose if self.bitmap != nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
self.x += @speed_x
self.y += @speed_y
self.opacity += 5
reset_setting if can_reset_setting?
end
#--------------------------------------------------------------------------
# ● Can Reset Setting
#--------------------------------------------------------------------------
def can_reset_setting?
return true if self.y < -50
return true if self.x > 576
return false
end
end
#==============================================================================
# ■ Window_Actor_Status_0
#==============================================================================
class Members_Windows_Status < Window_Selectable
attr_reader :pending_index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0)
super(x, y, window_width, window_height)
self.windowskin = Cache.menu("")
self.opacity = 0
self.contents_opacity = 0
self.visible = false
@input_lag = 0
@old_index = -1
@pending_index = -1
refresh
end
#--------------------------------------------------------------------------
# ● Window Width
#--------------------------------------------------------------------------
def window_width
40
end
#--------------------------------------------------------------------------
# ● Window Height
#--------------------------------------------------------------------------
def window_height
40
end
#--------------------------------------------------------------------------
# ● Cursor Movable?
#--------------------------------------------------------------------------
def cursor_movable?
active && open? && !@cursor_fix && !@cursor_all && item_max > 0 && @input_lag == 0
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# ● Item Height
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2) / 4
end
#--------------------------------------------------------------------------
# ● Draw Item Background
#--------------------------------------------------------------------------
def draw_item_background(index)
end
#--------------------------------------------------------------------------
# ● Pending Index
#--------------------------------------------------------------------------
def pending_index=(index)
last_pending_index = @pending_index
@pending_index = index
end
#--------------------------------------------------------------------------
# ● Process OK
#--------------------------------------------------------------------------
def process_ok
$game_party.target_actor = $game_party.members[index] unless @cursor_all
call_ok_handler
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
select($game_party.target_actor.index || 0)
end
#--------------------------------------------------------------------------
# ● Select For Item
#--------------------------------------------------------------------------
def select_for_item(item)
@cursor_fix = item.for_user?
@cursor_all = item.for_all?
if @cursor_fix
select($game_party.menu_actor.index)
elsif @cursor_all
select(0)
else
[url=home.php?mod=space&uid=370741]@Index[/url] = [url=home.php?mod=space&uid=370741]@Index[/url] < 0 ? 0 : @index
end
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
end
#--------------------------------------------------------------------------
# ● Process Cursor Move 2
#--------------------------------------------------------------------------
def process_cursor_move2
return unless cursor_movable?
last_index = @index
cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
cursor_up (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
Sound.play_cursor if [url=home.php?mod=space&uid=370741]@Index[/url] != last_index
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
@input_lag -= 1 if @input_lag > 0
if @old_index != @index
@old_index = @index
@input_lag = 5
end
end
end
#==============================================================================
# ■ Members Menu
#==============================================================================
class Members_Menu
include MOG_MEMBERS_LAYOUT
attr_accessor :actor
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor,index)
[url=home.php?mod=space&uid=95897]@actor[/url] = actor
@index = index
@index_old = -1
@com_index = 0
@max_index = $game_party.members.size - 1
@active = false
@active_old = false
@opac = 0
@opac_active = [0,0]
@par = []
[url=home.php?mod=space&uid=14099]@Float[/url] = [0,0,0]
set_old_parameter
create_sprites
create_sprites_support if @index == 0
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
@meter_image = $game_temp.pre_cache_actor_menu[6]
@meter_cw = @meter_image.width
@meter_ch = @meter_image.height / 2
@parameter_number = $game_temp.pre_cache_actor_menu[2]
@parameter_cw = @parameter_number.width / 10
@parameter_ch = @parameter_number.height
@visible = false
create_layout
create_parameter
create_face
create_name
create_hp_meter
create_mp_meter
@next_pos = [[email]-@layout.width[/email] - 64,0]
@now_index = [[email]-@layout.width[/email] - 64,0,0]
@before_index = [[email]-@layout.width[/email] - 64,0,0]
@next_index = [[email]-@layout.width[/email] - 64,0,0]
set_position([email]-@layout.width[/email] - 64,0)
set_opacity(0)
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites_support
create_scope_all
create_arrow
end
#--------------------------------------------------------------------------
# ● Create Scope All
#--------------------------------------------------------------------------
def create_scope_all
@scope = Sprite.new
@scope.bitmap = $game_temp.pre_cache_actor_menu[4]
@scope_cw = @scope.bitmap.width
@org_pos_scope = [SCOPE_TEXT_POSITION[0],SCOPE_TEXT_POSITION[1],SCOPE_TEXT_POSITION[0] - @scope_cw]
@scope.x = @org_pos_scope[2]
@scope.y = @org_pos_scope[1]
@scope.z = 15
end
#--------------------------------------------------------------------------
# ● Update Scope
#--------------------------------------------------------------------------
def update_scope
if @active and all_targets
if @scope.x < @org_pos_scope[0]
@scope.x += 15
if @scope.x >= @org_pos_scope[0]
@scope.x = @org_pos_scope[0]
end
end
else
if @scope.x > @org_pos_scope[2]
@scope.x -= 15
if @scope.x <= @org_pos_scope[2]
@scope.x = @org_pos_scope[2]
end
end
end
end
#--------------------------------------------------------------------------
# ● Create Arrow
#--------------------------------------------------------------------------
def create_arrow
@arrow_float = [0,0,0]
@arrow_np_1 = [0,0]
@arrow_np_2 = [0,0]
@arrow_image = $game_temp.pre_cache_actor_menu[5]
@arrow_image_cw = @arrow_image.width
@arrow_image_ch = @arrow_image.height# / 2
@arrow_1 = Sprite.new
@arrow_1.bitmap = Bitmap.new(@arrow_image_cw,@arrow_image_ch)
@arrow_cw = @arrow_1.bitmap.width
@org_pos_arrow_1 = [ARROW_1_POSITION[0],ARROW_1_POSITION[1]]
@arrow_1.x = @org_pos_arrow_1[0]
@arrow_1.y = @org_pos_arrow_1[1]
@arrow_1.z = 15
@arrow_1.opacity = 0
@arrow_2 = Sprite.new
@arrow_2.bitmap = Bitmap.new(@arrow_image_cw,@arrow_image_ch)
@arrow_2.ox = @arrow_2.bitmap.width / 2
@arrow_2.oy = @arrow_2.bitmap.height / 2
@arrow_2.angle = 180
ar_y = (MEMBERS_SPACE * 4) + ARROW_2_POSITION[1]
@org_pos_arrow_2 = [ARROW_2_POSITION[0] + @arrow_2.ox,ar_y]
@arrow_2.x = @org_pos_arrow_2[0]
@arrow_2.y = @org_pos_arrow_2[1]
@arrow_2.z = 15
@arrow_2.opacity = 0
@arrow_time_1 = 0
@arrow_time_2 = 0
refresh_arrow(0,@arrow_1,0)
refresh_arrow(1,@arrow_2,0)
end
#--------------------------------------------------------------------------
# ● Refresh_arrow 1
#--------------------------------------------------------------------------
def refresh_arrow(arrow,sprite,type)
sprite.bitmap.clear
h = @arrow_image_ch * type
a_rect = Rect.new(0,h,@arrow_image_cw,@arrow_image_ch)
sprite.bitmap.blt(0,0,@arrow_image,a_rect)
@arrow_time_1 = 20 if arrow == 0
@arrow_time_2 = 20 if arrow ==1
end
#--------------------------------------------------------------------------
# ● Update Arrow
#--------------------------------------------------------------------------
def update_arrow
# update_arrow_type
update_arrow_visible
update_arrow_float_animation
end
#--------------------------------------------------------------------------
# ● Update Arrow Type
#--------------------------------------------------------------------------
def update_arrow_type
if @arrow_time_1 > 0
@arrow_time_1 -= 1
refresh_arrow(0,@arrow_1,0) if @arrow_time_1 == 0
end
if @arrow_time_2 > 0
@arrow_time_2 -= 1
refresh_arrow(1,@arrow_2,0) if @arrow_time_2 == 0
end
end
#--------------------------------------------------------------------------
# ● Refresh Arrow Type
#--------------------------------------------------------------------------
def refresh_arrow_type
return
if @index_old > @com_index
refresh_arrow(0,@arrow_1,1)
else
refresh_arrow(1,@arrow_2,1)
end
end
#--------------------------------------------------------------------------
# ● Update Arrow Visible
#--------------------------------------------------------------------------
def update_arrow_visible
if can_arrow_visible?
@arrow_1.opacity += 15
@arrow_2.opacity += 15
@arrow_np_1 = [@org_pos_arrow_1[0],@org_pos_arrow_1[1]]
@arrow_np_2 = [@org_pos_arrow_2[0],@org_pos_arrow_2[1]]
else
@arrow_1.opacity -= 10
@arrow_2.opacity -= 10
@arrow_np_1 = [-@arrow_cw,@org_pos[1]]
@arrow_np_2 = [-@arrow_cw + @arrow_2.ox,@org_pos[1] + @arrow_2.oy]
end
end
#--------------------------------------------------------------------------
# ● Update Slide Arrow
#--------------------------------------------------------------------------
def update_slide_arrow(type,sprite,cp,np)
cp -= @arrow_float[1] if type == 1
sp = 2 + ((cp - np).abs / 20)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp + @arrow_float[1] if type == 1
end
#--------------------------------------------------------------------------
# ● Can Arrow Visiblle?
#--------------------------------------------------------------------------
def can_arrow_visible?
return false if !@active
return false if all_targets
return false if $game_party.members.size < 2
return true
end
#--------------------------------------------------------------------------
# ● Update Arrow Float Animation
#--------------------------------------------------------------------------
def update_arrow_float_animation
@arrow_float[2] += 1
if @arrow_float[2] > 2
@arrow_float[2] = 0
@arrow_float[0] += 1
case @arrow_float[0]
when 1..11
@arrow_float[1] += 1
when 12..22
@arrow_float[1] -= 1
else
@arrow_float[0] = 0
@arrow_float[1] = 0
end
end
update_slide_arrow(0,@arrow_1,@arrow_1.x,@arrow_np_1[0])
update_slide_arrow(1,@arrow_1,@arrow_1.y,@arrow_np_1[1])
update_slide_arrow(0,@arrow_2,@arrow_2.x,@arrow_np_2[0])
update_slide_arrow(1,@arrow_2,@arrow_2.y,@arrow_np_2[1])
end
#--------------------------------------------------------------------------
# ● Create Scope All
#--------------------------------------------------------------------------
def update_support
update_scope
update_arrow
end
#--------------------------------------------------------------------------
# ● Set Old Parameter
#--------------------------------------------------------------------------
def set_old_parameter
@par.clear
@par = [@actor.hp,@actor.mhp,@actor.mp,@actor.mmp,@actor.level]
end
#--------------------------------------------------------------------------
# ● Members Spate
#--------------------------------------------------------------------------
def members_space
LAYOUT_POSITION[1] + (@index * MEMBERS_SPACE)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_layout
dispose_parameter
dispose_face
dispose_name
dispose_hp_meter
dispose_mp_meter
dispose_support if @index == 0
end
#--------------------------------------------------------------------------
# ● Dispose Support
#--------------------------------------------------------------------------
def dispose_support
dispose_scope
dispose_arrow
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Scope
#--------------------------------------------------------------------------
def dispose_scope
@scope.dispose
end
#--------------------------------------------------------------------------
# ● Dispose_Arrow
#--------------------------------------------------------------------------
def dispose_arrow
@arrow_1.bitmap.dispose
@arrow_1.dispose
@arrow_2.bitmap.dispose
@arrow_2.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Parameter
#--------------------------------------------------------------------------
def dispose_parameter
@parameter.bitmap.dispose
@parameter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Face
#--------------------------------------------------------------------------
def dispose_face
@face.dispose
end
#--------------------------------------------------------------------------
# ● Dispose HP Meter
#--------------------------------------------------------------------------
def dispose_hp_meter
@hp_meter.bitmap.dispose
@hp_meter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose MP Meter
#--------------------------------------------------------------------------
def dispose_mp_meter
@mp_meter.bitmap.dispose
@mp_meter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
@name.bitmap.dispose
@name.dispose
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = Cache.menu("Actor_Layout_1")
@org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
@layout.x = @org_pos[0]
@layout.y = @org_pos[1]
@layout.z = 10
#@layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Parameter
#--------------------------------------------------------------------------
def create_parameter
@parameter = Sprite.new
@parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
@org_pos_par = [@org_pos[0] + PAR_POSITION[0],
@org_pos[1] + PAR_POSITION[1]]
@parameter.x = @org_pos_par[0]
@parameter.y = @org_pos_par[1]
@parameter.z = 12
# @parameter.opacity = 0
refresh_parameter
end
#--------------------------------------------------------------------------
# ● Create HP Meter
#--------------------------------------------------------------------------
def create_hp_meter
@hp_meter_old = [-1,-1]
@hp_meter = Sprite.new
@hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@org_pos_hp = [@org_pos[0] + HP_METER_POSITION[0],
@org_pos[1] + HP_METER_POSITION[1]]
@hp_meter.x = @org_pos_hp[0]
@hp_meter.y = @org_pos_hp[1]
@hp_meter.z = 11
end
#--------------------------------------------------------------------------
# ● Refresh HP Meter
#--------------------------------------------------------------------------
def refresh_hp_meter
@hp_meter_old[0] = @actor.hp
@hp_meter_old[1] = @actor.mhp
@hp_meter.bitmap.clear
width_range = @meter_cw * @actor.hp / @actor.mhp
m_rect = Rect.new(0,0,width_range,@meter_ch)
@hp_meter.bitmap.blt(0,0,@meter_image,m_rect)
end
#--------------------------------------------------------------------------
# ● Create MP Meter
#--------------------------------------------------------------------------
def create_mp_meter
@mp_meter_old = [-1,-1]
@mp_meter = Sprite.new
@mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@org_pos_mp = [@org_pos[0] + MP_METER_POSITION[0],
@org_pos[1] + MP_METER_POSITION[1]]
@mp_meter.x = @org_pos_mp[0]
@mp_meter.y = @org_pos_mp[1]
@mp_meter.z = 11
end
#--------------------------------------------------------------------------
# ● Refresh MP Meter
#--------------------------------------------------------------------------
def refresh_mp_meter
@mp_meter_old[0] = @actor.mp
@mp_meter_old[1] = @actor.mmp
@mp_meter.bitmap.clear
width_range = @meter_cw * @actor.mp / @actor.mmp rescue nil
width_range = 0 if width_range == nil
m_rect = Rect.new(0,@meter_ch,width_range,@meter_ch)
@mp_meter.bitmap.blt(0,0,@meter_image,m_rect)
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def refresh_parameter
set_old_parameter
@parameter.bitmap.clear
value = @actor.level
x = 146
y = 8
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.hp
x = 72
y = 24
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mp
x = 146
y = 24
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_number(sprite,image,value,number_cw,number_ch,x,y)
number = value.abs.to_s.split(//)
x2 = -number_cw * number.size
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
sprite.bitmap.blt(x + x2 + (number_cw * i), y, image, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def create_face
@face = Sprite.new
@org_pos_face = [@org_pos[0] + FACE_POSITION[0],
@org_pos[1] + FACE_POSITION[1]]
@face.x = @org_pos_face[0]
@face.y = @org_pos_face[1]
@face.z = 11
# @face.opacity = 0
refresh_face
end
#--------------------------------------------------------------------------
# ● Refresh Face
#--------------------------------------------------------------------------
def refresh_face
face_name = "Face_B" + @actor.id.to_s
@face.bitmap = Cache.menu(face_name.to_s)
end
#--------------------------------------------------------------------------
# ● Create Name
#--------------------------------------------------------------------------
def create_name
@name = Sprite.new
@name.bitmap = Bitmap.new(140,32)
@name.bitmap.font.name = FONT_NAME
@name.bitmap.font.size = FONT_SIZE
@name.bitmap.font.bold = FONT_BOLD
@org_pos_name = [@org_pos[0] + NAME_POSITION[0],
@org_pos[1] + NAME_POSITION[1]]
@name.x = @org_pos_name[0]
@name.y = @org_pos_name[1]
@name.z = 11
#@name.opacity = 0
refresh_name
end
#--------------------------------------------------------------------------
# ● Refresh Name
#--------------------------------------------------------------------------
def refresh_name
@name.bitmap.clear
@name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
end
#--------------------------------------------------------------------------
# ● Set Actor
#--------------------------------------------------------------------------
def set_actor(actor)
@actor = actor
end
#--------------------------------------------------------------------------
# ● Can Refresh HP Meter
#--------------------------------------------------------------------------
def can_refresh_hp_meter?
return true if @hp_meter_old[0] != @actor.hp
return true if @hp_meter_old[1] != @actor.mhp
return false
end
#--------------------------------------------------------------------------
# ● Can Refresh MP Meter
#--------------------------------------------------------------------------
def can_refresh_mp_meter?
return true if @mp_meter_old[0] != @actor.mp
return true if @mp_meter_old[1] != @actor.mmp
return false
end
#--------------------------------------------------------------------------
# ● Can Refresh Parameter
#--------------------------------------------------------------------------
def can_refresh_parameter?
return true if @par[0] != @actor.hp
return true if @par[1] != @actor.mhp
return true if @par[2] != @actor.mp
return true if @par[3] != @actor.mmp
return true if @par[4] != @actor.level
return false
end
#--------------------------------------------------------------------------
# ● Refresh_Visible
#--------------------------------------------------------------------------
def refresh_visible
if can_visible?
set_visible(true)
else
set_visible(false)
end
end
#--------------------------------------------------------------------------
# ● Set Index
#--------------------------------------------------------------------------
def set_index
@now_index[0] = @com_index
@before_index[0] = @com_index - 1
@next_index[0] = @com_index + 1
@before_index[0] = @max_index if @before_index[0] < 0
@next_index[0] = 0 if @next_index[0] > @max_index
end
#--------------------------------------------------------------------------
# ● Can Visible?
#--------------------------------------------------------------------------
def can_visible?
return true if @index == @now_index[0]
return true if @index == @next_index[0]
return true if @index == @before_index[0]
return false
end
#--------------------------------------------------------------------------
# ● Set Visible
#--------------------------------------------------------------------------
def set_visible(value)
@visible = value
return
@layout.visible = @visible
@parameter.visible = @visible
@hp_meter.visible = @visible
@mp_meter.visible = @visible
@face.visible = @visible
@name.visible = @visible
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
def update_position
update_slide(0,@layout,@layout.x,@next_pos[0] + @org_pos[0])
update_slide(1,@layout,@layout.y,@next_pos[1] + @org_pos[1])
update_slide(0,@parameter,@parameter.x,@next_pos[0] + @org_pos_par[0])
update_slide(1,@parameter,@parameter.y,@next_pos[1] + @org_pos_par[1])
update_slide(0,@hp_meter,@hp_meter.x,@next_pos[0] + @org_pos_hp[0])
update_slide(1,@hp_meter,@hp_meter.y,@next_pos[1] + @org_pos_hp[1])
update_slide(0,@mp_meter,@mp_meter.x,@next_pos[0] + @org_pos_mp[0])
update_slide(1,@mp_meter,@mp_meter.y,@next_pos[1] + @org_pos_mp[1])
update_slide(0,@face,@face.x,@next_pos[0] + @org_pos_face[0])
update_slide(1,@face,@face.y,@next_pos[1] + @org_pos_face[1])
update_slide(0,@name,@name.x,@next_pos[0] + @org_pos_name[0])
update_slide(1,@name,@name.y,@next_pos[1] + @org_pos_name[1])
end
#--------------------------------------------------------------------------
# ● Update Float
#--------------------------------------------------------------------------
def update_float
@float[2] += 1
if @float[2] > 5
@float[2] = 0
@float[0] += 1
case @float[0]
when 1..5
@float[1] -= 1
when 6..15
@float[1] += 1
when 16..20
@float[1] -= 1
else
@float = [0,0,0]
end
end
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,cp,np)
cp -= @float[1] if type == 1
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp + @float[1] if type == 1
end
#--------------------------------------------------------------------------
# ● All Targets
#--------------------------------------------------------------------------
def all_targets
return true if $game_temp.item_scope == 8
return true if $game_temp.item_scope == 10
return false
end
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_opacity
if @visible
if all_targets
if @max_index == 0
@next_pos = [0,0]
else
if @index == @before_index[0]
@next_pos = [0,-MEMBERS_SPACE]
elsif @index == @next_index[0]
@next_pos = [0,MEMBERS_SPACE]
else
@next_pos = [0,0]
end
end
update_opacity_active
update_float
else
if ((@index == @before_index[0]) or (@index == @next_index[0])) and
@max_index != 0
opac_limit = 170
if @opac > opac_limit
@opac -= 10
@opac = opac_limit if @opac < opac_limit
elsif @opac < opac_limit
@opac += 10
@opac = opac_limit if @opac > opac_limit
end
@float = [0,0,0]
else
update_opacity_active
update_float
end
end
else
@opac -= 10 if @opac > 0
@opac = 0 if @opac < 0
@float = [0,0,0]
end
set_opacity(@opac)
end
#--------------------------------------------------------------------------
# ● Update Opacity Active
#--------------------------------------------------------------------------
def update_opacity_active
@opac_active[0] += 1
case @opac_active[0]
when 1..30
@opac_active[1] += 4
when 31..60
@opac_active[1] -= 4
else
@opac_active[1] = 0
@opac_active[0] = 0
end
@opac = 160 + @opac_active[1]
end
#--------------------------------------------------------------------------
# ● Set Opacity
#--------------------------------------------------------------------------
def set_opacity(opac)
@layout.opacity = opac
@layout.opacity = opac
@parameter.opacity = opac
@parameter.opacity = opac
@hp_meter.opacity = opac
@hp_meter.opacity = opac
@mp_meter.opacity = opac
@mp_meter.opacity = opac
@face.opacity = opac
@face.opacity = opac
@name.opacity = opac
@name.opacity = opac
end
#--------------------------------------------------------------------------
# ● Refresh Index
#--------------------------------------------------------------------------
def refresh_index
refresh_arrow_type if @index == 0
@index_old = @com_index
set_index
refresh_visible
set_next_position
end
#--------------------------------------------------------------------------
# ● Set Next Position
#--------------------------------------------------------------------------
def set_next_position
if @max_index == 0
@next_pos = [0,0]
return
end
if @visible
if @index == @before_index[0]
@next_pos = [-32,-MEMBERS_SPACE]
if @layout.opacity < 150
set_position(@next_pos[0],-MEMBERS_SPACE * 2)
set_opacity(0)
end
elsif @index == @next_index[0]
@next_pos = [-32,MEMBERS_SPACE]
if @layout.opacity < 150
set_position(@next_pos[0],MEMBERS_SPACE * 2)
set_opacity(0)
end
else
@next_pos = [0,0]
end
else
@next_pos = [-64,0]
end
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
def set_position(pos_x,pos_y)
@layout.x = @org_pos[0] + pos_x
@layout.y = @org_pos[1] + pos_y
@parameter.x = @org_pos_par[0] + pos_x
@parameter.y = @org_pos_par[1] + pos_y
@hp_meter.x = @org_pos_hp[0] + pos_x
@hp_meter.y = @org_pos_hp[1] + pos_y
@mp_meter.x = @org_pos_mp[0] + pos_x
@mp_meter.y = @org_pos_mp[1] + pos_y
@face.x = @org_pos_face[0] + pos_x
@face.y = @org_pos_face[1] + pos_y
@name.x = @org_pos_name[0] + pos_x
@name.y = @org_pos_name[1] + pos_y
end
#--------------------------------------------------------------------------
# ● Refresh Active
#--------------------------------------------------------------------------
def refresh_active
@active_old = @active
@visible = @active
refresh_index
if !@active
@visible = @active
@next_pos = [[email]-@layout.width[/email] - 64,0]
else
set_position([email]-@layout.width[/email] - 64,0)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update(active,com_index)
@active = active
@com_index = com_index
refresh_active if @active != @active_old
update_opacity
update_position
update_support if @index == 0
return if !@active
refresh_index if @index_old != @com_index
return if !@active or !@visible
refresh_hp_meter if can_refresh_hp_meter?
refresh_mp_meter if can_refresh_mp_meter?
refresh_parameter if can_refresh_parameter?
end
#--------------------------------------------------------------------------
# ● Current Actor
#--------------------------------------------------------------------------
def current_actor
return true if @com_index == @index
return false
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Actor
#--------------------------------------------------------------------------
def execute_pre_cache_actor
@pre_cache_actor_menu = []
@pre_cache_actor_menu.push(Cache.menu("Actor_Layout_1"))
@pre_cache_actor_menu.push(Cache.menu("Actor_Layout_2"))
@pre_cache_actor_menu.push(Cache.menu("Actor_Number_1"))
@pre_cache_actor_menu.push(Cache.menu("Actor_Number_2"))
@pre_cache_actor_menu.push(Cache.menu("Actor_Scope_All"))
@pre_cache_actor_menu.push(Cache.menu("Actor_Members_Arrow"))
@pre_cache_actor_menu.push(Cache.menu("Actor_Meter"))
end
end
#==============================================================================
# ■ Actor Menu Status
#==============================================================================
class Actor_Menu_Status
include MOG_ACTOR_MENU_STATUS
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
@active = false
set_old_parameter
create_sprites
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
@parameter_number = $game_temp.pre_cache_actor_menu[3]
@parameter_cw = @parameter_number.width / 10
@parameter_ch = @parameter_number.height
create_layout
create_face
create_parameter
create_name
create_states
# update(true,@actor)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_layout
dispose_face
dispose_parameter
dispose_name
dispose_states
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Face
#--------------------------------------------------------------------------
def dispose_face
@face.bitmap.dispose if @face.bitmap != nil
@face.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Parameter
#--------------------------------------------------------------------------
def dispose_parameter
@parameter.bitmap.dispose
@parameter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
@name.bitmap.dispose
@name.dispose
end
#--------------------------------------------------------------------------
# ● Dispose States
#--------------------------------------------------------------------------
def dispose_states
return if @status == nil
@status.bitmap.dispose
@status.dispose
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
end
#--------------------------------------------------------------------------
# ● Set Old Parameter
#--------------------------------------------------------------------------
def set_old_parameter
@par = [] if @par == nil
@par.clear
@par = [@actor.hp,@actor.mhp,@actor.mp,@actor.mmp,@actor.atk,@actor.def,
@actor.mat,@actor.mdf,@actor.agi,@actor.luk,@actor.level,@actor.tp]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_actor_menu[1]
@org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
@layout.x = @org_pos[0] + 150
@layout.y = @org_pos[1]
@layout.z = 10
@layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Parameter
#--------------------------------------------------------------------------
def create_parameter
@parameter = Sprite.new
@parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
@org_pos_par = [@org_pos[0] + PAR_POSITION[0],
@org_pos[1] + PAR_POSITION[1]]
@parameter.x = @org_pos_par[0] + 150
@parameter.y = @org_pos_par[1]
@parameter.z = 11
@parameter.opacity = 0
refresh_parameter
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def create_face
@face = Sprite.new
@face.bitmap = Bitmap.new(96,96)
@org_pos_face = [@org_pos[0] + FACE_POSITION[0],
@org_pos[1] + FACE_POSITION[1]]
@face.x = @org_pos_face[0] + 150
@face.y = @org_pos_face[1]
@face.z = 11
@face.opacity = 0
refresh_face
end
#--------------------------------------------------------------------------
# ● Create Name
#--------------------------------------------------------------------------
def create_name
@name = Sprite.new
@name.bitmap = Bitmap.new(140,32)
@name.bitmap.font.name = FONT_NAME
@name.bitmap.font.size = FONT_SIZE
@name.bitmap.font.bold = FONT_BOLD
@org_pos_name = [@org_pos[0] + NAME_POSITION[0],
@org_pos[1] + NAME_POSITION[1]]
@name.x = @org_pos_name[0] + 150
@name.y = @org_pos_name[1]
@name.z = 11
@name.opacity = 0
refresh_name
end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
@status_old = nil
@status_flow = [-24,0]
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@org_pos_states = [@org_pos[0] + STATES_POSITION[0],
@org_pos[1] + STATES_POSITION[1]]
@status.x = @org_pos_states[0] + 150
@status.y = @org_pos_states[1]
@status.z = 11
end
#--------------------------------------------------------------------------
# * Refresh States
#--------------------------------------------------------------------------
def refresh_states
check_icon_image
@status_old = @actor.states
@status_flow = [0,0]
@actor_status.dispose if @actor_status != nil
@states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(26 * index , 0, @icon_image, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# * Flow_Status
#--------------------------------------------------------------------------
def flow_states
return if @actor_status == nil
@status.bitmap.clear
return if @actor.states.size == 0
st_src_rect = Rect.new(@status_flow[0],0, 24,24)
@status.bitmap.blt(0,0, @actor_status, st_src_rect)
if STATES_SCROLLING_ANIMATION
@status_flow[0] += 1
@status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
else
@status_flow[1] += 1 unless @actor.states.size <= 1
if @status_flow[1] > 30
@status_flow[1] = 0
@status_flow[0] += 26
@status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
end
end
end
#--------------------------------------------------------------------------
# * Check Icon Image
#--------------------------------------------------------------------------
def check_icon_image
if @icon_image == nil or @icon_image.disposed?
@icon_image = Cache.system("Iconset")
end
end
#--------------------------------------------------------------------------
# ● Can Refresh Parameter
#--------------------------------------------------------------------------
def can_refresh_parameter?
return false if !@active
return true if @par[0] != @actor.hp
return true if @par[1] != @actor.mhp
return true if @par[2] != @actor.mp
return true if @par[3] != @actor.mmp
return true if @par[4] != @actor.atk
return true if @par[5] != @actor.def
return true if @par[6] != @actor.mat
return true if @par[7] != @actor.mdf
return true if @par[8] != @actor.agi
return true if @par[9] != @actor.luk
return true if @par[10] != @actor.level
return true if @par[11] != @actor.tp
return false
end
#--------------------------------------------------------------------------
# ● Refresh All
#--------------------------------------------------------------------------
def refresh_all(actor)
@actor = actor
refresh_parameter
refresh_face
refresh_name
end
#--------------------------------------------------------------------------
# ● Refresh Name
#--------------------------------------------------------------------------
def refresh_name
@name.bitmap.clear
@name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def refresh_parameter
set_old_parameter
@parameter.bitmap.clear
value = @actor.level
x = 67
y = 24
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.tp
x = 140
y = 24
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.hp
x = 70
y = 46
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mhp
x = 140
y = 46
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mp
x = 70
y = 46 + 22 * 1
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mmp
x = 140
y = 46 + 22 * 1
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.atk
x = 70
y = 46 + 22 * 2
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.def
x = 70
y = 46 + 22 * 3
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.agi
x = 70
y = 46 + 22 * 4
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mat
x = 140
y = 46 + 22 * 2
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mdf
x = 140
y = 46 + 22 * 3
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.luk
x = 140
y = 46 + 22 * 4
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_number(sprite,image,value,number_cw,number_ch,x,y)
number = value.truncate.abs.to_s.split(//)
x2 = -number_cw * number.size
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
sprite.bitmap.blt(x + x2 + (number_cw * i), y, image, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Refresh Face
#--------------------------------------------------------------------------
def refresh_face
#return
@face.bitmap.clear
face_image = Cache.face(@actor.face_name)
arect = Rect.new(@actor.face_index % 4 * 96, @actor.face_index / 4 * 96, 96, 96)
@face.bitmap.blt(0,0, face_image, arect)
# face_image.dispose
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide
slide_speed = 10
opac_speed = 23
@slide_range = (@org_pos[0] + 150)
if @active
if @layout.x > @org_pos[0]
@layout.x -= slide_speed
@parameter.x -= slide_speed
@face.x -= slide_speed
@name.x -= slide_speed
@status.x -= slide_speed
@layout.opacity += opac_speed
@parameter.opacity += opac_speed
@face.opacity += opac_speed
@name.opacity += opac_speed
@status.opacity += opac_speed
if @layout.x <= @org_pos[0]
@layout.x = @org_pos[0]
@parameter.x = @org_pos_par[0]
@face.x = @org_pos_face[0]
@name.x = @org_pos_name[0]
@status.x = @org_pos_states[0]
@layout.opacity = 255
@parameter.opacity = 255
@face.opacity = 255
@name.opacity = 255
@status.opacity = 255
end
end
else
if @layout.x < @slide_range
@layout.x += slide_speed
@parameter.x += slide_speed
@face.x += slide_speed
@name.x += slide_speed
@status.x += slide_speed
@layout.opacity -= opac_speed
@parameter.opacity -= opac_speed
@face.opacity -= opac_speed
@name.opacity -= opac_speed
@status.opacity -= opac_speed
if @layout.x >= @slide_range
@layout.x = @slide_range
@parameter.x = @org_pos_par[0] + 150
@face.x = @org_pos_face[0] + 150
@name.x = @org_pos_name[0] + 150
@status.x = @org_pos_states[0] + 150
@layout.opacity = 0
@parameter.opacity = 0
@face.opacity = 0
@name.opacity = 0
@status.opacity = 0
end
end
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update(active,actor)
@active = active
update_slide
return if !@active
refresh_all(actor) if actor != @actor
refresh_parameter if can_refresh_parameter?
refresh_states if @status_old != @actor.states
flow_states
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Main Menu
#--------------------------------------------------------------------------
def execute_pre_cache_main_menu
@pre_cache_main_menu = []
@pre_cache_main_menu.push(Cache.menu_main("Background"))
@pre_cache_main_menu.push(Cache.menu_main("Layout"))
@pre_cache_main_menu.push(Cache.menu_main("Time_Number"))
@pre_cache_main_menu.push(Cache.menu_main("Gold_Number"))
@pre_cache_main_menu.push(Cache.menu_main("Members_Layout"))
@pre_cache_main_menu.push(Cache.menu_main("Members_Arrow"))
@pre_cache_main_menu.push(Cache.menu_main("Par_Number_1"))
@pre_cache_main_menu.push(Cache.menu_main("Par_Number_2"))
@pre_cache_main_menu.push(Cache.menu_main("Par_Meter"))
@pre_cache_main_menu.push(Cache.menu_main("Par_Layout"))
end
end
class Window_MenuCommand < Window_Command
# attr_accessor :handler
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
include MOG_MENU
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
$game_temp.execute_pre_cache_icon if $game_temp.can_pre_cache_icon?
@phase = 0
@members_windows_active = false
@members_index = 0
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Face Members
#==============================================================================
class Face_Members_Sprite < Sprite
include MOG_MENU
attr_accessor :index
attr_accessor :active
attr_accessor :actor_id
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil, index, actor_id)
super(viewport)
@active = false
@index = index
@actor_id = actor_id
@active = false
self.bitmap = Cache.menu("Face" + @actor_id.to_s)
self.z = 12
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
members_size = $game_party.members.size - 1
members_size = 3 if members_size > 3
space_base = (MEMBERS_FACE_SPACE * @index)
space = space_base - ((ACTOR_SPACE * members_size ) / 2) + MEMBERS_FACE_POSITION[0]
@org_pos = [space + self.ox , self.oy ]
@ny = 0
@zoom_duration = [0,0,false]
self.x = @org_pos[0]
self.y = @org_pos[1]
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
super
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_command(index, ny)
@active = index == @index ? true : false
@ny = ny
update_slide(index)
update_opacity
update_zoom
end
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_opacity
if @active
self.opacity += 12
else
self.opacity -= 6 if self.opacity > 120
end
end
#--------------------------------------------------------------------------
# ● Update Zoom
#--------------------------------------------------------------------------
def update_zoom
if @active
if !@zoom_duration[2]
update_zoom_out
@zoom_duration = [0,0,true] if self.zoom_x == 1.00
else
update_zoom_effect
end
else
@zoom_duration[2] = false
update_zoom_in
end
end
#--------------------------------------------------------------------------
# ● Update Zoom Out
#--------------------------------------------------------------------------
def update_zoom_out
return if self.zoom_x == 1.00
self.zoom_x += 0.03
self.zoom_y += 0.03
if self.zoom_x >= 1.00
self.zoom_x = 1.00
self.zoom_y = 1.00
end
end
#--------------------------------------------------------------------------
# ● Update Zoom In
#--------------------------------------------------------------------------
def update_zoom_in
return if self.zoom_x == 0.80
self.zoom_x -= 0.03
self.zoom_y -= 0.03
if self.zoom_x <= 0.80
self.zoom_x = 0.80
self.zoom_y = 0.80
end
end
#--------------------------------------------------------------------------
# ● Update Zoom_effect
#--------------------------------------------------------------------------
def update_zoom_effect
@zoom_duration[0] += 1
return if @zoom_duration[0] < 1
@zoom_duration[0] = 0
@zoom_duration[1] += 1
case @zoom_duration[1]
when 1..30
self.zoom_x -= 0.005
self.zoom_y -= 0.005
when 31..60
self.zoom_x += 0.005
self.zoom_y += 0.005
when 61..999
@zoom_duration[1] = 0
self.zoom_x = 1.00
self.zoom_y = 1.00
end
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(index)
np = @org_pos[0] - (index * MEMBERS_FACE_SPACE) + @ny
cp = self.x
sp = 5 + ((cp - np).abs / 5)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
self.x = cp
end
#--------------------------------------------------------------------------
# ● Active
#--------------------------------------------------------------------------
def active(value)
@active = value
end
end
#==============================================================================
# ■ Members Arrow Sprite
#==============================================================================
class Members_Arrow_Sprite
include MOG_MENU
attr_accessor :active
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@active = false
create_members_layout
create_arrows
end
#--------------------------------------------------------------------------
# ● Create Members Layout
#--------------------------------------------------------------------------
def create_members_layout
@layout_members = Sprite.new
@layout_members.bitmap = $game_temp.pre_cache_main_menu[4]
@layout_members.z = 13
@layout_members_pos = [MEMBERS_ARROW_LAYOUT_POSITION[0], MEMBERS_ARROW_LAYOUT_POSITION[1]]
@layout_members.x = @layout_members_pos[0]
@layout_members.y = @layout_members_pos[1]
@layout_members.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Arrows
#--------------------------------------------------------------------------
def create_arrows
@arrow_animation_duration = [0,0]
@arrow_1 = Sprite.new
@arrow_1.bitmap = $game_temp.pre_cache_main_menu[5]
@arrow_1.z = 13
@arrow1_pos = [MEMBERS_ARROW_1_POSITION[0], MEMBERS_ARROW_1_POSITION[1]]
@arrow_1.x = @arrow1_pos[0]
@arrow_1.y = @arrow1_pos[1]
@arrow_1.opacity = 0
@arrow_2 = Sprite.new
@arrow_2.bitmap = $game_temp.pre_cache_main_menu[5]
@arrow_2.z = 13
@arrow_2.mirror = true
@arrow2_pos = [MEMBERS_ARROW_2_POSITION[0], MEMBERS_ARROW_2_POSITION[1]]
@arrow_2.x = @arrow2_pos[0]
@arrow_2.y = @arrow2_pos[1]
@arrow_2.opacity = 0
@nx = 0
@nx2 = 0
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_members_layout
dispose_arrows
end
#--------------------------------------------------------------------------
# ● Dispose Arrows
#--------------------------------------------------------------------------
def dispose_arrows
return if @arrow_1 == nil
@arrow_1.dispose
@arrow_2.dispose
@arrow_1 = nil
end
#--------------------------------------------------------------------------
# ● Dispose Members Layout
#--------------------------------------------------------------------------
def dispose_members_layout
return if @layout_members == nil
@layout_members.dispose
@layout_members = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_arrow_animation
update_position
@layout_members.opacity += 15
@arrow_1.opacity += 15
@arrow_2.opacity += 15
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
def update_position
@arrow_1.x = @arrow1_pos[0] + @nx + @nx2
@arrow_2.x = @arrow2_pos[0] + @nx - @nx2
@layout_members.x = @layout_members_pos[0] + @nx
end
#--------------------------------------------------------------------------
# ● Update Arrow Animation
#--------------------------------------------------------------------------
def update_arrow_animation
@arrow_animation_duration[0] += 1
return if @arrow_animation_duration[0] < 2
@arrow_animation_duration[0] = 0
@arrow_animation_duration[1] += 1
case @arrow_animation_duration[1]
when 1..20
@nx2 -= 1
when 21..40
@nx2 += 1
when 41..999
@nx2 = 0
@arrow_animation_duration[1] = 0
end
end
#--------------------------------------------------------------------------
# ● Active
#--------------------------------------------------------------------------
def nx(value)
@nx = value
end
end
#==============================================================================
# ■ Command Menu Sprite
#==============================================================================
class Command_Menu_Sprite < Sprite
include MOG_MENU
attr_accessor :index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil,index,command_name)
super(viewport)
@index = index
@command_name = command_name
self.bitmap = Cache.menu_main("CM_" + @command_name.to_s)
@cw = self.bitmap.width
@ch = self.bitmap.height
cw1 = self.bitmap.height / 2
cw2 = (self.bitmap.width + COMMAND_SPACE) * index
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
@org_pos = [COMMAND_POSITION[0] + cw2 + self.ox, COMMAND_POSITION[1] + self.oy]
@slide_max = @org_pos[1] + cw1
@zoom_duration = [0,0,false]
@zoom_limit = [1.00, 1.20]
self.x = -@cw
self.y = -@ch
self.z = 10
@active = false
@visible_old = true
@np = [-@cw,-@ch]
@sprite_name = Sprite.new
@sprite_name.bitmap = Bitmap.new(100,32)
@sprite_name.bitmap.font.name = "Georgia"
@sprite_name.bitmap.draw_text(0,0,100,32,@command_name.to_s,0)
@sprite_name.z = 11
@np_name = [-@cw,-@ch]
@cw_name_pos = [@cw - self.ox + 4, -self.oy + 4]
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose_command
self.bitmap.dispose
@sprite_name.bitmap.dispose
@sprite_name.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_command(index, visible)
@active = index == @index ? true : false
refresh_active(visible) if @visible_old != visible
update_position
if !visible
if @active
self.opacity += 15
else
self.opacity -= 15
end
return
end
update_zoom
update_opacity
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,cp,np)
sp = 2 + ((cp - np).abs / 15)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
self.x = cp if type == 0
self.y = cp if type == 1
@sprite_name.x = cp if type == 2
@sprite_name.y = cp if type == 3
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
def update_position
unless !@visible_old
if @active
@np[0] = @org_pos[0]
@np[1] = @slide_max
else
@np[0] = @org_pos[0]
@np[1] = @org_pos[1]
end
end
update_slide(0,self.x,@np[0])
update_slide(1,self.y,@np[1])
update_sprite_name_position
end
#--------------------------------------------------------------------------
# ● Update Sprite Name Position
#--------------------------------------------------------------------------
def update_sprite_name_position
if (@active and !@visible_old) or !@active
@np_name[0] = self.x + @cw_name_pos[0] + COMMAND_NAME_POSITION[0]
@np_name[1] = self.y + @cw_name_pos[1] + COMMAND_NAME_POSITION[1]
else
@np_name[0] = COMMAND_NAME_POSITION_2[0]
@np_name[1] = COMMAND_NAME_POSITION_2[1]
end
update_slide(2,@sprite_name.x,@np_name[0])
update_slide(3,@sprite_name.y,@np_name[1])
@sprite_name.visible = @active ? true : false
end
#--------------------------------------------------------------------------
# ● Refresh Active
#--------------------------------------------------------------------------
def refresh_active(visible)
if @active and !visible
@np[0] = COMMAND_POSITION_2[0] + (@cw / 2)
@np[1] = COMMAND_POSITION_2[1]
self.zoom_x = @zoom_limit[0]
self.zoom_y = @zoom_limit[0]
else
@np[0] = @org_pos[0]
@np[1] = @org_pos[1]
end
@visible_old = visible
end
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_opacity
if @active
self.opacity += 15
else
self.opacity -= 15 if self.opacity > 160
if self.opacity < 160
self.opacity += 15
self.opacity = 160 if self.opacity > 160
end
end
end
#--------------------------------------------------------------------------
# ● Update Zoom
#--------------------------------------------------------------------------
def update_zoom
if @active
if !@zoom_duration[2]
update_zoom_out
@zoom_duration = [0,0,true] if self.zoom_x == @zoom_limit[1]
else
update_zoom_effect
end
else
@zoom_duration[2] = false
update_zoom_in
end
end
#--------------------------------------------------------------------------
# ● Update Zoom Out
#--------------------------------------------------------------------------
def update_zoom_out
return if self.zoom_x == @zoom_limit[1]
self.zoom_x += 0.03
self.zoom_y += 0.03
if self.zoom_x >= @zoom_limit[1]
self.zoom_x = @zoom_limit[1]
self.zoom_y = @zoom_limit[1]
end
end
#--------------------------------------------------------------------------
# ● Update Zoom In
#--------------------------------------------------------------------------
def update_zoom_in
return if self.zoom_x == @zoom_limit[0]
self.zoom_x -= 0.03
self.zoom_y -= 0.03
if self.zoom_x <= @zoom_limit[0]
self.zoom_x = @zoom_limit[0]
self.zoom_y = @zoom_limit[0]
end
end
#--------------------------------------------------------------------------
# ● Update Zoom_effect
#--------------------------------------------------------------------------
def update_zoom_effect
@zoom_duration[0] += 1
return if @zoom_duration[0] < 1
@zoom_duration[0] = 0
@zoom_duration[1] += 1
case @zoom_duration[1]
when 1..30
self.zoom_x -= 0.005
self.zoom_y -= 0.005
when 31..60
self.zoom_x += 0.005
self.zoom_y += 0.005
when 61..999
@zoom_duration[1] = 0
self.zoom_x = @zoom_limit[1]
self.zoom_y = @zoom_limit[1]
end
end
end
#==============================================================================
# ■ Actor Menu Pictures
#==============================================================================
class Actor_Menu_Pictures < Sprite
include MOG_MENU
attr_accessor :index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil,index,actor_id)
super(viewport)
@index = index
@actor_id = actor_id
self.bitmap = Cache.menu("Actor" + @actor_id.to_s)
self.z = 2
set_position
@slide_max = @org_pos[0] + 24
auto_y = Graphics.height - self.bitmap.height
self.ox = self.bitmap.width / 2
self.x = @org_pos[0] - 15
self.y = auto_y
self.opacity = 0
@op_time = 10 * @index
end
#--------------------------------------------------------------------------
# ● Set Position
#--------------------------------------------------------------------------
def set_position
members_size = $game_party.members.size
members_size = $game_party.max_battle_members if members_size > $game_party.max_battle_members
space_members = ((Graphics.width ) / members_size)
space_members_2 = (space_members * @index)
space_members_3 = ((space_members / 2) * (members_size - 1))
center = Graphics.width / 2
space = center + space_members_2 - space_members_3
@org_pos = [space, ACTOR_POSITION[1]]
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose_picture
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Update Picture
#--------------------------------------------------------------------------
def update_picture
@op_time -= 1 if @op_time > 0
return if @op_time > 0
self.opacity += 15
self.x += 1 if self.x < @org_pos[0]
end
end
#==============================================================================
# ■ Actor Menu Parameter
#==============================================================================
class Actor_Menu_Parameter
include MOG_MENU
attr_accessor :index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(index, actor)
setup(index, actor)
create_layout_par
create_hp_number
create_hp2_number
create_mp_number
create_mp2_number
create_hp_meter
create_mp_meter
create_level
create_states
create_name
end
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
def setup(index, actor)
@actor = actor
@index = index
set_position
@number_image_1 = $game_temp.pre_cache_main_menu[6]
@number_image_1_cw = @number_image_1.width / 10
@number_image_1_ch = @number_image_1.height / 3
@number_image_2 = $game_temp.pre_cache_main_menu[7]
@number_image_2_cw = @number_image_2.width / 10
@number_image_2_ch = @number_image_2.height
@par_meter_image = $game_temp.pre_cache_main_menu[8]
@par_meter_cw = @par_meter_image.width / 3
@par_meter_ch = @par_meter_image.height / 2
@par_meter_flow = 0
@par_meter_flow_max = @par_meter_image.width - @par_meter_cw
@icon_image = $game_temp.pre_cache_icon
end
#--------------------------------------------------------------------------
# ● Set Position
#--------------------------------------------------------------------------
def set_position
members_size = $game_party.members.size
members_size = $game_party.max_battle_members if members_size >= $game_party.max_battle_members
space_members = ((Graphics.width ) / members_size)
space_members_2 = (space_members * @index)
space_members_3 = ((space_members / 2) * (members_size - 1))
center = Graphics.width / 2
layout_ox = $game_temp.pre_cache_main_menu[9].width / 2
@base_x = center - layout_ox + space_members_2 - space_members_3
end
#--------------------------------------------------------------------------
# ● Create Layout Par
#--------------------------------------------------------------------------
def create_layout_par
@layout_par = Sprite.new
@layout_par.bitmap = $game_temp.pre_cache_main_menu[9]
@layout_par.z = 10
@layout_par.x = @base_x + ACTOR_LAYOUT_POSITON[0]
@layout_par.y = ACTOR_LAYOUT_POSITON[1]
end
#--------------------------------------------------------------------------
# ● Create Name
#--------------------------------------------------------------------------
def create_name
@actor_name = Sprite.new
@actor_name.bitmap = Bitmap.new(160,32)
@actor_name.bitmap.font.name = "Georgia"
@actor_name.bitmap.font.size = 18
@actor_name.bitmap.font.bold = true
@actor_name.bitmap.font.italic = true
actor_name = @actor.name
@actor_name.bitmap.font.color = Color.new(0,0,0)
@actor_name.bitmap.draw_text(1,1,140,32,actor_name,1)
@actor_name.bitmap.font.color = Color.new(255 ,255,255)
@actor_name.bitmap.draw_text(0,0,140,32,actor_name,1)
@actor_name.z = 12
@actor_name.x = @base_x - 20
@actor_name.y = 250
end
#--------------------------------------------------------------------------
# ● Create HP Number
#--------------------------------------------------------------------------
def create_hp_number
@hp_number = Sprite.new
@hp_number.bitmap = Bitmap.new(@number_image_1_cw * 4,@number_image_1_ch)
@hp_number.z = 12
@hp_number.x = @base_x + ACTOR_HP1_POSITON[0]
@hp_number.y = ACTOR_HP1_POSITON[1]
refresh_hp
end
#--------------------------------------------------------------------------
# ● Refresh HP
#--------------------------------------------------------------------------
def refresh_hp
@hp_number.bitmap.clear
number = @actor.hp.abs.to_s.split(//)
number_cw = @number_image_1_cw
number_ch = @number_image_1_ch
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
@hp_number.bitmap.blt(number_cw * i, 0, @number_image_1, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create HP2 Number
#--------------------------------------------------------------------------
def create_hp2_number
@hp2_number = Sprite.new
@hp2_number.bitmap = Bitmap.new(@number_image_2_cw * 4,@number_image_2_ch)
@hp2_number.z = 12
@hp2_number.x = @base_x + ACTOR_HP2_POSITON[0]
@hp2_number.y = ACTOR_HP2_POSITON[1]
refresh_hp2
end
#--------------------------------------------------------------------------
# ● Refresh HP2
#--------------------------------------------------------------------------
def refresh_hp2
@hp2_number.bitmap.clear
number = @actor.mhp.abs.to_s.split(//)
number_cw = @number_image_2_cw
number_ch = @number_image_2_ch
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
@hp2_number.bitmap.blt(number_cw * i, 0, @number_image_2, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create MP Number
#--------------------------------------------------------------------------
def create_mp_number
@mp_number = Sprite.new
@mp_number.bitmap = Bitmap.new(@number_image_1_cw * 4,@number_image_1_ch)
@mp_number.z = 12
@mp_number.x = @base_x + ACTOR_MP1_POSITON[0]
@mp_number.y = ACTOR_MP1_POSITON[1]
refresh_mp
end
#--------------------------------------------------------------------------
# ● Refresh MP
#--------------------------------------------------------------------------
def refresh_mp
@mp_number.bitmap.clear
number = @actor.mp.abs.to_s.split(//)
number_cw = @number_image_1_cw
number_ch = @number_image_1_ch
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
@mp_number.bitmap.blt(number_cw * i, 0, @number_image_1, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create MP2 Number
#--------------------------------------------------------------------------
def create_mp2_number
@mp2_number = Sprite.new
@mp2_number.bitmap = Bitmap.new(@number_image_2_cw * 4,@number_image_2_ch)
@mp2_number.z = 12
@mp2_number.x = @base_x + ACTOR_MP2_POSITON[0]
@mp2_number.y = ACTOR_MP2_POSITON[1]
refresh_mp2
end
#--------------------------------------------------------------------------
# ● Refresh MP2
#--------------------------------------------------------------------------
def refresh_mp2
@mp2_number.bitmap.clear
number = @actor.mmp.abs.to_s.split(//)
number_cw = @number_image_2_cw
number_ch = @number_image_2_ch
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
@mp2_number.bitmap.blt(number_cw * i, 0, @number_image_2, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create Level
#--------------------------------------------------------------------------
def create_level
@level = Sprite.new
@level.bitmap = Bitmap.new(@number_image_1_cw * 2, @number_image_1_ch)
@level.z = 12
@level.x = @base_x + ACTOR_LEVEL_POSITON[0]
@level.y = ACTOR_LEVEL_POSITON[1]
refresh_level
end
#--------------------------------------------------------------------------
# ● Refresh Level
#--------------------------------------------------------------------------
def refresh_level
@level.bitmap.clear
number = @actor.level.abs.to_s.split(//)
number_cw = @number_image_1_cw
number_ch = @number_image_1_ch
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, number_ch * 2, number_cw , number_ch)
@level.bitmap.blt(number_cw * i, 0, @number_image_1, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create HP Meter
#--------------------------------------------------------------------------
def create_hp_meter
@hp_meter = Sprite.new
@hp_meter.bitmap = Bitmap.new(@par_meter_cw,@par_meter_ch)
@hp_meter.z = 11
@hp_meter.x = @base_x + ACTOR_HP_METER_POSITON[0]
@hp_meter.y = ACTOR_HP_METER_POSITON[1]
update_flow_hp
end
#--------------------------------------------------------------------------
# ● Update Flow HP
#--------------------------------------------------------------------------
def update_flow_hp
@hp_meter.bitmap.clear
par_width = @par_meter_cw * @actor.hp / @actor.mhp
m_scr = Rect.new(@par_meter_flow,0, par_width, @par_meter_ch)
@hp_meter.bitmap.blt(0,0,@par_meter_image, m_scr)
end
#--------------------------------------------------------------------------
# ● Create MP Meter
#--------------------------------------------------------------------------
def create_mp_meter
@mp_meter = Sprite.new
@mp_meter.bitmap = Bitmap.new(@par_meter_cw,@par_meter_ch)
@mp_meter.z = 11
@mp_meter.x = @base_x + ACTOR_MP_METER_POSITON[0]
@mp_meter.y = ACTOR_MP_METER_POSITON[1]
update_flow_mp
end
#--------------------------------------------------------------------------
# ● Update Flow MP
#--------------------------------------------------------------------------
def update_flow_mp
@mp_meter.bitmap.clear
par_width = @par_meter_cw * @actor.mp / @actor.mmp rescue nil
par_width = 0 if par_width == nil
m_scr = Rect.new(@par_meter_flow,@par_meter_ch, par_width, @par_meter_ch)
@mp_meter.bitmap.blt(0,0,@par_meter_image, m_scr)
@par_meter_flow += 3
@par_meter_flow = 0 if @par_meter_flow > @par_meter_flow_max
end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
refresh_states
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@status.x = @base_x + ACTOR_STATES_POSITION[0]
@status.y = ACTOR_STATES_POSITION[1]
@status_flow = -24
@states_speed = 50
@status.z = 503
@old_states = @actor.states
refresh_states
update_flow_states
end
#--------------------------------------------------------------------------
# ● Upate Flow_Status
#--------------------------------------------------------------------------
def update_flow_states
return if @actor.states.size == 0 and !@status.visible
@states_speed = 0
@status.bitmap.clear
src_rect = Rect.new(@status_flow,0, 24,24)
@status.bitmap.blt(0,0, @actor_status, src_rect)
@status.visible = @actor.states.size == 0 ? false : true
@status_flow += 1
@status_flow = -24 if @status_flow >= @states_size - 24
end
#--------------------------------------------------------------------------
# ● Refresh States
#--------------------------------------------------------------------------
def refresh_states
@old_states = @actor.states
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
@states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(48 * index , 0, @icon_image, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_flow_hp
update_flow_mp
update_flow_states
end
end
#==============================================================================
# ■ Actor Menu Parameter
#==============================================================================
class Actor_Menu_Parameter
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_actor_layout_par
dispose_name
dispose_hp_number
dispose_mp_number
dispose_hp_meter
dispose_mp_meter
dispose_states
dispose_level
end
#--------------------------------------------------------------------------
# ● Dispose Actor Layout Par
#--------------------------------------------------------------------------
def dispose_actor_layout_par
return if @layout_par == nil
@layout_par.dispose
@layout_par = nil
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
return if @actor_name == nil
@actor_name.bitmap.dispose
@actor_name.dispose
@actor_name = nil
end
#--------------------------------------------------------------------------
# ● Dispose HP Number
#--------------------------------------------------------------------------
def dispose_hp_number
return if @hp_number == nil
@hp_number.bitmap.dispose
@hp_number.dispose
@hp_number = nil
@hp2_number.bitmap.dispose
@hp2_number.dispose
@hp2_number = nil
end
#--------------------------------------------------------------------------
# ● Dispose MP Number
#--------------------------------------------------------------------------
def dispose_mp_number
return if @mp_number == nil
@mp_number.bitmap.dispose
@mp_number.dispose
@mp_number = nil
@mp2_number.bitmap.dispose
@mp2_number.dispose
@mp2_number = nil
end
#--------------------------------------------------------------------------
# ● Dispose States
#--------------------------------------------------------------------------
def dispose_states
return if @status == nil
@status.bitmap.dispose
@status.dispose
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
end
#--------------------------------------------------------------------------
# ● Dispose MP Meter
#--------------------------------------------------------------------------
def dispose_mp_meter
return if @mp_meter == nil
@mp_meter.bitmap.dispose
@mp_meter.dispose
@mp_meter = nil
end
#--------------------------------------------------------------------------
# ● Dispose HP Meter
#--------------------------------------------------------------------------
def dispose_hp_meter
return if @hp_meter == nil
@hp_meter.bitmap.dispose
@hp_meter.dispose
@hp_meter = nil
end
#--------------------------------------------------------------------------
# ● Dispose Level
#--------------------------------------------------------------------------
def dispose_level
return if @level == nil
@level.bitmap.dispose
@level.dispose
@level = nil
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_command
create_actor_pictures
create_timer_sprite
create_gold_number
create_location
create_actor_parameter
create_members
create_members_layout
update_members_face
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_main_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_main_menu[1]
@layout.z = 3
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Create Command
#--------------------------------------------------------------------------
def create_command
create_command_window
@command_window.visible = false
@command_window.x -=544
@command_max = @command_window.list.size
@commnad_name = []
index = 0
for i in @command_window.list
@commnad_name.push(i[:name])
index += 1
end
@command_scroll_max = @command_max > 6 ? 6 : @command_max
@command_ny = 0
@command_sprites = []
index = 0
for i in 0...@command_max
@command_sprites.push(Command_Menu_Sprite.new(nil, index,@commnad_name[index]) )
index += 1
end
end
#--------------------------------------------------------------------------
# ● Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:skill, method(:command_personal))
@command_window.set_handler(:equip, method(:command_personal))
@command_window.set_handler(:status, method(:command_personal))
@command_window.set_handler(:formation, method(:command_formation))
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.index = $game_temp.menu_index
end
#--------------------------------------------------------------------------
# ● Create Actor Pictures
#--------------------------------------------------------------------------
def create_actor_pictures
@actor_pictures = []
members_size = $game_party.members.size
members_size = $game_party.max_battle_members if members_size >= $game_party.max_battle_members
for i in 0...members_size
@actor_pictures.push(Actor_Menu_Pictures.new(nil,i,$game_party.members[i].id))
end
end
#--------------------------------------------------------------------------
# ● Create Timer Number
#--------------------------------------------------------------------------
def create_timer_sprite
update_timer
@min_old = @min
@timer_image = $game_temp.pre_cache_main_menu[2]
@timer_cw = @timer_image.width / 10
@timer_ch = @timer_image.height
@timer_sprite = Sprite.new
@timer_sprite.bitmap = Bitmap.new(@timer_image.width ,@timer_image.height)
@timer_sprite.z = 11
@timer_sprite.x = TIME_NUMBER_POS[0]
@timer_sprite.y = TIME_NUMBER_POS[1]
refresh_timer
end
#--------------------------------------------------------------------------
# ● Create Gold Number
#--------------------------------------------------------------------------
def create_gold_number
@gold = $game_party.gold
@gold_image = $game_temp.pre_cache_main_menu[3]
@gold_cw = @gold_image.width / 10
@gold_ch = @gold_image.height
@gold_sprite = Sprite.new
@gold_sprite.bitmap = Bitmap.new(@gold_image.width ,@gold_image.height)
@gold_sprite.z = 11
@gold_sprite.x = GOLD_NUMBER_POS[0]
@gold_sprite.y = GOLD_NUMBER_POS[1]
refresh_gold
end
#--------------------------------------------------------------------------
# ● Create Location
#--------------------------------------------------------------------------
def create_location
@location = Sprite.new
@location.bitmap = Bitmap.new(200,40)
@location.bitmap.font.name = "Georgia"
@location.bitmap.font.size = 20
@location.bitmap.font.bold = true
@location.bitmap.font.italic = true
@location.z = 12
@location.x = LOCATION_POS[0]
@location.y = LOCATION_POS[1]
refresh_location
end
#--------------------------------------------------------------------------
# ● Refresh Location
#--------------------------------------------------------------------------
def refresh_location
location_name = $game_map.display_name
@location.bitmap.clear
@location.bitmap.font.color = Color.new(120,120,120,120)
@location.bitmap.draw_text(6,4,190,32, location_name.to_s,2)
@location.bitmap.font.color = Color.new(255,255,255)
@location.bitmap.draw_text(0,0,190,32, location_name.to_s,2)
end
#--------------------------------------------------------------------------
# ● Create Actor Parameter
#--------------------------------------------------------------------------
def create_actor_parameter
@actor_par = []
members_size = $game_party.members.size
members_size = $game_party.max_battle_members if members_size >= $game_party.max_battle_members
for i in 0...members_size
@actor_par.push(Actor_Menu_Parameter.new(i,$game_party.members[i]))
end
end
#--------------------------------------------------------------------------
# ● Create Members
#--------------------------------------------------------------------------
def create_members
@members_viewport = Viewport.new(MEMBERS_FACE_POSITION[0],MEMBERS_FACE_POSITION[1],400,96)
@members_viewport.z = 12
@members_viewport.ox = -544
@members_slide_max = (MEMBERS_FACE_POSITION[0] - 544)
@members = []
for i in 0...$game_party.members.size
@members.push(Face_Members_Sprite.new(@members_viewport,i, $game_party.members[i].id))
end
end
#--------------------------------------------------------------------------
# ● Create Members Layout
#--------------------------------------------------------------------------
def create_members_layout
@members_layout = Members_Arrow_Sprite.new
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_particles
dispose_command_sprites
dispose_actor_sprites
dispose_actor_parameter
dispose_timer_sprite
dispose_gold_number
dispose_location
dispose_members
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
# @background.bitmap.dispose
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
# @layout.bitmap.dispose
@layout.dispose
@layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Command Sprites
#--------------------------------------------------------------------------
def dispose_command_sprites
return if @command_sprites == nil
@command_sprites.each {|sprite| sprite.dispose_command }
@command_sprites = nil
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Actor Sprites
#--------------------------------------------------------------------------
def dispose_actor_sprites
return if @actor_pictures == nil
@actor_pictures.each {|sprite| sprite.dispose_picture }
@actor_pictures = nil
end
#--------------------------------------------------------------------------
# ● Dispose timer Sprite
#--------------------------------------------------------------------------
def dispose_timer_sprite
return if @timer_sprite == nil
@timer_sprite.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Gold Number
#--------------------------------------------------------------------------
def dispose_gold_number
return if @gold_image == nil
@gold_sprite.dispose
@gold_sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Location
#--------------------------------------------------------------------------
def dispose_location
return if @location == nil
@location.bitmap.dispose
@location.dispose
@location = nil
end
#--------------------------------------------------------------------------
# ● Dispose Actor Parameter
#--------------------------------------------------------------------------
def dispose_actor_parameter
return if @actor_par == nil
@actor_par.each {|sprite| sprite.dispose }
@actor_par = nil
end
#--------------------------------------------------------------------------
# ● Dispose Members
#--------------------------------------------------------------------------
def dispose_members
return if @members == nil
@members.each {|sprite| sprite.dispose }
@members = nil
@members_layout.dispose
@members_viewport.dispose
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_background
update_particles
update_command_sprites
update_actor_parameter
update_actor_sprites
update_members_face
refresh_timer if @min_old != @min
refresh_gold if @gold != $game_party.gold
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Command Sprites
#--------------------------------------------------------------------------
def update_command_sprites
return if @command_window == nil
visible = @phase == 0 ? true : false
@command_sprites.each {|sprite| sprite.update_command(@command_window.index,visible) }
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_timer
@min_old = @min
@timer_sprite.bitmap.clear
draw_number(@timer_cw * 1,0,0) if @hour < 10
draw_number(@timer_cw * 2,0,@hour)
draw_number(@timer_cw * 4,0,0) if @min < 10
draw_number(@timer_cw * 5,0,@min)
end
#--------------------------------------------------------------------------
# ● Draw Number
#--------------------------------------------------------------------------
def draw_number(x,y,value)
@number_text = value.abs.to_s.split(//)
plus_x = -@timer_cw * @number_text.size
for r in [email]0..@number_text.size[/email] - 1
@number_abs = @number_text[r].to_i
nsrc_rect = Rect.new(@timer_cw * @number_abs, 0, @timer_cw, @timer_ch)
@timer_sprite.bitmap.blt(plus_x + x + (@timer_cw * r), y, @timer_image, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update_timer
time = $game_system.playtime
@hour = time / 60 / 60
@min = time / 60 % 60
@sec = time % 60
end
#--------------------------------------------------------------------------
# ● Refresh Gold
#--------------------------------------------------------------------------
def refresh_gold
@gold = $game_party.gold
@gold_sprite.bitmap.clear
value_text = @gold.abs.to_s.split(//)
index = 0
for i in 0..value_text.size - 1
value_abs = value_text[i].to_i
nsrc_rect = Rect.new(@gold_cw * value_abs, 0, @gold_cw, @gold_ch)
@gold_sprite.bitmap.blt(@gold_cw * i, 0, @gold_image, nsrc_rect)
index += 1
end
ey = (index * @gold_cw)
@gold_sprite.x = GOLD_NUMBER_POS[0] - ey
end
#--------------------------------------------------------------------------
# ● Update Actor Parameter
#--------------------------------------------------------------------------
def update_actor_parameter
return if @actor_par == nil
@actor_par.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Actor Sprites
#--------------------------------------------------------------------------
def update_actor_sprites
return if @actor_pictures == nil
@actor_pictures.each {|sprite| sprite.update_picture }
end
#--------------------------------------------------------------------------
# ● Update Members Face
#--------------------------------------------------------------------------
def update_members_face
return if @members == nil or @members == 0
if @members_index > 4
ny = (5 * 64)
else
ny = 64 * @members_index
end
@members.each {|sprite| sprite.update_command(@members_index, ny) }
@members_layout.update
if @members_windows_active
if @members_viewport.ox < 0
@members_viewport.ox += 25
end
else
if @members_viewport.ox > -544
@members_viewport.ox -= 25
end
end
@members_layout.nx(@members_viewport.ox)
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_timer
update_sprites
update_command
@members_windows_active = @phase == 100 ? true : false
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
case @phase
when 0; update_main_command
when 100; update_select_members
end
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def update_main_command
if Input.trigger?(:UP) or Input.trigger?(:LEFT)
move_command_index(-1)
elsif Input.trigger?(:DOWN) or Input.trigger?(:RIGHT)
move_command_index(1)
elsif Input.trigger?(:C)
execute_select
elsif Input.trigger?(:B)
return_to_map
end
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def move_command_index(value)
Sound.play_cursor
@command_window.index += value
@command_window.index = 0 if @command_window.index >= @command_max
@command_window.index = (@command_max - 1) if @command_window.index < 0
end
#--------------------------------------------------------------------------
# ● Execute Select
#--------------------------------------------------------------------------
def execute_select
@phase = @command_window.index
$game_temp.menu_index = @phase
Sound.play_ok
$game_temp.pre_symbol = @command_window.current_symbol
@command_window.call_handler(@command_window.current_symbol)
end
#--------------------------------------------------------------------------
# ● Update Select Members
#--------------------------------------------------------------------------
def update_select_members
if $game_party.members.size == 0
execute_cancel
return
end
if Input.trigger?(:LEFT)
move_members_index(-1)
elsif Input.trigger?(:RIGHT)
move_members_index(1)
elsif Input.trigger?(:C)
execute_select_members
elsif Input.trigger?(:B)
execute_cancel
end
end
#--------------------------------------------------------------------------
# ● Execute Cancel
#--------------------------------------------------------------------------
def execute_cancel
Sound.play_cancel
@phase = 0
@members_index = 0
end
#--------------------------------------------------------------------------
# ● Move Members Index
#--------------------------------------------------------------------------
def move_members_index(value)
Sound.play_cursor
@members_index += value
@members_index = 0 if @members_index >= $game_party.members.size
@members_index = ($game_party.members.size - 1) if @members_index < 0
end
#--------------------------------------------------------------------------
# ● Command Formation
#--------------------------------------------------------------------------
def command_formation
SceneManager.call(Scene_Party)
end
#--------------------------------------------------------------------------
# ● Can Access Scene
#--------------------------------------------------------------------------
def can_access_scene?
if $game_party.members.size == 0
#Sound.play_buzzer
execute_cancel
return false
end
return true
end
#--------------------------------------------------------------------------
# ● Execute Select Members
#--------------------------------------------------------------------------
def execute_select_members
@phase = @command_window.index
$game_temp.menu_index = @phase
Sound.play_ok
on_personal_ok
end
#--------------------------------------------------------------------------
# ● ON Personal OK
#--------------------------------------------------------------------------
alias mog_monogatari_on_personal_ok on_personal_ok
def on_personal_ok
$game_temp.actor_menu_temp = $game_party.members[@members_index]
$game_party.menu_actor = $game_party.members[@members_index]
mog_monogatari_on_personal_ok
end
#--------------------------------------------------------------------------
# ● Return To Map
#--------------------------------------------------------------------------
def return_to_map
$game_temp.menu_index = 0
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● Command Personal
#--------------------------------------------------------------------------
def command_personal
@phase = 100
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Item Menu
#--------------------------------------------------------------------------
def execute_pre_cache_item_menu
@pre_cache_item_menu = []
@pre_cache_item_menu.push(Cache.menu_item("Background"))
@pre_cache_item_menu.push(Cache.menu_item("Layout"))
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Item
include MOG_MENU_ITEM
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
@phase = 0
@command_index = 0
@actor = $game_party.members[0]
@wait_time = 0
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Window_ItemList Z
#==============================================================================
class Window_ItemList_Z < Window_Selectable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data = []
end
#--------------------------------------------------------------------------
# ● Category
#--------------------------------------------------------------------------
def category=(category)
return if @category == category
@category = category
self.oy = 0
end
#--------------------------------------------------------------------------
# ● Col Max
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● Current Item Enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# ● Include?
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor)
when :key_item
item.is_a?(RPG::Item) && item.key_item?
else
false
end
end
#--------------------------------------------------------------------------
# ● Enable?
#--------------------------------------------------------------------------
def enable?(item)
$game_party.usable?(item)
end
#--------------------------------------------------------------------------
# ● Make Item List
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
select(@data.index($game_party.last_item.object) || 0)
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
draw_item_number(rect, item)
end
end
#--------------------------------------------------------------------------
# ● Draw Item Number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
end
#--------------------------------------------------------------------------
# ● Update Help
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Window_ItemList Z
#==============================================================================
class Window_ItemList_Item_1 < Window_Selectable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data = []
end
#--------------------------------------------------------------------------
# ● Category
#--------------------------------------------------------------------------
def category=(category)
return if @category == category
@category = category
self.oy = 0
end
#--------------------------------------------------------------------------
# ● Col Max
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● Current Item Enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# ● Include?
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item ; item.is_a?(RPG::Item) && !item.key_item?
else
false
end
end
#--------------------------------------------------------------------------
# ● Enable?
#--------------------------------------------------------------------------
def enable?(item)
$game_party.usable?(item)
end
#--------------------------------------------------------------------------
# ● Make Item List
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
select(@data.index($game_party.last_item.object) || 0)
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_number(rect, item)
end
end
#--------------------------------------------------------------------------
# ● Draw Item Number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
end
#--------------------------------------------------------------------------
# ● Update Help
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Window_ItemList Z
#==============================================================================
class Window_ItemList_Item_2 < Window_Selectable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data = []
end
#--------------------------------------------------------------------------
# ● Category
#--------------------------------------------------------------------------
def category=(category)
return if @category == category
@category = category
self.oy = 0
end
#--------------------------------------------------------------------------
# ● Col Max
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● Current Item Enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# ● Include?
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item ; item.is_a?(RPG::Item) && !item.key_item?
else
false
end
end
#--------------------------------------------------------------------------
# ● Enable?
#--------------------------------------------------------------------------
def enable?(item)
$game_party.usable?(item)
end
#--------------------------------------------------------------------------
# ● Make Item List
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
select(@data.index($game_party.last_item.object) || 0)
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
# draw_item_number(rect, item)
end
end
#--------------------------------------------------------------------------
# ● Draw Item Number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
end
#--------------------------------------------------------------------------
# ● Update Help
#--------------------------------------------------------------------------
def update_help
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_command
create_button
create_help_window
create_item_window
create_weapon_window
create_armor_window
create_key_window
create_actor_window
set_initial_visible
end
#--------------------------------------------------------------------------
# ● Create Actor Window
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Members_Windows_Status.new
@actor_window.set_handler(:ok, method(:on_actor_ok))
@actor_window.set_handler(:cancel, method(:on_actor_cancel))
@actor_window.opacity = 0
@actor_window.x = -10
@actor_window.y = 36
@actor_window_slide_range = [@actor_window.x, [email]-@actor_window.width[/email]]
@actor_window.x = @actor_window_slide_range[1]
@actor_window.visible = true
@actor_window_index_old = @actor_window.index
create_members_window
create_actor_status
update_active_window
update_command_sprites
end
#--------------------------------------------------------------------------
# ● Create Members Window
#--------------------------------------------------------------------------
def create_members_window
index = 0
@members_status = []
for actor in $game_party.members
@members_status.push(Members_Menu.new(actor,index))
index += 1
end
end
#--------------------------------------------------------------------------
# ● Create Actor Status
#--------------------------------------------------------------------------
def create_actor_status
@actor_status = Actor_Menu_Status.new(@actor)
end
#--------------------------------------------------------------------------
# ● Create Item Window
#--------------------------------------------------------------------------
def create_item_window
@item_window = Window_ItemList_Item_1.new(162,92,225,270)
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@item_window.category = :item
@item_window.active = true
@item_window.refresh
@item_window.index = 0
@item_window.opacity = 0
@item_window_2 = Window_ItemList_Item_2.new(162,92,225,270)
@item_window_2.help_window = @help_window
@item_window_2.set_handler(:ok, method(:on_item_ok))
@item_window_2.set_handler(:cancel, method(:on_item_cancel))
@item_window_2.category = :item
@item_window_2.active = true
@item_window_2.refresh
@item_window_2.index = 0
@item_window_2.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Weapon Window
#--------------------------------------------------------------------------
def create_weapon_window
@weapon_window = Window_ItemList_Z.new(162,92,225,270)
@weapon_window.help_window = @help_window
@weapon_window.set_handler(:ok, method(:on_item_ok))
@weapon_window.set_handler(:cancel, method(:on_item_cancel))
@weapon_window.category = :weapon
@weapon_window.active = true
@weapon_window.refresh
@weapon_window.index = 0
@weapon_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Armor Window
#--------------------------------------------------------------------------
def create_armor_window
@armor_window = Window_ItemList_Z.new(162,92,225,270)
@armor_window.help_window = @help_window
@armor_window.set_handler(:ok, method(:on_item_ok))
@armor_window.set_handler(:cancel, method(:on_item_cancel))
@armor_window.category = :armor
@armor_window.active = true
@armor_window.refresh
@armor_window.index = 0
@armor_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Key Window
#--------------------------------------------------------------------------
def create_key_window
@key_window = Window_ItemList_Z.new(162,92,225,270)
@key_window.help_window = @help_window
@key_window.set_handler(:ok, method(:on_item_ok))
@key_window.set_handler(:cancel, method(:on_item_cancel))
@key_window.category = :key_item
@key_window.active = true
@key_window.refresh
@key_window.index = 0
@key_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Help Window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = Graphics.height - @help_window.height
@help_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_item_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_item_menu[1]
@layout.z = 3
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Create Command
#--------------------------------------------------------------------------
def create_command
@command_sprites = []
index = 0
for i in 0...4
@command_sprites.push(Layout_Window_Sprite.new(nil, index) )
index += 1
end
end
#--------------------------------------------------------------------------
# ● Create Button
#--------------------------------------------------------------------------
def create_button
@button_sprites = []
index = 0
for i in 0...4
@button_sprites.push(Item_Button_Sprite.new(nil, index) )
index += 1
end
end
#--------------------------------------------------------------------------
# ● Set Initial Visible
#--------------------------------------------------------------------------
def set_initial_visible
@item_window.visible = false
@item_window_2.visible = false
@weapon_window.visible = false
@armor_window.visible = false
@key_window.visible = false
end
end
#==============================================================================
# ■ Layout Window Sprite
#==============================================================================
class Layout_Window_Sprite < Sprite
include MOG_MENU_ITEM
attr_accessor :index
attr_accessor :position
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil,index)
super(viewport)
@index = index
self.bitmap = Cache.menu_item("Item_Window" + @index.to_s)
self.z = 10
@org_pos = [COMMAND_POSITION[0],COMMAND_POSITION[1]]
@slide_max = @org_pos[0] + 24
@center = (544 - self.bitmap.width) - (544 / 2) + (self.bitmap.width / 2)
@left = -self.bitmap.width
@right = 544
@position = 0
@direction = 0
@org_pos = [@left ,COMMAND_POSITION[1]]
self.x = @org_pos[0]
self.y = @org_pos[1]
self.visible = false if @index > 0
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose_sprite
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_command(index)
slide_speed = 30
if @index == index
if self.x < @center
self.x += slide_speed
self.x = @center if self.x >= @center
elsif self.x > @center
self.x -= slide_speed
self.x = @center if self.x <= @center
end
else
if @direction == -1
self.x -= slide_speed if self.x > @left
else
self.x += slide_speed if self.x < @right
end
end
end
#--------------------------------------------------------------------------
# ● New P
#--------------------------------------------------------------------------
def newp(index,direction)
now_command = index
if direction == -1
pre_command = index + 1
pre_command = 0 if pre_command > 3
else
pre_command = index - 1
pre_command = 3 if pre_command < 0
end
if index == @index
self.visible = true
self.x = @right if direction == -1
self.x = @left if direction == 1
elsif pre_command == @index
self.visible = true
else
self.visible = false
end
@direction = direction
end
end
#==============================================================================
# ■ Item Button Sprite
#==============================================================================
class Item_Button_Sprite < Sprite
include MOG_MENU_ITEM
attr_accessor :index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil,index)
super(viewport)
@index = index
self.bitmap = Cache.menu_item("Button" + @index.to_s)
self.z = 12
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
@org_pos = [(BUTTON_SPACE * @index) + BUTTON_POSITION[0],BUTTON_POSITION[1]]
@slide_max = @org_pos[1] + 24
@next_pos = [@org_pos[0],@org_pos[1]]
self.x = @org_pos[0]
self.y = @org_pos[1] - 128 - (128 * @index)
@zoom_duration = [0,0,false]
@active = false
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose_sprite
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_command(index)
if @index == index
# self.y += 2
# self.y = @slide_max if self.y > @slide_max
@next_pos[1] =@slide_max
self.opacity += 15
@active = true
else
# self.y -= 2
# self.y = @org_pos[1] if self.y < @org_pos[1]
@next_pos[1] = @org_pos[1]
self.opacity -= 15 if self.opacity > 160
@active = false
end
update_slide(1,self.y,@next_pos[1])
update_zoom
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,cp,np)
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
self.x = cp if type == 0
self.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Update Zoom
#--------------------------------------------------------------------------
def update_zoom
if @active
if !@zoom_duration[2]
update_zoom_in
@zoom_duration = [0,0,true] if self.zoom_x == 1.00
else
update_zoom_effect
end
else
@zoom_duration[2] = false
update_zoom_in
end
end
#--------------------------------------------------------------------------
# ● Update Zoom Out
#--------------------------------------------------------------------------
def update_zoom_out
return if self.zoom_x == 1.00
self.zoom_x += 0.03
self.zoom_y += 0.03
if self.zoom_x >= 1.00
self.zoom_x = 1.00
self.zoom_y = 1.00
end
end
#--------------------------------------------------------------------------
# ● Update Zoom In
#--------------------------------------------------------------------------
def update_zoom_in
return if self.zoom_x == 1.00
self.zoom_x -= 0.03
self.zoom_y -= 0.03
if self.zoom_x <= 1.00
self.zoom_x = 1.00
self.zoom_y = 1.00
end
end
#--------------------------------------------------------------------------
# ● Update Zoom_effect
#--------------------------------------------------------------------------
def update_zoom_effect
@zoom_duration[0] += 1
return if @zoom_duration[0] < 1
@zoom_duration[0] = 0
@zoom_duration[1] += 1
case @zoom_duration[1]
when 1..30
self.zoom_x += 0.005
self.zoom_y += 0.005
when 31..60
self.zoom_x -= 0.005
self.zoom_y -= 0.005
when 61..999
@zoom_duration[1] = 0
self.zoom_x = 1.00
self.zoom_y = 1.00
end
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_particles
dispose_command_sprites
dispose_button_sprites
dispose_windows
dispose_members_status
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose
@layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Command Sprites
#--------------------------------------------------------------------------
def dispose_command_sprites
return if @command_sprites == nil
@command_sprites.each {|sprite| sprite.dispose_sprite }
@command_sprites = nil
end
#--------------------------------------------------------------------------
# ● Dispose Button Sprites
#--------------------------------------------------------------------------
def dispose_button_sprites
return if @button_sprites == nil
@button_sprites.each {|sprite| sprite.dispose_sprite }
@button_sprites = nil
end
#--------------------------------------------------------------------------
# ● Dispose Members Status
#--------------------------------------------------------------------------
def dispose_members_status
return if @members_status == nil
@members_status.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Winndows
#--------------------------------------------------------------------------
def dispose_windows
return if @item_window == nil
@item_window.dispose
@item_window_2.dispose
@weapon_window.dispose
@armor_window.dispose
@key_window.dispose
@actor_window.dispose
@actor_status.dispose
@help_window.dispose
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_background
update_particles
update_command_sprites
update_button_sprites
update_windows
update_members_status
end
#--------------------------------------------------------------------------
# ● Update Members Status
#--------------------------------------------------------------------------
def update_members_status
@members_status.each {|sprite| sprite.update(@actor_window.active,@actor_window.index) }
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Command Sprites
#--------------------------------------------------------------------------
def update_command_sprites
return if @command_sprites == nil
for i in @command_sprites
i.update_command(@command_index)
if i.index == 0
@item_window.x = i.x
@item_window.visible = i.visible
@item_window_2.x = i.x
@item_window_2.visible = i.visible
elsif i.index == 1
@weapon_window.x = i.x
@weapon_window.visible = i.visible
elsif i.index == 2
@armor_window.x = i.x
@armor_window.visible = i.visible
elsif i.index == 3
@key_window.x = i.x
@key_window.visible = i.visible
end
end
end
#--------------------------------------------------------------------------
# ● Update Button Sprites
#--------------------------------------------------------------------------
def update_button_sprites
return if @button_sprites == nil
@button_sprites.each {|sprite| sprite.update_command(@command_index) }
end
#--------------------------------------------------------------------------
# ● Update Winndow
#--------------------------------------------------------------------------
def update_windows
return if @item_window == nil
if @command_index == 0
@item_window.update
@item_window_2.index = @item_window.index
elsif @command_index == 1
@weapon_window.update
elsif @command_index == 2
@armor_window.update
elsif @command_index == 3
@key_window.update
end
@actor_window.update
update_actor_window_slide
update_actor_window2_slide
end
#--------------------------------------------------------------------------
# ● Update Actor Window Slide
#--------------------------------------------------------------------------
def update_actor_window_slide
if @actor_window.active
if @actor_window.x < @actor_window_slide_range[0]
@actor_window.x += 15
@actor_window.contents_opacity += 23
if @actor_window.x >= @actor_window_slide_range[0]
@actor_window.x = @actor_window_slide_range[0]
@actor_window.contents_opacity = 255
end
end
else
if @actor_window.x >= @actor_window_slide_range[1]
@actor_window.x -= 15
@actor_window.contents_opacity -= 3
if @actor_window.x <= @actor_window_slide_range[1]
@actor_window.x = @actor_window_slide_range[1]
@actor_window.contents_opacity = 0
end
end
end
end
#--------------------------------------------------------------------------
# ● Update Actor Window Slide
#--------------------------------------------------------------------------
def update_actor_window2_slide
@actor_status.update(@actor_window.active,@actor)
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_command
update_sprites
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
if @actor_window.active
update_target_select
else
update_main_command
update_active_window
end
end
#--------------------------------------------------------------------------
# ● Update Active Window
#--------------------------------------------------------------------------
def update_active_window
@item_window_2.active = false
if @command_index == 0
@item_window.active = true
@weapon_window.active = false
@armor_window.active = false
@key_window.active = false
elsif @command_index == 1
@item_window.active = false
@weapon_window.active = true
@armor_window.active = false
@key_window.active = false
elsif @command_index == 2
@item_window.active = false
@weapon_window.active = false
@armor_window.active = true
@key_window.active = false
elsif @command_index == 3
@item_window.active = false
@weapon_window.active = false
@armor_window.active = false
@key_window.active = true
end
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def update_main_command
@wait_time -= 1 if @wait_time > 0
if Input.trigger?(:LEFT)
move_command_index(-1)
elsif Input.trigger?(:RIGHT)
move_command_index(1)
elsif Input.trigger?(:B)
return_scene
end
end
#--------------------------------------------------------------------------
# ● Return Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● Cancel_Selection
#--------------------------------------------------------------------------
def cancel_selection
Sound.play_cancel
@phase = 0
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def move_command_index(value)
return if @wait_time > 0
@wait_time = 7
pre_index = @command_index
@command_index += value
@command_index = 0 if @command_index > 3
@command_index = 3 if @command_index < 0
for i in @command_sprites
i.newp(@command_index,value)
end
Sound.play_cursor
end
#--------------------------------------------------------------------------
# ● ON Category OK
#--------------------------------------------------------------------------
def on_category_ok
if @command_index == 0
@item_window.activate
@item_window.select_last
elsif @command_index == 1
@weapon_window.activate
@weapon_window.select_last
elsif @command_index == 2
@armor_window.activate
@armor_window.select_last
elsif @command_index == 3
@key_window.activate
@key_window.select_last
end
refresh_actor_status
end
#--------------------------------------------------------------------------
# ● ON Item OK
#--------------------------------------------------------------------------
def on_item_ok
$game_party.last_item.object = item
determine_item
end
#--------------------------------------------------------------------------
# ● ON Item Cancel
#--------------------------------------------------------------------------
def on_item_cancel
@item_window.unselect
end
#--------------------------------------------------------------------------
# ● Play SE For Item
#--------------------------------------------------------------------------
def play_se_for_item
Sound.play_use_item
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
if @command_index == 0
@item_window.item
elsif @command_index == 1
@weapon_window.item
elsif @command_index == 2
@armor_window.item
elsif @command_index == 3
@key_window.item
end
end
#--------------------------------------------------------------------------
# ● User
#--------------------------------------------------------------------------
def user
$game_party.movable_members.max_by {|member| member.pha }
end
#--------------------------------------------------------------------------
# ● Cursor Left
#--------------------------------------------------------------------------
def cursor_left?
@item_window.index % 2 == 0
end
#--------------------------------------------------------------------------
# ● Show Sub Window
#--------------------------------------------------------------------------
def show_sub_window(window)
window.show.activate
end
#--------------------------------------------------------------------------
# ● Hide Sub Window
#--------------------------------------------------------------------------
def hide_sub_window(window)
window.deactivate
activate_item_window
end
#--------------------------------------------------------------------------
# ● ON Actor OK
#--------------------------------------------------------------------------
def on_actor_ok
if item_usable?
use_item
refresh_window
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● Refresh Window
#--------------------------------------------------------------------------
def refresh_window
if @command_index == 0
old_item = @item_window.item
@item_window.refresh
# set_actor_for_members_menu
if @item_window.item == nil
@item_window.index -= 1
@item_window.index = 0 if @item_window.index < 0
@item_window.update
end
if old_item != @item_window.item
on_actor_cancel
cancel_selection
@item_window_2.refresh
@item_window.update_help
end
elsif @command_index == 1
@weapon_window.refresh
elsif @command_index == 2
@armor_window.refresh
elsif @command_index == 3
@key_window.refresh
end
end
#--------------------------------------------------------------------------
# ● Set Actor for Members Menu
#--------------------------------------------------------------------------
def set_actor_for_members_menu
index = 0
for actor in $game_party.members
@members_status[index].set_actor(actor)
index += 1
end
end
#--------------------------------------------------------------------------
# ● ON Actor Cancel
#--------------------------------------------------------------------------
def on_actor_cancel
hide_sub_window(@actor_window)
end
#--------------------------------------------------------------------------
# ● Determine Item
#--------------------------------------------------------------------------
def determine_item
if item.for_friend?
show_sub_window(@actor_window)
@actor_window.select_for_item(item)
$game_temp.item_scope = @item_window.item.scope rescue nil
else
use_item
activate_item_window
end
end
#--------------------------------------------------------------------------
# ● Activate Item Window
#--------------------------------------------------------------------------
def activate_item_window
if @command_index == 0
@item_window.refresh
@item_window.activate
elsif @command_index == 1
@weapon_window.refresh
@weapon_window.activate
elsif @command_index == 2
@armor_window.refresh
@armor_window.activate
elsif @command_index == 3
@key_window.refresh
@key_window.activate
end
end
#--------------------------------------------------------------------------
# ● Item Target Actors
#--------------------------------------------------------------------------
def item_target_actors
if !item.for_friend?
[]
elsif item.for_all?
$game_party.members
else
[$game_party.members[@actor_window.index]]
end
end
#--------------------------------------------------------------------------
# ● Item Usable?
#--------------------------------------------------------------------------
def item_usable?
user.usable?(item) && item_effects_valid?
end
#--------------------------------------------------------------------------
# ● Item Effects Valid?
#--------------------------------------------------------------------------
def item_effects_valid?
item_target_actors.any? do |target|
target.item_test(user, item)
end
end
#--------------------------------------------------------------------------
# ● Use Item to Actors
#--------------------------------------------------------------------------
def use_item_to_actors
item_target_actors.each do |target|
item.repeats.times { target.item_apply(user, item) }
end
end
#--------------------------------------------------------------------------
# ● Use Item
#--------------------------------------------------------------------------
def use_item
play_se_for_item
user.use_item(item)
use_item_to_actors
check_common_event
check_gameover
@actor_window.refresh
end
#--------------------------------------------------------------------------
# ● Check Common Event
#--------------------------------------------------------------------------
def check_common_event
SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?
end
#--------------------------------------------------------------------------
# ● Update Target Select
#--------------------------------------------------------------------------
def update_target_select
@actor = $game_party.members[@actor_window.index]
if Input.trigger?(:B)
cancel_selection
end
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Skill Menu
#--------------------------------------------------------------------------
def execute_pre_cache_skill_menu
@pre_cache_skill_menu = []
@pre_cache_skill_menu.push(Cache.menu_skill("Background"))
@pre_cache_skill_menu.push(Cache.menu_skill("Layout"))
@pre_cache_skill_menu.push(Cache.menu_skill("Type_Layout"))
@pre_cache_skill_menu.push(Cache.menu_skill("List_Layout"))
@pre_cache_skill_menu.push(Cache.menu_skill("Actor_Layout"))
end
end
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Skill
include MOG_MENU_SKILL
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
@actor = $game_temp.actor_menu_temp
@index_max = (@actor.added_skill_types.size - 1)
@index_max = 0 if @index_max < 0
@phase = 0
@press_time = 0
@press_lag = 0
@scene_active = @actor.added_skill_types.size > 0 ? true : false
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Actor Skill Status
#==============================================================================
class Actor_Skill_Status
include MOG_ACTOR_SKILL_STATUS
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
set_old_parameter
create_sprites
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
@meter_image = $game_temp.pre_cache_actor_menu[6]
@meter_cw = @meter_image.width
@meter_ch = @meter_image.height / 2
@parameter_number = $game_temp.pre_cache_actor_menu[2]
@parameter_cw = @parameter_number.width / 10
@parameter_ch = @parameter_number.height
@opac = 0
create_layout
create_parameter
create_face
create_name
create_hp_meter
create_mp_meter
create_states
set_position(0,[email]-@layout.bitmap.height[/email] - 48)
end
#--------------------------------------------------------------------------
# ● Set Old Parameter
#--------------------------------------------------------------------------
def set_old_parameter
@par = [] if @par == nil
@par.clear
@par = [@actor.hp,@actor.mhp,@actor.mp,@actor.mmp,@actor.level]
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_layout
dispose_parameter
dispose_face
dispose_name
dispose_hp_meter
dispose_mp_meter
dispose_states
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Parameter
#--------------------------------------------------------------------------
def dispose_parameter
@parameter.bitmap.dispose
@parameter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Face
#--------------------------------------------------------------------------
def dispose_face
@face.bitmap.dispose if @face.bitmap != nil
@face.dispose
end
#--------------------------------------------------------------------------
# ● Dispose HP Meter
#--------------------------------------------------------------------------
def dispose_hp_meter
@hp_meter.bitmap.dispose
@hp_meter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose MP Meter
#--------------------------------------------------------------------------
def dispose_mp_meter
@mp_meter.bitmap.dispose
@mp_meter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
@name.bitmap.dispose
@name.dispose
end
#--------------------------------------------------------------------------
# ● Dispose States
#--------------------------------------------------------------------------
def dispose_states
return if @status == nil
@status.bitmap.dispose
@status.dispose
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_skill_menu[4]
@org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
@layout.x = @org_pos[0]
@layout.y = @org_pos[1]
@layout.z = 10
#@layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Parameter
#--------------------------------------------------------------------------
def create_parameter
@parameter = Sprite.new
@parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
@org_pos_par = [@org_pos[0] + PAR_POSITION[0],
@org_pos[1] + PAR_POSITION[1]]
@parameter.x = @org_pos_par[0]
@parameter.y = @org_pos_par[1]
@parameter.z = 12
# @parameter.opacity = 0
refresh_parameter
end
#--------------------------------------------------------------------------
# ● Create HP Meter
#--------------------------------------------------------------------------
def create_hp_meter
@hp_meter_old = [-1,-1]
@hp_meter = Sprite.new
@hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@org_pos_hp = [@org_pos[0] + HP_METER_POSITION[0],
@org_pos[1] + HP_METER_POSITION[1]]
@hp_meter.x = @org_pos_hp[0]
@hp_meter.y = @org_pos_hp[1]
@hp_meter.z = 11
end
#--------------------------------------------------------------------------
# ● Refresh HP Meter
#--------------------------------------------------------------------------
def refresh_hp_meter
@hp_meter_old[0] = @actor.hp
@hp_meter_old[1] = @actor.mhp
@hp_meter.bitmap.clear
width_range = @meter_cw * @actor.hp / @actor.mhp
m_rect = Rect.new(0,0,width_range,@meter_ch)
@hp_meter.bitmap.blt(0,0,@meter_image,m_rect)
end
#--------------------------------------------------------------------------
# ● Create MP Meter
#--------------------------------------------------------------------------
def create_mp_meter
@mp_meter_old = [-1,-1]
@mp_meter = Sprite.new
@mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@org_pos_mp = [@org_pos[0] + MP_METER_POSITION[0],
@org_pos[1] + MP_METER_POSITION[1]]
@mp_meter.x = @org_pos_mp[0]
@mp_meter.y = @org_pos_mp[1]
@mp_meter.z = 11
end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
@status_old = nil
@status_flow = [-24,0]
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@org_pos_states = [@org_pos[0] + STATES_POSITION[0],
@org_pos[1] + STATES_POSITION[1]]
@status.x = @org_pos_states[0] + 1
@status.y = @org_pos_states[1]
@status.z = 11
end
#--------------------------------------------------------------------------
# * Refresh States
#--------------------------------------------------------------------------
def refresh_states
check_icon_image
@status_old = @actor.states
@status_flow = [0,0]
@actor_status.dispose if @actor_status != nil
@states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(26 * index , 0, @icon_image, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# * Flow_Status
#--------------------------------------------------------------------------
def flow_states
return if @actor_status == nil
@status.bitmap.clear
return if @actor.states.size == 0
st_src_rect = Rect.new(@status_flow[0],0, 24,24)
@status.bitmap.blt(0,0, @actor_status, st_src_rect)
if STATES_SCROLLING_ANIMATION
@status_flow[0] += 1
@status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
else
@status_flow[1] += 1 unless @actor.states.size <= 1
if @status_flow[1] > 30
@status_flow[1] = 0
@status_flow[0] += 26
@status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
end
end
end
#--------------------------------------------------------------------------
# * Check Icon Image
#--------------------------------------------------------------------------
def check_icon_image
if @icon_image == nil or @icon_image.disposed?
@icon_image = Cache.system("Iconset")
end
end
#--------------------------------------------------------------------------
# ● Refresh MP Meter
#--------------------------------------------------------------------------
def refresh_mp_meter
@mp_meter_old[0] = @actor.mp
@mp_meter_old[1] = @actor.mmp
@mp_meter.bitmap.clear
width_range = @meter_cw * @actor.mp / @actor.mmp rescue nil
width_range = 0 if width_range == nil
m_rect = Rect.new(0,@meter_ch,width_range,@meter_ch)
@mp_meter.bitmap.blt(0,0,@meter_image,m_rect)
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def refresh_parameter
set_old_parameter
@parameter.bitmap.clear
value = @actor.level
x = 112
y = 8
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.hp
x = 218
y = 2
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
value = @actor.mp
x = 238
y = 22
refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_number(sprite,image,value,number_cw,number_ch,x,y)
number = value.abs.to_s.split(//)
x2 = -number_cw * number.size
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
sprite.bitmap.blt(x + x2 + (number_cw * i), y, image, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def create_face
@face = Sprite.new
@org_pos_face = [@org_pos[0] + FACE_POSITION[0],
@org_pos[1] + FACE_POSITION[1]]
@face.x = @org_pos_face[0]
@face.y = @org_pos_face[1]
@face.z = 11
# @face.opacity = 0
refresh_face
end
#--------------------------------------------------------------------------
# ● Refresh Face
#--------------------------------------------------------------------------
def refresh_face
face_name = "Face" + @actor.id.to_s
@face.bitmap = Cache.menu(face_name.to_s)
end
#--------------------------------------------------------------------------
# ● Create Name
#--------------------------------------------------------------------------
def create_name
@name = Sprite.new
@name.bitmap = Bitmap.new(140,32)
@name.bitmap.font.name = FONT_NAME
@name.bitmap.font.size = FONT_SIZE
@name.bitmap.font.bold = FONT_BOLD
@org_pos_name = [@org_pos[0] + NAME_POSITION[0],
@org_pos[1] + NAME_POSITION[1]]
@name.x = @org_pos_name[0]
@name.y = @org_pos_name[1]
@name.z = 11
#@name.opacity = 0
refresh_name
end
#--------------------------------------------------------------------------
# ● Refresh Name
#--------------------------------------------------------------------------
def refresh_name
@name.bitmap.clear
@name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
end
#--------------------------------------------------------------------------
# ● Set Actor
#--------------------------------------------------------------------------
def set_actor(actor)
@actor = actor
end
#--------------------------------------------------------------------------
# ● Can Refresh HP Meter
#--------------------------------------------------------------------------
def can_refresh_hp_meter?
return true if @hp_meter_old[0] != @actor.hp
return true if @hp_meter_old[1] != @actor.mhp
return false
end
#--------------------------------------------------------------------------
# ● Can Refresh MP Meter
#--------------------------------------------------------------------------
def can_refresh_mp_meter?
return true if @mp_meter_old[0] != @actor.mp
return true if @mp_meter_old[1] != @actor.mmp
return false
end
#--------------------------------------------------------------------------
# ● Can Refresh Parameter
#--------------------------------------------------------------------------
def can_refresh_parameter?
return true if @par[0] != @actor.hp
return true if @par[1] != @actor.mhp
return true if @par[2] != @actor.mp
return true if @par[3] != @actor.mmp
return false
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
def update_position
update_slide(0,@layout,@layout.x,@org_pos[0])
update_slide(1,@layout,@layout.y,@org_pos[1])
update_slide(0,@parameter,@parameter.x,@org_pos_par[0])
update_slide(1,@parameter,@parameter.y,@org_pos_par[1])
update_slide(0,@hp_meter,@hp_meter.x,@org_pos_hp[0])
update_slide(1,@hp_meter,@hp_meter.y,@org_pos_hp[1])
update_slide(0,@mp_meter,@mp_meter.x,@org_pos_mp[0])
update_slide(1,@mp_meter,@mp_meter.y,@org_pos_mp[1])
update_slide(0,@face,@face.x,@org_pos_face[0])
update_slide(1,@face,@face.y,@org_pos_face[1])
update_slide(0,@name,@name.x,@org_pos_name[0])
update_slide(1,@name,@name.y,@org_pos_name[1])
update_slide(0,@status,@status.x,@org_pos_states[0])
update_slide(1,@status,@status.y,@org_pos_states[1])
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,cp,np)
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_opacity
@opac += 10
@opac = 255 if @opac > 255
set_opacity(@opac)
end
#--------------------------------------------------------------------------
# ● Set Opacity
#--------------------------------------------------------------------------
def set_opacity(opac)
@layout.opacity = opac
@layout.opacity = opac
@parameter.opacity = opac
@parameter.opacity = opac
@hp_meter.opacity = opac
@hp_meter.opacity = opac
@mp_meter.opacity = opac
@mp_meter.opacity = opac
@face.opacity = opac
@face.opacity = opac
@name.opacity = opac
@name.opacity = opac
@status.opacity = opac
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
def set_position(pos_x,pos_y)
@layout.x = @org_pos[0] + pos_x
@layout.y = @org_pos[1] + pos_y
@parameter.x = @org_pos_par[0] + pos_x
@parameter.y = @org_pos_par[1] + pos_y
@hp_meter.x = @org_pos_hp[0] + pos_x
@hp_meter.y = @org_pos_hp[1] + pos_y
@mp_meter.x = @org_pos_mp[0] + pos_x
@mp_meter.y = @org_pos_mp[1] + pos_y
@face.x = @org_pos_face[0] + pos_x
@face.y = @org_pos_face[1] + pos_y
@name.x = @org_pos_name[0] + pos_x
@name.y = @org_pos_name[1] + pos_y
@status.x = @org_pos_states[0] + pos_x
@status.y = @org_pos_states[1] + pos_y
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
refresh_hp_meter if can_refresh_hp_meter?
refresh_mp_meter if can_refresh_mp_meter?
refresh_parameter if can_refresh_parameter?
refresh_states if @status_old != @actor.states
update_opacity
update_position
flow_states
end
end
#==============================================================================
# ■ Window_SkillCommand
#==============================================================================
class Window_SkillCommand_2 < Window_Command
attr_reader :skill_window
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y)
@actor = nil
@index_max = 0
end
#--------------------------------------------------------------------------
# ● Window Width
#--------------------------------------------------------------------------
def window_width
return 140
end
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
@index_max = (@actor.added_skill_types.size - 1)
@index_max = 0 if @index_max < 0
refresh
select_last
end
#--------------------------------------------------------------------------
# ● Visible Line Number
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
#--------------------------------------------------------------------------
# ● Make Command List
#--------------------------------------------------------------------------
def make_command_list
return unless @actor
@actor.added_skill_types.sort.each do |stype_id|
name = $data_system.skill_types[stype_id]
add_command(name, :skill, true, stype_id)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
@skill_window.stype_id = current_ext if @skill_window
# update_index
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_index
return if @index_max <= 0
if Input.trigger?(:RIGHT)
add_index(1)
elsif Input.trigger?(:LEFT)
add_index(-1)
end
end
#--------------------------------------------------------------------------
# ● Add Index
#--------------------------------------------------------------------------
def add_index(value)
Sound.play_cursor
@index += value
@index = 0 if @index > @index_max
@index = @index_max if @index < 0
end
#--------------------------------------------------------------------------
# ● Skill Window
#--------------------------------------------------------------------------
def skill_window=(skill_window)
@skill_window = skill_window
update
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
skill = @actor.last_skill.object
if skill
select_ext(skill.stype_id)
else
select(0)
end
end
end
#==============================================================================
# ■ Window_SkillList
#==============================================================================
class Window_SkillList_Menu < Window_Selectable
attr_accessor :windows_index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@stype_id = 0
@data = []
@windows_index = 0
self.opacity = 0
@actor = nil
end
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
self.oy = 0
end
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
def setup(actor,skill_type,index)
@actor = actor
@stype_id = skill_type
@windows_index = index
refresh
end
#--------------------------------------------------------------------------
# ● Stype ID
#--------------------------------------------------------------------------
def stype_id=(stype_id)
end
#--------------------------------------------------------------------------
# ● Col Max
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● Current Item Enabled
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# ● Include
#--------------------------------------------------------------------------
def include?(item)
item && item.stype_id == @stype_id
end
#--------------------------------------------------------------------------
# ● Enable
#--------------------------------------------------------------------------
def enable?(item)
@actor && @actor.usable?(item)
end
#--------------------------------------------------------------------------
# ● Male Item List
#--------------------------------------------------------------------------
def make_item_list
@data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
select(@data.index(@actor.last_skill.object) || 0)
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
self.contents.font.size = 18
self.contents.font.bold = true
skill = @data[index]
if skill
rect = item_rect(index)
rect.width -= 4
draw_item_name(skill, rect.x, rect.y, enable?(skill),110)
draw_skill_cost(rect, skill)
end
end
#--------------------------------------------------------------------------
# ● Draw Skill Cost
#--------------------------------------------------------------------------
def draw_skill_cost(rect, skill)
if @actor.skill_tp_cost(skill) > 0
change_color(tp_cost_color, enable?(skill))
draw_text(rect, @actor.skill_tp_cost(skill), 2)
elsif @actor.skill_mp_cost(skill) > 0
change_color(mp_cost_color, enable?(skill))
draw_text(rect, @actor.skill_mp_cost(skill), 2)
end
end
#--------------------------------------------------------------------------
# ● Update Help
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Scene Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_actor_status
create_help_window
create_command_window
create_type_layout
create_item_window
create_list_layout
create_actor_window
create_type_name
@command_window.active = true
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_skill_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_skill_menu[1]
@layout.z = 3
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Create Actor Status
#--------------------------------------------------------------------------
def create_actor_status
@actor_skill_status = Actor_Skill_Status.new(@actor)
end
#--------------------------------------------------------------------------
# ● Create Help Window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = Graphics.height - @help_window.height
@help_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_SkillCommand_2.new(0, 84)
@command_window.help_window = @help_window
@command_window.actor = @actor
@command_window.set_handler(:skill, method(:command_skill))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
@command_window.active = false
@command_window.opacity = 0
@command_window.index = 0
@command_window.visible = @scene_active
@skill_list_slide_range = [@command_window.x, -(@command_window.x + @command_window.width)]
@command_window.x = @skill_list_slide_range[1] - 80
@command_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Type Layout
#--------------------------------------------------------------------------
def create_type_layout
@type_layout = Sprite.new
@type_layout.bitmap = $game_temp.pre_cache_skill_menu[2]
@type_layout.z = @command_window.z - 1
@type_layout.x = @command_window.x
@type_layout.y = @command_window.y - 30
@type_layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Item Window
#--------------------------------------------------------------------------
def create_item_window
@skill_window = []
index = 0
window_max = @actor.added_skill_types.size
window_max = 1 if window_max == 0
for item in 0...window_max
@skill_window.push(Window_SkillList_Menu.new(170,75,200,270))
@skill_window[index].setup(@actor,@actor.added_skill_types[index],index)
@skill_window[index].help_window = @help_window
@skill_window[index].set_handler(:ok, method(:on_item_ok))
@skill_window[index].set_handler(:cancel, method(:on_item_cancel))
@skill_window[index].active = false
@skill_window[index].index = -1
@skill_window[index].opacity = 0
@skill_window[index].contents_opacity = 0
@item_slide_range = [@skill_window[index].x, @skill_window[index].x + 50]
@skill_window[index].x = @item_slide_range[1]
index += 1
end
@item_pre_index = @skill_window[@command_window.index].index
@old_command_index = @skill_window[@command_window.index].index
end
#--------------------------------------------------------------------------
# ● Create List Layout
#--------------------------------------------------------------------------
def create_list_layout
@list_layout = Sprite.new
@list_layout.bitmap = $game_temp.pre_cache_skill_menu[3]
@list_layout.z = @skill_window[@command_window.index].z - 1
@list_layout.x = @item_slide_range[0] - 4
@list_layout.y = @skill_window[@command_window.index].y
@list_layout.opacity = 0
@list_layout_slide_range = [@list_layout.x,@list_layout.x + 50]
@list_layout.x = @list_layout_slide_range[1]
end
#--------------------------------------------------------------------------
# ● Create Actor Window
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Members_Windows_Status.new
@actor_window.set_handler(:ok, method(:on_actor_ok))
@actor_window.set_handler(:cancel, method(:on_actor_cancel))
@actor_window.opacity = 0
@actor_window.x = -10
@actor_window.y = 36
@actor_window_slide_range = [@actor_window.x, [email]-@actor_window.width[/email]]
@actor_window.x = @actor_window_slide_range[1]
@actor_window.visible = true
@actor_window_index_old = @actor_window.index
create_members_window
update_active
end
#--------------------------------------------------------------------------
# ● Create Members Window
#--------------------------------------------------------------------------
def create_members_window
@actor_status = Actor_Menu_Status.new(@actor)
index = 0
@members_status = []
for actor in $game_party.members
@members_status.push(Members_Menu.new(actor,index))
index += 1
end
end
#--------------------------------------------------------------------------
# ● Create Type Name
#--------------------------------------------------------------------------
def create_type_name
@type_name = Sprite.new
@type_name.x = 260
@type_name.y = 60
@type_name.z = @list_layout.z + 2
@type_name.bitmap = Bitmap.new(100,32)
@type_name.bitmap.font.name = "Georgia"
@type_name.bitmap.font.size = 18
@type_name.bitmap.font.bold = true
@type_name.opacity = 0
refresh_type_name
end
#--------------------------------------------------------------------------
# ● Refresh Type Name
#--------------------------------------------------------------------------
def refresh_type_name
@type_name.bitmap.clear
return if !@scene_active
stype_id = @actor.added_skill_types[@command_window.index]
type_name = $data_system.skill_types[stype_id]
@type_name.bitmap.draw_text(0,0,100,32,type_name,2)
end
end
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_list_layout
dispose_particles
dispose_windows
dispose_members_status
dispose_type_name
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose
@layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Window
#--------------------------------------------------------------------------
def dispose_windows
return if @command_window == nil
@skill_window.each {|sprite| sprite.dispose }
@command_window.dispose
@actor_window.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# ● Dispose List Layout
#--------------------------------------------------------------------------
def dispose_list_layout
return if @list_layout == nil
@list_layout.dispose
@type_layout.dispose
@list_layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Members Status
#--------------------------------------------------------------------------
def dispose_members_status
return if @members_status == nil
@actor_status.dispose
@actor_skill_status.dispose
@members_status.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Type Name
#--------------------------------------------------------------------------
def dispose_type_name
@type_name.bitmap.dispose
@type_name.dispose
end
end
#==============================================================================
# ■ Scene Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_background
update_particles
update_actor_status
update_slide_item
update_members_status
update_windows
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Windows
#--------------------------------------------------------------------------
def update_windows
@press_lag -= 1 if @press_lag > 0
return if @command_window == nil
for skw in @skill_window
if skw.windows_index == @command_window.index
skw.update unless @press_lag > 0
if @phase == 0
skw.index = 0 if skw.index < 0 or skw.index >= skw.item_max
end
skw.visible = true
else
skw.visible = false
end
end
#@skill_window[@command_window.index].update
@command_window.update
@actor_window.update
update_actor_window_slide
update_skill_list_slide
end
#--------------------------------------------------------------------------
# ● Update Skill List Slide
#--------------------------------------------------------------------------
def update_skill_list_slide
return if @phase == 999
if @actor_window.active or !@command_window.active
if @command_window.x > @skill_list_slide_range[1]
@command_window.x -= 15
@command_window.x = @skill_list_slide_range[1] if @command_window.x < @skill_list_slide_range[1]
end
else
if @command_window.x < @skill_list_slide_range[0]
@command_window.x += 15
@command_window.x = @skill_list_slide_range[0] if @command_window.x > @skill_list_slide_range[0]
end
end
@type_layout.x = @command_window.x
end
#--------------------------------------------------------------------------
# ● Update Actor Window Slide
#--------------------------------------------------------------------------
def update_actor_window_slide
if @actor_window.active
if @actor_window.x < @actor_window_slide_range[0]
@actor_window.x += 15
@actor_window.contents_opacity += 23
if @actor_window.x >= @actor_window_slide_range[0]
@actor_window.x = @actor_window_slide_range[0]
@actor_window.contents_opacity = 255
end
end
else
if @actor_window.x >= @actor_window_slide_range[1]
@actor_window.x -= 15
@actor_window.contents_opacity -= 3
if @actor_window.x <= @actor_window_slide_range[1]
@actor_window.x = @actor_window_slide_range[1]
@actor_window.contents_opacity = 0
end
end
end
end
#--------------------------------------------------------------------------
# ● Update Actor Status
#--------------------------------------------------------------------------
def update_actor_status
refresh_actor_status(true) if @actor_window_index_old != @actor_window.index
end
#--------------------------------------------------------------------------
# ● Refresh Actor Status
#--------------------------------------------------------------------------
def refresh_actor_status(reset = false)
# @actor = $game_party.members[@actor_window.index]
# @actor_window_index_old = @actor_window.index
end
#--------------------------------------------------------------------------
# ● Update Slide Item
#--------------------------------------------------------------------------
def update_slide_item
if @phase == 0
@command_window.contents_opacity += 10
else
@command_window.contents_opacity -= 10 if @command_window.contents_opacity > 160
end
@type_layout.opacity = @command_window.contents_opacity
@type_name.opacity = @skill_window[@command_window.index].contents_opacity
if @phase == 1
@skill_window[@command_window.index].contents_opacity += 5
@list_layout.opacity += 5
else
@skill_window[@command_window.index].contents_opacity -= 10 if @skill_window[@command_window.index].contents_opacity > 165
@list_layout.opacity -= 10 if @list_layout.opacity > 160
end
if @skill_window[@command_window.index].x > @item_slide_range[0]
@skill_window[@command_window.index].x -= 3
@list_layout.x -= 3
if @skill_window[@command_window.index].x <= @item_slide_range[0]
@skill_window[@command_window.index].x = @item_slide_range[0]
@list_layout.x = @list_layout_slide_range[0]
end
end
end
#--------------------------------------------------------------------------
# ● Update Members Status
#--------------------------------------------------------------------------
def update_members_status
for members in @members_status
members.update(@actor_window.active,@actor_window.index)
@actor_2 = members.actor if members.current_actor
end
@actor_2 = @actor if @actor_2 == nil
@actor_skill_status.update
@actor_status.update(@actor_window.active,@actor_2)
#@members_status.each {|sprite| sprite.update(@actor_window.active,@actor_window.index) }
end
end
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
unless @skill_window[@command_window.index].index < 0
@item_pre_index = @skill_window[@command_window.index].index
end
update_command
update_sprites
end
#--------------------------------------------------------------------------
# ● Show Sub Window
#--------------------------------------------------------------------------
def show_sub_window(window)
window.show.activate
end
#--------------------------------------------------------------------------
# ● Hide Sub Window
#--------------------------------------------------------------------------
def hide_sub_window(window)
window.hide.deactivate
activate_item_window
end
#--------------------------------------------------------------------------
# ● Determine Item
#--------------------------------------------------------------------------
def determine_item
if item.for_friend?
@phase = 2
show_sub_window(@actor_window)
@actor_window.select_for_item(item)
$game_temp.item_scope = @skill_window[@command_window.index].item.scope rescue nil
else
use_item
activate_item_window
end
end
#--------------------------------------------------------------------------
# ● ON Item OK
#--------------------------------------------------------------------------
def on_item_ok
return if @press_time > 1
@actor.last_skill.object = item
determine_item
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
@skill_window[@command_window.index].item
end
#--------------------------------------------------------------------------
# ● Use Item
#--------------------------------------------------------------------------
def use_item
super
@skill_window[@command_window.index].refresh if can_refresh_item_window?
end
#--------------------------------------------------------------------------
# ● Activate Item Window
#--------------------------------------------------------------------------
def activate_item_window
@skill_window[@command_window.index].refresh if can_refresh_item_window?
@skill_window[@command_window.index].activate
end
#--------------------------------------------------------------------------
# ● On Item Cancel
#--------------------------------------------------------------------------
def on_item_cancel
@skill_window[@command_window.index].unselect
@command_window.activate
end
#--------------------------------------------------------------------------
# ● Can Refresh Item Window
#--------------------------------------------------------------------------
def can_refresh_item_window?
return true if @actor.mp < @skill_window[@command_window.index].item.mp_cost
return true if @actor.tp < @skill_window[@command_window.index].item.tp_cost
return false
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
@skill_window[@command_window.index].index = @item_pre_index
if @phase == 0
update_main_command
elsif @phase == 1
update_item_window
elsif @phase == 2
update_target_window
end
update_active
end
#--------------------------------------------------------------------------
# ● Command Skill
#--------------------------------------------------------------------------
def command_skill
@skill_window[@command_window.index].activate
@skill_window[@command_window.index].select_last
# @item_window.activate
# @item_window.select_last
end
#--------------------------------------------------------------------------
# ● Update Active
#--------------------------------------------------------------------------
def update_active
if @phase == 0
@skill_window[@command_window.index].active = false
@command_window.active = true
@actor_window.active = false
elsif @phase == 1
@skill_window[@command_window.index].active = true
@command_window.active = false
@actor_window.active = false
elsif @phase == 2
@skill_window[@command_window.index].active = false
@command_window.active = false
@actor_window.active = true
end
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def update_main_command
reset_item_index
if Input.trigger?(:C) and @scene_active
Sound.play_ok
@phase = 1
@press_time = 2
@press_lag = 2
@skill_window[@command_window.index].index = 0 if @skill_window[@command_window.index].index == -1
elsif Input.trigger?(:B)
return_scene
end
end
#--------------------------------------------------------------------------
# ● Return Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● ON Actor Charge
#--------------------------------------------------------------------------
def on_actor_change
@phase = 999
$game_temp.actor_menu_temp = @actor
SceneManager.goto(Scene_Skill)
end
#--------------------------------------------------------------------------
# ● Reset Item Index
#--------------------------------------------------------------------------
def reset_item_index
return if @old_command_index == @command_window.index
return if @command_window.index == -1
@old_command_index = @command_window.index
refresh_type_name
reset_item_position
end
#--------------------------------------------------------------------------
# ● Reset Item Position
#--------------------------------------------------------------------------
def reset_item_position
@skill_window[@command_window.index].x = @item_slide_range[1]
@skill_window[@command_window.index].contents_opacity = 160
@list_layout.x = @list_layout_slide_range[1]
@list_layout.opacity = 160
end
end
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Update Item Window
#--------------------------------------------------------------------------
def update_item_window
@press_time -= 1 if @press_time > 0
update_item_command
update_index_type
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def update_item_command
if Input.trigger?(:B)
@phase = 0
Sound.play_cancel
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_index_type
return if @index_max <= 0
return if @command_window == nil
if Input.trigger?(:RIGHT)
add_index(1)
elsif Input.trigger?(:LEFT)
add_index(-1)
end
end
#--------------------------------------------------------------------------
# ● Add Index
#--------------------------------------------------------------------------
def add_index(value)
Sound.play_cursor
@command_window.index += value
@command_window.index = 0 if @command_window.index > @index_max
@command_window.index = @index_max if @command_window.index < 0
reset_item_index
end
end
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● Update Item Window
#--------------------------------------------------------------------------
def update_target_window
update_target_command
end
#--------------------------------------------------------------------------
# ● Update Main Command
#--------------------------------------------------------------------------
def update_target_command
if Input.trigger?(:B)
@phase = 1
@skill_window[@command_window.index].index = @item_pre_index
end
end
end
#==============================================================================
# ■ Window Base
#==============================================================================
class Window_Base < Window
include MOG_MENU_EQUIP
#--------------------------------------------------------------------------
# ● Set Equip Font
#--------------------------------------------------------------------------
def set_font_equip
return if self.disposed?
return if self.contents == nil
self.contents.font.name = FONT_NAME
self.contents.font.size = FONT_SIZE
self.contents.font.bold = FONT_BOLD
self.contents.font.italic = FONT_ITALIC
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Skill Menu
#--------------------------------------------------------------------------
def execute_pre_cache_equip_menu
@pre_cache_equip_menu = []
@pre_cache_equip_menu.push(Cache.menu_equip("Background"))
@pre_cache_equip_menu.push(Cache.menu_equip("Layout_U"))
@pre_cache_equip_menu.push(Cache.menu_equip("Layout_R"))
@pre_cache_equip_menu.push(Cache.menu_equip("Layout_D"))
@pre_cache_equip_menu.push(Cache.menu_equip("Layout_L"))
@pre_cache_equip_menu.push(Cache.menu_equip("Par_Number"))
end
end
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Equip
include MOG_MENU_EQUIP
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
@actor = $game_temp.actor_menu_temp
@actor_old = @actor
@phase = 0
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Window_EquipStatus
#==============================================================================
class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# ● Initializee
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@actor = nil
@temp_actor = nil
self.visible = false
end
#--------------------------------------------------------------------------
# ● Window Width
#--------------------------------------------------------------------------
def window_width
return 208
end
#--------------------------------------------------------------------------
# ● Window Height
#--------------------------------------------------------------------------
def window_height
return 296
end
#--------------------------------------------------------------------------
# ● Visible Line Number
#--------------------------------------------------------------------------
def visible_line_number
return 1
end
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
end
#--------------------------------------------------------------------------
# ● Set Temp Actor
#--------------------------------------------------------------------------
def set_temp_actor(temp_actor)
return if @temp_actor == temp_actor
@temp_actor = temp_actor
$game_temp.temp_actor_equip = @temp_actor
end
end
#==============================================================================
# ■ Window_EquipCommand
#==============================================================================
class Window_EquipCommand < Window_HorzCommand
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width)
@window_width = width
super(x, y)
end
#--------------------------------------------------------------------------
# ● Window Width
#--------------------------------------------------------------------------
def window_width
@window_width
end
#--------------------------------------------------------------------------
# ● Col Max
#--------------------------------------------------------------------------
def col_max
return 3
end
#--------------------------------------------------------------------------
# ● Make Command List
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::equip2, :equip)
add_command(Vocab::optimize, :optimize)
add_command(Vocab::clear, :clear)
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
end
end
#==============================================================================
# ■ Window_EquipSlot
#==============================================================================
class Window_EquipSlot < Window_Selectable
attr_reader :status_window
attr_reader :item_window
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, window_height)
@actor = nil
refresh
end
#--------------------------------------------------------------------------
# ● Window Height
#--------------------------------------------------------------------------
def window_height
fitting_height(visible_line_number)
end
#--------------------------------------------------------------------------
# ● Visible Line Number
#--------------------------------------------------------------------------
def visible_line_number
return 5
end
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
@item_window.slot_id = index if @item_window
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
@actor ? @actor.equip_slots.size : 0
end
#--------------------------------------------------------------------------
# ● Item
#--------------------------------------------------------------------------
def item
@actor ? @actor.equips[index] : nil
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
return unless @actor
rect = item_rect_for_text(index)
change_color(system_color, enable?(index))
set_font_equip
draw_item_name(@actor.equips[index], rect.x + 92, rect.y, enable?(index))
end
#--------------------------------------------------------------------------
# ● Slot Name
#--------------------------------------------------------------------------
def slot_name(index)
@actor ? Vocab::etype(@actor.equip_slots[index]) : ""
end
#--------------------------------------------------------------------------
# ● Enable
#--------------------------------------------------------------------------
def enable?(index)
@actor ? @actor.equip_change_ok?(index) : false
end
#--------------------------------------------------------------------------
# ● Current Item Enabled
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(index)
end
#--------------------------------------------------------------------------
# ● Status Window
#--------------------------------------------------------------------------
def status_window=(status_window)
@status_window = status_window
call_update_help
end
#--------------------------------------------------------------------------
# ● Item Window
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
#--------------------------------------------------------------------------
# ● Update Help
#--------------------------------------------------------------------------
def update_help
super
@help_window.set_item(item) if @help_window
$game_temp.temp_actor_equip = nil if @status_window
end
end
#==============================================================================
# ■ Window_EquipItem
#==============================================================================
class Window_EquipItem_Menu < Window_ItemList
attr_reader :status_window
attr_accessor :windows_index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@actor = nil
@slot_id = 0
@windows_index = 0
self.visible = false
self.opacity = 0
end
#--------------------------------------------------------------------------
# ● Col Max
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
self.oy = 0
end
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
def setup(actor,equip_type,index)
@actor = actor
@slot_id = equip_type
@windows_index = index
refresh
end
#--------------------------------------------------------------------------
# ● Slot ID
#--------------------------------------------------------------------------
def slot_id=(slot_id)
end
#--------------------------------------------------------------------------
# ● Include?
#--------------------------------------------------------------------------
def include?(item)
return true if item == nil
return false unless item.is_a?(RPG::EquipItem)
return false if @slot_id < 0
return false if item.etype_id != @actor.equip_slots[@slot_id]
return @actor.equippable?(item)
end
#--------------------------------------------------------------------------
# ● Enable?
#--------------------------------------------------------------------------
def enable?(item)
return true
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
end
#--------------------------------------------------------------------------
# ● Status Window
#--------------------------------------------------------------------------
def status_window=(status_window)
@status_window = status_window
call_update_help
end
#--------------------------------------------------------------------------
# ● Update Help
#--------------------------------------------------------------------------
def update_help
super
if @actor && @status_window
temp_actor = Marshal.load(Marshal.dump(@actor))
temp_actor.force_change_equip(@slot_id, item)
$game_temp.temp_actor_equip = temp_actor
end
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
set_font_equip
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
draw_item_number(rect, item)
end
end
#--------------------------------------------------------------------------
# ● Draw Item Number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
draw_text(rect, sprintf(": %2d", $game_party.item_number(item)), 2)
end
end
module MOG_EQUIP_STATUS
LAYOUT_POSITION = [0,80]
FACE_POSITION = [120,-45]
PAR_POSITION = [5,32]
NAME_POSITION = [15,-5]
FONT_NAME = "Georgia"
FONT_SIZE = 18
FONT_BOLD = true
end
#==============================================================================
# ■ Actor Menu Status
#==============================================================================
class Actor_Equip_Status
include MOG_EQUIP_STATUS
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
@actor_old = @actor
$game_temp.temp_actor_equip = nil
@old_temp_actor = $game_temp.temp_actor_equip
set_old_parameter
create_sprites
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
@parameter_number = $game_temp.pre_cache_equip_menu[5]
@parameter_cw = @parameter_number.width / 11
@parameter_ch = @parameter_number.height / 3
create_layout
create_face
create_parameter
create_name
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_layout
dispose_face
dispose_parameter
dispose_name
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Face
#--------------------------------------------------------------------------
def dispose_face
@face.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Parameter
#--------------------------------------------------------------------------
def dispose_parameter
@parameter.bitmap.dispose
@parameter.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
@name.bitmap.dispose
@name.dispose
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_equip_menu[4]
@org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
@layout.x = @org_pos[0] - 150
@layout.y = @org_pos[1]
@layout.z = 10
@layout.opacity = 0
@slide_range = (@org_pos[0] - 150)
end
#--------------------------------------------------------------------------
# ● Create Parameter
#--------------------------------------------------------------------------
def create_parameter
@parameter = Sprite.new
@parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
@org_pos_par = [@org_pos[0] + PAR_POSITION[0],
@org_pos[1] + PAR_POSITION[1]]
@parameter.x = @org_pos_par[0] - 150
@parameter.y = @org_pos_par[1]
@parameter.z = 11
@parameter.opacity = 0
refresh_parameter
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def create_face
@face = Sprite.new
@org_pos_face = [@org_pos[0] + FACE_POSITION[0],
@org_pos[1] + FACE_POSITION[1]]
@face.x = @org_pos_face[0] - 150
@face.y = @org_pos_face[1]
@face.z = 11
@face.opacity = 0
refresh_face
end
#--------------------------------------------------------------------------
# ● Create Name
#--------------------------------------------------------------------------
def create_name
@name = Sprite.new
@name.bitmap = Bitmap.new(140,32)
@name.bitmap.font.name = FONT_NAME
@name.bitmap.font.size = FONT_SIZE
@name.bitmap.font.bold = FONT_BOLD
@org_pos_name = [@org_pos[0] + NAME_POSITION[0],
@org_pos[1] + NAME_POSITION[1]]
@name.x = @org_pos_name[0] - 150
@name.y = @org_pos_name[1]
@name.z = 11
@name.opacity = 0
refresh_name
end
#--------------------------------------------------------------------------
# ● Set Old Parameter
#--------------------------------------------------------------------------
def set_old_parameter
@par = [] if @par == nil
@par.clear
@par = [
@actor.param(0),@actor.param(1),@actor.param(2),@actor.param(3),
@actor.param(4),@actor.param(5),@actor.param(6),@actor.param(7),
@old_temp_actor
]
end
#--------------------------------------------------------------------------
# ● Can Refresh Parameter
#--------------------------------------------------------------------------
def can_refresh_parameter?
return true if @par[0] != @actor.param(0)
return true if @par[1] != @actor.param(1)
return true if @par[2] != @actor.param(2)
return true if @par[3] != @actor.param(3)
return true if @par[4] != @actor.param(4)
return true if @par[5] != @actor.param(5)
return true if @par[6] != @actor.param(6)
return true if @par[7] != @actor.param(7)
return true if @old_temp_actor != $game_temp.temp_actor_equip
return false
end
#--------------------------------------------------------------------------
# ● Refresh Name
#--------------------------------------------------------------------------
def refresh_name
@name.bitmap.clear
@name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
end
#--------------------------------------------------------------------------
# ● Create Face
#--------------------------------------------------------------------------
def refresh_parameter
set_old_parameter
@parameter.bitmap.clear
@old_temp_actor = $game_temp.temp_actor_equip
x = 180
for p in 0...8
y = 24 * p
refresh_number(@parameter,@parameter_number,p,@parameter_cw,@parameter_ch,x,y,0)
end
if $game_temp.temp_actor_equip != nil
x = 180 - (@parameter_cw * 7)
for p in 0...8
y = 24 * p
refresh_number(@parameter,@parameter_number,p,@parameter_cw,@parameter_ch,x,y,1)
end
end
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_number(sprite,image,p,number_cw,number_ch,x,y,type)
value = @actor.param(p)
new_value = 0
ch = 0
if type == 1
if $game_temp.temp_actor_equip != nil
new_value = $game_temp.temp_actor_equip.param(p)
end
d_value = new_value - value
if d_value < 0
ch = 2
elsif d_value > 0
ch = 1
else
ch = 0
end
value = new_value
end
draw_arrow(sprite,image,number_cw,number_ch,x,y,ch)
draw_number(sprite,image,value,number_cw,number_ch,x,y,ch)
end
#--------------------------------------------------------------------------
# ● Draw Arrow
#--------------------------------------------------------------------------
def draw_arrow(sprite,image,number_cw,number_ch,x,y,ch)
nsrc_rect = Rect.new(number_cw * 10, number_ch * ch , number_cw , number_ch)
sprite.bitmap.blt(x + number_cw, y, image, nsrc_rect)
end
#--------------------------------------------------------------------------
# ● Draw Number
#--------------------------------------------------------------------------
def draw_number(sprite,image,value,number_cw,number_ch,x,y,ch)
number = value.truncate.abs.to_s.split(//)
x2 = -number_cw * number.size
for i in 0..number.size - 1
number_abs = number[i].to_i
nsrc_rect = Rect.new(number_cw * number_abs, number_ch * ch , number_cw , number_ch)
sprite.bitmap.blt(x + x2 + (number_cw * i), y, image, nsrc_rect)
end
end
#--------------------------------------------------------------------------
# ● Refresh Face
#--------------------------------------------------------------------------
def refresh_face
face_name = "Face" + @actor.id.to_s
@face.bitmap = Cache.menu(face_name.to_s)
end
#--------------------------------------------------------------------------
# ● Update Move
#--------------------------------------------------------------------------
def update_move
update_slide(0,@layout,@layout.x,@org_pos[0])
update_slide(1,@layout,@layout.y,@org_pos[1])
update_slide(0,@parameter,@parameter.x,@org_pos_par[0])
update_slide(1,@parameter,@parameter.y,@org_pos_par[1])
update_slide(0,@face,@face.x,@org_pos_face[0])
update_slide(1,@face,@face.y,@org_pos_face[1])
update_slide(0,@name,@name.x,@org_pos_name[0])
update_slide(1,@name,@name.y,@org_pos_name[1])
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,cp,np)
sprite.opacity += 5
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Refresh All
#--------------------------------------------------------------------------
def refresh_all(actor)
@actor = actor
refresh_parameter
refresh_face
refresh_name
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update(actor)
update_move
refresh_all(actor) if actor != @actor
refresh_parameter if can_refresh_parameter?
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_help_window
create_status_window
create_command_window
create_slot_window
create_item_window
create_actor_status
set_sprite_position
end
#--------------------------------------------------------------------------
# ● Set Sprite Position
#--------------------------------------------------------------------------
def set_sprite_position
@status_window.opacity = 0
@command_window.opacity = 0
@slot_window.opacity = 0
@help_window.opacity = 0
@status_window.contents_opacity = 0
@command_window.contents_opacity = 0
@slot_window.contents_opacity = 0
@help_window.contents_opacity = 0
@layout2.opacity = 0
@layout3.opacity = 0
@layout4.opacity = 0
@org_pos_help = [@help_window.x,@help_window.y]
@help_window.x = @org_pos_help[0]
@help_window.y = @org_pos_help[1] + 150
@org_pos_com = [@command_window.x,@command_window.y]
@command_window.x = @org_pos_com[0]
@command_window.y = @org_pos_com[1] - 150
@org_pos_slot = [@slot_window.x,@slot_window.y]
@slot_window.x = @org_pos_slot[0] + 150
@slot_window.y = @org_pos_slot[1]
@layout2.y = -150
@layout3.x = 150
@layout4.y = 150
end
#--------------------------------------------------------------------------
# ● Create Actor Status
#--------------------------------------------------------------------------
def create_actor_status
@actor_status = Actor_Equip_Status.new(@actor)
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_equip_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout2 = Sprite.new
@layout2.bitmap = $game_temp.pre_cache_equip_menu[1]
@layout2.z = 3
@layout3 = Sprite.new
@layout3.bitmap = $game_temp.pre_cache_equip_menu[2]
@layout3.z = 3
@layout4 = Sprite.new
@layout4.bitmap = $game_temp.pre_cache_equip_menu[3]
@layout4.z = 3
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Create Help Window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = Graphics.height - @help_window.height
@help_window.set_font_equip
end
#--------------------------------------------------------------------------
# ● Create Status Window
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_EquipStatus.new(0, @help_window.height)
@status_window.viewport = @viewport
@status_window.actor = @actor
@status_window.y = 48
end
#--------------------------------------------------------------------------
# ● Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_EquipCommand.new(208, 0, 336)
@command_window.help_window = @help_window
@command_window.set_handler(:equip, method(:command_equip))
@command_window.set_handler(:optimize, method(:command_optimize))
@command_window.set_handler(:clear, method(:command_clear))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ● Create Slot Window
#--------------------------------------------------------------------------
def create_slot_window
wx = @status_window.width
wy = @command_window.y + @command_window.height + 5
ww = Graphics.width - @status_window.width
@slot_window = Window_EquipSlot.new(wx, wy, ww)
@slot_window.help_window = @help_window
@slot_window.status_window = @status_window
@slot_window.actor = @actor
@slot_window.set_handler(:ok, method(:on_slot_ok))
@slot_window.set_handler(:cancel, method(:on_slot_cancel))
@slot_window.set_handler(:pagedown, method(:next_actor))
@slot_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ● Create Item Window
#--------------------------------------------------------------------------
def create_item_window
@equip_window = []
index = 0
window_max = 5
for item in 0...window_max
wx = @slot_window.x
wy = @slot_window.y + @slot_window.height + 5
ww = @slot_window.width
wh = @slot_window.height
@equip_window.push(Window_EquipItem_Menu.new(wx, wy, ww, wh))
@equip_window[item].setup(@actor,item, index)
@equip_window[item].visible = false
@equip_window[item].help_window = @help_window
@equip_window[item].status_window = @status_window
@equip_window[item].actor = @actor
@equip_window[item].set_handler(:ok, method(:on_item_ok))
@equip_window[item].set_handler(:cancel, method(:on_item_cancel))
@equip_window[item].opacity = 0
@org_pos_equip = [@equip_window[item].x,@equip_window[item].y]
index += 1
end
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_particles
dispose_window
dispose_actor_status
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout2 == nil
@layout2.dispose
@layout3.dispose
@layout4.dispose
@layout2 = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Window
#--------------------------------------------------------------------------
def dispose_window
@status_window.dispose
@command_window.dispose
@slot_window.dispose
@equip_window.each {|sprite| sprite.dispose }
@help_window.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Actor Status
#--------------------------------------------------------------------------
def dispose_actor_status
return if @actor_status == nil
@actor_status.dispose
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_actor_status
update_background
update_particles
update_window
update_move
end
#--------------------------------------------------------------------------
# ● Update Move
#--------------------------------------------------------------------------
def update_move
update_slide(0,@command_window,@org_pos_com[0],0)
update_slide(1,@command_window,@org_pos_com[1],0)
update_slide(0,@help_window,@org_pos_help[0],0)
update_slide(1,@help_window,@org_pos_help[1],0)
update_slide(0,@slot_window,@org_pos_slot[0],0)
update_slide(1,@slot_window,@org_pos_slot[1],0)
update_slide(0,@layout2,0,1)
update_slide(1,@layout2,0,1)
update_slide(0,@layout3,0,1)
update_slide(1,@layout3,0,1)
update_slide(0,@layout4,0,1)
update_slide(1,@layout4,0,1)
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,np,op_type)
if op_type == 0
sprite.contents_opacity += 5
else
sprite.opacity += 5
end
cp = type == 0 ? sprite.x : sprite.y
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Update Actor Status
#--------------------------------------------------------------------------
def update_actor_status
return if @actor_status == nil
@actor_status.update(@actor)
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Window
#--------------------------------------------------------------------------
def update_window
@status_window.update
@command_window.update
@slot_window.update
for equip in @equip_window
update_slide(0,equip,@org_pos_equip[0],0)
update_slide(1,equip,@org_pos_equip[1],0)
if equip.windows_index == @slot_window.index
equip.visible = true
equip.update
else
equip.visible = false
end
end
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_sprites
update_command
end
#--------------------------------------------------------------------------
# ● Command Equip
#--------------------------------------------------------------------------
def command_equip
@slot_window.activate
@slot_window.select(0)
end
#--------------------------------------------------------------------------
# ● Command Optimize
#--------------------------------------------------------------------------
def command_optimize
Sound.play_equip
@actor.optimize_equipments
@status_window.refresh
@slot_window.refresh
@command_window.activate
end
#--------------------------------------------------------------------------
# ● Command Clear
#--------------------------------------------------------------------------
def command_clear
Sound.play_equip
@actor.clear_equipments
@status_window.refresh
@slot_window.refresh
@command_window.activate
end
#--------------------------------------------------------------------------
# ● On Slot OK
#--------------------------------------------------------------------------
def on_slot_ok
@equip_window[@slot_window.index].activate
@equip_window[@slot_window.index].select(0)
end
#--------------------------------------------------------------------------
# ● On Slot Cancel
#--------------------------------------------------------------------------
def on_slot_cancel
@slot_window.unselect
@command_window.activate
end
#--------------------------------------------------------------------------
# ● On Item OK
#--------------------------------------------------------------------------
def on_item_ok
Sound.play_equip
@actor.change_equip(@slot_window.index, @equip_window[@slot_window.index].item)
@slot_window.activate
@slot_window.refresh
@equip_window[@slot_window.index].unselect
@equip_window[@slot_window.index].refresh
end
#--------------------------------------------------------------------------
# ● On Item Cancel
#--------------------------------------------------------------------------
def on_item_cancel
@slot_window.activate
@equip_window[@slot_window.index].unselect
end
#--------------------------------------------------------------------------
# ● Return Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● ON Actor Charge
#--------------------------------------------------------------------------
def on_actor_change
$game_temp.actor_menu_temp = @actor
SceneManager.goto(Scene_Equip)
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Status Menu
#--------------------------------------------------------------------------
def execute_pre_cache_status_menu
@pre_cache_status_menu = []
@pre_cache_status_menu.push(Cache.menu_status("Background"))
@pre_cache_status_menu.push(Cache.menu_status("Layout"))
end
end
#==============================================================================
# ■ Scene_Status
#==============================================================================
class Scene_Status
include MOG_MENU_STATUS
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
@actor = $game_temp.actor_menu_temp
@actor_old = @actor
@phase = 0
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Window_Status
#==============================================================================
class Window_Status < Window_Selectable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(-16, -16, Graphics.width + 32, Graphics.height + 32)
@actor = actor
self.z = 10
refresh
activate
end
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_description
self.contents.font.size = 18
self.contents.font.bold = true
self.contents.font.name = "Georgia"
draw_exp_info
draw_parameters
draw_equipments
draw_actor_hp_mp_tp
draw_actor_name
end
#--------------------------------------------------------------------------
# ● Draw Actor Name
#--------------------------------------------------------------------------
def draw_actor_name
self.contents.font.name = "Verdana"
self.contents.font.size = 16
text = @actor.class.name
draw_text(240,185,100,32, text.to_s,1)
self.contents.font.size = 20
self.contents.font.italic = true
text = @actor.name
draw_text(125,50,120,32, text.to_s,1)
end
#--------------------------------------------------------------------------
# ● Draw Parameters
#--------------------------------------------------------------------------
def draw_parameters
par = @actor.atk
draw_text(43,112,80,32, par.to_s,2)
par = @actor.def
draw_text(43,146,80,32, par.to_s,2)
par = @actor.mat
draw_text(162 ,112,80,32, par.to_s,2)
par = @actor.mdf
draw_text(162,146,80,32, par.to_s,2)
par = @actor.agi
draw_text(282,112,80,32, par.to_s,2)
par = @actor.luk
draw_text(282,146,80,32, par.to_s,2)
end
#--------------------------------------------------------------------------
# ● Draw Actor HP MP TP
#--------------------------------------------------------------------------
def draw_actor_hp_mp_tp
self.contents.font.name = "Verdana"
self.contents.font.size = 16
par = @actor.hp.truncate
draw_text(5,80,80,32, par.to_s,2)
par = @actor.mhp.truncate
draw_text(50,80,80,32, par.to_s,2)
par = @actor.mp.truncate
draw_text(123,80,80,32, par.to_s,2)
par = @actor.mmp.truncate
draw_text(168,80,80,32, par.to_s,2)
par = @actor.tp.truncate
draw_text(244,80,80,32, par.to_s,2)
par = @actor.max_tp.truncate
draw_text(282,80,80,32, par.to_s,2)
end
#--------------------------------------------------------------------------
# ● Draw Exp Info
#--------------------------------------------------------------------------
def draw_exp_info
draw_text(200,10,64,32,@actor.level.to_s,1)
s1 = @actor.max_level? ? "----------" : @actor.exp
s2 = @actor.max_level? ? "----------" : @actor.next_level_exp - @actor.exp
draw_text(300,10, 80, 32,s1.to_s, 1)
draw_text(460,10, 80, 32,s2.to_s, 1)
end
#--------------------------------------------------------------------------
# ● Draw Equipments
#--------------------------------------------------------------------------
def draw_equipments
self.contents.font.size = 16
item = @actor.equips[0]
draw_item_name(item, 20, 220,true,140)
item = @actor.equips[1]
draw_item_name(item, 20, 220 + 43,true,140)
item = @actor.equips[2]
draw_item_name(item, 20, 220 + 86,true,140)
item = @actor.equips[3]
draw_item_name(item, 196, 242,true,140)
item = @actor.equips[4]
draw_item_name(item, 196, 242 + 43,true,140)
end
#--------------------------------------------------------------------------
# ● Draw Description
#--------------------------------------------------------------------------
def draw_description
draw_text_ex(20, height - 96,@actor.description)
end
#--------------------------------------------------------------------------
# ● Next Actor
#--------------------------------------------------------------------------
def next_actor
$game_temp.actor_menu_temp = $game_party.menu_actor_next
on_actor_change
end
#--------------------------------------------------------------------------
# ● Prev Actor
#--------------------------------------------------------------------------
def prev_actor
$game_temp.actor_menu_temp = $game_party.menu_actor_prev
on_actor_change
end
#--------------------------------------------------------------------------
# ● On Actor Change
#--------------------------------------------------------------------------
def on_actor_change
Sound.play_cursor
SceneManager.goto(Scene_Status)
end
end
module MOG_STATUS_PARAMETER
PICTURE_POS = [-105,0]
METER_POSITION = [53,101]
STATES_POSITION = [21,46]
STATES_SCROLLING_ANIMATION = false
MAX_PARAMETER_VALUE = 999
end
#==============================================================================
# ■ Status Parameter
#==============================================================================
class Status_Parameter
include MOG_STATUS_PARAMETER
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
create_picture
create_states
create_meter
end
#--------------------------------------------------------------------------
# ● Create Picture
#--------------------------------------------------------------------------
def create_picture
@picture = Sprite.new
pic_name = "Actor_S" + @actor.id.to_s
@picture.bitmap = Cache.menu_status(pic_name.to_s)
@picture.ox = @picture.bitmap.width / 2
pos = [Graphics.width,Graphics.height - @picture.bitmap.height]
@pos_org_pic = [PICTURE_POS[0] + pos[0] ,PICTURE_POS[1] + pos[1]]
@picture.x = @pos_org_pic[0]
@picture.y = @pos_org_pic[1] + 150
@picture.opacity = 0
@picture.z = 3
end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
@status_old = nil
@status_flow = [-24,0]
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@org_pos_states = [STATES_POSITION[0],STATES_POSITION[1]]
@status.x = @org_pos_states[0] + 150
@status.y = @org_pos_states[1]
@status.z = 11
@status.opacity = 0
end
#--------------------------------------------------------------------------
# * Refresh States
#--------------------------------------------------------------------------
def refresh_states
check_icon_image
@status_old = @actor.states
@status_flow = [0,0]
@actor_status.dispose if @actor_status != nil
@states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(26 * index , 0, @icon_image, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# * Flow_Status
#--------------------------------------------------------------------------
def flow_states
return if @actor_status == nil
@status.bitmap.clear
return if @actor.states.size == 0
st_src_rect = Rect.new(@status_flow[0],0, 24,24)
@status.bitmap.blt(0,0, @actor_status, st_src_rect)
if STATES_SCROLLING_ANIMATION
@status_flow[0] += 1
@status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
else
@status_flow[1] += 1 unless @actor.states.size <= 1
if @status_flow[1] > 30
@status_flow[1] = 0
@status_flow[0] += 26
@status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
end
end
end
#--------------------------------------------------------------------------
# * Check Icon Image
#--------------------------------------------------------------------------
def check_icon_image
if @icon_image == nil or @icon_image.disposed?
@icon_image = Cache.system("Iconset")
end
end
#--------------------------------------------------------------------------
# * Create Meter
#--------------------------------------------------------------------------
def create_meter
@meter_image = Cache.menu_status("Par_Meter")
@meter_cw = @meter_image.width / 3
@meter_ch = @meter_image.height / 4
@meter = Sprite.new
@meter.bitmap = Bitmap.new(380,140)
@org_pos_meter = [METER_POSITION[0],METER_POSITION[1]]
@meter.x = @org_pos_meter[0] + 150
@meter.y = @org_pos_meter[1]
@meter.z = 11
@meter.opacity = 0
@meter_flow = [0,@meter_cw * 2]
refresh_meter
end
#--------------------------------------------------------------------------
# * Refresh Meter
#--------------------------------------------------------------------------
def refresh_meter
@meter.bitmap.clear
max_par = MAX_PARAMETER_VALUE
value = @actor.hp
value_max = @actor.mhp
pos = [0,0]
draw_meter(value,value_max,0,pos[0],pos[1])
value = @actor.mp
value_max = @actor.mmp
pos = [120,0]
draw_meter(value,value_max,1,pos[0],pos[1])
value = @actor.tp
value_max = @actor.max_tp
pos = [240,0]
draw_meter(value,value_max,2,pos[0],pos[1])
value = @actor.atk
value_max = max_par
pos = [0,34]
draw_meter(value,value_max,3,pos[0],pos[1])
value = @actor.mat
value_max = max_par
pos = [120,34]
draw_meter(value,value_max,3,pos[0],pos[1])
value = @actor.agi
value_max = max_par
pos = [240,34]
draw_meter(value,value_max,3,pos[0],pos[1])
value = @actor.def
value_max = max_par
pos = [0,68]
draw_meter(value,value_max,3,pos[0],pos[1])
value = @actor.mdf
value_max = max_par
pos = [120,68]
draw_meter(value,value_max,3,pos[0],pos[1])
value = @actor.luk
value_max = max_par
pos = [240,68]
draw_meter(value,value_max,3,pos[0],pos[1])
@meter_flow[0] += 5
@meter_flow[0] = 0 if @meter_flow[0] > @meter_flow[1]
end
#--------------------------------------------------------------------------
# * Draw Meter
#--------------------------------------------------------------------------
def draw_meter(value,value_max,type,x,y)
value_max = 1 if value_max <= 0
range = @meter_cw * value.truncate / value_max.truncate
ch = @meter_ch * type
meter_scr = Rect.new(@meter_flow[0],ch,range,@meter_ch)
@meter.bitmap.blt(x,y,@meter_image,meter_scr)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_picture
dispose_states
dispose_meter
end
#--------------------------------------------------------------------------
# ● Dispose Picture
#--------------------------------------------------------------------------
def dispose_picture
@picture.bitmap.dispose
@picture.dispose
end
#--------------------------------------------------------------------------
# ● Dispose States
#--------------------------------------------------------------------------
def dispose_states
return if @status == nil
@status.bitmap.dispose
@status.dispose
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
end
#--------------------------------------------------------------------------
# ● Dispose Meter
#--------------------------------------------------------------------------
def dispose_meter
return if @meter == nil
@meter.bitmap.dispose
@meter.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_slide(0,@picture,@pos_org_pic[0])
update_slide(1,@picture,@pos_org_pic[1])
update_slide(0,@status,@org_pos_states[0])
update_slide(1,@status,@org_pos_states[1])
update_slide(0,@meter,@org_pos_meter[0])
update_slide(1,@meter,@org_pos_meter[1])
refresh_states if @status_old != @actor.states
refresh_meter
flow_states
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,np)
sprite.opacity += 5
cp = type == 0 ? sprite.x : sprite.y
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
end
#==============================================================================
# ■ Scene_Status
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_status_window
create_parameter
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_status_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_status_menu[1]
@layout.z = 9
@layout.x = -150
@layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Create Status Window
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_Status.new(@actor)
@status_window.set_handler(:cancel, method(:return_scene))
@status_window.set_handler(:pagedown, method(:next_actor))
@status_window.set_handler(:pageup, method(:prev_actor))
@org_pos_win = [@status_window.x,@status_window.y]
@status_window.x += 150
@status_window.opacity = 0
@status_window.contents_opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Parameter
#--------------------------------------------------------------------------
def create_parameter
@parameter = Status_Parameter.new(@actor)
end
end
#==============================================================================
# ■ Scene_Status
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_particles
dispose_status_window
dispose_parameter
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose
@layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Status Window
#--------------------------------------------------------------------------
def dispose_status_window
return if @status_window == nil
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Parameter
#--------------------------------------------------------------------------
def dispose_parameter
return if @parameter == nil
@parameter.dispose
end
end
#==============================================================================
# ■ Scene Status
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_background
update_particles
update_status_window
update_parameter
update_move
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_status_window
return if @status_window == nil
@status_window.update
end
#--------------------------------------------------------------------------
# ● Update Move
#--------------------------------------------------------------------------
def update_move
update_slide(0,@status_window,@org_pos_win[0],0)
update_slide(1,@status_window,@org_pos_win[1],0)
update_slide(0,@layout,0,1)
update_slide(1,@layout,0,1)
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,np,opa)
if opa == 0
sprite.contents_opacity += 5
else
sprite.opacity += 5
end
cp = type == 0 ? sprite.x : sprite.y
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Update Parameter
#--------------------------------------------------------------------------
def update_parameter
return if @parameter == nil
@parameter.update
end
end
#==============================================================================
# ■ Scene_Status
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_sprites
update_command
end
#--------------------------------------------------------------------------
# ● Return Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● ON Actor Charge
#--------------------------------------------------------------------------
def on_actor_change
Sound.play_cursor
$game_temp.actor_menu_temp = @actor
SceneManager.goto(Scene_Status)
end
end
#==============================================================================
# ■ Scene_Status
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
update_next_actor
end
#--------------------------------------------------------------------------
# ● Update Next Actor
#--------------------------------------------------------------------------
def update_next_actor
if Input.trigger?(:RIGHT)
@status_window.next_actor
elsif Input.trigger?(:LEFT)
@status_window.prev_actor
end
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache Party Menu
#--------------------------------------------------------------------------
def execute_pre_cache_party_menu
@pre_cache_party_menu = []
@pre_cache_party_menu.push(Cache.menu_party("Background"))
@pre_cache_party_menu.push(Cache.menu_party("Layout"))
end
end
#==============================================================================
# ■ Scene_Party
#==============================================================================
class Scene_Party
include MOG_MENU_PARTY
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
@phase = 0
@actor = $game_party.members[0]
@actor_old = @actor
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
module MOG_ACTOR_MENU_PARTY
FACE_POSITION = [390,96]
NAME_POSITION = [390,73]
FONT_NAME = "Verdana"
FONT_SIZE = 16
FONT_BOLD = true
end
#==============================================================================
# ■ Actor Menu Status Party
#==============================================================================
class Actor_Menu_Status_Party
include MOG_ACTOR_MENU_PARTY
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@active = false
@max_members = $game_party.max_battle_members
@max_members = $game_party.members.size if @max_members > $game_party.members.size
create_sprites
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
@face = []
@face_org = []
@name = []
@name_org = []
@actor_id = []
space = 70
index = 0
for actor in $game_party.members
@face.push(Sprite.new)
@face_org[index] = [FACE_POSITION[0],FACE_POSITION[1] + space * index]
@face[index].x = @face_org[index][0] + 150 + (150 * index)
@face[index].y = @face_org[index][1]
@face[index].z = 10
@name.push(Sprite.new)
@name[index].bitmap = Bitmap.new(200,120)
@name[index].bitmap.font.name = FONT_NAME
@name[index].bitmap.font.size = FONT_SIZE
@name[index].bitmap.font.bold = FONT_BOLD
@name_org[index] = [NAME_POSITION[0],NAME_POSITION[1] + space * index]
@name[index].x = @name_org[index][0] + 150 + (150 * index)
@name[index].y = @name_org[index][1]
@name[index].z = 11
@actor_id[index] = actor.id
index += 1
break if index >= @max_members
end
refresh
end
#--------------------------------------------------------------------------
# ● Refresh Position
#--------------------------------------------------------------------------
def refresh_position(actor,index)
@actor_id[index] = actor.id
@face[index].x = @face_org[index][0] + 150 + (150 * index)
@name[index].x = @name_org[index][0] + 150 + (150 * index)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
@face.each {|sprite| sprite.dispose }
@name.each {|sprite| sprite.bitmap.dispose }
@name.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
index = 0
for actor in $game_party.members
face_name = "Face_B" + actor.id.to_s
@face[index].bitmap = Cache.menu(face_name.to_s)
@name[index].bitmap.clear
@name[index].bitmap.draw_text(100,28,64,32,"LV " + actor.level.to_s,0)
aname = actor.name
@name[index].bitmap.draw_text(0,0,100,32,aname.to_s,0)
refresh_position(actor,index) if @actor_id[index] != actor.id
index += 1
break if index >= @max_members
end
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,np)
sprite.opacity += 5
cp = type == 0 ? sprite.x : sprite.y
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update(actor)
for index in [email]0...@name.size[/email]
update_slide(0,@face[index],@face_org[index][0])
update_slide(1,@face[index],@face_org[index][1])
update_slide(0,@name[index],@name_org[index][0])
update_slide(1,@name[index],@name_org[index][1])
end
end
end
#==============================================================================
# ■ Window_MenuStatus Party
#==============================================================================
class Window_MenuStatus_Party < Window_Selectable
attr_reader :pending_index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@pending_index = -1
self.opacity = 0
self.contents.font.bold = true
self.contents.font.size = 18
refresh
end
#--------------------------------------------------------------------------
# ● Window Width
#--------------------------------------------------------------------------
def window_width
Graphics.width - 160
end
#--------------------------------------------------------------------------
# ● Window Height
#--------------------------------------------------------------------------
def window_height
Graphics.height
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# ● Item Height
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2) / 4
end
#--------------------------------------------------------------------------
# ● Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.members[index]
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_item_background(index)
draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
self.contents.font.color = Color.new(255,155,55,255)
draw_text(rect.x + 60,rect.y + 23,64,32,"LV",2)
draw_text(rect.x + 60,rect.y + 43,64,32,"HP",2)
draw_text(rect.x + 60,rect.y + 63,64,32,"MP",2)
draw_text(rect.x + 140,rect.y + 23,64,32,"Atk",2)
draw_text(rect.x + 140,rect.y + 43,64,32,"Def",2)
draw_text(rect.x + 140,rect.y + 63,64,32,"Agi",2)
draw_text(rect.x + 220,rect.y + 23,64,32,"Mag",2)
draw_text(rect.x + 220,rect.y + 43,64,32,"Mdf",2)
draw_text(rect.x + 220,rect.y + 63,64,32,"Luk",2)
self.contents.font.color = Color.new(255,255,255,255)
draw_text(rect.x + 105,rect.y,105,32,actor.name,0)
draw_text(rect.x + 105,rect.y + 23,64,32,actor.level,2)
draw_text(rect.x + 105,rect.y + 43,64,32,actor.mhp,2)
draw_text(rect.x + 105,rect.y + 63,64,32,actor.mmp,2)
draw_text(rect.x + 185,rect.y + 23,64,32,actor.atk,2)
draw_text(rect.x + 185,rect.y + 43,64,32,actor.def,2)
draw_text(rect.x + 185,rect.y + 63,64,32,actor.agi,2)
draw_text(rect.x + 265,rect.y + 23,64,32,actor.mat,2)
draw_text(rect.x + 265,rect.y + 43,64,32,actor.mdf,2)
draw_text(rect.x + 265,rect.y + 63,64,32,actor.luk,2)
end
#--------------------------------------------------------------------------
# ● Draw Item Background
#--------------------------------------------------------------------------
def draw_item_background(index)
if index == @pending_index
contents.fill_rect(item_rect(index), pending_color)
end
end
#--------------------------------------------------------------------------
# ● Process OK
#--------------------------------------------------------------------------
def process_ok
super
$game_party.menu_actor = $game_party.members[index]
end
#--------------------------------------------------------------------------
# ● Select Last
#--------------------------------------------------------------------------
def select_last
select($game_party.menu_actor.index || 0)
end
#--------------------------------------------------------------------------
# ● Pending Index
#--------------------------------------------------------------------------
def pending_index=(index)
last_pending_index = @pending_index
@pending_index = index
redraw_item(@pending_index)
redraw_item(last_pending_index)
end
end
#==============================================================================
# ■ Scene_Party
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_status_window
create_actor_menu
end
#--------------------------------------------------------------------------
# ● Create Status Window
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_MenuStatus_Party.new(0, 0)
command_formation
end
#--------------------------------------------------------------------------
# ● Create Actor Menu
#--------------------------------------------------------------------------
def create_actor_menu
@actor_status = Actor_Menu_Status_Party.new
end
#--------------------------------------------------------------------------
# ● Command Personal
#--------------------------------------------------------------------------
def command_personal
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_personal_ok))
@status_window.set_handler(:cancel, method(:on_personal_cancel))
end
#--------------------------------------------------------------------------
# ● Command Formation
#--------------------------------------------------------------------------
def command_formation
@status_window.index = 0
@old_index = @status_window.index
@status_window.activate
@status_window.set_handler(:ok, method(:on_formation_ok))
@status_window.set_handler(:cancel, method(:on_formation_cancel))
end
#--------------------------------------------------------------------------
# ● On Personal Cancel
#--------------------------------------------------------------------------
def on_personal_cancel
@status_window.unselect
end
#--------------------------------------------------------------------------
# ● On Formation OK
#--------------------------------------------------------------------------
def on_formation_ok
if @status_window.pending_index >= 0
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
@actor_status.refresh
else
@status_window.pending_index = @status_window.index
end
@status_window.activate
end
#--------------------------------------------------------------------------
# ● On Formation Cancel
#--------------------------------------------------------------------------
def on_formation_cancel
if @status_window.pending_index >= 0
@status_window.pending_index = -1
@status_window.activate
else
return_scene
end
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_party_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_party_menu[1]
@layout.z = 3
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
end
#==============================================================================
# ■ Scene_Party
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_particles
dispose_status_window
dispose_actor_menu
end
#--------------------------------------------------------------------------
# ● Dispose Status Window
#--------------------------------------------------------------------------
def dispose_status_window
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose
@layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Actor Menu
#--------------------------------------------------------------------------
def dispose_actor_menu
return if @actor_status == nil
@actor_status.dispose
end
end
#==============================================================================
# ■ Scene_Party
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_background
update_particles
update_status_window
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Status Window
#--------------------------------------------------------------------------
def update_status_window
return if @status_window == nil
@status_window.update
update_slide(0,@status_window,0)
update_slide(1,@status_window,0)
@actor = $game_party.members[@status_window.index]
@actor_status.update(@actor)
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide(type,sprite,np)
sprite.contents_opacity += 5
cp = type == 0 ? sprite.x : sprite.y
sp = 3 + ((cp - np).abs / 10)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
sprite.x = cp if type == 0
sprite.y = cp if type == 1
end
end
#==============================================================================
# ■ Scene_Party
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_sprites
update_command
end
#--------------------------------------------------------------------------
# ● Return Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● ON Actor Charge
#--------------------------------------------------------------------------
def on_actor_change
$game_temp.actor_menu_temp = @actor
SceneManager.goto(Scene_Status)
end
end
#==============================================================================
# ■ Scene_Party
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache File Menu
#--------------------------------------------------------------------------
def execute_pre_cache_file_menu
@pre_cache_file_menu = []
@pre_cache_file_menu.push(Cache.menu_save("Background"))
@pre_cache_file_menu.push(Cache.menu_save("Layout"))
@pre_cache_file_menu.push(Cache.menu_save("File_Mode"))
@pre_cache_file_menu.push(Cache.menu_save("File_layout_1"))
@pre_cache_file_menu.push(Cache.menu_save("File_layout_2"))
@pre_cache_file_menu.push(Cache.menu_save("File_layout_3"))
@pre_cache_file_menu.push(Cache.menu_save("Character_Floor"))
@pre_cache_file_menu.push(Cache.menu_save("File_Number"))
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :scene_save
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_scene_file_initialize initialize
def initialize
mog_scene_file_initialize
@scene_save = false
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)
#--------------------------------------------------------------------------
# X - Posição na horizontal
# Y - Posição na vertical
# VALUE - Valor Numérico
# FILE_NAME - Nome do arquivo
# ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita
# SPACE - Espaço entre os números.
# FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
# FRAME_INDEX - Definição do quadro a ser utilizado.
#--------------------------------------------------------------------------
def draw_picture_number_file(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)
number_image = $game_temp.pre_cache_file_menu[7]
frame_max = 1 if frame_max < 1
frame_index = frame_max -1 if frame_index > frame_max -1
align = 2 if align > 2
cw = number_image.width / 10
ch = number_image.height / frame_max
h = ch * frame_index
number = value.abs.to_s.split(//)
case align
when 0
plus_x = (-cw + space) * number.size
when 1
plus_x = (-cw + space) * number.size
plus_x /= 2
when 2
plus_x = 0
end
for r in 0..number.size - 1
number_abs = number[r].to_i
number_rect = Rect.new(cw * number_abs, h, cw, ch)
self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)
end
end
#--------------------------------------------------------------------------
# ● Draw Help Layout
#--------------------------------------------------------------------------
def draw_face_save(name,x,y,type)
if type == 0
image_name = name + "_0"
elsif type == 1
image_name = name + "_1"
else
image_name = name + "_2"
end
image = Cache.face(image_name)
cw = image.width
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , image, src_rect)
image.dispose
end
#--------------------------------------------------------------------------
# ● draw_parameter_layout
#--------------------------------------------------------------------------
def draw_parameter_layout(x,y)
image = $game_temp.pre_cache_file_menu[3]
cw = image.width
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , image, src_rect)
end
#--------------------------------------------------------------------------
# ● draw_parameter_layout2
#--------------------------------------------------------------------------
def draw_parameter_layout2(x,y,type)
if type == 0
image = $game_temp.pre_cache_file_menu[4]
else
image = $game_temp.pre_cache_file_menu[5]
end
cw = image.width
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , image, src_rect)
end
#--------------------------------------------------------------------------
# ● draw_character_floor
#--------------------------------------------------------------------------
def draw_character_floor(x,y)
image = $game_temp.pre_cache_file_menu[6]
cw = image.width
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , image, src_rect)
end
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# ● Make Save Header
#--------------------------------------------------------------------------
def self.make_save_header
header = {}
header[:characters] = $game_party.characters_for_savefile
header[:playtime_s] = $game_system.playtime_s
header[:playtime] = $game_system.playtime
header[:map_name] = $game_map.display_name
header[:members] = $game_party.members
header
end
end
#==============================================================================
# ■ Scene Save
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
$game_temp.scene_save = true
super
end
end
#==============================================================================
# ■ Scene Load
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
$game_temp.scene_save = false
super
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File
include MOG_MENU_SAVE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
$game_temp.execute_pre_cache_file_menu
create_sprites
Graphics.transition(10)
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Loop
#--------------------------------------------------------------------------
def execute_loop
loop do
Graphics.update
Input.update
update
if SceneManager.scene != self
break
end
end
end
end
#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveFile_A < Window_Base
attr_reader :filename
attr_reader :file_exist
attr_reader :time_stamp
attr_reader :selected
attr_reader :file_index
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 0,720, 140)
self.opacity = 0
@file_index = file_index
@filename = filename
load_gamedata
refresh
@selected = false
end
#--------------------------------------------------------------------------
# ● load_gamedata
#--------------------------------------------------------------------------
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
header = DataManager.load_header(@file_index)
if header == nil
@file_exist = false
return
end
@characters = header[:characters]
@total_sec = header[:playtime]
@mapname = header[:map_name]
@members = header[:members]
end
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
xp = 96
ex = 60
if @file_exist
if @total_sec == nil
draw_parameter_layout2(0,50,0)
draw_parameter_layout(-10 + xp,0)
value = @file_index + 1
draw_picture_number_file(13 + xp, 32,value, "File_Number_01",1,0,3,0)
self.contents.draw_text(140, 50, 450, 32, "Error! - Please, dont't use your old Save Files...", 0)
return
end
draw_parameter_layout2(0,50,0)
draw_parameter_layout(-10 + xp,0)
value = @file_index + 1
draw_picture_number_file(13 + xp, 32,value, "File_Number_01",1,0,3,0)
draw_party_characters(180 + xp, 75,ex)
draw_playtime(495, 20, contents.width - 4, 2)
draw_map_location( 400 + xp,64)
draw_level(185 + xp,85,ex)
draw_face_save(40 + xp,0)
else
draw_parameter_layout2(0,50,1)
draw_parameter_layout(-10 + xp,0)
value = @file_index + 1
draw_picture_number_file(13 + xp, 32,value, "File_Number_01",1,0,3,0)
self.contents.draw_text(260, 50, 120, 32, "No Data", 1)
end
end
#--------------------------------------------------------------------------
# ● draw_face
#--------------------------------------------------------------------------
def draw_face_save(x,y)
draw_actor_face(@members[0], x, y)
end
#--------------------------------------------------------------------------
# ● draw_level
#--------------------------------------------------------------------------
def draw_level(x,y,ex)
self.contents.font.color = normal_color
for i in [email]0...@members.size[/email]
break if i > 3
level = @members[i].level
draw_picture_number_file(x + (ex * i) , y ,level, "File_Number_01",1,0,3,1)
end
end
#--------------------------------------------------------------------------
# ● draw_map_location
#--------------------------------------------------------------------------
def draw_map_location(x,y)
self.contents.font.bold = true
self.contents.font.name = "Georgia"
self.contents.font.size = 20
self.contents.font.italic = true
self.contents.draw_text(x, y, 125, 32, @mapname.to_s, 0)
end
#--------------------------------------------------------------------------
# ● draw_party_characters
#--------------------------------------------------------------------------
def draw_party_characters(x, y,ex)
for i in [email]0...@characters.size[/email]
break if i > 3
name = @characters[i][0]
index = @characters[i][1]
draw_character_floor(- 35 + x + i * ex,y - 20)
draw_character(name, index, x + i * ex, y)
end
end
#--------------------------------------------------------------------------
# ● draw_playtime
#--------------------------------------------------------------------------
def draw_playtime(x, y, width, align)
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
draw_picture_number_file(x + 18 * 0, y ,0, "File_Number_01",0,0,3,0) if hour < 10
draw_picture_number_file(x + 18 * 1, y ,hour, "File_Number_01",0,0,3,0)
draw_picture_number_file(x + 18 * 3, y ,0, "File_Number_01",0,0,3,0) if min < 10
draw_picture_number_file(x + 18 * 4, y ,min, "File_Number_01",0,0,3,0)
draw_picture_number_file(x + 18 * 6, y ,0, "File_Number_01",0,0,3,0) if sec < 10
draw_picture_number_file(x + 18 * 7, y ,sec , "File_Number_01",0,0,3,0)
end
#--------------------------------------------------------------------------
# ● selected
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
@saving = $game_temp.scene_save
@file_max = FILES_MAX
@file_max = 1 if FILES_MAX < 1
create_background
create_layout
create_savefile_windows
create_particles
@index = DataManager.last_savefile_index
@check_prev_index = true
@savefile_windows[@index].selected = true
end
#--------------------------------------------------------------------------
# ● Create Background
#--------------------------------------------------------------------------
def create_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_file_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create_Layout
#--------------------------------------------------------------------------
def create_layout
@layout_01 = Sprite.new
@layout_01.bitmap = $game_temp.pre_cache_file_menu[1]
@layout_01.z = 1
@layout_01.blend_type = 1
@save_image = $game_temp.pre_cache_file_menu[2]
@layout_02 = Sprite.new
@layout_02.bitmap = Bitmap.new(@save_image.width,@save_image.height)
cw = @save_image.width
ch = @save_image.height / 2
if @saving
h = 0
else
h = ch
end
src_rect = Rect.new(0, h, cw, ch)
@layout_02.bitmap.blt(0,0, @save_image, src_rect)
@layout_02.z = 3
@layout_02.y = 370
end
#--------------------------------------------------------------------------
# ● Create Save File Window
#--------------------------------------------------------------------------
def create_savefile_windows
@pw_pos = [-160,32]
@aw_pos = [-96,160]
@nw_pos = [-32,288]
@savefile_windows = []
for i in 0...@file_max
@savefile_windows[i] = Window_SaveFile_A.new(i, DataManager.make_filename(i))
@savefile_windows[i].z = 2
@savefile_windows[i].visible = false
@savefile_windows[i].x = 400
end
check_active_window
@item_max = @file_max
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
return if @background == nil
Graphics.freeze
dispose_background
dispose_particles
dispose_layout
dispose_item_windows
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout_01.dispose
@layout_02.bitmap.dispose
@layout_02.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose of Save File Window
#--------------------------------------------------------------------------
def dispose_item_windows
for window in @savefile_windows
window.dispose
end
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
check_start_index
update_savefile_windows
update_background
update_particles
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● check_start_index
#--------------------------------------------------------------------------
def check_start_index
return if @check_prev_index == false
@check_prev_index = false
check_active_window
end
#--------------------------------------------------------------------------
# ● check_active_window
#--------------------------------------------------------------------------
def check_active_window
@index = 0 if @index == nil
for i in 0...@file_max
@pw = @index - 1
@pw = 0 if @pw > @file_max - 1
@pw = @file_max- 1 if @pw < 0
@aw = @index
@nw = @index + 1
@nw = 0 if @nw > @file_max - 1
@nw = @file_max - 1 if @nw < 0
case @savefile_windows[i].file_index
when @pw,@nw
@savefile_windows[i].visible = true
@savefile_windows[i].contents_opacity = 80
when @aw
@savefile_windows[i].visible = true
@savefile_windows[i].contents_opacity = 255
else
@savefile_windows[i].visible = false
end
end
end
#--------------------------------------------------------------------------
# ● Update Save File Window
#--------------------------------------------------------------------------
def update_savefile_windows
update_slide_window
for window in @savefile_windows
window.update
end
end
#--------------------------------------------------------------------------
# ● update_slide_window
#--------------------------------------------------------------------------
def update_slide_window
slide_window_x(@pw,@pw_pos[0])
slide_window_x(@aw,@aw_pos[0])
slide_window_x(@nw,@nw_pos[0])
slide_window_y(@pw,@pw_pos[1])
slide_window_y(@aw,@aw_pos[1])
slide_window_y(@nw,@nw_pos[1])
end
#--------------------------------------------------------------------------
# ● slide_window_x
#--------------------------------------------------------------------------
def slide_window_x(i,x_pos)
if @savefile_windows[i].x < x_pos
@savefile_windows[i].x += 15
@savefile_windows[i].x = x_pos if @savefile_windows[i].x > x_pos
end
if @savefile_windows[i].x > x_pos
@savefile_windows[i].x -= 15
@savefile_windows[i].x = x_pos if @savefile_windows[i].x < x_pos
end
end
#--------------------------------------------------------------------------
# ● slide_window_y
#--------------------------------------------------------------------------
def slide_window_y(i,y_pos)
if @savefile_windows[i].y < y_pos
@savefile_windows[i].y += 15
@savefile_windows[i].y = y_pos if @savefile_windows[i].y > y_pos
end
if @savefile_windows[i].y > y_pos
@savefile_windows[i].y -= 15
@savefile_windows[i].y = y_pos if @savefile_windows[i].y < y_pos
end
end
#--------------------------------------------------------------------------
# ● reset_position
#--------------------------------------------------------------------------
def reset_position(diretion)
check_active_window
case diretion
when 0
@savefile_windows[@pw].y = -64
@savefile_windows[@pw].x = 0
when 1
@savefile_windows[@nw].y = 440
@savefile_windows[@nw].x = 0
end
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ● Frame Update
#--------------------------------------------------------------------------
def update
update_sprites
update_command
end
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::C)
on_savefile_ok
elsif Input.trigger?(Input::B)
Sound.play_cancel
return_scene
else
last_index = @index
if Input.trigger?(Input::DOWN)
execute_index(1)
if @file_max > 2
reset_position(1)
else
reset_position(0)
end
end
if Input.trigger?(Input::UP)
execute_index(-1)
reset_position(0)
end
if @index != last_index
Sound.play_cursor
@savefile_windows[last_index].selected = false
@savefile_windows[@index].selected = true
end
end
end
#--------------------------------------------------------------------------
# ● Execute Index
#--------------------------------------------------------------------------
def execute_index(value)
@index += value
@index = @index >= @file_max ? 0 : @index < 0 ? (@file_max - 1) : @index
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Execute Pre Cache End Menu
#--------------------------------------------------------------------------
def execute_pre_cache_end_menu
@pre_cache_end_menu = []
@pre_cache_end_menu.push(Cache.menu_end("Background"))
@pre_cache_end_menu.push(Cache.menu_end("Layout"))
end
end
#==============================================================================
# ■ Scene_End
#==============================================================================
class Scene_End
include MOG_MENU_END
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Setup
#--------------------------------------------------------------------------
def execute_setup
@phase = 0
create_sprites
end
#--------------------------------------------------------------------------
# ● Execute Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Scene_End
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_menu_background
create_layout
create_particles
create_command_window
end
#--------------------------------------------------------------------------
# ● Create Menu Background
#--------------------------------------------------------------------------
def create_menu_background
@background = Plane.new
@background.bitmap = $game_temp.pre_cache_end_menu[0]
@background.z = 0
@background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.pre_cache_end_menu[1]
@layout.z = 3
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_GameEnd.new
@command_window.set_handler(:to_title, method(:command_to_title))
@command_window.set_handler(:shutdown, method(:command_shutdown))
@command_window.set_handler(:cancel, method(:return_scene))
end
end
#==============================================================================
# ■ Scene_End
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
Graphics.freeze
dispose_background
dispose_layout
dispose_particles
dispose_command_window
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose
@background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose
@layout = nil
end
#--------------------------------------------------------------------------
# ● Dispose Particles
#--------------------------------------------------------------------------
def dispose_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Dispose Command Window
#--------------------------------------------------------------------------
def dispose_command_window
return if @command_window == nil
@command_window.dispose
end
end
#==============================================================================
# ■ Scene_End
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# ● Update Sprites
#--------------------------------------------------------------------------
def update_sprites
update_background
update_particles
update_command_window
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += @background_scroll[0]
@background.oy += @background_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particles
#--------------------------------------------------------------------------
def update_particles
return if @particles_sprite == nil
@particles_sprite.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update Command Window
#--------------------------------------------------------------------------
def update_command_window
return if @command_window == nil
@command_window.update
end
end
#==============================================================================
# ■ Scene_End
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_sprites
update_command
end
#--------------------------------------------------------------------------
# ● Return Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● ON Actor Charge
#--------------------------------------------------------------------------
def on_actor_change
$game_temp.actor_menu_temp = @actor
SceneManager.goto(Scene_Status)
end
end
#==============================================================================
# ■ Scene_End
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
end
end
$mog_rgss3_monogatari = true