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
357 기타 여러스크립트(목적은 포인트) 12 file 인생은 힘들다. 2011.08.26 3087
356 기타 경험치 백분율 계산 2 허걱 2009.06.30 3093
355 기타 Crissaegrim Farm BETA 1.0.0 10 Man... 2008.11.22 3094
354 전투 Animated Battlers VX 3.5 by DerVVulfman 2 Alkaid 2011.11.02 3097
353 장비 KGC 확장 장비 화면 2009/02/15 13 시트르산 2010.09.25 3113
352 전투 Animated Battlers VX 3.4 by DerVVulfman 5 file Alkaid 2010.09.10 3117
351 전투 RPG tankentai에서의 치명적 문제점을 보완한 스크립트 2 file 톰소여동생 2010.11.03 3117
350 커서 애니메이션 12 file RPGbooster 2008.10.11 3127
349 전투 전투후렙업시나오는상세창 11 작은샛별 2010.03.07 3128
348 메뉴 YERD - 시스템 옵션 5 file 훈덕 2009.11.08 3136
347 기타 커스텀 페이지 스크립트 9 file 달표범 2009.09.07 3140
346 스킬 hp소모스킬 31 file DH Games 2010.02.14 3141
345 기타 요리 시스템을 도입하는 스크립트입니다. 9 file 스페나로츠 2011.08.18 3145
344 기타 디스크 체인져 VX!! (업데이트..) 30 file Tofuman 2008.12.02 3168
343 그래픽 KGC_BitmapExtension : 비트맵 클래스 확장 8 file soleone 2010.07.18 3176
342 스킬 발상의전환 : 스킬과 아이템의 공격횟수를 동시에 증가시키기 14 star211 2010.02.16 3179
341 상점 Shopoholic(한글 설명) 11 Man... 2008.10.29 3185
340 상점 상점 할인 스크립트(변수를 이용한 물건 가격 조정) 9 달표범 2009.09.04 3185
339 기타 [자작]게임 실행시 파일 체크 프로그램. 또는 파일 실행기. 16 file NightWind AYARSB 2010.05.20 3193
338 전투 불사신(무적) 스크립트 9 file 미얼 2009.10.29 3198
Board Pagination Prev 1 ... 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 32 Next
/ 32