查看: 2563|回复: 5

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

[复制链接]
梦石
0
星屑
710
在线时间
663 小时
注册时间
2012-10-21
回帖
251
发表于 2014-9-2 09:28:48 | 显示全部楼层 |阅读模式

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

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

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

[pre lang="ruby" line="1"]# ╔══════════════════════════════════════════════════════╤═══════╤═══════════╗
# ║ Too Much Information Item Scene                      │ v1.01 │ (5/22/13) ║
# ╚══════════════════════════════════════════════════════╧═══════╧═══════════╝
# Script by:
#     Mr. Bubble ( http://mrbubblewand.wordpress.com/ )
# Thanks:
#     Tsukihime, Tag Manager script
#--------------------------------------------------------------------------
# This script remodels the item scene so that more information about
# items may be viewed by players. People familiar with my Tactics
# Ogre PSP Crafting System script will find the window aesthetic
# similar in style.
#
# The type of information you can provide players is customized in the
# Info Pages Window's customization module.
#
# Additionally, this script significantly changes the category selection
# function in the item scene. By default, players must select a category
# before being able to view their inventory. With this script, players
# may select items immediately after entering the item scene. The
# item category is changed by using other gamepad buttons. This makes
# the inventory interface more inline with console RPGs.
#
# More item category filters can be made with Tsukihime's Tag Manager
# script.
#--------------------------------------------------------------------------
#      Changelog   
#--------------------------------------------------------------------------
# v1.01 : Compatibility Update: Tsukihime's "Inventory Sorting". (5/22/2013)
# v1.00 : Initial release. (4/14/2013)
#--------------------------------------------------------------------------
#      Installation and Requirements
#--------------------------------------------------------------------------
# Install this script in the Materials section in your project's
# script editor. This script is not plug-and-play and requires
# multiple other scripts in order to function.
#
#     "Info Pages Window" - by Mr. Bubble
#         http://wp.me/PxlCT-tA
#     "Reader Functions for Features/Effects" v1.4+ - by Mr. Bubble
#         http://wp.me/PxlCT-rC
#     
# Additionally, I recommend installing two extra, optional scripts in
# order to fully utilize some settings in this script:
#
#     "Tag Manager" - by Tsukihime
#         http://himeworks.wordpress.com/2013/03/07/tag-manager/
#     "Text Cache" - by Mithran
#         http://forums.rpgmakerweb.com/index.php?/topic/1001-text-cache/
#--------------------------------------------------------------------------
#      Compatibility
#--------------------------------------------------------------------------
# This script overwrites the following default VXA methods:
#
#     Scene_Item#start
#     Scene_Item#create_category_window
#     Scene_Item#create_item_window
#     Scene_Item#on_item_cancel
#
# Built-in script compatibility with:
#
#     -Tsukihime's "Inventory Sorting"
#
# This script will have issues with other scripts that also modify the
# default item scene.
#--------------------------------------------------------------------------
#      Terms and Conditions   
#--------------------------------------------------------------------------
# Please do not repost this script elsewhere without permission.
# Free for non-commercial use. For commercial use, contact me first.
#
# Newest versions of this script can be found at
#                                           http://mrbubblewand.wordpress.com/
#=============================================================================

$imported ||= {}
$imported["Bubs_TMI_ItemScene"] = 1.01

