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

Project1

 找回密码
 注册会员
搜索
楼主: 冰舞蝶恋
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2010-10-18
帖子
104
31
发表于 2010-11-3 12:46:03 | 只看该作者
本帖最后由 迷路子 于 2010-11-3 12:49 编辑

我战斗测试是正常呢    应该是和其他脚本冲突了
写时没考虑冲突…(汗)
猜测是有用了其他的脚本有动到draw_item等等函数
另战斗时物品使用的人物选择我没做描边(真忘了……)
文章选项窗口不能描边是指?

这是只套用我的脚本的画面



回复

使用道具 举报

Lv2.观梦者

花开堪折直须折

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

贵宾

32
 楼主| 发表于 2010-11-3 12:52:59 | 只看该作者
回复 迷路子 的帖子

我是说,当没有物品的时候打开物品就会出错;没有技能的话,打开技能就出错;没有装备也是。。呃,谢谢

点评

汗 我忘了处理无选项可选了~ 处理中  发表于 2010-11-3 13:02
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

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

使用道具 举报

Lv1.梦旅人

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

改了下    看这样行不?
  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 @index >= 0 && @index < @item_max-1
  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.   
  193.   def update
  194.     super
  195.     @item_max = @data.size
  196.     create_contents
  197.     for i in 0...@item_max
  198.       rect = item_rect(i)
  199.       self.contents.clear_rect(rect)
  200.       next if i == @old_index
  201.       draw_item_name(@data[i],92,WLH*i)
  202.     end
  203.     rect = item_rect(self.index)
  204.     rect.x += 115
  205.     self.contents.clear_rect(rect)
  206.     color = text_color(FONT_COLOR_ID)
  207.     draw_stroke_text(rect, @data[@index].name, true, 0, color)
  208.     self.contents.font.color = system_color
  209.     if @actor.two_swords_style
  210.       self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
  211.       self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
  212.     else
  213.       self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
  214.       self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
  215.     end
  216.     self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
  217.     self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
  218.     self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
  219.   end
  220. end


  221. class Window_Skill < Window_Selectable  
  222.   alias Mro_initialize3 initialize
  223.   def initialize(x, y, width, height, actor)
  224.     @enabled_list = []
  225.     Mro_initialize3(x, y, width, height,actor)
  226.   end
  227.   
  228.   #--------------------------------------------------------------------------
  229.   # ● 描绘项目
  230.   #     index : 项目编号
  231.   #--------------------------------------------------------------------------
  232.   def draw_item(index)
  233.     rect = item_rect(index)
  234.     self.contents.clear_rect(rect)
  235.     skill = @data[index]
  236.     if skill != nil
  237.       rect.width -= 4
  238.       enabled = @actor.skill_can_use?(skill)
  239.       draw_item_name(skill, rect.x, rect.y, enabled)
  240.       self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
  241.     end
  242.     @enabled_list[index] = enabled
  243.   end
  244.   
  245.   def update
  246.     super
  247.     @item_max = @data.size
  248.     create_contents
  249.     for i in 0...@item_max
  250.       rect = item_rect(i)
  251.       self.contents.clear_rect(rect)
  252.       next if i == @old_index
  253.       draw_item(i)
  254.     end
  255.     rect = item_rect(self.index)
  256.     rect.width -= 60
  257.     rect.x += 24
  258.     self.contents.clear_rect(rect)
  259.     color = text_color(FONT_COLOR_ID)
  260.     if @index>=0 && @index<@item_max-1
  261.       draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
  262.     else
  263.       draw_stroke_text(rect, "无", false, 0, color)
  264.     end
  265.   end
  266. end
复制代码
回复

使用道具 举报

Lv2.观梦者

花开堪折直须折

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

贵宾

34
 楼主| 发表于 2010-11-3 13:05:09 | 只看该作者
本帖最后由 冰舞蝶恋 于 2010-11-3 13:08 编辑

回复 迷路子 的帖子

感谢,继续提出BUG:装备栏空的时候移动光标还会出错喵!另外,商店界面的文字和文章选项窗口的文字喵!~~迷路大大的脚本真是太有爱了~~>_<

点评

商店的要稍等了 文章选项是指对话时的选项?  发表于 2010-11-3 13:17
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

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

使用道具 举报

Lv1.梦旅人

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

修正完成
再试下吧~
  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 @index >= 0 && @index < @item_max-1
  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 @index>=0 && @index<@item_max-1
  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
复制代码

点评

有事先出门 晚点继续更新~  发表于 2010-11-3 13:18
回复

使用道具 举报

Lv2.观梦者

花开堪折直须折

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

贵宾

36
 楼主| 发表于 2010-11-3 13:21:13 | 只看该作者
回复 迷路子 的帖子

嗯,是的,感谢~~
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

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

使用道具 举报

Lv1.梦旅人

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

