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

Project1

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

[已经过期] 请问如何让限制型魔法商店和通用型魔法商店共存?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2009-10-4
帖子
45
跳转到指定楼层
1
发表于 2013-6-29 15:29:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我现在试了两个都加 然后只能呼出其中一个 求解
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. #——以下是一些自定义的内容
  6. $mShop_use_1 = "灵魄"    #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”
  7. $mShop_use_2 = "特斯拉"  #——这项是购买魔法特技的货币单位,如“点”、“¥”
  8. $mShop_use_variable = 1  #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱
  9. $mShop_Window_Opacity = 200  #——这项是窗口透明度
  10. #==============================================================================
  11. # ■ Window_MGold
  12. #------------------------------------------------------------------------------
  13. #  显示金钱的窗口。
  14. #==============================================================================
  15. class Window_MGold < Window_Base
  16.   #--------------------------------------------------------------------------
  17.   # ● 初始化窗口
  18.   #--------------------------------------------------------------------------
  19.   def initialize
  20.     super(0, 0, 272, 64)
  21.     self.contents = Bitmap.new(width - 32, height - 32)
  22.     refresh
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh
  28.     self.contents.clear
  29.     self.contents.font.color = system_color
  30.     self.contents.draw_text(0, 0 , 240,32 ,$mShop_use_1)
  31.     self.contents.font.color = normal_color
  32.     self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
  33.     self.contents.font.color = system_color
  34.     self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
  35.   end
  36. end
  37. #==============================================================================
  38. # ■ Scene_MShop
  39. #------------------------------------------------------------------------------
  40. #  处理特技商店画面的类。
  41. #==============================================================================
  42. class Scene_MShop
  43.   #--------------------------------------------------------------------------
  44.   # ● 初始化
  45.   #--------------------------------------------------------------------------
  46.   def initialize(id)
  47.     @id = id
  48.   end   
  49.   #--------------------------------------------------------------------------
  50.   # ● 主处理
  51.   #--------------------------------------------------------------------------
  52.   def main
  53.     screen = Spriteset_Map.new
  54.     if $mShop_use_variable == 0
  55.       $mShop_gold = $game_party.gold
  56.     else
  57.       $mShop_gold = $game_variables[$mShop_use_variable]
  58.     end
  59.     # 生成帮助窗口
  60.     @help_window = Window_Help.new
  61.     @help_window.opacity = $mShop_Window_Opacity
  62.     # 生成金钱窗口
  63.     @gold_window = Window_MGold.new
  64.     @gold_window.x = 368
  65.     @gold_window.y = 416
  66.     @gold_window.opacity = $mShop_Window_Opacity
  67.     # 生成购买窗口
  68.     @buy_window = Window_MShopBuy.new(@id)
  69.     @buy_window.active = true
  70.     @buy_window.visible = true
  71.     @buy_window.help_window = @help_window
  72.     @buy_window.opacity = $mShop_Window_Opacity
  73.     # 生成状态窗口
  74.     @status_window = Window_MShopStatus.new
  75.     @status_window.visible = true
  76.     @status_window.active = false
  77.     @status_window.opacity = $mShop_Window_Opacity
  78.     # 执行过渡
  79.     Graphics.transition
  80.     # 主循环
  81.     loop do
  82.       # 刷新游戏画面
  83.       Graphics.update
  84.       # 刷新输入信息
  85.       Input.update
  86.       # 刷新画面
  87.       update
  88.       # 如果画面切换的话就中断循环
  89.       if $scene != self
  90.         break
  91.       end
  92.     end
  93.     # 准备过渡
  94.     Graphics.freeze
  95.     # 释放窗口
  96.     @help_window.dispose
  97.     #@mhelp_window.dispose
  98.     @gold_window.dispose
  99.     @buy_window.dispose
  100.     @status_window.dispose
  101.     screen.dispose
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 刷新画面
  105.   #--------------------------------------------------------------------------
  106.   def update
  107.     # 刷新窗口
  108.     @help_window.update
  109.     #@mhelp_window.update
  110.     @gold_window.update
  111.     @buy_window.update
  112.     @status_window.update
  113.     # 购买窗口激活的情况下: 调用 update_buy
  114.     if @buy_window.active
  115.       update_buy
  116.       return
  117.     end
  118.     if @status_window.active
  119.       update_status
  120.       return
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 刷新画面 (购买窗口激活的情况下)
  125.   #--------------------------------------------------------------------------
  126.   def update_buy
  127.     @status_window.skill = @buy_window.skill
  128.     if Input.trigger?(Input::B)
  129.       $game_system.se_play($data_system.cancel_se)
  130.       $scene = Scene_Map.new
  131.       return
  132.     end
  133.     if Input.trigger?(Input::C)
  134.       [url=home.php?mod=space&uid=260100]@skill[/url] = @buy_window.skill
  135.       if @skill == nil or @skill.price > $mShop_gold
  136.         $game_system.se_play($data_system.buzzer_se)
  137.         return
  138.       end
  139.       $game_system.se_play($data_system.decision_se)
  140.       @buy_window.active = false
  141.       @status_window.index = 0
  142.       @status_window.active = true
  143.     end
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 刷新画面 (状态窗口激活的情况下)
  147.   #--------------------------------------------------------------------------
  148.   def update_status
  149.     if Input.trigger?(Input::B)
  150.       $game_system.se_play($data_system.cancel_se)
  151.       @status_window.active = false
  152.       @status_window.index = -1
  153.       @buy_window.active = true
  154.     end
  155.     if Input.trigger?(Input::C)
  156.       if $game_party.actors[@status_window.index].skill_learn?(@skill.id)
  157.         $game_system.se_play($data_system.cancel_se)
  158.         return
  159.       else
  160.         $game_system.se_play($data_system.decision_se)
  161.         if $mShop_use_variable == 0
  162.           $game_party.gain_gold([email protected])
  163.           $mShop_gold -= @skill.price
  164.         else
  165.           $game_variables[$mShop_use_variable] -= @skill.price
  166.           $mShop_gold -= @skill.price
  167.         end
  168.         $game_party.actors[@status_window.index].learn_skill(@skill.id)
  169.         @gold_window.refresh
  170.         @buy_window.refresh
  171.         @status_window.refresh
  172.         @status_window.active = false
  173.         @status_window.index = -1
  174.         @buy_window.active = true
  175.       end      
  176.     end     
  177.   end
  178. end
  179. #==============================================================================
  180. # ■ Window_MShopStatus
  181. #------------------------------------------------------------------------------
  182. #  特技商店画面、显示物品所持数与角色装备的窗口。
  183. #==============================================================================
  184. class Window_MShopStatus < Window_Selectable
  185.   #--------------------------------------------------------------------------
  186.   # ● 初始化对像
  187.   #--------------------------------------------------------------------------
  188.   def initialize
  189.     super(368, 64, 272, 352)
  190.     self.contents = Bitmap.new(width - 32, height - 32)
  191.     self.contents.font.size = 18
  192.     @skill = nil
  193.     refresh
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 刷新
  197.   #--------------------------------------------------------------------------
  198.   def refresh
  199.     self.contents.clear
  200.     for i in 0...$game_party.actors.size
  201.       actor = $game_party.actors[i]
  202.       draw_actor_graphic(actor,12,80*i+64)
  203.       self.contents.font.color = system_color
  204.       self.contents.draw_text(44, 80*i, 240, 32, actor.name)
  205.       self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
  206.       self.contents.font.color = normal_color
  207.       self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
  208.       self.contents.font.color = system_color
  209.       self.contents.draw_text(44, 80*i+22, 45, 32, $data_system.words.hp)
  210.       self.contents.font.color = normal_color
  211.       self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
  212.       self.contents.font.color = system_color
  213.       self.contents.draw_text(150, 80*i+22, 45, 32, $data_system.words.sp)
  214.       self.contents.font.color = normal_color
  215.       self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxsp.to_s,2)      
  216.       if actor.skill_learn?(@skill.id)
  217.         self.contents.font.color = Color.new(255,255,255,128)
  218.         self.contents.draw_text(44, 80*i+44, 196, 32, "⊙此项特技已经学习⊙",2)         
  219.       else
  220.         self.contents.font.color = Color.new(255,255,0,255)
  221.         self.contents.draw_text(44, 80*i+44, 240, 32, "★此项特技尚未学习★")
  222.       end
  223.     end
  224.     @item_max = $game_party.actors.size
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 设置物品
  228.   #     item : 新的物品
  229.   #--------------------------------------------------------------------------
  230.   def skill=(skill)
  231.     if @skill != skill
  232.       @skill = skill
  233.       refresh
  234.     end
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 刷新光标矩形
  238.   #--------------------------------------------------------------------------
  239.   def update_cursor_rect
  240.     if @index < 0
  241.       self.cursor_rect.empty
  242.     else
  243.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  244.     end
  245.   end
  246. end
  247. #==============================================================================
  248. # ■ Window_MShopBuy
  249. #------------------------------------------------------------------------------
  250. #  特技商店画面、浏览显示可以购买的商品的窗口。
  251. #==============================================================================
  252. class Window_MShopBuy < Window_Selectable
  253.   #--------------------------------------------------------------------------
  254.   # ● 初始化对像
  255.   #     shop_goods : 商品
  256.   #--------------------------------------------------------------------------
  257.   def initialize(id)
  258.     super(0, 64, 368, 416)
  259.     @id = id
  260.     refresh
  261.     self.index = 0
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 获取物品
  265.   #--------------------------------------------------------------------------
  266.   def skill
  267.     return @data[self.index]
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 刷新
  271.   #--------------------------------------------------------------------------
  272.   def refresh
  273.     if self.contents != nil
  274.       self.contents.dispose
  275.       self.contents = nil
  276.     end
  277.     @data = []
  278.     for skill_id in @id
  279.       skill = $data_skills[skill_id]
  280.       if skill != nil
  281.         @data.push(skill)
  282.       end
  283.     end
  284.     @item_max = @data.size
  285.     if @item_max > 0
  286.       self.contents = Bitmap.new(width - 32, row_max * 32)
  287.       for i in 0...@item_max
  288.         draw_item(i)
  289.       end
  290.     end
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 描绘羡慕
  294.   #     index : 项目编号
  295.   #--------------------------------------------------------------------------
  296.   def draw_item(index)
  297.     skill = @data[index]
  298.     # 除此之外的情况设置为无效文字色
  299.     if skill.price <= $mShop_gold
  300.       self.contents.font.color = normal_color
  301.     else
  302.       self.contents.font.color = disabled_color
  303.     end
  304.     x = 4
  305.     y = index * 32
  306.     rect = Rect.new(x, y, self.width - 32, 32)
  307.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  308.     bitmap = RPG::Cache.icon(skill.icon_name)
  309.     opacity = self.contents.font.color == normal_color ? 255 : 128
  310.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  311.     self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
  312.     self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 刷新帮助文本
  316.   #--------------------------------------------------------------------------
  317.   def update_help
  318.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  319.   end
  320. end
  321. #==============================================================================
  322. # ■ RPG原装定义
  323. #==============================================================================
  324. module RPG
  325.   class Skill
  326.     def description
  327.       description = @description.split(/@/)[0]
  328.       return description != nil ? description : ''
  329.     end
  330.     def price
  331.       price = @description.split(/@/)[1]
  332.       return price != nil ? price.to_i : 0
  333.     end
  334.   end
  335. end
  336. #==============================================================================
  337. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  338. #==============================================================================