#==========================================================================
# ++ START OF USER CUSTOMIZATION MODULE ++
#==========================================================================
module Bubs
  #==========================================================================
  # ++ TMI Item Scene Settings
  #==========================================================================
  module TMI_ItemScene
  #--------------------------------------------------------------------------
  #   Item Scene Categories
  #--------------------------------------------------------------------------
  # This setting determines which categories appear in the item scene.
  # The order of symbols in the array determines
  # the order seen in the item scene.
  #
  # Custom categories can only be used if Tsukihime's Tag Manager
  # script is also installed. Define new categories in the
  # TSUKIHIME_CATEGORY_TAGS setting. For example, if :sword is
  # defined in TSUKIHIME_CATEGORY_TAGS, you may add :sword into the
  # CATEGORIES array.
  #
  # There is no limit on the amount of symbols you may list in the array.
  #
  # Default category symbols:
  #   :all, :item, :weapon, :armor, :key_item
  CATEGORIES = [:all, :food, :weapon, :armor, :material, :key_item]
  
  #--------------------------------------------------------------------------
  #   Custom Category Definitions
  #--------------------------------------------------------------------------
  # !! This section requires Tsukihime's Tag Manager script. !!
  #
  # This setting allows you to create custom categories based on the
  # tags you give them. For more information, please read the comments
  # in the Tag Manager script.
  #
  # For example, if a weapon has the tag '<tag: sword, metal>' in its notebox,
  # it will appear under any category which has "sword" or "metal" in
  # its tag array.
  #
  # The pre-defined categories here serve as examples and can be freely
  # modified.
  CATEGORY_TAGS = {
  # :symbol         => ["string1", "string2", ...],
    :sword          => ["sword", "rapier", "great sword"],
    :polearm        => ["spear", "polearm", "scythe"],
    :axe            => ["axe", "ax", "great axe", "hatchet"],
    :staff          => ["staff", "stave", "cane"],
    :light_armor    => ["robe", "light_armor", "dress", "shirt"],
    :heavy_armor    => ["chain_mail", "mail", "plate_mail", "heavy_armor"],
    :shield         => ["shield", "buckler"],
    :accessory      => ["ring", "brooch", "necklace", "medal"],
    :material        => ["material"],
    :food        => ["food"],
    # Define more categories here!
   
  } # <- Do not delete.
  
  #--------------------------------------------------------------------------
  #   Category Icons
  #--------------------------------------------------------------------------
  # This setting lets you define which icons represent a category.
  # The format for creating a new entry is:
  #   
  #       :symbol => icon_index,
  #
  # where :symbol is a symbol from CATEGORY_TAGS hash.
  CATEGORY_ICONS = {
    # Default category icons
    :all          => 270,
    :item         => 192,
    :weapon       => 147,
    :armor        => 170,
    :key_item     => 243,
    # Custom category icons
    :sword        => 147,
    :polearm      => 146,
    :staff        => 152,
    :axe          => 144,
    :shield       => 506,
    :light_armor  => 183,
    :heavy_armor  => 170,
    :material     => 170,
    # Define more icons here
   
  } # <- Do not delete.
  
  #--------------------------------------------------------------------------
  #   Default Category Icon
  #--------------------------------------------------------------------------
  # If a category icon index number is not defined in CATEGORY_ICONS, it will
  # use this default index.
  CATEGORY_ICONS.default = 261
  
  #--------------------------------------------------------------------------
  #   Category Background Icon
  #--------------------------------------------------------------------------
  # This setting defines the icon displayed behind category icons. If set
  # to 0, a background icon will not be used.
  CATEGORY_ICON_BACKGROUND = 16
  
  #--------------------------------------------------------------------------
  #   Item Scene Button Settings
  #--------------------------------------------------------------------------
  # This setting determine which gamepad buttons change aspects of the
  # item scene such as changing categories or changing the info window.
  # Default buttons that you can use include:
  #
  # :LEFT, :RIGHT
  # :A, :B, :C, :X, :Y, :Z, :L, :R
  # :SHIFT, :CTRL, :ALT
  ITEM_SCENE_BUTTONS = {
    :next_category      => :RIGHT,
    :prev_category      => :LEFT,
    :itemlist_pagedown  => :R,
    :itemlist_pageup    => :L,
  } # <- Do not delete.
  
  #--------------------------------------------------------------------------
  #   Button Icons
  #--------------------------------------------------------------------------
  # This setting defines the icons used to represent buttons in the item
  # scene.
  BUTTON_ICONS = {
    :next_category      => 0, # Next Category Button Icon
    :prev_category      => 0, # Previous Category Button Icon
  } # <- Do not delete.
  
  #--------------------------------------------------------------------------
  #   Category Change Sound Effect
  #--------------------------------------------------------------------------
  # Filename : SE filename in Audio/SE/ folder
  # Volume   : Between 0~100
  # Pitch    : Between 50~150
  #
  #                      Filename, Volume, Pitch
  CATEGORY_CHANGE_SE = ["Cursor1",     80,   100]
  
  end # module TMI_ItemScene
end # module Bubs


