class Tempo_de_jogo < Window_Base def initialize super(0, 0, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end def refresh self.contents.clear self.contents.font.color = system_color @total_sec = Graphics.frame_count / Graphics.frame_rate hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 text = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(-20, 5, 120, 24, text, 2) end def update super if Graphics.frame_count / Graphics.frame_rate != @total_sec refresh end end end
class Numero_de_passos < Window_Base def initialize super(0, 0, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, "Passos ") self.contents.font.color = normal_color self.contents.draw_text(-20, 5, 120, 24, $game_party.steps.to_s, 2) end end class Dinheiro < Window_Base def initialize super(0, 0, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end def refresh self.contents.clear cx = contents.text_size($data_system.words.gold).width self.contents.font.color = normal_color self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2) end end
class Window_Hero_Status < Window_Base
def initialize(actor) super(0, 0, 480, 192) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @actor = actor @frame = 0 @pose = 0 @rot = 0 refresh end def refresh self.contents.clear draw_actor_sprite draw_actor_name2(@actor, 8, 0, 1) draw_actor_class(@actor, 96, 0) draw_actor_level(@actor, 96, 24) draw_actor_state(@actor, 96, 48) self.contents.font.color = system_color self.contents.draw_text(96, 72, 80, 32, "EXP:") self.contents.font.color = normal_color self.contents.draw_text(96, 72, 160, 32, @actor.exp_s + "/" + @actor.next_exp_s , 2) draw_actor_hp(@actor, 96, 100, 172) draw_actor_sp(@actor, 96, 124, 172) end def draw_actor_sprite #Limpa a área onde o heroi será desenhado self.contents.fill_rect(0, 32, 80, 120, Color.new(0, 0, 0, 0)) #Carrega a imagem do herói numa var bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue) #desenha o herói, aumentado de tamanho e no frame correnspondente self.contents.stretch_blt(Rect.new(0, 32, 80, 120), bitmap, Rect.new(bitmap.width / 4 * @frame, bitmap.height / 4 * @pose , bitmap.width / 4 , bitmap.height / 4)) end def update super if Graphics.frame_count % 10 == 0 @frame == 3 ? @frame = 0 : @frame += 1 draw_actor_sprite end if @rot == 100 and @pose < 3 @pose += 1 @rot = 0 elsif @rot == 100 and @pose == 3 @pose = 0 @rot = 0 else @rot += 1 end end end
class Equipamento < Window_Base def initialize(actor) super(0, 0, 240, 192) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @actor = actor refresh end def refresh self.contents.clear draw_item_name($data_weapons[@actor.weapon_id], 0, 0) draw_item_name($data_armors[@actor.armor1_id], 0, 32) draw_item_name($data_armors[@actor.armor2_id], 0, 64) draw_item_name($data_armors[@actor.armor3_id], 0, 96) draw_item_name($data_armors[@actor.armor4_id], 0, 128) end end
class Nome_do_Mapa < Window_Base def initialize super(0, 0, 640, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end def refresh self.contents.draw_text(4, 16, 608, 32, $game_map.name.to_s, 1) end end
class Status_do_Personagem < Window_Base def initialize(actor) super(0, 0, 240, 192) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @actor = actor refresh end def refresh self.contents.clear draw_actor_parameter(@actor, 0, 0, 0) draw_actor_parameter(@actor, 0, 21, 1) draw_actor_parameter(@actor, 0, 42, 2) draw_actor_parameter(@actor, 0, 63, 3) draw_actor_parameter(@actor, 0, 84, 4) draw_actor_parameter(@actor, 0, 105, 5) draw_actor_parameter(@actor, 0, 126, 6) end end
class Game_Map def name $map_infos[@map_id] end end
class Scene_Title $map_infos = load_data("Data/MapInfos.rxdata") for key in $map_infos.keys $map_infos[key] = $map_infos[key].name end end
#-----------------------------------------------------------------
class Window_Base def draw_actor_name2(actor, x, y,align=0) self.contents.font.color = normal_color self.contents.draw_text(x, y, 64, 32, actor.name ,align) end def draw_actor_parameter2(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int end self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 164, y, 36, 32, parameter_value.to_s, 2) end alias cbs_draw_actor_hp draw_actor_hp def draw_actor_hp(actor, x, y, width = 146, height = 15) bg = Color.new( 0, 0, 0, 160) c1 = Color.new(255, 0, 0, 0) c2 = Color.new(255, 255, 0, 160) self.contents.fill_rect(x, y, width, height, bg) width2 = width * actor.hp / actor.maxhp gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2) cbs_draw_actor_hp(actor, x, y, width) end alias cbs_draw_actor_sp draw_actor_sp def draw_actor_sp(actor, x, y, width = 146, height = 15) bg = Color.new( 0, 0, 0, 160) c1 = Color.new( 0, 0, 255, 0) c2 = Color.new( 0, 255, 255, 160) self.contents.fill_rect(x, y, width, height, bg) if actor.maxsp != 0 width2 = width * actor.sp / actor.maxsp else width2 = width * actor.sp / 1 end gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2) cbs_draw_actor_sp(actor, x, y, width) end def gradient(x, y, width, height, c1, c2) for i in 1..width x2 = x + i - 1 r = c1.red * (width - i) / width + c2.red * i / width g = c1.green * (width - i) / width + c2.green * i / width b = c1.blue * (width - i) / width + c2.blue * i / width a = c1.alpha * (width - i) / width + c2.alpha * i / width self.contents.fill_rect(x2, y, 1, height, Color.new(r, g, b, a)) end end end
class Scene_Menu def initialize(indexagem_do_menu = 0) @indexagem_do_menu = indexagem_do_menu end
def main s1 = "Objetos" s2 = "Habilidades" s3 = "Equipamento" s4 = "Guardar" s5 = "Salir" @janela_de_comando = Window_Command.new(160, [s1, s2, s3, s4, s5]) @janela_de_comando.index = @indexagem_do_menu if $game_party.actors.size == 0 @janela_de_comando.disable_item(0) @janela_de_comando.disable_item(1) @janela_de_comando.disable_item(2) @janela_de_comando.disable_item(3) end if $game_system.save_disabled @janela_de_comando.disable_item(3) end @var = 0 @spriteset = Spriteset_Map.new @sprite = Sprite.new @sprite.bitmap = RPG::Cache.windowskin("2") @sprite.zoom_y = 0 @sprite.y = 240 @tempo_de_jogo = Tempo_de_jogo.new @tempo_de_jogo.x = 480 @tempo_de_jogo.y = 0 @tempo_de_jogo.back_opacity = 150 @tempo_de_jogo.opacity = 0
@numero_de_passos = Numero_de_passos.new @numero_de_passos.x = 480 @numero_de_passos.y = 64 @numero_de_passos.back_opacity = 150 @numero_de_passos.opacity = 0 @dinheiro = Dinheiro.new @dinheiro.x = 480 @dinheiro.y = 128 @dinheiro.back_opacity = 150 @dinheiro.opacity = 0 @status_do_heroi = @status_window = Window_Hero_Status.new($game_party.actors[0]) @status_do_heroi.x = 0 @status_do_heroi.y = 0 @status_do_heroi.back_opacity = 150 @status_do_heroi.opacity = 0 @status = Status_do_Personagem.new($game_party.actors[0]) @status.x = 240 @status.y = 192 @status.back_opacity = 150 @status.opacity = 0
@equipamento = Equipamento.new($game_party.actors[0]) @equipamento.x = 0 @equipamento.y = 192 @equipamento.back_opacity = 150 @equipamento.opacity = 0 @nome_do_mapa = Nome_do_Mapa.new @nome_do_mapa.x = 0 @nome_do_mapa.y = 384 @nome_do_mapa.back_opacity = 150 @nome_do_mapa.opacity = 0 @janela_de_comando.x = 480 @janela_de_comando.y = 192 @janela_de_comando.back_opacity = 150 @janela_de_comando.opacity = 0 Graphics.transition
loop do Graphics.update Input.update update @sprite.zoom_y < 1 ? @sprite.zoom_y += 0.05 : @sprite.zoom_y = 1 @sprite.y > 0 ? @sprite.y -= 12 : @var +=1 case @var when 1 @janela_de_comando.opacity = 100 @nome_do_mapa.opacity = 100 @equipamento.opacity = 100 @status.opacity = 100 @status_do_heroi.opacity = 100 @dinheiro.opacity = 100 @numero_de_passos.opacity = 100 @tempo_de_jogo.opacity = 100 when 2 @janela_de_comando.opacity = 120 @nome_do_mapa.opacity = 120 @equipamento.opacity = 120 @status.opacity = 120 @status_do_heroi.opacity = 120 @dinheiro.opacity = 120 @numero_de_passos.opacity = 120 @tempo_de_jogo.opacity = 120 when 3 @janela_de_comando.opacity = 150 @nome_do_mapa.opacity = 150 @equipamento.opacity = 150 @status.opacity = 150 @status_do_heroi.opacity = 150 @dinheiro.opacity = 150 @numero_de_passos.opacity = 150 @tempo_de_jogo.opacity = 150 when 4 @janela_de_comando.opacity = 170 @nome_do_mapa.opacity = 170 @equipamento.opacity = 170 @status.opacity = 170 @status_do_heroi.opacity = 170 @dinheiro.opacity = 170 @numero_de_passos.opacity = 170 @tempo_de_jogo.opacity = 170 when 5 @janela_de_comando.opacity = 190 @nome_do_mapa.opacity = 190 @equipamento.opacity = 190 @status.opacity = 190 @status_do_heroi.opacity = 190 @dinheiro.opacity = 190 @numero_de_passos.opacity = 190 @tempo_de_jogo.opacity = 190 when 6 @janela_de_comando.opacity = 200 @nome_do_mapa.opacity = 200 @equipamento.opacity = 200 @status.opacity = 200 @status_do_heroi.opacity = 200 @dinheiro.opacity = 200 @numero_de_passos.opacity = 200 @tempo_de_jogo.opacity = 200 end if $scene != self break end end
Graphics.freeze
@janela_de_comando.dispose @tempo_de_jogo.dispose @numero_de_passos.dispose @dinheiro.dispose @status_do_heroi.dispose @status.dispose @equipamento.dispose @nome_do_mapa.dispose @sprite.dispose @spriteset.dispose end def update @janela_de_comando.update @tempo_de_jogo.update @numero_de_passos.update @dinheiro.update @status_do_heroi.update @status.update @equipamento.update @nome_do_mapa.update @sprite.update @spriteset.update update_do_comando end def update_do_comando if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end if Input.trigger?(Input::C) if $game_party.actors.size == 0 and @janela_de_comando.index < 3 $game_system.se_play($data_system.buzzer_se) return end case @janela_de_comando.index when 0 $game_system.se_play($data_system.decision_se) $scene = Scene_Item.new when 1 if $game_party.actors[0].restriction >= 2 $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Scene_Skill.new(0) when 2 $game_system.se_play($data_system.decision_se) $scene = Scene_Status.new(0) when 3 if $game_system.save_disabled $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Scene_Save.new when 4 $game_system.se_play($data_system.decision_se) $scene = Scene_End.new end return end end end |