| Ancien membre du staff |
 |
Inscrit le: 03 Nov 2006, 01:00 Messages: 598 Points d'aide: 0/60
Créations :
Voir ses créations
|
- Code: Tout sélectionner
#----------------------------------------------------------------- # ¦ Slipknot's Advance Message System ¦ #----------------------------------------------------------------- # Dernière mise à jour : 02/01/06 #----------------------------------------------------------------- # - Objets, Armes, Armures et sorts par Dubealex # - Name Box par Dubealex # - Taille du texte par Dubealex # - Tye de la police par Dubealex # - Nom de la map par Dubealex # - Window Over Event by Dubealex #----------------------------------------------------------------- # Reporter les bugs aux adresses suivantes : # - dubealex.com/asylum # - rmxp.net/forums # - crankeye.com/forums #-----------------------------------------------------------------
#----------------------------------------------------------------- # This module carries the some message settings #----------------------------------------------------------------- module Message #--------------------------------------------------------------- # ● Style de texte : # 0: normal # 1: ombré # 2: contours #--------------------------------------------------------------- Default_Text = 0 #--------------------------------------------------------------- # ● Fade the name box and picture #--------------------------------------------------------------- Fade = true #--------------------------------------------------------------- # ● Change it to change the folder for the message # pictures #--------------------------------------------------------------- Path = "Graphics/Pictures/" #----------------------------------------------------------------- end #----------------------------------------------------------------- # Add the text displays to the bitmap class #----------------------------------------------------------------- class Bitmap #--------------------------------------------------------------- # ● Draws the text 5 times to get the outline effect #--------------------------------------------------------------- def draw_text_outline x, y, wid, hei, str, ali=0 color = font.color.dup font.color = Color.new 0, 0, 0, color.alpha #changer ces valeurs pour changer la couleur draw_text(x - 1, y, wid, hei, str, ali) draw_text(x-1, y, wid, hei, str, ali) draw_text(x, y - 1, wid, hei, str, ali) draw_text(x, y-1, wid, hei, str, ali) font.color = color draw_text(x, y, wid, hei, str, ali) end #--------------------------------------------------------------- # ● Draws the text 3 times to get the shadow effect #--------------------------------------------------------------- def draw_text_shadow x, y, wid, hei, str, ali=0 color = font.color.dup font.color = Color.new -20, 0, 0, (color.alpha*2/3) #changer ces valeurs pour changer la couleur draw_text(x - 2, y 2, wid, hei, str, ali) font.color = color draw_text(x, y, wid, hei, str, ali) end #----------------------------------------------------------------- end #----------------------------------------------------------------- # The Window Message #----------------------------------------------------------------- class Window_Message < Window_Selectable #--------------------------------------------------------------- # ● Include the modules to use their methods and # constants #--------------------------------------------------------------- include Message, Input, RPG #--------------------------------------------------------------- # ● Create the message window, and define some # variables #--------------------------------------------------------------- def initialize super 65, 299, 510, 175 self.contents = Bitmap.new width-32, height-32 self.z = 9998 @contents_showing = false self.index = -1 self.opacity = @cursor_width = 0 @back = Window_Base.new 65, 299, 510, 175 self.active = self.visible = false end #--------------------------------------------------------------- # ● Change visibility of the contents window and the # back one #--------------------------------------------------------------- def visible=(val) super @back.visible = val end #--------------------------------------------------------------- # ● Dispose all the windows #--------------------------------------------------------------- def dispose terminate_message $game_temp.message_window_showing = false @back.dispose [@input_number_window].each{|i| if exists? i; i.dispose; end} super end #--------------------------------------------------------------- # ● Terminates the message and dispose some objects #--------------------------------------------------------------- def terminate_message self.active = @back.pause = false self.index = -1 contents.clear @contents_showing = false if $game_temp.message_proc != nil $game_temp.message_proc.call end [$game_temp].each {|t| t.message_text = t.message_proc = nil; t.choice_start = 99; t.choice_max = t.choice_cancel_type = 0; t.choice_proc = nil; t.num_input_start = 99; t.num_input_variable_id = t.num_input_digits_max = 0 } [@gold_window, @name_box, @picture].each{|o| o.dispose if exists? o } end #--------------------------------------------------------------- # ● Read all the message text and write it into the # window #--------------------------------------------------------------- def refresh contents.clear # Setting the text options to default [contents.font].each {|w| w.name = "Dumbledor 1","Arial" w.size = 22; w.bold = w.italic = false} case Default_Text when 0 then disp_text when 1 then disp_text false,true when 2 then disp_text true end # Setting some variables to 0 @cursor_width = x = y = 0 x=8 if $game_temp.choice_start == 0 if $game_temp.message_text != nil text = $game_temp.message_text begin last_text = text.clone # Show Variables Value text.gsub!(/\[Vv][([0-9]+)]/) { $game_variables[$1.to_i] } end until text == last_text # Show Hero Name text.gsub!(/\[Nn][([0-9]+)]/) { $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : "" } # Current money display text.gsub!(/\$$/) {"#{$game_party.gold} #{$data_system.words.gold}"} text.gsub!(/\$/) { $game_party.gold.to_s } # Show Hero Class Name text.gsub!(/\[Cc]lass[([0-9]+)]/) { $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].class_name : "" } # Show Current Map Name text.gsub!(/\[Mm]ap/) { $game_map.name } # Set some variables to false name_box = face = picture = over_event = false # Name box if (/\[Nn]a[(.+?)]/.match(text)) != nil name_box, name_text = true, $1 text.sub!(/\[Nn]a[.*?]/){""} end # Picture if (/\[Pp]ic[(.+?)]/.match(text)) != nil picture, pic_name = true, $1 text.sub!(/\[Pp]ic[.*?]/){""} end # Face # - Right if (/\[Ff]ace{(.+?)}/.match(text)) != nil face, face_name = 1, $1 text.sub!(/\[Ff]ace{.*?}/){""} end # - Left if (/\[Ff]ace[(.+?)]/.match(text)) != nil face, face_name = 0, $1 text.sub!(/\[Ff]ace[.*?]/){""} end # Window over event if (/\[Pp][([-1,0-9]+)]/.match(text)) != nil over_event, event = true, $1.to_i text.sub!(/\[Pp][[-1,0-9]+]/){""} end # "" display text.gsub!(/\\/){"\000"} # Text Color text.gsub!(/\[Cc][([0-9]+)]/){"\001[#$1]"} # Show Gold Window text.gsub!(/\[Gg]/){"\002"} # Text size text.gsub!(/\[Tt][Ss][(d+)]/){"\003[#$1]"} # Text font text.gsub!(/\[Ff]ont[(.+?)]/){"\004[#$1]"} # Text different display text.gsub!(/\[Tt]ext[([0-2])]/){"\005[#$1]"} # SlipKnot's Icon text.gsub!(/\[Ii]idiot[(.+?)]/){"\006[#$1]"} # Dubealex's Icon text.gsub!(/\[Ii]i{([IiWwAaSs]?)}[(d+)]/){change_icon($1,$2.to_i)} # Bold font text.gsub!(/\[Bb]/){"\007"} # Italic font text.gsub!(/\[Ii]/){"\010"} # Array with all the lines width stxt = 0, 0, 0, 0 @back.height = 32 icon = "" x = 104 if face == 0 while (c = text.slice!(/./m)) != nil if c == "\000" then c = "\" end if c == "\001" text.sub!(/[([0-9]+)]/, "") color = $1.to_i contents.font.color = text_color(color) if color >= 0 next end if c == "\002" if @gold_window == nil @gold_window = Window_Gold.new @gold_window.x = 560 - @gold_window.width if $game_temp.in_battle then @gold_window.y = 192 else @gold_window.y = self.y >= 128 ? 32 : 384 end @gold_window.opacity = @back.opacity @gold_window.back_opacity = @back.back_opacity end; next end if c == "\003" text.sub!(/[([0-9]+)]/, "") contents.font.size = [[$1.to_i, 6].max, 32].min next end if c == "\004" text.sub!(/[(.+?)]/, "") contents.font.name = $1.to_s next end if c == "\005" text.sub!(/[([0-9]+)]/, "") case $1.to_i when 0 then disp_text when 1 then disp_text false,true when 2 then disp_text true end next end if c == "\006" text.sub!(/[(.+?)]/, "") icon = $1.to_s c = "" end if c == "\007" [contents.font].each {|i| i.bold = !i.bold } next end if c == "\010" [contents.font].each {|i| i.italic = !i.italic } next end if c == "\013" text.sub!(/[(.*?)]/, "") icon = $1.to_s c = "" end if c == " " @cursor_width = [@cursor_width, x].max if y >= $game_temp.choice_start y += 1 x = face == 0 ? 104 : 0 if y >= $game_temp.choice_start x += 8 @cursor_width = [@cursor_width, x].max if face == 0 @cursor_width -= 104 @cursor_x = 112 else @cursor_x = 8 end end next else stxt[y] += contents.text_size(c).width end if icon != "" icon_y = (32-24)/2 contents.blt(4+x, 32*y+4, Cache.icon(icon), Rect.new(0,0,24,24)) stxt[y] += 24 x += 24 icon = "" end if @outline_text and !@shadow_text contents.draw_text_outline 4+x, 32*y, 40, 32, c elsif @shadow_text and !@outline_text contents.draw_text_shadow 4+x, 32*y, 40, 32, c else contents.draw_text 4+x, 32*y, 40, 32, c end x += contents.text_size(c).width end for i in 0..3 do stxt[i] += 104 end if face == 0 @back.height = y*32+32 @back.width = stxt.max+40 end men_pos if $game_temp.choice_max > 0 @item_max = $game_temp.choice_max self.active, self.index = true, 0 end if $game_temp.num_input_variable_id > 0 digits_max = $game_temp.num_input_digits_max number = $game_variables[$game_temp.num_input_variable_id] @input_number_window = Window_InputNumber.new digits_max @back.height += 32 width = [@back.width, @input_number_window.width-16].max @back.width = width [@input_number_window].each {|o| o.number = number o.y = self.y+$game_temp.num_input_start*32 o.x = face != 0 ? self.x+8 : self.x+8+112 } end if face bitmap = Cache.load_bitmap Path, face_name fy = @back.height <= 128 ? 0 : (@back.height-128)/2 fx = face == 0 ? 0 : stxt.max+8 @back.width = stxt.max + 136 if face == 1 contents.blt fx, fy, bitmap, Rect.new(0,0,96,96) @back.height = 128 if @back.height <= 128 men_pos end if over_event and $game_map.events != nil ch = event <= 0 ? $game_player : $game_map.events[event] fx = [[ch.screen_x-@back.width/2, 4].max, 636-@back.width].min fy = [[ch.screen_y-(@back.height+48), 4].max, 476-@back.height].min self.x = @back.x = fx self.y = @back.y = fy end if picture px = self.x+@back.width @picture = Sprite.new @picture.bitmap = Cache.load_bitmap Path, pic_name @picture.x = px-@picture.bitmap.width @picture.y = self.y-@picture.bitmap.height @picture.opacity = 0 if Fade end if name_box @name_box = Name_Box.new self.x, self.y-15, name_text @name_box.opacity = 0 if Fade @name_box.back.opacity = $game_system.message_frame == 0 ? 255 : 0 end end
|
|