加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 dant 于 2012-8-2 11:59 编辑
就是这样。
在所有使用到draw_text_ex的地方都可以使用。
也可以改成只在某个Window类内部使用
#============================================================================== # ** 转义字符加强 #------------------------------------------------------------------------------ # 加强用于显示文章和其它使用draw_text_ex的转义字符。 # - \V[n],\N[n],\P[n] 支持无限嵌套 # - 添加以下转义字符 # + \ITM[n] 替换为n号道具 (带图标) # + \WPN[n] 替换为n号武器 (带图标) # + \ARM[n] 替换为n号防具 (带图标) # + \SKL[n] 替换为n号特技 (带图标) #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # * Preconvert Control Characters # As a rule, replace only what will be changed into text strings before # starting actual drawing. The character "\" is replaced with the escape # character (\e). #-------------------------------------------------------------------------- def convert_escape_characters(text) result = text.to_s.clone result.gsub!(/\\/) { "\e" } result.gsub!(/\e\e/) { "\\" } while true done_flag = nil done_flag |= result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } #result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } done_flag |= result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) } done_flag |= result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) } done_flag |= result.gsub!(/\eITM\[(\d+)\]/i) { item_ctrl_str($data_items[$1.to_i]) } done_flag |= result.gsub!(/\eWPN\[(\d+)\]/i) { item_ctrl_str($data_weapons[$1.to_i]) } done_flag |= result.gsub!(/\eARM\[(\d+)\]/i) { item_ctrl_str($data_armors[$1.to_i]) } done_flag |= result.gsub!(/\eSKL\[(\d+)\]/i) { item_ctrl_str($data_skills[$1.to_i]) } break unless done_flag end result.gsub!(/\eG/i) { Vocab::currency_unit } result end def item_ctrl_str(item) "\eI[#{item.icon_index}] #{item.name}" end end
#==============================================================================
# ** 转义字符加强
#------------------------------------------------------------------------------
# 加强用于显示文章和其它使用draw_text_ex的转义字符。
# - \V[n],\N[n],\P[n] 支持无限嵌套
# - 添加以下转义字符
# + \ITM[n] 替换为n号道具 (带图标)
# + \WPN[n] 替换为n号武器 (带图标)
# + \ARM[n] 替换为n号防具 (带图标)
# + \SKL[n] 替换为n号特技 (带图标)
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Preconvert Control Characters
# As a rule, replace only what will be changed into text strings before
# starting actual drawing. The character "\" is replaced with the escape
# character (\e).
#--------------------------------------------------------------------------
def convert_escape_characters(text)
result = text.to_s.clone
result.gsub!(/\\/) { "\e" }
result.gsub!(/\e\e/) { "\\" }
while true
done_flag = nil
done_flag |= result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
#result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
done_flag |= result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
done_flag |= result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
done_flag |= result.gsub!(/\eITM\[(\d+)\]/i) { item_ctrl_str($data_items[$1.to_i]) }
done_flag |= result.gsub!(/\eWPN\[(\d+)\]/i) { item_ctrl_str($data_weapons[$1.to_i]) }
done_flag |= result.gsub!(/\eARM\[(\d+)\]/i) { item_ctrl_str($data_armors[$1.to_i]) }
done_flag |= result.gsub!(/\eSKL\[(\d+)\]/i) { item_ctrl_str($data_skills[$1.to_i]) }
break unless done_flag
end
result.gsub!(/\eG/i) { Vocab::currency_unit }
result
end
def item_ctrl_str(item)
"\eI[#{item.icon_index}] #{item.name}"
end
end
|