HUD

맵이름표시

by 캉쿤 posted Sep 14, 2011
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

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

뭔 이상한 말이 잔뜩 써있네;;

 

 

 

 

 

 

 

 

 

# 寃덇쾫寃?XRXS20. ?湲욊링堉??묎툊洹산튆湲ㅺ툊 ver.1.5 寃덇쾫寃?
# by 沅멸톭, ?롫맧 ?る콠

#==============================================================================
# 嫄?湲뉕툣??洹쎄툤?洹쎄튆湲?
#==============================================================================
module XRXS20
  # 湲귢렌源쏄륵湲귥겇洹??묎땅洹?
  WINDOW_FRAME = true
  #
  # 湲꿸툍源쏄르
  #
  FONT_NAME  = "굴림"
  FONT_COLOR = Color.new(255, 255, 0, 255)
  FONT_SIZE  = 18
  #
  # [??묐쟾??
  #
  TIME_FADEIN  =  8 # 湲꿸툋?湲ㅺ렘源?
  TIME_STOP    = 64 # ??묐캙?
  TIME_FADEOUT = 24 # 湲꿸툋?湲ㅺ렉湲귢르
end
  #--------------------------------------------------------------------------
  # 湲↔툕湲싰르由?
  #--------------------------------------------------------------------------
class Window_Map_Name < Window_Base
  def text_model(text)
    return "" + text + "  "
  end
end
#
#[??]
# ?湲욊링堉밴떻癒⑸쾯沅멸릭源뤾툎湲ㅺ콓.嫄먭텞沅뉕래沅?湲욊링堉밴랭??묎땁洹뤾때洹り컘
#
#==============================================================================
# 嫄?Window_Map_Name_Space
#==============================================================================
class Window_Map_Name_Space < Window_Base
  #--------------------------------------------------------------------------
  # 嫄?湲녾립湲숆툋湲뤾르猷딅뵔??
  #--------------------------------------------------------------------------
  def initialize(x, y, w, h)
    super(x-16, y-16, w+32, h+32)
    self.contents = Bitmap.new(w, h)
    self.opacity = 0
    @align = 2
  end
  #--------------------------------------------------------------------------
  # 嫄?湲꿸툍源쏄르
  #--------------------------------------------------------------------------
  def font
    return self.contents.font
  end
  #--------------------------------------------------------------------------
  # 嫄?鍮믩읅洹⑸짆沅?
  #--------------------------------------------------------------------------
  def draw_text(text)
    self.contents.clear
    return if text.nil?
    #r = self.contents.rect
    #self.contents.draw_text(r, text, 1)
    x = 4
    y = 0
    width = self.contents.width
    text_color = self.contents.font.color.dup
    self.contents.font.color = Color.new(  0,  0,  0, 192)
    self.contents.draw_text(x+2, y+2, width, 32, text, @align)
    self.contents.font.color = Color.new( 64, 64, 64, 192)
    self.contents.draw_text(x-1, y-1, width, 32, text, @align)
    self.contents.draw_text(x+1, y-1, width, 32, text, @align)
    self.contents.draw_text(x-1, y+1, width, 32, text, @align)
    self.contents.draw_text(x+1, y+1, width, 32, text, @align)
    self.contents.font.color = text_color
    self.contents.draw_text(x,   y,   width, 32, text, @align)
    self.visible = true
  end
