查看: 2771|回复: 2

[已经过期] 状态滚动和显示回合不兼容

[复制链接]
梦石
0
星屑
1461
在线时间
815 小时
注册时间
2013-8-3
回帖
355
发表于 2019-10-20 15:30:43 | 显示全部楼层 |阅读模式

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

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

×
两个功能不能一起实现
状态滚动
  1. #==============================================================================
  2. # ■状态剩余回合数显示 for RGSS3 Ver1.01-β
  3. # □作成者 kure
  4. #==============================================================================
  5. #
  6. # 状态备注:  <不显示剩余回合数>   则不会显示剩余回合数
  7. #

  8. #==============================================================================
  9. # ■ RPG::State(追加定義)
  10. #==============================================================================
  11. class RPG::State < RPG::BaseItem
  12.   #--------------------------------------------------------------------------
  13.   # ☆残りターン非表示の定義(追加定義)
  14.   #--------------------------------------------------------------------------  
  15.   def view_turns?
  16.     return true unless @note
  17.     return false if @note.include?("<不显示剩余回合数>")
  18.     return true
  19.   end
  20. end

  21. #==============================================================================
  22. # ■ Window_Base
  23. #==============================================================================
  24. class Window_Base < Window
  25.   #--------------------------------------------------------------------------
  26.   # ● ステートおよび強化/弱体のアイコンを描画(再定義)
  27.   #--------------------------------------------------------------------------
  28.   def draw_actor_icons(actor, x, y, width = 96)
  29.     icons = (actor.state_icons_adv + actor.buff_icons_adv)[0, width / 24]
  30.    
  31.     last = contents.font.size
  32.     contents.font.size = 18
  33.     change_color(crisis_color)
  34.     icons.each_with_index {|n, i| draw_state_icon_turns(n, x + 24 * i, y) }
  35.     change_color(normal_color)
  36.     contents.font.size = last
  37.    
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 残りのターンを加えたアイコンの描画(追加定義)
  41.   #--------------------------------------------------------------------------
  42.   def draw_state_icon_turns(data, x, y)
  43.     draw_icon(data[0], x, y)
  44.     if data[2] and $data_states[data[2]] and $data_states[data[2]].auto_removal_timing == 0
  45.       return
  46.     end
  47.     draw_text(x + 12, y + 8, 12, 18, data[1],2)
  48.   end
  49. end

  50. #==============================================================================
  51. # ■ Game_BattlerBase
  52. #==============================================================================
  53. class Game_BattlerBase
  54.   #--------------------------------------------------------------------------
  55.   # ● 現在のステートをアイコンINDEX、残りターン、ステートIDで取得(追加定義)
  56.   #--------------------------------------------------------------------------
  57.   def state_icons_adv
  58.     icons = states.collect {|state| [state.icon_index, @state_turns[state.id], state.id] }
  59.     for i in 0..icons.size - 1
  60.       if icons[i][0] == 0
  61.         icons[i] = nil
  62.       else
  63.         icons[i][1] = "" if $data_states[icons[i][2]].auto_removal_timing == 0
  64.         icons[i][1] = "" unless $data_states[icons[i][2]].view_turns?
  65.       end
  66.     end
  67.     icons.compact!
  68.     return icons
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 現在の強化/弱体をアイコンINDEX、残りターンで取得(追加定義)
  72.   #--------------------------------------------------------------------------
  73.   def buff_icons_adv
  74.     icons = []
  75.     @buffs.each_with_index {|lv, i| [icons.push(buff_icon_index(lv, i)),@buff_turns[i]] }
  76.     for i in 0..icons.size - 1
  77.       icons[i] = nil if icons[i][0] == 0
  78.     end
  79.     icons.compact!
  80.     return icons
  81.   end
  82. end
复制代码

