| 赞 | 40 |
| VIP | |
| 好人卡 | |
| 积分 | 50 |
| 经验 | |
| 最后登录 | 2026-9-17 |
| 在线时间 | 5234 小时 |
八宝粥的基叔
- 梦石
- 0
- 星屑
- 4957
- 在线时间
- 5234 小时
- 注册时间
- 2009-4-29
- 回帖
- 14054

|
发表于 2013-3-1 17:00:13
|
显示全部楼层
本帖最后由 protosssonny 于 2013-9-19 09:20 编辑
二维数组什么的,头好晕。
还好,做了一个早上+一个中午,终于做完成了。
把成果发上来。
使用方法非常详细,看看就会用了,范例也做了。
真累,需要休息一下了。
小瞬.rar
(243.07 KB, 下载次数: 32)
- #==============================================================================
- # ■ P叔专门为小瞬制作的文章显示窗口
- #------------------------------------------------------------------------------
- # ● 初始设定
- # 请在下面输入控制三个窗口的变量,一旦该变量控制一个窗口,这个变量就不再具有
- # 变量的功能,除了调用窗口可以使用它意外,别的地方都不可以使用它。默认的控制
- # 变量为1、2、3号变量。第一个元素写0,不用理会。后面三个元素可以改,比如改成
- # [0,20,30,35]就表示20号变量控制第一个窗口,30号控制第二个,35号控制第三个。
- W_V = [0,1,2,3] # 第一个元素写0,不用理会。后面三个元素可以改。
- #------------------------------------------------------------------------------
- =begin
- ● 事件脚本控制命令
- 1、显示文章的方法,注意,这几行脚本必须写在同一脚本框内。
- 其中窗口号是几就写几,显示就写true,隐藏就写false,text用不理会照写即可
- #----------------------------------------------------
- text =
- "在这里输入文章即可显示
- "
- $scene::new_page(窗口号 ,显示或隐藏 ,text)
- #----------------------------------------------------
-
- 2、窗口刷新的方法。
- 其中窗口号是几就写几,显示就写true,隐藏就写false,X,Y坐标可以不写,不写
- 表示与上次窗口显示位置相同,写了的话会刷新窗口位置
- #----------------------------------------------------
- $scene::am_refresh(窗口号 ,显示或隐藏 ,X坐标 ,Y坐标)
- #----------------------------------------------------
- 3、窗口隐藏的方法。
- 如果窗口不必要刷新,只是纯粹暂时不想显示,可以用以下命令更简便,当然你
- 调用1、2的方法,参数改为false来隐藏也没错。
- #----------------------------------------------------
- $scene::hide_am_window(窗口号)
- #----------------------------------------------------
- 3、窗口显示的方法。
- 如果窗口不必要刷新,只是纯粹暂时需要显示,可以用以下命令更简便,当然你
- 调用1、2的方法,参数改为true来隐藏也没错。
- #----------------------------------------------------
- $scene::show_am_window(窗口号)
- #----------------------------------------------------
- ● 支持的特殊符号转换
- \\V\[x] 显示x号变量
- \\N\[x] 显示x号角色名称
- \\C\[x] 文字变色
- \\S\[x] 文字字号
- \\I\[x] 图标号
- \\\\ 显示符号""
-
- #------------------------------------------------------------------------------
- =end
- #==============================================================================
- #==============================================================================
- # ■ Window_Gold
- #------------------------------------------------------------------------------
- # 显示金钱的窗口。
- #==============================================================================
- class Window_Another_Message < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 544, WLH * 8 + 32)
- @contents_x = 0 # 描绘下一字的 X 座标
- @contents_y = 24 # 描绘下一字的 Y 座标
- @line_count = 0 # 以描绘行数
- end
- #--------------------------------------------------------------------------
- # ● 新页处理(th——窗口号,text——文字)
- #--------------------------------------------------------------------------
- def new_page(text)
- @save_text = text.dup
- contents.clear
- @contents_x = 0
- @contents_y = 0
- @line_count = 0
- contents.font.color = text_color(0)
- update_message(convert_special_characters(text))
- end
-
- #--------------------------------------------------------------------------
- # ● 新行处理
- #--------------------------------------------------------------------------
- def new_line
- @contents_x = 0
- @contents_y += WLH
- @line_count += 1
- end
- #--------------------------------------------------------------------------
- # ● 转换特殊符号
- #--------------------------------------------------------------------------
- def convert_special_characters(text)
- @text = text
- @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!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
- @text.gsub!(/\\S\[([0-9]+)\]/i) { "\x02[#{$1}]" }
- @text.gsub!(/\\I\[([0-9]+)\]/i) { "\x03[#{$1}]" }
- @text.gsub!(/\\\\/) { "\" }
- return @text
- end
- #--------------------------------------------------------------------------
- # ● 更新文章显示
- #--------------------------------------------------------------------------
- def update_message(text)
- loop do
- c = text.slice!(/./m) # 获取一个文字
- case c
- when nil # 无法获取文字时
- break
- when "\n" # 新行
- new_line
- when "\x01" # \C[n](文字变色)
- @text.sub!(/\[([0-9]+)\]/, "")
- contents.font.color = text_color($1.to_i)
- next
- when "\x02" # \S[n](文字字号)
- @text.sub!(/\[([0-9]+)\]/, "")
- contents.font.size = $1.to_i
- next
- when "\x03" # \I[n](图标)
- @text.sub!(/\[([0-9]+)\]/, "")
- draw_icon($1.to_i, @contents_x, @contents_y, true)
- c_width = contents.text_size(c).width
- @contents_x += 24
- else
- contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
- c_width = contents.text_size(c).width
- @contents_x += c_width
- end
- end
- end
-
- def marshal_dump
- [x, y, @save_text]
- end
- def marshal_load(data)
- @x, @y, @save_text = data
- end
- def get_saved_data
- return @x, @y, @save_text
- end
- attr_reader :save_text
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_map.refresh
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- for th in W_V
- $game_variables[th] = [nil, 0, 0, "", ""] unless $game_variables[th].is_a?(Array)
- if $game_variables[th][0].nil?
- $game_variables[th][0] = Window_Another_Message.new($game_variables[th][1],$game_variables[th][2])
- $game_variables[th][0].opacity = 0
- elsif $game_variables[th][0].disposed?
- x, y, text = $game_variables[th][0].get_saved_data
- $game_variables[th][0] = Window_Another_Message.new(x, y)
- $game_variables[th][0].opacity = 0
- $game_variables[th][0].new_page(text) if text
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 窗口刷新(th——窗口号,b——显示/隐藏,x——X坐标,y——Y坐标)
- #--------------------------------------------------------------------------
- def am_refresh(th, b, x = nil, y = nil)
- $game_variables[W_V[th]][0].new_page($game_variables[W_V[th]][0].save_text)
- $game_variables[W_V[th]][0].x = x if x
- $game_variables[W_V[th]][0].y = y if y
- end
- #--------------------------------------------------------------------------
- # ● 显示新文字(th——窗口号,b——显示/隐藏,text——文字)
- #--------------------------------------------------------------------------
- def new_page(th ,b , text)
- $game_variables[W_V[th]][0].new_page(text)
- b == true ? show_am_window(th) : hide_am_window(th)
- end
- #--------------------------------------------------------------------------
- # ● 显示窗口(th——窗口号)
- #--------------------------------------------------------------------------
- def show_am_window(th)
- $game_variables[W_V[th]][0].visible = true
- return self
- end
- #--------------------------------------------------------------------------
- # ● 隐藏窗口(th——窗口号)
- #--------------------------------------------------------------------------
- def hide_am_window(th)
- $game_variables[W_V[th]][0].visible = false
- return self
- end
- end
复制代码 |
评分
-
查看全部评分
|