RPGXP 스크립트
2013.10.01 06:25

윈도우 링 메뉴

조회 수 848 추천 수 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. VXA에서 XBOX360 컨트롤러 사용 여부 체크

    Date2018.07.15 CategoryRPGVX Ace 스크립트 By러닝은빛 Views719 Votes0
    Read More
  2. 데이터 베이스 이스케이프 처리 플러그인

    Date2015.11.01 CategoryRPGMV 플러그인 By백난화백 Views720 Votes0
    Read More
  3. 정지 모션 스크립트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views722 Votes1
    Read More
  4. 맵 이동시 로딩 그림 표시 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views735 Votes0
    Read More
  5. 경험치 표시 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views757 Votes0
    Read More
  6. 스테이터스,보수,골드,플레임 타임 삭제

    Date2015.06.02 CategoryRPGXP 스크립트 Byrpgmakingbot Views760 Votes0
    Read More
  7. FPS 표기 플러그인! (화면에 FPS값을 표기해준다!)

    Date2015.11.07 CategoryRPGMV 플러그인 Bywillmv Views762 Votes0
    Read More
  8. 전메뉴 반투명화

    Date2013.10.01 CategoryRPGXP 스크립트 By Views772 Votes0
    Read More
  9. Mog Hunter 스페셜

    Date2015.03.26 CategoryRPGVX Ace 스크립트 By철창노틸 Views773 Votes1
    Read More
  10. HBGames.ORG::Motion Blur

    Date2013.09.27 CategoryRPGXP 스크립트 By죽은노예 Views777 Votes0
    Read More
  11. 직업명 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views778 Votes0
    Read More
  12. RPGXP ATB전투 시스템 예제(스크립트는 예제 안에 포함)

    Date2015.11.17 CategoryRPGXP 스크립트 ByMagNesium Views792 Votes0
    Read More
  13. game testplay 테스트중 게임속도 상승 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By부초 Views795 Votes0
    Read More
  14. 9마리 이상의 몬스터 설정 | More Enemies

    Date2018.08.31 CategoryRPGMV 플러그인 By러닝은빛 Views805 Votes0
    Read More
  15. 모든 글자에 외곽선을 넣어주는 스크립트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views816 Votes1
    Read More
  16. Iavra Generic Popup (일정시간 팝업을 띄우는 플러그인)

    Date2015.10.30 CategoryRPGMV 플러그인 By파란별빛 Views831 Votes0
    Read More
  17. 메뉴에 얼굴 그래픽 표시

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

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views848 Votes0
    Read More
  19. 윈도우 링 메뉴

    Date2013.10.01 CategoryRPGXP 스크립트 By Views848 Votes0
    Read More
  20. 날씨효과를 전투중에도 사용하는 플러그인입니다.

    Date2015.10.27 CategoryRPGMV 플러그인 Byplam Views853 Votes0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15






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

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