复制代码
通用型↑
限制型↓
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ 本脚本源自www.66rpg.com,转载与使用请保留此信息
  6. #==============================================================================
  7. #——以下是一些自定义的内容
  8. $mShop_use_1 = "灵魄"    #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”
  9. $mShop_use_2 = "特斯拉"  #——这项是购买魔法特技的货币单位,如“点”、“¥”
  10. $mShop_use_variable = 1  #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱
  11. $mShop_Window_Opacity = 200  #——这项是窗口透明度
  12. #==============================================================================
  13. # ■ Window_MGold
  14. #------------------------------------------------------------------------------
  15. #  显示金钱的窗口。
  16. #==============================================================================
  17. class Window_MGold < Window_Base
  18.   #--------------------------------------------------------------------------
  19.   # ● 初始化窗口
  20.   #--------------------------------------------------------------------------
  21.   def initialize
  22.     super(0, 0, 272, 64)
  23.     self.contents = Bitmap.new(width - 32, height - 32)
  24.     refresh
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 刷新
  28.   #--------------------------------------------------------------------------
  29.   def refresh
  30.     self.contents.clear
  31.     self.contents.font.color = system_color
  32.     self.contents.draw_text(0, 0 , 240,32 ,$mShop_use_1)
  33.     self.contents.font.color = normal_color
  34.     self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
  35.     self.contents.font.color = system_color
  36.     self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
  37.   end
  38. end
  39. #==============================================================================
  40. # ■ Scene_MShop
  41. #------------------------------------------------------------------------------
  42. #  处理特技商店画面的类。
  43. #==============================================================================
  44. class Scene_MShop
  45.   #--------------------------------------------------------------------------
  46.   # ● 初始化
  47.   #--------------------------------------------------------------------------
  48.   def initialize(id)
  49.     @id = id
  50.   end   
  51.   #--------------------------------------------------------------------------
  52.   # ● 主处理
  53.   #--------------------------------------------------------------------------
  54.   def main
  55.     screen = Spriteset_Map.new
  56.     if $mShop_use_variable == 0
  57.       $mShop_gold = $game_party.gold
  58.     else
  59.       $mShop_gold = $game_variables[$mShop_use_variable]
  60.     end
  61.     # 生成帮助窗口
  62.     @help_window = Window_Help.new
  63.     @help_window.opacity = $mShop_Window_Opacity
  64.     # 生成金钱窗口
  65.     @gold_window = Window_MGold.new
  66.     @gold_window.x = 368
  67.     @gold_window.y = 416
  68.     @gold_window.opacity = $mShop_Window_Opacity
  69.     # 生成购买窗口
  70.     @buy_window = Window_MShopBuy.new(@id)
  71.     @buy_window.active = true
  72.     @buy_window.visible = true
  73.     @buy_window.help_window = @help_window
  74.     @buy_window.opacity = $mShop_Window_Opacity
  75.     # 生成状态窗口
  76.     @status_window = Window_MShopStatus.new
  77.     @status_window.visible = true
  78.     @status_window.active = false
  79.     @status_window.opacity = $mShop_Window_Opacity
  80.     # 执行过渡
  81.     Graphics.transition
  82.     # 主循环
  83.     loop do
  84.       # 刷新游戏画面
  85.       Graphics.update
  86.       # 刷新输入信息
  87.       Input.update
  88.       # 刷新画面
  89.       update
  90.       # 如果画面切换的话就中断循环
  91.       if $scene != self
  92.         break
  93.       end
  94.     end
  95.     # 准备过渡
  96.     Graphics.freeze
  97.     # 释放窗口
  98.     @help_window.dispose
  99.     #@mhelp_window.dispose
  100.     @gold_window.dispose
  101.     @buy_window.dispose
  102.     @status_window.dispose
  103.     screen.dispose
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 刷新画面
  107.   #--------------------------------------------------------------------------
  108.   def update
  109.     # 刷新窗口
  110.     @help_window.update
  111.     #@mhelp_window.update
  112.     @gold_window.update
  113.     @buy_window.update
  114.     @status_window.update
  115.     # 购买窗口激活的情况下: 调用 update_buy
  116.     if @buy_window.active
  117.       update_buy
  118.       return
  119.     end
  120.     if @status_window.active
  121.       update_status
  122.       return
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 刷新画面 (购买窗口激活的情况下)
  127.   #--------------------------------------------------------------------------
  128.   def update_buy
  129.     @status_window.skill = @buy_window.skill
  130.     if Input.trigger?(Input::B)
  131.       $game_system.se_play($data_system.cancel_se)
  132.       $scene = Scene_Map.new
  133.       return
  134.     end
  135.     if Input.trigger?(Input::C)
  136.       @skill = @buy_window.skill
  137.       if @skill == nil or @skill.price > $mShop_gold
  138.         $game_system.se_play($data_system.buzzer_se)
  139.         return
  140.       end
  141.       $game_system.se_play($data_system.decision_se)
  142.       @buy_window.active = false
  143.       @status_window.index = 0
  144.       @status_window.active = true
  145.     end
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 刷新画面 (状态窗口激活的情况下)
  149.   #--------------------------------------------------------------------------
  150.   def update_status
  151.     if Input.trigger?(Input::B)
  152.       $game_system.se_play($data_system.cancel_se)
  153.       @status_window.active = false
  154.       @status_window.index = -1
  155.       @buy_window.active = true
  156.     end
  157.     if Input.trigger?(Input::C)
  158.       can_learn=false
  159.       for j in $data_classes[$game_party.actors[@status_window.index].class_id].learnings
  160.         if j.skill_id == @skill.id
  161.           can_learn=true
  162.         end
  163.       end
  164.       if can_learn==false
  165.         $game_system.se_play($data_system.cancel_se)
  166.         return
  167.       end
  168.       if $game_party.actors[@status_window.index].skill_learn?(@skill.id)
  169.         $game_system.se_play($data_system.cancel_se)
  170.         return
  171.       else
  172.         $game_system.se_play($data_system.decision_se)
  173.         if $mShop_use_variable == 0
  174.           $game_party.gain_gold([email protected])
  175.           $mShop_gold -= @skill.price
  176.         else
  177.           $game_variables[$mShop_use_variable] -= @skill.price
  178.           $mShop_gold -= @skill.price
  179.         end
  180.         $game_party.actors[@status_window.index].learn_skill(@skill.id)
  181.         @gold_window.refresh
  182.         @buy_window.refresh
  183.         @status_window.refresh
  184.         @status_window.active = false
  185.         @status_window.index = -1
  186.         @buy_window.active = true
  187.       end      
  188.     end     
  189.   end
  190. end
  191. #==============================================================================
  192. # ■ Window_MShopStatus
  193. #------------------------------------------------------------------------------
  194. #  特技商店画面、显示物品所持数与角色装备的窗口。
  195. #==============================================================================
  196. class Window_MShopStatus < Window_Selectable
  197.   #--------------------------------------------------------------------------
  198.   # ● 初始化对像
  199.   #--------------------------------------------------------------------------
  200.   def initialize
  201.     super(368, 64, 272, 352)
  202.     self.contents = Bitmap.new(width - 32, height - 32)
  203.     self.contents.font.size = 18
  204.     @skill = nil
  205.     refresh
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 刷新
  209.   #--------------------------------------------------------------------------
  210.   def refresh
  211.     self.contents.clear
  212.     for i in 0...$game_party.actors.size
  213.       actor = $game_party.actors[i]
  214.       draw_actor_graphic(actor,12,80*i+64)
  215.       self.contents.font.color = system_color
  216.       self.contents.draw_text(44, 80*i, 240, 32, actor.name)
  217.       self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
  218.       self.contents.font.color = normal_color
  219.       self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
  220.       self.contents.font.color = system_color
  221.       self.contents.draw_text(44, 80*i+22, 45, 32, $data_system.words.hp)
  222.       self.contents.font.color = normal_color
  223.       self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
  224.       self.contents.font.color = system_color
  225.       self.contents.draw_text(150, 80*i+22, 45, 32, $data_system.words.sp)
  226.       self.contents.font.color = normal_color
  227.       self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxsp.to_s,2)     
  228.       can_learn=false
  229.       for j in $data_classes[actor.class_id].learnings
  230.         if j.skill_id == @skill.id
  231.           can_learn=true
  232.         end
  233.       end
  234.       if can_learn == true
  235.         if actor.skill_learn?(@skill.id)
  236.           self.contents.font.color = Color.new(255,255,255,128)
  237.           self.contents.draw_text(44, 80*i+44, 196, 32, "⊙此项特技已经学习⊙",2)         
  238.         else
  239.           self.contents.font.color = Color.new(255,255,0,255)
  240.           self.contents.draw_text(44, 80*i+44, 240, 32, "★此项特技尚未学习★")
  241.         end
  242.       else
  243.         self.contents.font.color = Color.new(255,255,255,128)
  244.         self.contents.draw_text(44, 80*i+44, 196, 32, "◇此项特技无法学习◇",2)         
  245.       end
  246.     end
  247.     @item_max = $game_party.actors.size
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 设置物品
  251.   #     item : 新的物品
  252.   #--------------------------------------------------------------------------
  253.   def skill=(skill)
  254.     if @skill != skill
  255.       @skill = skill
  256.       refresh
  257.     end
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● 刷新光标矩形
  261.   #--------------------------------------------------------------------------
  262.   def update_cursor_rect
  263.     if @index < 0
  264.       self.cursor_rect.empty
  265.     else
  266.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  267.     end
  268.   end
  269. end
  270. #==============================================================================
  271. # ■ Window_MShopBuy
  272. #------------------------------------------------------------------------------
  273. #  特技商店画面、浏览显示可以购买的商品的窗口。
  274. #==============================================================================
  275. class Window_MShopBuy < Window_Selectable
  276.   #--------------------------------------------------------------------------
  277.   # ● 初始化对像
  278.   #     shop_goods : 商品
  279.   #--------------------------------------------------------------------------
  280.   def initialize(id)
  281.     super(0, 64, 368, 416)
  282.     @id = id
  283.     refresh
  284.     self.index = 0
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● 获取物品
  288.   #--------------------------------------------------------------------------
  289.   def skill
  290.     return @data[self.index]
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 刷新
  294.   #--------------------------------------------------------------------------
  295.   def refresh
  296.     if self.contents != nil
  297.       self.contents.dispose
  298.       self.contents = nil
  299.     end
  300.     @data = []
  301.     for skill_id in @id
  302.       skill = $data_skills[skill_id]
  303.       if skill != nil
  304.         @data.push(skill)
  305.       end
  306.     end
  307.     @item_max = @data.size
  308.     if @item_max > 0
  309.       self.contents = Bitmap.new(width - 32, row_max * 32)
  310.       for i in 0...@item_max
  311.         draw_item(i)
  312.       end
  313.     end
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ● 描绘羡慕
  317.   #     index : 项目编号
  318.   #--------------------------------------------------------------------------
  319.   def draw_item(index)
  320.     skill = @data[index]
  321.     # 除此之外的情况设置为无效文字色
  322.     if skill.price <= $mShop_gold
  323.       self.contents.font.color = normal_color
  324.     else
  325.       self.contents.font.color = disabled_color
  326.     end
  327.     x = 4
  328.     y = index * 32
  329.     rect = Rect.new(x, y, self.width - 32, 32)
  330.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  331.     bitmap = RPG::Cache.icon(skill.icon_name)
  332.     opacity = self.contents.font.color == normal_color ? 255 : 128
  333.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  334.     self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
  335.     self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 刷新帮助文本
  339.   #--------------------------------------------------------------------------
  340.   def update_help
  341.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  342.   end
  343. end
  344. #==============================================================================
  345. # ■ RPG原装定义
  346. #==============================================================================
  347. module RPG
  348.   class Skill
  349.     def description
  350.       description = @description.split(/@/)[0]
  351.       return description != nil ? description : ''
  352.     end
  353.     def price
  354.       price = @description.split(/@/)[1]
  355.       return price != nil ? price.to_i : 0
  356.     end
  357.   end
  358. end
  359. #==============================================================================
  360. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  361. #==============================================================================
复制代码

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
2
发表于 2013-6-29 16:32:03 | 只看该作者
那时因为类重复了,把其中一个的
  1. class Scene_MShop
复制代码
改掉就行了==
可以改成Scene_MShop2或者其他的名称,
调用时就用你改了的名称来调用==
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2009-10-4
帖子
45
3
 楼主| 发表于 2013-6-30 07:20:37 | 只看该作者
英顺的马甲 发表于 2013-6-29 16:32
那时因为类重复了,把其中一个的改掉就行了==
可以改成Scene_MShop2或者其他的名称,
调用时就用你改了的名 ...

额 改了之后测试了一下 限制型的就算不能学也会显示可以学习 ,请问这个怎么办?

点评

大概是窗口的类也重复了吧 =.=  发表于 2013-6-30 09:32
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
466 小时
注册时间
2013-2-8
帖子
424
4
发表于 2013-7-2 00:36:50 手机端发表。 | 只看该作者
要把其中一个脚本里的类名全部替换
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-16 10:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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