查看: 3447|回复: 6

[原创发布] 【画面崩坏神器】Qrazier 文本系统

[复制链接]
梦石
2
星屑
6777
在线时间
501 小时
注册时间
2018-3-23
回帖
487

R考场第七期银奖

发表于 2020-4-19 22:22:19 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
为了能在对话等文本中用上一些奇葩效果……让您的排版瞬间混乱的Qraizer文本系统出现了!(口胡
截图

Quazier系统实例

Quazier系统实例

脚本
  1. #==============================================================================
  2. # Qrazier 文本系统 V1.0
  3. #------------------------------------------------------------------------------
  4. # 作者:MCCF 最后更新时间:2020/04/19
  5. #==============================================================================
  6. #  - [简要概述]
  7. #------------------------------------------------------------------------------
  8. #  - Qrazier 是一个用于实现奇特(且通常无用)的文本效果的系统。
  9. #==============================================================================
  10. #  - [使用说明]
  11. #------------------------------------------------------------------------------
  12. #  - 在对话等文本中使用[b]文本[/b]可以给文本附加加粗效果。
  13. #  - 在对话等文本中使用[i]文本[/i]可以给文本附加斜体效果。
  14. #  - 在对话等文本中使用[u]文本[/u]可以给文本附加下划线效果。
  15. #  - 在对话等文本中使用[s]文本[/s]可以给文本附加删除线效果。
  16. #==============================================================================
  17. #  - [使用规约]
  18. #------------------------------------------------------------------------------
  19. #  - 只要署名MCCF,即可在符合当地法规及其它规约的情况下,自由使用于任何游戏中。
  20. #==============================================================================

  21. #==============================================================================
  22. # ■ Window_Base
  23. #------------------------------------------------------------------------------
  24. #  游戏中所有窗口的父类
  25. #==============================================================================
  26. class Window_Base < Window
  27.   #--------------------------------------------------------------------------
  28.   # ● 获取划线宽度
  29.   #--------------------------------------------------------------------------
  30.   def qrazier_line_width
  31.     return 1
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 文字的处理
  35.   #--------------------------------------------------------------------------
  36.   alias qrazier_process_character process_character
  37.   def process_character(c, text, pos)
  38.     if c == "[" && text[/^(\/?[A-Z]+)\]/i]
  39.       process_qrazier_character($1, text, pos)
  40.     else
  41.       last_pos = pos.dup
  42.       qrazier_process_character(c, text, pos)
  43.       process_underline(c, last_pos) if last_pos[:text_underline]
  44.       process_strike(c, last_pos) if last_pos[:text_strike]
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● CRA控制符的处理
  49.   #--------------------------------------------------------------------------
  50.   def process_qrazier_character(code, text, pos)
  51.     if code.slice!(/^\//)
  52.       case code.upcase
  53.       when 'B'
  54.         contents.font.bold = false
  55.         text.slice!(/^\/?[A-Z]+\]/i)
  56.       when 'I'
  57.         contents.font.italic = false
  58.         text.slice!(/^\/?[A-Z]+\]/i)
  59.       when 'U'
  60.         pos[:text_underline] = false
  61.         text.slice!(/^\/?[A-Z]+\]/i)
  62.       when 'S'
  63.         pos[:text_strike] = false
  64.         text.slice!(/^\/?[A-Z]+\]/i)
  65.       end
  66.     else
  67.       case code.upcase
  68.       when 'B'
  69.         contents.font.bold = true
  70.         text.slice!(/^\/?[A-Z]+\]/i)
  71.       when 'I'
  72.         contents.font.italic = true
  73.         text.slice!(/^\/?[A-Z]+\]/i)
  74.       when 'U'
  75.         pos[:text_underline] = true
  76.         text.slice!(/^\/?[A-Z]+\]/i)
  77.       when 'S'
  78.         pos[:text_strike] = true
  79.         text.slice!(/^\/?[A-Z]+\]/i)
  80.       end
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 处理下划线
  85.   #--------------------------------------------------------------------------
  86.   def process_underline(char, pos)
  87.     text_width = text_size(char).width
  88.     line_color = contents.font.color
  89.     pos_x = pos[:x] + 0
  90.     pos_y = pos[:y] + contents.font.size
  91.     contents.fill_rect(pos_x, pos_y, text_width, qrazier_line_width, line_color)
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 处理删除线
  95.   #--------------------------------------------------------------------------
  96.   def process_strike(char, pos)
  97.     text_width = text_size(char).width
  98.     line_color = contents.font.color
  99.     pos_x = pos[:x] + 0
  100.     pos_y = pos[:y] + line_height / 2
  101.     contents.fill_rect(pos_x, pos_y, text_width, qrazier_line_width, line_color)
  102.   end
  103. end
复制代码

评分

参与人数 3赞 +3 收起 理由
Nil2018 + 1 精品文章
PLeaseS + 1 太强了
chanszeman1018 + 1 精品文章

查看全部评分

祝好。
梦石
0
星屑
11806
在线时间
623 小时
注册时间
2016-8-25
回帖
1339

R考场第七期纪念奖

发表于 2020-4-19 22:42:24 | 显示全部楼层
好,必须点赞
大佬太强了
加油
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
5706
在线时间
922 小时
注册时间
2013-8-29
回帖
1401
发表于 2020-4-19 22:44:52 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
回帖
647
发表于 2020-4-29 18:18:41 | 显示全部楼层
楼上两个水神正在努力赚星屑
















回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
5706
在线时间
922 小时
注册时间
2013-8-29
回帖
1401
发表于 2020-4-29 19:23:57 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部