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

Project1

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

[已经解决] 关于选项指令窗口描边、去框、文字色

[复制链接]

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
631
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

跳转到指定楼层
1
发表于 2010-11-2 20:07:38 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
1星屑
http://rpg.blue/forum.php?mod=vi ... 6&fromuid=85979
这是原帖,非常感谢水镜!不过希望的是,游戏中所有界面的选项窗口(包括文章啥的)都去框并描边,最好能更改选中文字色或字号啥的……谢谢,知道对于各位大大来讲,1个V实在不算什么,就当作一点小小心意献给各位大大吧!谢谢了。

最佳答案

查看完整内容

回复 冰舞蝶恋 的帖子 去掉对话框的部份了 应该其他部份没啥问题了~
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2010-10-18
帖子
104
2
发表于 2010-11-2 20:07:39 | 只看该作者
回复 冰舞蝶恋 的帖子

去掉对话框的部份了
应该其他部份没啥问题了~
  1. #==============================================================================
  2. # ■ Window_Selectable
  3. #------------------------------------------------------------------------------
  4. #  拥有光标的移动以及滚动功能的窗口类。
  5. #==============================================================================

  6. class Window_Selectable < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 更新光标
  9.   #--------------------------------------------------------------------------
  10.   def update_cursor
  11.     self.cursor_rect.empty  
  12.     if @index < 0                   # 当光标位置小于0
  13.       self.cursor_rect.empty        # 隐藏光标
  14.     else                            # 当光标位置为0或大于
  15.       row = @index / @column_max    # 获取当前行
  16.       if row < top_row              # 若先于首行
  17.         self.top_row = row          # 向上滚动
  18.       end
  19.       if row > bottom_row           # 若後于末行
  20.         self.bottom_row = row       # 向下滚动
  21.       end
  22.       rect = item_rect(@index)      # 获取所选项目矩形
  23.       rect.y -= self.oy             # 设矩形为滚动位置
  24.       self.cursor_rect = rect       # 更新光标矩形
  25.       self.cursor_rect.empty
  26.     end
  27.   end
  28.   
  29. end


  30. class Window_Base < Window
  31.   
  32.   #--------------------------------------------------------------------------
  33.   # ○ 描边字
  34.   #--------------------------------------------------------------------------
  35.   def draw_stroke_text(rect, str, enabled = true, align = 0, color = nil)
  36.     x = rect.x
  37.     y = rect.y
  38.     width = rect.width
  39.     height = rect.height

  40.     # 准备字体
  41.     font_backup = self.contents.font.clone
  42.     if color
  43.       self.contents.font.color.red   = color.red
  44.       self.contents.font.color.green = color.green
  45.       self.contents.font.color.blue  = color.blue
  46.     end

  47.     # 关闭默认阴影
  48.     self.contents.font.shadow = false

  49.     # 描绘边缘
  50.     self.contents.font.color.alpha = enabled ? 255 : 128
  51.     self.contents.draw_text(x-1, y-1, width, height, str, align)
  52.     self.contents.draw_text(x-1, y+1, width, height, str, align)
  53.     self.contents.draw_text(x+1, y-1, width, height, str, align)
  54.     self.contents.draw_text(x+1, y+1, width, height, str, align)
  55.     self.contents.draw_text(x, y-1, width, height, str, align)
  56.     self.contents.draw_text(x, y+1, width, height, str, align)
  57.     self.contents.draw_text(x-1, y, width, height, str, align)
  58.     self.contents.draw_text(x+1, y, width, height, str, align)

  59.     # 描绘主文字
  60.     self.contents.font.color = font_backup.color
  61.     self.contents.font.color.alpha = enabled ? 255 : 128
  62.     self.contents.draw_text(x, y, width, height, str, align)
  63.    
  64.     # 还原默认字体
  65.     self.contents.font = font_backup

  66.   end
  67. end

  68. #==============================================================================
  69. # ■ Window_Command   捣鼓 by 水镜风生 (描边字部分出自沉影不器)
  70. #------------------------------------------------------------------------------
  71. #  一般的命令选择行窗口。
  72. #==============================================================================
  73. FONT_COLOR_ID = 1   # 描边颜色ID,请参考[显示文章]中\C[n]的颜色

  74. class Window_Command < Window_Selectable
  75.   #--------------------------------------------------------------------------
  76.   # ● 初始化对象 追加定义
  77.   #--------------------------------------------------------------------------
  78.   alias Mro_initialize initialize  
  79.   def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
  80.     @enabled_list = []
  81.     Mro_initialize(width, commands, column_max, row_max, spacing)
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 描绘项目  追加定义
  85.   #--------------------------------------------------------------------------
  86.   alias Mro_draw_item draw_item
  87.   def draw_item(index, enabled = true)
  88.     @enabled_list[index] = enabled
  89.     Mro_draw_item(index, @enabled_list[index])
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 更新
  93.   #--------------------------------------------------------------------------
  94.   def update
  95.     super
  96.     if @last_index != self.index
  97.       @last_index = self.index
  98.       for i in 0...@item_max
  99.         rect = item_rect(i)
  100.         self.contents.clear_rect(rect)
  101.         next if i == @old_index
  102.         draw_item(i, @enabled_list[i])
  103.       end
  104.        rect = item_rect(self.index)
  105.        self.contents.clear_rect(rect)
  106.       color = text_color(FONT_COLOR_ID)
  107.       draw_stroke_text(rect, @commands[@index], @enabled_list[@index], 0, color)
  108.     end
  109.   end
  110. end

  111. #==============================================================================
  112. # ■ Window_Item
  113. #------------------------------------------------------------------------------
  114. #  物品画面、战斗画面、显示浏览物品的窗口。
  115. #==============================================================================

  116. class Window_Item < Window_Selectable
  117.   alias Mro_initialize0 initialize
  118.   def initialize(x, y, width, height)
  119.     @enabled_list = []
  120.     Mro_initialize0(x, y, width, height)
  121.   end
  122.   
  123.   #--------------------------------------------------------------------------
  124.   # ● 刷新
  125.   #--------------------------------------------------------------------------  
  126.   def refresh
  127.     @data = []
  128.     for item in $game_party.items
  129.       next unless include?(item)
  130.       @data.push(item)
  131.       if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
  132.         self.index = @data.size - 1
  133.       end
  134.     end
  135.     @data.push(nil) if include?(nil)
  136.     @item_max = @data.size
  137.     create_contents
  138.     for i in 0...@item_max
  139.       draw_item(i)
  140.     end
  141.   end
  142.   
  143.   def update
  144.     super
  145.     @item_max = @data.size
  146.     create_contents
  147.     for i in 0...@item_max
  148.       rect = item_rect(i)
  149.       self.contents.clear_rect(rect)
  150.       next if i == @old_index
  151.       draw_item(i)
  152.     end
  153.     rect = item_rect(self.index)
  154.     rect.width -= 60
  155.     rect.x += 24
  156.     self.contents.clear_rect(rect)
  157.     color = text_color(FONT_COLOR_ID)
  158.     if @data[@index] != nil
  159.       draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
  160.     else
  161.       draw_stroke_text(rect, "无", true, 0, color)
  162.     end
  163.   end
  164.   
  165.   #--------------------------------------------------------------------------
  166.   # ● 描绘项目
  167.   #     index : 项目编号
  168.   #--------------------------------------------------------------------------
  169.   def draw_item(index)
  170.     rect = item_rect(index)
  171.     self.contents.clear_rect(rect)
  172.     item = @data[index]
  173.     if item != nil
  174.       number = $game_party.item_number(item)
  175.       enabled = enable?(item)
  176.       rect.width -= 4
  177.       draw_item_name(item, rect.x, rect.y, enabled)
  178.       self.contents.draw_text(rect, sprintf(":%2d", number), 2)
  179.     else
  180.       rect.x += 24
  181.       self.contents.draw_text(rect,"无")
  182.     end
  183.     @enabled_list[index] = enabled
  184.   end
  185. end

  186. class Window_Equip < Window_Selectable
  187.   alias Mro_initialize4 initialize
  188.   def initialize(x, y, actor)
  189.     Mro_initialize4(x, y, actor)
  190.   end
  191.   
  192.   def update
  193.     super
  194.     @item_max = @data.size
  195.     create_contents
  196.     for i in 0...@item_max
  197.       rect = item_rect(i)
  198.       self.contents.clear_rect(rect)
  199.       next if i == @old_index
  200.       draw_item_name(@data[i],92,WLH*i)
  201.     end
  202.     rect = item_rect(self.index)
  203.     rect.x += 115
  204.     self.contents.clear_rect(rect)
  205.     color = text_color(FONT_COLOR_ID)
  206.     if @data[@index] != nil
  207.       draw_stroke_text(rect, @data[@index].name, true, 0, color)
  208.     else
  209.       draw_stroke_text(rect, "无", true, 0, color)
  210.     end
  211.     self.contents.font.color = system_color
  212.     if @actor.two_swords_style
  213.       self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
  214.       self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
  215.     else
  216.       self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
  217.       self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
  218.     end
  219.     self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
  220.     self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
  221.     self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
  222.     self.contents.font.color = Color.new(255,255,255)
  223.     if @data[0] == nil
  224.       self.contents.draw_text(116, 0,92,WLH,"无")
  225.     end
  226.     if @data[1] == nil
  227.       self.contents.draw_text(116, WLH,92,WLH,"无")
  228.     end
  229.     if @data[2] == nil
  230.       self.contents.draw_text(116, WLH*2,92,WLH,"无")
  231.     end
  232.     if @data[3] == nil
  233.       self.contents.draw_text(116, WLH*3,92,WLH,"无")
  234.     end
  235.     if @data[4] == nil
  236.       self.contents.draw_text(116, WLH*4,92,WLH,"无")
  237.     end
  238.   end
  239. end


  240. class Window_Skill < Window_Selectable  
  241.   alias Mro_initialize3 initialize
  242.   def initialize(x, y, width, height, actor)
  243.     @enabled_list = []
  244.     Mro_initialize3(x, y, width, height,actor)
  245.   end
  246.   
  247.   #--------------------------------------------------------------------------
  248.   # ● 描绘项目
  249.   #     index : 项目编号
  250.   #--------------------------------------------------------------------------
  251.   def draw_item(index)
  252.     rect = item_rect(index)
  253.     self.contents.clear_rect(rect)
  254.     skill = @data[index]
  255.     if skill != nil
  256.       rect.width -= 4
  257.       enabled = @actor.skill_can_use?(skill)
  258.       draw_item_name(skill, rect.x, rect.y, enabled)
  259.       self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
  260.     end
  261.     @enabled_list[index] = enabled
  262.   end
  263.   
  264.   def update
  265.     super
  266.     @item_max = @data.size
  267.     create_contents
  268.     for i in 0...@item_max
  269.       rect = item_rect(i)
  270.       self.contents.clear_rect(rect)
  271.       next if i == @old_index
  272.       draw_item(i)
  273.     end
  274.     rect = item_rect(self.index)
  275.     rect.width -= 60
  276.     rect.x += 24
  277.     self.contents.clear_rect(rect)
  278.     color = text_color(FONT_COLOR_ID)
  279.     if @data[@index] != nil
  280.       draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
  281.     else
  282.       draw_stroke_text(rect, "无", false, 0, color)
  283.     end
  284.   end
  285. end

  286. class Window_ShopBuy < Window_Selectable
  287.   alias Mro_initialize5 initialize
  288.   def initialize(x, y)
  289.     @enabled_list = []
  290.     Mro_initialize5(x,y)
  291.   end
  292.   
  293.   def draw_item(index)
  294.     item = @data[index]
  295.     number = $game_party.item_number(item)
  296.     enabled = (item.price <= $game_party.gold and number < 99)
  297.     rect = item_rect(index)
  298.     self.contents.clear_rect(rect)
  299.     draw_item_name(item, rect.x, rect.y, enabled)
  300.     rect.width -= 4
  301.     self.contents.draw_text(rect, item.price, 2)
  302.     @enabled_list[index] = enabled
  303.   end
  304.   
  305.   def update
  306.     super
  307.     @item_max = @data.size
  308.     create_contents
  309.     for i in 0...@item_max
  310.       rect = item_rect(i)
  311.       self.contents.clear_rect(rect)
  312.       next if i == @old_index
  313.       draw_item(i)
  314.     end
  315.     rect = item_rect(self.index)
  316.     rect.width -= 60
  317.     rect.x += 24
  318.     self.contents.clear_rect(rect)
  319.     color = text_color(FONT_COLOR_ID)
  320.     draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
  321.   end
  322. end
