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

Project1

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

[有事请教] [已解决]【布阵位法原创】脚本出错第一个脚本和窗口对应...

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7474
在线时间
1302 小时
注册时间
2015-8-15
帖子
742
跳转到指定楼层
1
发表于 2024-7-9 13:49:20 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 金芒芒 于 2024-7-11 14:16 编辑

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Scene_zhenwei
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================
  6.  
  7. class Scene_zhenwei
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     zhenwei_index : 命令光标的初期位置,zhenwei_index = 9,chuzhan_index = 0
  11.   #--------------------------------------------------------------------------
  12.   def initialize(zhenwei_index = 0)
  13.     @zhenwei_index = zhenwei_index
  14.   #  @chuzhan_index = chuzhan_index
  15.     @wait_time = 0
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 主处理
  19.   #--------------------------------------------------------------------------
  20.   def main#(zhenwei_index=0)
  21.     # 生成地图背景
  22.     @zhenwei_TransparentBackground = Spriteset_Map.new
  23.     @chuzhan_IndexCommand = Window_chuzhanCommand.new
  24.     # 生成出战菜单选项
  25.     @zhenwei_IndexCommand = Window_zhenweiCommand.new#(zhenwei_index = 0)
  26.    # @zhenwei_IndexCommand = Window_zhenweiCommand.new
  27.   #  @zhenwei_IndexCommand.index = @zhenwei_index
  28.  
  29.     # 冻结
  30.     Graphics.transition
  31.     update while  $scene == self
  32.     # 不切换场景就一直循环
  33.    # update while $scene == self
  34.     # 渐变
  35.     Graphics.freeze
  36.     @zhenwei_IndexCommand.dispose
  37. #   @chuzhan_IndexCommand.dispose
  38.      #update
  39.  
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 刷新画面
  43.   #--------------------------------------------------------------------------
  44.   def update
  45.     Graphics.update
  46.     Input.update
  47.     @wait_time -= 1
  48. #    @spriteset.update
  49.   #  @zhenwei_IndexCommand.active=true
  50.      # @window_CB_selected_troop.update
  51.      # return
  52.    # end
  53.     @zhenwei_IndexCommand.update
  54.  
  55.     update_zhenwei_IndexCommand
  56. #   break
  57.  
  58. end
  59.   #--------------------------------------------------------------------------
  60.   # ● 刷新画面 (命令窗口被激活的情况下)
  61.   #--------------------------------------------------------------------------
  62.   def update_zhenwei_IndexCommand
  63. # end
  64.     # 按下 C 键的情况下
  65.     if Input.trigger?(Input::C)
  66.          # @zhenwei_IndexCommand.zhenwei_index == 0
  67.         if  @zhenwei_IndexCommand.zhenwei_index == 0
  68.          @zhenwei_IndexCommand.zhenwei_1_spawn
  69.         elsif
  70.         if  @zhenwei_IndexCommand.zhenwei_index == 1
  71.          @zhenwei_IndexCommand.zhenwei_2_spawn
  72.         elsif
  73.         if  @zhenwei_IndexCommand.zhenwei_index == 2
  74.          @zhenwei_IndexCommand.zhenwei_3_spawn
  75.         elsif
  76.         if  @zhenwei_IndexCommand.zhenwei_index == 3
  77.          @zhenwei_IndexCommand.zhenwei_4_spawn
  78.         elsif
  79.         if  @zhenwei_IndexCommand.zhenwei_index == 4
  80.          @zhenwei_IndexCommand.zhenwei_5_spawn
  81.         elsif
  82.         if  @zhenwei_IndexCommand.zhenwei_index == 5
  83.          @zhenwei_IndexCommand.zhenwei_6_spawn
  84.         elsif
  85.         if  @zhenwei_IndexCommand.zhenwei_index == 6
  86.          @zhenwei_IndexCommand.zhenwei_7_spawn
  87.         elsif
  88.         if  @zhenwei_IndexCommand.zhenwei_index == 7
  89.          @zhenwei_IndexCommand.zhenwei_8_spawn
  90.         elsif
  91.         if  @zhenwei_IndexCommand.zhenwei_index == 8
  92.          @zhenwei_IndexCommand.zhenwei_9_spawn
  93.         elsif
  94.         if  @zhenwei_IndexCommand.zhenwei_index == 9
  95.          @zhenwei_IndexCommand.zhenwei_10_spawn
  96.               end
  97.             end
  98.           end
  99.          end
  100.         end
  101.       end
  102.      end
  103.     end
  104.   end
  105. end
  106.     # 按下 B 键的情况下
  107.     if Input.trigger?(Input::B)
  108.       # 演奏取消 SE
  109.       $game_system.se_play($data_system.cancel_se)
  110.       # 切换的地图画面
  111.       $scene = Scene_chuzhan.new
  112.       return
  113.     end
  114. end
  115. end
  116. end

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_MenuCommand
  3. #------------------------------------------------------------------------------
  4. #  菜单的命令选择行窗口。
  5. #==============================================================================
  6.  
  7. class Window_zhenweiCommand <  Window_Base
  8.    attr_reader   :chuzhan_index
  9.    attr_reader   :zhenwei_index
  10.   #--------------------------------------------------------------------------
  11.   # ● 初始化对像
  12.   #     actor : 角色
  13.   #--------------------------------------------------------------------------
  14.  
  15.   def initialize(zhenwei_index=0)
  16.    @zhenwei_index=0
  17.     super(32+200, 32, 480, 320)
  18.    origin_x=120
  19.    origin_y=110
  20.    @zhenwei_base = Sprite.new
  21.    @zhenwei_base.bitmap = RPG::Cache.title("")
  22.    @zhenwei_base.x = 200#origin_x
  23.    @zhenwei_base.y = 20#origin_y
  24.    @zhenwei_buttons = [] #@底部按钮=[]
  25.  
  26.     @zhenwei_base_1 = Sprite.new #@完成按钮=精灵.new
  27.     @zhenwei_base_1.bitmap = RPG::Cache.title("bottom-button-2-basic")
  28.     @zhenwei_base_1.x = origin_x+10
  29.     @zhenwei_base_1.y = origin_y+50
  30.  
  31.     @zhenwei_base_2 = Sprite.new #@完成按钮=精灵.new
  32.     @zhenwei_base_2.bitmap = RPG::Cache.title("bottom-button-2-basic")
  33.     @zhenwei_base_2.x = origin_x+80
  34.     @zhenwei_base_2.y = origin_y+100
  35.  
  36.     @zhenwei_base_3 = Sprite.new #@完成按钮=精灵.new
  37.     @zhenwei_base_3.bitmap = RPG::Cache.title("bottom-button-2-basic")
  38.     @zhenwei_base_3.x = origin_x+10
  39.     @zhenwei_base_3.y = origin_y+160
  40.  
  41.     @zhenwei_base_4 = Sprite.new #@完成按钮=精灵.new
  42.     @zhenwei_base_4.bitmap = RPG::Cache.title("bottom-button-2-basic")
  43.     @zhenwei_base_4.x = origin_x+80
  44.     @zhenwei_base_4.y = origin_y+180
  45.  
  46.     @zhenwei_base_5 = Sprite.new #@完成按钮=精灵.new
  47.     @zhenwei_base_5.bitmap = RPG::Cache.title("bottom-button-2-basic")
  48.     @zhenwei_base_5.x = origin_x+10
  49.     @zhenwei_base_5.y = origin_y+240
  50.  
  51.     @zhenwei_base_6 = Sprite.new #@完成按钮=精灵.new
  52.     @zhenwei_base_6.bitmap = RPG::Cache.title("bottom-button-2-basic")
  53.     @zhenwei_base_6.x = origin_x+180
  54.     @zhenwei_base_6.y = origin_y+50
  55.  
  56.     @zhenwei_base_7 = Sprite.new #@完成按钮=精灵.new
  57.     @zhenwei_base_7.bitmap = RPG::Cache.title("bottom-button-2-basic")
  58.     @zhenwei_base_7.x = origin_x+240
  59.     @zhenwei_base_7.y = origin_y+80
  60.  
  61.     @zhenwei_base_8 = Sprite.new #@完成按钮=精灵.new
  62.     @zhenwei_base_8.bitmap = RPG::Cache.title("bottom-button-2-basic")
  63.     @zhenwei_base_8.x = origin_x+180
  64.     @zhenwei_base_8.y = origin_y+160
  65.  
  66.     @zhenwei_base_9 = Sprite.new #@完成按钮=精灵.new
  67.     @zhenwei_base_9.bitmap = RPG::Cache.title("bottom-button-2-basic")
  68.     @zhenwei_base_9.x = origin_x+240
  69.     @zhenwei_base_9.y = origin_y+180
  70.  
  71.     @zhenwei_base_10 = Sprite.new #@完成按钮=精灵.new
  72.     @zhenwei_base_10.bitmap = RPG::Cache.title("bottom-button-2-basic")
  73.     @zhenwei_base_10.x = origin_x+180
  74.     @zhenwei_base_10.y = origin_y+240
  75.  
  76.  
  77.     @zhenwei_buttons.push @zhenwei_base_1# @底部按钮。按下完成按钮
  78.     @zhenwei_buttons.push @zhenwei_base_2# @底部按钮。按下完成按钮
  79.     @zhenwei_buttons.push @zhenwei_base_3# @底部按钮。按下完成按钮
  80.     @zhenwei_buttons.push @zhenwei_base_4# @底部按钮。按下完成按钮
  81.     @zhenwei_buttons.push @zhenwei_base_5# @底部按钮。按下完成按钮
  82.     @zhenwei_buttons.push @zhenwei_base_6# @底部按钮。按下完成按钮
  83.     @zhenwei_buttons.push @zhenwei_base_7# @底部按钮。按下完成按钮
  84.     @zhenwei_buttons.push @zhenwei_base_8# @底部按钮。按下完成按钮
  85.     @zhenwei_buttons.push @zhenwei_base_9# @底部按钮。按下完成按钮
  86.     @zhenwei_buttons.push @zhenwei_base_10# @底部按钮。按下完成按钮
  87.  
  88. #  @zhenwei_index = index
  89. # @zhenwei_index =0
  90.  
  91.     adj_x = 0                       # 调整_x=0
  92.     adj_y = 0                       # 调整_y=0
  93.  
  94.  
  95.  
  96.  
  97.   #--------------------------------------------------------------------------
  98.   # ● 一些方法的重载
  99.   #--------------------------------------------------------------------------  
  100.   def dispose #定义释放
  101.   #  @zhenwei_base.dispose
  102.     @zhenwei_base_1.dispose
  103.     @zhenwei_base_2.dispose
  104.     @zhenwei_base_3.dispose
  105.     @zhenwei_base_4.dispose
  106.     @zhenwei_base_5.dispose
  107.     @zhenwei_base_6.dispose
  108.     @zhenwei_base_7.dispose
  109.     @zhenwei_base_8.dispose
  110.     @zhenwei_base_9.dispose
  111.     @zhenwei_base_10.dispose
  112.   def z=(z)
  113.     super(z)
  114.   #  @delete_button.z=z+1
  115. #    @zhenwei_base.z=z+1
  116. #    @zhenwei_base_1.z=z+1
  117. #   @zhenwei_base_2.z=z+1
  118. #   @zhenwei_base_3.z=z+1
  119. #   @zhenwei_base_4.z=z+1
  120. #   @zhenwei_base_5.z=z+1
  121. #   @zhenwei_base_6.z=z+1
  122. #   @zhenwei_base_7.z=z+1
  123. #   @zhenwei_base_8.z=z+1
  124. #   @zhenwei_base_9.z=z+1
  125. #   @zhenwei_base_10.z=z+1
  126.    end
  127.     def x=(x)
  128.     super(x)
  129.     adj_x = 0
  130.    # @button_base.x=x+origin_x
  131. #    @zhenwei_base_1.x=x+origin_x+10
  132. #    @zhenwei_base_2.x=x+origin_x+50
  133. #   @zhenwei_base_3.x=x+origin_x+10
  134. #   @zhenwei_base_4.x=x+origin_x+50
  135. #   @zhenwei_base_5.x=x+origin_x+10
  136. #   @zhenwei_base_6.x=x+origin_x+100
  137. #   @zhenwei_base_7.x=x+origin_x+180
  138.   #  @zhenwei_base_8.x=x+origin_x+100
  139.   #  @zhenwei_base_9.x=x+origin_x+180
  140.   #  @zhenwei_base_10.x=x+origin_x+100
  141.  
  142.   end #
  143.  
  144.   def y=(y)
  145.     super(y)
  146. #   adj_y = 0
  147. #   @zhenwei_base_1.y=y+origin_y+40
  148. #    @zhenwei_base_2.y=y+origin_y+80
  149. #    @zhenwei_base_3.y=y+origin_y+40
  150. #    @zhenwei_base_4.y=y+origin_y+80
  151. #   @zhenwei_base_5.y=y+origin_y+40
  152. #   @zhenwei_base_6.y=y+origin_y+120
  153. #   @zhenwei_base_7.y=y+origin_y+180
  154. #   @zhenwei_base_8.y=y+origin_y+120
  155.   #  @zhenwei_base_9.y=y+origin_y+180
  156.   #  @zhenwei_base_10.y=y+origin_y+120
  157.  
  158.  
  159.   end  
  160.   def visible=(visible)
  161.     super(visible)
  162.   #  @zhenwei_base.visible = visible
  163.     @zhenwei_base_1.visible = visible
  164.     @zhenwei_base_2.visible = visible
  165.     @zhenwei_base_3.visible = visible
  166.     @zhenwei_base_4.visible = visible
  167.     @zhenwei_base_5.visible = visible
  168.     @zhenwei_base_6.visible = visible
  169.     @zhenwei_base_7.visible = visible
  170.     @zhenwei_base_8.visible = visible
  171.     @zhenwei_base_9.visible = visible
  172.     @zhenwei_base_10.visible = visible
  173.    # @finish_button.visible = visible
  174.     end  
  175.   end
  176.   def contents_opacity=(opacity)
  177.     super(opacity)
  178.     @zhenwei_base_1.opacity = opacity
  179.     @zhenwei_base_2.opacity = opacity
  180.     @zhenwei_base_3.opacity = opacity
  181.     @zhenwei_base_4.opacity = opacity
  182.     @zhenwei_base_5.opacity = opacity
  183.     @zhenwei_base_6.opacity = opacity
  184.     @zhenwei_base_7.opacity = opacity
  185.     @zhenwei_base_8.opacity = opacity
  186.     @zhenwei_base_9.opacity = opacity
  187.     @zhenwei_base_10.opacity = opacity
  188.     @finish_button.opacity = opacity
  189.     end  
  190.   end
  191.  
  192.   def index=(index)
  193.     @zhenwei_index=index
  194.   end
  195.  
  196.   def back_normal(index)
  197.     #p index
  198.       @zhenwei_index = -1
  199.      for i in 0..@max_item_row_2-1
  200.         @zhenwei_buttons[i].bitmap = RPG::Cache.title("bottom-button-"+(i+1).to_s+"-basic")#+i.to_s)
  201.      end
  202.     else
  203.      @zhenwei_buttons[index].bitmap = RPG::Cache.title("bottom-button-"+(index+1).to_s+"-basic")#+i.to_s)
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 更新光标矩形
  208.   #--------------------------------------------------------------------------
  209.   def update_cursor_rect
  210.  
  211.       if @zhenwei_index < 0
  212.         for i in 0..@max_item_row_2-1
  213.           back_normal(i)
  214.         end
  215.         return
  216.       end
  217.       #p @index,@second_index                                 
  218.      # @second_index%=2                                            完成
  219.       @zhenwei_buttons[@zhenwei_index].bitmap = RPG::Cache.title("bottom-button-"+(@second_index+1).to_s+"-l")#+i.to_s)
  220.     end
  221. #  end
  222.   #--------------------------------------------------------------------------
  223.   # ● 刷新画面
  224.   #--------------------------------------------------------------------------
  225.   def update
  226.     if self.active
  227.       if Input.repeat?(Input::DOWN)
  228.         $game_system.se_play($data_system.cursor_se)
  229.  
  230.         @v_index = (@v_index+1)%@max_row
  231.         #@last_index = @index
  232.         if @v_index == 0
  233.            #back_normal(@zhenwei_index)
  234.           @zhenwei_index = -1
  235.           for i in 0..@max_item_row_2-1
  236.           back_normal(i)
  237.           end
  238.         else
  239.           #back_normal(@index)
  240.           @zhenwei_index = 1
  241.           #@index%=@max_item_row_2
  242.            if @player_or_enermy == 0
  243.            @groups[@index].bitmap = RPG::Cache.title("team-basic")#+i.to_s)
  244.           else
  245.            @groups[@index].bitmap = RPG::Cache.title("enermy-basic")#+i.to_s)
  246.           end         
  247.         end  
  248.         refresh
  249.       end
  250.  
  251.       if Input.repeat?(Input::UP)
  252.         $game_system.se_play($data_system.cursor_se)
  253.         #back_normal(@index)
  254.         @v_index = (@v_index-1)%@max_row
  255.        # @last_index = @index
  256.         if @v_index == 0
  257.            #back_normal(@zhenwei_index)
  258.           @zhenwei_index = -1
  259.           for i in 0..@max_item_row_2-1
  260.           back_normal(i)
  261.           end
  262.         else
  263.           #back_normal(@index)
  264.           @zhenwei_index = 1
  265.           #@index%=@max_item_row_2
  266.            if @player_or_enermy == 0               #队伍1-5背景
  267.            @groups[@index].bitmap = RPG::Cache.title("team-basic")#+i.to_s)
  268.           else                                    # 敌人队伍1-5背景
  269.            @groups[@index].bitmap = RPG::Cache.title("enermy-basic")#+i.to_s)
  270.           end              
  271.         end  
  272.         refresh
  273.       end
  274.     if @v_index == 0
  275.       # 方向键左被按下的情况下
  276.       if Input.repeat?(Input::RIGHT)
  277.         $game_system.se_play($data_system.cursor_se)
  278.         back_normal(@index)
  279.         @index = (@index+1)%@group_max
  280.         until @able[@index]
  281.           @index = (@index+1)%@group_max
  282.         end
  283.         refresh
  284.       end
  285.       # 方向键右被按下的情况下
  286.       if Input.repeat?(Input::LEFT)
  287.         $game_system.se_play($data_system.cursor_se)
  288.         back_normal(@index)
  289.         @index = (@index+@item_max-1)%@group_max
  290.         until @able[@index]
  291.           @index = (@index+@item_max-1)%@group_max
  292.         end
  293.         refresh
  294.       end
  295.     else # level 2
  296.       # 方向键左被按下的情况下
  297.       if Input.repeat?(Input::RIGHT)
  298.         $game_system.se_play($data_system.cursor_se)
  299.         back_normal(@zhenwei_index)
  300.         @zhenwei_index = (@zhenwei_index+1)%@max_item_row_2
  301.         #p @zhenwei_index
  302.         refresh
  303.       end
  304.       # 方向键右被按下的情况下
  305.       if Input.repeat?(Input::LEFT)
  306.         $game_system.se_play($data_system.cursor_se)
  307.         back_normal(@zhenwei_index)
  308.         @zhenwei_index = (@zhenwei_index-1)%@max_item_row_2
  309.         refresh
  310.       end
  311.     end   # @v_index == 0
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.     end   
  319.  
  320.       update_cursor_rect #if @slide_over
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 获取东西
  324.   #--------------------------------------------------------------------------
  325.   def item_num(index = @index) # 定义项目 (索引=@索引)
  326.     return @selected_units[@index].size
  327.   end
  328.   def set_units(a)
  329.     @selected_units = a
  330.   end  
  331.   #--------------------------------------------------------------------------
  332.   # ● 更新内容
  333.   #--------------------------------------------------------------------------
  334.   def refresh
  335.     for i in 0...@item_max
  336.       @icons[i].bitmap = nil
  337.     end
  338.     #对于i,单位为0..@选定的单位[@索引]。大小-1
  339.     for i in 0..@selected_units[@index].size-1
  340.       @icons[i].bitmap = RPG::Cache.icon(Figter_data::CHARACTER_NAME[@selected_units[@index][i]])
  341.       #p Figter_data::CHARACTER_NAME[twoArray[@index][i]]
  342.     end
  343.  
  344.   end
  345.  
  346.   #--------------------------------------------------------------------------
  347.   # ● 阵位1
  348.   #--------------------------------------------------------------------------
  349.   def zhenwei_1_spawn
  350. #  @efs_team_spawn[@index]=[9,11]
  351.     $scene = Scene_chuzhan.new(4)
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 阵位2
  355.   #--------------------------------------------------------------------------
  356.   def zhenwei_2_spawn
  357.    #@efs_team_spawn[@index]=[9,12]
  358.     $scene = Scene_chuzhan.new
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 阵位3
  362.   #--------------------------------------------------------------------------
  363.   def zhenwei_3_spawn
  364.   # @efs_team_spawn[@index]=[9,13]
  365.    $scene = Scene_chuzhan.new #refresh
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 阵位4
  369.   #--------------------------------------------------------------------------
  370.   def zhenwei_4_spawn
  371. #  @efs_team_spawn[@index]=[9,14]
  372.   $scene = Scene_chuzhan.new#  refresh
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 阵位5
  376.   #--------------------------------------------------------------------------
  377.   def zhenwei_5_spawn
  378.   # @efs_team_spawn[@index]=[9,15]
  379.   $scene = Scene_chuzhan.new #   refresh
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● 阵位6
  383.   #--------------------------------------------------------------------------
  384.   def zhenwei_6_spawn
  385.   # @efs_team_spawn[@index]=[9,16]
  386. $scene = Scene_chuzhan.new #  refresh
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● 阵位7
  390.   #--------------------------------------------------------------------------
  391.   def zhenwei_7_spawn
  392.   # @efs_team_spawn[@index]=[9,17]
  393. $scene = Scene_chuzhan.new#   refresh
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ● 阵位8
  397.   #--------------------------------------------------------------------------
  398.   def zhenwei_8_spawn
  399.   # @efs_team_spawn[@index]=[9,18]
  400.    $scene = Scene_chuzhan.new #refresh
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # ● 阵位9
  404.   #--------------------------------------------------------------------------
  405.   def zhenwei_9_spawn
  406.   # @efs_team_spawn[@index]=[9,19]
  407.   $scene = Scene_chuzhan.new # refresh
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● 阵位10
  411.   #--------------------------------------------------------------------------
  412.   def zhenwei_10_spawn
  413.   # @efs_team_spawn[@index]=[9,20]
  414.   $scene = Scene_chuzhan.new # refresh
  415.   end

