Project1

标题: 想在scene item內加一window 顯示大圖像 [打印本页]

作者: baggiochan    时间: 2007-7-14 19:26
标题: 想在scene item內加一window 顯示大圖像
小弟對scene_item做了些修改,現在我希望能在此基礎上多顯示一個window來顯示物品,武器及裝備的大圖示,希望有高人能幫手.window 沒什麼規格要求, 我自己微調就可以了. 現我把我的scene_item 貼出來, 當中的"back0", "back1","back2"是背景, 隨意放一張圖就可以的了~~~

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs item screen processing.
#==============================================================================

######################
# Window_Target_Item #
######################

class Window_Target_Item < Window_Selectable
def initialize
   super(0, 80, 280, 420)
   self.contents = Bitmap.new(width - 32, height - 12)
   self.z += 10
   @item_max = $game_party.actors.size
   refresh
end
def refresh
   self.contents.clear
   for i in 0...$game_party.actors.size
     x = 4
     y = i * 65
     actor = $game_party.actors
     draw_actor_name(actor, x + 150, y - 4)
     draw_actor_state(actor, x + 150, y + 28)
     draw_actor_hp(actor, x + 15, y - 4)
     draw_actor_sp(actor, x + 15, y + 28)
     end
end
def update_cursor_rect
   if @index <= -2
     self.cursor_rect.set(0, (@index + 10) * 65, self.width - 55, 60)
     elsif @index == -1
     self.cursor_rect.set(0, 0, self.width - 55, @item_max * 64 )
     else
     self.cursor_rect.set(0, @index * 65, self.width - 55, 60)
    end
end
end
############
# Type_Sel #
############
class Type_Sel < Window_Base
attr_reader   :index                    
attr_reader   :help_window            
def initialize(x, y, width, height)
   super(x, y, width, height)
   @item_max = 1
   @column_max = 1
   @index = -1
end
def index=(index)
   @index = index
end
def row_max
   return (@item_max + @column_max - 1) / @column_max
end
def top_row
   return self.oy / 32
end
def top_row=(row)
   if row < 0
     row = 0
   end
   if row > row_max - 1
     row = row_max - 1
   end
   self.oy = row * 32
end
def page_row_max
   return (self.height - 32) / 32
end
def page_item_max
   return page_row_max * @column_max
end
def update
   super
   if self.active and @item_max > 0 and @index >= 0
     if Input.repeat?(Input::RIGHT)
       if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
          @index < @item_max - @column_max
         $game_system.se_play($data_system.cursor_se)
         @index = (@index + @column_max) % @item_max
       end
     end
     if Input.repeat?(Input::LEFT)
       if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
          @index >= @column_max
         $game_system.se_play($data_system.cursor_se)
         @index = (@index - @column_max + @item_max) % @item_max
       end
     end
   end
end
end
###############
# Window_Type #
###############
class Window_Type < Type_Sel
def initialize
   super(0, 0, 0, 0)
   @item_max = 3
   self.index = 0
end
end
##################
# Window_Item_Ex #
##################
class Window_Item_Ex < Window_Selectable
def initialize
   super(250, 50, 295, 350)
   @column_max = 1
   refresh
   self.index = 0
   if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
end
def item
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   for i in 1...$data_items.size
     if $game_party.item_number(i) > 0
       @data.push($data_items)
     end
   end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   case item
   when RPG::Item
     number = $game_party.item_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 1 * (288 + 32)
   y = index / 1 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128   
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
   self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
   
end
def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#################
# Window_Weapon #
#################
class Window_Weapon < Window_Selectable
def initialize
   super(250, 50, 295, 350)
   @column_max = 1
   refresh
   self.index = 0
    if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
end
def item
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
     for i in 1...$data_weapons.size
       if $game_party.weapon_number(i) > 0
         @data.push($data_weapons)
       end
     end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   case item
   when RPG::Weapon
     number = $game_party.weapon_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 1 * (288 + 32)
   y = index / 1 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128   
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
   self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
################
# Window_Armor #
################
class Window_Armor < Window_Selectable
def initialize
   super(250, 50, 295, 350)
   @column_max = 1
   refresh
   self.index = 0
   if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
end
def item
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
     for i in 1...$data_armors.size
       if $game_party.armor_number(i) > 0
         @data.push($data_armors)
       end
     end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   case item
   when RPG::Armor
     number = $game_party.armor_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 1 * (288 + 32)
   y = index / 1 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128   
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
   self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
