VX 스크립트

#==============================================================================
# ** Dialog system
#------------------------------------------------------------------------------
# Zeriab
# Version 1.0
# 2007-11-07 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Description :
#
#   A small framework like script for dialogs
#------------------------------------------------------------------------------
# * License :
#
#   Copyright (C) 2007  Zeriab
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Lesser Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Lesser Public License for more details.
#
#   For the full license see <http://www.gnu.org/licenses/>
#   The GNU General Public License: http://www.gnu.org/licenses/gpl.txt
#   The GNU Lesser General Public License: http://www.gnu.org/licenses/lgpl.txt
#------------------------------------------------------------------------------
# * Instructions :
#
#   You can place this script pretty much anyway you like.
#   Place it above any other Dialogs you might be using.
#   Increase the STARTING_Z_VALUE if you have trouble with the dialog not
#   on top.
#==============================================================================
class Dialog
  STARTING_Z_VALUE = 1500 # Default value is 1500
  attr_accessor :value
  attr_writer :marked_to_close
  #--------------------------------------------------------------------------
  # * Getter with 'false' as default value
  #--------------------------------------------------------------------------
  def marked_to_close
    @marked_to_close = false  if @marked_to_close.nil?
    return @marked_to_close
  end
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def mark_to_close
    self.marked_to_close = true
  end
  #--------------------------------------------------------------------------
  # * Show the dialog
  #   Returns the value from the dialog
  #--------------------------------------------------------------------------
  def self.show(*args, &block)
    dialog = self.new(*args, &block)
    dialog.marked_to_close = false
    return dialog.main
  end
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def initialize(*args, &block)
    # For subclasses to overwrite
  end
  #--------------------------------------------------------------------------
  # * Main processing
  #--------------------------------------------------------------------------
  def main
    # Create the dimmed background
    create_background
    # Create Windows
    main_window
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if the dialog should close
      if marked_to_close
        break
      end
    end
    # Dispose of windows
    main_dispose
    # Dispose of background
    dispose_background
    # Update input information
    Input.update
    # Returns the acquired value
    return self.value
  end
  #--------------------------------------------------------------------------
  # * Create the dimmed background
  #--------------------------------------------------------------------------
  def create_background
    bitmap = Bitmap.new(640,480)
    bitmap.fill_rect(0,0,640,480,Color.new(0,0,0,128))
    @background_sprite = Sprite.new
    @background_sprite.z = STARTING_Z_VALUE
    @background_sprite.bitmap = bitmap
  end
  #--------------------------------------------------------------------------
  # * Create the windows
  #--------------------------------------------------------------------------
  def main_window
    # For the subclasses to override
    # Remember to set their z.value to at least STARTING_Z_VALUE + 1
  end
  #--------------------------------------------------------------------------
  # * Dispose the background
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Dispose the windows
  #--------------------------------------------------------------------------
  def main_dispose
    # For the subclasses to override
    # Dispose your windows here
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # For the subclasses to override
    if Input.trigger?(Input::B)
      mark_to_close
    end
  end
end

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
197 키입력 답을 입력하는 텍스트박스 스크립트!! 21 file 좀비사냥꾼 2009.03.29 4206
196 기타 개인판타지메뉴+업그래이드 배틀 23 file 콩밥 2010.08.02 4211
195 액터 스탯 시스탬 29 츠키아 2008.08.08 4214
194 기타 아이콘 캐릭터 17 file 허걱 2010.02.28 4225
193 전투 XAS Hero Edition VX 15 Alkaid 2011.12.28 4227
192 메시지 네오 메시지 시스템 최신 17 file RPGbooster 2008.10.08 4251
191 기타 (이거 정말 좋군요) 말이나 용을 탈수있게 하는 스크립트. 31 file 아방스가 짱 2010.02.28 4261
190 기타 [자작] 횡스크롤 점프스크립트 18 file 좀비사냥꾼 2009.04.03 4276
189 상태/속성 상태 메뉴 변경 스크립트 45 죄송해욧! 2008.03.01 4284
188 메시지 MultiMessage 멀티 메시지 스크립트 9 file 허걱 2010.02.23 4297
187 이동 및 탈것 자동 이동 시스템 20 file 허걱 2010.04.21 4303
186 기타 집안의 가구를 내마음대로 데코레이션하기 15 file EuclidE 2010.09.18 4303
185 맵/타일 VX Mode 7 스크립트!!!! 42 file Tofuman 2009.01.07 4306
184 그래픽 밤낮 변환 VX용 26 독도2005 2008.03.23 4314
183 기타 심플 마우스 시스템 1.5 애드온 11 file RMdude 2009.02.11 4325
182 메뉴 [자작]명성치 사용 시스템(메뉴 출력) 16 Rainsy 2009.03.22 4360
181 메뉴 CogWheelBars 시스템. 13 file 할렘 2009.02.20 4362
180 메시지 직접 생각해서 만든 "문장 속 특정 단어 색 바꾸기" 10 file X.66 2010.04.28 4363
179 HUD 맵 이름 스크립트 21 file 개임맨 2010.10.03 4365
178 맵/타일 타일셋 변경 10 file 만들어보자꾸나 2008.06.08 4370
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32