#==========================================================================
# ++ END OF USER CUSTOMIZATION MODULE ++
#==========================================================================


#==============================================================================
# ++ Sound
#==============================================================================
module Sound
  #--------------------------------------------------------------------------
  # new method : play_tmi_category_change
  #--------------------------------------------------------------------------
  def self.play_tmi_category_change
    filename = Bubs::TMI_ItemScene::CATEGORY_CHANGE_SE[0]
    volume   = Bubs::TMI_ItemScene::CATEGORY_CHANGE_SE[1]
    pitch    = Bubs::TMI_ItemScene::CATEGORY_CHANGE_SE[2]
    Audio.se_play("Audio/SE/" + filename, volume, pitch)
  end
end # module Sound



#==============================================================================
# ++ Window_TMI_ItemCategory
#==============================================================================
class Window_TMI_ItemCategory < Window_Base
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    self.opacity = 0
    @category_index = 0
    initialize_categories
    adjust_index_range
    refresh
  end
  
  #--------------------------------------------------------------------------
  # initialize_categories
  #--------------------------------------------------------------------------
  def initialize_categories
    @category_symbols = Bubs::TMI_ItemScene::CATEGORIES
    @category = @category_symbols[@category_index]
  end
  
  #--------------------------------------------------------------------------
  # category=
  #--------------------------------------------------------------------------
  def category=(symbol)
    @category = symbol
    @category_index = @category_symbols.index(@category)
    refresh
  end
   
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_horz_line(line_height)
    adjust_index_range
    draw_category_icons
    draw_category_button_icons(0, 0)
  end
   
  #--------------------------------------------------------------------------
  # draw_horz_line
  #--------------------------------------------------------------------------
  def draw_horz_line(y)
    line_y = y + line_height / 2 - 1
    color = normal_color
    color.alpha = 48
    contents.fill_rect(0, line_y, contents_width, 2, color)
  end
  
  #--------------------------------------------------------------------------
  # draw_category_icons
  #--------------------------------------------------------------------------
  def draw_category_icons
    x = (contents_width / 2) - (icon_row_width / 2) - icon_adjustment
    for index in @index_range[0]..@index_range[1]
      bool = index == @category_index
      x += icon_width
      draw_icon(16, x, 0, bool)
      draw_icon(category_icon_index(index), x, 0, bool)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_category_button_icons
  #--------------------------------------------------------------------------
  def draw_category_button_icons(x, y)
    draw_icon(category_button_icon_index(:prev_category), x, y)
    x = x + contents_width - icon_width
    draw_icon(category_button_icon_index(:next_category), x, y)
  end
  
  #--------------------------------------------------------------------------
  # category_button_icon_index
  #--------------------------------------------------------------------------
  def category_button_icon_index(symbol)
    Bubs::TMI_ItemScene::BUTTON_ICONS[symbol]
  end
  
  #--------------------------------------------------------------------------
  # icon_adjustment
  #--------------------------------------------------------------------------
  def icon_adjustment
    return 25
  end
  
  #--------------------------------------------------------------------------
  # icon_width
  #--------------------------------------------------------------------------
  def icon_width
    return 24
  end
  
  #--------------------------------------------------------------------------
  # icon_row_width
  #--------------------------------------------------------------------------
  def icon_row_width
    icon_width * icon_max
  end
  
  #--------------------------------------------------------------------------
  # icon_max
  #--------------------------------------------------------------------------
  def icon_max
    num = @category_symbols.size
    return [14, num].min if Graphics.width == 736
    return [8, num].min
  end
  
  #--------------------------------------------------------------------------
  # icon_by_index
  #--------------------------------------------------------------------------
  def category_icon_index(index)
    Bubs::TMI_ItemScene::CATEGORY_ICONS[@category_symbols[index]]
  end
  
  #--------------------------------------------------------------------------
  # adjust_index_range
  #--------------------------------------------------------------------------
  def adjust_index_range
    sz = @category_symbols.size - 1
    if @category_index == 0
      @index_range = initial_range
    elsif @category_index == sz
      @index_range = final_range
    elsif @category_index > @index_range[1]
      @index_range[0] += 1
      @index_range[1] += 1
    elsif @category_index < @index_range[0]
      @index_range[0] -= 1
      @index_range[1] -= 1
    end
  end
  
  #--------------------------------------------------------------------------
  # initial_range
  #--------------------------------------------------------------------------
  def initial_range
    [0, icon_max - 1]
  end
  
  #--------------------------------------------------------------------------
  # final_range
  #--------------------------------------------------------------------------
  def final_range
    [@category_symbols.size - icon_max, @category_symbols.size - 1]
  end