商店选择和对话框选项描边完成
没考虑冲突问题
如果用其他脚本可能会有冲突
座标等等可能也要修改才行
  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 @index >= 0 && @index < @item_max-1
  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 @index>=0 && @index<@item_max-1
  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

  323. class Window_Message < Window_Selectable
  324.   def update
  325.     super
  326.     update_gold_window
  327.     update_number_input_window
  328.     update_back_sprite
  329.     update_show_fast
  330.     unless @opening or @closing             # 窗口非正在打开或正在关闭中
  331.       if @wait_count > 0                    # 文间等待
  332.         @wait_count -= 1
  333.       elsif self.pause                      # 等待输入的情况下
  334.         input_pause
  335.       elsif self.active                     # 输入选择的情况下
  336.         input_choice
  337.       elsif @number_input_window.visible    # 输入数值的情况下
  338.         input_number
  339.       elsif @text != nil                    # 有等待显示的文字的情况下
  340.         update_message                        # 更新文章
  341.       elsif continue?                       # 继续的情况下
  342.         start_message                         # 开始文章
  343.         open                                  # 打开窗口
  344.         $game_message.visible = true
  345.       else                                  # 否则
  346.         close                                 # 关闭窗口
  347.         $game_message.visible = @closing
  348.       end
  349.     end
  350.     if $game_message.choice_proc != nil
  351.       @item_max = $game_message.texts.size
  352.       create_contents
  353.       for i in 0...@item_max
  354.         rect = item_rect(i)
  355.         self.contents.clear_rect(rect)
  356.         next if i == @old_index
  357.         self.contents.draw_text(rect.x+24,rect.y,contents.width,WLH,$game_message.texts[i])
  358.       end
  359.       rect = item_rect(self.index)
  360.       rect.x += 24
  361.       self.contents.clear_rect(rect)
  362.       color = text_color(FONT_COLOR_ID)
  363.       draw_stroke_text(rect, $game_message.texts[@index] , true, 0, color)
  364.     end
  365.   end
  366. end
复制代码
回复

使用道具 举报

Lv2.观梦者

花开堪折直须折

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

贵宾

38
 楼主| 发表于 2010-11-3 20:47:02 | 只看该作者
本帖最后由 冰舞蝶恋 于 2010-11-3 21:16 编辑

回复 迷路子 的帖子

谢谢,不过
而且,当光标选到最后一个技能/物品的时候:

而且显示文章会不断的重复,无法进入下一个内容。
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

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

使用道具 举报

Lv2.观梦者

花开堪折直须折

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

贵宾

39
 楼主| 发表于 2010-11-4 12:35:33 | 只看该作者
哇哇哇哇,自顶一次
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

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

使用道具 举报

Lv1.梦旅人

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

对话选项的光标问题我修正好了
不过不太懂文章会一直重覆的意思
  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

  323. class Window_Message < Window_Selectable
  324.   
  325.   def update_cursor
  326.     if @index >= 0
  327.       x = $game_message.face_name.empty? ? 0 : 112
  328.       y = ($game_message.choice_start + @index) * WLH
  329.       self.cursor_rect.set(x, y, contents.width - x, WLH)
  330.       self.cursor_rect.empty
  331.     else
  332.       self.cursor_rect.empty
  333.     end
  334.   end
  335.   
  336.   def update
  337.     super
  338.     update_gold_window
  339.     update_number_input_window
  340.     update_back_sprite
  341.     update_show_fast
  342.     unless @opening or @closing             # 窗口非正在打开或正在关闭中
  343.       if @wait_count > 0                    # 文间等待
  344.         @wait_count -= 1
  345.       elsif self.pause                      # 等待输入的情况下
  346.         input_pause
  347.       elsif self.active                     # 输入选择的情况下
  348.         input_choice
  349.       elsif @number_input_window.visible    # 输入数值的情况下
  350.         input_number
  351.       elsif @text != nil                    # 有等待显示的文字的情况下
  352.         update_message                        # 更新文章
  353.       elsif continue?                       # 继续的情况下
  354.         start_message                         # 开始文章
  355.         open                                  # 打开窗口
  356.         $game_message.visible = true
  357.       else                                  # 否则
  358.         close                                 # 关闭窗口
  359.         $game_message.visible = @closing
  360.       end
  361.     end
  362.     if $game_message.choice_proc != nil
  363.       @item_max1 = $game_message.texts.size
  364.       @item_max2 = $game_message.choice_max
  365.       create_contents
  366.       for i in 0...@item_max1
  367.         rect = item_rect(i)
  368.         self.contents.clear_rect(rect)
  369.         next if i == @old_index
  370.         self.contents.draw_text(rect.x+24,rect.y,contents.width,WLH,$game_message.texts[i])
  371.       end
  372.       if @item_max1 != @item_max2
  373.         @item_max = @item_max1-@item_max2
  374.       else
  375.         @item_max = @item_max2
  376.       end
  377.       if @item_max1 != @item_max2
  378.         @index_temp = self.index + @item_max
  379.         if self.index >= 0
  380.           rect = item_rect(@index_temp)
  381.           rect.x += 24
  382.           self.contents.clear_rect(rect)
  383.           color = text_color(FONT_COLOR_ID)
  384.           draw_stroke_text(rect, $game_message.texts[@index_temp] , true, 0, color)
  385.         end
  386.       elsif @item_max1 == @item_max2
  387.         rect = item_rect(self.index)
  388.         rect.x += 24
  389.         self.contents.clear_rect(rect)
  390.         color = text_color(FONT_COLOR_ID)
  391.         draw_stroke_text(rect, $game_message.texts[@index] , true, 0, color)
  392.       end
  393.     end
  394.   end
  395. end
复制代码
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 12:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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