RPGXP 스크립트
2013.10.01 06:25

윈도우 링 메뉴

조회 수 845 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

#==============================================================================
# ■ Window_RingMenu
#==============================================================================
class Window_RingMenu < Window_Base
  #--------------------------------------------------------------------------
  # ○ 클래스 정의
  #--------------------------------------------------------------------------
  STARTUP_FRAMES = 20 # 초기 애니메이션의 프레임
  MOVING_FRAMES = 5   # 링을 돌린 때의 프레임
  RING_R = 64         # 링의 반?
  ICON_ITEM   = RPG::Cache.icon("034-Item03") # 「아이템」메뉴의 아이콘
  ICON_SKILL  = RPG::Cache.icon("044-Skill01") # 「숙련」메뉴의 아이콘
  ICON_EQUIP  = RPG::Cache.icon("001-Weapon01") # 「장비」메뉴의 아이콘
  ICON_STATUS = RPG::Cache.icon("050-Skill07") # 「스테이터스」메뉴의 아이콘
  ICON_SAVE   = RPG::Cache.icon("038-Item07") # 「세이브」메뉴의 아이콘
  ICON_EXIT   = RPG::Cache.icon("046-Skill03") # 「종료」메뉴의 아이콘
  ICON_DISABLE= RPG::Cache.icon("") # 사용 금지항목에 붙는 아이콘
  SE_STARTUP = "056-Right02" # 메뉴가 열릴 때 들리는 SE
  MODE_START = 1 # 시작 에니메이션
  MODE_WAIT  = 2 # 대기
  MODE_MOVER = 3 # 시계방향 회전 애니메이션
  MODE_MOVEL = 4 # 반 시계방향 회전 애니메이션
  #--------------------------------------------------------------------------
  # ○ 억세서
  #--------------------------------------------------------------------------
  attr_accessor :index
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------  
  def initialize( center_x, center_y )
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width-32, height-32)
    self.opacity = 0
    self.back_opacity = 0
    s1 = "소지품"
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "상태"
    s5 = "세이브"
    s6 = "종료"
    @commands = [ s1, s2, s3, s4, s5, s6 ]
    @item_max = 6
    @index = 0
    @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
    @disabled = [ false, false, false, false, false, false ]
    @cx = center_x - 16
    @cy = center_y - 16
    setup_move_start
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    super
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 메뉴의 묘화
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # 아이콘을 묘화
    case @mode
    when MODE_START
      refresh_start
    when MODE_WAIT
      refresh_wait
    when MODE_MOVER
      refresh_move(1)
    when MODE_MOVEL
      refresh_move(0)
    end
    # 액티브한 커맨드명 표시
    rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index],1)
  end
  #--------------------------------------------------------------------------
  # ○ 메뉴의 묘화 (초기화 시)
  #--------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / STARTUP_FRAMES
    r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = MODE_WAIT
    end
  end
  #--------------------------------------------------------------------------
  # ○ 메뉴의 묘화 (대기시)
  #--------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index
      x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
      y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
      draw_item(x, y, i)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 메뉴의 묘화(회전시)
  #  mode : 0=반 시계방향 1=시계방향
  #--------------------------------------------------------------------------
  def refresh_move( mode )
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / MOVING_FRAMES
    d2 *= -1 if mode != 0
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = @cx + ( RING_R * Math.sin( d ) ).to_i
      y = @cy - ( RING_R * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = MODE_WAIT
    end
  end
  #--------------------------------------------------------------------------
  # ● 항목의 묘화
  #     x :
  #     y :
  #     i : 항목 번호
  #--------------------------------------------------------------------------
  def draw_item(x, y, i)
    #p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s
    rect = Rect.new(0, 0, @items[i].width, @items[i].height)
    if @index == i
      self.contents.blt( x, y, @items[i], rect )
      if @disabled[@index]
        self.contents.blt( x, y, ICON_DISABLE, rect )
      end
    else
      self.contents.blt( x, y, @items[i], rect, 128 )
      if @disabled[@index]
        self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 항목을 없앤다
  #     index : 항목 번지?
  #--------------------------------------------------------------------------
  def disable_item(index)
    @disabled[index] = true
  end
  #--------------------------------------------------------------------------
  # ○ 초기화 애니메이션의 준비
  #--------------------------------------------------------------------------
  def setup_move_start
    @mode = MODE_START
    @steps = STARTUP_FRAMES
    if  SE_STARTUP != nil and SE_STARTUP != ""
      Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 회전 애니메이션의 준비
  #--------------------------------------------------------------------------
  def setup_move_move(mode)
    if mode == MODE_MOVER
      @index -= 1
      @index = @items.size - 1 if @index < 0
    elsif mode == MODE_MOVEL
      @index += 1
      @index = 0 if @index >= @items.size
    else
      return
    end
    @mode = mode
    @steps = MOVING_FRAMES
  end
  #--------------------------------------------------------------------------
  # ○ 애니메이션 중인지 아닌지
  #--------------------------------------------------------------------------
  def animation?
    return @mode != MODE_WAIT
  end
end
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
#     메뉴화면에서 파티 멤버의 스테이터스스를 표시한 윈도우입니다
#==============================================================================

class Window_RingMenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(204, 64, 232, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # ● 회복
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 80
      y = 80 * i
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 80)
      draw_actor_name(actor, x, y + 24)
    end
  end
  #--------------------------------------------------------------------------
  # ● 커서의 구형 갱신
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
    end
  end
end
#==============================================================================
# #■ Scene_RingMenu
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  Scene_Menu의 클래스입니다。
#==============================================================================

#class Scene_RingMenu
class Scene_Menu
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     menu_index : 커맨드 커서의 초기 위치
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 스프라이트 세트를 작성
    @spriteset = Spriteset_Map.new
    # 커맨드 윈도우를 작성
    px = $game_player.screen_x - 15
    py = $game_player.screen_y - 24
    @command_window = Window_RingMenu.new(px,py)
    @command_window.index = @menu_index
    # 파티 멤버가 0 일 경우
    if $game_party.actors.size == 0
      # 아이템,숙련,장비,스테이터스를 무효화
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    @command_window.z = 100
    # 세이브 금지의 경우
    if $game_system.save_disabled
      # 세이브를 비 활성화 한다
      @command_window.disable_item(4)
    end
    # 스테이터스 윈도우를 작성
    @status_window = Window_RingMenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    @status_window.z = 200
    @status_window.visible = false
    # 트란지션 실행
    Graphics.transition
    # 메인 루프
    loop do
      # 게임 화면을 갱신
      Graphics.update
      # 입력 정보를 갱신
      Input.update
      # 프레임 갱신
      update
      # 화면이 전환되면 루프를 중지
      if $scene != self
        break
      end
    end
    # 트란지션 준비
    Graphics.freeze
    # 스프라이트 세트를 해방
    @spriteset.dispose
    # 윈도우를 해방
    @command_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 윈도우를 갱신
    @command_window.update
    @status_window.update
    # 커맨드 윈도우가 액티브의 경우: update_command 을(를) 부른다
    if @command_window.active
      update_command
      return
    end
    # 스테이터스 윈도우가 액티브의 경우: update_status 을(를) 부른다
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (커맨드 윈도우가 액티브의 경우)
  #--------------------------------------------------------------------------
  def update_command
    # B 버튼이 눌러진 경우
    if Input.trigger?(Input::B)
      # 캔슬 SE 을(를) 연주
      $game_system.se_play($data_system.cancel_se)
      # 맵화면에 교체
      $scene = Scene_Map.new
      return
    end
    # C 버튼이 눌러진 경우
    if Input.trigger?(Input::C)
      # 파티 멤버가 0 으로 ,세이브,게임 종료 이외의 커맨드의 경우
      if $game_party.actors.size == 0 and @command_window.index < 4
        # 부져 SE 을(를) 연주
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 커맨드 윈도우의 커서 위치에서 분기
      case @command_window.index
      when 0  # 아이템
        # 결정  SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 아이템화면으로 교체
        $scene = Scene_Item.new
      when 1  # 상태
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 스테이터스 윈도우를 액티브하게 한다
        @command_window.active = false
        @status_window.active = true
        @status_window.visible = true
        @status_window.index = 0
      when 2  # 장비
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 스테이터스 윈도우를 액티브하게 한다
        @command_window.active = false
        @status_window.active = true
        @status_window.visible = true
        @status_window.index = 0
      when 3  # 스테이터스
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 스테이터스 윈도우를 액티브하게 한다
        @command_window.active = false
        @status_window.active = true
        @status_window.visible = true
        @status_window.index = 0
      when 4  # 세이브
        # 세이브 금지의 경우
        if $game_system.save_disabled
          # 부져 SE 을(를) 연주
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 세이브 화면으로 교체
        $scene = Scene_Save.new
      when 5  # 종료
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 게임 종료 화면으로 교체
        $scene = Scene_End.new
      end
      return
    end
    # 애니메이션 중이라면 커서의 위치를 실행하지 않는다
    return if @command_window.animation?
    # ↑or← 버튼이 눌러진 경우
    if Input.press?(Input::UP) or  Input.press?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
      return
    end
    # ↓or→ 버튼이 눌러진 경우
    if Input.press?(Input::DOWN) or  Input.press?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (스테터스스 윈도우가 액티브의 경우)
  #--------------------------------------------------------------------------
  def update_status
    # B 버튼이 눌러진 경우
    if Input.trigger?(Input::B)
      # 캔슬 SE 을(를) 연주
      $game_system.se_play($data_system.cancel_se)
      # 커맨드 윈도우를 액티브하게 한다
      @command_window.active = true
      @status_window.active = false
      @status_window.visible = false
      @status_window.index = -1
      return
    end
    # C 버튼이 눌러진 경우
    if Input.trigger?(Input::C)
      # 커맨드 윈도우의 커서르 위치에서 분기
      case @command_window.index
      when 1  # ??
        # 이 엑터의 행동 제한이 2 이상의 경우
        if $game_party.actors[@status_window.index].restriction >= 2
          # 부져 SE 을(를) 연주
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 숙련 화면으로 교체
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # 장비
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 장비 화면으로 교체
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # 스테이터스
        # 결정 SE 을(를) 연주
        $game_system.se_play($data_system.decision_se)
        # 스테이터스 화면으로 교체
        $scene = Scene_Status.new(@status_window.index)
      end  
      return
    end
  end
end

 

?

  1. 엔딩 후 타이틀과 BGM 변경

    Date2015.12.21 CategoryRPGMV 플러그인 By러닝은빛 Views2324 Votes0
    Read More
  2. 오렌지 - 타임 시스템 플러그인(Time system). (게임 시간시스템 관련)

    Date2015.11.07 CategoryRPGMV 플러그인 Byplam Views948 Votes1
    Read More
  3. 요청하신 게이지바 스크립트 입니다.

    Date2013.10.04 CategoryRPGXP 스크립트 By소년영남 Views1924 Votes1
    Read More
  4. 윈도우 링 메뉴

    Date2013.10.01 CategoryRPGXP 스크립트 By Views845 Votes0
    Read More
  5. 윈도우 시스템 트레이로 최소화

    Date2016.01.21 CategoryRPGMV 플러그인 By러닝은빛 Views2034 Votes0
    Read More
  6. 유니티)캐릭터 좌우 이동 (C#)

    Date2016.01.05 Category유니티 스크립트 Byzerosium Views986 Votes0
    Read More
  7. 이름조합스크립트

    Date2013.10.27 CategoryRPGXP 스크립트 ByScissor Views2773 Votes0
    Read More
  8. 이벤트 이름 표시하기

    Date2016.04.05 CategoryRPGMV 플러그인 By러닝은빛 Views2101 Votes1
    Read More
  9. 이벤트 자동 추적 플러그인

    Date2016.04.27 CategoryRPGMV 플러그인 By러닝은빛 Views2720 Votes3
    Read More
  10. 이벤트(엑스트라) 좌표 콘트롤 플러그인(Move Route Extras - Version 1.1)

    Date2015.11.07 CategoryRPGMV 플러그인 Byplam Views862 Votes0
    Read More
  11. 이벤트커맨드 스크립트 관련 설명

    Date2009.01.29 CategoryRPGVX 스크립트 ByEvangelista Views2165 Votes3
    Read More
  12. 이벤트커맨드 스크립트 관련 설명

    Date2009.01.29 CategoryRPGVX 스크립트 ByEvangelista Views2659 Votes3
    Read More
  13. 이벤트커맨드 스크립트 사용법 모음

    Date2009.07.21 CategoryRPGVX 스크립트 ByEvangelista Views2534 Votes2
    Read More
  14. 이벤트커맨드 스크립트 사용법 모음

    Date2009.07.21 CategoryRPGVX 스크립트 ByEvangelista Views2649 Votes2
    Read More
  15. 이벤트커맨드 스크립트 조건분기법 모음

    Date2009.11.18 CategoryRPGVX 스크립트 ByEvangelista Views2592 Votes2
    Read More
  16. 이벤트커맨드 스크립트 조건분기법 모음

    Date2009.11.18 CategoryRPGVX 스크립트 ByEvangelista Views2536 Votes2
    Read More
  17. 일시정지 스크립트

    Date2013.09.29 CategoryRPGXP 스크립트 By청담 Views930 Votes0
    Read More
  18. 자동 세이브 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views846 Votes0
    Read More
  19. 자동으로 장애물을 피해가는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views863 Votes0
    Read More
  20. 장비 레벨 제한

    Date2013.10.01 CategoryRPGXP 스크립트 By Views908 Votes1
    Read More
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)