end # class Window_TMI_ItemCategory



#==============================================================================
# ++ Window_TMI_ItemList
#==============================================================================
class Window_TMI_ItemList < Window_ItemList
  attr_accessor :category_index
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    self.opacity = 0
    @category_index = 0
    initialize_categories
    refresh
  end
  #--------------------------------------------------------------------------
  # initialize_categories
  #--------------------------------------------------------------------------
  def initialize_categories
    @category_keys = Bubs::TMI_ItemScene::CATEGORIES
    @category = @category_keys[@category_index]
  end
  
  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item)
    @info_window.item = item if @info_window
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    make_item_list
    create_contents
    draw_all_items
    @category_window.category = @category if @category_window
    call_update_help
  end
  
  #--------------------------------------------------------------------------
  # info_window=
  #--------------------------------------------------------------------------
  def info_window=(info_window)
    @info_window = info_window
  end
  
  #--------------------------------------------------------------------------
  # category_window=
  #--------------------------------------------------------------------------
  def category_window=(category_window)
    @category_window = category_window
  end

  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  
  #--------------------------------------------------------------------------
  # item_max                                    # Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # item                                          # Get Item
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  
  #--------------------------------------------------------------------------
  # current_item_enabled?         # Get Activation State of Selection Item
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  
  #--------------------------------------------------------------------------
  # include?                              # Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    if $imported["Tsuki_TagManager"] && category_tags.include?(@category)
      return has_tag?(item)
    end
   
    case @category
    when :all
      true
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  
  #--------------------------------------------------------------------------
  # has_tag?          # Check if item has matching tag string
  #--------------------------------------------------------------------------
  def has_tag?(item)
    return false unless item
    return false unless category_tags.include?(@category)
    category_tags[@category].each do |string|
      return true if item.object_tags.include?(string.downcase)
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # category_tags
  #--------------------------------------------------------------------------
  def category_tags
    Bubs::TMI_ItemScene::CATEGORY_TAGS
  end
  
  #--------------------------------------------------------------------------
  # enable?                       # Display in Enabled State?
  #--------------------------------------------------------------------------
  def enable?(item)
    $game_party.usable?(item)
  end
  #--------------------------------------------------------------------------
  # make_item_list                    # Create Item List
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) }
    sort_list if $imported["Tsuki_InventorySort"]
  end
  
  #--------------------------------------------------------------------------
  # select_last                   # Restore Previous Selection Position
  #--------------------------------------------------------------------------
  def select_last
    select(@data.index($game_party.last_item.object) || 0)
  end
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enable?(item))
      draw_item_number(rect, item)
    end
  end
  #--------------------------------------------------------------------------
  # draw_item_number                        # Draw Number of Items
  #--------------------------------------------------------------------------
  def draw_item_number(rect, item)
    draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  end
  
  #--------------------------------------------------------------------------
  # next_category_button
  #--------------------------------------------------------------------------
  def next_category_button
    Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:next_category]
  end
  
  #--------------------------------------------------------------------------
  # prev_category_button
  #--------------------------------------------------------------------------
  def prev_category_button
    Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:prev_category]
  end
  
  #--------------------------------------------------------------------------
  # cursor_pagedown_button
  #--------------------------------------------------------------------------
  def cursor_pagedown_button
    Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:itemlist_pagedown]
  end
  
  #--------------------------------------------------------------------------
  # cursor_pageup_button
  #--------------------------------------------------------------------------
  def cursor_pageup_button
    Bubs::TMI_ItemScene::ITEM_SCENE_BUTTONS[:itemlist_pageup]
  end  
  #--------------------------------------------------------------------------
  # process_cursor_move                   # Cursor Movement Processing
  #--------------------------------------------------------------------------
  def process_cursor_move
    change_category(1)   if Input.trigger?(next_category_button)
    change_category(-1)    if Input.trigger?(prev_category_button)
    return unless cursor_movable?
    last_index = @index
    cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
    cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
    cursor_pagedown   if Input.trigger?(cursor_pagedown_button)
    cursor_pageup     if Input.trigger?(cursor_pageup_button)
    Sound.play_cursor if @index != last_index
  end
  
  #--------------------------------------------------------------------------
  # change_category
  #--------------------------------------------------------------------------
  def change_category(value = 0)
    @category_index += value
    @category_index = @category_index % @category_keys.size
    @category = @category_keys[@category_index]
    self.select(0)
    Sound.play_tmi_category_change
    refresh
  end
  