##############
# Scene_Item #
##############
class Scene_Item
def main
   @item_com = Sprite.new
   @item_com.bitmap = RPG::Cache.picture("Back0")
   @item_com.opacity -= 40
   @item_com.z = 100
   @type = Window_Type.new
   @type.opacity = 0
   @type.visible = false   
   @help_window = Window_Help.new
   @help_window.y = 405
   @item_window = Window_Item_Ex.new
   @item_window.help_window = @help_window
   @item_window.visible = true
   @item_window.active = true
   @weapon_window = Window_Weapon.new
   @weapon_window.help_window = @help_window
   @weapon_window.visible = false
   @weapon_window.active = true
   @armor_window = Window_Armor.new
   @armor_window.help_window = @help_window
   @armor_window.visible = false
   @armor_window.active = true   
   @target_window = Window_Target_Item.new
   @target_window.x = -300
   @target_window.active = false
   @help_window.opacity = 0
   @help_window.x = -200
   @help_window.contents_opacity = 0   
   @item_window.opacity -= 110
   @weapon_window.opacity -= 110
   @armor_window.opacity -= 110
   @target_window.opacity = 0   
   @weapon_window.x = 640
   @armor_window.x = 640
   @item_window.x = 640   
   @weapon_window.contents_opacity = 0
   @armor_window.contents_opacity = 0
   @item_window.contents_opacity = 0      
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   for i in 0..30
   @weapon_window.x += 20
   @armor_window.x += 20
   @item_window.x += 20   
   @weapon_window.contents_opacity -= 15
   @armor_window.contents_opacity -= 15
   @item_window.contents_opacity -= 15     
   @target_window.x -= 15
   @help_window.contents_opacity -= 15
   Graphics.update  
   end  
   Graphics.freeze
   @help_window.dispose
   @item_window.dispose
   @weapon_window.dispose
   @armor_window.dispose
   @target_window.dispose
   @item_com.dispose
   @type.dispose
end
def update
   if @target_window.active == true
      @target_window.visible = true
   if @target_window.x < 0
      @target_window.x += 20
   elsif @target_window.x >= 0
      @target_window.x = 0      
   end  
   else
   if @target_window.x > -300
      @target_window.x -= 20
   elsif @target_window.x >= -300
      @target_window.x = -300
      @target_window.visible = false
   end
   end   
   if @help_window.x < 0
   @help_window.x += 10
   @help_window.contents_opacity += 15   
   elsif @help_window.x >= 0
   @help_window.x = 0
   @help_window.contents_opacity = 255   
   end
   if @item_window.x > 250
   @weapon_window.x -= 20
   @armor_window.x -= 20
   @item_window.x -= 20   
   @weapon_window.contents_opacity += 15
   @armor_window.contents_opacity += 15
   @item_window.contents_opacity += 15   
   elsif  @item_window.x <= 250
   @weapon_window.x = 250
   @armor_window.x = 250
   @item_window.x = 250   
   @weapon_window.contents_opacity = 250
   @armor_window.contents_opacity = 250
   @item_window.contents_opacity = 250      
   end
   if @target_window.active == false
   if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT) or
      Input.press?(Input::RIGHT) or  Input.press?(Input::LEFT)
   @weapon_window.x = 640
   @armor_window.x = 640
   @item_window.x = 640      
   @weapon_window.contents_opacity = 0
   @armor_window.contents_opacity = 0
   @item_window.contents_opacity = 0      
   end
   if Input.trigger?(Input.dir4) or Input.trigger?(Input.dir4) or
      Input.trigger?(Input::L) or Input.trigger?(Input::R)      
   @help_window.x = -200
   @help_window.contents_opacity = 0
   end  
   end
   @help_window.update
   @item_window.update
   @weapon_window.update
   @armor_window.update
   @target_window.update
   @type.update
   case @type.index
   when 0
   @item_com.bitmap = RPG::Cache.picture("Back0")
   if @target_window.active == true
     update_target
     @item_window.active = false  
     @type.active = false
     return
   else   
     @item_window.active = true
     @type.active = true
   end   
   @weapon_window.active = false
   @armor_window.active = false
   @item_window.visible = true
   @weapon_window.visible = false
   @armor_window.visible = false   
   when 1
   @item_com.bitmap = RPG::Cache.picture("Back1")
   @item_window.active = false
   @weapon_window.active = true
   @armor_window.active = false
   @item_window.visible = false
   @weapon_window.visible = true
   @armor_window.visible = false   
   when 2
   @item_com.bitmap = RPG::Cache.picture("Back2")   
   @item_window.active = false
   @weapon_window.active = false
   @armor_window.active = true
   @item_window.visible = false
   @weapon_window.visible = false
   @armor_window.visible = true
   end
   if @item_window.active
     update_item
     return
   end
   if @weapon_window.active
     update_weapon
     return
   end
   if @armor_window.active
     update_armor
     return
   end
end
def update_weapon
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
end
def update_armor
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
end
def update_item
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
   if Input.trigger?(Input::C)
     @item = @item_window.item
     unless @item.is_a?(RPG::Item)
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     unless $game_party.item_can_use?(@item.id)
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     $game_system.se_play($data_system.decision_se)
     if @item.scope >= 3
       @item_window.active = false
       @target_window.x = (@item_window.index + 1) % 1 * 304
       @target_window.active = true
       @target_window.x = -350              
       if @item.scope == 4 || @item.scope == 6
         @target_window.index = -1
       else
         @target_window.index = 0
       end
     else
       if @item.common_event_id > 0
         $game_temp.common_event_id = @item.common_event_id
         $game_system.se_play(@item.menu_se)
         if @item.consumable
           $game_party.lose_item(@item.id, 1)
           @item_window.draw_item(@item_window.index)
         end
         $scene = Scene_Map.new
         return
       end
     end
     return
   end
