| 赞 | 32 |
| VIP | |
| 好人卡 | |
| 积分 | 49 |
| 经验 | |
| 最后登录 | 2025-3-1 |
| 在线时间 | 918 小时 |
- 梦石
- 0
- 星屑
- 4935
- 在线时间
- 918 小时
- 注册时间
- 2015-7-1
- 回帖
- 309
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 L7-wind 于 2018-12-9 20:43 编辑
这些脚本有些没有写出处,或者只是写来自p1,导致我不清楚作者,又或者写了作者但我不知道作者的联系方式,因为想用于商业游戏,所以在这里问一下大家
Fuki对话框优化版 v6
- #==============================================================================
- # Fuki对话框优化版 v6
- # 原版作者:by パラ犬(日)
- # 汉化修正:by 66RPG.com
- #------------------------------------------------------------------------------
- # 2006年01月 汉化修改 by bbschat
- # 2007年02月 脚本更新 by KKME
- # 2007年07月 脚本更新 by 绫晓露雪萌
- # 2010年05月 脚本优化 by Linki Shy
- # 2011年10月 阴影修正 by 各种压力的猫君
- # 2011年11月 脚本增强 by 各种压力的猫君
- #==============================================================================
- #
- # 【脚本功能】
- #
- # 1. 此脚本主要是解决了在1.03版XP上的方块问题,以及增加了一些功能
- #
- # 2. 人名美化使用方法与以前一样
- #
- # 3. 默认人物头像在左边显示
- # 如果需要右边显示,在输入的名称之后加"@r"即可
- # 例: "阿尔西斯@r:"(注意必须小写)
- #
- # 4. 在对话中更改字体的方法:
- # \f[X]:更改字号为X
- #
- # 5. 在对话中显示(技能 物品 武器 防具 人物)图标和名称的方法:
- # \s[X]: 显示第X号技能图标和名称
- # \i[X]: 显示第X号物品图标和名称
- # \w[X]: 显示第X号武器图标和名称
- # \a[X]: 显示第X号防具图标和名称
- # \r[X]: 显示第X号人物图标和名称
- #
- # 6. 在对话中更改文字不透明度的方法:
- # \o[X]: 把文字不透明度更改为X (取值范围为0~255)
- #
- # 7. 在对话中关闭或开启拟声音效的方法:
- # \q:默认开启时,执行一次关闭,再执行一次则开启
- #
- # 8. 如果需要自定义字体颜色,
- # 可以打开"Graphics/Windowskins"目录下的"Window.png"文件查看
- # 使用方法与VX类似
- #
- # 9. 追加了不为瞬间显示时确定键快速显示的功能
- #
- # 10. $mes_id = 0 代表本事件
- # $mes_id = -1 代表主角
- # $mes_id = 其他数值 代表事件编号
- # $mes_id = nil 代表不使用fuki形式
- #
- #
- # 【素材要求】
- #
- # 1. 要求所有半身像朝向一致(默认是正面偏右)
- #
- #==============================================================================
- #==============================================================================
- # ■ Fuki_v6_Setup
- #------------------------------------------------------------------------------
- # Fuki对话框优化版 v6 参数设置
- #==============================================================================
- module Fuki_v6_Setup
-
- #--------------------------------------------------------------------------
- # ● 外观
- #--------------------------------------------------------------------------
-
- # 窗口透明度
- FUKI_OPACITY = 255 # 呼出对话框
- MES_OPACITY = 160 # 默认信息窗口
-
- # 角色高度尺寸
- CHARACTOR_HEIGHT = 50
-
- # 呼出对话框的相对位置(纵坐标)
- POP_SHIFT_TOP = 0 # 表示位置为上的时候
- POP_SHIFT_UNDER = -4 # 表示位置为下的时候
-
- # 信息的表示速度(数字越小速度越快,0为瞬间表示)
- # 游戏中可以随时用数字代入 $MES_SPEED 来改变消息表示速度。
- MES_SPEED = 1
-
- # 名称修饰符(一对)(此处参考 沉影不器 的VX版对话框加强)
- NAME_SYMBOL = "【】"
-
- # 名称颜色
- NAME_COLOR = 7
-
- #--------------------------------------------------------------------------
- # ● 功能( true / false )
- #--------------------------------------------------------------------------
-
- # 是否显示尾巴
- TAIL_SHOW = true
-
- # 是否播放打字音效
- $play_voice = false
-
- # $MES_SPEED不为0时,是否可以用确定键快速显示对话
- ENABLE_SKIP = true
- # 窗口表示时是否根据画面大小自动改变窗口出现的位置
- POS_FIX = true
-
- #--------------------------------------------------------------------------
- # ● 字体
- #--------------------------------------------------------------------------
-
- # 预设字体组
- FONT_ARRAY = ["幼圆", "黑体", "宋体"]
-
- # 默认字号【已知BUG,当默认字号不为20时会导致各种奇怪问题……暂未修正】
- MES_FONT_SIZE = 20
-
- # 默认字体颜色
- FUKI_COLOR = Color.new(0, 0, 0, 255)
-
- #--------------------------------------------------------------------------
- # ● 目录
- #--------------------------------------------------------------------------
-
- # 呼出对话框用Skin名称(自动在 Graphics\Windowskins 内搜索)
- FUKI_SKIN_NAME = "Window"
-
- # 设定头像图片保存目录
- FACE_PIC_DIR = "Graphics/Faces/"
- #--------------------------------------------------------------------------
- # ● 头像对应表
- #--------------------------------------------------------------------------
- # 如果不想使用角色名字直接作为头像文件名
- # 可在这里重新设定角色名字与文件名的对应关系
- #
- # (这功能怎么用我自己也没搞明白……大家无视吧 by 各种压力的猫君)
- #--------------------------------------------------------------------------
-
- NAME_TABLE = {"玩家"=>"维斯特"}
-
- end
- #==============================================================================
-
- "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
- "┃ 自定义内容到此结束,以下内容切勿随意修改 ┃"
- "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
- #==============================================================================
- # ● 初始化全局变量并定义chat方法
- #==============================================================================
- $mes_id = nil
- $mes_name = ""
- def chat(id = nil,name = "")
- $mes_id = id
- $mes_name = name
- end
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor:namebmp # 记录角色名字和头像文件名对应关系
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias initialize_fuki initialize
- def initialize
- initialize_fuki
- @namebmp = Fuki_v6_Setup::NAME_TABLE
- end
- end
- #==============================================================================
- # ■ Window_InputNumber
- #==============================================================================
- class Window_InputNumber < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # digits_max : 位数
- #--------------------------------------------------------------------------
- def initialize(digits_max)
- @digits_max = digits_max
- @number = 0
- # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
- dummy_bitmap = Bitmap.new(Fuki_v6_Setup::MES_FONT_SIZE, Fuki_v6_Setup::MES_FONT_SIZE)
- @cursor_width = dummy_bitmap.text_size("0").width + 8
- dummy_bitmap.dispose
- super(0, 0, @cursor_width * @digits_max + 32, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.size = Fuki_v6_Setup::MES_FONT_SIZE
- self.contents.font.color = Fuki_v6_Setup::FUKI_COLOR
- self.z += 9999
- self.opacity = 0
- @index = 0
- refresh
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # ● 更新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- self.cursor_rect.set(@index * @cursor_width-4, 0, @cursor_width, Fuki_v6_Setup::MES_FONT_SIZE + 4)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- s = sprintf("%0*d", @digits_max, @number)
- for i in 0...@digits_max
- self.contents.draw_text(i * @cursor_width, 0, 24, Fuki_v6_Setup::MES_FONT_SIZE + 4, s[i,1])
- end
- end
- end
- #==============================================================================
- # ■ Window_Message
- #==============================================================================
- class Window_Message < Window_Selectable
-
- #--------------------------------------------------------------------------
- # ● 初始化状态
- #--------------------------------------------------------------------------
- def initialize
- super(80, 304, 480, 160)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.color = text_color(0)
- self.visible = false
- self.z = 9998
- @fade_in = false
- @fade_out = false
- @contents_showing = false
- @cursor_width = 0
- self.active = false
- self.index = -1
- @w = 0
- @h = 0
- @wait = 0
- @dx = 0
- @dy = 0
- $MES_SPEED = Fuki_v6_Setup::MES_SPEED
- #------------------------
- # ★ 特殊时期中断标志
- #------------------------
- @no_term_stop = false
- @save_x = 0
- @save_y = 0
- @old_text_info = []
- @show_right = false
- @show_name = false
- @face_width = 0
- end
- #--------------------------------------------------------------------------
- # ○ 决定窗口尺寸并生成窗口
- #--------------------------------------------------------------------------
- def refresh_create
- unless @no_term_stop
- @pic_skin.dispose if @pic_skin != nil
- if $game_temp.message_text.include?(":")
- if $game_temp.message_text.include?("@r")
- @show_right = true
- $game_temp.message_text.sub!(/\@r/, "")
- end
- @show_name = true
- # 添加名称修饰符
- unless Fuki_v6_Setup::NAME_SYMBOL.empty?
- $game_temp.message_text = '\c[' + Fuki_v6_Setup::NAME_COLOR.to_s + ']' + Fuki_v6_Setup::NAME_SYMBOL[0,Fuki_v6_Setup::NAME_SYMBOL.size/2] + $game_temp.message_text
- $game_temp.message_text.sub!(/\:/, Fuki_v6_Setup::NAME_SYMBOL[Fuki_v6_Setup::NAME_SYMBOL.size/2,Fuki_v6_Setup::NAME_SYMBOL.size/2] + '\c[0]')
- end
- end
- self.contents.clear
- self.contents.font.color = normal_color
- # 取得窗口尺寸
- get_windowsize
- w = @w + 40
- h = @h * (self.contents.font.size + 4) + 30
- h = 64 if h < 64
- # 生成呼出窗口
- set_fukidasi(self.x, self.y, w, h)
- draw_msg_face
- create_backbmp
- end
- # 初始化信息表示使用的变量
- @dx = @save_x
- @dx += @face_width unless @show_right
- @dy = @save_y
- @cursor_width = 0
- @contents_drawing = true
- # 瞬间表示的情况下
- if $MES_SPEED == 0
- # 循环信息描绘处理
- while $game_temp.message_text != ""
- draw_massage
- end
- draw_opt_text
- @contents_showing_end = true
- @contents_drawing = false
- else
- # 一个一个描绘文字
- refresh_drawtext
- end
- end
- #--------------------------------------------------------------------------
- # ○ 一个一个描绘文字
- #--------------------------------------------------------------------------
- def refresh_drawtext
- # 当按下确定键的时候直接显示剩余的全部文字
- if Input.trigger?(Input::C) and Fuki_v6_Setup::ENABLE_SKIP
- # 循环信息描绘处理
- while $game_temp.message_text != ""
- draw_massage
- end
- draw_opt_text
- @contents_showing_end = true
- @contents_drawing = false
- elsif $game_temp.message_text != ""
- if @wait > 0
- @wait -= 1
- elsif @wait == 0
- # 描绘处理
- draw_massage
- @wait = $MES_SPEED
- end
- else
- draw_opt_text
- @contents_showing_end = true
- @contents_drawing = false
- end
- end
- #--------------------------------------------------------------------------
- # ○ 取得窗口尺寸
- #--------------------------------------------------------------------------
- def get_windowsize
- get_face_width($mes_name)
- x = y = 0
- @h = @w = 0
- @cursor_width = 0
- # 有选择项的话,处理字的缩进
- if $game_temp.choice_start == 0
- x = 16
- end
- # 有等待显示的文字的情况下
- if $game_temp.message_text != nil
- text = $game_temp.message_text.clone
- # 限制文字处理
- begin
- last_text = text.clone
- text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
- end until text == last_text
- text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
- $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- end
- text.gsub!(/\\\\/) { "\x00" }
- text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\x01" }
- text.gsub!(/\\[Gg]/) { "\x02" }
- text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\x03" + $data_skills[$1.to_i].name }
- text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\x04" + $data_items[$1.to_i].name }
- text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\x05" + $data_weapons[$1.to_i].name }
- text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\x06" + $data_armors[$1.to_i].name }
- text.gsub!(/\\[Rr]\[([0-9]+)\]/) { "\x10" + $game_actors[$1.to_i].name }
- # c 获取 1 个字 (如果不能取得文字就循环)
- while ((c = text.slice!(/./m)) != nil)
- if c == "\x00"
- c = "\"
- end
- if c == "\x01" or c == "\x02"
- next
- end
- if c == "\x03" or c == "\x04" or c == "\x05" or c == "\x06" or c == "\x010"
- c = " "
- end
- if c == "\n"
- # y 累加 1
- y += 1
- # 取得纵横尺寸
- @h = y
- @w = x > @w ? x : @w
- if y >= $game_temp.choice_start
- @w = x + Fuki_v6_Setup::MES_FONT_SIZE > @w ? x + Fuki_v6_Setup::MES_FONT_SIZE : @w
- end
- x = 0
- x = Fuki_v6_Setup::MES_FONT_SIZE if y >= $game_temp.choice_start
- # 下面的文字
- next
- end
- # x 为要描绘文字的宽度加法运算
- x += self.contents.text_size(c).width
- end
- 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]
- @h += 1
- x = digits_max * self.contents.font.size + 16
- @w = x > @w ? x : @w
- end
- @w += @face_width
- @w = 128 if @w < 128
- end
- #--------------------------------------------------------------------------
- # ○ 描绘信息处理
- #--------------------------------------------------------------------------
- def draw_massage
- # 有等待显示的文字的情况下
- if $game_temp.message_text != nil or @old_text_info != nil
- text = $game_temp.message_text
- # 限制文字处理
- begin
- last_text = text.clone
- text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
- end until text == last_text
- text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
- $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- end
- text.gsub!(/\\\\/) { "\x00" }
- text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\x01[#{$1}]" }
- text.gsub!(/\\[Gg]/) { "\x02" }
- text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\x03[#{$1}]" }
- text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\x04[#{$1}]" }
- text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\x05[#{$1}]" }
- text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\x06[#{$1}]" }
- text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\x07[#{$1}]" }
- text.gsub!(/\\[Qq]/) { "\x08" }
- text.gsub!(/\\[Ff]\[([0-9]+)\]/) { "\x09[#{$1}]" }
- text.gsub!(/\\[Rr]\[([0-9]+)\]/) { "\x10[#{$1}]" }
- # c 获取 1 个字
- c = text.slice!(/./m)
- # 默认对话框采用默认颜色
- self.contents.font.color = normal_color if $mes_id == nil
- # 选择项的情况
- if @dy >= $game_temp.choice_start
- # 处理字的缩进
- @dx = Fuki_v6_Setup::MES_FONT_SIZE
- @dx += @face_width unless @show_right
- @dx += Fuki_v6_Setup::MES_FONT_SIZE if @show_name
- # 描绘文字
- self.contents.draw_text(@dx, 24 * @dy, 24, 24, c)
- # x 为要描绘文字宽度的加法运算
- @dx += self.contents.text_size(c).width
- # 循环
- while ((c = text.slice!(/./m)) != "\n")
- # 描绘文字
- self.contents.draw_text(@dx, 24 * @dy, 24, 24, c)
- # x 为要描绘文字宽度的加法运算
- @dx += self.contents.text_size(c).width
- end
- if c == "\n"
- # 更新光标宽度
- @cursor_width = [@cursor_width, @dx - @face_width].max
- # dy 累加 1
- @dy += 1
- end
- return
- end
- case c
- when "\x00"
- c = "\"
- when "\x01"
- text.sub!(/\[([0-9]+)\]/, "")
- color = $1.to_i
- self.contents.font.color = text_color(color)
- when "\x02"
- @contents_showing_end = true
- @contents_drawing = false
- terminate_messageX
- @save_x = @dx
- @save_y = @dy
- when "\x03"
- text.sub!(/\[([0-9]+)\]/, "")
- last_character
- draw_icon($data_skills[$1.to_i], 4 + @dx, 24 * @dy)
- @dx += self.contents.text_size(" ").width
- when "\x04"
- text.sub!(/\[([0-9]+)\]/, "")
- last_character
- draw_icon($data_items[$1.to_i], 4 + @dx, 24 * @dy)
- @dx += self.contents.text_size(" ").width
- when "\x05"
- text.sub!(/\[([0-9]+)\]/, "")
- last_character
- draw_icon($data_weapons[$1.to_i], 4 + @dx, 24 * @dy)
- @dx += self.contents.text_size(" ").width
- when "\x06"
- text.sub!(/\[([0-9]+)\]/, "")
- last_character
- draw_icon($data_armors[$1.to_i], 4 + @dx, 24 * @dy)
- @dx += self.contents.text_size(" ").width
- when "\x07"
- text.sub!(/\[([0-9]+)\]/, "")
- self.contents.font.color.alpha = $1.to_i
- when "\x08"
- text.sub!(/\[([0-9]+)\]/, "")
- $play_voice = !$play_voice
- when "\x09"
- text.sub!(/\[([0-9]+)\]/, "")
- self.contents.font.name = Fuki_v6_Setup::FONT_ARRAY[$1.to_i]
- when "\x10"
- text.sub!(/\[([0-9]+)\]/, "")
- last_character
- draw_actor_graphic($game_actors[$1.to_i], 4 + @dx, 24 * @dy)
- @dx += self.contents.text_size(" ").width
- when "\n"
- @dy += 1
- @dx = 0
- @dx += @face_width unless @show_right
- @dx += Fuki_v6_Setup::MES_FONT_SIZE if @show_name
- last_character
- else
- last_character
- size_zy = 6 # 设定文字动态增大幅度
- if c != nil
- self.contents.font.size = Fuki_v6_Setup::MES_FONT_SIZE
- font_size = self.contents.font.size += size_zy
- @old_text_info.push(@dx , @dy , font_size, self.contents.font.color.clone, c)
- self.contents.draw_text(4 + @dx, (font_size + 4 - size_zy) * @dy - size_zy / 2, font_size, font_size, c)
- self.contents.font.size -= size_zy
- Audio.se_play("Audio/SE/Voice", 90, 100) if $play_voice and c != " "
- @dx += self.contents.text_size(c).width
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ 完成上一个字符的描绘
- #--------------------------------------------------------------------------
- def last_character
- size_zy = 6 # 设定文字动态增大幅度
- unless @old_text_info == []
- self.contents.fill_rect (4 + @old_text_info[0], (@old_text_info[2]+ 4 - size_zy) * @old_text_info[1] - size_zy / 2, @old_text_info[2], @old_text_info[2], Color.new(0,0,0,0))
- color = self.contents.font.color.clone
- self.contents.font.color = @old_text_info[3].clone
- self.contents.font.size = @old_text_info[2] -= size_zy
- self.contents.draw_text(4 + @old_text_info[0], (@old_text_info[2] + 4) * @old_text_info[1], @old_text_info[2], @old_text_info[2], @old_text_info[4])
- self.contents.font.color = color
- @old_text_info = []
- end
- end
- #--------------------------------------------------------------------------
- # ○ 选择项和输入数值的情况下
- #--------------------------------------------------------------------------
- def draw_opt_text
- # 选择项的情况下
- if $game_temp.choice_max > 0
- @item_max = $game_temp.choice_max
- self.active = true
- self.index = 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)
- @input_number_window.number = number
- @input_number_window.x = self.x + @face_width + Fuki_v6_Setup::MES_FONT_SIZE + 8
- @input_number_window.y = self.y + $game_temp.num_input_start * (Fuki_v6_Setup::MES_FONT_SIZE + 2)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 生成背景图片
- #--------------------------------------------------------------------------
- def create_backbmp
- @pic_skin.dispose if @pic_skin != nil
- @pic_skin = Sprite.new
- @pic_skin.opacity = 0 unless @no_term_stop
- @pic_skin.bitmap = Bitmap.new(self.width + 32, self.height + 32)
- @pic_skin.x = self.x + 2
- @pic_skin.y = self.y + 2
- @pic_skin.z = self.z
- bitmap = RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME)
- rect = Rect.new(0, 0, 32, 32)
- @pic_skin.bitmap.blt(0, 0, bitmap, rect)
- rect = Rect.new(96, 0, 32, 32)
- @pic_skin.bitmap.blt(self.width-32, 0, bitmap, rect)
- rect = Rect.new(0, 96, 32, 32)
- @pic_skin.bitmap.blt(0, self.height-32, bitmap, rect)
- rect = Rect.new(96, 96, 32, 32)
- @pic_skin.bitmap.blt(self.width-32, self.height-32, bitmap, rect)
- rect = Rect.new(0, 32, 32, 32)
- @pic_skin.bitmap.stretch_blt(Rect.new(0, 32, 32, self.height - 64), bitmap, rect)
- rect = Rect.new(96, 32, 32, 32)
- @pic_skin.bitmap.stretch_blt(Rect.new(self.width-32,32,32,self.height-64), bitmap, rect)
- rect = Rect.new(32, 0, 32, 32)
- @pic_skin.bitmap.stretch_blt(Rect.new(32,0,self.width-64,self.height-32), bitmap, rect)
- # 如果尾巴在底端的话,更改底边描绘方式以修正阴影
- if @message_position == 0 and @tale != nil
- # 乱七八糟的三个计算变量
- above_tale_x = @tale.x - self.x + 14
- above_tale_width1 = @tale.x - self.x - 16 - 2
- above_tale_width2 = self.width - above_tale_width1 - 32 - 64
- # 中部(尾巴上方)
- rect = Rect.new(32, 96, 32, 16)
- @pic_skin.bitmap.stretch_blt(Rect.new(above_tale_x , self.height-32, 32, 24), bitmap, rect)
- # 左半部
- rect = Rect.new(32, 96, 32, 32)
- @pic_skin.bitmap.stretch_blt(Rect.new(32, self.height-32, above_tale_width1, 32), bitmap, rect)
- # 右半部
- @pic_skin.bitmap.stretch_blt(Rect.new(32+above_tale_x, self.height-32, above_tale_width2, 32), bitmap, rect)
- bitmap.dispose
- else # 除此之外的情况保留原来的底边描绘方式
- rect = Rect.new(32, 96, 32, 32)
- @pic_skin.bitmap.stretch_blt(Rect.new(32,self.height-32,self.width-64,32), bitmap, rect)
- bitmap.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ○ 设置呼出对话框
- #--------------------------------------------------------------------------
- def set_fukidasi(x, y, width, height)
- begin
- self.pause = false # 不显示暂停标志
- pos = get_fuki_pos(width, height) # 取得对话框位置
- x = pos[0]
- y = pos[1]
- self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
- self.x = x
- self.y = y
- self.height = height
- self.width = width
- unless @no_term_stop
- self.contents.dispose
- self.contents = Bitmap.new(width - 32, height - 32)
- self.back_opacity = Fuki_v6_Setup::FUKI_OPACITY
- self.contents.clear
- self.contents.font.color = Color.new(0, 0, 0, 255)
- self.contents.font.size = Fuki_v6_Setup::MES_FONT_SIZE
- end
- if $game_system.message_frame == 0
- tale_pos = get_tale_pos
- @tale = Sprite.new
- @tale.bitmap = Bitmap.new(64, 32)
- if Fuki_v6_Setup::TAIL_SHOW
- case @message_position
- when 0 # 上
- bitmap = RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME)
- rect = Rect.new(32, 32, 64, 32)
- @tale.bitmap.blt(0, 0, bitmap, rect)
- bitmap.dispose
- @tale.x = tale_pos[0]
- @tale.x += 8 if @tale.x < 64
- if @tale.x > 640 - 64
- @tale.mirror = true
- @tale.x -= 64
- end
- @tale.y = tale_pos[1]
- @tale.z = self.z + 1
- when 1 # 中
- @tale.dispose
- @tale = nil
- when 2 # 下
- bitmap = RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME)
- rect = Rect.new(32, 64, 64, 32)
- @tale.bitmap.blt(0, 0, bitmap, rect)
- bitmap.dispose
- @tale.x = tale_pos[0]
- @tale.x += 8 if @tale.x < 64
- if @tale.x > 640 - 64
- @tale.mirror = true
- @tale.x -= 64
- end
- @tale.y = tale_pos[1]
- @tale.z = self.z# + 1
- end
- end
- end
- rescue
- del_fukidasi
- reset_window(width, height)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 计算呼出对话框的位置
- #--------------------------------------------------------------------------
- def get_fuki_pos(width, height)
- # 取得角色
- @character = get_character($mes_id)
- if @character == nil
- # 角色不存在的情况下使用默认信息框
-
- del_fukidasi
- reset_window(width, height)
- return
- end
- # 处理坐标
- x = (@character.real_x - $game_map.display_x + 64) * 32 / 128 - (width / 2)
- # 为尽量显示在画面内而移动横坐标
- if x + width > 640
- x = 640 - width
- elsif x < 0
- x = 0
- end
- # 决定窗口位置
- case $game_system.message_position
- when 0 # 上
- y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - Fuki_v6_Setup::CHARACTOR_HEIGHT + Fuki_v6_Setup::POP_SHIFT_TOP
- when 1 # 中
- x = (640 - width) / 2
- y = (480 - height) / 2
- when 2 # 下
- y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + Fuki_v6_Setup::POP_SHIFT_UNDER
- end
- # 纪录文章显示位置
- @message_position = $game_system.message_position
- if Fuki_v6_Setup::POS_FIX
- case @message_position
- when 0 # 上
- if y <= 0
- @message_position = 2
- y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + Fuki_v6_Setup::POP_SHIFT_UNDER
- end
- when 2 # 下
- if y + height >= 480
- @message_position = 0
- y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - Fuki_v6_Setup::CHARACTOR_HEIGHT + Fuki_v6_Setup::POP_SHIFT_TOP
- end
- end
- end
- return [x, y]
- end
- #--------------------------------------------------------------------------
- # ○ 计算尾部图标的位置
- #--------------------------------------------------------------------------
- def get_tale_pos
- case @message_position
- when 0 # 上
- # 处理坐标
- x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 8
- y = self.y + self.height - 6
- when 1 # 中
- x = nil
- y = nil
- when 2 # 下
- # 处理坐标
- x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 8
- y = self.y - 18
- end
- return [x, y]
- end
- #--------------------------------------------------------------------------
- # ○ 设置角色半身像窗口
- #--------------------------------------------------------------------------
- def draw_msg_face
- @face_sprite.dispose if @face_sprite != nil
- # $mes_name为空时不显示
- if $mes_name == nil or $mes_name == ""
- return
- else
- # 设定变量
- mes_name = $mes_name
- if $game_temp.namebmp[mes_name] == nil
- sFile = Fuki_v6_Setup::FACE_PIC_DIR + mes_name
- else
- sFile = Fuki_v6_Setup::FACE_PIC_DIR + $game_temp.namebmp[mes_name]
- end
- bitmap = Bitmap.new(sFile)
- @pic_width = bitmap.width
- @pic_height = bitmap.height
- @face_sprite = Sprite.new
- @face_sprite.x = self.x + 26
- @face_sprite.x = self.x + self.width - @pic_width - 26 if @show_right
- @face_sprite.y = self.y + self.height - @pic_height - 6
- @face_sprite.bitmap = bitmap
- @face_sprite.z = self.z + 3
- @face_sprite.mirror = @show_right
- @face_sprite.opacity = 0
- end
- end
- #--------------------------------------------------------------------------
- # ○ 释放呼出对话框
- #--------------------------------------------------------------------------
- def del_fukidasi
- self.opacity = 0
- self.x = 80
- self.width = 480
- self.height = 160
- self.contents.dispose
- self.contents = Bitmap.new(width - 32, height - 32)
- self.pause = true
- if @tale != nil
- @tale.dispose
- @tale = nil
- end
- end
- #--------------------------------------------------------------------------
- # ○ 取得角色
- # parameter : 参数
- #--------------------------------------------------------------------------
- def get_character(parameter)
- # 参数分歧
- case parameter
- when nil
- return events == nil
- when -1 # 玩家
- return $game_player
- when 0 # 该事件
- events = $game_map.events
- # 循环 (地图事件)
- for event in $game_map.events.values
- # 如果找到了启动中的事件
- if event.starting
- @event_id = event.id
- end
- end
- return events == nil ? nil : events[@event_id]
- else # 特定事件
- events = $game_map.events
- return events == nil ? nil : events[parameter]
- end
- end
- #--------------------------------------------------------------------------
- # ● 设定窗口位置和不透明度
- #--------------------------------------------------------------------------
- def reset_window(width = nil, height = nil)
- if $game_temp.in_battle
- self.y = 16
- else
- case $game_system.message_position
- when 0 # 上
- self.y = 16
- when 1 # 中
- if height != nil and width != nil
- self.y = (480 - height) / 2 - 32
- self.x = (640 - width) / 2
- self.width = width
- self.height = height
- self.contents.dispose
- self.contents = Bitmap.new(width - 32, height - 32)
- else
- self.y = 160
- end
- when 2 # 下
- self.y = 304
- end
- end
- self.opacity = 0
- if $game_system.message_frame == 0
- self.back_opacity = Fuki_v6_Setup::MES_OPACITY
- else
- self.back_opacity = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- if $tale_need_dispose
- del_fukidasi
- $tale_need_dispose = false
- end
- super
- update_fuki # 呼出模式下跟随事件移动
- if @fade_in # 渐变的情况下
- self.contents_opacity += 24
- @pic_skin.opacity += 20 if $game_system.message_frame == 0
- if @tale != nil
- @face_sprite.opacity += 24 if @face_sprite != nil and !@face_sprite.disposed?
- @tale.opacity += 20
- end
- @input_number_window.contents_opacity += 24 if @input_number_window != nil
- @fade_in = false if self.contents_opacity == 255
- return
- end
- if @contents_drawing # 显示信息中的情况下
- refresh_drawtext
- return
- end
- update_input_number_window # 输入数值的情况下
- if @contents_showing_end # 显示信息结束的情况下
- if $game_temp.choice_max == 0 and @tale == nil
- self.pause = true
- else
- self.pause = false
- end
- update_choose
- return
- end
- if @fade_out == false and $game_temp.message_text != nil # 在渐变以外的状态下
- @contents_showing = true
- $game_temp.message_window_showing = true
- reset_window
- refresh_create
- if @no_term_stop
- self.visible = true
- else
- @tale.opacity = 0 if @tale != nil
- Graphics.frame_reset
- self.visible = true
- self.contents_opacity = 0
- @input_number_window.contents_opacity = 0 if @input_number_window != nil
- @fade_in = true
- end
- return
- end
- unless @no_term_stop # 没有可以显示的信息、但是窗口为可见的情况下
- if self.visible
- @fade_out = true
- self.opacity -= 48
- @face_sprite.opacity -= 48 if @face_sprite != nil and !@face_sprite.disposed?
- @pic_skin.opacity -= 48 if @pic_skin != nil and !@pic_skin.disposed?
- @tale.opacity -= 48 if @tale != nil and !@tale.disposed?
- if (@face_sprite == nil) or @face_sprite.disposed? or (@face_sprite.opacity == 0)
- self.visible = false
- @face_sprite.dispose if @face_sprite != nil
- @pic_skin.dispose
- @fade_out = false
- $game_temp.message_window_showing = false
- end
- return
- end
- else
- $game_temp.message_window_showing = false
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- terminate_message
- $game_temp.message_window_showing = false
- @input_number_window.dispose if @input_number_window != nil
- super
- end
- #--------------------------------------------------------------------------
- # ● 信息结束处理
- #--------------------------------------------------------------------------
- def terminate_message
- self.active = false
- self.pause = false
- self.index = -1
- self.contents.clear
- # 清除显示中标志
- @contents_showing = false
- @contents_showing_end = false
- $mes_name = ""
- # 呼叫信息调用
- $game_temp.message_proc.call if $game_temp.message_proc != nil
- # 清除文章、选择项、输入数值的相关变量
- $game_temp.message_text = nil
- $game_temp.message_proc = nil
- $game_temp.choice_start = 99
- $game_temp.choice_max = 0
- $game_temp.choice_cancel_type = 0
- $game_temp.choice_proc = nil
- $game_temp.num_input_start = 99
- $game_temp.num_input_variable_id = 0
- $game_temp.num_input_digits_max = 0
- # 释放金钱窗口
- if @gold_window != nil
- @gold_window.dispose
- @gold_window = nil
- end
- @no_term_stop = false
- @save_x = 0
- @save_y = 0
- @show_right = false
- @show_name = false
- @face_width = 0
- $tale_need_dispose = true if @tale != nil
- end
- #--------------------------------------------------------------------------
- # ● ★信息结束处理★
- #--------------------------------------------------------------------------
- def terminate_messageX
- self.active = false
- self.pause = false
- self.index = -1
- # 清除显示中标志
- @contents_showing = false
- @contents_showing_end = false
- # 呼叫信息调用
- $game_temp.message_proc.call if $game_temp.message_proc != nil
- # 清除文章、选择项、输入数值的相关变量
- $game_temp.message_text = nil
- $game_temp.message_proc = nil
- @no_term_stop = true
- @show_right = false
- @show_name = false
- @face_width = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index >= 0
- n = $game_temp.choice_start + @index
- self.cursor_rect.set(Fuki_v6_Setup::MES_FONT_SIZE / 2, n * (Fuki_v6_Setup::MES_FONT_SIZE + 4), @cursor_width, Fuki_v6_Setup::MES_FONT_SIZE + 4)
- self.cursor_rect.x += @face_width unless @show_right
- self.cursor_rect.x += Fuki_v6_Setup::MES_FONT_SIZE / 2 if @show_name
- else
- self.cursor_rect.empty
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取文字颜色色
- # n : 文字颜色编号 (0~31)
- #--------------------------------------------------------------------------
- def text_color(n)
- return normal_color if n > 31
- x = (n % 8) * 16
- y = 128 + (n / 8) * 16
- return RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME).get_pixel(x, y)
- end
- #--------------------------------------------------------------------------
- # ● 取得普通文字色
- #--------------------------------------------------------------------------
- def normal_color
- nil_color = Color.new(0,0,0,255)
- return Fuki_v6_Setup::FUKI_COLOR if Fuki_v6_Setup::FUKI_COLOR != nil_color
- return nil_color
- end
- #--------------------------------------------------------------------------
- # ● 获取头像宽度
- #--------------------------------------------------------------------------
- def get_face_width(face_name)
- return if $mes_name == ""
- filename = Fuki_v6_Setup::FACE_PIC_DIR + face_name
- bitmap = Bitmap.new(filename)
- @face_width = bitmap.width + Fuki_v6_Setup::MES_FONT_SIZE
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ● 描绘物品
- # item : 物品
- #--------------------------------------------------------------------------
- def draw_icon(item, x, y)
- return if item == nil
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x + 4, y, bitmap, Rect.new(0, 0, 24, 24))
- color = self.contents.font.color.clone
- self.contents.font.color = text_color(1)
- self.contents.draw_text(x + 28, y, self.contents.text_size(item.name).width + 5, 24, item.name)
- self.contents.font.color = color
- @dx += self.contents.text_size(item.name).width
- end
- #--------------------------------------------------------------------------
- # ● 图形的描绘
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_actor_graphic(actor, x, y)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(x, y - 4, bitmap, src_rect)
- color = self.contents.font.color.clone
- self.contents.font.color = text_color(1)
- self.contents.draw_text(x + 32, y, self.contents.text_size(actor.name).width + 5, 24, actor.name)
- self.contents.font.color = color
- @dx += self.contents.text_size(actor.name).width
- end
- #--------------------------------------------------------------------------
- # ● 刷新呼出对话框
- #--------------------------------------------------------------------------
- def update_fuki
- if @tale != nil
- pos = get_fuki_pos(self.width, self.height)
- self.x = pos[0]
- self.y = pos[1]
- tale_pos = get_tale_pos
- @tale.mirror = false
- @tale.x = tale_pos[0]
- @tale.x += 8 if @tale.x < 64
- if @tale.x > 640 - 64
- @tale.mirror = true
- @tale.x -= 64
- end
- @tale.y = tale_pos[1]
- @pic_skin.x = self.x + 2
- @pic_skin.y = self.y + 2
- if @face_sprite != nil and !@face_sprite.disposed?
- @face_sprite.x = self.x + 26
- @face_sprite.x = self.x + self.width - @pic_width - 26 if @show_right
- @face_sprite.y = self.y + self.height - @pic_height - 6
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新数字输入框
- #--------------------------------------------------------------------------
- def update_input_number_window
- if @input_number_window != nil
- @input_number_window.update
- # 确定
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- $game_variables[$game_temp.num_input_variable_id] = @input_number_window.number
- # 释放输入数值窗口
- @input_number_window.dispose
- @input_number_window = nil
- $game_map.need_refresh = true
- terminate_message
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新选择输入
- #--------------------------------------------------------------------------
- def update_choose
- if Input.trigger?(Input::B)
- if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
- $game_system.se_play($data_system.cancel_se)
- $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
- terminate_message
- end
- end
- if Input.trigger?(Input::C)
- if $game_temp.choice_max > 0
- $game_system.se_play($data_system.decision_se)
- $game_temp.choice_proc.call(self.index)
- end
- terminate_message
- end
- end
- end
复制代码
覆盖存档的时候弹出对话框提示
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- #在覆盖存档的时候弹出对话框提示
- class Scene_Save < Scene_File
- # -----------------------------
- def initialize
- super("Save Data")
- @confirm_window = Window_Base.new(120, 188, 400, 64)
- @confirm_window.contents = Bitmap.new(368, 32)
- string = "确定要覆盖这个进度吗?"
- @confirm_window.contents.font.name = "幼圆"
- @confirm_window.contents.font.size = 24
- @confirm_window.contents.draw_text(4, 0, 368, 32, string)
- @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
- @confirm_window.visible = false
- @confirm_window.z = 1500
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @yes_no_window.x = 270
- @yes_no_window.y = 252
- @yes_no_window.z = 1500
- @mode = 0
- end
- # -----------------------------
- def on_decision(filename)
- if FileTest.exist?(filename)
- @confirm_window.visible = true
- @yes_no_window.visible = true
- @yes_no_window.active = true
- @mode = 1
- else
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Map.new
- #$scene = Scene_Menu.new(4)
- end
- end
- # -----------------------------
- def update
- if @mode == 0
- super
- else
- @help_window.update
- @yes_no_window.update
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- if @yes_no_window.index == 0
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @confirm_window.visible = false
- filename = make_filename(@file_index)
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- else
- $scene = Scene_Map.new
- #$scene = Scene_Menu.new(4)
- end
- else
- @confirm_window.visible = false
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @mode = 0
- end
- end
- if Input.trigger?(Input::B)
- @confirm_window.visible = false
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @mode = 0
- return
- end
- end
- end
- # -----------------------------
- def on_cancel
- $game_system.se_play($data_system.cancel_se)
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Map.new
- #$scene = Scene_Menu.new(4)
- end
- # -----------------------------
- def write_save_data(file)
- ###characters改为写入第一个角色的信息,增加写入地图信息###
- characters = $game_party.actors[0]
- mapinfo = load_data("Data/MapInfos.rxdata")
- Marshal.dump(mapinfo[$game_map.map_id].name, file )
- #-------------------------------------------------------------------------
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- $game_system.save_count += 1
- $game_system.magic_number = $data_system.magic_number
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
- class Scene_File
- alias carol3_main main
- def main
- carol3_main
- if self.is_a?(Scene_Save)
- @confirm_window.dispose
- @yes_no_window.dispose
- end
- end
- end
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
复制代码
存档扩位
- # --------------------------------------------------------------------
- class Scene_File
- #——最大存档数量,一般我认为最多50足够了,20比较合适
- SAVEFILE_MAX = 100
- # -------------------
- def initialize(help_text)
- @help_text = help_text
- end
- # -------------------
- def main
- ###设置背景图片###
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.picture("background")
- #---------------------------------------------------
- @help_window = Window_Help.new
- ###帮助窗口透明度改为0###
- @help_window.opacity = 0
- @help_window.set_text(@help_text)
- @savefile_windows = []
- @cursor_displace = 0
- for i in 0..3
- @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
- end
- @file_index = 0
- @savefile_windows[@file_index].selected = true
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- for i in @savefile_windows
- i.dispose
- end
- ###释放背景图片###
- @sprite.dispose
- end
- # -------------------
- def update
- @help_window.update
- for i in @savefile_windows
- i.update
- end
- if Input.trigger?(Input::C)
- on_decision(make_filename(@file_index))
- $game_temp.last_file_index = @file_index
- return
- end
- if Input.trigger?(Input::B)
- #@sprite.dispose
- on_cancel
- return
- end
- if Input.repeat?(Input::DOWN)
- if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
- if @file_index == SAVEFILE_MAX - 1
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace += 1
- if @cursor_displace == 4
- @cursor_displace = 3
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..3
- f = i - 2 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index + 1)
- if @file_index == SAVEFILE_MAX
- @file_index = SAVEFILE_MAX - 1
- end
- for i in 0..3
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- return
- end
- end
- if Input.repeat?(Input::UP)
- if Input.trigger?(Input::UP) or @file_index > 0
- if @file_index == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace -= 1
- if @cursor_displace == -1
- @cursor_displace = 0
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..3
- f = i - 1 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index - 1)
- if @file_index == -1
- @file_index = 0
- end
- for i in 0..3
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- return
- end
- end
- end
- # -------------------
- def make_filename(file_index)
- return "Save/Save#{file_index + 1}.rxdata"
- end
- # -------------------
- end
-
- class Window_SaveFile < Window_Base
- # -------------------
- def initialize(file_index, filename, position)
- #--------------------------------------------------------------------------
- # ###修改窗口Y值、高度、不透明度###
- #---------------------------------------------------------------------------
- y = 46 + position * 104
- super(0, y, 640, 134)
- self.opacity = 0
- #--------------------------------------------------------------------------
- self.contents = Bitmap.new(width - 32, height - 32)
- @file_index = file_index
- @filename = "Save/Save#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @mapname = Marshal.load(file)
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- end
- #==============================================================================
复制代码
全键盘按键
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
-
- #============================================================================
- # ■ Keyboard Script
- #----------------------------------------------------------------------------
- # By: Cybersam
- # Date: 25/05/05
- # Version 4
- #============================================================================
- # 66对此脚本使用方法的说明(可能不是很准确,反正大体能用):
- #
- # ★、Kboard.keyboard(键位) 返回是否按下这个键的判断。
- # 比如条件分歧:Kboard.keyboard($R_Key_H)
- # 则当按下键盘H键的时候条件分歧成立
- #Kboard.press?
- # ★、Kboard.keyb(键位) == 1 当连续按住某键返回真,否则为false
- # 比如条件分歧:Kboard.keyb($R_Key_U) == 1
- # 则当持续按下键盘U的时候条件分歧成立
- #
- # ★、Kboard.key(键位,1) 似乎可以做开关用。按下一次变为true,再按变false
- #============================================================================
-
- module Kboard
- #==========================================================================
- # 以下是全键盘按键列表
- #--------------------------------------------------------------------------
- $Rmouse_BUTTON_L = 0x01 # left mouse button
- $Rmouse_BUTTON_R = 0x02 # right mouse button
- $Rmouse_BUTTON_M = 0x04 # middle mouse button
- $Rmouse_BUTTON_4 = 0x05 # 4th mouse button
- $Rmouse_BUTTON_5 = 0x06 # 5th mouse button
- #--------------------------------------------------------------------------
- $R_Key_BACK = 0x08 # BACKSPACE key
- $R_Key_TAB = 0x09 # TAB key
- $R_Key_RETURN = 0x0D # ENTER key
- $R_Key_SHIFT = 0x10 # SHIFT key
- $R_Key_CTLR = 0x11 # CTLR key
- $R_Key_ALT = 0x12 # ALT key
- $R_Key_PAUSE = 0x13 # PAUSE key
- $R_Key_CAPITAL = 0x14 # CAPS LOCK key
- $R_Key_ESCAPE = 0x1B # ESC key
- $R_Key_SPACE = 0x20 # SPACEBAR
- $R_Key_PRIOR = 0x21 # PAGE UP key
- $R_Key_NEXT = 0x22 # PAGE DOWN key
- $R_Key_END = 0x23 # END key
- $R_Key_HOME = 0x24 # HOME key
- $R_Key_LEFT = 0x25 # LEFT ARROW key
- $R_Key_UP = 0x26 # UP ARROW key
- $R_Key_RIGHT = 0x27 # RIGHT ARROW key
- $R_Key_DOWN = 0x28 # DOWN ARROW key
- $R_Key_SELECT = 0x29 # SELECT key
- $R_Key_PRINT = 0x2A # PRINT key
- $R_Key_SNAPSHOT = 0x2C # PRINT SCREEN key
- $R_Key_INSERT = 0x2D # INS key
- $R_Key_DELETE = 0x2E # DEL key
- #--------------------------------------------------------------------------
- $R_Key_0 = 0x30 # 0 key
- $R_Key_1 = 0x31 # 1 key
- $R_Key_2 = 0x32 # 2 key
- $R_Key_3 = 0x33 # 3 key
- $R_Key_4 = 0x34 # 4 key
- $R_Key_5 = 0x35 # 5 key
- $R_Key_6 = 0x36 # 6 key
- $R_Key_7 = 0x37 # 7 key
- $R_Key_8 = 0x38 # 8 key
- $R_Key_9 = 0x39 # 9 key
- #--------------------------------------------------------------------------
- $R_Key_A = 0x41 # A key
- $R_Key_B = 0x42 # B key
- $R_Key_C = 0x43 # C key
- $R_Key_D = 0x44 # D key
- $R_Key_E = 0x45 # E key
- $R_Key_F = 0x46 # F key
- $R_Key_G = 0x47 # G key
- $R_Key_H = 0x48 # H key
- $R_Key_I = 0x49 # I key
- $R_Key_J = 0x4A # J key
- $R_Key_K = 0x4B # K key
- $R_Key_L = 0x4C # L key
- $R_Key_M = 0x4D # M key
- $R_Key_N = 0x4E # N key
- $R_Key_O = 0x4F # O key
- $R_Key_P = 0x50 # P key
- $R_Key_Q = 0x51 # Q key
- $R_Key_R = 0x52 # R key
- $R_Key_S = 0x53 # S key
- $R_Key_T = 0x54 # T key
- $R_Key_U = 0x55 # U key
- $R_Key_V = 0x56 # V key
- $R_Key_W = 0x57 # W key
- $R_Key_X = 0x58 # X key
- $R_Key_Y = 0x59 # Y key
- $R_Key_Z = 0x5A # Z key
- #--------------------------------------------------------------------------
- $R_Key_LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
- $R_Key_RWIN = 0x5C # Right Windows key (Natural keyboard)
- $R_Key_APPS = 0x5D # Applications key (Natural keyboard)
- #--------------------------------------------------------------------------
- $R_Key_NUMPAD0 = 0x60 # Numeric keypad 0 key
- $R_Key_NUMPAD1 = 0x61 # Numeric keypad 1 key
- $R_Key_NUMPAD2 = 0x62 # Numeric keypad 2 key
- $R_Key_NUMPAD3 = 0x63 # Numeric keypad 3 key
- $R_Key_NUMPAD4 = 0x64 # Numeric keypad 4 key
- $R_Key_NUMPAD5 = 0x65 # Numeric keypad 5 key
- $R_Key_NUMPAD6 = 0x66 # Numeric keypad 6 key
- $R_Key_NUMPAD7 = 0x67 # Numeric keypad 7 key
- $R_Key_NUMPAD8 = 0x68 # Numeric keypad 8 key
- $R_Key_NUMPAD9 = 0x69 # Numeric keypad 9 key
- $R_Key_MULTIPLY = 0x6A # Multiply key (*)
- $R_Key_ADD = 0x6B # Add key (+)
- $R_Key_SEPARATOR = 0x6C # Separator key
- $R_Key_SUBTRACT = 0x6D # Subtract key (-)
- $R_Key_DECIMAL = 0x6E # Decimal key
- $R_Key_DIVIDE = 0x6F # Divide key (/)
- #--------------------------------------------------------------------------
- $R_Key_F1 = 0x70 # F1 key
- $R_Key_F2 = 0x71 # F2 key
- $R_Key_F3 = 0x72 # F3 key
- $R_Key_F4 = 0x73 # F4 key
- $R_Key_F5 = 0x74 # F5 key
- $R_Key_F6 = 0x75 # F6 key
- $R_Key_F7 = 0x76 # F7 key
- $R_Key_F8 = 0x77 # F8 key
- $R_Key_F9 = 0x78 # F9 key
- $R_Key_F10 = 0x79 # F10 key
- $R_Key_F11 = 0x7A # F11 key
- $R_Key_F12 = 0x7B # F12 key
- #--------------------------------------------------------------------------
- $R_Key_NUMLOCK = 0x90 # NUM LOCK key
- $R_Key_SCROLL = 0x91 # SCROLL LOCK key
- #--------------------------------------------------------------------------
- $R_Key_LSHIFT = 0xA0 # Left SHIFT key
- $R_Key_RSHIFT = 0xA1 # Right SHIFT key
- $R_Key_LCONTROL = 0xA2 # Left CONTROL key
- $R_Key_RCONTROL = 0xA3 # Right CONTROL key
- $R_Key_L_ALT = 0xA4 # Left ALT key
- $R_Key_R_ALT = 0xA5 # Right ALT key
- #--------------------------------------------------------------------------
- $R_Key_SEP = 0xBC # , key
- $R_Key_DASH = 0xBD # - key
- $R_Key_DOTT = 0xBE # . Key
- #--------------------------------------------------------------------------
- GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
- GetKeyboardState = Win32API.new("user32","GetKeyState",['I'],'I')
- GetSetKeyState = Win32API.new("user32","SetKeyboardState",['I'],'I')
- #--------------------------------------------------------------------------
- module_function
- #--------------------------------------------------------------------------
- def keyb(rkey)
- if GetKeyState.call(rkey) != 0
- return 1
- end
- return 0
- end
- #--------------------------------------------------------------------------
- def keyboard(rkey)
- GetKeyState.call(rkey) & 0x01 == 1 #
- end
- #--------------------------------------------------------------------------
- def key(rkey, key = 0)
- GetKeyboardState.call(rkey) & 0x01 == key #
- end
- end
-
-
-
-
-
- #============================================================================
- # ■ 全键盘脚本(夏娜改,优化)
- #============================================================================
- #原来常用的全键盘脚本使用方法比较诡异,这里夏娜进行了修改。
- #本脚本没有给出键值,请在此处查询:[url]http://www.66rpg.com/htm/news7.htm[/url] 。
- #本教学95%以上作者用不上,除非制作ARPG或者默认按键不够用了。
- #============================================================================
- # 1、Kboard.press?(key) 同 Input.press?(key)
- # 2、Kboard.repeat?(key) 同 Input.repeat?(key)
- # 3、Kboard.trigger?(key) 同 Input.trigger?(key)
- #============================================================================
-
-
-
-
- module Kboard
-
- module_function
-
- @R_Key_Hash = {}
- @R_Key_Repeat = {}
-
- GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
-
- def press?(rkey)
- return if rkey.nil?
-
-
- return GetKeyState.call(rkey) != 0
- end
-
- def 任意键?(rkey, lkey=0)
- for i in 8..190
- if !rkey.nil? and Kboard.press?(i) and i != rkey and !Kboard.press?(rkey) and i != lkey and !Kboard.press?(lkey)
- return GetKeyState.call(i) != 0
- break
- end
- end
- return
- end
-
- def repeat?(rkey)
- return if rkey.nil?
-
-
- result = GetKeyState.call(rkey)
- if result != 0
- if @R_Key_Repeat[rkey].nil?
- @R_Key_Repeat[rkey] = 0
- return true
- end
- @R_Key_Repeat[rkey] += 1
- else
- @R_Key_Repeat[rkey] = nil
- @R_Key_Hash[rkey] = 0
- end
- if !@R_Key_Repeat[rkey].nil? and @R_Key_Repeat[rkey] > 4 # 4乃准确数字
- @R_Key_Repeat[rkey] = 0
- return true
- else
- return false
- end
- end
-
- def trigger?(rkey)
- return if rkey.nil?
-
- result = GetKeyState.call(rkey)
- if @R_Key_Hash[rkey] == 1 and result != 0
- return false
- end
- if result != 0
- @R_Key_Hash[rkey] = 1
- return true
- else
- @R_Key_Hash[rkey] = 0
- return false
- end
- end
-
- end
-
-
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
复制代码
变量显示
- #==========================================================================
- # 本脚本来自[url]www.66rpg.com[/url],用于任何游戏请保留此信息。
- #==========================================================================
- VAR_SWITCH = 155 # 1号开关打开此脚本才工作,关闭则停止运算,并且透明
- VAR_REFRESH_SWITCH = 156 # 2号开关控制强制刷新,使用时机:1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var
- $var = []
- $var = []#所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]
- #==============================================================================
- # ■ Window_XY
- #------------------------------------------------------------------------------
- # 显示坐标的窗口。
- #==============================================================================
- class Window_Var < Window_Base#注意前面那个window_var是文件名
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(-16, -16, 640+32, 480+32)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
- self.contents = Bitmap.new(width - 32, height - 32)
- self.back_opacity = 255 # 这个是背景透明
- self.opacity = 255 # 这个是边框和背景都透明
- self.contents_opacity = 255 # 这个是内容透明
- self.visible = false
- self.z=9999
- @var = $var
- @var_a = []
- for var_draw in $var
- @var_a[var_draw[0]] = $game_variables[var_draw[0]]
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if $game_switches[VAR_SWITCH]
- @var = $var # 记录现在变量数组结构
- self.contents.clear # 清除以前的东西
- for var_draw in @var
- @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量
- self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断文字刷新。节约内存用
- #--------------------------------------------------------------------------
- def judge
- for var_draw in $var
- if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新
- return true
- end
- end
- if $game_switches[VAR_REFRESH_SWITCH] # 强制刷新的时候,刷新
- $game_switches[VAR_REFRESH_SWITCH] = false
- return true
- end
- return false
- end
- end
- class Scene_Map
- alias var_66rpg_main main
- def main
- @var_window = Window_Var.new
- @var_window.opacity = 0
- var_66rpg_main
- @var_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- alias var_66rpg_update update
- def update
- var_66rpg_update
- if $game_switches[VAR_SWITCH]
- @var_window.visible = true
- @var_window.refresh if @var_window.judge
- else
- @var_window.visible = false
- end
- end
- end
- #========================================================================
- # 本脚本来自[url]www.66rpg.com[/url],用于任何游戏请保留此信息。
- #========================================================================
复制代码
远景图移动
- # ▼▲▼ XRXS34. パノラマスクロール ▼▲▼
- # by ぷのくー
- #——————————————————————————————————————
- # 这是一个非常简单的脚本,只要自定义自动滚动的地图编号和绝对不滚动的地图编号
- # 即可实现对远景的操作。
- #——————————————————————————————————————
- #==============================================================================
- # 初始化的一些常量
- #==============================================================================
- class Game_Map
-
- # 远景横向飘移速度速度
- PANORAMA_SX = 18
-
- # 远景纵向飘移速度速度
- PANORAMA_SY = 0
-
- # 自动滚动远景的地图编号(编号为292、293的地图远景会自动移动)
- AUTO_SCROLL_PANORAMA_IDS = [53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69]
- end
-
- class Spriteset_Map
-
- # 锁定远景的地图编号(编号为1的地图远景会锁定)
- SCROLL_FREEZE_PANORAMA_IDS = [1]
-
- #——说明:如果自动滚动和锁定都包括了某张地图,则该地图不滚动。
- #——如果自动滚动和锁定都没有包括某图,则还是会使用默认效果。
- end
- #==============================================================================
- # ■ Game_Map
- #==============================================================================
- class Game_Map
- attr_accessor :panorama_sx
- attr_accessor :panorama_sy
- attr_reader :panorama_ox
- attr_reader :panorama_oy
- def setup(map_id)
- @map_id = map_id
- @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
- tileset = $data_tilesets[@map.tileset_id]
- @tileset_name = tileset.tileset_name
- @autotile_names = tileset.autotile_names
- @panorama_name = tileset.panorama_name
- @panorama_hue = tileset.panorama_hue
- @fog_name = tileset.fog_name
- @fog_hue = tileset.fog_hue
- @fog_opacity = tileset.fog_opacity
- @fog_blend_type = tileset.fog_blend_type
- @fog_zoom = tileset.fog_zoom
- @fog_sx = tileset.fog_sx
- @fog_sy = tileset.fog_sy
- # ===================================
- if AUTO_SCROLL_PANORAMA_IDS.include?(map_id)
- @panorama_sx = PANORAMA_SX
- @panorama_sy = PANORAMA_SY
- else
- @panorama_sx = 0
- @panorama_sy = 0
- end
- # ===================================
- @battleback_name = tileset.battleback_name
- @passages = tileset.passages
- @priorities = tileset.priorities
- @terrain_tags = tileset.terrain_tags
- @display_x = 0
- @display_y = 0
- @need_refresh = false
- @events = {}
- for i in @map.events.keys
- @events[i] = Game_Event.new(@map_id, @map.events[i])
- end
- @common_events = {}
- for i in 1...$data_common_events.size
- @common_events[i] = Game_CommonEvent.new(i)
- end
- @fog_ox = 0
- @fog_oy = 0
- @panorama_ox = 0
- @panorama_oy = 0
- @fog_tone = Tone.new(0, 0, 0, 0)
- @fog_tone_target = Tone.new(0, 0, 0, 0)
- @fog_tone_duration = 0
- @fog_opacity_duration = 0
- @fog_opacity_target = 0
- @scroll_direction = 2
- @scroll_rest = 0
- @scroll_speed = 4
- end
- def update
- if $game_map.need_refresh
- refresh
- end
- if @scroll_rest > 0
- distance = 2 ** @scroll_speed
- case @scroll_direction
- when 2 # 下
- scroll_down(distance)
- when 4 # 左
- scroll_left(distance)
- when 6 # 右
- scroll_right(distance)
- when 8 # 上
- scroll_up(distance)
- end
- @scroll_rest -= distance
- end
- for event in @events.values
- event.update
- end
- for common_event in @common_events.values
- common_event.update
- end
- @fog_ox -= @fog_sx / 8.0
- @fog_oy -= @fog_sy / 8.0
- # ===================================
- @panorama_ox -= @panorama_sx / 8.0
- @panorama_oy -= @panorama_sy / 8.0
- # ===================================
- if @fog_tone_duration >= 1
- d = @fog_tone_duration
- target = @fog_tone_target
- @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
- @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
- @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
- @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
- @fog_tone_duration -= 1
- end
- if @fog_opacity_duration >= 1
- d = @fog_opacity_duration
- @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
- @fog_opacity_duration -= 1
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Map
- #==============================================================================
- class Spriteset_Map
- def update
- if @panorama_name != $game_map.panorama_name or
- @panorama_hue != $game_map.panorama_hue
- @panorama_name = $game_map.panorama_name
- @panorama_hue = $game_map.panorama_hue
- if @panorama.bitmap != nil
- @panorama.bitmap.dispose
- @panorama.bitmap = nil
- end
- if @panorama_name != ""
- @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
- end
- Graphics.frame_reset
- end
- if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
- @fog_name = $game_map.fog_name
- @fog_hue = $game_map.fog_hue
- if @fog.bitmap != nil
- @fog.bitmap.dispose
- @fog.bitmap = nil
- end
- if @fog_name != ""
- @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
- end
- Graphics.frame_reset
- end
- @tilemap.ox = $game_map.display_x / 4
- @tilemap.oy = $game_map.display_y / 4
- @tilemap.update
- # ===================================
- if SCROLL_FREEZE_PANORAMA_IDS.include?($game_map.map_id)
- @panorama.ox = 0
- @panorama.oy = 0
- else
- @panorama.ox = $game_map.display_x / 8 +$game_map.panorama_ox
- @panorama.oy = $game_map.display_y / 8 +$game_map.panorama_oy
- end
- # ===================================
- @fog.zoom_x = $game_map.fog_zoom / 100.0
- @fog.zoom_y = $game_map.fog_zoom / 100.0
- @fog.opacity = $game_map.fog_opacity
- @fog.blend_type = $game_map.fog_blend_type
- @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
- @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
- @fog.tone = $game_map.fog_tone
- for sprite in @character_sprites
- sprite.update
- end
- @weather.type = $game_screen.weather_type
- @weather.max = $game_screen.weather_max
- @weather.ox = $game_map.display_x / 4
- @weather.oy = $game_map.display_y / 4
- @weather.update
- for sprite in @picture_sprites
- sprite.update
- end
- @timer_sprite.update
- @viewport1.tone = $game_screen.tone
- @viewport1.ox = $game_screen.shake
- @viewport3.color = $game_screen.flash_color
- @viewport1.update
- @viewport3.update
- end
- end
复制代码
|
|