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

Project1

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

[已经过期] 物品界面

[复制链接]

Lv1.梦旅人

梦石
0
星屑
64
在线时间
124 小时
注册时间
2015-1-30
帖子
61
跳转到指定楼层
1
发表于 2015-2-7 17:09:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x

能不能根据这个仓库脚本的仓库界面作出配套的物品界面,现在这里谢过了

Project1.zip

204.97 KB, 下载次数: 48

点评

话说你这么连帖没问题么。。。  发表于 2015-2-11 22:12

Lv1.梦旅人

梦石
0
星屑
64
在线时间
124 小时
注册时间
2015-1-30
帖子
61
2
 楼主| 发表于 2015-2-8 16:25:20 | 只看该作者
或者给点修改脚本的提示也行啊  {:2_264:}
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
64
在线时间
124 小时
注册时间
2015-1-30
帖子
61
3
 楼主| 发表于 2015-2-8 23:08:00 | 只看该作者
已经尽力努力过了,最后挣扎一下,希望有大神能帮我改一下这个脚本,添加"普通物品","药品类","武器类","护甲类","首饰类","食材","料理","任务物品"这些默认选项,就是不管什么时候都有这些选项,而且没有添加@备注的物品,武器,防具自动分类进 普通物品 武器类 护甲类 。希望路过的人能够帮一下忙 万分感谢{:2_264:}
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================
  7.  
  8. class Harts_Window_ItemTitle < Window_Base
  9.   def initialize
  10.     super(0, 0, 160, 64)
  11.     self.contents = Bitmap.new(width - 32, height - 32)
  12.     self.contents.clear
  13.     self.contents.font.color = normal_color
  14.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  15.   end
  16. end
  17.  
  18. #==============================================================================
  19. # ■ Harts_Window_ItemCommand
  20. #==============================================================================
  21.  
  22. class Harts_Window_ItemCommand < Window_Selectable
  23.   attr_accessor :commands
  24.   #--------------------------------------------------------------------------
  25.   # ● 初始化,生成commands窗口
  26.   #--------------------------------------------------------------------------
  27.   def initialize
  28.     super(0, 64, 160, 352)
  29.     @commands = []
  30.     #————————生成commands窗口
  31.     for i in 1...$data_items.size
  32.       if $game_party.item_number(i) > 0
  33.         push = true
  34.         for com in @commands
  35.           if com == $data_items[i].desc
  36.             push = false
  37.           end
  38.         end
  39.         if push == true
  40.           @commands.push($data_items[i].desc)
  41.         end
  42.       end
  43.     end
  44.     for i in 1...$data_weapons.size
  45.       if $game_party.weapon_number(i) > 0
  46.         push = true
  47.         for com in @commands
  48.           if com == $data_weapons[i].desc
  49.             push = false
  50.           end
  51.         end
  52.         if push == true
  53.           @commands.push($data_weapons[i].desc)
  54.         end
  55.       end
  56.     end
  57.     for i in 1...$data_armors.size
  58.       if $game_party.armor_number(i) > 0
  59.         push = true
  60.         for com in @commands
  61.           if com == $data_armors[i].desc
  62.             push = false
  63.           end
  64.         end
  65.         if push == true
  66.           @commands.push($data_armors[i].desc)
  67.         end
  68.       end
  69.     end
  70.     if @commands == []
  71.       @commands.push("普通物品")
  72.     end      
  73.     @item_max = @commands.size
  74.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  75.     refresh
  76.     self.index = 0
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   #--------------------------------------------------------------------------
  80.   def refresh
  81.     self.contents.clear
  82.     for i in 0...@item_max
  83.       draw_item(i, normal_color)
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   #--------------------------------------------------------------------------
  88.   def draw_item(index, color)
  89.     self.contents.font.color = color
  90.     y = index * 32
  91.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # 只描绘原文字
  95.   #--------------------------------------------------------------------------
  96.   def update_help
  97.     @help_window.set_text(@commands[self.index])
  98.   end
  99. end
  100.  
  101. #==============================================================================
  102. # ■ Window_Item
  103. #==============================================================================
  104.  
  105. class Harts_Window_ItemList < Window_Selectable
  106.   #--------------------------------------------------------------------------
  107.   #--------------------------------------------------------------------------
  108.   def initialize
  109.     super(160, 0, 480, 416)
  110.     refresh
  111.     self.index = 0
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   #--------------------------------------------------------------------------
  115.   def item
  116.     return @data[self.index]
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   #--------------------------------------------------------------------------
  120.   def refresh
  121.     if self.contents != nil
  122.       self.contents.dispose
  123.       self.contents = nil
  124.     end
  125.     @data = []
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   #--------------------------------------------------------------------------
  129.   def set_item(command)
  130.     refresh
  131.     for i in 1...$data_items.size
  132.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  133.         @data.push($data_items[i])
  134.       end
  135.     end
  136.     for i in 1...$data_weapons.size
  137.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  138.         @data.push($data_weapons[i])
  139.       end
  140.     end
  141.     for i in 1...$data_armors.size
  142.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  143.         @data.push($data_armors[i])
  144.       end
  145.     end
  146.     @item_max = @data.size
  147.     if @item_max > 0
  148.       self.contents = Bitmap.new(width - 32, row_max * 32)
  149.       self.contents.clear
  150.       for i in 0...@item_max
  151.         draw_item(i)
  152.       end
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   #--------------------------------------------------------------------------
  157.   def item_number
  158.     return @item_max
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   #--------------------------------------------------------------------------
  162.   def draw_item(index)
  163.     item = @data[index]
  164.     case item
  165.     when RPG::Item
  166.       number = $game_party.item_number(item.id)
  167.     when RPG::Weapon
  168.       number = $game_party.weapon_number(item.id)
  169.     when RPG::Armor
  170.       number = $game_party.armor_number(item.id)
  171.     end
  172.     if item.is_a?(RPG::Item) and
  173.       $game_party.item_can_use?(item.id)
  174.       self.contents.font.color = normal_color
  175.     else
  176.       self.contents.font.color = disabled_color
  177.     end
  178.     x = 4
  179.     y = index * 32
  180.     bitmap = RPG::Cache.icon(item.icon_name)
  181.     opacity = self.contents.font.color == normal_color ? 255 : 128
  182.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  183.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  184.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  185.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   #--------------------------------------------------------------------------
  189.   def update_help
  190.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  191.   end
  192. end
  193.  
  194. #==============================================================================
  195. # ■ Harts_Scene_Item
  196. #==============================================================================
  197.  
  198. class Scene_Item
  199.   #--------------------------------------------------------------------------
  200.   #--------------------------------------------------------------------------
  201.   def main
  202.     @itemtitle_window = Harts_Window_ItemTitle.new
  203.     @itemcommand_window = Harts_Window_ItemCommand.new
  204.     @command_index = @itemcommand_window.index
  205.     @itemlist_window = Harts_Window_ItemList.new
  206.     @itemlist_window.active = false
  207.     @help_window = Window_Help.new
  208.     @help_window.x = 0
  209.     @help_window.y = 416
  210.     @itemcommand_window.help_window = @help_window
  211.     @itemlist_window.help_window = @help_window
  212.     @target_window = Window_Target.new
  213.     @target_window.visible = false
  214.     @target_window.active = false
  215.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  216.     Graphics.transition
  217.     loop do
  218.       Graphics.update
  219.       Input.update
  220.       update
  221.       if $scene != self
  222.         break
  223.       end
  224.     end
  225.     Graphics.freeze
  226.     @itemtitle_window.dispose
  227.     @itemcommand_window.dispose
  228.     @itemlist_window.dispose
  229.     @help_window.dispose
  230.     @target_window.dispose
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   #--------------------------------------------------------------------------
  234.   def update
  235.     @itemtitle_window.update
  236.     @itemcommand_window.update
  237.     @itemlist_window.update
  238.     @help_window.update
  239.     @target_window.update
  240.     if @command_index != @itemcommand_window.index
  241.       @command_index = @itemcommand_window.index
  242.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  243.     end
  244.     if @itemcommand_window.active
  245.       update_itemcommand
  246.       return
  247.     end
  248.     if @itemlist_window.active
  249.       update_itemlist
  250.       return
  251.     end
  252.     if @target_window.active
  253.       update_target
  254.       return
  255.     end
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   #--------------------------------------------------------------------------
  259.   def update_itemcommand
  260.     if Input.trigger?(Input::B)
  261.       $game_system.se_play($data_system.cancel_se)
  262.       $scene = Scene_Menu.new(0)
  263.       return
  264.     end
  265.     if Input.trigger?(Input::C)
  266.       if @itemlist_window.item_number == 0
  267.         $game_system.se_play($data_system.buzzer_se)
  268.         return
  269.       end
  270.       $game_system.se_play($data_system.decision_se)
  271.       @itemcommand_window.active = false
  272.       @itemlist_window.active = true
  273.       @itemlist_window.index = 0
  274.       return
  275.     end
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   #--------------------------------------------------------------------------
  279.   def update_itemlist
  280.     if Input.trigger?(Input::B)
  281.       $game_system.se_play($data_system.cancel_se)
  282.       @itemcommand_window.active = true
  283.       @itemlist_window.active = false
  284.       @itemlist_window.index = 0
  285.       @itemcommand_window.index = @command_index
  286.       return
  287.     end
  288.     if Input.trigger?(Input::C)
  289.       @item = @itemlist_window.item
  290.       unless @item.is_a?(RPG::Item)
  291.         $game_system.se_play($data_system.buzzer_se)
  292.         return
  293.       end
  294.       unless $game_party.item_can_use?(@item.id)
  295.         $game_system.se_play($data_system.buzzer_se)
  296.         return
  297.       end
  298.       $game_system.se_play($data_system.decision_se)
  299.       if @item.scope >= 3
  300.         @itemlist_window.active = false
  301.         @target_window.x = 304
  302.         @target_window.visible = true
  303.         @target_window.active = true
  304.         if @item.scope == 4 || @item.scope == 6
  305.           @target_window.index = -1
  306.         else
  307.           @target_window.index = 0
  308.         end
  309.       else
  310.         if @item.common_event_id > 0
  311.           $game_temp.common_event_id = @item.common_event_id
  312.           $game_system.se_play(@item.menu_se)
  313.             if @item.consumable
  314.               $game_party.lose_item(@item.id, 1)
  315.               @itemlist_window.draw_item(@itemlist_window.index)
  316.             end
  317.           $scene = Scene_Map.new
  318.           return
  319.         end
  320.       end
  321.       return
  322.     end
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   #--------------------------------------------------------------------------
  326.   def update_target
  327.     if Input.trigger?(Input::B)
  328.       $game_system.se_play($data_system.cancel_se)
  329.       unless $game_party.item_can_use?(@item.id)
  330.         @itemlist_window.refresh
  331.       end
  332.       @itemlist_window.active = true
  333.       @target_window.visible = false
  334.       @target_window.active = false
  335.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  336.       return
  337.     end
  338.     if Input.trigger?(Input::C)
  339.       if $game_party.item_number(@item.id) == 0
  340.         $game_system.se_play($data_system.buzzer_se)
  341.         return
  342.       end
  343.       if @target_window.index == -1
  344.         used = false
  345.         for i in $game_party.actors
  346.           used |= i.item_effect(@item)
  347.         end
  348.       end
  349.       if @target_window.index >= 0
  350.         target = $game_party.actors[@target_window.index]
  351.         used = target.item_effect(@item)
  352.       end
  353.       if used
  354.         $game_system.se_play(@item.menu_se)
  355.         if @item.consumable
  356.           $game_party.lose_item(@item.id, 1)
  357.           @itemlist_window.draw_item(@itemlist_window.index)
  358.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  359.         end
  360.         @target_window.refresh
  361.         if $game_party.all_dead?
  362.           $scene = Scene_Gameover.new
  363.           return
  364.         end
  365.         if @item.common_event_id > 0
  366.           $game_temp.common_event_id = @item.common_event_id
  367.           $scene = Scene_Map.new
  368.           return
  369.         end
  370.       end
  371.       unless used
  372.         $game_system.se_play($data_system.buzzer_se)
  373.       end
  374.     return
  375.     end
  376.   end
  377. end
  378.  
  379.  
  380.  
  381.  
  382. #==============================================================================
  383. # ■ RPG追加定义,使用@符号分类
  384. #==============================================================================
  385.  
  386. module RPG
  387.   class Weapon
  388.     def description
  389.       description = @description.split(/@/)[0]
  390.       return description != nil ? description : ''
  391.     end
  392.     def desc
  393.       desc = @description.split(/@/)[1]
  394.       return desc != nil ? desc : "武器类"
  395.     end
  396.   end
  397.   class Item
  398.     def description
  399.       description = @description.split(/@/)[0]
  400.       return description != nil ? description : ''
  401.     end
  402.     def desc
  403.       desc = @description.split(/@/)[1]
  404.       return desc != nil ? desc : "普通物品"
  405.     end
  406.   end
  407.   class Armor
  408.     def description
  409.       description = @description.split(/@/)[0]
  410.       return description != nil ? description : ''
  411.     end
  412.     def desc
  413.       desc = @description.split(/@/)[1]
  414.       return desc != nil ? desc : "防具类"
  415.     end
  416.   end
  417. end
  418.  
  419. #==============================================================================
  420. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  421. #==============================================================================
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 19:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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