#============================================================================== # ** Hangul Message System 1.5.5 (RPG Maker VX Ace) #============================================================================== # Name : Hangul Message System # Author : biud436 # Version : 1.5.5 # Link : http://biud436.blog.me/220251747366 #============================================================================== # ** ¾÷µ¥ÀÌÆ® ·Î±× #============================================================================== # 2017.06.20 : # - ¸»Ç³¼± ¸ðµå¿¡¼­µµ ¾ó±¼ À̹ÌÁö »ç¿ë °¡´É # - ¸ØÃã Ç¥½Ã À̹ÌÁö Ç¥½Ã # - ¸»Ç³¼± À§Ä¡ È­¸é ³»·Î ÀÚµ¿ Á¶Àý # 2016.05.07 - Á¤±ÔÇ¥Çö½Ä ¹× ÅؽºÆ® ¸ÅĪ ÄÚµå ¼öÁ¤, ÀÚµ¿ °³Çà ±â´É Ãß°¡ # 2015.10.12 - À̸§ À©µµ¿ì ÅؽºÆ® Å©±â ¼³Á¤ # 2015.09.06 - È­¸é ¿µ¿ª ³» ¸Þ½ÃÁö Ç¥½Ã ±â´É # 2015.08.22 - ¹ö±× ¼öÁ¤(¸í·É¾î ó¸® ¼ø¼­ º¯°æ) # 2015.08.11 - RGB ¸ðµâ ÄÚµå Á¤¸® # 2015.08.08 - À̸§ À©µµ¿ì ÆøÀ» ÅؽºÆ® ±æÀÌ¿¡ ¸ÂÃã # 2015.08.06 - ¸»Ç³¼± Å©±â °è»ê ¹æ¹ý ¼öÁ¤ (Æø°ú ³ôÀ̸¦ µ¿ÀûÀ¸·Î °è»ê) # 2015.08.02 - À̸§ À©µµ¿ì ÁÂÇ¥ ¹ö±× ¼öÁ¤, ÆäÀ̽ºÄ¨ Ŭ·¡½º Ãß°¡ # 2015.07.29 - ¸»Ç³¼± ±×·¡ÇÈÀÌ ¾øÀ» ¶§ ¸»Ç³¼± ¸ðµå¿¡¼­ À̸§ À©µµ¿ì À§Ä¡ ¼öÁ¤ # 2015.06.19 - ±×¸² »ðÀÔ ±â´É Ãß°¡ # 2015.06.18 - º¯¼ö, ÁÖÀΰø, ÆÄƼ¿ø, °ñµå µî »õ·Î¿î ¸í·É¾î Ãß°¡ # 2015.06.15 - Á¤±ÔÇ¥Çö½ÄÀ» UTF_8(16Áø¼ö)¿¡¼­ Çѱ۷Πº¯°æ, »ó¼ö¸¦ Çؽ÷ΠÁ¤¸® # 2015.06.11 - ÆäÀ̽ºÄ¨ ÁÂÇ¥ ¹× Á¤·Ä ±â´É ¼öÁ¤, ÆäÀ̽ºÄ¨ Åõ¸í ó¸® º¯°æ # 2015.06.10 - »ö»ó ºÒ·¯¿À±â ±â´É Ãß°¡ # 2015.06.08 - ÃÖ´ë ¶óÀÎ ¼ö º¯°æ ±â´É ¾÷µ¥ÀÌÆ® # 2015.06.03 - »ç¿ëÀÚ Á¤ÀÇ ±×·¡ÇÈ, ÃÖ´ë ¶óÀÎ ¼ö º¯°æ ±â´É Ãß°¡ # 2015.06.02 - ¼±ÅÃÁö ZÁÂÇ¥ ¼öÁ¤ # 2015.05.13 - ±â¿ïÀӲà ¹®Á¦ ¼öÁ¤ # 2015.05.11 - ±âº» ÆùÆ® »çÀÌÁ º¯°æÇÒ ¶§ »ý±â´Â ¸»Ç³¼± ÁÂÇ¥ ¿ÀÂ÷ ¼öÁ¤ # 2015.04.15 - ÆäÀ̽ºÄ¨ ¹ÝÀü ±â´É »ç¿ë ¿©ºÎ ½ºÅ©¸³Æ® »ç¿ëÀÚ ¼±Åÿ¡ ¸Ã±è # 2015.03.21 - ÄÚµå Á¤¸® # 2015.03.20 - ¸»Ç³¼± ½ºÇÁ¶óÀÌÆ® Ãß°¡, ¸»Ç³¼±À¸·Î ½ÃÀÛ ½Ã â¿­¸²È¿°ú Á¦°Å, Åõ¸íµµ Á¶Àý # 2015.02.20 - ÀúÀå ¹ö±× ¼öÁ¤ # 2015.02.16 - ¸»Ç³¼± ¸ðµå Ãß°¡, È¿°úÀ½ Àç»ý ±â´É Ãß°¡, À̸§ À©µµ¿ì °Å¸® Á¶Àý ±â´É # 2015.02.14 - ±½°Ô, ±â¿ïÀÓ²Ã, Å׵θ®»ö Ãß°¡, ¹ö±× ÇȽº # 2015.02.13 - ÇÑ±Û ¸í·É¾î Ãß°¡, Å« ÆäÀ̽ºÄ¨ À̸§ ¼öÁ¤, À̸§ À©µµ¿ì Á¤·Ä À§Ä¡ ¼öÁ¤ # 2015.02.12 - À̸§ À©µµ¿ì Á¤·Ä ¿À·ù ¼öÁ¤ # 2015.02.11 - À̸§ À©µµ¿ì ÁÂÇ¥ ¼öÁ¤ # 2015.02.05 - ¸Þ½ÃÁö ½Ã½ºÅÛ + »ö»ó º¯È¯ ½ºÅ©¸³Æ® ÅëÇÕ # 2015.01.26 - ¹ö±× ÇȽº # 2015.01.25 - ½ºÅ©¸³Æ® ÅëÇÕ #============================================================================== # ** »ç¿ë¹ý #============================================================================== # \À̸§<À̺¥Æ®¸í> # \¸»Ç³¼±[À̺¥Æ®ÀÇ ID] # \¸»Ç³¼±[0] # \¸»Ç³¼±[-1] # \º¯¼ö[À妽º] # \°ñµå # \ÁÖÀΰø[À妽º] # \ÆÄƼ¿ø[À妽º] # \»ö[»ö»ó¸í] # \È¿°úÀ½![È¿°úÀ½¸í] # \Å׵θ®»ö![»ö»ó¸í] # \#»ö»óÄÚµå! # \±½°Ô! # \ÀÌÅŸ¯! # \¼Óµµ![ÅؽºÆ®ÀÇ ¼Óµµ] # \±×¸²![±×¸²ÆÄÀϸí] # \ÀÚµ¿°³Çà! #============================================================================== # ** Terms of Use #============================================================================== # Free for commercial and non-commercial use #============================================================================== # ** RS #------------------------------------------------------------------------------ # ±âº» ¼³Á¤°ªÀÔ´Ï´Ù. #============================================================================== module RS LIST = CODE = {} # ±âº» ¼³Á¤ LIST["ÆùÆ®¸í"] = Font.default_name LIST["ÆùƮũ±â"] = Font.default_size LIST["X"] = -186 LIST["Y"] = 0 LIST["³ôÀÌ"] = Graphics.height - LIST["Y"] LIST["¶óÀÎ"] = 4 LIST["È¿°úÀ½"] = "Attack3" LIST["¹ÝÀü"] = true LIST["¹ÙÅÁÈ­¸é"] = nil LIST["¿ÞÂÊ"] = 190 LIST["¿À¸¥ÂÊ"] = 534 LIST["Åõ¸íµµ"] = 250 LIST["À̸§À©µµ¿ìX1"] = 10 LIST["À̸§À©µµ¿ìX2"] = 210 LIST["À̸§À©µµ¿ìY"] = 36 LIST["ÅؽºÆ®½ÃÀÛX"] = LIST["¿ÞÂÊ"] + 12 LIST["ÅؽºÆ®¼Óµµ-ÃÖ¼Ò"] = 0 LIST["ÅؽºÆ®¼Óµµ-ÃÖ´ë"] = 8 LIST["È­¸é¿µ¿ª³»Ç¥½Ã"] = true # Á¤±Ô Ç¥Çö½Ä CODE["16Áø¼ö"] = /#([a-zA-Z^\d]*)/i CODE["»ö»óÃßÃâ"] = /^\p{hangul}+|c_[a-zA-z]+$/ CODE["¸í·É¾î"] = /^[\$\.\|\^!><\{\}\\]|^[A-Z]|^[°¡-ÆR]+[!]*/i CODE["À̸§»ö»óÄÚµå"] = /\[(\p{hangul}+[\d]*|c_[\p{Latin}]+)\]/ CODE["À¥»ö»ó"] = /([\p{Latin}\d]+)!/ CODE["ÃßÃâ"] = /^(\p{hangul}+)/ CODE["Å«ÆäÀ̽ºÄ¨"] = /^Å«\_+/ CODE["È¿°úÀ½"] = /^\[(.+?)\]/i CODE["ó¸®!"] = /^(\p{hangul}+)!/ CODE["À̸§"] = /\eÀ̸§\<(.+?)\>/ CODE["¸»Ç³¼±"] = /\e¸»Ç³¼±\[(\d+|-\d+)\]/i CODE["À̸§ÃßÃâ"] = /\[(.*)\]/ CODE["À̸§»ö»óº¯°æ1"] = /\eC\[(.+)\]/ CODE["À̸§»ö»óº¯°æ2"] = /\e»ö\[(.+)\]/ extend self #-------------------------------------------------------------------------- # »ö»óÀ» ºÒ·¯¿É´Ï´Ù(ÅäÅ« ÃßÃâ) #-------------------------------------------------------------------------- def import_color(string) begin data = INI.read_string("»ö»ó¸ñ·Ï",string,'»ö»óÅ×À̺í.ini') parser = RubyVM::InstructionSequence.compile(data) token = parser.to_a[13][2][0] case token when :duparray then return Color.new(*parser.eval()) else return Color.new(255,255,255,255) end rescue Color.new(255,255,255,255) end end end #============================================================================== # ** RS::BALLOON #------------------------------------------------------------------------------ # ¸»Ç³¼± ´ëȭâÀ» À§ÇÑ »ó¼öµéÀÌ Á¤ÀǵǾîÀÖ½À´Ï´Ù #============================================================================== module RS::BALLOON # ÆùÆ® »çÀÌÁî(ÆùÆ® »çÀÌÁ ¹Ù²Ù´Â »ó¼ö°¡ ¾Æ´Ï¶ó ±âº» Æø°ú ³ôÀÌ¿¡ ¿µÇâÀ» ÁÖ´Â »ó¼öÀÔ´Ï´Ù) FONT_SIZE = 24 # °£°Ý STD_PADDING = 24 # ÃÖ¼Ò Æø WIDTH = (FONT_SIZE * 6) + STD_PADDING # ÃÖ¼Ò ³ôÀÌ HEIGHT = FONT_SIZE + (STD_PADDING / 2) #-------------------------------------------------------------------------- # * ¸»Ç³¼± ½ºÇÁ¶óÀÌÆ®°¡ Àִ°¡? #-------------------------------------------------------------------------- def balloon_sprite? return false end end #============================================================================== # ** RS::BNSprite #------------------------------------------------------------------------------ # ¸»Ç³¼± ½ºÇÁ¶óÀÌÆ® »ý¼ºÀ» À§ÇÑ ¸Þ¼ÒµåµéÀÌ Á¤ÀǵǾîÀÖ½À´Ï´Ù #============================================================================== module RS::BNSprite #-------------------------------------------------------------------------- # * ¸»Ç³¼± ½ºÇÁ¶óÀÌÆ® »ý¼º #-------------------------------------------------------------------------- def create_balloon_sprite @b_cursor = Sprite.new @b_cursor.visible = false @b_cursor.bitmap = Cache.system("Window") @b_cursor.src_rect.set(96, 80, 16, 16) @b_cursor.z = 290 end #-------------------------------------------------------------------------- # * ¸»Ç³¼± ½ºÇÁ¶óÀÌÆ® Çعæ #-------------------------------------------------------------------------- def update_balloon_sprite if @b_cursor and @b_cursor.bitmap dx = 16 * ((Time.now.to_i % 2) + 1) @b_cursor.src_rect.set(96 + dx, 80,16, 16) end end #-------------------------------------------------------------------------- # * ¸»Ç³¼± ½ºÇÁ¶óÀÌÆ® Çعæ #-------------------------------------------------------------------------- def dispose_balloon_sprite if @b_cursor @b_cursor.bitmap.dispose @b_cursor.dispose end end end #============================================================================== # ** RS::LoadFace #------------------------------------------------------------------------------ # Å« ÆäÀ̽ºÄ¨ ¼³Á¤À» À§ÇÑ ¸Þ¼ÒµåµéÀÌ Á¤ÀǵǾîÀÖ½À´Ï´Ù #============================================================================== module RS::LoadFace #-------------------------------------------------------------------------- # * ºñÆ®¸Ê »ý¼º #-------------------------------------------------------------------------- def create_face_bitmap @face_sprite = Sprite.new @face_bitmap = Bitmap.new(544, 416) end #-------------------------------------------------------------------------- # * ½ºÇÁ¶óÀÌÆ® »ý¼º #-------------------------------------------------------------------------- def create_face_sprite(align=false) @face_sprite.visible = true @face_sprite.bitmap = @face_bitmap @face_sprite.opacity = 255 @face_sprite.x = RS::LIST["X"] + RS::LIST[align ? "¿À¸¥ÂÊ" : "¿ÞÂÊ"] @face_sprite.mirror = RS::LIST["¹ÝÀü"] ? align : false @face_sprite.y = RS::LIST["³ôÀÌ"] - @face_bitmap.height end #-------------------------------------------------------------------------- # * ½ºÇÁ¶óÀÌÆ® ¼³Á¤ #-------------------------------------------------------------------------- def set_sprite(align) @face_sprite.visible = true @face_sprite.bitmap = @face_bitmap @face_sprite.x = RS::LIST["X"] + RS::LIST[align ? "¿À¸¥ÂÊ" : "¿ÞÂÊ"] @face_sprite.mirror = RS::LIST["¹ÝÀü"] ? align : false @face_sprite.y = RS::LIST["³ôÀÌ"] - @face_bitmap.height end #-------------------------------------------------------------------------- # * ÆäÀ̽ºÄ¨ À妽º üũ #-------------------------------------------------------------------------- def bigface_right_alignment? $game_message.face_index != 0 end #-------------------------------------------------------------------------- # * Å« ÆäÀ̽ºÄ¨ üũ #-------------------------------------------------------------------------- def bigface_valid? return false if $game_message.face_name == "" return true if $game_message.face_name[RS::CODE["Å«ÆäÀ̽ºÄ¨"]] == "Å«_" return false end #-------------------------------------------------------------------------- # * ÀÏ¹Ý ÆäÀ̽ºÄ¨ üũ #-------------------------------------------------------------------------- def normal_face? return true if bigface_valid? == false && $game_message.face_name.size > 0 return false end #-------------------------------------------------------------------------- # * ºñÆ®¸Ê Á¦°Å #-------------------------------------------------------------------------- def iface_clear @face_bitmap = nil end #-------------------------------------------------------------------------- # * ºñÆ®¸Ê ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def face_update @face_sprite.visible = if $game_message.visible @face_sprite.update; true else; false end end end #============================================================================== # ** RS::Face #------------------------------------------------------------------------------ # Å« ÆäÀ̽ºÄ¨°ú °ü·ÃµÈ Ŭ·¡½ºÀÔ´Ï´Ù. #============================================================================== class RS::Face include RS::LoadFace #-------------------------------------------------------------------------- # * ÃʱâÈ­ #-------------------------------------------------------------------------- def initialize(message_window) create_face_bitmap create_face_sprite init_params @face_sprite.z = message_window.z + 1 end #-------------------------------------------------------------------------- # * ÀνºÅϽº ÃʱâÈ­ #-------------------------------------------------------------------------- def init_params @face_set_x = 0 @face_index = 0 @face_name = "" end #-------------------------------------------------------------------------- # * À̸§ ÃʱâÈ­ #-------------------------------------------------------------------------- def reset_face_name @face_name = "" end #-------------------------------------------------------------------------- # * Åõ¸íµµ ÃʱâÈ­ #-------------------------------------------------------------------------- def reset_opacity @face_sprite.opacity = 0 end #-------------------------------------------------------------------------- # * À妽º°¡ À¯È¿ÇÑ°¡? #-------------------------------------------------------------------------- def face_index_invalid? @face_index != $game_message.face_index end #-------------------------------------------------------------------------- # * À̸§ÀÌ À¯È¿ÇÑ°¡? #-------------------------------------------------------------------------- def face_name_invalid? @face_name != $game_message.face_name end #-------------------------------------------------------------------------- # * ´Ù½Ã ±×·Á¾ß Çϴ°¡? #-------------------------------------------------------------------------- def check_redraw? face_index_invalid? || face_name_invalid? end #-------------------------------------------------------------------------- # * Çعæ #-------------------------------------------------------------------------- def dispose @face_bitmap.dispose @face_sprite.dispose end #-------------------------------------------------------------------------- # * Å« ÆäÀ̽ºÄ¨ ±×¸®±â #-------------------------------------------------------------------------- def draw_bigface(align) set_sprite(align) end #-------------------------------------------------------------------------- # * Åõ¸íµµ Á¶Àý #-------------------------------------------------------------------------- def opacity=(n) @face_sprite.opacity = n end #-------------------------------------------------------------------------- # * Å« ÆäÀ̽ºÄ¨ ´Ù½Ã ±×¸®±â #-------------------------------------------------------------------------- def redraw_bigface @face_bitmap = Cache.face($game_message.face_name) @face_index = $game_message.face_index @face_name = $game_message.face_name draw_bigface(align) end #-------------------------------------------------------------------------- # * Á¤·Ä À§Ä¡ #-------------------------------------------------------------------------- def align bigface_right_alignment? end #-------------------------------------------------------------------------- # * Set Visible #-------------------------------------------------------------------------- def visible=(toggle) @face_sprite.visible = toggle end #-------------------------------------------------------------------------- # * ¿À¸¥ÂÊ Á¤·ÄÀΰ¡? #-------------------------------------------------------------------------- def right_alignment_check? @face_sprite.visible && align == false && $game_message.balloon == -2 end #-------------------------------------------------------------------------- # * Å« ÆäÀ̽ºÄ¨ÀÌ ¼³Á¤µÈ »óÅÂÀΰ¡? #-------------------------------------------------------------------------- def visible? @face_Sprite.visible == true end end #============================================================================== # ** RS::Color #------------------------------------------------------------------------------ # »ö»óÅ×À̺í ÆÄÀÏÀ» ¸¸µì´Ï´Ù #============================================================================== module RS::Color #-------------------------------------------------------------------------- # * »ö»óÀ» ÃʱâÈ­ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def init_color_table # ±âº» »ö»óÀ» Ãß°¡ÇÕ´Ï´Ù color_table = {} color_range = (0..31) color_range.each_with_index do |color,index| color_table["±âº»»ö#{index}"] = text_color(color).to_a end # Ãß°¡·Î Á¤ÀÇµÈ »ö»óÀ» Ãß°¡ÇÕ´Ï´Ù extend_color {|k,v| color_table[k] = v } # INI ÆÄÀÏÀ» »ý¼ºÇÕ´Ï´Ù color_table.to_ini("»ö»óÅ×À̺í.ini","»ö»ó¸ñ·Ï") end #-------------------------------------------------------------------------- # * »ö»óÀ» Ãß°¡ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def extend_color yield "Çϴûö",[153, 217, 234, 255] yield "¿¬º¸¶ó»ö",[200,191,231,255] end end #============================================================================== # ** Unicode #============================================================================== module Unicode MultiByteToWideChar = Win32API.new('Kernel32','MultiByteToWideChar','llpipi','i') WideCharToMultiByte = Win32API.new('Kernel32','WideCharToMultiByte','llpipipp','i') # ÄÚµå ÆäÀÌÁö UTF_8 = 65001 #-------------------------------------------------------------------------- # * MBCS(¸ÖƼ¹ÙÀÌÆ®) -> WBCS(À¯´ÏÄÚµå) #-------------------------------------------------------------------------- def unicode! buf = "\0" * (self.size * 2 + 1) MultiByteToWideChar.call(UTF_8, 0, self, -1, buf, buf.size) buf end #-------------------------------------------------------------------------- # * WBCS(À¯´ÏÄÚµå) -> MBCS(¸ÖƼ¹ÙÀÌÆ®) #-------------------------------------------------------------------------- def unicode_s buf = "\0" * (self.size * 2 + 1) WideCharToMultiByte.call(UTF_8, 0, self, -1, buf, buf.size, nil, nil) buf.delete("\0") end end #============================================================================== # ** String È®Àå #============================================================================== class String include Unicode end #============================================================================== # ** INI #------------------------------------------------------------------------------ # INI ÆÄÀÏÀ» ¸¸µé°Å³ª ÀÐÀ» ¼ö ÀÖ´Â ¸ðµâÀÔ´Ï´Ù #============================================================================== module INI WritePrivateProfileStringW = Win32API.new('Kernel32','WritePrivateProfileStringW','pppp','s') GetPrivateProfileStringW = Win32API.new('Kernel32','GetPrivateProfileStringW','ppppip','s') extend self #-------------------------------------------------------------------------- # * INI ÆÄÀÏÀÇ ³»¿ëÀ» ÀÛ¼ºÇÕ´Ï´Ù #-------------------------------------------------------------------------- def write_string(app,key,str,file_name) path = ".\\" + file_name (param = [app,key.to_s,str.to_s,path]).collect! {|i| i.unicode!} success = WritePrivateProfileStringW.call(*param) end #-------------------------------------------------------------------------- # * INI ÆÄÀÏÀÇ ³»¿ëÀ» Àоî¿É´Ï´Ù #-------------------------------------------------------------------------- def read_string(app_name,key_name,file_name) buf = "\0" * 256 path = ".\\" + file_name (param = [app_name,key_name,path]).collect! {|x| x.unicode!} GetPrivateProfileStringW.call(*param[0..1],0,buf,256,param[2]) buf.unicode_s.unpack('U*').pack('U*') end end #============================================================================== # ** Hash #------------------------------------------------------------------------------ # HashÀÇ ¿ø¼Ò(Key, Value)¸¦ ¹ÙÅÁÀ¸·Î INI ÆÄÀÏÀ» ¸¸µì´Ï´Ù #============================================================================== class Hash def to_ini(file_name="Default.ini",app_name="Default") self.each { |k, v| INI.write_string(app_name,k.to_s.dup,v.to_s.dup,file_name) } end end #============================================================================== # ** RGB #============================================================================== module RGB extend self #-------------------------------------------------------------------------- # * »ö»ó ÄÚµå ó¸®(Á¤¼öÇü) #-------------------------------------------------------------------------- def int_to_rgb(rgb) [rgb, rgb>>8, rgb>>16].map {|i| i & 0xFF } end #-------------------------------------------------------------------------- # * »ö»ó ÄÚµå ó¸®(16Áø¼ö) #-------------------------------------------------------------------------- def hex_to_rgb(hex) return unless hex.is_a?(String) hex = hex.delete('#').to_i(16) return int_to_rgb(hex).reverse end end #============================================================================== # ** Colour #============================================================================== module Colour include RGB # »ö»óÀ» ÃßÃâÇÕ´Ï´Ù GET_COLOR = ->(cint){color = Color.new(*int_to_rgb(cint),get_alpha); color} extend self @@c_alpha = 255 @@c_base = Color.new(255,255,255,255) #-------------------------------------------------------------------------- # * »ö»ó ÄÚµå ó¸® #-------------------------------------------------------------------------- def gm_color(string) case string when "û·Ï",'û·Ï»ö','c_aqua' then GET_COLOR.(16776960) when "°ËÀº»ö","°ËÁ¤",'c_black' then GET_COLOR.(0) when "ÆĶõ»ö","ÆĶû",'c_blue' then GET_COLOR.(16711680) when "£ÀºÈ¸»ö",'c_dkgray' then GET_COLOR.(4210752) when "ÀÚÈ«»ö","ÀÚÈ«",'c_fuchsia' then GET_COLOR.(16711935) when "ȸ»ö",'c_gray' then GET_COLOR.(8421504) when "³ì»ö",'c_green' then GET_COLOR.(32768) when "¹àÀº³ì»ö","¶óÀÓ",'c_lime' then GET_COLOR.(65280) when "¹àÀºÈ¸»ö",'c_ltgray' then GET_COLOR.(12632256) when "¹ã»ö","¸¶·é",'c_maroon' then GET_COLOR.(128) when "°¨Ã»»ö","³×À̺ñ",'c_navy' then GET_COLOR.(8388608) when "Ȳ·Ï»ö","¿Ã¸®ºê",'c_olive' then GET_COLOR.(32896) when "ÁÖȲ»ö","ÁÖȲ","¿À·»Áö",'c_orange' then GET_COLOR.(4235519) when "º¸¶ó»ö","º¸¶ó",'c_purple' then GET_COLOR.(8388736) when "»¡°£»ö","»¡°­",'c_red' then GET_COLOR.(255) when "Àº»ö","Àº",'c_silver' then GET_COLOR.(12632256) when "¹ÎÆ®»ö",'c_teal' then GET_COLOR.(8421376) when "Èò»ö","Èò",'c_white' then GET_COLOR.(16777215) when "³ë¶õ»ö","³ë¶û",'c_yellow' then GET_COLOR.(65535) when "±âº»","±âº»»ö",'c_normal' then get_base_color else RS.import_color(string) end end #-------------------------------------------------------------------------- # * Åõ¸íµµ Á¶Àý #-------------------------------------------------------------------------- def draw_set_alpha(value) @@c_alpha = if value.between?(0,255) value else 255 end end #-------------------------------------------------------------------------- # * ±âº»»ö ȹµæ #-------------------------------------------------------------------------- def get_base_color @@c_base end #-------------------------------------------------------------------------- # * ±âº»»ö ¼³Á¤ #-------------------------------------------------------------------------- def set_base_color=(color) @@c_base = color end #-------------------------------------------------------------------------- # * Åõ¸í»ö ȹµæ #-------------------------------------------------------------------------- def get_alpha @@c_alpha end end #============================================================================== # ** Color #============================================================================== class Color extend Colour #-------------------------------------------------------------------------- # * Á¤¼ö·Î º¯È¯ #-------------------------------------------------------------------------- def to_int(r=red.round,g=green.round,b=blue.round) (r) | (g << 8) | (b << 16) end #-------------------------------------------------------------------------- # * 16Áø¼ö·Î À¥ »ö»ó ÄÚµå·Î º¯È¯ #-------------------------------------------------------------------------- def to_hex(r=red.round,g=green.round,b=blue.round) "#" + ([r,g,b].collect {|i| sprintf("%#02x", i)}.join)[2..-1].upcase end #-------------------------------------------------------------------------- # * ¹è¿­·Î º¯È¯ #-------------------------------------------------------------------------- def to_a [red.round,green.round,blue.round,alpha.round] end end #============================================================================== # ** String #============================================================================== class String #-------------------------------------------------------------------------- # * »ö»ó ÄÚµå ó¸® #-------------------------------------------------------------------------- def c Color.gm_color(self) if (self =~ RS::CODE["»ö»óÃßÃâ"]) end #-------------------------------------------------------------------------- # * À¥ »ö»ó ÄÚµå ó¸® #-------------------------------------------------------------------------- def hex_to_color Color.new *Color.hex_to_rgb(self),255 end end #============================================================================== # ** Window_Base #============================================================================== class Window_Base #-------------------------------------------------------------------------- # * ±âº»»ö ó¸® #-------------------------------------------------------------------------- alias get_base_text_color_initialize initialize def initialize(x, y, width, height) get_base_text_color_initialize(x, y, width, height) Color.set_base_color = text_color(0) end #-------------------------------------------------------------------------- # * ¹®ÀÚ Ã³¸® #-------------------------------------------------------------------------- def obtain_escape_code(text) text.slice!(RS::CODE["¸í·É¾î"]) end #-------------------------------------------------------------------------- # * »ö»ó ÄÚµå ó¸® #-------------------------------------------------------------------------- def obtain_name_color(text) text.slice!(RS::CODE["À̸§»ö»óÄÚµå"])[$1] end #-------------------------------------------------------------------------- # * À¥ »ö»ó ÄÚµå ó¸® #-------------------------------------------------------------------------- def to_hex(text) text.slice!(RS::CODE["À¥»ö»ó"])[$1] rescue "#FFFFFF" end #-------------------------------------------------------------------------- # * ¸í·É ¹®ÀÚ Ã³¸® #-------------------------------------------------------------------------- alias color_process_escape_character process_escape_character def process_escape_character(code, text, pos) case code.upcase when '»ö' color = Color.gm_color(obtain_name_color(text)) change_color(color) when '#' color = "##{to_hex(text)}".hex_to_color change_color(color) else color_process_escape_character(code, text, pos) end end #-------------------------------------------------------------------------- # * ±âº» ÆùÆ® ¼³Á¤ #-------------------------------------------------------------------------- def reset_font_settings change_color(normal_color) contents.font.size = RS::LIST["ÆùƮũ±â"] contents.font.bold = Font.default_bold contents.font.italic = Font.default_italic contents.font.outline = Font.default_outline contents.font.out_color = Font.default_out_color end #-------------------------------------------------------------------------- # * Å׵θ® »ö»ó ó¸® #-------------------------------------------------------------------------- def change_out_color(color, enabled = true) contents.font.out_color.set(color) contents.font.out_color.alpha = translucent_alpha unless enabled end #-------------------------------------------------------------------------- # * ¾ÆÀÌÅÛ À̸§ #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text_ex(x + 24, y, item.name) end end #============================================================================== # ** Window_Message #------------------------------------------------------------------------------ # ¸Þ½ÃÁö ½Ã½ºÅÛÀÌ ±¸ÇöµÇ¾îÀִ Ŭ·¡½ºÀÔ´Ï´Ù #============================================================================== class Window_Message include RS::BNSprite include RS::Color include RS::BALLOON #-------------------------------------------------------------------------- # * ÀçÁ¤ÀÇ #-------------------------------------------------------------------------- alias load_face_initialize initialize alias load_face_update update alias load_face_dispose dispose #-------------------------------------------------------------------------- # * ÃʱâÈ­ #-------------------------------------------------------------------------- def initialize load_face_initialize init_color_table @util = RS::Face.new(self) create_balloon_sprite set_font(RS::LIST["ÆùÆ®¸í"],RS::LIST["ÆùƮũ±â"]) end #-------------------------------------------------------------------------- # * ÆùÆ® ¼³Á¤ #-------------------------------------------------------------------------- def set_font(name, size = Font.default_size ) self.contents.font.name = name self.contents.font.size = size end #-------------------------------------------------------------------------- # * ÀνºÅϽº ÃʱâÈ­ #-------------------------------------------------------------------------- alias load_face_clear_instance_variables clear_instance_variables def clear_instance_variables load_face_clear_instance_variables @util.reset_face_name if @util end #-------------------------------------------------------------------------- # * Çǹö ¸ÞÀÎ #-------------------------------------------------------------------------- def fiber_main $game_message.visible = true update_background update_balloon_position @util.face_update loop do process_all_text if $game_message.has_text? process_input $game_message.clear @name_window.close @gold_window.close Fiber.yield break unless text_continue? end close_and_wait $game_message.visible = false @util.reset_opacity @util.face_update resize_message_system @util.reset_face_name @fiber = nil end #-------------------------------------------------------------------------- # * ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def update load_face_update update_balloon_sprite @util.face_update if @fiber end #-------------------------------------------------------------------------- # * Çعæ #-------------------------------------------------------------------------- def dispose load_face_dispose @util.dispose dispose_balloon_sprite end #-------------------------------------------------------------------------- # * »õ·Î¿î ÆäÀÌÁö #-------------------------------------------------------------------------- def new_page(text, pos) contents.clear @util.bigface_valid? ? draw_bigface_entity(text,pos) : draw_normalface_entity(text,pos) end #-------------------------------------------------------------------------- # * Å« ÆäÀ̽ºÄ¨ ±×¸®±â #-------------------------------------------------------------------------- def draw_bigface_entity(text,pos) @util.create_face_sprite( @util.align ) if @util.check_redraw? @util.redraw_bigface else @util.visible = true end normal_set_page(pos,@util.align ? 0 : RS::LIST["ÅؽºÆ®½ÃÀÛX"],text) end #-------------------------------------------------------------------------- # * ÀÏ¹Ý ÆäÀ̽ºÄ¨ ±×¸®±â #-------------------------------------------------------------------------- def draw_normalface_entity(text,pos) @util.opacity = 0 if @util.check_redraw? draw_face($game_message.face_name,$game_message.face_index, 0, 0) normal_set_page(pos,new_line_x,text) end #-------------------------------------------------------------------------- # * »õ·Î¿î ÆäÀÌÁö #-------------------------------------------------------------------------- def normal_set_page(pos,*args) reset_font_settings pos[:x] = args[0] pos[:y] = 0 pos[:new_x] = args[0] pos[:height] = calc_line_height(args[1]) clear_flags end #-------------------------------------------------------------------------- # * È¿°úÀ½ ÃßÃâ #-------------------------------------------------------------------------- def obtain_escape_sound(text) text.slice!(RS::CODE["È¿°úÀ½"])[$1] rescue RS::LIST["È¿°úÀ½"] end #-------------------------------------------------------------------------- # * Preconvert Control Characters # As a rule, replace only what will be changed into text strings before # starting actual drawing. The character "\" is replaced with the escape # character (\e). #-------------------------------------------------------------------------- def convert_escape_characters(text) result = text.to_s.clone result.gsub!(/\\/) { "\e" } result.gsub!(/\e\e/) { "\\" } result.gsub!(/(?:\eV|\eº¯¼ö)\[(\d+)\]/i) { $game_variables[$1.to_i] } result.gsub!(/(?:\eV|\eº¯¼ö)\[(\d+)\]/i) { $game_variables[$1.to_i] } result.gsub!(/(?:\eN|\eÁÖÀΰø)\[(\d+)\]/i) { actor_name($1.to_i) } result.gsub!(/(?:\eP|\eÆÄƼ¿ø)\[(\d+)\]/i) { party_member_name($1.to_i) } result.gsub!(/(?:\eG|\e°ñµå)/i) { Vocab::currency_unit } result end #-------------------------------------------------------------------------- # * ¸í·É¾î ó¸® (´ëÈ­°¡ ½ÃÀÛµÈ ÈÄ¿¡ 󸮵˴ϴÙ) #-------------------------------------------------------------------------- alias msg_speed_process_escape_character process_escape_character def process_escape_character(code, text, pos) case code when '¼Óµµ!' set_text_speed(obtain_escape_param(text).to_i) when 'Å©±â!' t = obtain_escape_param(text).to_i contents.font.size = t pos[:height] = [t,pos[:height]].max when '±½°Ô!' contents.font.bold = !contents.font.bold when 'ÀÌÅŸ¯!' contents.font.italic = !contents.font.italic when 'Å׵θ®!' contents.font.outline = !contents.font.outline when 'Å׵θ®»ö!' color = Color.gm_color(obtain_name_color(text)) change_out_color(color) when '±×¸²!' process_draw_picture(obtain_escape_sound(text).to_s,pos) when 'È¿°úÀ½!' $game_map.se_play = obtain_escape_sound(text).to_s when 'ÀÚµ¿°³Çà!' $game_message.word_wrap_enabled = true else msg_speed_process_escape_character(code, text, pos) end end #-------------------------------------------------------------------------- # * ±×¸²ÀÇ Ã³¸® #-------------------------------------------------------------------------- def process_draw_picture(picture_name, pos) draw_picture(pos ,picture_name) wait_for_one_character end #-------------------------------------------------------------------------- # * ±×¸² ±×¸®±â #-------------------------------------------------------------------------- def draw_picture(pos, picture_name, enabled = true) bitmap = Cache.picture(picture_name) rect = Rect.new(0, 0, bitmap.width, bitmap.height) pic_opacity = enabled ? 255 : translucent_alpha # ¿øº» º¹Á¦ contents_temp = Bitmap.new(contents_width,contents_height + bitmap.height) temp_rect = Rect.new(0,0,self.width,self.height + bitmap.height) contents_temp.blt(0,0,contents,temp_rect,pic_opacity) # ÄÜÅÙÃ÷ ³ôÀÌ °è»ê if rect.height <= (self.height - STD_PADDING) self.height += rect.height else value = rect.height - (self.height - STD_PADDING) self.height += value + line_height if value > 0 end # »õ·Î¿î ºñÆ®¸Ê self.contents = contents_temp # À§Ä¡ ¾÷µ¥ÀÌÆ® update_placement # ¹¦È­ contents.blt(pos[:x],pos[:y] , bitmap, rect,pic_opacity) pos[:x] += bitmap.width pos[:y] += bitmap.height end #-------------------------------------------------------------------------- # * »õ·Î¿î ÆäÀÌÁö°¡ ÇÊ¿äÇÑ Áö ¿©ºÎ¸¦ °áÁ¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def need_new_page?(text, pos) pos[:y] + pos[:height] > (self.height - STD_PADDING) && !text.empty? end #-------------------------------------------------------------------------- # * ÅؽºÆ® ¼Óµµ Á¶Àý #-------------------------------------------------------------------------- def set_text_speed(text_speed) $game_message.message_speed = case text_speed when (RS::LIST["ÅؽºÆ®¼Óµµ-ÃÖ¼Ò"]..RS::LIST["ÅؽºÆ®¼Óµµ-ÃÖ´ë"]) text_speed else RS::LIST["ÅؽºÆ®¼Óµµ-ÃÖ¼Ò"] end end #-------------------------------------------------------------------------- # * ¸í··¾î ó¸®(´ëÈ­°¡ ½ÃÀ۵DZâ Àü¿¡ 󸮵˴ϴÙ) #-------------------------------------------------------------------------- alias rs_extend_msg_convert_escape_characters convert_escape_characters def convert_escape_characters(text) f = rs_extend_msg_convert_escape_characters(text) f.gsub!(RS::CODE["À̸§"]) { name_window_open($1.to_s); "" } f.gsub!(RS::CODE["¸»Ç³¼±"]) { $game_message.balloon = $1.to_i; "" } f end #-------------------------------------------------------------------------- # * ¹®ÀÚ Ãâ·Â ¼Óµµ #-------------------------------------------------------------------------- def wait_for_one_character update_show_fast wait($game_message.message_speed) unless @show_fast || @line_show_fast end #-------------------------------------------------------------------------- # * À̸§ »Ì¾Æ³»±â #-------------------------------------------------------------------------- def obtain_name_text(text) text.slice!(RS::CODE["À̸§ÃßÃâ"])[$1] end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ì ¶ç¿ì±â #-------------------------------------------------------------------------- def name_window_open(text) @name_window.draw_name(text) end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ì »ý¼º #-------------------------------------------------------------------------- alias namewindow_create_all_windows create_all_windows def create_all_windows namewindow_create_all_windows @name_window = RS::Window_Name.new @name_window.x = self.x + RS::LIST["À̸§À©µµ¿ìX1"] @name_window.y = self.y - RS::LIST["À̸§À©µµ¿ìY"] @name_window.openness = 0 end #-------------------------------------------------------------------------- # * À©µµ¿ì ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- alias namewindow_update_all_windows update_all_windows def update_all_windows update_name_windows namewindow_update_all_windows end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ìÀÇ XÁÂÇ¥ #-------------------------------------------------------------------------- def namewindow_get_x if @util.normal_face? return self.x + 112 + RS::LIST["À̸§À©µµ¿ìX1"] else if @util.bigface_valid? if @util.bigface_right_alignment? return self.x + RS::LIST["À̸§À©µµ¿ìX1"] else return self.x + RS::LIST["À̸§À©µµ¿ìX2"] end end end return self.x + RS::LIST["À̸§À©µµ¿ìX1"] end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ì ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def update_name_windows @name_window.x = namewindow_get_x @name_window.y = self.y - RS::LIST["À̸§À©µµ¿ìY"] @name_window.update end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ì Á¦°Å #-------------------------------------------------------------------------- alias namewindow_dispose_all_windows dispose_all_windows def dispose_all_windows @name_window.dispose namewindow_dispose_all_windows end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ìÀÇ Y°ª Á¶Àý #-------------------------------------------------------------------------- alias namewindow_update_placement update_placement def update_placement update_name_windows if @name_window.open? @position = $game_message.position case @position when 0 then self.y = 25 else; self.y = @position * (Graphics.height - height) / 2 end @gold_window.y = y > 0 ? 0 : Graphics.height - @gold_window.height else self.ox = $game_message.ox namewindow_update_placement end end end #============================================================================== # ** RS::Window_Name #------------------------------------------------------------------------------ # À̸§ À©µµ¿ì°¡ ±¸ÇöµÇ¾îÀִ Ŭ·¡½ºÀÔ´Ï´Ù #============================================================================== class RS::Window_Name < Window_Base #-------------------------------------------------------------------------- # * ÃʱâÈ­ #-------------------------------------------------------------------------- def initialize @in_pos = 0 @text = "" super(0, 0, window_width, fitting_height(1)) create_back_bitmap create_back_sprite self.z = 206 refresh end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ìÀÇ Å©±â #-------------------------------------------------------------------------- def window_width return 140 end #-------------------------------------------------------------------------- # * ¹è°æ ºñÆ®¸Ê »ý¼º #-------------------------------------------------------------------------- def create_back_bitmap @back_bitmap = Bitmap.new(width, height) back_color2 = Color.new(12, 24, 13, 0) back_color1 = Color.new(0, 13, 24, 160) rect1 = Rect.new(standard_padding, 0, width, 12) rect2 = Rect.new(standard_padding, 12, width, height - 24) rect3 = Rect.new(standard_padding, height - 12, width, 12) @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true) @back_bitmap.fill_rect(rect2, back_color1) @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true) end #-------------------------------------------------------------------------- # * ¹è°æ ½ºÇÁ¶óÀÌÆ® »ý¼º #-------------------------------------------------------------------------- def create_back_sprite @back_sprite = Sprite.new @back_sprite.bitmap = @back_bitmap @back_sprite.visible = false @back_sprite.z = z + 2 end #-------------------------------------------------------------------------- # * ¹è°æ ½ºÇÁ¶óÀÌÆ®ÀÇ ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def update_back_sprite @back_sprite.visible = (@background == 1) @back_sprite.x = x @back_sprite.y = y @back_sprite.opacity = openness @back_sprite.wave_amp = 3 @back_sprite.update end #-------------------------------------------------------------------------- # * ¹è°æ ½ºÇÁ¶óÀÌÆ®ÀÇ Çعæ #-------------------------------------------------------------------------- def dispose super @back_bitmap.dispose @back_sprite.dispose end #-------------------------------------------------------------------------- # * ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def update super update_back_sprite end #-------------------------------------------------------------------------- # * ¸»Ç³¼± ¿µ¿ª °è»ê #-------------------------------------------------------------------------- def get_balloon_text_rect(text) begin tmp_text = text_processing(text) tmp_text = tmp_text.split("\n") tmp_text.sort! {|a,b| b.size - a.size } _rect = contents.text_size(tmp_text[0]) @_width = (_rect.width) + RS::BALLOON::STD_PADDING rescue @_width = window_width end end #-------------------------------------------------------------------------- # * ÅؽºÆ® ¸ÅĪ (¸ðµç ¸í·É¾î Á¦°Å) #-------------------------------------------------------------------------- def text_processing(text) f = text.dup f.gsub!("\\") { "\e" } f.gsub!("\e\e") { "\\" } f.gsub!(/\e[\$\.\|\!\>\<\^]/) { "" } f.gsub!(/(?:\eV|\eº¯¼ö)\[(\d+)\]/i) { $game_variables[$1.to_i] } f.gsub!(/(?:\eV|\eº¯¼ö)\[(\d+)\]/i) { $game_variables[$1.to_i] } f.gsub!(/(?:\eN|\eÁÖÀΰø)\[(\d+)\]/i) { actor_name($1.to_i) } f.gsub!(/(?:\eP|\eÆÄƼ¿ø)\[(\d+)\]/i) { party_member_name($1.to_i) } f.gsub!(/(?:\eG|\e°ñµå)/i) { Vocab::currency_unit } f.gsub!(/(?:\eC)\[(\d+)\]/i) { "" } f.gsub!(/\e»ö\[(.+?)\]/) { "" } f.gsub!(/\eÅ׵θ®»ö!\[(.+)\]/) { "" } f.gsub!(/\e#([\p{Latin}\d]+)!/) { "" } f.gsub!(RS::CODE["À̸§"]) { "" } f.gsub!(RS::CODE["¸»Ç³¼±"]) { "" } f.gsub!(/\eÈ¿°úÀ½!\[(.+?)\]/i) { "" } f.gsub!(/\e¼Óµµ!\[\d+\]/) { "" } f.gsub!(/\eÅ©±â!\[\d+\]/) { "" } f.gsub!(/\e±½°Ô!/) { "" } f.gsub!(/\eÀÌÅŸ¯!/) { "" } f.gsub!(/\eÅ׵θ®!/) { "" } f.gsub!(/\e±×¸²!\[(.+?)\]/) { "" } f end #-------------------------------------------------------------------------- # * ¸í·É¾î ó¸® (´ëÈ­°¡ ½ÃÀ۵DZâ Àü¿¡ 󸮵˴ϴÙ) #-------------------------------------------------------------------------- alias rs_extend_name_convert_escape_characters convert_escape_characters def convert_escape_characters(text) f = rs_extend_name_convert_escape_characters(text) f.gsub!(RS::CODE["À̸§»ö»óº¯°æ1"]) { change_color(text_color($1.to_i)) } f.gsub!(RS::CODE["À̸§»ö»óº¯°æ2"]) do color = Color.gm_color($1) change_color(color) end f end #-------------------------------------------------------------------------- # * ¸®ÇÁ·¹½¬ #-------------------------------------------------------------------------- def refresh contents.clear @background = $game_message.background self.opacity = @background == 0 ? RS::LIST["Åõ¸íµµ"] : 0 update_back_sprite rect = text_size(@text) self.arrows_visible = false self.width = @_width || window_width text = convert_escape_characters(@text) self.contents.font.size = RS::LIST["ÆùƮũ±â"] draw_text(0,0,contents_width,calc_line_height(text),text.to_s,1) end #-------------------------------------------------------------------------- # * À̸§ Ãâ·Â #-------------------------------------------------------------------------- def draw_name(text) @text = text @_width = window_width get_balloon_text_rect(text.dup) if $game_message.background != 1 open end #-------------------------------------------------------------------------- # * ±âº»»ö ó¸® #-------------------------------------------------------------------------- def set_base_color change_color("±âº»»ö".c) end #-------------------------------------------------------------------------- # * âÀ» ´Ý°í ºñÈ°¼ºÈ­ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def close set_base_color super end #-------------------------------------------------------------------------- # * À̸§ À©µµ¿ì¸¦ È°¼ºÈ­ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def open @back_sprite.ox = 0 refresh super end end #============================================================================== # ** Game_Message #------------------------------------------------------------------------------ # ¸Þ½ÃÁö ½Ã½ºÅÛ¿¡ »ç¿ëµÇ´Â ÀνºÅϽº º¯¼öµéÀÌ ¼±¾ðµÇ¾îÀִ Ŭ·¡½ºÀÔ´Ï´Ù #============================================================================== class Game_Message attr_accessor :message_speed attr_accessor :line attr_accessor :balloon attr_accessor :texts attr_accessor :ox attr_accessor :word_wrap_enabled #-------------------------------------------------------------------------- # * ÃʱâÈ­ #-------------------------------------------------------------------------- alias multi_line_initialize initialize def initialize multi_line_initialize @line = RS::LIST["¶óÀÎ"] end #-------------------------------------------------------------------------- # * Ŭ¸®¾î #-------------------------------------------------------------------------- alias msg_speed_clear clear def clear msg_speed_clear @message_speed = 1 @balloon = -2 @ox = 0 @word_wrap_enabled = false end end #============================================================================== # ** Game_Map #============================================================================== class Game_Map attr_accessor :msg_owner attr_accessor :msg_event alias game_map_balloon_initialize initialize #-------------------------------------------------------------------------- # * ¸»Ç³¼± ´ëȭâÀÇ ¼ÒÀ¯ÀÚ¸¦ ¼³Á¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def initialize game_map_balloon_initialize @msg_owner = $game_player @msg_event = 0 end #-------------------------------------------------------------------------- # * È¿°úÀ½À» Àç»ýÇÕ´Ï´Ù #-------------------------------------------------------------------------- def se_play=(name) msg_se = RPG::SE.new msg_se.name = name msg_se.play end end #============================================================================== # ** Window_Message #------------------------------------------------------------------------------ # ¸»Ç³¼± ½Ã½ºÅÛ°ú °ü·ÃµÇ¾îÀÖ½À´Ï´Ù. #============================================================================== class Window_Message < Window_Base include RS::BALLOON #-------------------------------------------------------------------------- # * »õ·Î¿î ÆäÀÌÁö ¼³Á¤ #-------------------------------------------------------------------------- alias balloon_new_page new_page def new_page(text, pos) open_balloon balloon_new_page(text,pos) wait(1) end #-------------------------------------------------------------------------- # * ¸»Ç³¼± ¼³Á¤ #-------------------------------------------------------------------------- def open_balloon(sign=$game_message.balloon) # return nil if $game_message.face_name.size > 0 if sign == -2 resize_message_system return nil end setup_owner(sign.to_i) update_balloon_position $game_message.word_wrap_enabled = false end #-------------------------------------------------------------------------- # * ÅؽºÆ® ó¸® #-------------------------------------------------------------------------- def process_all_text open_and_wait get_balloon_text_rect($game_message.all_text.dup) text = convert_escape_characters($game_message.all_text) pos = {} new_page(text, pos) process_character(text.slice!(0, 1), text, pos) until text.empty? end #-------------------------------------------------------------------------- # * ¸»Ç³¼± ¿µ¿ª °è»ê #-------------------------------------------------------------------------- def get_balloon_text_rect(text) tmp_text = text_processing(text) tmp_text = tmp_text.split("\n") tmp_text.sort! {|a,b| b.size - a.size } _rect = contents.text_size(tmp_text[0]) @_width = (_rect.width) + standard_padding * 2 @_height = tmp_text.size * FONT_SIZE + standard_padding * 2 if $game_message.face_name.size > 0 @_width += new_line_x @_height = [@_height, fitting_height(4)].max end end #-------------------------------------------------------------------------- # * ÅؽºÆ® ¸ÅĪ (¸ðµç ¸í·É¾î Á¦°Å) #-------------------------------------------------------------------------- def text_processing(text) f = text.dup f.gsub!("\\") { "\e" } f.gsub!("\e\e") { "\\" } f.gsub!(/\e[\$\.\|\!\>\<\^]/) { "" } f.gsub!(/(?:\eV|\eº¯¼ö)\[(\d+)\]/i) { $game_variables[$1.to_i] } f.gsub!(/(?:\eV|\eº¯¼ö)\[(\d+)\]/i) { $game_variables[$1.to_i] } f.gsub!(/(?:\eN|\eÁÖÀΰø)\[(\d+)\]/i) { actor_name($1.to_i) } f.gsub!(/(?:\eP|\eÆÄƼ¿ø)\[(\d+)\]/i) { party_member_name($1.to_i) } f.gsub!(/(?:\eG|\e°ñµå)/i) { Vocab::currency_unit } f.gsub!(/(?:\eC)\[(\d+)\]/i) { "" } f.gsub!(/\e»ö\[(.+?)\]/) { "" } f.gsub!(/\eÅ׵θ®»ö!\[(.+)\]/) { "" } f.gsub!(/\e#([\p{Latin}\d]+)!/) { "" } f.gsub!(RS::CODE["À̸§"]) { "" } f.gsub!(RS::CODE["¸»Ç³¼±"]) { "" } f.gsub!(/\eÈ¿°úÀ½!\[(.+?)\]/i) { "" } f.gsub!(/\e¼Óµµ!\[\d+\]/) { "" } f.gsub!(/\eÅ©±â!\[\d+\]/) { "" } f.gsub!(/\e±½°Ô!/) { "" } f.gsub!(/\eÀÌÅŸ¯!/) { "" } f.gsub!(/\eÅ׵θ®!/) { "" } f.gsub!(/\e±×¸²!\[(.+?)\]/) { "" } f end #-------------------------------------------------------------------------- # * ¸Þ½ÃÁö À©µµ¿ìÀÇ XÁÂÇ¥¸¦ ±¸ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def get_x(n) return n unless RS::LIST["È­¸é¿µ¿ª³»Ç¥½Ã"] case when n < 0 then return 0 when n > Graphics.width - @_width Graphics.width - @_width else return n end end #-------------------------------------------------------------------------- # * ¸Þ½ÃÁö À©µµ¿ìÀÇ YÁÂÇ¥¸¦ ±¸ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def get_y(n) return n unless RS::LIST["È­¸é¿µ¿ª³»Ç¥½Ã"] case when n < 0 then return 0 + @name_window.height - @name_window.x when n > Graphics.height - @_height + @_height Graphics.height - @_height else return n end end #-------------------------------------------------------------------------- # * ¸»Ç³¼± À§Ä¡ ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def update_balloon_position return update_placement if $game_message.balloon == -2 # ¸»Ç³¼± ¼ÒÀ¯ÀÚÀÇ È­¸é ÁÂÇ¥ mx = $game_map.msg_owner.screen_x rescue 0 my = $game_map.msg_owner.screen_y rescue 0 tx = @_width / 2 ty = @_height scale_y = 1 tile_height = 32 dx = mx - @_width / 2 dy = my - @_height - tile_height ny = self.y - @name_window.height - RS::LIST["À̸§À©µµ¿ìY"] # È­¸é ÁÂÃø if (mx - @_width / 2) < 0 dx = 0 tx = mx end # È­¸é ¿ìÃø if (mx - @_width / 2) > (Graphics.width - @_width) dx = Graphics.width - @_width tx = mx - dx end # È­¸é »ó´Ü if (my - @_height - tile_height / 2) < 0 dy = my + tile_height / 2 scale_y = -1 ty = (@_height * scale_y) + @_height ny = (self.y + @_height) + RS::LIST["À̸§À©µµ¿ìY"] end # È­¸é ÇÏ´Ü if (my - @_height) > Graphics.height - @_height dy = Graphics.width - @_height ty = dy - @_height end # ¸»Ç³¼± À§Ä¡ ¹× Å©±â ¼³Á¤ self.x = dx self.y = dy self.width = @_width self.height = @_height # pause Ä¿¼­ÀÇ ÁÂÇ¥ @b_cursor.x = dx + tx @b_cursor.y = dy + ty @b_cursor.mirror = (scale_y == -1) ? true : false # À̸§ À©µµ¿ì ÁÂÇ¥ ¼öÁ¤ @name_window.y = ny # Åõ¸íµµ ¼³Á¤ self.opacity = balloon_sprite? ? 0 : RS::LIST["Åõ¸íµµ"] @balloon_pause = false self.arrows_visible = false @b_cursor.visible = true show end #-------------------------------------------------------------------------- # * ¼ÒÀ¯ÀÚ¸¦ ¼³Á¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def setup_owner(sign) $game_map.msg_owner = case sign when -1 $game_player when 0 $game_map.msg_event else $game_map.events[sign] end end #-------------------------------------------------------------------------- # * Å©±â Àç¼³Á¤ #-------------------------------------------------------------------------- def resize_message_system # ´ëȭâÀÇ ¼ÒÀ¯ÀÚ ¼³Á¤ $game_map.msg_owner = $game_player @balloon_pause = true self.arrows_visible = true @b_cursor.visible = false # ´ëȭâÀÇ À§Ä¡ @position = $game_message.position # ´ëȭâÀÇ YÁÂÇ¥ y = @position * (Graphics.height - window_height) / 2 # À§Ä¡ ¹× Å©±â ¼³Á¤ self.move(0, y, window_width, fitting_height($game_message.line || RS::LIST["¶óÀÎ"]) ) end #-------------------------------------------------------------------------- # * Input Pause Processing (¸»Ç³¼± ¸ðµå) #-------------------------------------------------------------------------- def input_pause self.pause = @balloon_pause wait(10) Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) Input.update self.pause = false end #-------------------------------------------------------------------------- # * ¸»Ç³¼± üũ #-------------------------------------------------------------------------- def open_and_wait hide if $game_message.all_text.include?("\\¸»Ç³¼±") open Fiber.yield until open? end #-------------------------------------------------------------------------- # * ¹è°æ ¾÷µ¥ÀÌÆ® #-------------------------------------------------------------------------- def update_background update_balloon_sprite @background = $game_message.background self.opacity = @background == 0 ? RS::LIST["Åõ¸íµµ"] : 0 end end #============================================================================== # ** °ÔÀÓ ÀÎÅÍÇÁ¸®ÅÍ #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # * ¹®ÀåÀÇ Ç¥½Ã(¿À¹ö¶óÀ̵ù) #-------------------------------------------------------------------------- def command_101 wait_for_message $game_map.msg_event = get_character(@event_id > 0? 0 : -1) $game_message.face_name = @params[0] $game_message.face_index = @params[1] $game_message.background = @params[2] $game_message.position = @params[3] # ¶óÀÎ È®Àå ¿©ºÎ üũ multi_line_flag? ? multi_line_add_message : default_add_message case next_event_code when 102 # Show Choices @index += 1 setup_choices(@list[@index].parameters) when 103 # Input Number @index += 1 setup_num_input(@list[@index].parameters) when 104 # Select Item @index += 1 setup_item_choice(@list[@index].parameters) end wait_for_message end #-------------------------------------------------------------------------- # * ±âº»Çü ¸Þ½ÃÁö Ãß°¡ #-------------------------------------------------------------------------- def default_add_message while next_event_code == 401 # Text data @index += 1 $game_message.add(@list[@index].parameters[0]) end end #-------------------------------------------------------------------------- # * È®ÀåÇü ´ëȭâ Ãß°¡ #-------------------------------------------------------------------------- def multi_line_add_message init_line_height # ¶óÀÎ ÃʱâÈ­ until @line_height >= $game_message.line # ¶óÀÎ Àбâ while next_event_code == 401 # ÅؽºÆ® µ¥ÀÌÅÍ @index += 1 $game_message.add(@list[@index].parameters[0]) add_line_height # ¶óÀÎ Ãß°¡ end # ´ÙÀ½ À̺¥Æ®°¡ ´ëȭâÀÌ ¾Æ´Ï¸é ·çÇÁ Å»Ãâ break if next_event_code != 101 end end #-------------------------------------------------------------------------- # * ¶óÀÎ ÃʱâÈ­ #-------------------------------------------------------------------------- def init_line_height @line_height = 0 end #-------------------------------------------------------------------------- # * ¶óÀÎ È®Àå ¼³Á¤ È®ÀÎ #-------------------------------------------------------------------------- def multi_line_flag? $game_message.line > 4 end #-------------------------------------------------------------------------- # * ¶óÀÎ Ãß°¡ #-------------------------------------------------------------------------- def add_line_height @line_height += 1 @index += 1 if next_event_code == 101 end end #============================================================================== # ** Window_ChoiceList (¼±ÅÃÁö ZÁÂÇ¥) #============================================================================== class Window_ChoiceList < Window_Command alias choicelist_initialize initialize #-------------------------------------------------------------------------- # * ¼±ÅÃÁö À©µµ¿ìÀÇ ZÁÂÇ¥¸¦ ¼³Á¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def initialize(message_window) choicelist_initialize(message_window) self.z = @message_window.z + 5 end end #============================================================================== # ** Game_Temp(Call Refer) #============================================================================== class Game_Temp attr_accessor :set_max_line #-------------------------------------------------------------------------- # * ÃÖ´ë ¶óÀÎ ¼ö¸¦ °áÁ¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def max_line=(n) return if @set_max_line.nil? @set_max_line.call(n) end end #============================================================================== # ** Window_Message #============================================================================== class Window_Message alias xxxheight_initialize initialize #-------------------------------------------------------------------------- # * ¶óÀÎ ¼ö¸¦ ¼³Á¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- def initialize xxxheight_initialize $game_temp.set_max_line = method(:set_height) set_height(RS::LIST["¶óÀÎ"]) end #-------------------------------------------------------------------------- # * ¸Þ½ÃÁö À©µµ¿ìÀÇ ³ôÀ̸¦ º¯°æÇÕ´Ï´Ù #-------------------------------------------------------------------------- def set_height(n) contents.clear $game_message.line = n self.height = fitting_height(n) create_contents update_placement end #-------------------------------------------------------------------------- # * À©µµ¿ìÀÇ ¹è°æ È­¸éÀ» »ç¿ëÀÚ Á¤ÀÇ ±×·¡ÇÈÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù #-------------------------------------------------------------------------- if RS::LIST["¹ÙÅÁÈ­¸é"] def create_back_bitmap @back_bitmap = Cache.picture(RS::LIST["¹ÙÅÁÈ­¸é"]) end end #-------------------------------------------------------------------------- # * º¸¿©Áú ¶óÀÎÀÇ °¹¼ö #-------------------------------------------------------------------------- def visible_line_number $game_message.line || RS::LIST["¶óÀÎ"] end #-------------------------------------------------------------------------- # * Character Processing # c : Characters # text : A character string buffer in drawing processing (destructive) # pos : Draw position {:x, :y, :new_x, :height} #-------------------------------------------------------------------------- def process_character(c, text, pos) case c when "\n" # New line process_new_line(text, pos) when "\f" # New page process_new_page(text, pos) when "\e" # Control character process_escape_character(obtain_escape_code(text), text, pos) else # Normal character process_normal_character(c, pos, text) end end #-------------------------------------------------------------------------- # * ÅؽºÆ® ÀÚµ¿ °³Çà #-------------------------------------------------------------------------- alias process_word_wrap_character process_normal_character def process_normal_character(c, pos, text) # ÀÚµ¿ °³Çà ¿©ºÎ ÆÇ´Ü if $game_message.word_wrap_enabled tw = text_size(c).width if pos[:x] + (tw * 2) > contents_width process_new_line(text, pos) end end process_word_wrap_character(c, pos) end end