end
def update_target
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     unless $game_party.item_can_use?(@item.id)
       @item_window.refresh
     end
     @item_window.active = true
     @target_window.active = false
     return
   end
   if Input.trigger?(Input::C)
     if $game_party.item_number(@item.id) == 0
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     if @target_window.index == -1
       used = false
       for i in $game_party.actors
         used |= i.item_effect(@item)
       end
     end
     if @target_window.index >= 0
       target = $game_party.actors[@target_window.index]
       used = target.item_effect(@item)
     end
     if used
       $game_system.se_play(@item.menu_se)
       if @item.consumable
         $game_party.lose_item(@item.id, 1)
         @item_window.draw_item(@item_window.index)
       end
       @target_window.refresh
       if $game_party.all_dead?
         $scene = Scene_Gameover.new
         return
       end
       if @item.common_event_id > 0
         $game_temp.common_event_id = @item.common_event_id
         $scene = Scene_Map.new
         return
       end
     end
     unless used
       $game_system.se_play($data_system.buzzer_se)
     end
     return
   end
end
end
作者: baggiochan    时间: 2007-7-14 19:26
标题: 想在scene item內加一window 顯示大圖像
小弟對scene_item做了些修改,現在我希望能在此基礎上多顯示一個window來顯示物品,武器及裝備的大圖示,希望有高人能幫手.window 沒什麼規格要求, 我自己微調就可以了. 現我把我的scene_item 貼出來, 當中的"back0", "back1","back2"是背景, 隨意放一張圖就可以的了~~~

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs item screen processing.
#==============================================================================

######################
# Window_Target_Item #
######################

class Window_Target_Item < Window_Selectable
def initialize
   super(0, 80, 280, 420)
   self.contents = Bitmap.new(width - 32, height - 12)
   self.z += 10
   @item_max = $game_party.actors.size
   refresh
end
def refresh
   self.contents.clear
   for i in 0...$game_party.actors.size
     x = 4
     y = i * 65
     actor = $game_party.actors
     draw_actor_name(actor, x + 150, y - 4)
     draw_actor_state(actor, x + 150, y + 28)
     draw_actor_hp(actor, x + 15, y - 4)
     draw_actor_sp(actor, x + 15, y + 28)
     end
end
def update_cursor_rect
   if @index <= -2
     self.cursor_rect.set(0, (@index + 10) * 65, self.width - 55, 60)
     elsif @index == -1
     self.cursor_rect.set(0, 0, self.width - 55, @item_max * 64 )
     else
     self.cursor_rect.set(0, @index * 65, self.width - 55, 60)
    end
end
end
############
# Type_Sel #
############
class Type_Sel < Window_Base
attr_reader   :index                    
attr_reader   :help_window            
def initialize(x, y, width, height)
   super(x, y, width, height)
   @item_max = 1
   @column_max = 1
   @index = -1
end
def index=(index)
   @index = index
end
def row_max
   return (@item_max + @column_max - 1) / @column_max
end
def top_row
   return self.oy / 32
end
def top_row=(row)
   if row < 0
     row = 0
   end
   if row > row_max - 1
     row = row_max - 1
   end
   self.oy = row * 32
end
def page_row_max
   return (self.height - 32) / 32
end
def page_item_max
   return page_row_max * @column_max
end
def update
   super
   if self.active and @item_max > 0 and @index >= 0
     if Input.repeat?(Input::RIGHT)
       if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
          @index < @item_max - @column_max
         $game_system.se_play($data_system.cursor_se)
         @index = (@index + @column_max) % @item_max
       end
     end
     if Input.repeat?(Input::LEFT)
       if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
          @index >= @column_max
         $game_system.se_play($data_system.cursor_se)
         @index = (@index - @column_max + @item_max) % @item_max
       end
     end
   end
end
end
###############
# Window_Type #
###############
class Window_Type < Type_Sel
def initialize
   super(0, 0, 0, 0)
   @item_max = 3
   self.index = 0
end
end
##################
# Window_Item_Ex #
##################
class Window_Item_Ex < Window_Selectable
def initialize
   super(250, 50, 295, 350)
   @column_max = 1
   refresh
   self.index = 0
   if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
end
def item
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   for i in 1...$data_items.size
     if $game_party.item_number(i) > 0
       @data.push($data_items)
     end
   end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   case item
   when RPG::Item
     number = $game_party.item_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 1 * (288 + 32)
   y = index / 1 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128   
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
   self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
   
end
def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#################
# Window_Weapon #
#################
class Window_Weapon < Window_Selectable
def initialize
   super(250, 50, 295, 350)
   @column_max = 1
   refresh
   self.index = 0
    if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
end
def item
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
     for i in 1...$data_weapons.size
       if $game_party.weapon_number(i) > 0
         @data.push($data_weapons)
       end
     end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   case item
   when RPG::Weapon
     number = $game_party.weapon_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 1 * (288 + 32)
   y = index / 1 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128   
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
   self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
################
# Window_Armor #
################
class Window_Armor < Window_Selectable
def initialize
   super(250, 50, 295, 350)
   @column_max = 1
   refresh
   self.index = 0
   if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
