UltimaForum

Skrypty [XP] - Ulepszony Scene_End

PaKiTos - Sob 01 Maj, 2010 08:43
Temat postu: Ulepszony Scene_End
Skrypt ulepsza Scene_End na lepszy. Można w nim zobaczyć mapkę lub szybko wczytać grę.

A oto on:
Spoiler:

SKRYPT:
Spoiler:

Kod:
# Ulepszony Scene_End
# by PaKiTos

class Scene_End
  def main
    @e = Spriteset_Map.new
    s1 = "Ekran tytułowy"
    s2 = "Wczytaj grę"
    s3 = "Wyjdź"
    s4 = "Powrót"
    @command_window = Window_Command.new(192, [s1, s2, s3,s4])
    @command_window.x = 98 - @command_window.width / 2
    @command_window.y = 146 - @command_window.height / 2
    @c_window = Window_Shi.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @c_window.dispose
    @e.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
  def update
    @command_window.update
    @c_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(5)
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        command_to_title
      when 1 
        command_to_title2
      when 2 
        command_shutdown
      when 3 
        command_cancel
      end
      return
    end
  end
 
  def command_to_title
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $scene = Scene_Title.new
  end
 
  def command_to_title2
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $scene = Scene_Load2.new
  end
 
  def command_shutdown
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $scene = nil
  end
 
  def command_cancel
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Menu.new(5)
  end
end

class Window_Shi < Window_Base
 
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = $defaultfontsize
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.draw_text(4, 0, 120, 32, "Wybierz opcję.")
  end
end

class Scene_Load2 < Scene_File
 
  def initialize
    $game_temp = Game_Temp.new
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
      if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Który plik wczytać ?")
  end
 
  def on_decision(filename)
    unless FileTest.exist?(filename)
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $game_system.se_play($data_system.load_se)
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    $game_map.update
    $scene = Scene_Map.new
  end
 
  def on_cancel
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_End.new
  end
 
  def read_save_data(file)
    characters = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
    if $game_system.magic_number != $data_system.magic_number
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    $game_party.refresh
  end
end


TU NIESPODZIANKA:
Spoiler:

Spoiler:

BUUU! PUSTO!



[ Komentarz dodany przez: Ayene: Sob 01 Maj, 2010 11:24 ]
Edycja by Ayene

HESEE - Sob 01 Maj, 2010 10:45

Mi się przydał i jest dobry.
Ale możesz powiedzieć do czego on dokładnie służy bo nie wiem czy to jest u mnie.

PaKiTos - Sob 01 Maj, 2010 11:14

Ulepsza Scene_End. ( ekran wyłączania gry )
Dodaje opcję wczytania gry i pozwala zobaczyć mapkę, ponieważ na czarnym tle byłoby gorzej, nie sądzicie?

Mam nadzieję, że ktoś użyje skryptu :)

adzio96 - Sob 05 Cze, 2010 17:16

Spoko Skrypcik:)) Napewno się przyda:))
skate51 - Sob 05 Cze, 2010 17:30

Napisz gdzie go wkleić

Daj screen

A tak to spoko skrypt

PaKiTos - Nie 06 Cze, 2010 08:59

Nad Main się wszystko wkleja...
Izaya - Nie 06 Cze, 2010 16:41

Świetny skrypt, przydał mi się.
Dzięki, PaKiTos.


Powered by phpBB modified by Przemo © 2003 phpBB Group