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

Project1

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

[已经解决] 如何把这个物品窗口deactivate?

[复制链接]

Lv2.观梦者

梦石
0
星屑
685
在线时间
661 小时
注册时间
2012-10-21
帖子
350
跳转到指定楼层
1
发表于 2014-9-2 09:28:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
原版的物品窗口可以在class Scene_Item中@item_window.deactivate 实现
但是咱用了一个物品栏窗口的脚本,上面那条语句无效,请大神帮帮忙该怎么办?
这是物品栏窗口脚本

RUBY 代码复制
  1. # ╔══════════════════════════════════════════════════════╤═══════╤═══════════╗
  2. # ║ Too Much Information Item Scene                      │ v1.01 │ (5/22/13) ║
  3. # ╚══════════════════════════════════════════════════════╧═══════╧═══════════╝
  4. # Script by:
  5. #     Mr. Bubble ( [url]http://mrbubblewand.wordpress.com/[/url] )
  6. # Thanks:
  7. #     Tsukihime, Tag Manager script
  8. #--------------------------------------------------------------------------
  9. # This script remodels the item scene so that more information about
  10. # items may be viewed by players. People familiar with my Tactics
  11. # Ogre PSP Crafting System script will find the window aesthetic
  12. # similar in style.
  13. #
  14. # The type of information you can provide players is customized in the
  15. # Info Pages Window's customization module.
  16. #
  17. # Additionally, this script significantly changes the category selection
  18. # function in the item scene. By default, players must select a category
  19. # before being able to view their inventory. With this script, players
  20. # may select items immediately after entering the item scene. The
  21. # item category is changed by using other gamepad buttons. This makes
  22. # the inventory interface more inline with console RPGs.
  23. #
  24. # More item category filters can be made with Tsukihime's Tag Manager
  25. # script.
  26. #--------------------------------------------------------------------------
  27. #      Changelog   
  28. #--------------------------------------------------------------------------
  29. # v1.01 : Compatibility Update: Tsukihime's "Inventory Sorting". (5/22/2013)
  30. # v1.00 : Initial release. (4/14/2013)
  31. #--------------------------------------------------------------------------
  32. #      Installation and Requirements
  33. #--------------------------------------------------------------------------
  34. # Install this script in the Materials section in your project's
  35. # script editor. This script is not plug-and-play and requires
  36. # multiple other scripts in order to function.
  37. #
  38. #     "Info Pages Window" - by Mr. Bubble
  39. #         [url]http://wp.me/PxlCT-tA[/url]
  40. #     "Reader Functions for Features/Effects" v1.4+ - by Mr. Bubble
  41. #         [url]http://wp.me/PxlCT-rC[/url]
  42. #     
  43. # Additionally, I recommend installing two extra, optional scripts in
  44. # order to fully utilize some settings in this script:
  45. #
  46. #     "Tag Manager" - by Tsukihime
  47. #         [url]http://himeworks.wordpress.com/2013/03/07/tag-manager/[/url]
  48. #     "Text Cache" - by Mithran
  49. #         [url]http://forums.rpgmakerweb.com/index.php?/topic/1001-text-cache/[/url]
  50. #--------------------------------------------------------------------------
  51. #      Compatibility
  52. #--------------------------------------------------------------------------
  53. # This script overwrites the following default VXA methods:
  54. #
  55. #     Scene_Item#start
  56. #     Scene_Item#create_category_window
  57. #     Scene_Item#create_item_window
  58. #     Scene_Item#on_item_cancel
  59. #
  60. # Built-in script compatibility with:
  61. #
  62. #     -Tsukihime's "Inventory Sorting"
  63. #
  64. # This script will have issues with other scripts that also modify the
  65. # default item scene.
  66. #--------------------------------------------------------------------------
  67. #      Terms and Conditions   
  68. #--------------------------------------------------------------------------
  69. # Please do not repost this script elsewhere without permission.
  70. # Free for non-commercial use. For commercial use, contact me first.
  71. #
  72. # Newest versions of this script can be found at
  73. #                                           [url]http://mrbubblewand.wordpress.com/[/url]
  74. #=============================================================================
  75.  
  76. $imported ||= {}
  77. $imported["Bubs_TMI_ItemScene"] = 1.01
  78.  
  79. #==========================================================================
  80. # ++ START OF USER CUSTOMIZATION MODULE ++
  81. #==========================================================================
  82. module Bubs
  83.   #==========================================================================
  84.   # ++ TMI Item Scene Settings
  85.   #==========================================================================
  86.   module TMI_ItemScene
  87.   #--------------------------------------------------------------------------
  88.   #   Item Scene Categories
  89.   #--------------------------------------------------------------------------
  90.   # This setting determines which categories appear in the item scene.
  91.   # The order of symbols in the array determines
  92.   # the order seen in the item scene.
  93.   #
  94.   # Custom categories can only be used if Tsukihime's Tag Manager
  95.   # script is also installed. Define new categories in the
  96.   # TSUKIHIME_CATEGORY_TAGS setting. For example, if :sword is
  97.   # defined in TSUKIHIME_CATEGORY_TAGS, you may add :sword into the
  98.   # CATEGORIES array.
  99.   #
  100.   # There is no limit on the amount of symbols you may list in the array.
  101.   #
  102.   # Default category symbols:
  103.   #   :all, :item, :weapon, :armor, :key_item
  104.   CATEGORIES = [:all, :food, :weapon, :armor, :material, :key_item]
  105.  
  106.   #--------------------------------------------------------------------------
  107.   #   Custom Category Definitions
  108.   #--------------------------------------------------------------------------
  109.   # !! This section requires Tsukihime's Tag Manager script. !!
  110.   #
  111.   # This setting allows you to create custom categories based on the
  112.   # tags you give them. For more information, please read the comments
  113.   # in the Tag Manager script.
  114.   #
  115.   # For example, if a weapon has the tag '<tag: sword, metal>' in its notebox,
  116.   # it will appear under any category which has "sword" or "metal" in
  117.   # its tag array.
  118.   #
  119.   # The pre-defined categories here serve as examples and can be freely
  120.   # modified.
  121.   CATEGORY_TAGS = {
  122.   # :symbol         => ["string1", "string2", ...],
  123.     :sword          => ["sword", "rapier", "great sword"],
  124.     :polearm        => ["spear", "polearm", "scythe"],
  125.     :axe            => ["axe", "ax", "great axe", "hatchet"],
  126.     :staff          => ["staff", "stave", "cane"],
  127.     :light_armor    => ["robe", "light_armor", "dress", "shirt"],
  128.     :heavy_armor    => ["chain_mail", "mail", "plate_mail", "heavy_armor"],
  129.     :shield         => ["shield", "buckler"],
  130.     :accessory      => ["ring", "brooch", "necklace", "medal"],
  131.     :material        => ["material"],
  132.     :food        => ["food"],
  133.     # Define more categories here!
  134.  
  135.   } # <- Do not delete.
  136.  
  137.   #--------------------------------------------------------------------------
  138.   #   Category Icons
  139.   #--------------------------------------------------------------------------
  140.   # This setting lets you define which icons represent a category.
  141.   # The format for creating a new entry is:
  142.   #   
  143.   #       :symbol => icon_index,
  144.   #
  145.   # where :symbol is a symbol from CATEGORY_TAGS hash.
  146.   CATEGORY_ICONS = {
  147.     # Default category icons
  148.     :all          => 270,
  149.     :item         => 192,
  150.     :weapon       => 147,
  151.     :armor        => 170,
  152.     :key_item     => 243,
  153.     # Custom category icons
  154.     :sword        => 147,
  155.     :polearm      => 146,
  156.     :staff        => 152,
  157.     :axe          => 144,
  158.     :shield       => 506,
  159.     :light_armor  => 183,
  160.     :heavy_armor  => 170,
  161.     :material     => 170,
  162.     # Define more icons here
  163.  
  164.   } # <- Do not delete.
  165.  
  166.   #--------------------------------------------------------------------------
  167.   #   Default Category Icon
  168.   #--------------------------------------------------------------------------
  169.   # If a category icon index number is not defined in CATEGORY_ICONS, it will
  170.   # use this default index.
  171.   CATEGORY_ICONS.default = 261
  172.  
  173.   #--------------------------------------------------------------------------
  174.   #   Category Background Icon
  175.   #--------------------------------------------------------------------------
  176.   # This setting defines the icon displayed behind category icons. If set
  177.   # to 0, a background icon will not be used.
  178.   CATEGORY_ICON_BACKGROUND = 16
  179.  
  180.   #--------------------------------------------------------------------------
  181.   #   Item Scene Button Settings
  182.   #--------------------------------------------------------------------------
  183.   # This setting determine which gamepad buttons change aspects of the
  184.   # item scene such as changing categories or changing the info window.
  185.   # Default buttons that you can use include:
  186.   #
  187.   # :LEFT, :RIGHT
  188.   # :A, :B, :C, :X, :Y, :Z, :L, :R
  189.   # :SHIFT, :CTRL, :ALT
  190.   ITEM_SCENE_BUTTONS = {
  191.     :next_category      => :RIGHT,
  192.     :prev_category      => :LEFT,
  193.     :itemlist_pagedown  => :R,
  194.     :itemlist_pageup    => :L,
  195.   } # <- Do not delete.
  196.  
  197.   #--------------------------------------------------------------------------
  198.   #   Button Icons
  199.   #--------------------------------------------------------------------------
  200.   # This setting defines the icons used to represent buttons in the item
  201.   # scene.
  202.   BUTTON_ICONS = {
  203.     :next_category      => 0, # Next Category Button Icon
  204.     :prev_category      => 0, # Previous Category Button Icon
  205.   } # <- Do not delete.
  206.  
  207.   #--------------------------------------------------------------------------
  208.   #   Category Change Sound Effect
  209.   #--------------------------------------------------------------------------
  210.   # Filename : SE filename in Audio/SE/ folder
  211.   # Volume   : Between 0~100
  212.   # Pitch    : Between 50~150
  213.   #
  214.   #                      Filename, Volume, Pitch
  215.   CATEGORY_CHANGE_SE = ["Cursor1",     80,   100]
  216.  
  217.   end # module TMI_ItemScene
  218. end # module Bubs
  219.  
  220.  
  221. #==========================================================================
  222. # ++ END OF USER CUSTOMIZATION MODULE ++
  223. #==========================================================================
  224.  
  225.  
  226. #==============================================================================
  227. # ++ Sound
  228. #==============================================================================
  229. module Sound
  230.   #--------------------------------------------------------------------------
  231.   # new method : play_tmi_category_change
  232.   #--------------------------------------------------------------------------
  233.   def self.play_tmi_category_change
  234.     filename = Bubs::TMI_ItemScene::CATEGORY_CHANGE_SE[0]
  235.     volume   = Bubs::TMI_ItemScene::CATEGORY_CHANGE_SE[1]
  236.     pitch    = Bubs::TMI_ItemScene::CATEGORY_CHANGE_SE[2]
  237.     Audio.se_play("Audio/SE/" + filename, volume, pitch)
  238.   end
  239. end # module Sound
  240.  
  241.  
  242.  
  243. #==============================================================================
  244. # ++ Window_TMI_ItemCategory
  245. #==============================================================================
  246. class Window_TMI_ItemCategory < Window_Base
  247.   #--------------------------------------------------------------------------
  248.   # initialize
  249.   #--------------------------------------------------------------------------
  250.   def initialize(x, y, width, height)
  251.     super
  252.     self.opacity = 0
  253.     @category_index = 0
  254.     initialize_categories
  255.     adjust_index_range
  256.     refresh
  257.   end
  258.  
  259.   #--------------------------------------------------------------------------
  260.   # initialize_categories
  261.   #--------------------------------------------------------------------------
  262.   def initialize_categories
  263.     @category_symbols = Bubs::TMI_ItemScene::CATEGORIES
  264.     @category = @category_symbols[@category_index]
  265.   end
  266.  
  267.   #--------------------------------------------------------------------------
  268.   # category=
  269.   #--------------------------------------------------------------------------
  270.   def category=(symbol)
  271.     @category = symbol
  272.     @category_index = @category_symbols.index(@category)
  273.     refresh
  274.   end
  275.  
  276.   #--------------------------------------------------------------------------
  277.   # refresh
  278.   #--------------------------------------------------------------------------
  279.   def refresh
  280.     contents.clear
  281.     draw_horz_line(line_height)
  282.     adjust_index_range
  283.     draw_category_icons
  284.     draw_category_button_icons(0, 0)
  285.   end
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # draw_horz_line
  289.   #--------------------------------------------------------------------------
  290.   def draw_horz_line(y)
  291.     line_y = y + line_height / 2 - 1
  292.     color = normal_color
  293.     color.alpha = 48
  294.     contents.fill_rect(0, line_y, contents_width, 2, color)
  295.   end
  296.  
  297.   #--------------------------------------------------------------------------
  298.   # draw_category_icons
  299.   #--------------------------------------------------------------------------
  300.   def draw_category_icons
  301.     x = (contents_width / 2) - (icon_row_width / 2) - icon_adjustment
  302.     for index in @index_range[0]..@index_range[1]
  303.       bool = index == @category_index
  304.       x += icon_width
  305.       draw_icon(16, x, 0, bool)
  306.       draw_icon(category_icon_index(index), x, 0, bool)
  307.     end
  308.   end
  309.  
  310.   #--------------------------------------------------------------------------
  311.   # draw_category_button_icons
  312.   #--------------------------------------------------------------------------
  313.   def draw_category_button_icons(x, y)
  314.     draw_icon(category_button_icon_index(:prev_category), x, y)
  315.     x = x + contents_width - icon_width
  316.     draw_icon(category_button_icon_index(:next_category), x, y)
  317.   end
  318.  
  319.   #--------------------------------------------------------------------------
  320.   # category_button_icon_index
  321.   #--------------------------------------------------------------------------
  322.   def category_button_icon_index(symbol)
  323.     Bubs::TMI_ItemScene::BUTTON_ICONS[symbol]
  324.   end
  325.  
  326.   #--------------------------------------------------------------------------
  327.   # icon_adjustment
  328.   #--------------------------------------------------------------------------
  329.   def icon_adjustment
  330.     return 25
  331.   end
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # icon_width
  335.   #--------------------------------------------------------------------------
  336.   def icon_width
  337.     return 24
  338.   end
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # icon_row_width
  342.   #--------------------------------------------------------------------------
  343.   def icon_row_width
  344.     icon_width * icon_max
  345.   end
  346.  
  347.   #--------------------------------------------------------------------------
  348.   # icon_max
  349.   #--------------------------------------------------------------------------
  350.   def icon_max
  351.     num = @category_symbols.size
  352.     return [14, num].min if Graphics.width == 736
  353.     return [8, num].min
  354.   end
  355.  
  356.   #--------------------------------------------------------------------------
  357.   # icon_by_index
  358.   #--------------------------------------------------------------------------
  359.   def category_icon_index(index)
  360.     Bubs::TMI_ItemScene::CATEGORY_ICONS[@category_symbols[index]]
  361.   end
  362.  
  363.   #--------------------------------------------------------------------------
  364.   # adjust_index_range
  365.   #--------------------------------------------------------------------------
  366.   def adjust_index_range
  367.     sz = @category_symbols.size - 1
  368.     if @category_index == 0
  369.       @index_range = initial_range
  370.     elsif @category_index == sz
  371.       @index_range = final_range
  372.     elsif @category_index > @index_range[1]
  373.       @index_range[0] += 1
  374.       @index_range[1] += 1
  375.     elsif @category_index < @index_range[0]
  376.       @index_range[0] -= 1
  377.       @index_range[1] -= 1
  378.     end
  379.   end
  380.  
  381.   #--------------------------------------------------------------------------
  382.   # initial_range
  383.   #--------------------------------------------------------------------------
  384.   def initial_range
  385.     [0, icon_max - 1]
  386.   end
  387.  
  388.   #--------------------------------------------------------------------------
  389.   # final_range
  390.   #--------------------------------------------------------------------------
  391.   def final_range
  392.     [@category_symbols.size - icon_max, @category_symbols.size - 1]
  393.   end
  394.  
  395. end # class Window_TMI_ItemCategory
  396.  
  397.  
  398.  
  399. #==============================================================================
  400. # ++ Window_TMI_ItemList
  401. #==============================================================================
  402. class Window_TMI_ItemList < Window_ItemList
  403.   attr_accessor :category_index
  404.   #--------------------------------------------------------------------------
  405.   # initialize
  406.   #--------------------------------------------------------------------------
  407.   def initialize(x, y, width, height)
  408.     super
  409.     self.opacity = 0
  410.     @category_index = 0
  411.     initialize_categories
  412.     refresh
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # initialize_categories
  416.   #--------------------------------------------------------------------------
  417.   def initialize_categories
  418.     @category_keys = Bubs::TMI_ItemScene::CATEGORIES
  419.     @category = @category_keys[@category_index]
  420.   end
  421.  
  422.   #--------------------------------------------------------------------------
  423.   # update_help
  424.   #--------------------------------------------------------------------------
  425.   def update_help
  426.     @help_window.set_item(item)
  427.     @info_window.item = item if @info_window
  428.   end
  429.  
  430.   #--------------------------------------------------------------------------
  431.   # refresh
  432.   #--------------------------------------------------------------------------
  433.   def refresh
  434.     make_item_list
  435.     create_contents
  436.     draw_all_items
  437.     @category_window.category = @category if @category_window
  438.     call_update_help
  439.   end
  440.  
  441.   #--------------------------------------------------------------------------
  442.   # info_window=
  443.   #--------------------------------------------------------------------------
  444.   def info_window=(info_window)
  445.     @info_window = info_window
  446.   end
  447.  
  448.   #--------------------------------------------------------------------------
  449.   # category_window=
  450.   #--------------------------------------------------------------------------
  451.   def category_window=(category_window)
  452.     @category_window = category_window
  453.   end
  454.  
  455.   #--------------------------------------------------------------------------
  456.   # col_max
  457.   #--------------------------------------------------------------------------
  458.   def col_max
  459.     return 1
  460.   end
  461.  
  462.   #--------------------------------------------------------------------------
  463.   # item_max                                    # Get Number of Items
  464.   #--------------------------------------------------------------------------
  465.   def item_max
  466.     @data ? @data.size : 1
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # item                                          # Get Item
  470.   #--------------------------------------------------------------------------
  471.   def item
  472.     @data && index >= 0 ? @data[index] : nil
  473.   end
  474.  
  475.   #--------------------------------------------------------------------------
  476.   # current_item_enabled?         # Get Activation State of Selection Item
  477.   #--------------------------------------------------------------------------
  478.   def current_item_enabled?
  479.     enable?(@data[index])
  480.   end
  481.  
  482.   #--------------------------------------------------------------------------
  483.   # include?                              # Include in Item List?
  484.   #--------------------------------------------------------------------------
  485.   def include?(item)
  486.     if $imported["Tsuki_TagManager"] && category_tags.include?(@category)
  487.       return has_tag?(item)
  488.     end
  489.  
  490.     case @category
  491.     when :all
  492.       true
  493.     when :item
  494.       item.is_a?(RPG::Item) && !item.key_item?
  495.     when :weapon
  496.       item.is_a?(RPG::Weapon)
  497.     when :armor
  498.       item.is_a?(RPG::Armor)
  499.     when :key_item
  500.       item.is_a?(RPG::Item) && item.key_item?
  501.     else
  502.       false
  503.     end
  504.   end
  505.  
  506.   #--------------------------------------------------------------------------
  507.   # has_tag?          # Check if item has matching tag string
  508.   #--------------------------------------------------------------------------
  509.   def has_tag?(item)
  510.     return false unless item
  511.     return false unless category_tags.include?(@category)
  512.     category_tags[@category].each do |string|
  513.       return true if item.object_tags.include?(string.downcase)
  514.     end
  515.     return false
  516.   end
  517.  
  518.   #--------------------------------------------------------------------------
  519.   # category_tags
  520.   #--------------------------------------------------------------------------
  521.   def category_tags
  522.     Bubs::TMI_ItemScene::CATEGORY_TAGS
  523.   end
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # enable?                       # Display in Enabled State?
  527.   #--------------------------------------------------------------------------
  528.   def enable?(item)
  529.     $game_party.usable?(item)
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # make_item_list                    # Create Item List
  533.   #--------------------------------------------------------------------------
  534.   def make_item_list
  535.     @data = $game_party.all_items.select {|item| include?(item) }
  536.     sort_list if $imported["Tsuki_InventorySort"]
  537.   end
  538.  
  539.   #--------------------------------------------------------------------------
  540.   # select_last                   # Restore Previous Selection Position
  541.   #--------------------------------------------------------------------------
  542.   def select_last
  543.     select(@data.index($game_party.last_item.object) || 0)
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # draw_item
  547.   #--------------------------------------------------------------------------
  548.   def draw_item(index)
  549.     item = @data[index]
  550.     if item
  551.       rect = item_rect(index)
  552.       rect.width -= 4
  553.       draw_item_name(item, rect.x, rect.y, enable?(item))
  554.       draw_item_number(rect, item)
  555.     end
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # draw_item_number                        # Draw Number of Items
  559.   #--------------------------------------------------------------------------
  560.   def draw_item_number(rect, item)
  561.     draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  562.   end
  563.  
  564.   #--------------------------------------------------------------------------
  565.   # next_category_button
  566.   #--------------------------------------------------------------------------
  567.   def next_category_button
  568.     Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:next_category]
  569.   end
  570.  
  571.   #--------------------------------------------------------------------------
  572.   # prev_category_button
  573.   #--------------------------------------------------------------------------
  574.   def prev_category_button
  575.     Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:prev_category]
  576.   end
  577.  
  578.   #--------------------------------------------------------------------------
  579.   # cursor_pagedown_button
  580.   #--------------------------------------------------------------------------
  581.   def cursor_pagedown_button
  582.     Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:itemlist_pagedown]
  583.   end
  584.  
  585.   #--------------------------------------------------------------------------
  586.   # cursor_pageup_button
  587.   #--------------------------------------------------------------------------
  588.   def cursor_pageup_button
  589.     Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:itemlist_pageup]
  590.   end  
  591.   #--------------------------------------------------------------------------
  592.   # process_cursor_move                   # Cursor Movement Processing
  593.   #--------------------------------------------------------------------------
  594.   def process_cursor_move
  595.     change_category(1)   if Input.trigger?(next_category_button)
  596.     change_category(-1)    if Input.trigger?(prev_category_button)
  597.     return unless cursor_movable?
  598.     last_index = @index
  599.     cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  600.     cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  601.     cursor_pagedown   if Input.trigger?(cursor_pagedown_button)
  602.     cursor_pageup     if Input.trigger?(cursor_pageup_button)
  603.     Sound.play_cursor if @index != last_index
  604.   end
  605.  
  606.   #--------------------------------------------------------------------------
  607.   # change_category
  608.   #--------------------------------------------------------------------------
  609.   def change_category(value = 0)
  610.     @category_index += value
  611.     @category_index = @category_index % @category_keys.size
  612.     @category = @category_keys[@category_index]
  613.     self.select(0)
  614.     Sound.play_tmi_category_change
  615.     refresh
  616.   end
  617.  
  618. end # class Window_TMI_ItemList
  619.  
  620.  
  621.  
  622. #==============================================================================
  623. # ++ Scene_Item
  624. #------------------------------------------------------------------------------
  625. #  This class performs the item screen processing.
  626. #==============================================================================
  627. class Scene_Item < Scene_ItemBase
  628.   #--------------------------------------------------------------------------
  629.   # overwrite : start
  630.   #--------------------------------------------------------------------------
  631.   def start
  632.     super
  633.     check_tmi_scripts
  634.     create_help_window
  635.     create_dummy_window
  636.     create_category_window
  637.     create_info_window
  638.     create_item_window
  639.   end
  640.  
  641.   #--------------------------------------------------------------------------
  642.   # new method : check_tmi_scripts
  643.   #--------------------------------------------------------------------------
  644.   def check_tmi_scripts
  645.     return if $imported["BubsInfoPages"]
  646.     msgbox("TMI Item Scene requires the script \"Info Pages Window\"\n
  647.     Find it at [url]http://mrbubblewand.wordpress.com/[/url]")
  648.     exit
  649.   end
  650.  
  651.   #--------------------------------------------------------------------------
  652.   # new method : create_dummy_window
  653.   #--------------------------------------------------------------------------
  654.   def create_dummy_window
  655.     wy = @help_window.height
  656.     ww = Graphics.width / 2
  657.     wh = Graphics.height - wy
  658.     @dummy_window = Window_Base.new(0, wy, ww, wh)
  659.     @dummy_window.viewport = @viewport
  660.   end
  661.  
  662.   #--------------------------------------------------------------------------
  663.   # overwrite : create_category_window
  664.   #--------------------------------------------------------------------------
  665.   def create_category_window
  666.     wx = 0
  667.     wy = @help_window.height
  668.     ww = Graphics.width / 2
  669.     wh = @help_window.height
  670.     @category_window = Window_TMI_ItemCategory.new(wx, wy, ww, wh)
  671.     @category_window.viewport = @viewport
  672.   end  
  673.   #--------------------------------------------------------------------------
  674.   # new method : create_category_window
  675.   #--------------------------------------------------------------------------
  676.   def create_info_window
  677.     wx = Graphics.width / 2
  678.     wy = @help_window.height
  679.     ww = Graphics.width / 2
  680.     wh = Graphics.height - wy
  681.     @info_window = Window_InfoPages.new(wx, wy, ww, wh)
  682.     @info_window.viewport = @viewport
  683.   end
  684.  
  685.   #--------------------------------------------------------------------------
  686.   # overwrite : create_item_window
  687.   #--------------------------------------------------------------------------
  688.   def create_item_window
  689.     wy = @help_window.height * 2 - 24
  690.     wh = Graphics.height - wy
  691.     @item_window = Window_TMI_ItemList.new(0, wy, Graphics.width / 2, wh)
  692.     @item_window.viewport = @viewport
  693.     @item_window.help_window = @help_window
  694.     @item_window.set_handler(:ok,     method(:on_item_ok))
  695.     @item_window.set_handler(:cancel, method(:return_scene))
  696.     @item_window.category_window = @category_window
  697.     @item_window.info_window = @info_window
  698.     @item_window.activate.select(0)
  699.   end
  700.  
  701.   #--------------------------------------------------------------------------
  702.   # inherit overwrite : on_item_cancel
  703.   #--------------------------------------------------------------------------
  704.   def on_item_cancel
  705.   end
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # inherit overwrite : cursor_left? # Determine if Cursor Is in Left Column
  709.   #--------------------------------------------------------------------------
  710.   def cursor_left?
  711.     return true
  712.   end
  713.  
  714. end # class Scene_Item

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10074
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

2
发表于 2014-9-2 09:48:08 | 只看该作者
你写在哪里的?这个脚本可能覆盖了原来的物品脚本,所以写在自带的脚本里面可能会被覆盖。没有效果的

点评

不对……窗口已经deactivated了,但是按左右键还是能切换物品标签,请问怎么改?  发表于 2014-9-2 12:18
class Window_TMI_ItemCategory < Window_Base 这个窗口请问怎么取消激活?  发表于 2014-9-2 11:58
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
685
在线时间
661 小时
注册时间
2012-10-21
帖子
350
3
 楼主| 发表于 2014-9-2 09:53:13 | 只看该作者
VIPArcher 发表于 2014-9-2 09:48
你写在哪里的?这个脚本可能覆盖了原来的物品脚本,所以写在自带的脚本里面可能会被覆盖。没有效果的
...

我有个丢弃物品的脚本,按下按键可丢弃一定数量的物品,在原版物品栏中,选择数量时,物品栏是deactivated的,只能操作弹出的选择丢弃数量的window,但是用了这脚本后,我在选择丢弃数量时(左右键),后面的物品栏也在翻页,没有deactivated。所以问如何把这个物品栏脚本窗口给deactivate掉呢?


RUBY 代码复制
  1. #==============================================================================
  2. # ~~Throw Items Away~~                                                                                                                         v1.0 (26/03/2012)
  3. #==============================================================================
  4. # Script by:
  5. #                Claimh
  6. #
  7. # Translation by:
  8. #                Albic
  9. #==============================================================================
  10. # Terms of use:
  11. # * You are allowed to use this script in commercial and non-commercial products,
  12. #   but if you use it in a commercial product, you have to send me an e-mail, to
  13. #   let me know to: "[email protected]"!
  14. #
  15. # * You are allowed to edit everything for yourself, but you are not allowed to
  16. #   post this script as yours or post it at other websites without permission!
  17. #
  18. # * You have to credit me and Claimh as well!
  19. #
  20. # * You have to have a link to Code Crush:
  21. #   [url]http://www4.plala.or.jp/findias/codecrush/[/url]
  22. #=============================================================================
  23.  
  24.  
  25. #==============================================================================
  26. # ■ Window_ItemList
  27. #==============================================================================
  28. class Window_ItemList < Window_Selectable
  29.   #--------------------------------------------------------------------------
  30.   # ● Handling processing such as decision and cancellation
  31.   #--------------------------------------------------------------------------
  32.   def process_handling
  33.         return unless open? && active
  34.         return call_handler(:append_x)   if handle?(:append_x) && Input.trigger?(:R)
  35.         super
  36.   end
  37. end
  38.  
  39. #==============================================================================
  40. # ■ Window_ItemNumber
  41. #==============================================================================
  42. class Window_ItemNumber < Window_ShopNumber
  43.   #--------------------------------------------------------------------------
  44.   # ● Open instance variable
  45.   #--------------------------------------------------------------------------
  46.   attr_reader   :number                                   # The input quantity
  47.   #--------------------------------------------------------------------------
  48.   # ● Object initialization
  49.   #--------------------------------------------------------------------------
  50.   def initialize
  51.         x = (Graphics.width - window_width) / 2
  52.         super(x, 200, line_height*2 + 32)
  53.         @item = nil
  54.         [url=home.php?mod=space&uid=25307]@Max[/url] = 1
  55.         @number = 1
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● Setting of item and maximum quantity
  59.   #--------------------------------------------------------------------------
  60.   def set(item, max)
  61.         @item = item
  62.         @max = max
  63.         @number = 1
  64.         refresh
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● Refresh
  68.   #--------------------------------------------------------------------------
  69.   def refresh
  70.         contents.clear
  71.         contents.draw_text(0, 0, 200, line_height, "Throw away:")
  72.         draw_item_name(@item, 4, line_height)
  73.         draw_number
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● Y-coordinate of item name display line
  77.   #--------------------------------------------------------------------------
  78.   def item_y
  79.         line_height
  80.   end
  81. end
  82.  
  83.  
  84. #==============================================================================
  85. # ■ Scene_Item
  86. #==============================================================================
  87. class Scene_Item < Scene_ItemBase
  88.   #--------------------------------------------------------------------------
  89.   # ● Start processing
  90.   #--------------------------------------------------------------------------
  91.   alias start_dump start
  92.   def start
  93.         start_dump
  94.         create_item_dump_window
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● Compilation of item window
  98.   #--------------------------------------------------------------------------
  99.   alias create_item_window_dump create_item_window
  100.   def create_item_window
  101.         create_item_window_dump
  102.         @item_window.set_handler(:append_x, method(:on_item_dump))
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● Compilation of item several selective windows
  106.   #--------------------------------------------------------------------------
  107.   def create_item_dump_window
  108.         @number_window = Window_ItemNumber.new
  109.         @number_window.viewport = @viewport
  110.         @number_window.hide
  111.         @number_window.set_handler(:ok,         method(:on_number_ok))
  112.         @number_window.set_handler(:cancel, method(:on_number_cancel))
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● Item(You throw away)
  116.   #--------------------------------------------------------------------------
  117.   def on_item_dump
  118.         if item_dumpable?
  119.           Sound.play_ok
  120.           @number_window.set(item, max_item)
  121.           @number_window.show.activate
  122.           @item_window.deactivate ###!!!!
  123.  
  124.     #@category_window.deactivate##
  125.  
  126.         else
  127.           Sound.play_buzzer
  128.         end
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● Quantity input (decision)
  132.   #--------------------------------------------------------------------------
  133.   def on_number_ok
  134.         Sound.play_ok
  135.         do_item_dump(@number_window.number)
  136.         @number_window.hide
  137.         activate_item_window
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● Quantity input (cancellation)
  141.   #--------------------------------------------------------------------------
  142.   def on_number_cancel
  143.         Sound.play_cancel
  144.         @number_window.hide
  145.         activate_item_window
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● Throw away
  149.   #--------------------------------------------------------------------------
  150.   def do_item_dump(number)
  151.         $game_party.lose_item(item, number)
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● The decision which throws away the item
  155.   #--------------------------------------------------------------------------
  156.   def item_dumpable?
  157.         item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● Acquisition of the frequency of possession
  161.   #--------------------------------------------------------------------------
  162.   def max_item
  163.         $game_party.item_number(item)
  164.   end
  165. end
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
269 小时
注册时间
2014-5-9
帖子
127

开拓者

4
发表于 2014-9-2 09:53:48 | 只看该作者
在这个脚本中搜索start,把取消激活的语句放在这个方法的最后即可。
泉眼无声惜细流,树阴照水爱晴柔。
小荷才露尖尖角,早有蜻蜓立上头。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
685
在线时间
661 小时
注册时间
2012-10-21
帖子
350
5
 楼主| 发表于 2014-9-2 09:56:02 | 只看该作者
泉塚四季 发表于 2014-9-2 09:53
在这个脚本中搜索start,把取消激活的语句放在这个方法的最后即可。

  def start
    super
    check_tmi_scripts
    create_help_window
    create_dummy_window
    create_category_window
    create_info_window
    create_item_window
  end

然后要怎么做?
我是在其他脚本里要取消激活这个脚本的窗口

点评

就是无效了才问的  发表于 2014-9-2 11:49
如果你问的是三楼那个的话,把三楼的脚本放到这个脚本之后试试  发表于 2014-9-2 10:11
deactivate  发表于 2014-9-2 10:00
deacvitate  发表于 2014-9-2 09:59
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21616
在线时间
9412 小时
注册时间
2012-6-19
帖子
7118

开拓者短篇九导演组冠军

6
发表于 2014-9-2 20:15:30 | 只看该作者
把这个脚本插入到那两个脚本的后面
  1. class Window_TMI_ItemList
  2.   alias m5_change_category change_category
  3.   def change_category(value = 0)
  4.     return unless self.active
  5.     m5_change_category(value)
  6.   end
  7. end
复制代码

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-14 10:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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