#==============================================================================
# Version History.
#==============================================================================
# 1.5 - Função de desabilitar o save.
# Definição dos nomes das fontes baseado na fonte padrão do sistema,
# para resolver o problema de compatibilidade de fontes de outras línguas.
# Melhoria na posição das janelas.
# Correção do bug de não atualizar o número de itens. (Dual Wield)
# 1.4 - Compatibilidade com Mog Menu Cursor.
# 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
#==============================================================================
#==============================================================================
# ■ MOG MENU BASE
#==============================================================================
module MOG_MENU_BASE
end
$imported = {} if $imported.nil?
$imported[:mog_monogatari] = true
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
#==============================================================================
# ■ 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
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
@index = @index < 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 @index != 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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 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 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Refresh Active
#--------------------------------------------------------------------------
def refresh_active
@active_old = @active
@visible = @active
refresh_index
if !@active
@visible = @active
@next_pos = [[email protected] - 64,0]
else
set_position([email protected] - 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
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Face
#--------------------------------------------------------------------------
def dispose_face
@face.bitmap.dispose if @face.bitmap != nil
@face.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
#--------------------------------------------------------------------------
# * 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.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
#--------------------------------------------------------------------------
# ● 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
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
include MOG_MENU
include MOG_MENU_BASE
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_setup
execute_loop
execute_dispose
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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Active
#--------------------------------------------------------------------------
def active(value)
@active = value
end
end
#==============================================================================
# ■ Members Arrow Sprite
#==============================================================================
class Members_Arrow_Sprite
include MOG_MENU
attr_accessor :active
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#==============================================================================
# ■ Actor Menu Parameter
#==============================================================================
class Actor_Menu_Parameter
#--------------------------------------------------------------------------
# ● 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 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 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.id))
end
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))
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.id))
end
end
#--------------------------------------------------------------------------
# ● Create Members Layout
#--------------------------------------------------------------------------
def create_members_layout
@members_layout = Members_Arrow_Sprite.new
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● 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 0..@number_text.size - 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.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
#==============================================================================
# ■ 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
if @command_window.current_symbol == :save and $game_system.save_disabled
Sound.play_buzzer
return
end
@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
#--------------------------------------------------------------------------
# ● 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 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
#==============================================================================
# ■ 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
#==============================================================================
# ■ 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
#--------------------------------------------------------------------------
# ● 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 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Dispose Members Status
#--------------------------------------------------------------------------
def dispose_members_status
return if @members_status == nil
@members_status.each {|sprite| sprite.dispose }
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 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 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
#--------------------------------------------------------------------------
# ● 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 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# * 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 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
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#==============================================================================
# ■ Scene Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● 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 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
#--------------------------------------------------------------------------
# ● 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 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
skw.update unless @press_lag > 0
if skw.windows_index == @command_window.index
skw.active = true
if @phase == 0
skw.index = 0 if skw.index < 0 or skw.index >= skw.item_max
end
skw.visible = true
else
skw.visible = false
skw.active = 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
#==============================================================================
# ■ 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 Main Command
#--------------------------------------------------------------------------
def update_target_command
if Input.trigger?(:B)
@phase = 1
@skill_window[@command_window.index].index = @item_pre_index
end
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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Set Equip Font
#--------------------------------------------------------------------------
def set_font_equip
return if self.disposed?
return if self.contents == nil
self.contents.font.size = FONT_SIZE
self.contents.font.bold = FONT_BOLD
end
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Set Equip Font
#--------------------------------------------------------------------------
def set_font_equip
return if self.disposed?
return if self.contents == nil
self.contents.font.size = FONT_SIZE
self.contents.font.bold = FONT_BOLD
end
#--------------------------------------------------------------------------
# ● 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
#==============================================================================
# ■ Actor Menu Status
#==============================================================================
class Actor_Equip_Status
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Dispose Face
#--------------------------------------------------------------------------
def dispose_face
@face.dispose
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
#--------------------------------------------------------------------------
# ● 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 Actor Status
#--------------------------------------------------------------------------
def create_actor_status
@actor_status = Actor_Equip_Status.new(@actor)
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
end
#--------------------------------------------------------------------------
# ● Dispose Actor Status
#--------------------------------------------------------------------------
def dispose_actor_status
return if @actor_status == nil
@actor_status.dispose
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● 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.each do |i| i.refresh; i.index = 0; i.unselect end
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
#==============================================================================
# ■ 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
#--------------------------------------------------------------------------
# ● Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● Draw Actor Name
#--------------------------------------------------------------------------
def draw_actor_name
self.contents.font.size = 16
text = @actor.class.name
draw_text(240,185,100,32, text.to_s,1)
self.contents.font.size = 20
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.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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# * 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
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 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 Lopp
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition(10)
loop do
Input.update
update
Graphics.update
break if SceneManager.scene != self
end
end
end
#==============================================================================
# ■ Actor Menu Status Party
#==============================================================================
class Actor_Menu_Status_Party
#--------------------------------------------------------------------------
# ● 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 protected]
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
#--------------------------------------------------------------------------
# ● Window Height
#--------------------------------------------------------------------------
def window_height
Graphics.height
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
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 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
#--------------------------------------------------------------------------
# ● 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 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
#--------------------------------------------------------------------------
# ● 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 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
#==============================================================================
# ■ 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
#--------------------------------------------------------------------------
# ● 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
#--------------------------------------------------------------------------
# ● draw_level
#--------------------------------------------------------------------------
def draw_level(x,y,ex)
self.contents.font.color = normal_color
for i in [email protected]
break if i > 3
level = @members.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.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 protected]
break if i > 3
name = @characters[0]
index = @characters[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 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 = Window_SaveFile_A.new(i, DataManager.make_filename(i))
@savefile_windows.z = 2
@savefile_windows.visible = false
@savefile_windows.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 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 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.file_index
when @pw,@nw
@savefile_windows.visible = true
@savefile_windows.contents_opacity = 80
when @aw
@savefile_windows.visible = true
@savefile_windows.contents_opacity = 255
else
@savefile_windows.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 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
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
@particles_sprite =[]
for i in 0...NUMBER_OF_PARTICLES
@particles_sprite.push(Particles_Menu.new(nil))
end
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
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
end
end
作者: adahs 时间: 2020-3-24 16:38
修改这几段的draw_text吧,括号前两位是x,y坐标