end
def item
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
     for i in 1...$data_armors.size
       if $game_party.armor_number(i) > 0
         @data.push($data_armors)
       end
     end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   case item
   when RPG::Armor
     number = $game_party.armor_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 1 * (288 + 32)
   y = index / 1 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128   
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
   self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
##############
# Scene_Item #
##############
class Scene_Item
def main
   @item_com = Sprite.new
   @item_com.bitmap = RPG::Cache.picture("Back0")
   @item_com.opacity -= 40
   @item_com.z = 100
   @type = Window_Type.new
   @type.opacity = 0
   @type.visible = false   
   @help_window = Window_Help.new
   @help_window.y = 405
   @item_window = Window_Item_Ex.new
   @item_window.help_window = @help_window
   @item_window.visible = true
   @item_window.active = true
   @weapon_window = Window_Weapon.new
   @weapon_window.help_window = @help_window
   @weapon_window.visible = false
   @weapon_window.active = true
   @armor_window = Window_Armor.new
   @armor_window.help_window = @help_window
   @armor_window.visible = false
   @armor_window.active = true   
   @target_window = Window_Target_Item.new
   @target_window.x = -300
   @target_window.active = false
   @help_window.opacity = 0
   @help_window.x = -200
   @help_window.contents_opacity = 0   
   @item_window.opacity -= 110
   @weapon_window.opacity -= 110
   @armor_window.opacity -= 110
   @target_window.opacity = 0   
   @weapon_window.x = 640
   @armor_window.x = 640
   @item_window.x = 640   
   @weapon_window.contents_opacity = 0
   @armor_window.contents_opacity = 0
   @item_window.contents_opacity = 0      
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   for i in 0..30
   @weapon_window.x += 20
   @armor_window.x += 20
   @item_window.x += 20   
   @weapon_window.contents_opacity -= 15
   @armor_window.contents_opacity -= 15
   @item_window.contents_opacity -= 15     
   @target_window.x -= 15
   @help_window.contents_opacity -= 15
   Graphics.update  
   end  
   Graphics.freeze
   @help_window.dispose
   @item_window.dispose
   @weapon_window.dispose
   @armor_window.dispose
   @target_window.dispose
   @item_com.dispose
   @type.dispose
end
def update
   if @target_window.active == true
      @target_window.visible = true
   if @target_window.x < 0
      @target_window.x += 20
   elsif @target_window.x >= 0
      @target_window.x = 0      
   end  
   else
   if @target_window.x > -300
      @target_window.x -= 20
   elsif @target_window.x >= -300
      @target_window.x = -300
      @target_window.visible = false
   end
   end   
   if @help_window.x < 0
   @help_window.x += 10
   @help_window.contents_opacity += 15   
   elsif @help_window.x >= 0
   @help_window.x = 0
   @help_window.contents_opacity = 255   
   end
   if @item_window.x > 250
   @weapon_window.x -= 20
   @armor_window.x -= 20
   @item_window.x -= 20   
   @weapon_window.contents_opacity += 15
   @armor_window.contents_opacity += 15
   @item_window.contents_opacity += 15   
   elsif  @item_window.x <= 250
   @weapon_window.x = 250
   @armor_window.x = 250
   @item_window.x = 250   
   @weapon_window.contents_opacity = 250
   @armor_window.contents_opacity = 250
   @item_window.contents_opacity = 250      
   end
   if @target_window.active == false
   if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT) or
      Input.press?(Input::RIGHT) or  Input.press?(Input::LEFT)
   @weapon_window.x = 640
   @armor_window.x = 640
   @item_window.x = 640      
   @weapon_window.contents_opacity = 0
   @armor_window.contents_opacity = 0
   @item_window.contents_opacity = 0      
   end
   if Input.trigger?(Input.dir4) or Input.trigger?(Input.dir4) or
      Input.trigger?(Input::L) or Input.trigger?(Input::R)      
   @help_window.x = -200
   @help_window.contents_opacity = 0
   end  
   end
   @help_window.update
   @item_window.update
   @weapon_window.update
   @armor_window.update
   @target_window.update
   @type.update
   case @type.index
   when 0
   @item_com.bitmap = RPG::Cache.picture("Back0")
   if @target_window.active == true
     update_target
     @item_window.active = false  
     @type.active = false
     return
   else   
     @item_window.active = true
     @type.active = true
   end   
   @weapon_window.active = false
   @armor_window.active = false
   @item_window.visible = true
   @weapon_window.visible = false
   @armor_window.visible = false   
   when 1
   @item_com.bitmap = RPG::Cache.picture("Back1")
   @item_window.active = false
   @weapon_window.active = true
   @armor_window.active = false
   @item_window.visible = false
   @weapon_window.visible = true
   @armor_window.visible = false   
   when 2
   @item_com.bitmap = RPG::Cache.picture("Back2")   
   @item_window.active = false
   @weapon_window.active = false
   @armor_window.active = true
   @item_window.visible = false
   @weapon_window.visible = false
   @armor_window.visible = true
   end
   if @item_window.active
     update_item
     return
   end
   if @weapon_window.active
     update_weapon
     return
   end
   if @armor_window.active
     update_armor
     return
   end
