제한변경
2007.02.01 03:16

저장 공간 15 슬롯으로 늘리기

조회 수 1996 추천 수 2 댓글 4
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
#RPG만들기 XP포럼 - XP강좌 천무님
#Main위에 삽입, 그냥 복사해서 붙히시면 됩니다. 원본 출처는 KGC입니다.
#빨간색으로 주석을 달아놨으니 찾아서 세이브 파일 수를 늘릴수도 있습니다.마음대로 고치실 수도 있습니다.

#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
#  세이브 화면 및 로드 화면의 슈퍼 클래스입니다.
#  2000식15개 표시에 대응하고 있습니다.
#==============================================================================

class Scene_File
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     help_text : 헬프 윈도우에 표시하는 캐릭터 라인
  #--------------------------------------------------------------------------
  def initialize(help_text)
    @help_text = help_text
    @index_y = 0
  end
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 헬프 윈도우를 작성
    @help_window = Window_Help.new
    @help_window.set_text(@help_text)
    # 세이브 파일 윈도우를 작성
    @savefile_windows = []
    for i in 0...15 #원하는 세이브 파일 수만큼
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
      @savefile_windows[i].visible = false
    end
    # 마지막에 조작한 파일을 선택
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    i = 0
    if @file_index <= 12
      while i <= 2
        @savefile_windows[@file_index + i].y = 138 * i + 64
        @savefile_windows[@file_index + i].visible = true
        i += 1
        @index_y = 0
      end
    else
      while i <= 2
        @savefile_windows[@file_index - 2 + i].y = 138 * i + 64
        @savefile_windows[@file_index - 2 + i].visible = true
        i += 1
        @index_y = 2
      end
    end
    # 트란지션 실행
    Graphics.transition
    # 메인 루프
    loop do
      # 게임 화면을 갱신
      Graphics.update
      # 입력 정보를 갱신
      Input.update
      # 프레임 갱신
      update
      # 화면이 바뀌면(자) 루프를 중단
      if $scene != self
        break
      end
    end
    # 트란지션 준비
    Graphics.freeze
    # 윈도우를 해방
    @help_window.dispose
    for i in @savefile_windows
      i.dispose
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 윈도우를 갱신
    @help_window.update
    for i in @savefile_windows
      i.update
    end
    # C 버튼이 밀렸을 경우
    if Input.trigger?(Input::C)
      # 메소드 on_decision (계승처에서 정의) 를 부르는
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    # B 버튼이 밀렸을 경우
    if Input.trigger?(Input::B)
      # 메소드 on_cancel (계승처에서 정의) 를 부를
      on_cancel
      return
    end
    # 방향 버튼아래가 밀렸을 경우
    if Input.repeat?(Input::DOWN)
      # 방향 버튼아래의 압하 상태가 리피트가 아닌 경우인가 ,
      # 또는 커서 위치가 14 보다 전의 경우
      if Input.trigger?(Input::DOWN) or @file_index < 14 #원하는 세이브파일 수보다 1 적은 수. 이 경우 15개이므로 14.
        # 커서 SE 를 연주
        $game_system.se_play($data_system.cursor_se)
        # 커서를 아래에 이동
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 1) % 15
        @savefile_windows[@file_index].selected = true
        @index_y += 1
        # 윈도우 이동
        self.move_window
        return
      end
    end
    # 방향 버튼 위가 밀렸을 경우
    if Input.repeat?(Input::UP)
      # 방향 버튼 위의 압하 상태가 리피트가 아닌 경우인가 ,
      # 또는 커서 위치가 0 보다 뒤의 경우
      if Input.trigger?(Input::UP) or @file_index > 0
        # 커서 SE 를 연주
        $game_system.se_play($data_system.cursor_se)
        # 커서를 위에 이동
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 14) % 15
        @savefile_windows[@file_index].selected = true
        @index_y -= 1
        # 윈도우 이동
        self.move_window
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 파일명의 작성
  #     file_index : 세이브 파일의 인덱스 (0~14)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rxdata"
  end
#--------------------------------------------------------------------------
# ● 세이브 윈도우의 이동
#--------------------------------------------------------------------------
def move_window
if @index_y >= 0 && @index_y <= 2
return
end
for i in 0...15 #원하는 세이브파일 수만큼
@savefile_windows[i].visible = false
end
i = 0
if @index_y == 3
if @file_index == 0
while i <= 2
@savefile_windows[@file_index + i].y = 138 * i + 64
@savefile_windows[@file_index + i].visible = true
i += 1
end
@index_y = 0
else
while i <= 2
@savefile_windows[@file_index - 2 + i].y = 138 * i + 64
@savefile_windows[@file_index - 2 + i].visible = true
i += 1
end
@index_y = 2
end
elsif @index_y == -1
if @file_index == 14
while i <= 2
@savefile_windows[@file_index - 2 + i].y = 138 * i + 64
@savefile_windows[@file_index - 2 + i].visible = true
i += 1
end
@index_y = 2
else
while i <= 2
@savefile_windows[@file_index + i].y = 138 * i + 64
@savefile_windows[@file_index + i].visible = true
i += 1
end
@index_y = 0
end
end
end


end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  タイトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  def main
    # 戦闘テストの場合
    if $BTEST
      battle_test
      return
    end
    # データベースをロード
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    # システムオブジェクトを作成
    $game_system = Game_System.new
    # タイトルグラフィックを作成