end
#==============================================================================
# 嫄?Window_Map_Name
#------------------------------------------------------------------------------
# ??湲욊링堉밴랭??묎땅洹↔툊洹산튆湲ㅺ툊沅녠땅媛?
#==============================================================================
class Window_Map_Name < Window_Base
  #--------------------------------------------------------------------------
  # 嫄??븍몠洹쎄튆湲?源쏄툣鍮얜╋
  #--------------------------------------------------------------------------
  attr_accessor :text
  #--------------------------------------------------------------------------
  # 嫄?湲녾립湲숆툋湲뤾르猷딅뵔
  #--------------------------------------------------------------------------
  def initialize
    super(152, 8, 480, 40)
    self.opacity = 0
    self.visible = false
    @space = Window_Map_Name_Space.new(self.x, self.y+4, self.width, self.height-8)
    @space.font.name  = XRXS20::FONT_NAME
    @space.font.color = XRXS20::FONT_COLOR
    @space.font.size  = XRXS20::FONT_SIZE
    @space.font.bold  = true
    # 猷딅뵔??
    @fadein_time    = 0
    @showing_time   = 0
    @fadeouut_time  = 0
  end
  #--------------------------------------------------------------------------
  # 嫄?湲↔툕湲싰르癒좊?
  #     text  : 湲귢렌源쏄륵湲귢떳??묎땅洹〓퉺?살€?
  #--------------------------------------------------------------------------
  def set_text(text)
    if text.nil? or text.empty? or text =~ /^./
      @showing_time = -1
      @text = ""
      self.contents_opacity = 0
      self.visible = false
      @space.visible = false
    else
      # 癒좊?
      @text = text_model(text)
      # ?濡?
      @fadein_time    = XRXS20::TIME_FADEIN
      @fadein_amount  = (255.0 / XRXS20::TIME_FADEIN).ceil
      self.width = @space.contents.text_size(@text).width + 24
      @x_indent = 632 - self.width
      self.x = @x_indent - @fadein_time
      @space.draw_text(@text)
      self.visible = XRXS20::WINDOW_FRAME
    end
  end
  #--------------------------------------------------------------------------
  # 嫄??띕볐
  #--------------------------------------------------------------------------
  def dispose
    @space.dispose
    super
  end
  #--------------------------------------------------------------------------
  # 嫄?湲꿸퉺???쏅Ⅷ
  #--------------------------------------------------------------------------
  def update
    #return if @showing_time < 0
    #
    # 湲꿸툋?湲ㅺ렘源?
    #
    if @fadein_time > 0
      @fadein_time -= 1
      @space.contents_opacity += @fadein_amount
      self.opacity = [self.opacity + @fadein_amount*5/8, 160].min
      self.x = @x_indent - @fadein_time
      @space.x = self.x - (512-self.width)
      if @fadein_time == 0
        @showing_time = XRXS20::TIME_STOP
      end
    #
    # 誘낅쪈???
    #
    elsif @showing_time > 0
      @showing_time -= 1
      if @showing_time == 0
        @fadeouut_time  = XRXS20::TIME_FADEOUT
        @fadeout_amount = (255.0 / XRXS20::TIME_FADEOUT).ceil
      end
    #
    # 湲꿸툋?湲ㅺ렉湲귢르
    #
    elsif @fadeouut_time > 0
      @fadeouut_time -= 1
      self.opacity -= @fadeout_amount * 5/8
      @space.contents_opacity -= @fadeout_amount
      self.x = (@x_indent + XRXS20::TIME_FADEOUT) - @fadeouut_time
      @space.x = self.x - (512-self.width)
      if @fadeouut_time == 0
        self.visible = false
        @space.visible = false
      end
    end
  end
end
#==============================================================================
# 嫄?Scene_Map
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # 嫄??湲욊링堉밸즸?뽯뤈
  #--------------------------------------------------------------------------
  def initialize_map_name_window(text = nil)
    if @map_name_window.nil?
      @map_name_window = Window_Map_Name.new
      @map_name_window.text = text if not text.nil?
    end
  end
  #--------------------------------------------------------------------------
  # 嫄?湲쎄렘源쏅즷肉?
  #--------------------------------------------------------------------------
  alias xrxs20_main main
  def main
    # 萸ㅻ섰湲귢렌源쏄륵湲귢랭?용쭫
    initialize_map_name_window
    # 戮j땅
    xrxs20_main
    # 萸ㅻ섰湲귢렌源쏄륵湲귢랭?띕볐
    @map_name_window.dispose
  end
  #--------------------------------------------------------------------------
  # 嫄?湲꿸퉺???쏅Ⅷ
  #--------------------------------------------------------------------------
  alias xrxs20_update update
  def update
    # 萸ㅻ섰湲귢렌源쏄륵湲귢떻?쏅Ⅷ
    @map_name_window.update
    # ?곴톪戮j땅
    xrxs20_update
  end
  #--------------------------------------------------------------------------
  # 嫄?湲듦퉺洹쎄퉪?沅삳ㅎ猷뗫뙴踰?
  #--------------------------------------------------------------------------
  alias xrxs20_transfer_player transfer_player
  def transfer_player
    # ?곴톪戮j땅
    xrxs20_transfer_player
    # 萸ㅻ섰湲귢렌源쏄륵湲귢떻?쏅Ⅷ
    @map_name_window.set_text($game_map.name)
  end
end
#==============================================================================
# 嫄?Game_Map
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # 嫄??湲욊링堉밴랭濡?꺅
  #--------------------------------------------------------------------------
  def name
    $map_infos = load_data("Data/MapInfos.rxdata") if $map_infos.nil?
    $map_infos[@map_id].name
  end
end


 

Who's 캉쿤

?

배고파요ㅠㅜ

전 댓글을 먹고 살아요ㅠㅜ

댓글 하나만요ㅠㅜ