回合显示
  1. ###--------------------------------------------------------------------------###
  2. #  CP 滚动状态 VX script                                               #
  3. #  Version 1.1                                                                 #
  4. #                                                                              #
  5. #      Credits:                                                                #
  6. #  Original code by: Neon Black                                                #
  7. #  Modified by:                                                                #
  8. #                                                                              #
  9. #  This work is licensed under the Creative Commons Attribution-NonCommercial  #
  10. #  3.0 Unported License. To view a copy of this license, visit                 #
  11. #  [url]http://creativecommons.org/licenses/by-nc/3.0/.[/url]                             #
  12. #  Permissions beyond the scope of this license are available at               #
  13. #  [url]http://cphouseset.wordpress.com/liscense-and-terms-of-use/.[/url]                 #
  14. #                                                                              #
  15. #      Contact:                                                                #
  16. #  NeonBlack - neonblack23@live.com (e-mail) or "neonblack23" on skype         #
  17. ###--------------------------------------------------------------------------###

  18. ###--------------------------------------------------------------------------###
  19. #      Revision information:                                                   #
  20. #  V1.1 - 11.14.2012                                                           #
  21. #   Improved state rectangle drawing                                           #
  22. #  V1.0 - 7.15.2012                                                            #
  23. #   Wrote and debugged main script                                             #
  24. ###--------------------------------------------------------------------------###

  25. ###--------------------------------------------------------------------------###
  26. #      Compatibility:                                                          #
  27. #  Alias       - Window_Base: initialize, update                               #
  28. #  Overwrites  - Window_Base: draw_actor_icons                                 #
  29. #  New Objects - Window_Base: draw_icons_area, clear_all_icons                 #
  30. #                Scroll_States: initialize, change?, update_icons,             #
  31. #                               clear_icon_area                                #
  32. ###--------------------------------------------------------------------------###

  33. ###--------------------------------------------------------------------------###
  34. #      Instructions:                                                           #
  35. #  Place this script in the "Materials" section of the scripts above main.     #
  36. #  This script is plug and play and overwrites how states, buff, and debuffs   #
  37. #  are displayed.  The only setting this script contains modifies the speed    #
  38. #  at which the states change and can be altered below.                        #
  39. ###--------------------------------------------------------------------------###

  40. ###--------------------------------------------------------------------------###
  41. #      说明:                                                                 #
  42. #  可以让玩家处于多个状态时,依次滚动显示状态图标,请在下面设定滚动前等待的时间
  43. #                                                                              #
  44. module CP            # Do not                                                  #
  45. module SCROLL_STATES #  change these.                                          #
  46. #                                                                              #
  47. ###-----                                                                -----###
  48. # 图标切换前等待的时间,单位是帧.   #
  49. TRANS = 45 # 默认 = 45                                                      #
  50. #                                                                              #
  51. ###--------------------------------------------------------------------------###


  52. ###--------------------------------------------------------------------------###
  53. #  The following lines are the actual core code of the script.  While you are  #
  54. #  certainly invited to look, modifying it may result in undesirable results.  #
  55. #  Modify at your own risk!                                                    #
  56. ###--------------------------------------------------------------------------###

  57. end
  58. end

  59. $imported = {} if $imported == nil
  60. $imported["CP_SCROLLING_STATES"] = 1.1

  61. class Scroll_States  ## This class holds the state icons for windows.
  62.   attr_reader   :x
  63.   attr_reader   :y
  64.   attr_reader   :width
  65.   attr_reader   :icons
  66.   attr_accessor :bitmap
  67.   
  68.   def initialize(x, y, width, states, level = 0)
  69.     @x = x  ## Sets up required aspects of the states class.
  70.     @y = y
  71.     @width = width
  72.     @states = states
  73.     @bitmap = Bitmap.new([width, 1].max, 24)
  74.     update_icons(level)
  75.   end
  76.   
  77.   def change?(level)  ## Determines if a refresh is required.
  78.     return false if (@width / 24 >= @states.size)
  79.     return true if (level % CP::SCROLL_STATES::TRANS == 0)
  80.     return false
  81.   end
  82.   
  83.   def update_icons(level)
  84.     return @icons = [0] if @states.empty?  ## Skip if no states.
  85.     total = @width / 24
  86.     return @icons = @states if total >= @states.size  ## No refresh needed.
  87.     start = (level / CP::SCROLL_STATES::TRANS) % @states.size
  88.     double = @states + @states  ## Doubles the states for overlap.
  89.     top = [double.size, start + total].min
  90.     @icons = []
  91.     for i in start...top  ## Create the shown states in order.
  92.       @icons.push(double[i])
  93.     end
  94.   end
  95. end

  96. class Window_Base < Window
  97.   alias cp_sswb_initialize initialize
  98.   def initialize(x, y, width, height)
  99.     cp_sswb_initialize(x, y, width, height)
  100.     @icon_areas = {}  ## Sets up an array for the states.
  101.     @icon_scroll = false
  102.     @icon_timer = 0
  103.   end
  104.   
  105.   alias cp_sswb_update update
  106.   def update
  107.     cp_sswb_update
  108.     unless @icon_areas.empty?  ## Ignore if no states were drawn.
  109.       @icon_timer += 1  ## A timer used by states.
  110.       @icon_areas.each_value do |area|
  111.         next unless area.change?(@icon_timer)
  112.         draw_icons_area(area)
  113.       end
  114.     end
  115.   end
  116.   
  117.   def draw_icons_area(area)
  118.     contents.clear_rect(area.x, area.y, area.width, 24)  ## Clears state area.
  119.     contents.blt(area.x, area.y, area.bitmap, area.bitmap.rect)
  120.     area.update_icons(@icon_timer)  ## Updates the icons.
  121.     area.icons.each_with_index {|n, i| draw_icon(n, area.x + 24 * i, area.y) }
  122.   end
  123.   
  124.   def clear_all_icons  ## Clears all icon spots for redraw.
  125.     @icon_areas.each_key {|key| clear_icon_area(key)}
  126.     @icon_areas = {}  ## Resets the array.
  127.     @icon_scroll = false  ## Do not reset this frame.
  128.   end
  129.   
  130.   def clear_icon_area(key)
  131.     return if @icon_areas[key].nil?
  132.     area = @icon_areas[key]
  133.     contents.clear_rect(area.x, area.y, area.width, 24)
  134.     contents.blt(area.x, area.y, area.bitmap, area.bitmap.rect)
  135.     @icon_areas[key] = nil
  136.   end
  137.   
  138.   def draw_actor_icons(actor, x, y, width = 96)  ## Overwrite this method.
  139.     icons = (actor.state_icons + actor.buff_icons)
  140.     key = [x, y, width]
  141.     clear_icon_area(key)
  142.     temp = Scroll_States.new(x, y, width, icons)  ## Creates an icon holder.
  143.     @icon_areas[key] = temp
  144.     rect = Rect.new(x, y, width, 24)
  145.     @icon_areas[key].bitmap.blt(0, 0, contents, rect)
  146.     draw_icons_area(@icon_areas[key])  ## Draw the newest set.
  147.   end
  148. end


  149. ###--------------------------------------------------------------------------###
  150. #  End of script.                                                              #
  151. ###--------------------------------------------------------------------------###
复制代码

【同人游戏】勇者斗恶龙TG
欢迎加入游戏测试群333599798
如有需私聊请加QQ:516425000
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部