end # class Window_TMI_ItemList



#==============================================================================
# ++ Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================
class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # overwrite : start
  #--------------------------------------------------------------------------
  def start
    super
    check_tmi_scripts
    create_help_window
    create_dummy_window
    create_category_window
    create_info_window
    create_item_window
  end
  
  #--------------------------------------------------------------------------
  # new method : check_tmi_scripts
  #--------------------------------------------------------------------------
  def check_tmi_scripts
    return if $imported["BubsInfoPages"]
    msgbox("TMI Item Scene requires the script \"Info Pages Window\"\n
    Find it at http://mrbubblewand.wordpress.com/")
    exit
  end
  
  #--------------------------------------------------------------------------
  # new method : create_dummy_window
  #--------------------------------------------------------------------------
  def create_dummy_window
    wy = @help_window.height
    ww = Graphics.width / 2
    wh = Graphics.height - wy
    @dummy_window = Window_Base.new(0, wy, ww, wh)
    @dummy_window.viewport = @viewport
  end
  
  #--------------------------------------------------------------------------
  # overwrite : create_category_window
  #--------------------------------------------------------------------------
  def create_category_window
    wx = 0
    wy = @help_window.height
    ww = Graphics.width / 2
    wh = @help_window.height
    @category_window = Window_TMI_ItemCategory.new(wx, wy, ww, wh)
    @category_window.viewport = @viewport
  end  
  #--------------------------------------------------------------------------
  # new method : create_category_window
  #--------------------------------------------------------------------------
  def create_info_window
    wx = Graphics.width / 2
    wy = @help_window.height
    ww = Graphics.width / 2
    wh = Graphics.height - wy
    @info_window = Window_InfoPages.new(wx, wy, ww, wh)
    @info_window.viewport = @viewport
  end

  #--------------------------------------------------------------------------
  # overwrite : create_item_window
  #--------------------------------------------------------------------------
  def create_item_window
    wy = @help_window.height * 2 - 24
    wh = Graphics.height - wy
    @item_window = Window_TMI_ItemList.new(0, wy, Graphics.width / 2, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:return_scene))
    @item_window.category_window = @category_window
    @item_window.info_window = @info_window
    @item_window.activate.select(0)
  end

  #--------------------------------------------------------------------------
  # inherit overwrite : on_item_cancel
  #--------------------------------------------------------------------------
  def on_item_cancel
  end
  
  #--------------------------------------------------------------------------
  # inherit overwrite : cursor_left? # Determine if Cursor Is in Left Column
  #--------------------------------------------------------------------------
  def cursor_left?
    return true
  end
  
end # class Scene_Item
[/pre]

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

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

点评

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

使用道具 举报

梦石
0
星屑
710
在线时间
663 小时
注册时间
2012-10-21
回帖
251
 楼主| 发表于 2014-9-2 09:53:13 | 显示全部楼层
VIPArcher 发表于 2014-9-2 09:48
你写在哪里的?这个脚本可能覆盖了原来的物品脚本,所以写在自带的脚本里面可能会被覆盖。没有效果的
...

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


[pre lang="ruby" line="1"]#==============================================================================
# ~~Throw Items Away~~                                                                                                                         v1.0 (26/03/2012)
#==============================================================================
# Script by:
#                Claimh
#
# Translation by:
#                Albic
#==============================================================================
# Terms of use:
# * You are allowed to use this script in commercial and non-commercial products,
#   but if you use it in a commercial product, you have to send me an e-mail, to
#   let me know to: "albic@spellcraftgaming.net"!
#
# * You are allowed to edit everything for yourself, but you are not allowed to
#   post this script as yours or post it at other websites without permission!
#
# * You have to credit me and Claimh as well!
#
# * You have to have a link to Code Crush:
#   http://www4.plala.or.jp/findias/codecrush/
#=============================================================================


