查看: 2832|回复: 6

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

[复制链接]
梦石
0
星屑
646
在线时间
63 小时
注册时间
2019-1-26
回帖
9
发表于 2020-4-16 22:48:55 | 显示全部楼层 |阅读模式

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

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

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

  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. ($imported ||= {})["Galvs_Image_Choices"] = true
  48. module Galv_Choice

  49. #------------------------------------------------------------------------------#
  50. #  SCRIPT SETUP OPTIONS
  51. #------------------------------------------------------------------------------#
  52.    
  53.   CURSOR_IMAGE = "Cursor"  # Images used to determine which option you select
  54.   CURSOR_OPACITY = 255      # Opacity of the cursor
  55.   CURSOR_Y_OFFSET = 0       # Nudge cursor position vertically
  56.   CURSOR_X_OFFSET = 0       # Nudge cursor position horizontally

  57.   CHOICE_IMAGE = "Choice"   # Image for each choice located in /Graphics/System
  58.   IMAGE_Y_OFFSET = 3        # Nudge your choice image vertically if needed
  59.   IMAGE_OPACITY = 215       # The opacity of the image

  60.   CHOICE_HEIGHT = 45        # How tall each choice.
  61.   CHOICE_ITEM_Y = 2         # Offset for choice item text
  62.    
  63.   CENTER_TEXT = true        # left aligned if false, centered if true
  64.                              
  65.   DISABLE_SWITCH = 1        # Turn this switch ON to disable this script
  66.    
  67.   CHOICES_Y = 0             # Y offset to move choice window up or down.
  68.                             # useful if you use a script that creates a namebox
  69.   CHOICES_Z = 50            # The z value of the choices window. Try changing it
  70.                             # if pictures or other scripts appear over or under
  71.                             # the choices window to how you like.
  72.    
  73. #------------------------------------------------------------------------------#
  74.   OTHER_Y_OFFSET = 12       # May fix other cursor scripts positioning
  75. #------------------------------------------------------------------------------#
  76. #  SCRIPT SETUP OPTIONS
  77. #------------------------------------------------------------------------------#

  78. end

  79. class Window_ChoiceList < Window_Command

  80.   alias galv_choice_initialize initialize
  81.   def initialize(message_window)
  82.     galv_choice_initialize(message_window)
  83.     self.z = Galv_Choice::CHOICES_Z
  84.   end
  85.    
  86.   def start
  87.     @index = 0
  88.     setup_choices
  89.     make_cursor
  90.     refresh
  91.     open
  92.     activate
  93.     update_placement
  94.     update_bgs
  95.     refresh
  96.     select(0)
  97.   end
  98.    
  99.   def make_cursor
  100.     return if $game_switches[Galv_Choice::DISABLE_SWITCH]
  101.     @cursor_sprite = Sprite.new
  102.     @cursor_sprite.bitmap = Cache.system(Galv_Choice::CURSOR_IMAGE)
  103.   end
  104.    
  105.   def setup_choices
  106.     @choice_sprite = []
  107.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  108.       self.opacity = 0
  109.       get_widths
  110.     else
  111.       self.opacity = 255
  112.     end
  113.   end
  114.    
  115.   alias galv_choice_update_placement update_placement
  116.   def update_placement
  117.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  118.       galv_choice_update_placement
  119.     else
  120.       self.width = [max_choice_width + 12, 96].max + padding * 4
  121.       self.width = [width, Graphics.width].min
  122.       self.height = contents_height + Galv_Choice::CHOICE_HEIGHT - 10
  123.       self.x = (Graphics.width - width) / 2
  124.       
  125.       if @message_window.openness < 100
  126.         self.y = Graphics.height - contents_height + item_height / 2
  127.       elsif @message_window.y >= Graphics.height / 2
  128.         self.y = @message_window.y - contents_height + item_height / 2 - Galv_Choice::CHOICES_Y
  129.       else
  130.         self.y = @message_window.y + @message_window.height + item_height / 2 + Galv_Choice::CHOICES_Y
  131.       end
  132.     end
  133.   end

  134.   alias galv_choice_contents_height contents_height
  135.   def contents_height
  136.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  137.       galv_choice_contents_height
  138.     else
  139.       (item_max + 1) * item_height
  140.     end
  141.   end
  142.    
  143.   def draw_item(index)
  144.     rect = item_rect_for_text(index)
  145.     draw_text_ex(rect.x, rect.y, command_name(index))
  146.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  147.       draw_bgs(index)
  148.     end
  149.   end
  150.    
  151.   def item_rect_for_text(index)
  152.     rect = item_rect(index)
  153.      
  154.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  155.       rect.x += 4
  156.       rect.width -= 8
  157.       rect
  158.     else
  159.       if Galv_Choice::CENTER_TEXT
  160.         rect.x = (max_choice_width - @text_sizes.collect {|s| text_size(s).width }[index] + (padding * 3)) / 2
  161.       else
  162.         rect.x += 4
  163.       end
  164.       rect.width -= 8
  165.       rect.y += Galv_Choice::CHOICE_ITEM_Y
  166.       rect
  167.     end
  168.   end
  169.    
  170.   def get_widths
  171.     @text_sizes = []
  172.     @choice_background = []
  173.     $game_message.choices.each_with_index do |c,i|
  174.       @text_sizes[i] = esc_characters(c,i)
  175.     end
  176.   end
  177.    
  178.   def esc_characters(text,index)
  179.     result = text.to_s.clone
  180.     result.gsub!(/\\/)            { "\e" }
  181.     result.gsub!(/\e\e/)          { "\" }
  182.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  183.     result.gsub!(/\eN\[(\d+)\]/i) { $game_actors[$1.to_i].name}
  184.     result.gsub!(/\eP\[(\d+)\]/i) {
  185.       if $game_party.members[$1.to_i].nil?
  186.         ""
  187.       else
  188.         $game_party.members[$1.to_i].name
  189.       end
  190.     }
  191.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  192.     result.gsub!(/\eC\[(\d+)\]/i)  { "" }
  193.     result.gsub!(/\eI\[(\d+)\]/i)  { "   " }
  194.     result.gsub!(/\eB\[(\d+)\]/i)  { @choice_background[index] = $1.to_i }
  195.     result.gsub!(/\eB\[(\d+)\]/i)  { "" }
  196.     result
  197.   end
  198.    
  199.   def convert_escape_characters(text)
  200.     result = text.to_s.clone
  201.     result.gsub!(/\\/)            { "\e" }
  202.     result.gsub!(/\e\e/)          { "\" }
  203.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  204.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  205.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  206.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  207.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  208.     result.gsub!(/\eB\[(\d+)\]/i)  { "" }
  209.     result
  210.   end
  211.    
  212.   def item_height
  213.     return line_height if $game_switches[Galv_Choice::DISABLE_SWITCH]
  214.     return Galv_Choice::CHOICE_HEIGHT
  215.   end
  216.    
  217.   def item_rect(index)
  218.     rect = Rect.new
  219.     rect.width = item_width
  220.     rect.height = item_height - 15
  221.     rect.height += 15 if $game_switches[Galv_Choice::DISABLE_SWITCH]
  222.     rect.x = index % col_max * (item_width + spacing)
  223.     rect.y = index / col_max * item_height
  224.     rect
  225.   end
  226.    
  227.   def draw_bgs(index)
  228.     return if @choice_sprite[index] != nil
  229.      
  230.     if @choice_background[index].nil?
  231.       b = ""
  232.     else
  233.       b = @choice_background[index]
  234.     end
  235.     @choice_sprite[index] = Sprite.new
  236.     @choice_sprite[index].bitmap = Cache.system(Galv_Choice::CHOICE_IMAGE + b.to_s)
  237.     @choice_sprite[index].x = index % col_max * (item_width + spacing)
  238.     @choice_sprite[index].y = index / col_max * item_height
  239.     @choice_sprite[index].z = self.z - 2
  240.   end

  241.   def update_bgs
  242.     @choice_sprite.each_with_index do |s,i|
  243.       s.y = self.y + i * Galv_Choice::CHOICE_HEIGHT + Galv_Choice::IMAGE_Y_OFFSET
  244.       s.x = (Graphics.width - s.width) / 2
  245.       s.opacity = Galv_Choice::IMAGE_OPACITY
  246.     end
  247.   end
  248.    
  249.   def dispose_bgs
  250.     @choice_sprite.each_with_index do |s,i|
  251.       s.dispose
  252.       s.bitmap.dispose
  253.     end
  254.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  255.       @cursor_sprite.dispose
  256.       @cursor_sprite.bitmap.dispose
  257.       @choice_sprite = []
  258.     end
  259.   end
  260.    
  261.   alias galv_choice_call_ok_handler call_ok_handler
  262.   def call_ok_handler
  263.     galv_choice_call_ok_handler
  264.     dispose_bgs
  265.   end
  266.   alias galv_choice_call_cancel_handler call_cancel_handler
  267.   def call_cancel_handler
  268.     galv_choice_call_cancel_handler
  269.     dispose_bgs
  270.   end
  271.    
  272.   def update_cursor
  273.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  274.       super
  275.     else
  276.       cursor_rect.empty
  277.       return if @cursor_sprite.nil? || @choice_sprite.nil?
  278.       if @index < 0
  279.         @cursor_sprite.opacity = 0
  280.       else
  281.         @cursor_sprite.opacity = Galv_Choice::CURSOR_OPACITY
  282.         @cursor_sprite.x = @choice_sprite[@index].x + Galv_Choice::CURSOR_X_OFFSET
  283.         @cursor_sprite.y = @choice_sprite[@index].y + Galv_Choice::CURSOR_Y_OFFSET
  284.         @cursor_sprite.z = self.z - 1
  285.         cursor_rect.y = (item_height * @index) + Galv_Choice::OTHER_Y_OFFSET
  286.       end
  287.     end
  288.   end

  289. end # Window_ChoiceList < Window_Command
复制代码

老鹰

梦石
40
星屑
38044
在线时间
7127 小时
注册时间
2012-5-26
回帖
3306

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

发表于 2020-4-16 23:40:13 | 显示全部楼层
选项内容里写转义符 \c[1]  就是改成1号颜色绘制(窗口皮肤右下角颜色索引里的第二个颜色)
回复 1 0

使用道具 举报

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

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

使用道具 举报

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

忘记发后续了= =,抱歉
回复

使用道具 举报

梦石
0
星屑
646
在线时间
63 小时
注册时间
2019-1-26
回帖
9
 楼主| 发表于 2020-4-17 00:10:02 | 显示全部楼层
本帖最后由 KanadeZero 于 2020-4-17 00:12 编辑

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

点评

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

使用道具 举报

梦石
0
星屑
11806
在线时间
623 小时
注册时间
2016-8-25
回帖
1339

R考场第七期纪念奖

发表于 2020-4-17 08:14:50 | 显示全部楼层
太强了
这是什么脚本
让我看出一股galgame的感觉
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部