最近电脑健康不太好,说不准哪天要是电脑坏了我就该傻眼了,直接把东西都扔在这里
进来就是有缘,无需声明无需引用有人需要就拿去好了←有白字
1.自定义存档
#encoding:utf-8
#==============================================================================
# ■ DataManager
#------------------------------------------------------------------------------
# 数据库和游戏实例的管理器。所有在游戏中使用的全局变量都在这里初始化。
#==============================================================================
module DataManager
class << self
alias_method :create_game_objects_20150416, :create_game_objects
#--------------------------------------------------------------------------
# ● 生成各种游戏对象
#--------------------------------------------------------------------------
def create_game_objects
create_game_objects_20150416
$step = Hash.new(0)
$facemap = Hash.new("")
end
#--------------------------------------------------------------------------
# ● 生成存档内容
#--------------------------------------------------------------------------
alias_method :make_save_contents_20150416, :make_save_contents
def make_save_contents
contents = make_save_contents_20150416
contents[:step] = $step
contents[:facemap] = $facemap
contents
end
#--------------------------------------------------------------------------
# ● 展开存档内容
#--------------------------------------------------------------------------
alias_method :extract_save_contents_20150416, :extract_save_contents
def extract_save_contents(contents)
extract_save_contents_20150416(contents)
$step = contents[:step]
$facemap = contents[:facemap]
end
end
end
2.追加的文字控制符
#encoding:utf-8
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
# 显示文字信息的窗口。
#==============================================================================
class Window_Message < Window_Base
#--------------------------------------------------------------------------
# ● 控制符的处理
# code : 控制符的实际形式(比如“\C[1]”是“C”)
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
# 使用方式:比如定义为$step["123"],此处应写为123
#--------------------------------------------------------------------------
alias_method :process_escape_character_20150416, :process_escape_character
def process_escape_character(code, text, pos)
process_escape_character_20150416(code, text, pos)
case code.upcase
when 'S'
t = text.slice!(/^\[.+?\]/).to_s rescue ""
t.delete!("[]")
text.insert(0,"#{$step[t]}")
end
end
end
3.追加的先期处理文字控制
#encoding:utf-8
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# 事件指令的解释器。
# 本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。
#==============================================================================
module WSK
def self.AddMap(arg0,arg1)
if $facemap.member?(arg0)
msgbox("亲,请不要重复定义映射,脚本君的思维会混乱的=v=")
else
$facemap[arg0] = arg1
end
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 显示文字
#--------------------------------------------------------------------------
def command_101
wait_for_message
$game_message.face_name = @params[0]
$game_message.face_index = @params[1]
$game_message.background = @params[2]
$game_message.position = @params[3]
#对“@list[@index+1].parameters[0]”进行处理可以得到文字数据
t0 = @list[@index+1].parameters[0]
if t0[0] = '['
t1 = @list[@index+1].parameters[0].slice!(/^\[.+?\]/).to_s rescue ""
t1.delete!("[]")
t2 = t1.split(',', 3)
@list[@index+1].parameters[0].insert(0,t2[0]+"\n")
$game_message.face_name = $facemap[t2[0]] + "_" + t2[1]
$game_message.face_index = t2[2].to_i
msgbox("face_name:" + $game_message.face_name + "\n" +
"face_index:" + $game_message.face_index.to_s + "\n")
end
while next_event_code == 401 # 文字数据
@index += 1
$game_message.add(@list[@index].parameters[0])
end
case next_event_code
when 102 # 显示选项
@index += 1
setup_choices(@list[@index].parameters)
when 103 # 数值输入的处理
@index += 1
setup_num_input(@list[@index].parameters)
when 104 # 物品选择的处理
@index += 1
setup_item_choice(@list[@index].parameters)
end
wait_for_message
end
end
4.在地图上随时随地显示文字
#encoding:utf-8
#==============================================================================
# ■ Window_Text
#------------------------------------------------------------------------------
# 地图界面中,随时显示文字的特殊窗口。
#==============================================================================
module WSK
def self.Show_text(arg0,arg1,arg2)
@m = Window_Text.new(arg0,arg1,arg2)
end
def self.Dispose_text
@m.dispose
end
end
class Window_Text < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0, text = "")
super(x, y, Graphics.width, text.size * 50)
self.back_opacity = 0
self.windowskin = Bitmap.new("Graphics\\System\\noframe.png") #无边框窗口皮肤
set_text(text)
end
#--------------------------------------------------------------------------
# ● 设置内容
#--------------------------------------------------------------------------
def set_text(text)
if text != @text
@text = text
refresh
end
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(4, 0, @text)
end
end
5.追加LOGO动画
#encoding:utf-8
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 标题画面
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
SceneManager.clear
Graphics.freeze
start_logo
create_background
create_foreground
create_command_window
play_title_music
end
#--------------------------------------------------------------------------
# ● 播放起始动画
#--------------------------------------------------------------------------
def start_logo
@path = ""
if(@path != "")
Graphics.play_movie(@path)
Graphics.frame_reset
end
end
end