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

Project1

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

[已经解决] 希望大佬帮我看看,这个选项脚本的字体颜色设定

[复制链接]

Lv2.观梦者

梦石
0
星屑
646
在线时间
63 小时
注册时间
2019-1-26
帖子
12
跳转到指定楼层
1
发表于 2020-4-16 22:48:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我找了好一会都没找到,是不是没有字体颜色设定......

RUBY 代码复制
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Visual Novel Choices
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.9
  6. #------------------------------------------------------------------------------#
  7. #  2013-01-16 - Version 1.9 - Added Y offset for choice window
  8. #  2012-11-28 - Version 1.8 - Z level setting added
  9. #  2012-11-28 - Version 1.7 - Added compatability for some cursor scripts
  10. #  2012-11-28 - Version 1.6 - Fixed a bug that could crash the game.
  11. #  2012-11-28 - Version 1.5 - Added offset to change postion of cursor x and y
  12. #  2012-11-28 - Version 1.4 - Fixed z levels and made cursor use an image
  13. #  2012-11-27 - Version 1.3 - Fixed a bug with cancel choice selection
  14. #  2012-11-27 - Version 1.2 - added a switch to disable script effects
  15. #  2012-11-27 - Version 1.1 - added ability to use different image per choice
  16. #                           - added a couple more options
  17. #  2012-11-27 - Version 1.0 - release
  18. #------------------------------------------------------------------------------#
  19. #  This script overwrites the default "Show Choices" list. The choices are
  20. #  changed so they display centered on the screen with a graphic behind each
  21. #  of them. Made with visual novel choice selection in mind.
  22. #------------------------------------------------------------------------------#
  23. #  INSTRUCTIONS:
  24. #  Copy the graphic from the demo /Graphics/System into your project.
  25. #  Copy the script into your script list, below Materials and above Main
  26. #
  27. #  Some setup options below, most only need to be changed if you use your own
  28. #  custom choice image.
  29. #------------------------------------------------------------------------------#
  30. #  Codes:
  31. #------------------------------------------------------------------------------#
  32. #  Most of the usual codes that work in messages should work in choices.
  33. #  (eg. \V[x], \N[x], \C[x], etc. Look at message tooltip to know more.)
  34. #
  35. #  A new one has been added so you can change the background image for separate
  36. #  choice options.
  37. #
  38. #  \B[x]
  39. #
  40. #  This works by adding the number x (as you put in the code above) to the end
  41. #  of the CHOICE IMAGE file name. For example, the default choice image is:
  42. #  "Choice.png" located in /Graphics/System/. If you put the code anywhere in
  43. #  a choice box:  \B[3]  it will look for "Choice3.png" image in the same
  44. #  location.
  45. #
  46. #------------------------------------------------------------------------------#
  47.  
  48. ($imported ||= {})["Galvs_Image_Choices"] = true
  49. module Galv_Choice
  50.  
  51. #------------------------------------------------------------------------------#
  52. #  SCRIPT SETUP OPTIONS
  53. #------------------------------------------------------------------------------#
  54.  
  55.   CURSOR_IMAGE = "Cursor"  # Images used to determine which option you select
  56.   CURSOR_OPACITY = 255      # Opacity of the cursor
  57.   CURSOR_Y_OFFSET = 0       # Nudge cursor position vertically
  58.   CURSOR_X_OFFSET = 0       # Nudge cursor position horizontally
  59.  
  60.   CHOICE_IMAGE = "Choice"   # Image for each choice located in /Graphics/System
  61.   IMAGE_Y_OFFSET = 3        # Nudge your choice image vertically if needed
  62.   IMAGE_OPACITY = 215       # The opacity of the image
  63.  
  64.   CHOICE_HEIGHT = 45        # How tall each choice.
  65.   CHOICE_ITEM_Y = 2         # Offset for choice item text
  66.  
  67.   CENTER_TEXT = true        # left aligned if false, centered if true
  68.  
  69.   DISABLE_SWITCH = 1        # Turn this switch ON to disable this script
  70.  
  71.   CHOICES_Y = 0             # Y offset to move choice window up or down.
  72.                             # useful if you use a script that creates a namebox
  73.   CHOICES_Z = 50            # The z value of the choices window. Try changing it
  74.                             # if pictures or other scripts appear over or under
  75.                             # the choices window to how you like.
  76.  
  77. #------------------------------------------------------------------------------#
  78.   OTHER_Y_OFFSET = 12       # May fix other cursor scripts positioning
  79. #------------------------------------------------------------------------------#
  80. #  SCRIPT SETUP OPTIONS
  81. #------------------------------------------------------------------------------#
  82.  
  83. end
  84.  
  85. class Window_ChoiceList < Window_Command
  86.  
  87.   alias galv_choice_initialize initialize
  88.   def initialize(message_window)
  89.     galv_choice_initialize(message_window)
  90.     self.z = Galv_Choice::CHOICES_Z
  91.   end
  92.  
  93.   def start
  94.     @index = 0
  95.     setup_choices
  96.     make_cursor
  97.     refresh
  98.     open
  99.     activate
  100.     update_placement
  101.     update_bgs
  102.     refresh
  103.     select(0)
  104.   end
  105.  
  106.   def make_cursor
  107.     return if $game_switches[Galv_Choice::DISABLE_SWITCH]
  108.     @cursor_sprite = Sprite.new
  109.     @cursor_sprite.bitmap = Cache.system(Galv_Choice::CURSOR_IMAGE)
  110.   end
  111.  
  112.   def setup_choices
  113.     @choice_sprite = []
  114.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  115.       self.opacity = 0
  116.       get_widths
  117.     else
  118.       self.opacity = 255
  119.     end
  120.   end
  121.  
  122.   alias galv_choice_update_placement update_placement
  123.   def update_placement
  124.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  125.       galv_choice_update_placement
  126.     else
  127.       self.width = [max_choice_width + 12, 96].max + padding * 4
  128.       self.width = [width, Graphics.width].min
  129.       self.height = contents_height + Galv_Choice::CHOICE_HEIGHT - 10
  130.       self.x = (Graphics.width - width) / 2
  131.  
  132.       if @message_window.openness < 100
  133.         self.y = Graphics.height - contents_height + item_height / 2
  134.       elsif @message_window.y >= Graphics.height / 2
  135.         self.y = @message_window.y - contents_height + item_height / 2 - Galv_Choice::CHOICES_Y
  136.       else
  137.         self.y = @message_window.y + @message_window.height + item_height / 2 + Galv_Choice::CHOICES_Y
  138.       end
  139.     end
  140.   end
  141.  
  142.   alias galv_choice_contents_height contents_height
  143.   def contents_height
  144.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  145.       galv_choice_contents_height
  146.     else
  147.       (item_max + 1) * item_height
  148.     end
  149.   end
  150.  
  151.   def draw_item(index)
  152.     rect = item_rect_for_text(index)
  153.     draw_text_ex(rect.x, rect.y, command_name(index))
  154.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  155.       draw_bgs(index)
  156.     end
  157.   end
  158.  
  159.   def item_rect_for_text(index)
  160.     rect = item_rect(index)
  161.  
  162.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  163.       rect.x += 4
  164.       rect.width -= 8
  165.       rect
  166.     else
  167.       if Galv_Choice::CENTER_TEXT
  168.         rect.x = (max_choice_width - @text_sizes.collect {|s| text_size(s).width }[index] + (padding * 3)) / 2
  169.       else
  170.         rect.x += 4
  171.       end
  172.       rect.width -= 8
  173.       rect.y += Galv_Choice::CHOICE_ITEM_Y
  174.       rect
  175.     end
  176.   end
  177.  
  178.   def get_widths
  179.     @text_sizes = []
  180.     @choice_background = []
  181.     $game_message.choices.each_with_index do |c,i|
  182.       @text_sizes[i] = esc_characters(c,i)
  183.     end
  184.   end
  185.  
  186.   def esc_characters(text,index)
  187.     result = text.to_s.clone
  188.     result.gsub!(/\\/)            { "\e" }
  189.     result.gsub!(/\e\e/)          { "\\" }
  190.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  191.     result.gsub!(/\eN\[(\d+)\]/i) { $game_actors[$1.to_i].name}
  192.     result.gsub!(/\eP\[(\d+)\]/i) {
  193.       if $game_party.members[$1.to_i].nil?
  194.         ""
  195.       else
  196.         $game_party.members[$1.to_i].name
  197.       end
  198.     }
  199.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  200.     result.gsub!(/\eC\[(\d+)\]/i)  { "" }
  201.     result.gsub!(/\eI\[(\d+)\]/i)  { "   " }
  202.     result.gsub!(/\eB\[(\d+)\]/i)  { @choice_background[index] = $1.to_i }
  203.     result.gsub!(/\eB\[(\d+)\]/i)  { "" }
  204.     result
  205.   end
  206.  
  207.   def convert_escape_characters(text)
  208.     result = text.to_s.clone
  209.     result.gsub!(/\\/)            { "\e" }
  210.     result.gsub!(/\e\e/)          { "\\" }
  211.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  212.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  213.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  214.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  215.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  216.     result.gsub!(/\eB\[(\d+)\]/i)  { "" }
  217.     result
  218.   end
  219.  
  220.   def item_height
  221.     return line_height if $game_switches[Galv_Choice::DISABLE_SWITCH]
  222.     return Galv_Choice::CHOICE_HEIGHT
  223.   end
  224.  
  225.   def item_rect(index)
  226.     rect = Rect.new
  227.     rect.width = item_width
  228.     rect.height = item_height - 15
  229.     rect.height += 15 if $game_switches[Galv_Choice::DISABLE_SWITCH]
  230.     rect.x = index % col_max * (item_width + spacing)
  231.     rect.y = index / col_max * item_height
  232.     rect
  233.   end
  234.  
  235.   def draw_bgs(index)
  236.     return if @choice_sprite[index] != nil
  237.  
  238.     if @choice_background[index].nil?
  239.       b = ""
  240.     else
  241.       b = @choice_background[index]
  242.     end
  243.     @choice_sprite[index] = Sprite.new
  244.     @choice_sprite[index].bitmap = Cache.system(Galv_Choice::CHOICE_IMAGE + b.to_s)
  245.     @choice_sprite[index].x = index % col_max * (item_width + spacing)
  246.     @choice_sprite[index].y = index / col_max * item_height
  247.     @choice_sprite[index].z = self.z - 2
  248.   end
  249.  
  250.   def update_bgs
  251.     @choice_sprite.each_with_index do |s,i|
  252.       s.y = self.y + i * Galv_Choice::CHOICE_HEIGHT + Galv_Choice::IMAGE_Y_OFFSET
  253.       s.x = (Graphics.width - s.width) / 2
  254.       s.opacity = Galv_Choice::IMAGE_OPACITY
  255.     end
  256.   end
  257.  
  258.   def dispose_bgs
  259.     @choice_sprite.each_with_index do |s,i|
  260.       s.dispose
  261.       s.bitmap.dispose
  262.     end
  263.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  264.       @cursor_sprite.dispose
  265.       @cursor_sprite.bitmap.dispose
  266.       @choice_sprite = []
  267.     end
  268.   end
  269.  
  270.   alias galv_choice_call_ok_handler call_ok_handler
  271.   def call_ok_handler
  272.     galv_choice_call_ok_handler
  273.     dispose_bgs
  274.   end
  275.   alias galv_choice_call_cancel_handler call_cancel_handler
  276.   def call_cancel_handler
  277.     galv_choice_call_cancel_handler
  278.     dispose_bgs
  279.   end
  280.  
  281.   def update_cursor
  282.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  283.       super
  284.     else
  285.       cursor_rect.empty
  286.       return if @cursor_sprite.nil? || @choice_sprite.nil?
  287.       if @index < 0
  288.         @cursor_sprite.opacity = 0
  289.       else
  290.         @cursor_sprite.opacity = Galv_Choice::CURSOR_OPACITY
  291.         @cursor_sprite.x = @choice_sprite[@index].x + Galv_Choice::CURSOR_X_OFFSET
  292.         @cursor_sprite.y = @choice_sprite[@index].y + Galv_Choice::CURSOR_Y_OFFSET
  293.         @cursor_sprite.z = self.z - 1
  294.         cursor_rect.y = (item_height * @index) + Galv_Choice::OTHER_Y_OFFSET
  295.       end
  296.     end
  297.   end
  298.  
  299. end # Window_ChoiceList < Window_Command

