赞 | 1 |
VIP | 95 |
好人卡 | 8 |
积分 | 1 |
经验 | 23267 |
最后登录 | 2020-10-15 |
在线时间 | 433 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 65
- 在线时间
- 433 小时
- 注册时间
- 2007-5-1
- 帖子
- 993
|
苍天啊!大地啊!原本以为是5分钟就能了结的事情,没想到判定选项有效度的部分硬是拖了我一小时= =
效果只适用于Window_Command类(没图标的那些选择窗口),话说我写完看到效果才发现MS以前看到某个日站已经有这样的脚本= =
有效选项
无效选项
- #==============================================================================
- # ■ Window_Command 捣鼓 by 水镜风生 (描边字部分出自沉影不器)
- #------------------------------------------------------------------------------
- # 一般的命令选择行窗口。
- #==============================================================================
- FONT_COLOR_ID = 1 # 描边颜色ID,请参考[显示文章]中\C[n]的颜色
- class Window_Command < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对象 追加定义
- #--------------------------------------------------------------------------
- alias Mro_initialize initialize
- def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
- @enabled_list = []
- Mro_initialize(width, commands, column_max, row_max, spacing)
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目 追加定义
- #--------------------------------------------------------------------------
- alias Mro_draw_item draw_item
- def draw_item(index, enabled = true)
- @enabled_list[index] = enabled
- Mro_draw_item(index, @enabled_list[index])
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- if @last_index != self.index
- @last_index = self.index
- for i in 0...@item_max
- rect = item_rect(i)
- self.contents.clear_rect(rect)
- next if i == @old_index
- draw_item(i, @enabled_list[i])
- end
- rect = item_rect(self.index)
- self.contents.clear_rect(rect)
- color = text_color(FONT_COLOR_ID)
- draw_stroke_text(rect, @commands[@index], @enabled_list[@index], 0, color)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 描边字
- #--------------------------------------------------------------------------
- def draw_stroke_text(rect, str, enabled = true, align = 0, color = nil)
- x = rect.x
- y = rect.y
- width = rect.width
- height = rect.height
- # 准备字体
- font_backup = self.contents.font.clone
- if color
- self.contents.font.color.red = color.red
- self.contents.font.color.green = color.green
- self.contents.font.color.blue = color.blue
- end
-
- # 关闭默认阴影
- self.contents.font.shadow = false
- # 描绘边缘
-
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x-1, y-1, width, height, str, align)
- self.contents.draw_text(x-1, y+1, width, height, str, align)
- self.contents.draw_text(x+1, y-1, width, height, str, align)
- self.contents.draw_text(x+1, y+1, width, height, str, align)
- self.contents.draw_text(x, y-1, width, height, str, align)
- self.contents.draw_text(x, y+1, width, height, str, align)
- self.contents.draw_text(x-1, y, width, height, str, align)
- self.contents.draw_text(x+1, y, width, height, str, align)
- # 描绘主文字
-
- self.contents.font.color = font_backup.color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x, y, width, height, str, align)
- # 还原默认字体
- self.contents.font = font_backup
- end
- end
复制代码 |
|