- 累计送礼:
- 0 个
- 累计收礼:
- 0 个
TA的每日心情 | 开心 昨天 18:01 |
---|
签到天数: 114 天 连续签到: 4 天 [LV.6]常住居民II

管理员
  
- VIP
- 6
- 卡币
- 10632
- OK点
- 16
- 推广点
- 0
- 同能卷
- 0
- 积分
- 13401


|
非常实用,而且脚本易修改。
另外脚本中不再置字体名、粗体以及斜体等的改变
(因为那玩意性价比太低了 - - !)- #===========================================================================# * draw_text必备扩展#============================================================================begin!c[n] 改用n号颜色 *注 颜色在color处自定!s[n] 改用n号大小!k[n] 空n像素v[n] n号变量i[n] 描绘id为n的物品的图标s[n] 描绘id为n的特技的图标w[n] 描绘id为n的武器的图标a[n] 描绘id为n的防具的图标\\n 手动换行(附带自动换行)=endclass Window_Base < Window def dl_draw_text(x, y, text) #初始化数据 color_copy = self.contents.font.color.clone text_copy = text text_x,text_y = x,y #正则 text_copy.gsub!(/!c\[([0-9]+)\]/) { "\001[#{$1}]" } text_copy.gsub!(/!s\[([0-9]+)\]/) { "\002[#{$1}]" } text_copy.gsub!(/!k\[([0-9]+)\]/) { "\003[#{$1}]" } text_copy.gsub!(/i\[([0-9]+)\]/) { "\020[#{$1}]" } text_copy.gsub!(/s\[([0-9]+)\]/) { "\021[#{$1}]" } text_copy.gsub!(/w\[([0-9]+)\]/) { "\022[#{$1}]" } text_copy.gsub!(/a\[([0-9]+)\]/) { "\023[#{$1}]" } text_copy.gsub!(/v\[([0-9]+)\]/) { $game_variables[$1.to_i] } text_copy.gsub!(/\\n/) { "\030" } # 描绘每一个字 while ((c = text_copy.slice!(/./m)) != nil) #颜色 if c == "\001" text_copy.sub!(/\[([0-9]+)\]/, "") self.contents.font.color = text_color($1.to_i) next end #大小 if c == "\002" text_copy.sub!(/\[([0-9]+)\]/, "") self.contents.font.size = $1.to_i next end #空像素 if c == "\003" text_copy.sub!(/\[([0-9]+)\]/, "") text_x += $1.to_i if text_x > self.width - 40 text_x = 40 + text_x - self.width text_y += self.contents.font.size end next end #物品 if c == "\020" text_copy.sub!(/\[([0-9]+)\]/, "") if !$data_items[$1.to_i].nil? and $data_items[$1.to_i].icon_name != "" next if text_x + 24 > self.width - 32 bitmap = RPG::Cache.icon($data_items[$1.to_i].icon_name) self.contents.blt(text_x, text_y, bitmap, Rect.new(0, 0, 24, 24)) text_x += 24 end next end #特技 if c == "\021" text_copy.sub!(/\[([0-9]+)\]/, "") if !$data_skills[$1.to_i].nil? and $data_skills[$1.to_i].icon_name != "" next if text_x + 24 > self.width - 32 bitmap = RPG::Cache.icon($data_skills[$1.to_i].icon_name) self.contents.blt(text_x, text_y, bitmap, Rect.new(0, 0, 24, 24)) text_x += 24 end next end #武器 if c == "\022" text_copy.sub!(/\[([0-9]+)\]/, "") if !$data_weapons[$1.to_i].nil? and $data_weapons[$1.to_i].icon_name != "" next if text_x + 24 > self.width - 32 bitmap = RPG::Cache.icon($data_weapons[$1.to_i].icon_name) self.contents.blt(text_x, text_y, bitmap, Rect.new(0, 0, 24, 24)) text_x += 24 end next end #防具 if c == "\023" text_copy.sub!(/\[([0-9]+)\]/, "") if !$data_armors[$1.to_i].nil? and $data_armors[$1.to_i].icon_name != "" next if text_x + 24 > self.width - 32 bitmap = RPG::Cache.icon($data_armors[$1.to_i].icon_name) self.contents.blt(text_x, text_y, bitmap, Rect.new(0, 0, 24, 24)) text_x += 24 end next end #换行 if c == "\030" text_y += self.contents.font.size next end cx = self.contents.text_size(c).width self.contents.draw_text(text_x, text_y, cx, self.contents.font.size, c) text_x += cx #自动换行 if text_x > self.width - 40 text_x = 0 text_y += self.contents.font.size end end self.contents.font.color = color_copy endend复制代码
复制代码 本帖来自P1论坛作者恐惧剑刃,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=343165 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |
|