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

Project1

 找回密码
 注册会员
搜索

战斗视窗调整(行走图战斗) + DQ菜单

查看数: 131 | 评论数: 1 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2024-10-17 17:52

正文摘要:

我方角色遭受技能与攻击的动画未完成,只有背部行走图的动态显示。 战斗视窗调整为原创,DQ菜单是转载。 RUBY 代码复制module Vocab  BattleParty = "队伍"end class Scene_ ...

回复

swbsl 发表于 2024-10-17 18:07:00
补充一个队伍管理器 Prexus-Party Manager v1.1c


  1. #==============================================================================
  2. # ** Prexus - Party Manager (v1.1c)  【队伍管理器】(角色后备仓库)
  3. #------------------------------------------------------------------------------
  4. #  这是一个由 Prexus 创建的队伍管理系统。
  5. #  它允许你从一组备用角色中更改你的队伍组成。
  6. #  它还允许你锁定角色,使他们成为强制性的,以及使角色不可用。
  7. #
  8. #  查看 RMXP.org 上的帖子获取说明:
  9. #  http://www.rmxp.org/forums/index.php?topic=42685.msg402326#msg402326
  10. #
  11. #  - 更新日志(v1.1c)
  12. #    *  修复了队伍预备窗口中的一个图形错误
  13. #
  14. #  - (v1.1b)
  15. #    * 修复了 draw_item_name 方法的一个错误,增加了宽度参数
  16. #  - (v1.1)
  17. #    * 添加了查看玩家装备的功能(按下 A 按钮)
  18. #  
  19. #==============================================================================

  20. module RPG
  21.   class Actor
  22.     def setup
  23.       @found = false
  24.       @unavailable = false
  25.       @required = false
  26.     end
  27.     attr_accessor :found
  28.     attr_accessor :unavailable
  29.     attr_accessor :required
  30.   end
  31. end

  32. class Game_Actors
  33.   attr_reader :data
  34.   alias prex_party_g_actors_initialize initialize
  35.   def initialize
  36.     prex_party_g_actors_initialize
  37.     $data_actors.each do |actor|
  38.       actor.setup if actor
  39.       @data[actor.id] = Game_Actor.new(actor.id) if actor
  40.     end
  41.   end
  42. end

  43. class Scene_File < Scene_Base
  44.   alias prex_party_s_file_write_save_data write_save_data
  45.   alias prex_party_s_file_read_save_data read_save_data
  46.   def write_save_data(file)
  47.     prex_party_s_file_write_save_data(file)
  48.     Marshal.dump($data_actors, file)
  49.   end
  50.   def read_save_data(file)
  51.     prex_party_s_file_read_save_data(file)
  52.     $data_actors = Marshal.load(file)
  53.   end
  54. end

  55. class Scene_Title < Scene_Base
  56.   alias prex_party_s_title_command_new_game command_new_game
  57.   def command_new_game
  58.     prex_party_s_title_command_new_game
  59.     $game_party.members.each {|s| s.actor.found = true if s}
  60.   end
  61. end

  62. class Window_Base < Window
  63.   def draw_item_name(item, x, y, enabled = true, width = 172)
  64.     if item != nil
  65.       draw_icon(item.icon_index, x, y, enabled)
  66.       self.contents.font.color = normal_color
  67.       self.contents.font.color.alpha = enabled ? 255 : 128
  68.       self.contents.draw_text(x + 24, y, width, WLH, item.name)
  69.     end
  70.   end
  71. end

  72. class Scene_Party < Scene_Base
  73.   def start
  74.     super
  75.     create_menu_background
  76.     create_windows
  77.   end
  78.   def create_windows
  79.     @member_window = Window_CurrentMember.new
  80.     @party_window = Window_CurrentParty.new
  81.     @party_window.active = true
  82.     @selectable_window = Window_SelectMember.new
  83.   end
  84.   def update_windows
  85.     @member_window.update
  86.     @party_window.update
  87.     @selectable_window.update
  88.     if @party_window.active
  89.       @member_window.set_member(@party_window.member)
  90.     elsif @selectable_window.active
  91.       @member_window.set_member(@selectable_window.member)
  92.     end
  93.   end
  94.   def terminate
  95.     super
  96.     @member_window.dispose
  97.     @party_window.dispose
  98.     @selectable_window.dispose
  99.   end
  100.   def update
  101.     super
  102.     update_windows
  103.     update_input
  104.   end
  105.   def update_input
  106.     if Input.trigger?(Input::A)
  107.       if @member_window.mode == 1
  108.         @member_window.set_mode(0)
  109.       elsif @member_window.mode == 0
  110.         @member_window.set_mode(1)
  111.       end
  112.     end
  113.     if @party_window.active
  114.       if Input.trigger?(Input::B)
  115.         if $game_temp.in_battle            # 按取消键返回时,判断是不是在战斗场景
  116.           $scene = Scene_Battle.new
  117.         else
  118.           Sound.play_cancel
  119.           $scene = Scene_Map.new
  120.         end
  121.       elsif Input.trigger?(Input::C)
  122.         member = @party_window.member
  123.         if member != nil
  124.           if member.actor.unavailable or member.actor.required
  125.             Sound.play_buzzer
  126.             return
  127.           end
  128.         end
  129.         Sound.play_decision
  130.         @party_window.active = false
  131.         @selectable_window.active = true
  132.         @selectable_window.index = 0
  133.       end
  134.     elsif @selectable_window.active
  135.       if Input.trigger?(Input::B)
  136.         Sound.play_cancel
  137.         @selectable_window.index = -1
  138.         @selectable_window.active = false
  139.         @party_window.active = true
  140.       elsif Input.trigger?(Input::C)
  141.         member = @selectable_window.member
  142.         if member != nil
  143.           if member.actor.unavailable
  144.             Sound.play_buzzer
  145.             return
  146.           end
  147.         end
  148.         Sound.play_decision
  149.         $game_party.remove_actor(@party_window.member.id) if @party_window.member != nil
  150.         $game_party.add_actor(@selectable_window.member.id) if @selectable_window.member != nil
  151.         @selectable_window.refresh
  152.         @party_window.refresh
  153.         @selectable_window.index = -1
  154.         @selectable_window.active = false
  155.         @party_window.active = true
  156.       end
  157.     end
  158.   end
  159. end

  160. class Window_CurrentMember < Window_Base
  161.   attr_reader :mode
  162.   def initialize(member = nil, mode = 0)
  163.     super(304, 80, 192, 256)
  164.     create_contents
  165.     @member = member
  166.     @mode = 0
  167.     refresh
  168.   end
  169.   def member
  170.     return @member
  171.   end
  172.   def set_member(member)
  173.     old_member = @member
  174.     @member = member
  175.     refresh if old_member != @member
  176.   end
  177.   def set_mode(mode)
  178.     @mode = mode if [0, 1].include?(mode)
  179.     refresh
  180.   end
  181.   def refresh
  182.     self.contents.clear
  183.     return unless @member
  184.     x, y = 0, 0
  185.     self.draw_actor_face(@member, x, y, 48)
  186.     self.draw_actor_name(@member, x + 52, y)
  187.     self.draw_actor_class(@member, x + 52, y + WLH)
  188.     self.draw_actor_level(@member, x, y + WLH*2)
  189.     case @mode
  190.     when 0
  191.       self.draw_icon(142, self.contents.width - 24, y + WLH*2)
  192.       self.contents.draw_text(x, y + WLH*2, self.contents.width - 12, WLH, '按A查装备', 2)
  193.       self.draw_actor_hp(@member, x, y + WLH*3, 160)
  194.       self.draw_actor_mp(@member, x, y + WLH*4, 160)
  195.       self.draw_actor_parameter(@member, x, y + WLH*5, 0)
  196.       self.draw_actor_parameter(@member, x, y + WLH*6, 1)
  197.       self.draw_actor_parameter(@member, x, y + WLH*7, 2)
  198.       self.draw_actor_parameter(@member, x, y + WLH*8, 3)
  199.     when 1
  200.       self.draw_icon(143, self.contents.width - 24, y + WLH*2)
  201.       self.contents.draw_text(x, y + WLH*2, self.contents.width - 12, WLH, '按A看属性', 2)
  202.       for i in [email protected]
  203.         item = @member.equips[i]
  204.         self.draw_item_name(item, x, y + WLH*(3+i), true, self.contents.width - 24)
  205.       end
  206.     end
  207.   end
  208. end

  209. class Window_CurrentParty < Window_Selectable
  210.   def initialize
  211.     super(48, 80, 256, 64)
  212.     @item_max = 4
  213.     @column_max = @item_max
  214.     create_contents
  215.     self.index = 0
  216.     refresh
  217.   end
  218.   def member
  219.     return $game_party.members[self.index]
  220.   end
  221.   def refresh
  222.     for i in 0...@item_max
  223.       rect = item_rect(i)
  224.       self.contents.clear_rect(rect)
  225.     end
  226.     for i in 0...$game_party.members.size
  227.       rect = item_rect(i)
  228.       bitmap = Cache.character($game_party.members[i].character_name)
  229.       sign = $game_party.members[i].character_name[/^[\!\$]./]
  230.       if sign != nil and sign.include?(')
  231.         cw = bitmap.width / 3
  232.         ch = bitmap.height / 4
  233.       else
  234.         cw = bitmap.width / 12
  235.         ch = bitmap.height / 8
  236.       end
  237.       n = $game_party.members[i].character_index
  238.       src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  239.       if $game_party.members[i].actor.unavailable
  240.         self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
  241.       else
  242.         self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
  243.       end
  244.       if $game_party.members[i].actor.required
  245.         lock_bitmap = Cache.system("Locked")
  246.         self.contents.blt(rect.x + rect.width - lock_bitmap.width,
  247.                           rect.y + rect.height - lock_bitmap.height,
  248.                           lock_bitmap, lock_bitmap.rect)
  249.       end
  250.     end
  251.   end
  252.   def item_rect(index)
  253.     rect = Rect.new(0, 0, 0, 0)
  254.     rect.width = (contents.width + @spacing) / @column_max - @spacing
  255.     rect.height = 32
  256.     rect.x = index % @column_max * (rect.width + @spacing)
  257.     rect.y = index / @column_max * 32
  258.     return rect
  259.   end
  260. end

  261. class Window_SelectMember < Window_Selectable
  262.   def initialize
  263.     super(48, 144, 256, 192)
  264.     calculate_actors
  265.     @item_max = @actors.size + 1
  266.     @column_max = 4
  267.     self.index = -1
  268.     self.active = false
  269.     refresh
  270.   end
  271.   def calculate_actors
  272.     @actors = []
  273.     for a in $game_actors.data
  274.       @actors << a if a != nil and a.actor.found and !$game_party.members.include?(a)
  275.     end
  276.   end
  277.   def member
  278.     return @actors[self.index]
  279.   end
  280.   def refresh
  281.     self.contents.clear
  282.     calculate_actors
  283.     @item_max = @actors.size + 1
  284.     for i in [email protected]
  285.       rect = item_rect(i)
  286.       bitmap = Cache.character(@actors[i].character_name)
  287.       sign = @actors[i].character_name[/^[\!\$]./]
  288.       if sign != nil and sign.include?(')
  289.         cw = bitmap.width / 3
  290.         ch = bitmap.height / 4
  291.       else
  292.         cw = bitmap.width / 12
  293.         ch = bitmap.height / 8
  294.       end
  295.       n = @actors[i].character_index
  296.       src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  297.       if @actors[i].actor.unavailable
  298.         self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
  299.       else
  300.         self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
  301.       end
  302.       if @actors[i].actor.required
  303.         lock_bitmap = Cache.system("Locked")
  304.         self.contents.blt(rect.x + rect.width - lock_bitmap.width,
  305.                           rect.y + rect.height - lock_bitmap.height,
  306.                           lock_bitmap, lock_bitmap.rect)
  307.       end
  308.     end
  309.   end
  310.   def item_rect(index)
  311.     rect = Rect.new(0, 0, 0, 0)
  312.     rect.width = (contents.width + @spacing) / @column_max - @spacing
  313.     rect.height = 32
  314.     rect.x = index % @column_max * (rect.width + @spacing)
  315.     rect.y = index / @column_max * 32
  316.     return rect
  317.   end
  318. end
复制代码
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-11-21 23:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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