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

Project1

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

[已经过期] 仓库的脚本或事件测试文件谁有啊

[复制链接]

Lv1.梦旅人

梦石
0
星屑
124
在线时间
36 小时
注册时间
2011-10-26
帖子
32
跳转到指定楼层
1
发表于 2011-11-20 17:39:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 1165385344 于 2011-11-20 17:42 编辑

{:4_157:}

Lv1.梦旅人

小黑

梦石
0
星屑
50
在线时间
140 小时
注册时间
2011-8-23
帖子
536
2
发表于 2011-11-20 18:07:30 | 只看该作者
  1. #==============================================================================
  2. #==============================================================================
  3. #     
  4. #                      ■ [vx]仓库
  5. #------------------------------------------------------------------------------
  6. #                       by 八云 紫
  7. #                转载时,请注明 本脚本来着 66RPG
  8. #==============================================================================
  9. #==============================================================================

  10. #==============================================================================
  11. # ■ Byz_Vocab
  12. #------------------------------------------------------------------------------
  13. #  定义系统用语和信息的模块。
  14. #==============================================================================
  15. module Byz_Vocab
  16.   #------  仓库  ---------
  17.   WAREHOUSE_SAVING = "存东西"
  18.   WAREHOUSE_TAKING = "取东西"
  19.   CANCEN           = "取消"
  20.   # 箭头文件名字, 放到 Graphics\Pictures 目录下。
  21.   ARROW_TWO        = "Cursor"
  22.   # 存物品的时候的价格
  23.   PRICES           = 10
  24. end

  25. class Bitmap
  26.   #--------------------------------------------------------------------------
  27.   # ● 描绘直线   
  28.   #     x1,y1,x2,y2:  直线两端的坐标
  29.   #     width:    宽度  
  30.   #     color:    颜色
  31.   #--------------------------------------------------------------------------
  32.   def drawline(x1, y1, x2, y2, width, color)
  33.     x1 = x1.to_f
  34.     y1 = y1.to_f
  35.     x2 = x2.to_f
  36.     y2 = y2.to_f
  37.     width = width.to_f
  38.     k = (y2 - y1) / (x2 - x1)
  39.     if k.abs > 1
  40.       drawline_x(x1, y1, x2, y2, width, color)
  41.     else
  42.       drawline_y(x1, y1, x2, y2, width, color)
  43.     end
  44.   end
  45.   def drawline_x(x1, y1, x2, y2, width, color)
  46.     l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (y1 - y2)
  47.     length = l.abs * 2
  48.     k = (x2 - x1) / (y2 - y1) #x=ky+b
  49.     b = x1 - k * y1
  50.     if l > 0
  51.       for ty in y2.to_i..y1.to_i
  52.         tx = ty * k + b
  53.         fill_rect(tx - l, ty, length, 1, color)
  54.       end
  55.     else
  56.       for ty in y1.to_i..y2.to_i
  57.         tx = ty * k + b
  58.         fill_rect(tx + l, ty, length, 1, color)
  59.       end
  60.     end
  61.   end
  62.   def drawline_y(x1, y1, x2, y2, width, color)
  63.     l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (x1 - x2)
  64.     height = l.abs * 2
  65.     k = (y2 - y1) / (x2 - x1) #y=kx+b
  66.     b = y1 - k * x1
  67.     if l > 0
  68.       for tx in x2.to_i..x1.to_i
  69.         ty = tx * k + b
  70.         fill_rect(tx, ty - l, 1, height, color)
  71.       end
  72.     else
  73.       for tx in x1.to_i..x2.to_i
  74.         ty = tx * k + b
  75.         fill_rect(tx, ty + l, 1, height, color)
  76.       end
  77.     end
  78.   end
  79. end
  80. #==============================================================================
  81. # ■ Game_System
  82. #------------------------------------------------------------------------------
  83. #  处理系统附属数据的类。也可执行诸如 BGM 管理、交通工具之类的功能。本类的实
  84. # 例请参考 $game_system 。
  85. #==============================================================================

  86. class Game_System
  87.   attr_accessor :bank_loli_bitmap
  88.   attr_accessor :back_bank_bitmap
  89.   attr_accessor :prices                   # 存物品的收费价格
  90.   #--------------------------------------------------------------------------
  91.   # ● 初始化对象
  92.   #--------------------------------------------------------------------------
  93.   alias old_initialize initialize
  94.   def initialize
  95.     old_initialize
  96.     @bank_loli_bitmap = "MM_Pic1"
  97.     @back_bank_bitmap = "back"
  98.     @prices = Byz_Vocab::PRICES
  99.   end
  100. end
  101. #==============================================================================
  102. # ■ Game_Party
  103. #------------------------------------------------------------------------------
  104. #  处理队伍的类。包含金钱以及物品的信息。
  105. # 这个类的实例请参考 $game_party 。
  106. #==============================================================================
  107. class Game_Party < Game_Unit
  108.   attr_accessor :warehouse                              # 仓库
  109.   #--------------------------------------------------------------------------
  110.   # ● 初始化对象
  111.   #--------------------------------------------------------------------------
  112.   alias initialize_currency initialize
  113.   def initialize
  114.     initialize_currency
  115.     @warehouse_item = {}                                # 仓库物品
  116.     @warehouse_weapon = {}                              # 仓库武器
  117.     @warehouse_armor = {}                               # 仓库防具
  118.     @warehouse = [@warehouse_item, @warehouse_weapon, @warehouse_armor]
  119.   end
  120. end

  121. #==============================================================================
  122. # ■ Window_Warehouse
  123. #==============================================================================
  124. class Window_Warehouse < Window_Selectable
  125.   #--------------------------------------------------------------------------
  126.   # ● 初始化
  127.   #     kind  : 0  物品            bool :0  背包
  128.   #           : 1  武器                 :1  仓库
  129.   #           :2  防具
  130.   #--------------------------------------------------------------------------
  131.   def initialize(kind, bool)
  132.     super(100, 110, 285, 202)
  133.     @kind = kind
  134.     @bool = bool
  135.     @column_max = 1
  136.     @help_window = Window_Byz_Help.new
  137.     @last_kind = @kind + 1
  138.     self.index = 0
  139.     @last_index = self.index + 1
  140.     @data = []
  141.     refresh
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 写入 kind
  145.   #--------------------------------------------------------------------------
  146.   def kind=(index)
  147.     @kind = index
  148.     refresh
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 获取 obj
  152.   #--------------------------------------------------------------------------
  153.   def check
  154.     if @data[self.index] == nil
  155.       return nil
  156.     else
  157.       return @data[self.index].id
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 刷新开关
  162.   #--------------------------------------------------------------------------
  163.   def refresh_bool
  164.     @last_index = self.index + 1
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 刷新
  168.   #--------------------------------------------------------------------------
  169.   def refresh
  170.     if @bool == 1
  171.       dates = []
  172.       dates.clear
  173.       @data.clear
  174.       $game_party.warehouse[@kind].each_key {|key|
  175.         next if $game_party.warehouse[@kind][key] == nil
  176.         dates.push(key)}
  177.       if dates.size == 0
  178.         @data.clear
  179.       end
  180.       dates.sort!
  181.       if @kind == 0
  182.         dates.each{|index| @data.push($data_items[index])}
  183.       elsif @kind == 1
  184.         dates.each{|index| @data.push($data_weapons[index])}
  185.       elsif @kind == 2
  186.         dates.each{|index| @data.push($data_armors[index])}
  187.       end
  188.       @item_max = @data.size
  189.     else
  190.       @data.clear
  191.       for item in $game_party.items
  192.         if @kind == 0
  193.           @data.push(item) if item.is_a?(RPG::Item)
  194.         elsif @kind == 1
  195.           @data.push(item) if item.is_a?(RPG::Weapon)
  196.         elsif @kind == 2
  197.           @data.push(item) if item.is_a?(RPG::Armor)
  198.         end
  199.       end
  200.       @item_max = @data.size
  201.     end
  202.     return if 0 == @item_max
  203.     self.contents.clear
  204.     create_contents
  205.     if @data.size != 0
  206.       @data.each_index{|index| draw_item(index)}
  207.     end
  208.   end
  209.   
  210.   def update
  211.     super
  212.     if @last_index != self.index or @last_kind != @kind
  213.       item_index = check
  214.       if item_index != nil
  215.         if @kind == 0
  216.           @help_window.set_item($data_items[item_index])
  217.         elsif @kind == 1
  218.           @help_window.set_item($data_weapons[item_index])
  219.         elsif @kind == 2
  220.           @help_window.set_item($data_armors[item_index])
  221.         end
  222.       else
  223.         @help_window.clear
  224.         self.contents.clear
  225.       end
  226.       refresh
  227.       @last_index = self.index
  228.       @last_kind = @kind
  229.     end
  230.   end
  231.   
  232.   def dispose
  233.     super
  234.     @help_window.dispose
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 描绘项目
  238.   #     index : 项目编号
  239.   #--------------------------------------------------------------------------
  240.   def draw_item(index)
  241.     rect = item_rect(index)
  242.     item = @data[index]
  243.     self.contents.clear_rect(rect)
  244.     if item != nil
  245.       if @bool == 1
  246.         number = $game_party.warehouse[@kind][@data[index].id]
  247.       else
  248.         number = $game_party.item_number(item)
  249.       end
  250.       rect.width -= 4
  251.       draw_item_name(item, rect.x, rect.y, true)
  252.       self.contents.draw_text(rect, sprintf("%10d", number), 2)
  253.     else
  254.       self.contents.clear
  255.     end
  256.   end
  257. end

  258. #==============================================================================
  259. # ■ Window_Byz_Help   物品帮助
  260. #==============================================================================
  261. class Window_Byz_Help < Window_Base
  262.   #--------------------------------------------------------------------------
  263.   # ● 初始化
  264.   #--------------------------------------------------------------------------
  265.   def initialize
  266.     super(0, 312, 544, 104)
  267.   end
  268.   
  269.   def clear
  270.     self.contents.clear
  271.   end
  272.   
  273.   #--------------------------------------------------------------------------
  274.   # ● 文字设定
  275.   #     item  : 物品
  276.   #--------------------------------------------------------------------------
  277.   def set_item(item)
  278.     if item.nil?
  279.       self.contents.clear
  280.       self.contents.font.color = normal_color
  281.       self.contents.draw_text(0, 0, 512, 24, $game_temp.shop_word)
  282.       @item = nil
  283.       return
  284.     end
  285.     if item != @item
  286.       @item = item
  287.       self.contents.clear
  288.       self.contents.font.color = normal_color
  289.       self.contents.draw_text(0, 0, 512, 24, @item.description)
  290.       if @item.is_a?(RPG::Item)
  291.         # 物品范围描述
  292.         scope = "[对象] : "
  293.         case @item.scope
  294.         when 0;  scope += "无"
  295.         when 1;  scope += "敌单体"
  296.         when 2;  scope += "敌全体"
  297.         when 3;  scope += "敌单体 连续"
  298.         when 4;  scope += "敌单体 随机"
  299.         when 5;  scope += "敌二体 随机"
  300.         when 6;  scope += "敌三体 随机"
  301.         when 7;  scope += "我方单体"
  302.         when 8;  scope += "我方全体"
  303.         when 9;  scope += "我方单体 (阵亡)"
  304.         when 10; scope += "我方全体 (阵亡)"
  305.         when 11; scope += "使用者"
  306.         end
  307.         self.contents.draw_text(0, 24, 512, 24, scope)
  308.         # 物品范围描述结束
  309.         # 物品恢复效果描述
  310.         effection = "[效果] : "
  311.         if @item.hp_recovery_rate > 0
  312.           effection += "#{Vocab.hp}+#{@item.hp_recovery_rate}% "
  313.         elsif @item.hp_recovery_rate < 0
  314.           effection += "#{Vocab.hp}-#{@item.hp_recovery_rate}% "
  315.         elsif @item.hp_recovery > 0
  316.           effection += "#{Vocab.hp}+#{@item.hp_recovery} "
  317.         elsif @item.hp_recovery < 0
  318.           effection += "#{Vocab.hp}-#{@item.hp_recovery} "
  319.         end
  320.         if @item.mp_recovery_rate > 0
  321.           effection += "#{Vocab.mp}+#{@item.mp_recovery_rate}% "
  322.         elsif @item.mp_recovery_rate < 0
  323.           effection += "#{Vocab.mp}-#{@item.mp_recovery_rate}% "
  324.         elsif @item.mp_recovery > 0
  325.           effection += "#{Vocab.mp}+#{@item.mp_recovery} "
  326.         elsif @item.mp_recovery < 0
  327.           effection += "#{Vocab.mp}-#{@item.mp_recovery} "
  328.         end
  329.         effection += "伤害#{@item.base_damage} " if @item.base_damage != 0
  330.         case @item.parameter_type
  331.         when 1
  332.           effection += "最大#{Vocab.hp}+#{@item.parameter_points}"
  333.         when 2
  334.           effection += "最大#{Vocab.mp}+#{@item.parameter_points}"
  335.         when 3
  336.           effection += "#{Vocab.atk}+#{@item.parameter_points}"
  337.         when 4
  338.           effection += "#{Vocab.def}+#{@item.parameter_points}"
  339.         when 5
  340.           effection += "#{Vocab.spi}+#{@item.parameter_points}"
  341.         when 6
  342.           effection += "#{Vocab.agi}+#{@item.parameter_points}"
  343.         end
  344.         self.contents.draw_text(0, 48, 512, 24, effection)
  345.         # 物品恢复效果描述结束
  346.       else
  347.         # 武器防具可装备人员描述
  348.         equip = "[可装备] : "
  349.         for actor in $game_party.members
  350.           if actor.equippable?(@item)
  351.             equip += "、" if equip != "[可装备] : "
  352.             equip += actor.name
  353.           end
  354.         end
  355.         equip += "无" if equip == "[可装备] : "
  356.         self.contents.draw_text(0, 24, 512, 24, equip)
  357.         # 武器防具可装备人员描述结束
  358.         # 武器防具攻防增减描述
  359.         effection = "[属性] : "
  360.         if @item.atk != 0
  361.           effection += "攻击力+#{@item.atk} "
  362.         end
  363.         if @item.def != 0
  364.           effection += "防御力+#{@item.def} "
  365.         end
  366.         if @item.spi != 0
  367.           effection += "精神力+#{@item.spi} "
  368.         end
  369.         if @item.agi != 0
  370.           effection += "敏捷性+#{@item.agi} "
  371.         end
  372.         # 武器防具攻防增减描述结束
  373.         if @item.is_a?(RPG::Armor)
  374.           # 防具特殊属性描述
  375.           if @item.prevent_critical
  376.             effection += "防止会心一击 "
  377.           end
  378.           if @item.half_mp_cost
  379.             effection += "消费MP减半 "
  380.           end
  381.           if @item.double_exp_gain
  382.             effection += "双倍经验 "
  383.           end
  384.           if @item.auto_hp_recover
  385.             effection += "自动恢复HP "
  386.           end
  387.           # 防具特殊属性描述结束
  388.         else
  389.           # 武器特殊属性描述
  390.           if @item.two_handed
  391.             effection += "双手持 "
  392.           end
  393.           if @item.fast_attack
  394.             effection += "先发制人 "
  395.           end
  396.           if @item.dual_attack
  397.             effection += "连击 "
  398.           end
  399.           if @item.critical_bonus
  400.             effection += "频发会心一击 "
  401.           end
  402.           # 武器特殊属性描述结束
  403.         end
  404.         unless @item.element_set.empty?
  405.           # 武器防具属性描述(左边那一栏需要打勾的)
  406.           effection += @item.is_a?(RPG::Armor) ? "  [防具状态] : " : "  [武器属性] : "
  407.           for state in @item.element_set
  408.             effection += $data_system.elements[state] + " "
  409.           end
  410.           # 武器防具属性描述结束
  411.         end
  412.         unless @item.state_set.empty?
  413.           # 武器防具状态描述(右边那一栏需要打勾的)
  414.           effection += @item.is_a?(RPG::Armor) ? "  [无效化属性] : " : "  [附加状态] : "
  415.           for state in @item.state_set
  416.             effection += $data_states[state].name + " "
  417.           end
  418.           # 武器防具状态描述结束
  419.         end
  420.         self.contents.draw_text(0, 48, 512, 24, effection)
  421.       end
  422.     end
  423.   end
  424. end
  425. #==============================================================================
  426. # ■ Window_Byz_Name   标题名字
  427. #==============================================================================
  428. class Window_Byz_Name < Window_Base
  429.   #--------------------------------------------------------------------------
  430.   # ● 初始化对象
  431.   #     x : 窗口的 X 坐标
  432.   #     y : 窗口的 Y 坐标
  433.   #--------------------------------------------------------------------------
  434.   def initialize
  435.     super(0, 0, 384, 56)
  436.     self.contents.draw_text(-10, -5, 384, 32, "欢迎", 1)
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 设置
  440.   #--------------------------------------------------------------------------
  441.   def set(string)
  442.     self.contents.clear
  443.     self.contents.draw_text(-10, -5, 384, 32, string, 1)
  444.   end
  445. end

  446. #==============================================================================
  447. # ■ Window_ByzNumber
  448. #==============================================================================

  449. class Window_ByzNumber < Window_Base
  450.   #--------------------------------------------------------------------------
  451.   # ● 初始化
  452.   #--------------------------------------------------------------------------
  453.   def initialize(x, y)
  454.     super(x, y, 304, 130)
  455.     @item = nil
  456.     @max = 1
  457.     @price = 0
  458.     @number = 1
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ● 物品、最大个数、价格设定
  462.   #--------------------------------------------------------------------------
  463.   def set(item, max, price)
  464.     @item = item
  465.     @max = max
  466.     @price = price
  467.     @number = 1
  468.     refresh
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ● 取得数量
  472.   #--------------------------------------------------------------------------
  473.   def number
  474.     return @number
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ● 取得总价格
  478.   #--------------------------------------------------------------------------
  479.   def price
  480.     return @price * @number
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ● 刷新
  484.   #--------------------------------------------------------------------------
  485.   def refresh
  486.     y = 5
  487.     self.contents.clear
  488.     draw_item_name(@item, 0, y)
  489.     self.contents.font.color = normal_color
  490.     self.contents.draw_text(212, y, 20, WLH, "×")
  491.     self.contents.draw_text(248, y, 20, WLH, @number, 2)
  492.     self.cursor_rect.set(244, y, 28, WLH)
  493.     self.contents.draw_text(0, y + WLH * 2, 100, WLH, "所需金钱")
  494.     draw_currency_value(@price * @number, 4, y + WLH * 2, 264)
  495.     self.contents.draw_text(0, y + WLH * 3, 100, WLH, "现有金钱")
  496.     draw_currency_value($game_party.gold, 4, y + WLH * 3, 264)
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● 更新(再定义)
  500.   #--------------------------------------------------------------------------
  501.   def update
  502.     super
  503.     if self.active
  504.       last_number = @number
  505.       if Input.repeat?(Input::RIGHT) and @number < @max
  506.         @number += 1
  507.       end
  508.       if Input.repeat?(Input::LEFT) and @number > 1
  509.         @number -= 1
  510.       end
  511.       if Input.repeat?(Input::UP) and @number < @max
  512.         @number = [@number + 10, @max].min
  513.       end
  514.       if Input.repeat?(Input::DOWN) and @number > 1
  515.         @number = [@number - 10, 1].max
  516.       end
  517.       if @number != last_number
  518.         Sound.play_cursor
  519.         refresh
  520.       end
  521.     end
  522.   end
  523. end
  524. #==========================================================================
  525. #  Scene_Byz_Bank
  526. #==========================================================================
  527. class Scene_Byz_Bank < Scene_Base
  528.   #======== 初始化 ========
  529.   def initialize
  530.     @command = []
  531.     @currency_exchanges_1 = -1              # 需要兑换的货币种类
  532.     @currency_exchanges_2 = -1
  533.     @numbers = 0
  534.     @command_number = []
  535.     @command_numbers = []
  536.     @type = -1                              # 窗口刷新标志
  537.   end
  538.   #======== 主题 ========
  539.   #--------------------------------------------------------------------------
  540.   # ● 开始处理
  541.   #--------------------------------------------------------------------------
  542.   def start
  543.     super
  544.     create_menu_background
  545.     create_name
  546.     create_warehouse_command
  547.     @gold_window = Window_Gold.new(384, 0)
  548.     draw_loli_bitmap if $game_system.bank_loli_bitmap != ""
  549.     draw_back_bitmap if $game_system.back_bank_bitmap != ""
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● 结束处理
  553.   #--------------------------------------------------------------------------
  554.   def terminate
  555.     super
  556.     dispose_menu_background
  557.     dispose_loli_bitmap if $game_system.bank_loli_bitmap != ""
  558.     dispose_back_bitmap if $game_system.back_bank_bitmap != ""
  559.     @warehouse_obj_command_window.dispose if @warehouse_obj_command_window != nil
  560.     @name_window.dispose
  561.     @gold_window.dispose
  562.     @warehouse_command_window.dispose
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● 刷新
  566.   #--------------------------------------------------------------------------
  567.   def update
  568.     super
  569.     @warehouse_command_window.update if @warehouse_command_window.active
  570.     @warehouse_window.update if @warehouse_window != nil and @warehouse_window.active
  571.     @warehouse_input.update if @warehouse_input != nil
  572.     if @warehouse_command_window.active
  573.       update_warehouse_command
  574.     elsif @warehouse_input != nil
  575.       update_warehouse_input(@type)
  576.     elsif @warehouse_window != nil and @warehouse_window.active
  577.       update_warehouse_window
  578.     end
  579.   end
  580.   #======== //end主题 ========   
  581.   #========    创建   ========
  582.   #--------------------------------------------------------------------------
  583.   # ● 创建仓库选项
  584.   #--------------------------------------------------------------------------
  585.   def create_warehouse_command
  586.     s1 = Byz_Vocab::WAREHOUSE_SAVING
  587.     s2 = Byz_Vocab::WAREHOUSE_TAKING
  588.     s3 = Byz_Vocab::CANCEN
  589.     @warehouse_command_window = Window_Command.new(384,[s1, s2, s3], 3)
  590.     @warehouse_command_window.x = 0
  591.     @warehouse_command_window.y = 55
  592.     @warehouse_command_window.index = 0
  593.     @warehouse_command_window.active = true
  594.     @warehouse_command_window.visible = true
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● 创建仓库子选项
  598.   #--------------------------------------------------------------------------  
  599.   def create_warehouse_type
  600.     @warehouse_obj_command_window = Window_Base.new(0,110, 100, 130)
  601.     @warehouse_obj_command_window.visible = true
  602.     @warehouse_obj_command_window_index = 0
  603.     @warehouse_obj_command_window.contents.draw_text(-5, -27, 78, 100, "物品", 1)
  604.     @warehouse_obj_command_window.contents.draw_text(-5, 0, 78, 100, "武器", 1)
  605.     @warehouse_obj_command_window.contents.draw_text(-5, 27, 78, 100, "防具", 1)
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ● 创建银行名字
  609.   #--------------------------------------------------------------------------
  610.   def create_name
  611.     @name_window = Window_Byz_Name.new
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● 显示LOLI图片
  615.   #--------------------------------------------------------------------------
  616.   def draw_loli_bitmap
  617.     @bitmap_viewport = Viewport.new(384, 55, 544, 416)
  618.     @loli_bitmap = Sprite.new(@bitmap_viewport)
  619.     @loli_bitmap.bitmap = Bitmap.new("Graphics/Pictures/#{$game_system.bank_loli_bitmap}")
  620.     @bitmap_viewport.z = 1
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● 显示背景图片
  624.   #--------------------------------------------------------------------------
  625.   def draw_back_bitmap
  626.     @back_bitmap = Sprite.new
  627.     @back_bitmap.bitmap = Bitmap.new("Graphics/Pictures/#{$game_system.back_bank_bitmap}")
  628.     @back_bitmap.x = @back_bitmap.y = 0
  629.     @back_bitmap.z = 0
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ● 显示箭头图片
  633.   #--------------------------------------------------------------------------
  634.   def show_arrow_two
  635.     @arrow_two = Sprite.new
  636.     @arrow_two.bitmap = Bitmap.new("Graphics/Pictures/#{Byz_Vocab::ARROW_TWO}")
  637.     @arrow_two.x = 0
  638.     @arrow_two.y = 130
  639.     @arrow_two.z = 500
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ● 显示提示窗口
  643.   #--------------------------------------------------------------------------
  644.   def show_window(string)
  645.     re = string.split(//)
  646.     w = Window_Base.new(150, 100, re.size * 32 + 64, 64)
  647.     w.contents = Bitmap.new(w.width - 32, w.height - 32)
  648.     w.contents.font.color = w.text_color(2)
  649.     w.contents.draw_text(0, -15, w.width, w.height, string)
  650.     for i in 0..10
  651.       w.open
  652.       w.update
  653.       Graphics.update
  654.     end
  655.     for i in 0..30
  656.       Graphics.update
  657.     end
  658.     for i in 0..20
  659.       w.close
  660.       w.update
  661.       Graphics.update
  662.     end
  663.     w.dispose
  664.   end
  665.   #======== //end创建 ========
  666.   #========    更新   ========
  667.   #--------------------------------------------------------------------------
  668.   # ● 仓库总窗口刷新
  669.   #--------------------------------------------------------------------------
  670.   def update_warehouse_command
  671.     if Input.trigger?(Input::B)
  672.       $scene = Scene_Map.new
  673.     elsif Input.trigger?(Input::C)
  674.       Sound.play_decision
  675.       case @warehouse_command_window.index
  676.       when 0
  677.         create_warehouse_type
  678.         show_arrow_two
  679.         @warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, 0)
  680.         @warehouse_window.active = true
  681.         @bitmap_viewport.rect.set(384, 55, 544, 257)
  682.         @type = 0
  683.         @warehouse_command_window.active = false
  684.         @warehouse_command_window.index = -1
  685.         @name_window.set("存物品")
  686.       when 1
  687.         create_warehouse_type
  688.         show_arrow_two
  689.         @warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, 1)
  690.         @warehouse_window.active = true
  691.         @bitmap_viewport.rect.set(384, 55, 544, 257)
  692.         @type = 1
  693.         @warehouse_command_window.active = false
  694.         @warehouse_command_window.index = -1
  695.         @name_window.set("取物品")
  696.       when 2
  697.         $scene = Scene_Map.new
  698.       end
  699.     end
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● 物品窗口刷新
  703.   #--------------------------------------------------------------------------  
  704.   def update_warehouse_window
  705.     if Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
  706.       Sound.play_decision
  707.       @warehouse_obj_command_window_index += 1
  708.       @warehouse_obj_command_window_index %= 3
  709.       @warehouse_window.kind = @warehouse_obj_command_window_index
  710.       @warehouse_window.index = 0
  711.       @arrow_two.y = 130 + @warehouse_obj_command_window_index * 32
  712.     elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
  713.       Sound.play_decision
  714.       @warehouse_obj_command_window_index -= 1
  715.       @warehouse_obj_command_window_index %= 3
  716.       @warehouse_window.kind = @warehouse_obj_command_window_index
  717.       @item_index = @warehouse_window.check
  718.       @warehouse_window.index = 0
  719.       @arrow_two.y = 130 + @warehouse_obj_command_window_index * 32
  720.     elsif Input.trigger?(Input::C)
  721.       Sound.play_decision
  722.       @item_index = @warehouse_window.check
  723.       @last_index = @warehouse_window.index
  724.       if @item_index == nil
  725.         return
  726.       end
  727.       @warehouse_window.active = false
  728.       @warehouse_input = Window_ByzNumber.new(100, 100)
  729.       @warehouse_input.active = true
  730.       if @type == 0
  731.         price = Byz_Vocab::PRICES
  732.         if @warehouse_obj_command_window_index == 0
  733.           @warehouse_input.set($data_items[@item_index], $game_party.item_number($data_items[@item_index]), price)
  734.         elsif @warehouse_obj_command_window_index == 1
  735.           @warehouse_input.set($data_weapons[@item_index], $game_party.item_number($data_weapons[@item_index]), price)
  736.         elsif @warehouse_obj_command_window_index == 2
  737.           @warehouse_input.set($data_armors[@item_index], $game_party.item_number($data_armors[@item_index]), price)
  738.         end
  739.       else
  740.         if @warehouse_obj_command_window_index == 0
  741.           @warehouse_input.set($data_items[@item_index], $game_party.warehouse[0][@item_index], 0)
  742.         elsif @warehouse_obj_command_window_index == 1
  743.           @warehouse_input.set($data_weapons[@item_index], $game_party.warehouse[1][@item_index], 0)
  744.         elsif @warehouse_obj_command_window_index == 2
  745.           @warehouse_input.set($data_armors[@item_index], $game_party.warehouse[2][@item_index], 0)
  746.         end
  747.       end
  748.     elsif Input.trigger?(Input::B)
  749.       @warehouse_obj_command_window.dispose
  750.       @warehouse_obj_command_window = nil
  751.       @arrow_two.bitmap.dispose
  752.       @arrow_two.dispose
  753.       @warehouse_window.dispose
  754.       @warehouse_window = nil
  755.       @warehouse_command_window.index = @type
  756.       @warehouse_command_window.active = true
  757.       @bitmap_viewport.rect.set(384, 55, 544, 416)
  758.       @name_window.set("欢迎")
  759.     end
  760.   end
  761.   
  762.   def update_warehouse_input(type)
  763.     if Input.trigger?(Input::B)
  764.       @warehouse_obj_command_window.dispose
  765.       @warehouse_obj_command_window = nil
  766.       @arrow_two.bitmap.dispose
  767.       @arrow_two.dispose
  768.       create_warehouse_type
  769.       show_arrow_two
  770.       @warehouse_window.dispose
  771.       @warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, @type)
  772.       @warehouse_window.active = true
  773.       @warehouse_window.index = @last_index
  774.       @warehouse_input.dispose if @warehouse_input != nil
  775.       @warehouse_input = nil
  776.       @warehouse_window.active = true
  777.     elsif Input.trigger?(Input::C)
  778.       Sound.play_decision
  779.       @item_index = @warehouse_window.check
  780.       if @item_index == nil
  781.         return
  782.       end
  783.       @numbers = @warehouse_input.number
  784.       price = @warehouse_input.price
  785.       if type == 0
  786.         if @warehouse_obj_command_window_index == 0
  787.           if price < $game_party.gold
  788.             $game_party.lose_item($data_items[@item_index], @numbers)
  789.             if $game_party.warehouse[0][@item_index] == nil
  790.               $game_party.warehouse[0][@item_index] = 0
  791.             end
  792.             $game_party.lose_gold(@warehouse_input.price)
  793.             $game_party.warehouse[0][@item_index] += @numbers
  794.             @warehouse_window.refresh_bool
  795.             @gold_window.refresh
  796.             input_to_command
  797.           else
  798.             show_window("金钱不足")
  799.             return
  800.           end
  801.         elsif @warehouse_obj_command_window_index == 1
  802.           if price < $game_party.gold
  803.             $game_party.lose_item($data_weapons[@item_index], @numbers)
  804.             if $game_party.warehouse[1][@item_index] == nil
  805.               $game_party.warehouse[1][@item_index] = 0
  806.             end
  807.             $game_party.lose_gold(@warehouse_input.price)
  808.             $game_party.warehouse[1][@item_index] += @numbers
  809.             @warehouse_window.refresh_bool
  810.             @gold_window.refresh
  811.             input_to_command
  812.           else
  813.             show_window("金钱不足")
  814.             return
  815.           end
  816.         elsif @warehouse_obj_command_window_index == 2
  817.           if price < $game_party.gold
  818.             $game_party.lose_item($data_armors[@item_index], @numbers)
  819.             if $game_party.warehouse[2][@item_index] == nil
  820.               $game_party.warehouse[2][@item_index] = 0
  821.             end
  822.             $game_party.lose_gold(@warehouse_input.price)
  823.             $game_party.warehouse[2][@item_index] += @numbers
  824.             @warehouse_window.refresh_bool
  825.             @gold_window.refresh
  826.             input_to_command
  827.           else
  828.             show_window("金钱不足")
  829.             return
  830.           end
  831.         end
  832.       else
  833.         if @warehouse_obj_command_window_index == 0
  834.           if $game_party.warehouse[0][@item_index] == nil
  835.             input_to_command
  836.             return
  837.           end
  838.           if $game_party.warehouse[0][@item_index] <= @numbers
  839.             @numbers = $game_party.warehouse[0][@item_index]
  840.             $game_party.warehouse[0][@item_index] = nil
  841.           else
  842.             $game_party.warehouse[0][@item_index] -= @numbers
  843.           end
  844.           $game_party.gain_item($data_items[@item_index], @numbers)
  845.           @warehouse_window.refresh_bool
  846.           @gold_window.refresh
  847.           input_to_command
  848.         elsif @warehouse_obj_command_window_index == 1
  849.           if $game_party.warehouse[1][@item_index] == nil
  850.             @warehouse_window.refresh_bool
  851.             input_to_command
  852.             return
  853.           end
  854.           if $game_party.warehouse[1][@item_index] <= @numbers
  855.             @numbers = $game_party.warehouse[1][@item_index]
  856.             $game_party.warehouse[1][@item_index] = nil
  857.           else
  858.             $game_party.warehouse[1][@item_index] -= @numbers
  859.           end
  860.           $game_party.gain_item($data_weapons[@item_index], @numbers)
  861.           @warehouse_window.refresh_bool
  862.           @gold_window.refresh
  863.           input_to_command
  864.         elsif @warehouse_obj_command_window_index == 2
  865.           if $game_party.warehouse[2][@item_index] == nil
  866.             @warehouse_window.refresh_bool
  867.             input_to_command
  868.             return
  869.           end
  870.           if $game_party.warehouse[2][@item_index] <= @numbers
  871.             @numbers = $game_party.warehouse[2][@item_index]
  872.             $game_party.warehouse[2][@item_index] = nil
  873.           else
  874.             $game_party.warehouse[2][@item_index] -= @numbers
  875.           end
  876.           $game_party.gain_item($data_armors[@item_index], @numbers)
  877.           @warehouse_window.refresh_bool
  878.           @gold_window.refresh
  879.           input_to_command
  880.         end
  881.       end
  882.     end
  883.   end
  884.   #======== //end更新 ========
  885.   #========    切换   ========
  886.   def input_to_command
  887.     @warehouse_input.dispose
  888.     @warehouse_input = nil
  889.     @warehouse_window.refresh
  890.     @warehouse_window.active = true
  891.   end
  892.   #======== //end切换 ========
  893.   #========    释放   ========
  894.   #--------------------------------------------------------------------------
  895.   # ● 释放LOLI图片
  896.   #--------------------------------------------------------------------------
  897.   def dispose_loli_bitmap
  898.     @loli_bitmap.bitmap.dispose
  899.     @loli_bitmap.dispose
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● 释放背景图片
  903.   #--------------------------------------------------------------------------
  904.   def dispose_back_bitmap
  905.     @back_bitmap.bitmap.dispose
  906.     @back_bitmap.dispose
  907.   end
  908.   #======== //end释放 ========
  909. end
复制代码
起码对得起自己。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-28 22:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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