RPGXP 스크립트

현재 시간 확인

by posted Oct 01, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

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

#============================================================================== 

# ■ Window_NowTime

#------------------------------------------------------------------------------ 

#  현재시간을 표시하는 윈도우입니다. 

#============================================================================== 


class Window_NowTime < Window_Base 

#-------------------------------------------------------------------------- 

# ● 오브젝트 초기화 

#-------------------------------------------------------------------------- 

def initialize 

super(0, 0, 200, 50)

self.contents = Bitmap.new(width - 32, height - 32) 

self.contents.font = Font.new("나눔고딕", 18) # <- font, size 

self.opacity = 180

self.back_opacity = 180

refresh 

end 

#-------------------------------------------------------------------------- 

# ● 리프레쉬 

#-------------------------------------------------------------------------- 

def refresh 

self.contents.clear 

time = Time.now 

text = time.strftime("현재시간 - %X") 

self.contents.draw_text(0, -7, 120, 32, text, 2) 

end 


#-------------------------------------------------------------------------- 

# ● 프레임 갱신 

#-------------------------------------------------------------------------- 

def update 

super 

if Graphics.frame_count / Graphics.frame_rate != @total_sec 

refresh 

end 

end 

end 


class Scene_Map 

  alias update_before_map update 

  def update 

    update_before_map 

    @window_nowtime = Window_NowTime.new unless @window_nowtime

    @window_nowtime.update 

    unless $scene.is_a?(Scene_Map) 

      @window_nowtime.dispose 

      @window_nowtime = nil       

    end 

  end 

end