复制代码
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
518 小时
注册时间
2010-6-16
帖子
1073
3
发表于 2010-11-2 20:13:15 | 只看该作者
本帖最后由 Rion幻音 于 2010-11-2 20:15 编辑

是指无视掉窗口素材吗?直接把窗口的素材给弄透明吧~
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
518 小时
注册时间
2010-6-16
帖子
1073
4
发表于 2010-11-2 20:16:30 | 只看该作者
是指无视掉窗口选项框吗?直接把它的素材给弄透明吧~

点评

糟糕连贴了~斑竹手下流情啊~  发表于 2010-11-2 20:18
回复

使用道具 举报

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
631
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

5
 楼主| 发表于 2010-11-2 20:17:02 | 只看该作者
回复 Rion幻音 的帖子

可是水镜的描边选项只限于系统的喵!
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2010-10-18
帖子
104
6
发表于 2010-11-2 20:19:23 | 只看该作者
本帖最后由 迷路子 于 2010-11-2 20:19 编辑

应该是指去掉选择时的透明框
然後直接用文字描边方式绘制目前选项吧
把描绘外框的函数替换掉不知能行不

或是直接用图片做选项应该也能行
回复

使用道具 举报

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
631
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

7
 楼主| 发表于 2010-11-2 20:21:14 | 只看该作者
回复 迷路子 的帖子

我想描边嘛!
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
518 小时
注册时间
2010-6-16
帖子
1073
8
发表于 2010-11-2 20:21:15 | 只看该作者
回复 冰舞蝶恋 的帖子

那就把def update_cursor下所有的东西都写成
self.cursor_rect.empty
吧!(PIA飞~)
回复

使用道具 举报

头像被屏蔽

Lv3.寻梦者 (禁止发言)

无能君

梦石
0
星屑
3380
在线时间
30 小时
注册时间
2010-9-18
帖子
354
9
发表于 2010-11-2 20:26:43 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

头像被屏蔽

Lv3.寻梦者 (禁止发言)

无能君

梦石
0
星屑
3380
在线时间
30 小时
注册时间
2010-9-18
帖子
354
10
发表于 2010-11-2 20:28:24 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-24 16:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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