#===============================================================================================================
###로고 띄우기
#Logo("DK1LOGO", "059-Applause01") #이 줄을 넣어준 횟수만큼 로고를 띄움. Title폴더에서 DK1LOGO라는 이름의 그래픽을
#Logo("DK1LOGO", "059-Applause01") #효과음 폴더의 059-Applause01의 음향과 함께 띄운다.
#Logo("DK1LOGO", "059-Applause01")
#===============================================================================================================

    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    # コマンドウィンドウを作成
    s1 = "·시작"
    s2 = "·로드"
    s3 = "·홈페이지가기"
    s4 = "·메일보내기"
    s5 = "·종료"
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5])
    @command_window.back_opacity = 0
    # 위의 숫자 0 을 160 으로 맞추면 기본투명색이 됩니다.
    @command_window.x = 100 - @command_window.width / 2
    @command_window.y = 250
    # 320 / 288 은 기본수치.
    # 커맨드메뉴를 기본자리로 돌려놓으려면 x = 320 / y = 288 을 입력하세요.
    # セーブファイルがひとつでも存在するかどうかを調べる
    # 有効なら @continue_enabled を true、無効なら false にする
    @continue_enabled = false
    # false
    for i in 0..14 #세이브 파일을 15개로 늘린 경우 3이 아닌 14로 고쳐줍니다.
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    # コンティニューが有効な場合、カーソルをコンティニューに合わせる
    # 無効な場合、コンティニューの文字をグレー表示にする
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    # タイトル BGM を演奏
    $game_system.bgm_play($data_system.title_bgm)
    # ME、BGS の演奏を停止
    Audio.me_stop
    Audio.bgs_stop
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # コマンドウィンドウを解放
    @command_window.dispose
    # タイトルグラフィックを解放
    @sprite.bitmap.dispose
    @sprite.dispose
  end

#로고 띄우기 메소드
def Logo(logo, 효과음)
unless $DEBUG 
Audio.se_play("Audio/SE/" + 효과음)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title(logo)
@sprite.x = (640 - @sprite.bitmap.width) / 2
@sprite.y = (480 - @sprite.bitmap.height) / 2
@sprite.opacity = 255
Graphics.transition(40)
for i in 0..80
@sprite.opacity =240 - (i - 40) * 6 if i >= 40
Graphics.update
end
@sprite.dispose
Graphics.freeze
end
end

  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # コマンドウィンドウを更新
    @command_window.update
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # コマンドウィンドウのカーソル位置で分岐
      case @command_window.index
      when 0  # ニューゲーム
        command_new_game
      when 1  # コンティニュー
        command_continue
      when 2  # 3.
        OpenBrowser("http://rpgxp.co.kr/")
      when 3  # 4.
        OpenBrowser("mailto:dwjk@hotmail.com")
      when 4  # シャットダウン
        command_shutdown
      end
    end
  end

end #클래스 종료


#==============================================================================
# ■ Window_SaveFile
#------------------------------------------------------------------------------
#  세이브 화면 및 로드 화면에서 표시하는, 세이브 파일의 윈도우입니다.
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_reader   :filename                 # 파일명
  attr_reader   :selected                 # 선택 상태
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     file_index : 세이브 파일의 인덱스 (0~3)
  #     filename   : 파일명
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(0, 64 + file_index % 15 * 138, 640, 138) #15에 주목. 원하는 세이브 파일 수만큼.
    self.contents = Bitmap.new(width - 32, height - 32)
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.rxdata"
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist? (@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      @characters = Marshal.load(file)
      @frame_count = Marshal.load(file)
      @game_system = Marshal.load(file)
      @game_switches = Marshal.load(file)
      @game_variables = Marshal.load(file)
      @total_sec = @frame_count / Graphics.frame_rate
      file.close
    end
    refresh
    @selected = false
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # 파일 번호를 묘화
    self.contents.font.color = normal_color
    name = "파일#{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name). width
    # 세이브 파일이 존재하는 경우
    if @file_exist
      # 캐릭터를 묘화
  x = 112
      for i in 0...@characters.size
        bitmap = RPG::Cache.battler(@characters[i][0], @characters[i][1])
        cw = bitmap.rect.width
        ch = bitmap.rect.height
        src_rect = Rect.new(0, 0, cw, ch)
        dest_rect = Rect.new(x, 0, cw / 2, ch / 2)
        x += dest_rect.width
        self.contents.stretch_blt(dest_rect, bitmap, src_rect)
      end
      # 플레이 시간을 묘화
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 8, 600, 32, time_string, 2)
      # 타임 스탬프를 묘화
      self.contents.font.color = normal_color
      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
      self.contents.draw_text(4, 40, 600, 32, time_string, 2)
      end
  end
  #--------------------------------------------------------------------------
  # ● 선택 상태의 설정
  #     selected : 새로운 선택 상태 (true=선택 false=비선택)
  #--------------------------------------------------------------------------
  def selected=(selected)
    @selected = selected
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # ● 커서의 구형 갱신
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @selected
      self.cursor_rect.set(0, 0, @name_width + 8, 32)
    else
      self.cursor_rect.empty
    end
  end
end


class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    # 텐포라리오브제크트를 재작성
    $game_temp = Game_Temp.new
    # 타임 스탬프가 최신의 파일을 선택
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0...15 #원하는 세이브 파일 수만큼
      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("어느 것을 선택하시겠습니까?")
  end
end

  • ?
    루비 2007.08.07 09:57
    저기... 여기 스크립트가 시작 메뉴에도 영향을 준다는...
  • ?
    김준형 2007.09.24 07:51
    ㅇ오오오 내가 찾던 엄청난강좌 기역시옷..
  • ?
    김준형 2007.09.24 08:00
    근데 홈페이지 같은경우 페이지를 적어놓고 열면 오류나는데 다른방법 없나요?
  • ?
    루비 2007.10.03 07:44
    감사합니다^^


Copyright ⓒ Nioting All Rights Reserved. (since 1999)    개인정보
        

Fatal error: Cannot access property sessionController::$lifetime in /web/old/xe/modules/session/session.controller.php on line 45