布阵1.png (148.97 KB, 下载次数: 4)

布阵1.png

4b51ac5253460c7db54720d6d4971b4c_112121o0zv0w8jilj08uv0.png (388.13 KB, 下载次数: 5)

4b51ac5253460c7db54720d6d4971b4c_112121o0zv0w8jilj08uv0.png

Lv4.逐梦者

梦石
0
星屑
7474
在线时间
1302 小时
注册时间
2015-8-15
帖子
742
2
 楼主| 发表于 2024-7-11 13:35:24 | 只看该作者
本帖最后由 金芒芒 于 2024-7-11 13:36 编辑
  1. #==============================================================================
  2. # ■ Scene_zhenwei
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================

  6. class Scene_zhenwei
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     zhenwei_index : 命令光标的初期位置,zhenwei_index = 9,chuzhan_index = 0
  10.   #--------------------------------------------------------------------------
  11.   def initialize(zhenwei_index = 0)
  12.     @zhenwei_index = zhenwei_index
  13. #    @chuzhan_index = chuzhan_index
  14.     @wait_time = 0
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 主处理
  18.   #--------------------------------------------------------------------------
  19.   def main
  20.     # 生成地图背景
  21.     @zhenwei_TransparentBackground = Spriteset_Map.new
  22.     @chuzhan_IndexCommand = Window_chuzhanCommand.new
  23.     # 生成出战菜单选项
  24.     @zhenwei_IndexCommand = Window_zhenweiCommand.new
  25.     @zhenwei_IndexCommand.index = @zhenwei_index

  26.     # 冻结
  27.     Graphics.transition
  28.     # 不切换场景就一直循环
  29.     update while $scene == self
  30.     # 渐变
  31.     Graphics.freeze
  32.     @zhenwei_IndexCommand.dispose
  33.     @chuzhan_IndexCommand.dispose

  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新画面
  37.   #--------------------------------------------------------------------------
  38.   def update
  39.     Graphics.update
  40.     Input.update
  41.     @wait_time -= 1

  42.     @zhenwei_IndexCommand.update
  43.   
  44.     update_zhenwei_IndexCommand


  45. end

  46.   #--------------------------------------------------------------------------
  47.   # ● 刷新画面 (命令窗口被激活的情况下)
  48.   #--------------------------------------------------------------------------


  49.   #--------------------------------------------------------------------------
  50.   # ● 刷新画面 (命令窗口被激活的情况下)
  51.   #--------------------------------------------------------------------------
  52.   def update_zhenwei_IndexCommand
  53.       
  54.   #  end
  55.    # update_zhenwei_IndexCommand
  56.     # 按下 B 键的情况下
  57.     if Input.trigger?(Input::B)
  58.       # 演奏取消 SE
  59.       $game_system.se_play($data_system.cancel_se)
  60.       # 切换的地图画面
  61.       $scene = Scene_chuzhan.new
  62.       return
  63.     end
  64.     # 按下 C 键的情况下
  65.     if Input.trigger?(Input::C)
  66.       # 命令窗口的光标位置分支
  67.       case @zhenwei_IndexCommand.index
  68.       when 0  # 队组1出生点
  69.         # 演奏确定 SE
  70.         $game_system.se_play($data_system.decision_se)
  71.       if $game_switches[20] == true
  72.        $game_switches[20] = false
  73.        $出战前锋=[9,12]
  74.       # p $出战前锋
  75.        $scene = Scene_chuzhan.new(1)
  76.       end
  77.       if $game_switches[21] == true
  78.        $game_switches[21] = false
  79.        $scene = Scene_chuzhan.new(2)
  80.       end
  81.       if $game_switches[22] == true
  82.        $game_switches[22] = false
  83.        $scene = Scene_chuzhan.new(3)
  84.       end
  85.       if $game_switches[23] == true
  86.        $game_switches[23] = false
  87.        $scene = Scene_chuzhan.new(4)
  88.       end
  89.       if $game_switches[24] == true
  90.        $game_switches[24] = false
  91.        $scene = Scene_chuzhan.new(5)
  92.       end
  93.       if $game_switches[25] == true
  94.        $game_switches[25] = false
  95.        $scene = Scene_chuzhan.new(0)
  96.       end
  97.       when 1  # 队组2出生点
  98.         # 演奏确定 SE
  99.         $game_system.se_play($data_system.decision_se)
  100.       if $game_switches[20] == true
  101.        $game_switches[20] = false
  102.        $scene = Scene_chuzhan.new(1)
  103.       end
  104.       if $game_switches[21] == true
  105.        $game_switches[21] = false
  106.        $scene = Scene_chuzhan.new(2)
  107.       end
  108.       if $game_switches[22] == true
  109.        $game_switches[22] = false
  110.        $scene = Scene_chuzhan.new(3)
  111.       end
  112.       if $game_switches[23] == true
  113.        $game_switches[23] = false
  114.        $scene = Scene_chuzhan.new(4)
  115.       end
  116.       if $game_switches[24] == true
  117.        $game_switches[24] = false
  118.        $scene = Scene_chuzhan.new(5)
  119.       end
  120.       if $game_switches[25] == true
  121.        $game_switches[25] = false
  122.        $scene = Scene_chuzhan.new(0)
  123.       end
  124.       when 2  # 队组3出生点
  125.         # 演奏确定 SE
  126.         $game_system.se_play($data_system.decision_se)
  127.         # 激活状态窗口
  128.       if $game_switches[20] == true
  129.        $game_switches[20] = false
  130.        $scene = Scene_chuzhan.new(1)
  131.       end
  132.       if $game_switches[21] == true
  133.        $game_switches[21] = false
  134.        $scene = Scene_chuzhan.new(2)
  135.       end
  136.       if $game_switches[22] == true
  137.        $game_switches[22] = false
  138.        $scene = Scene_chuzhan.new(3)
  139.       end
  140.       if $game_switches[23] == true
  141.        $game_switches[23] = false
  142.        $scene = Scene_chuzhan.new(4)
  143.       end
  144.       if $game_switches[24] == true
  145.        $game_switches[24] = false
  146.        $scene = Scene_chuzhan.new(5)
  147.       end
  148.       if $game_switches[25] == true
  149.        $game_switches[25] = false
  150.        $scene = Scene_chuzhan.new(0)
  151.       end

  152.       when 3  # 队组4出生点
  153.         # 演奏确定 SE
  154.         $game_system.se_play($data_system.decision_se)
  155.       if $game_switches[20] == true
  156.        $game_switches[20] = false
  157.        $scene = Scene_chuzhan.new(1)
  158.       end
  159.       if $game_switches[21] == true
  160.        $game_switches[21] = false
  161.        $scene = Scene_chuzhan.new(2)
  162.       end
  163.       if $game_switches[22] == true
  164.        $game_switches[22] = false
  165.        $scene = Scene_chuzhan.new(3)
  166.       end
  167.       if $game_switches[23] == true
  168.        $game_switches[23] = false
  169.        $scene = Scene_chuzhan.new(4)
  170.       end
  171.       if $game_switches[24] == true
  172.        $game_switches[24] = false
  173.        $scene = Scene_chuzhan.new(5)
  174.       end
  175.       if $game_switches[25] == true
  176.        $game_switches[25] = false
  177.        $scene = Scene_chuzhan.new(0)
  178.       end
  179.       when 4  # 队组5出生点
  180.         # 演奏确定 SE
  181.         $game_system.se_play($data_system.decision_se)
  182.       if $game_switches[20] == true
  183.        $game_switches[20] = false
  184.        $scene = Scene_chuzhan.new(1)
  185.       end
  186.       if $game_switches[21] == true
  187.        $game_switches[21] = false
  188.        $scene = Scene_chuzhan.new(2)
  189.       end
  190.       if $game_switches[22] == true
  191.        $game_switches[22] = false
  192.        $scene = Scene_chuzhan.new(3)
  193.       end
  194.       if $game_switches[23] == true
  195.        $game_switches[23] = false
  196.        $scene = Scene_chuzhan.new(4)
  197.       end
  198.       if $game_switches[24] == true
  199.        $game_switches[24] = false
  200.        $scene = Scene_chuzhan.new(5)
  201.       end
  202.       if $game_switches[25] == true
  203.        $game_switches[25] = false
  204.        $scene = Scene_chuzhan.new(0)
  205.       end

  206.       when 5  
  207.         $game_system.se_play($data_system.decision_se)
  208.       if $game_switches[20] == true
  209.        $game_switches[20] = false
  210.        $scene = Scene_chuzhan.new(1)
  211.       end
  212.       if $game_switches[21] == true
  213.        $game_switches[21] = false
  214.        $scene = Scene_chuzhan.new(2)
  215.       end
  216.       if $game_switches[22] == true
  217.        $game_switches[22] = false
  218.        $scene = Scene_chuzhan.new(3)
  219.       end
  220.       if $game_switches[23] == true
  221.        $game_switches[23] = false
  222.        $scene = Scene_chuzhan.new(4)
  223.       end
  224.       if $game_switches[24] == true
  225.        $game_switches[24] = false
  226.        $scene = Scene_chuzhan.new(5)
  227.       end
  228.       if $game_switches[25] == true
  229.        $game_switches[25] = false
  230.        $scene = Scene_chuzhan.new(0)
  231.       end

  232.       when 6  
  233.         $game_system.se_play($data_system.decision_se)
  234.       if $game_switches[20] == true
  235.        $game_switches[20] = false
  236.        $scene = Scene_chuzhan.new(1)
  237.       end
  238.       if $game_switches[21] == true
  239.        $game_switches[21] = false
  240.        $scene = Scene_chuzhan.new(2)
  241.       end
  242.       if $game_switches[22] == true
  243.        $game_switches[22] = false
  244.        $scene = Scene_chuzhan.new(3)
  245.       end
  246.       if $game_switches[23] == true
  247.        $game_switches[23] = false
  248.        $scene = Scene_chuzhan.new(4)
  249.       end
  250.       if $game_switches[24] == true
  251.        $game_switches[24] = false
  252.        $scene = Scene_chuzhan.new(5)
  253.       end
  254.       if $game_switches[25] == true
  255.        $game_switches[25] = false
  256.        $scene = Scene_chuzhan.new(0)
  257.       end

  258.       when 7  
  259.         $game_system.se_play($data_system.decision_se)
  260.       if $game_switches[20] == true
  261.        $game_switches[20] = false
  262.        $scene = Scene_chuzhan.new(1)
  263.       end
  264.       if $game_switches[21] == true
  265.        $game_switches[21] = false
  266.        $scene = Scene_chuzhan.new(2)
  267.       end
  268.       if $game_switches[22] == true
  269.        $game_switches[22] = false
  270.        $scene = Scene_chuzhan.new(3)
  271.       end
  272.       if $game_switches[23] == true
  273.        $game_switches[23] = false
  274.        $scene = Scene_chuzhan.new(4)
  275.       end
  276.       if $game_switches[24] == true
  277.        $game_switches[24] = false
  278.        $scene = Scene_chuzhan.new(5)
  279.       end
  280.       if $game_switches[25] == true
  281.        $game_switches[25] = false
  282.        $scene = Scene_chuzhan.new(0)
  283.       end

  284.       when 8  
  285.         $game_system.se_play($data_system.decision_se)
  286.       if $game_switches[20] == true
  287.        $game_switches[20] = false
  288.        $scene = Scene_chuzhan.new(1)
  289.       end
  290.       if $game_switches[21] == true
  291.        $game_switches[21] = false
  292.        $scene = Scene_chuzhan.new(2)
  293.       end
  294.       if $game_switches[22] == true
  295.        $game_switches[22] = false
  296.        $scene = Scene_chuzhan.new(3)
  297.       end
  298.       if $game_switches[23] == true
  299.        $game_switches[23] = false
  300.        $scene = Scene_chuzhan.new(4)
  301.       end
  302.       if $game_switches[24] == true
  303.        $game_switches[24] = false
  304.        $scene = Scene_chuzhan.new(5)
  305.       end
  306.       if $game_switches[25] == true
  307.        $game_switches[25] = false
  308.        $scene = Scene_chuzhan.new(0)
  309.       end

  310.       when 9  
  311.         $game_system.se_play($data_system.decision_se)
  312.       if $game_switches[20] == true
  313.        $game_switches[20] = false
  314.        $scene = Scene_chuzhan.new(1)
  315.       end
  316.       if $game_switches[21] == true
  317.        $game_switches[21] = false
  318.        $scene = Scene_chuzhan.new(2)
  319.       end
  320.       if $game_switches[22] == true
  321.        $game_switches[22] = false
  322.        $scene = Scene_chuzhan.new(3)
  323.       end
  324.       if $game_switches[23] == true
  325.        $game_switches[23] = false
  326.        $scene = Scene_chuzhan.new(4)
  327.       end
  328.       if $game_switches[24] == true
  329.        $game_switches[24] = false
  330.        $scene = Scene_chuzhan.new(5)
  331.       end
  332.       if $game_switches[25] == true
  333.        $game_switches[25] = false
  334.        $scene = Scene_chuzhan.new(0)
  335.        end
  336.       end
  337.       return
  338.     end
  339.   end

  340. end
