RMVX

SRPG 부대편성씬 닫아주세요

by minibalrog posted Mar 26, 2012
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
srpg

버튼B를 (키보드상 x)
눌러도 창이 안닫혀 커맨드 윈도우 선택지에서 
명령을 하나 늘려서 닫으려 합니다.
'when 2 # 취소' 어떤 명령어가 들어가야 
작동을 하게 될까요? 아니면 종료 처리쪽의 문제일까요?
혹 다른 방법이 있으시면  가르쳐주십쇼

class TSrpg_Edit_Scene < Scene_Base
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_reader :member_max
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize(map_id)
    @map_id = map_id
    if $data_mapinfos[map_id].name =~ TSRPG::Pattern::SRPG
#    if $data_mapinfos[$game_map.map_id].name =~ TSRPG::Pattern::SRPG
      @member_max = $1.to_i
    end
    
  end
  #--------------------------------------------------------------------------
  # ● 개시 처리
  #--------------------------------------------------------------------------
  def start
    super
    $game_temp.srpg_member = []       # 부대 배열의 초기화
    # 자동전투 캐릭터를 부대에 추가
#    for i in 0...$game_party.members.size
    for i in 0...$game_party.battle_members.size
      if $game_party.members[i].auto_battle and $game_temp.srpg_member.size < @member_max
        $game_temp.srpg_member.push(i)
      end
    end
    # 맵 ID에 강제 출격 설정되어 있는 캐릭터를 부대에 추가
    if TSRPG::Options::MAP_ACTOR[@map_id] != nil
#      for i in 0...$game_party.members.size
      for i in 0...$game_party.battle_members.size
        if TSRPG::Options::MAP_ACTOR[@map_id].include?($game_party.members[i].id)
          $game_temp.srpg_member.push(i)
        end
      end
    end
    create_menu_background            # 배경의 작성
    @help_window = Window_Help.new
    create_command_window
    @character_window = TRts_Window_Character.new(272, 56, 272, 360, @map_id)
    @character_window.help_window = @help_window
    @status_window = TRts_Window_Status.new(0, 136, @map_id)
  end
  #--------------------------------------------------------------------------
  # ● 커맨드 윈도우의 작성
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = "부대편성"
    s2 = "출격"
    s3 = "취소"
    @command_window = TRts_Window_Command.new(272, [s1, s2, s3])
    @command_window.index = 0
    @command_window.y = 56
    @command_window.active = true
    @command_window.help_window = @help_window
  end
  #--------------------------------------------------------------------------
  # ● 종료 처리
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @command_window.dispose
    @character_window.dispose
    @status_window.dispose
    @actor_window.dispose if @actor_window != nil
    end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @status_window.update
    if @actor_window != nil
      update_actor_selection
    elsif @character_window.active
      update_character_selection
    else
      update_command_selection
    end
  end
  #--------------------------------------------------------------------------
  # ● 부대 윈도우의 갱신
  #--------------------------------------------------------------------------
  def update_character_selection
    @character_window.update
    if Input.trigger?(Input::A)   # 액터 스테이터스를 표시
      Sound.play_decision
      @character_window.active = false
#      @actor_window = Window_Status.new($game_party.members[@character_window.index])
      @actor_window = Window_Status.new($game_party.battle_members[@character_window.index])
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @character_window.active = false
      @character_window.index = -1
    elsif Input.trigger?(Input::C)
      if $game_temp.srpg_member.include?(@character_window.index)
        # 미리 등록되어 있던 멤버라면 제외한다. 강제출격 멤버는 제외할 수 없다
#       if $game_party.members[@character_window.index].auto_battle or
#          (TSRPG::Options::MAP_ACTOR[@map_id] != nil and
#          TSRPG::Options::MAP_ACTOR[@map_id].include?($game_party.members[@character_window.index].id))
       if $game_party.battle_members[@character_window.index].auto_battle or
          (TSRPG::Options::MAP_ACTOR[@map_id] != nil and
          TSRPG::Options::MAP_ACTOR[@map_id].include?($game_party.battle_members[@character_window.index].id))
          Sound.play_buzzer
        else
          Sound.play_cancel
          $game_temp.srpg_member.delete(@character_window.index)
        end
      else
        # 미등록 상태라면 등록, 인원수 한계라면 등록하지 않는다
        if $game_temp.srpg_member.size == @member_max
          Sound.play_buzzer
        else
          Sound.play_decision
          $game_temp.srpg_member.push(@character_window.index)
        end
      end
      # 윈도우의 갱신
      @character_window.refresh
      @status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 커맨드 윈도우의 갱신
  #--------------------------------------------------------------------------
  def update_command_selection
    @command_window.update
    if Input.trigger?(Input::B)
      if TSRPG::Options::CANCEL_EDIT
        Sound.play_cancel
        $game_temp.srpg_member = nil
        $scene = Scene_Map.new
      else
        Sound.play_buzzer
      end
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0    # 부대편성
        Sound.play_decision
        @command_window.active = false
        @character_window.active = true
        @character_window.index = 0
      when 1    # 출격
        if $game_temp.srpg_member.size > 0
          Sound.play_decision
          $game_temp.srpg_member.sort!
          $scene = Scene_Map.new
          return
        else
when 2 (여기에 넣는거 아닐까요?)
          Sound.play_buzzer
        end
      end
    end
    end
  #--------------------------------------------------------------------------
  # ● 액터 스테이터스 윈도우의 갱신
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B) or Input.trigger?(Input::C)
      Sound.play_cancel
      @actor_window.dispose
      @actor_window = nil
      @character_window.active = true
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      @character_window.index -= 1
      if @character_window.index < 0
#        @character_window.index = $game_party.members.size - 1
        @character_window.index = $game_party.battle_members.size - 1
      end
      @actor_window.dispose
#      @actor_window = Window_Status.new($game_party.members[@character_window.index])
      @actor_window = Window_Status.new($game_party.battle_members[@character_window.index])
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      @character_window.index += 1
#      if @character_window.index >= $game_party.members.size
      if @character_window.index >= $game_party.battle_members.size
        @character_window.index = 0
      end
      @actor_window.dispose
#      @actor_window = Window_Status.new($game_party.members[@character_window.index])
      @actor_window = Window_Status.new($game_party.battle_members[@character_window.index])
    end
  end
end