查看: 3377|回复: 6

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

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

R考场第七期银奖

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

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

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

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

Quazier系统实例

Quazier系统实例

脚本[pre lang="ruby"]#==============================================================================
# Qrazier 文本系统 V1.0
#------------------------------------------------------------------------------
# 作者:MCCF 最后更新时间:2020/04/19
#==============================================================================
#  - [简要概述]
#------------------------------------------------------------------------------
#  - Qrazier 是一个用于实现奇特(且通常无用)的文本效果的系统。
#==============================================================================
#  - [使用说明]
#------------------------------------------------------------------------------
#  - 在对话等文本中使用文本可以给文本附加加粗效果。
#  - 在对话等文本中使用文本可以给文本附加斜体效果。
#  - 在对话等文本中使用文本可以给文本附加下划线效果。
#  - 在对话等文本中使用文本可以给文本附加删除线效果。
#==============================================================================
#  - [使用规约]
#------------------------------------------------------------------------------
#  - 只要署名MCCF,即可在符合当地法规及其它规约的情况下,自由使用于任何游戏中。
#==============================================================================

#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中所有窗口的父类
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 获取划线宽度
  #--------------------------------------------------------------------------
  def qrazier_line_width
    return 1
  end
  #--------------------------------------------------------------------------
  # ● 文字的处理
  #--------------------------------------------------------------------------
  alias qrazier_process_character process_character
  def process_character(c, text, pos)
    if c == "[" && text[/^(\/?[A-Z]+)\]/i]
      process_qrazier_character($1, text, pos)
    else
      last_pos = pos.dup
      qrazier_process_character(c, text, pos)
      process_underline(c, last_pos) if last_pos[:text_underline]
      process_strike(c, last_pos) if last_pos[:text_strike]
    end
  end
  #--------------------------------------------------------------------------
  # ● CRA控制符的处理
  #--------------------------------------------------------------------------
  def process_qrazier_character(code, text, pos)
    if code.slice!(/^\//)
      case code.upcase
      when 'B'
        contents.font.bold = false
        text.slice!(/^\/?[A-Z]+\]/i)
      when 'I'
        contents.font.italic = false
        text.slice!(/^\/?[A-Z]+\]/i)
      when 'U'
        pos[:text_underline] = false
        text.slice!(/^\/?[A-Z]+\]/i)
      when 'S'
        pos[:text_strike] = false
        text.slice!(/^\/?[A-Z]+\]/i)
      end
    else
      case code.upcase
      when 'B'
        contents.font.bold = true
        text.slice!(/^\/?[A-Z]+\]/i)
      when 'I'
        contents.font.italic = true
        text.slice!(/^\/?[A-Z]+\]/i)
      when 'U'
        pos[:text_underline] = true
        text.slice!(/^\/?[A-Z]+\]/i)
      when 'S'
        pos[:text_strike] = true
        text.slice!(/^\/?[A-Z]+\]/i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 处理下划线
  #--------------------------------------------------------------------------
  def process_underline(char, pos)
    text_width = text_size(char).width
    line_color = contents.font.color
    pos_x = pos[:x] + 0
    pos_y = pos[:y] + contents.font.size
    contents.fill_rect(pos_x, pos_y, text_width, qrazier_line_width, line_color)
  end
  #--------------------------------------------------------------------------
  # ● 处理删除线
  #--------------------------------------------------------------------------
  def process_strike(char, pos)
    text_width = text_size(char).width
    line_color = contents.font.color
    pos_x = pos[:x] + 0
    pos_y = pos[:y] + line_height / 2
    contents.fill_rect(pos_x, pos_y, text_width, qrazier_line_width, line_color)
  end
end[/pre]

评分

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

查看全部评分

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

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.

在本版发帖返回顶部