设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2151|回复: 2
打印 上一主题 下一主题

[已经过期] 如何解决文字阴影效果F12后的问题?

[复制链接]

Lv2.观梦者

梦石
0
星屑
615
在线时间
84 小时
注册时间
2012-8-12
帖子
178
跳转到指定楼层
1
发表于 2018-1-9 23:20:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#======================================================================
# 脚本来自www.66rpg.com,使用请保留此信息
# 作者:SailCat;升级:柳柳;最后升级日期:2006年4月30日
#======================================================================
class Bitmap
  unless $OK
    alias sailcat_draw_text draw_text
    def draw_text(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p9 = false, p7 = 3, p8 = nil)
      case p1
      when Numeric
        x = p1
        y = p2
        width = p3
        height = p4
        text = p5
        align = p6
        shadow_direction = p7
        shadow_color = p8
        if shadow_color.nil?
          shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.99)
        end
      when Rect
        x = p1.x
        y = p1.y
        width = p1.width
        height = p1.height
        text = p2
        align = p3
        shadow_direction = p4
        shadow_color = p5
        if shadow_color.nil?
          shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.99)
        end
      end
      if p9
        sailcat_draw_text(x, y, width, height, text, align)
        return
      end
      color_temp = self.font.color.clone
      if shadow_direction != 0
        self.font.color = shadow_color
        case shadow_direction
        when 1
          sailcat_draw_text(x-1, y+1, width, height, text, align)
        when 3
          sailcat_draw_text(x+1, y+1, width, height, text, align)
        when 7
          sailcat_draw_text(x-1, y-1, width, height, text, align)
        when 9
          sailcat_draw_text(x+1, y-1, width, height, text, align)
        end
        self.font.color = color_temp
      end
      $OK = true
      sailcat_draw_text(x, y, width, height, text, align)
    end
  end
end

F12之后报错,这问题可以解决吗
不要屏蔽F12这个方法
或者有没有更好的文字阴影脚本

Lv5.捕梦者 (版主)

遠航の猫咪

梦石
3
星屑
23109
在线时间
2386 小时
注册时间
2005-10-15
帖子
1166

开拓者

2
发表于 2018-1-10 00:43:29 | 只看该作者
SEP Core插件应该可以满足你

节选:
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Bitmap
  3. #------------------------------------------------------------------------------
  4. #   位图的增强功能,植入部分RGSS2的功能。
  5. #==============================================================================
  6. class Bitmap
  7.   #--------------------------------------------------------------------------
  8.   # ● 方法重定义
  9.   #--------------------------------------------------------------------------
  10.   unless method_defined?(:sailcat_sepcore_dispose)
  11.     alias sailcat_sepcore_draw_text draw_text
  12.   end
  13.   #--------------------------------------------------------------------------
  14.   # ● 获得描绘缓存
  15.   #--------------------------------------------------------------------------
  16.   def buffer
  17.     @buffer ||= Bitmap.new(width, height)
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 清除缓存
  21.   #--------------------------------------------------------------------------
  22.   def clear_buffer
  23.     self.buffer.clear
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 释放
  27.   #--------------------------------------------------------------------------
  28.   def dispose
  29.     sailcat_sepcore_dispose
  30.     @buffer.dispose if @buffer
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 绘制带有阴影或描边的文字
  34.   #     args : 参数,写法同RGSS2
  35.   #       参数1:x, y, width, height, str[, align[, shadow_direction[, color]]]
  36.   #       参数2:rect, str[, align[, shadow_direction[, color]]]
  37.   #     shadow_direction : 阴影的方向(0/1/3/5/7/9),0取消,1/3/7/9四角,5描边
  38.   #     color : 阴影的颜色,不透明度会自动调整
  39.   #--------------------------------------------------------------------------
  40.   def draw_text(*args)
  41.     case args[0]
  42.     when Numeric
  43.       x, y, width, height, text, align, shadow_direction, shadow_color = args
  44.       align ||= 0
  45.       shadow_direction ||= 3
  46.       shadow_color ||= Color.new(0, 0, 0)
  47.       shadow_color.alpha = font.color.alpha * 160 / 255
  48.     when Rect
  49.       rect, text, align, shadow_direction, shadow_color = args
  50.       x = args[0].x
  51.       y = args[0].y
  52.       width = args[0].width
  53.       height = args[0].height
  54.       align ||= 0
  55.       shadow_direction ||= 3
  56.       shadow_color ||= Color.new(0, 0, 0)
  57.       shadow_color.alpha = font.color.alpha * 160 / 255
  58.     end
  59.     text = text.to_s unless text.is_a?(String)
  60.     color_temp = font.color.clone
  61.     if shadow_direction != 0
  62.       font.color = shadow_color
  63.       if shadow_direction == 5
  64.         buffer_rect = Rect.new(0, 0, width, height)
  65.         clear_buffer
  66.         buffer.font = font.clone
  67.         buffer.font.color = shadow_color
  68.         buffer.sailcat_sepcore_draw_text(buffer_rect, text, align)
  69.         blt(x - 1,y - 1, buffer, buffer_rect)
  70.         blt(x - 1,y + 1, buffer, buffer_rect)
  71.         blt(x + 1,y - 1, buffer, buffer_rect)
  72.         blt(x + 1,y + 1, buffer, buffer_rect)
  73.       else
  74.         a = shadow_direction % 6 == 1 ? -1 : 1
  75.         b = shadow_direction / 6 == 1 ? -1 : 1
  76.         sailcat_sepcore_draw_text(x + a, y + b, width, height, text, align)
  77.       end
  78.       font.color = color_temp
  79.     end
  80.     sailcat_sepcore_draw_text(x, y, width, height, text, align)
  81.   end
  82. end

点评

甚至原作者都出来了。  发表于 2018-1-10 10:40

评分

参与人数 1星屑 +20 收起 理由
RyanBern + 20 塞糖

查看全部评分

SailCat (小猫子·要开心一点) 共上站 24 次,发表过 11 篇文章 上 次 在: [2006年01月28日11:41:18 星期六] 从 [162.105.120.91] 到本站一游。
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-21 14:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表