复制代码
  1. #==============================================================================
  2. # ■ Window_MenuCommand
  3. #------------------------------------------------------------------------------
  4. #  菜单的命令选择行窗口。
  5. #==============================================================================

  6. class Window_zhenweiCommand <  Window_Base         # Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     width    : 窗口的宽
  10.   #     commands : 命令字符串序列
  11.   #--------------------------------------------------------------------------

  12.   attr_reader   :index
  13.   attr_reader   :slide_over   #滚动结束
  14.   #start load option exit
  15.   #--------------------------------------------------------------------------
  16.   # ● 初始化对像
  17.   #     actor : 角色
  18.   #--------------------------------------------------------------------------
  19.   def initialize(index=0)
  20.     @index = index
  21.     #选项背景
  22.     @button_base = Sprite.new
  23.     @button_base.bitmap = RPG::Cache.title("")
  24.     @button_base.x = 409
  25.     @button_base.y = 56
  26.    
  27.    
  28.     @cur_back = []
  29.     @text_list = []
  30.     @able = []
  31.     #光标
  32.     @item_max = 10
  33.     @column_max = 2
  34.     for i in 0...@item_max
  35.       @able[i] = true
  36.       @cur_back[i] = Sprite.new
  37.       @cur_back[i].bitmap = RPG::Cache.title("title-normal")#+i.to_s)
  38.       @cur_back[i].x = 435+i%4 *86
  39.       @cur_back[i].y = 81#+45*i
  40.       @text_list[i] = Sprite.new
  41.       @text_list[i].bitmap = RPG::Cache.title("index-"+i.to_s)
  42.       @text_list[i].x = 435 + 47+i%4 *86
  43.       @text_list[i].y = 81+9#+45*i + 9
  44.     end
  45.       @cur_back[0].x = 349
  46.       @cur_back[0].y = 145
  47.       @cur_back[1].x = 435
  48.       @cur_back[1].y = 59
  49.       @cur_back[2].x = 521
  50.       @cur_back[2].y = 145
  51.       @cur_back[3].x = 607
  52.       @cur_back[3].y = 59
  53.       @cur_back[4].x = 349
  54.       @cur_back[4].y = 317
  55.       @cur_back[5].x = 435
  56.       @cur_back[5].y = 231
  57.       @cur_back[6].x = 521
  58.       @cur_back[6].y = 317
  59.       @cur_back[7].x = 607
  60.       @cur_back[7].y = 231
  61.       @cur_back[8].x = 435
  62.       @cur_back[8].y = 403
  63.       @cur_back[9].x = 607
  64.       @cur_back[9].y = 403
  65.       @text_list[0].x = 349
  66.       @text_list[0].y = 145
  67.       @text_list[1].x = 435
  68.       @text_list[1].y = 59
  69.       @text_list[2].x = 521
  70.       @text_list[2].y = 145
  71.       @text_list[3].x = 607
  72.       @text_list[3].y = 59
  73.       @text_list[4].x = 349
  74.       @text_list[4].y = 317
  75.       @text_list[5].x = 435
  76.       @text_list[5].y = 231
  77.       @text_list[6].x = 521
  78.       @text_list[6].y = 317
  79.       @text_list[7].x = 607
  80.       @text_list[7].y = 231
  81.       @text_list[8].x = 435
  82.       @text_list[8].y = 403
  83.       @text_list[9].x = 607
  84.       @text_list[9].y = 403

  85.       
  86.       
  87.     @slide_over = false
  88.     super(0, 0, 0, 0)
  89.     self.opacity = 0
  90.     self.active = true
  91.   end
  92.   def origin_x
  93.     return 435
  94.   end
  95.   def origin_y
  96.     return 81
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 一些方法的重载
  100.   #--------------------------------------------------------------------------  
  101.   def dispose
  102.     @button_base.dispose
  103.     for i in 0...@item_max
  104.       @cur_back[i].dispose
  105.       @text_list[i].dispose
  106.     end
  107.     super
  108.   end
  109.   
  110.   def z=(z)
  111.     super(z)
  112.     @button_base.z=z
  113.     for i in 0...@item_max
  114.       @cur_back[i].z=z
  115.       @text_list[i].z=z
  116.     end
  117.   end
  118.   def visible=(visible)
  119.     super(visible)
  120.     @button_base.visible = visible
  121.     for i in 0...@item_max
  122.       @cur_back[i].visible = visible
  123.       @text_list[i].visible = visible
  124.     end
  125.   end
  126.   def index=(index)
  127.     @index=index
  128.   end
  129.   def disable_item(i)
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 光标不被选中状态
  133.   #--------------------------------------------------------------------------
  134.   def back_normal(index)
  135.     if index != -1
  136.        @cur_back[index].bitmap = RPG::Cache.title("title-normal")#+i.to_s)
  137.        @text_list[index].bitmap = RPG::Cache.title("index-"+index.to_s)
  138.     end
  139.   end
  140.   def disable_item(index)
  141.     @cur_back[index].bitmap = RPG::Cache.title("title-pressed")#+i.to_s)
  142.     @able[index] = false
  143.     @text_list[index].bitmap = RPG::Cache.title("index-"+index.to_s+"-black")
  144.     #@cur_back[index].color = Color.new(0,0,0,128)
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 更新光标矩形
  148.   #--------------------------------------------------------------------------
  149.   def update_cursor_rect
  150.     # 光标位置不满 0 的情况下
  151.     if @index < 0
  152.       for i in 0...@item_max
  153.         back_normal(i)
  154.       end
  155.       return
  156.     end
  157.     @cur_back[@index].bitmap = RPG::Cache.title("title-highlight")#+i.to_s)
  158.     @text_list[@index].bitmap = RPG::Cache.title("index-"+index.to_s+"-hl")
  159. #NAME?
  160.     speed = 40#闪烁速度
  161. #    if Graphics.frame_count % speed
  162. #      < speed/2
  163. #      @cur_back[@index].color = Color.new(255,255,255,100+(Graphics.frame_count%speed)*2)
  164. #   else
  165. #     @cur_back[@index].color = Color.new(255,255,255,100+(speed-Graphics.frame_count%speed)*2)
  166. #   end
  167. #NAME?

  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 刷新画面
  171.   #--------------------------------------------------------------------------
  172.   def update
  173.     #@cur_back[i].x = 644#640-188
  174.      @slide_over = true

  175.    
  176.     if self.active
  177.       # 方向键左被按下的情况下
  178.       if Input.repeat?(Input::DOWN)
  179.         $game_system.se_play($data_system.cursor_se)
  180.         back_normal(@index)
  181.         @index = (@index+1)%@item_max
  182.         until @able[@index]
  183.           @index = (@index+1)%@item_max
  184.         end
  185.       end
  186.       # 方向键右被按下的情况下
  187.       if Input.repeat?(Input::UP)
  188.         $game_system.se_play($data_system.cursor_se)
  189.         back_normal(@index)
  190.         @index = (@index+@item_max-1)%@item_max
  191.         until @able[@index]
  192.           @index = (@index+@item_max-1)%@item_max
  193.         end
  194.       end
  195.     end
  196.     # 刷新光标矩形
  197.     update_cursor_rect if @slide_over
  198.   end
  199.   
  200. end
复制代码

阵位破解.png (167.79 KB, 下载次数: 4)

阵位破解.png

4b51ac5253460c7db54720d6d4971b4c_112121o0zv0w8jilj08uv0.png (388.13 KB, 下载次数: 4)

4b51ac5253460c7db54720d6d4971b4c_112121o0zv0w8jilj08uv0.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-8 10:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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