end
def update_weapon
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
end
def update_armor
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
end
def update_item
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
   if Input.trigger?(Input::C)
     @item = @item_window.item
     unless @item.is_a?(RPG::Item)
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     unless $game_party.item_can_use?(@item.id)
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     $game_system.se_play($data_system.decision_se)
     if @item.scope >= 3
       @item_window.active = false
       @target_window.x = (@item_window.index + 1) % 1 * 304
       @target_window.active = true
       @target_window.x = -350              
       if @item.scope == 4 || @item.scope == 6
         @target_window.index = -1
       else
         @target_window.index = 0
       end
     else
       if @item.common_event_id > 0
         $game_temp.common_event_id = @item.common_event_id
         $game_system.se_play(@item.menu_se)
         if @item.consumable
           $game_party.lose_item(@item.id, 1)
           @item_window.draw_item(@item_window.index)
         end
         $scene = Scene_Map.new
         return
       end
     end
     return
   end
end
def update_target
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     unless $game_party.item_can_use?(@item.id)
       @item_window.refresh
     end
     @item_window.active = true
     @target_window.active = false
     return
   end
   if Input.trigger?(Input::C)
     if $game_party.item_number(@item.id) == 0
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     if @target_window.index == -1
       used = false
       for i in $game_party.actors
         used |= i.item_effect(@item)
       end
     end
     if @target_window.index >= 0
       target = $game_party.actors[@target_window.index]
       used = target.item_effect(@item)
     end
     if used
       $game_system.se_play(@item.menu_se)
       if @item.consumable
         $game_party.lose_item(@item.id, 1)
         @item_window.draw_item(@item_window.index)
       end
       @target_window.refresh
       if $game_party.all_dead?
         $scene = Scene_Gameover.new
         return
       end
       if @item.common_event_id > 0
         $game_temp.common_event_id = @item.common_event_id
         $scene = Scene_Map.new
         return
       end
     end
     unless used
       $game_system.se_play($data_system.buzzer_se)
     end
     return
   end
end
end
作者: 残阳泪珀    时间: 2007-7-14 20:34
请看
http://rpg.blue/web/htm/news702.htm
window_help类~~~~~~~
作者: baggiochan    时间: 2007-7-14 23:31
我這裡下載不到啊~~
作者: 永劫的咎人    时间: 2007-7-15 00:31
提示: 作者被禁止或删除 内容自动屏蔽
作者: baggiochan    时间: 2007-7-15 01:36
我本來已用bitmap的方法設定了window, 名叫Window_Picture. 但就是不知應插在我scene_item的那裡, 令他顯示出來~~~ 我放在 def update中也不行~~~{/dk}
作者: baggiochan    时间: 2007-7-15 06:34
高手可否直接於我的腳本中插入需要加的句子啊? 我弄了大半天都弄不好  {/ll}
作者: 永劫的咎人    时间: 2007-7-15 21:51
提示: 作者被禁止或删除 内容自动屏蔽
作者: baggiochan    时间: 2007-7-15 22:34
我有這樣做啊, 仍然是不顯示圖像, 你可以拿我的腳本試一試啊~~~~
作者: baggiochan    时间: 2007-7-16 20:08
高人們可不可以直接在我的腳本上加入需要的指令啊!? 拜託啦~~~{/ll}
作者: baggiochan    时间: 2007-7-18 19:40
怎麼還未有人願意幫我啊...........{/dk}
作者: 永劫的咎人    时间: 2007-7-18 21:14
提示: 作者被禁止或删除 内容自动屏蔽
作者: baggiochan    时间: 2007-7-18 22:42
我已按你的方法加了, 但還是不行啊~~ 我把scene_item 修改後的內容再貼上來給你看看~~~

#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
#  装备物品大图标显示。
#==============================================================================

class Window_Equip < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 40, 200, 200)
    @item = nil
    @item_id = -1
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  
    def refresh
    if @item != nil
      if @item != @item_id
        self.contents.clear
        bitmap = Bitmap.new("Graphics/Pictures/Item/" + @item.name)
        pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
        self.contents.blt(0, 0, bitmap, pic_rect)
        @item_id = @item
      end
    else
      @item_id = nil
      self.contents.clear
      bitmap = Bitmap.new("Graphics/Pictures/Item/空.png")
      pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
      self.contents.blt(0, 0, bitmap, pic_rect)
    end
  end
      
  #--------------------------------------------------------------------------
  # ● 设置物品
  #--------------------------------------------------------------------------
  def set_item(item)
    @item = item
  end
end

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs item screen processing.
#==============================================================================

######################
# Window_Target_Item #
######################

class Window_Target_Item < Window_Selectable
  def initialize
    super(0, 80, 280, 420)
    self.contents = Bitmap.new(width - 32, height - 12)
    self.z += 10
    @item_max = $game_party.actors.size
    refresh
  end
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      x = 4
      y = i * 65
      actor = $game_party.actors
      draw_actor_name(actor, x + 150, y - 4)
      draw_actor_state(actor, x + 150, y + 28)
      draw_actor_hp(actor, x + 15, y - 4)
      draw_actor_sp(actor, x + 15, y + 28)
      end
  end
  def update_cursor_rect
    if @index <= -2
      self.cursor_rect.set(0, (@index + 10) * 65, self.width - 55, 60)
      elsif @index == -1
      self.cursor_rect.set(0, 0, self.width - 55, @item_max * 64 )
      else
      self.cursor_rect.set(0, @index * 65, self.width - 55, 60)
     end
  end