#==============================================================================
# ■ Window_ItemList
#==============================================================================
class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● Handling processing such as decision and cancellation
  #--------------------------------------------------------------------------
  def process_handling
        return unless open? && active
        return call_handler(:append_x)   if handle?(:append_x) && Input.trigger?(:R)
        super
  end
end

#==============================================================================
# ■ Window_ItemNumber
#==============================================================================
class Window_ItemNumber < Window_ShopNumber
  #--------------------------------------------------------------------------
  # ● Open instance variable
  #--------------------------------------------------------------------------
  attr_reader   :number                                   # The input quantity
  #--------------------------------------------------------------------------
  # ● Object initialization
  #--------------------------------------------------------------------------
  def initialize
        x = (Graphics.width - window_width) / 2
        super(x, 200, line_height*2 + 32)
        @item = nil
        @Max = 1
        @number = 1
  end
  #--------------------------------------------------------------------------
  # ● Setting of item and maximum quantity
  #--------------------------------------------------------------------------
  def set(item, max)
        @item = item
        @max = max
        @number = 1
        refresh
  end
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------
  def refresh
        contents.clear
        contents.draw_text(0, 0, 200, line_height, "Throw away:")
        draw_item_name(@item, 4, line_height)
        draw_number
  end
  #--------------------------------------------------------------------------
  # ● Y-coordinate of item name display line
  #--------------------------------------------------------------------------
  def item_y
        line_height
  end
end


#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● Start processing
  #--------------------------------------------------------------------------
  alias start_dump start
  def start
        start_dump
        create_item_dump_window
  end
  #--------------------------------------------------------------------------
  # ● Compilation of item window
  #--------------------------------------------------------------------------
  alias create_item_window_dump create_item_window
  def create_item_window
        create_item_window_dump
        @item_window.set_handler(:append_x, method(:on_item_dump))
  end
  #--------------------------------------------------------------------------
  # ● Compilation of item several selective windows
  #--------------------------------------------------------------------------
  def create_item_dump_window
        @number_window = Window_ItemNumber.new
        @number_window.viewport = @viewport
        @number_window.hide
        @number_window.set_handler(:ok,         method(:on_number_ok))
        @number_window.set_handler(:cancel, method(:on_number_cancel))
  end
  #--------------------------------------------------------------------------
  # ● Item(You throw away)
  #--------------------------------------------------------------------------
  def on_item_dump
        if item_dumpable?
          Sound.play_ok
          @number_window.set(item, max_item)
          @number_window.show.activate
          @item_window.deactivate ###!!!!

    #@category_window.deactivate##
   
        else
          Sound.play_buzzer
        end
  end
  #--------------------------------------------------------------------------
  # ● Quantity input (decision)
  #--------------------------------------------------------------------------
  def on_number_ok
        Sound.play_ok
        do_item_dump(@number_window.number)
        @number_window.hide
        activate_item_window
  end
  #--------------------------------------------------------------------------
  # ● Quantity input (cancellation)
  #--------------------------------------------------------------------------
  def on_number_cancel
        Sound.play_cancel
        @number_window.hide
        activate_item_window
  end
  #--------------------------------------------------------------------------
  # ● Throw away
  #--------------------------------------------------------------------------
  def do_item_dump(number)
        $game_party.lose_item(item, number)
  end
  #--------------------------------------------------------------------------
  # ● The decision which throws away the item
  #--------------------------------------------------------------------------
  def item_dumpable?
        item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
  end
  #--------------------------------------------------------------------------
  # ● Acquisition of the frequency of possession
  #--------------------------------------------------------------------------
  def max_item
        $game_party.item_number(item)
  end
end[/pre]
回复

使用道具 举报

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

开拓者

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

使用道具 举报

梦石
0
星屑
710
在线时间
663 小时
注册时间
2012-10-21
回帖
251
 楼主| 发表于 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
回复

使用道具 举报

梦石
1
星屑
23246
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 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 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部