Lv6.析梦学徒

老鹰

梦石
40
星屑
34720
在线时间
6739 小时
注册时间
2012-5-26
帖子
3259

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

2
发表于 2020-4-16 23:40:13 | 只看该作者
选项内容里写转义符 \c[1]  就是改成1号颜色绘制(窗口皮肤右下角颜色索引里的第二个颜色)
回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
646
在线时间
63 小时
注册时间
2019-1-26
帖子
12
3
 楼主| 发表于 2020-4-17 00:04:13 | 只看该作者
百里_飞柳 发表于 2020-4-16 23:40
选项内容里写转义符 \c[1]  就是改成1号颜色绘制(窗口皮肤右下角颜色索引里的第二个颜色) ...

好像找到原因了,不是字体颜色问题,是透明度(亮度?)问题,好像是之前有脚本改变了字体的设定,我现在一个一个找一下
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
646
在线时间
63 小时
注册时间
2019-1-26
帖子
12
4
 楼主| 发表于 2020-4-17 00:09:02 | 只看该作者
KanadeZero 发表于 2020-4-17 00:04
好像找到原因了,不是字体颜色问题,是透明度(亮度?)问题,好像是之前有脚本改变了字体的设定,我现在 ...

忘记发后续了= =,抱歉
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
646
在线时间
63 小时
注册时间
2019-1-26
帖子
12
5
 楼主| 发表于 2020-4-17 00:10:02 | 只看该作者
本帖最后由 KanadeZero 于 2020-4-17 00:12 编辑

图片怎么没发成功....

1.png (133.28 KB, 下载次数: 33)

1.png

点评

选择框内容contents_opacity的透明度,文字颜色的透明度contents.font.color.alpha  发表于 2020-4-17 01:53
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
11352
在线时间
611 小时
注册时间
2016-8-25
帖子
1400

R考场第七期纪念奖

6
发表于 2020-4-17 08:14:50 | 只看该作者
太强了
这是什么脚本
让我看出一股galgame的感觉
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-16 10:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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