end
############
# Type_Sel #
############
class Type_Sel < Window_Base
  attr_reader   :index                    
  attr_reader   :help_window            
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @item_max = 1
    @column_max = 1
    @index = -1
  end
  def index=(index)
    @index = index
  end
  def row_max
    return (@item_max + @column_max - 1) / @column_max
  end
  def top_row
    return self.oy / 32
  end
  def top_row=(row)
    if row < 0
      row = 0
    end
    if row > row_max - 1
      row = row_max - 1
    end
    self.oy = row * 32
  end
  def page_row_max
    return (self.height - 32) / 32
  end
  def page_item_max
    return page_row_max * @column_max
  end
  def update
    super
    if self.active and @item_max > 0 and @index >= 0
      if Input.repeat?(Input::RIGHT)
        if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
           @index < @item_max - @column_max
          $game_system.se_play($data_system.cursor_se)
          @index = (@index + @column_max) % @item_max
        end
      end
      if Input.repeat?(Input::LEFT)
        if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
           @index >= @column_max
          $game_system.se_play($data_system.cursor_se)
          @index = (@index - @column_max + @item_max) % @item_max
        end
      end
    end
  end
end
###############
# Window_Type #
###############
class Window_Type < Type_Sel
  def initialize
    super(0, 0, 0, 0)
    @item_max = 3
    self.index = 0
  end
end
##################
# Window_Item_Ex #
##################
class Window_Item_Ex < Window_Selectable
  def initialize
    super(250, 50, 295, 350)
    @column_max = 1
    refresh
    self.index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 1 * (288 + 32)
    y = index / 1 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128   
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
    self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
     
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
#################
# Window_Weapon #
#################
class Window_Weapon < Window_Selectable
  def initialize
    super(250, 50, 295, 350)
    @column_max = 1
    refresh
    self.index = 0
     if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons)
        end
      end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 1 * (288 + 32)
    y = index / 1 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128   
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
    self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
################
# Window_Armor #
################
class Window_Armor < Window_Selectable
  def initialize
    super(250, 50, 295, 350)
    @column_max = 1
    refresh
    self.index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors)
        end
      end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 1 * (288 + 32)
    y = index / 1 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128   
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
    self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
