赞 | 0 |
VIP | 451 |
好人卡 | 0 |
积分 | 1 |
经验 | 24407 |
最后登录 | 2023-5-13 |
在线时间 | 1563 小时 |
Lv1.梦旅人 kissye的宠物<
- 梦石
- 0
- 星屑
- 61
- 在线时间
- 1563 小时
- 注册时间
- 2008-8-11
- 帖子
- 6174
|
用的是这个嘛?
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- =begin
- superufo版加强对话框
- 新增功能:
- 1.\h[X]:更改字号为X(X〈32)
- 2.\o[X]:更改透明度为X(模拟悄悄话?)
- 3.\u[XXXXXX]:直接以十六进制指定颜色
- 4.\i[X]:显示X号物品名
- 5.\s[X]:显示X号技能名
- 6.\w[X]:显示X号武器名
- 7.\a[X]:显示X号防具名
- 再加上原有功能
- 8.\c[X]:将颜色调整为X(0〈=X〈=15)
- 9.\n[X]:显示X号同伴名
- 10.\v[X]:显示X号变量
- 11.\g:显示金钱窗口
- 12.\.:停滞1/4秒
- 13.\|:停滞1秒
- 14.\!:等待输入???
- 15.\>:开启瞬间输入
- 16.\<:关闭瞬间输入
- 17.\^:等待输入的无???
- 18.\\:显示“\”这个符号
- 就是全部参数
- =end
- class Window_Message < Window_Selectable
- MAX_LINE = 4
- def initialize
- super(0, 288, 544, 128)
- self.z = 200
- self.active = false
- self.index = -1
- self.openness = 0
- @opening = false
- @closing = false
- @text = nil
- @contents_x = 0
- @contents_y = 0
- @line_count = 0
- @wait_count = 0
- @background = 0
- @position = 2
- @show_fast = false
- @line_show_fast = false
- @pause_skip = false
- create_gold_window
- create_number_input_window
- create_back_sprite
- end
- def dispose
- super
- dispose_gold_window
- dispose_number_input_window
- dispose_back_sprite
- end
- def update
- super
- update_gold_window
- update_number_input_window
- update_back_sprite
- update_show_fast
- unless @opening or @closing
- if @wait_count > 0
- @wait_count -= 1
- elsif self.pause
- input_pause
- elsif self.active
- input_choice
- elsif @number_input_window.visible
- input_number
- elsif @text != nil
- update_message
- elsif continue?
- start_message
- open
- $game_message.visible = true
- else
- close
- $game_message.visible = @closing
- end
- end
- end
- def create_gold_window
- @gold_window = Window_Gold.new(384, 0)
- @gold_window.openness = 0
- end
- def create_number_input_window
- @number_input_window = Window_NumberInput.new
- @number_input_window.visible = false
- end
- def create_back_sprite
- @back_sprite = Sprite.new
- @back_sprite.bitmap = Cache.system("MessageBack")
- @back_sprite.visible = (@background == 1)
- @back_sprite.z = 190
- end
- def dispose_gold_window
- @gold_window.dispose
- end
- def dispose_number_input_window
- @number_input_window.dispose
- end
- def dispose_back_sprite
- @back_sprite.dispose
- end
- def update_gold_window
- @gold_window.update
- end
- def update_number_input_window
- @number_input_window.update
- end
- def update_back_sprite
- @back_sprite.visible = (@background == 1)
- @back_sprite.y = y - 16
- @back_sprite.opacity = openness
- @back_sprite.update
- end
- def update_show_fast
- if self.pause or self.openness < 255
- @show_fast = false
- elsif Input.trigger?(Input::C) and @wait_count < 2
- @show_fast = true
- elsif not Input.press?(Input::C)
- @show_fast = false
- end
- if @show_fast and @wait_count > 0
- @wait_count -= 1
- end
- end
- def continue?
- return true if $game_message.num_input_variable_id > 0
- return false if $game_message.texts.empty?
- if self.openness > 0 and not $game_temp.in_battle
- return false if @background != $game_message.background
- return false if @position != $game_message.position
- end
- return true
- end
- def start_message
- @text = ""
- for i in 0...$game_message.texts.size
- @text += " " if i >= $game_message.choice_start
- @text += $game_message.texts[i].clone + "\x00"
- end
- @item_max = $game_message.choice_max
- convert_special_characters
- reset_window
- new_page
- end
- def new_page
- contents.clear
- if $game_message.face_name.empty?
- @contents_x = 0
- else
- name = $game_message.face_name
- index = $game_message.face_index
- draw_face(name, index, 0, 0)
- @contents_x = 112
- end
- @contents_y = 0
- @line_count = 0
- @show_fast = false
- @line_show_fast = false
- @pause_skip = false
- contents.font.color = text_color(0)
- end
- def new_line
- if $game_message.face_name.empty?
- @contents_x = 0
- else
- @contents_x = 112
- end
- @contents_y += WLH
- @line_count += 1
- @line_show_fast = false
- end
- def convert_special_characters
- @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
- @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
- @text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
- @text.gsub!(/\\I\[([0-9]+)\]/i) { $data_items[$1.to_i].name }
- @text.gsub!(/\\S\[([0-9]+)\]/i) { $data_skills[$1.to_i].name }
- @text.gsub!(/\\W\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name }
- @text.gsub!(/\\A\[([0-9]+)\]/i) { $data_armors[$1.to_i].name }
- @text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
- @text.gsub!(/\\G/) { "\x02" }
- @text.gsub!(/\\\./) { "\x03" }
- @text.gsub!(/\\\|/) { "\x04" }
- @text.gsub!(/\\!/) { "\x05" }
- @text.gsub!(/\\>/) { "\x06" }
- @text.gsub!(/\\</) { "\x07" }
- @text.gsub!(/\\\^/) { "\x08" }
- @text.gsub!(/\\O\[([0-9]+)\]/i) { "\x09[#{$1}]" }
- @text.gsub!(/\\H\[([0-9]+)\]/i) { "\x10[#{$1}]" }
- @text.gsub!(/\\U\[([0-9A-Fa-f]{6})\]/) { "\x11[#{$1}]" }
- @text.gsub!(/\\\\/) { "\\" }
- end
- def reset_window
- @background = $game_message.background
- @position = $game_message.position
- if @background == 0
- self.opacity = 255
- else
- self.opacity = 0
- end
- case @position
- when 0
- self.y = 0
- @gold_window.y = 360
- when 1
- self.y = 144
- @gold_window.y = 0
- when 2
- self.y = 288
- @gold_window.y = 0
- end
- end
- def terminate_message
- self.active = false
- self.pause = false
- self.index = -1
- @gold_window.close
- @number_input_window.active = false
- @number_input_window.visible = false
- $game_message.main_proc.call if $game_message.main_proc != nil
- $game_message.clear
- end
- def update_message
- loop do
- c = @text.slice!(/./m)
- case c
- when nil
- finish_message
- break
- when "\x00"
- new_line
- if @line_count >= MAX_LINE
- unless @text.empty?
- self.pause = true
- break
- end
- end
- when "\x01"
- @text.sub!(/\[([0-9]+)\]/, "")
- contents.font.color = text_color($1.to_i)
- next
- when "\x02"
- @gold_window.refresh
- @gold_window.open
- when "\x03"
- @wait_count = 15
- break
- when "\x04"
- @wait_count = 60
- break
- when "\x05"
- self.pause = true
- break
- when "\x06"
- @line_show_fast = true
- when "\x07"
- @line_show_fast = false
- when "\x08"
- @pause_skip = true
- when "\x09"
- @text.sub!(/\[([0-9]+)\]/, "")
- self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
- next
- when "\x10"
- @text.sub!(/\[([0-9]+)\]/, "")
- self.contents.font.size = [[$1.to_i, 6].max, 32].min
- next
- when "\x11"
- @text.sub!(/\[([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\]/, "")
- self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)
- next
- else
- contents.draw_text(@contents_x, @contents_y, 40, 32, c)
- c_width = contents.text_size(c).width
- @contents_x += c_width
- end
- break unless @show_fast or @line_show_fast
- end
- end
- def finish_message
- if $game_message.choice_max > 0
- start_choice
- elsif $game_message.num_input_variable_id > 0
- start_number_input
- elsif @pause_skip
- terminate_message
- else
- self.pause = true
- end
- @wait_count = 10
- @text = nil
- end
- def start_choice
- self.active = true
- self.index = 0
- end
- def start_number_input
- digits_max = $game_message.num_input_digits_max
- number = $game_variables[$game_message.num_input_variable_id]
- @number_input_window.digits_max = digits_max
- @number_input_window.number = number
- if $game_message.face_name.empty?
- @number_input_window.x = x
- else
- @number_input_window.x = x + 112
- end
- @number_input_window.y = y + @contents_y
- @number_input_window.active = true
- @number_input_window.visible = true
- @number_input_window.update
- end
- def update_cursor
- if @index >= 0
- x = $game_message.face_name.empty? ? 0 : 112
- y = ($game_message.choice_start + @index) * WLH
- self.cursor_rect.set(x, y, contents.width - x, WLH)
- else
- self.cursor_rect.empty
- end
- end
- def input_pause
- if Input.trigger?(Input::B) or Input.trigger?(Input::C)
- self.pause = false
- if @text != nil and not @text.empty?
- new_page if @line_count >= MAX_LINE
- else
- terminate_message
- end
- end
- end
- def input_choice
- if Input.trigger?(Input::B)
- if $game_message.choice_cancel_type > 0
- Sound.play_cancel
- $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
- terminate_message
- end
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- $game_message.choice_proc.call(self.index)
- terminate_message
- end
- end
- def input_number
- if Input.trigger?(Input::C)
- Sound.play_decision
- $game_variables[$game_message.num_input_variable_id] =
- @number_input_window.number
- $game_map.need_refresh = true
- terminate_message
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码
如果是这个应该不会出问题 |
|