##############
# Scene_Item #
##############
class Scene_Item
  def main
    @item_com = Sprite.new
    @item_com.bitmap = RPG::Cache.picture("Back0")
    @item_com.opacity -= 40
    @item_com.z = 100
    @type = Window_Type.new
    @type.opacity = 0
    @type.visible = false   
    @help_window = Window_Help.new
    @help_window.y = 405
    @item_window = Window_Item_Ex.new
    @item_window.help_window = @help_window
    @item_window.visible = true
    @item_window.active = true
    @weapon_window = Window_Weapon.new
    @weapon_window.help_window = @help_window
    @weapon_window.visible = false
    @weapon_window.active = true
    @armor_window = Window_Armor.new
    @armor_window.help_window = @help_window
    @armor_window.visible = false
    @armor_window.active = true   
    @target_window = Window_Target_Item.new
    @target_window.x = -300
    @target_window.active = false
    @help_window.opacity = 0
    @help_window.x = -200
    @help_window.contents_opacity = 0   
    @item_window.opacity -= 110
    @weapon_window.opacity -= 110
    @armor_window.opacity -= 110
    @target_window.opacity = 0   
    @weapon_window.x = 640
    @armor_window.x = 640
    @item_window.x = 640   
    @weapon_window.contents_opacity = 0
    @armor_window.contents_opacity = 0
    @item_window.contents_opacity = 0     
  #........................................................................
    @equip_window = Window_Equip.new
  #........................................................................
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    for i in 0..30
    @weapon_window.x += 20
    @armor_window.x += 20
    @item_window.x += 20   
    @weapon_window.contents_opacity -= 15
    @armor_window.contents_opacity -= 15
    @item_window.contents_opacity -= 15     
    @target_window.x -= 15
    @help_window.contents_opacity -= 15
    Graphics.update  
    end  
    Graphics.freeze
    @help_window.dispose
    @item_window.dispose
    @weapon_window.dispose
    @armor_window.dispose
    @target_window.dispose
    @item_com.dispose
    @type.dispose
     #........................................................................
    @equip_window.dispose
  #........................................................................
   
   
  end
  def update
    if @target_window.active == true
       @target_window.visible = true
    if @target_window.x < 0
       @target_window.x += 20
    elsif @target_window.x >= 0
       @target_window.x = 0      
    end  
    else
    if @target_window.x > -300
       @target_window.x -= 20
    elsif @target_window.x >= -300
       @target_window.x = -300
       @target_window.visible = false
    end
    end   
    if @help_window.x < 0
    @help_window.x += 10
    @help_window.contents_opacity += 15   
    elsif @help_window.x >= 0
    @help_window.x = 0
    @help_window.contents_opacity = 255   
    end
    if @item_window.x > 250
    @weapon_window.x -= 20
    @armor_window.x -= 20
    @item_window.x -= 20   
    @weapon_window.contents_opacity += 15
    @armor_window.contents_opacity += 15
    @item_window.contents_opacity += 15   
    elsif  @item_window.x <= 250
    @weapon_window.x = 250
    @armor_window.x = 250
    @item_window.x = 250   
    @weapon_window.contents_opacity = 250
    @armor_window.contents_opacity = 250
    @item_window.contents_opacity = 250      
    end
    if @target_window.active == false
    if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT) or
       Input.press?(Input::RIGHT) or  Input.press?(Input::LEFT)
    @weapon_window.x = 640
    @armor_window.x = 640
    @item_window.x = 640      
    @weapon_window.contents_opacity = 0
    @armor_window.contents_opacity = 0
    @item_window.contents_opacity = 0      
    end
    if Input.trigger?(Input.dir4) or Input.trigger?(Input.dir4) or
       Input.trigger?(Input::L) or Input.trigger?(Input::R)      
    @help_window.x = -200
    @help_window.contents_opacity = 0
    end  
    end
    @help_window.update
    @item_window.update
    @weapon_window.update
    @armor_window.update
    @target_window.update
  ##################################################################
    @equip_window.update
    #################################
    @type.update
    case @type.index
    when 0
    @item_com.bitmap = RPG::Cache.picture("Back0")
    if @target_window.active == true
      update_target
      @item_window.active = false  
      @type.active = false
      return
    else   
      @item_window.active = true
      @type.active = true
    end   
    @weapon_window.active = false
    @armor_window.active = false
    @item_window.visible = true
    @weapon_window.visible = false
    @armor_window.visible = false   
    when 1
    @item_com.bitmap = RPG::Cache.picture("Back1")
    @item_window.active = false
    @weapon_window.active = true
    @armor_window.active = false
    @item_window.visible = false
    @weapon_window.visible = true
    @armor_window.visible = false   
    when 2
    @item_com.bitmap = RPG::Cache.picture("Back2")   
    @item_window.active = false
    @weapon_window.active = false
    @armor_window.active = true
    @item_window.visible = false
    @weapon_window.visible = false
    @armor_window.visible = true
    end
    if @item_window.active
      update_item
      return
    end
    if @weapon_window.active
      update_weapon
      return
    end
    if @armor_window.active
      update_armor
      return
    end
  end
  def update_weapon
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0)
      return
    end
  end
  def update_armor
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0)
      return
    end
  end
  def update_item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0)
      return
    end
    if Input.trigger?(Input::C)
      @item = @item_window.item
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      unless $game_party.item_can_use?(@item.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if @item.scope >= 3
        @item_window.active = false
        @target_window.x = (@item_window.index + 1) % 1 * 304
        @target_window.active = true
        @target_window.x = -350              
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      else
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $game_system.se_play(@item.menu_se)
          if @item.consumable
            $game_party.lose_item(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  def update_target
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      unless $game_party.item_can_use?(@item.id)
        @item_window.refresh
      end
      @item_window.active = true
      @target_window.active = false
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.item_number(@item.id) == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @target_window.index == -1
        used = false
        for i in $game_party.actors
          used |= i.item_effect(@item)
        end
      end
      if @target_window.index >= 0
        target = $game_party.actors[@target_window.index]
        used = target.item_effect(@item)
      end
      if used
        $game_system.se_play(@item.menu_se)
        if @item.consumable
          $game_party.lose_item(@item.id, 1)
          @item_window.draw_item(@item_window.index)
        end
        @target_window.refresh
        if $game_party.all_dead?
          $scene = Scene_Gameover.new
          return
        end
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $scene = Scene_Map.new
          return
        end
      end
      unless used
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end
作者: xueran100    时间: 2007-7-18 23:20
提示: 作者被禁止或删除 内容自动屏蔽
作者: baggiochan    时间: 2007-7-19 05:52
可以講解一下是什麼來的嗎?

以下引用xueran100于2007-7-18 15:20:50的发言:



#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
#  处理物品画面的类。
#==============================================================================

class Scene_Item
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
   # 生成帮助窗口、物品窗口、头像窗口
   @help_window = Window_Help.new
   @item_window = Window_Item.new
   $head.window = super(x, y, w, h)                   #头像窗口位置
   $head.index1 = Bitmap.new("Graphics/Pictures/#filename")
   # 关联帮助窗口
   @item_window.help_window = @help_window
   # 生成目标窗口 (设置为不可见・不活动)
   @target_window = Window_Target.new
   @target_window.visible = false
   @target_window.active = false
   # 执行过度
   Graphics.transition
   # 主循环
   loop do
     # 刷新游戏画面
     Graphics.update
     # 刷新输入信息
     Input.update
     # 刷新画面
     update
     # 如果画面切换就中断循环
     if $scene != self
       break
     end
   end
   # 装备过渡
   Graphics.freeze
   # 释放窗口
   @help_window.dispose
   @item_window.dispose
   @target_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
   # 刷新窗口
   @help_window.update
   @item_window.update
   @target_window.update
   # 物品窗口被激活的情况下: 调用 update_item
   if @item_window.active
     update_item
     return
   end
   # 目标窗口被激活的情况下: 调用 update_target
   if @target_window.active
     update_target
     return
   end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
   # 按下 B 键的情况下
   if Input.trigger?(Input::B)
     # 演奏取消 SE
     $game_system.se_play($data_system.cancel_se)
     # 切换到菜单画面
     $scene = Scene_Menu.new(0)
     return
   end
   # 按下 C 键的情况下
   if Input.trigger?(Input::C)
     # 获取物品窗口当前选中的物品数据
     @item = @item_window.item
     # 不使用物品的情况下
     unless @item.is_a?(RPG::Item)
       # 演奏冻结 SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 不能使用的情况下
     unless $game_party.item_can_use?(@item.id)
       # 演奏冻结 SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 演奏确定 SE
     $game_system.se_play($data_system.decision_se)
     # 效果范围是我方的情况下
     if @item.scope >= 3
       # 激活目标窗口
       @item_window.active = false
       @target_window.x = (@item_window.index + 1) % 2 * 304
       @target_window.visible = true
       @target_window.active = true
       # 设置效果范围 (单体/全体) 的对应光标位置
       if @item.scope == 4 || @item.scope == 6
         @target_window.index = -1
       else
         @target_window.index = 0
       end
     # 效果在我方以外的情况下
     else
       # 公共事件 ID 有效的情况下
       if @item.common_event_id > 0
         # 预约调用公共事件
         $game_temp.common_event_id = @item.common_event_id
         # 演奏物品使用时的 SE
         $game_system.se_play(@item.menu_se)
         # 消耗品的情况下
         if @item.consumable
           # 使用的物品数减 1
           $game_party.lose_item(@item.id, 1)
           # 再描绘物品窗口的项目
           @item_window.draw_item(@item_window.index)
         end
         # 切换到地图画面
         $scene = Scene_Map.new
         return
       end
     end
     return
   end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (目标窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_target
   # 按下 B 键的情况下
   if Input.trigger?(Input::B)
     # 演奏取消 SE
     $game_system.se_play($data_system.cancel_se)
     # 由于物品用完而不能使用的场合
     unless $game_party.item_can_use?(@item.id)
       # 再次生成物品窗口的内容
       @item_window.refresh
     end
     # 删除目标窗口
     @item_window.active = true
     @target_window.visible = false
     @target_window.active = false
     return
   end
   # 按下 C 键的情况下
   if Input.trigger?(Input::C)
     # 如果物品用完的情况下
     if $game_party.item_number(@item.id) == 0
       # 演奏冻结 SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 目标是全体的情况下
     if @target_window.index == -1
       # 对同伴全体应用物品使用效果
       used = false
       for i in $game_party.actors
         used |= i.item_effect(@item)
       end
     end
     # 目标是单体的情况下
     if @target_window.index >= 0
       # 对目标角色应用物品的使用效果
       target = $game_party.actors[@target_window.index]
       used = target.item_effect(@item)
     end
     # 使用物品的情况下
     if used
       # 演奏物品使用时的 SE
       $game_system.se_play(@item.menu_se)
       # 消耗品的情况下
       if @item.consumable
         # 使用的物品数减 1
         $game_party.lose_item(@item.id, 1)
         # 再描绘物品窗口的项目
         @item_window.draw_item(@item_window.index)
       end
       # 再生成目标窗口的内容
       @target_window.refresh
       # 全灭的情况下
       if $game_party.all_dead?
         # 切换到游戏结束画面
         $scene = Scene_Gameover.new
         return
       end
       # 公共事件 ID 有效的情况下
       if @item.common_event_id > 0
         # 预约调用公共事件
         $game_temp.common_event_id = @item.common_event_id
         # 切换到地图画面
         $scene = Scene_Map.new
         return
       end
     end
     # 无法使用物品的情况下
     unless used
       # 演奏冻结 SE
       $game_system.se_play($data_system.buzzer_se)
     end
     return
   end
end
end


作者: 706756524    时间: 2007-7-19 06:01
提示: 作者被禁止或删除 内容自动屏蔽
作者: baggiochan    时间: 2007-7-19 06:07
拜託你了

以下引用706756524于2007-7-18 22:01:06的发言:

今天没时间了,明天帮你弄吧.
我习惯编辑帖子


作者: 纯子    时间: 2007-7-20 00:54

你是不是要的是这个效果?有一个小窗口显示图片???
--------------------------------------------------------------
这个?http://rpg.blue/web/htm/news279.htm
作者: baggiochan    时间: 2007-7-20 01:51
是啦, 差不多了~~~{/cy}{/qiang}
作者: baggiochan    时间: 2007-7-20 08:24
2個都應該可以的, 只要能有一個window 把圖顯示出來.......

以下引用纯子于2007-7-19 16:54:37的发言:


你是不是要的是这个效果?有一个小窗口显示图片???
--------------------------------------------------------------
这个?http://rpg.blue/web/htm/news279.htm


[本贴由作者于 2007-7-19 17:00:35 最后编辑]






欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1