查看: 1340|回复: 0

[已经过期] manually_group_them_up如何将以下脚本在窗口里处理

[复制链接]
梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2023-5-16 14:35:55 | 显示全部楼层 |阅读模式

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

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

×
在窗口里安命令处理
[pre lang="ruby"]  def manually_group_them_up#手动定义组主题
    #各种刷新
    Graphics.update
    Input.update
    @spriteset.update
    #改变画面颜色
    $game_screen.start_tone_change(Tone.new(@efs_tone_R,@efs_tone_G,@efs_tone_B), 20)
    #等待一会儿   
      
    wait_a_moment(true)

    #开启消息
    Notification.show
   
    for groups in @team_groups
    next unless groups.aviliable?
    groups.calculate_rect_size(@target_d)
      if @target_d == 4 or @target_d == 6
        if groups.get_length > @team_spawn_height or groups.get_height > @team_spawn_width
          Notification.post(groups.name+"队伍过于庞大无法手动布阵!")
          next
        end
      else
        if groups.get_length > @team_spawn_width or groups.get_height > @team_spawn_height
          Notification.post(groups.name+"队伍过于庞大无法手动布阵!")
          next
        end  
      end  
      
      #通知。邮递                      组。名称
      Notification.post("正在手动部署"+groups.name+",请选择一个一个部署地点。")
      #让用户为派生(组)选择目标
      let_user_choose_a_goal_for_spawn(groups)
      flush_map_makers #平面地图绘制器
    end
   # 取消使地图移动(@团队显示区域)
    cancel_make_map_move(@team_display_area)
   # 取消使地图移动( @efs团队生成)
    cancel_make_map_move(@efs_team_spawn)
    flush_map_makers #平面地图绘制器
   
   
   
  end
  #定义让用户为出生(组)选择一个目标
  def let_user_choose_a_goal_for_spawn(group)
    # 演奏确定 SE
    $game_system.se_play($data_system.decision_se)
    #临时存储=$游戏玩家。字符名称
    temp_storage = $game_player.character_name
    #最终x=无[1,2,3,4,5]
    final_x = nil
  #  final_x = [11,14,17,20,20]
    #最终y=无[1,2,3,4,5]
  #  final_y = [20,23,20,17,29]
    final_y = nil
    #cp=组.队长
    cp = group.captain
    x = cp.x
    y = cp.y
   # cp.转向战斗者(cp.找到最近的敌人)
    cp.turn_toward_fighter(cp.find_closest_enermy)
     #$游戏玩家。字符名称=cp.字符名称
     $game_player.character_name = cp.character_name
     #游戏玩家。移动(X,Y)
     $game_player.moveto(x,y)
     #$游戏玩家。透明=错误
     $game_player.transparent = false
     #游戏玩家方向= cp.方向
     $game_player.direction = cp.direction

      loop do #循环 do
       pl = $game_player#游戏玩家
      # @efs最后一个实数x=pl.实数x
       @efs_last_real_x = pl.real_x
      # @efs最后一个实数y=pl.实数y
       @efs_last_real_y = pl.real_y
       #游戏系统更新
       $game_system.update
      
       #游戏_屏幕更新
       $game_screen.update
       @spriteset.update#精灵集更新
       Input.update #输入更新
      # _更新生成(组)的命令和输入
       _update_comand_input_for_spawn(group)
       Graphics.update#图形更新
        
        if Input.trigger?(Input::C)#如果输入触发器?(输入::C)
          if if_user_can_deploy(group)#if-if用户可以部署(组)
          # 演奏确定 SE
          $game_system.se_play($data_system.decision_se)
           #最终x=游戏玩家.x
           final_x = $game_player.x
           ##最终y=游戏玩家.y
           final_y = $game_player.y
            break
          else  
            $game_system.se_play($data_system.buzzer_se)
            
            
          end #user can
        end #if
        if Input.trigger?(Input::B)
            # 演奏取消 SE
            $game_system.se_play($data_system.cancel_se)
          #spawn_groups
          #break
        end
      end #loop
      #游戏玩家。透明度=真如果@玩家控制  
      $game_player.transparent = true if @player_controll
      #$游戏玩家。字符名称=临时存储
      $game_player.character_name = temp_storage
      return final_x, final_y
      
    end #def

  #--------------------------------------------------------
  # EFS系统 主初始化函数:
  #--------------------------------------------------------  
  def _update_comand_input_for_spawn(group)
  #-<方向键>------------   
      if Input.repeat?(Input::UP)
        #p $game_screen.tone.red
        if @efs_team_spawn.include?([$game_player.x,$game_player.y-1])
        $game_system.se_play($data_system.cursor_se)
        cancel_make_map_move(@team_display_area)
          $game_player.moveto($game_player.x,$game_player.y-1)
          display_move_able_groups(group)
        else  
        $game_system.se_play($data_system.buzzer_se)
        end  
        return
      end
      if Input.repeat?(Input::DOWN)
        if @efs_team_spawn.include?([$game_player.x,$game_player.y+1])  
        $game_system.se_play($data_system.cursor_se)
        cancel_make_map_move(@team_display_area)
        $game_player.moveto($game_player.x,$game_player.y+1)  
        display_move_able_groups(group)
        else  
       $game_system.se_play($data_system.buzzer_se)
       end  
      return
      end
      if Input.repeat?(Input::RIGHT)  
       if @efs_team_spawn.include?([$game_player.x+1,$game_player.y])  
        $game_system.se_play($data_system.cursor_se)
        cancel_make_map_move(@team_display_area)
          $game_player.moveto($game_player.x+1,$game_player.y)  
         display_move_able_groups(group)
       else  
       $game_system.se_play($data_system.buzzer_se)
       end  
        return
      end
      if Input.repeat?(Input::LEFT)
        if @efs_team_spawn.include?([$game_player.x-1,$game_player.y])  
        $game_system.se_play($data_system.cursor_se)
        cancel_make_map_move(@team_display_area)
          $game_player.moveto($game_player.x-1,$game_player.y)  
         display_move_able_groups(group)
        else  
        $game_system.se_play($data_system.buzzer_se)
        end  
       return
      end  
  end
  
  
  
  def display_move_able_groups(group)
    cp = group.captain
    cp.set_goal_xy($game_player.x,$game_player.y)
    group.set_up_rect(group.captain.direction,1,true,false)
    @team_display_area = group.display_grid_of_indiv
    make_map_move(@team_display_area)
      for f in group.fighter
        f.moveto(f.goal_x,f.goal_y)
        make_map_team_display(f)
      end
   
   
  
  end
  
  def if_user_can_deploy(group)
      for f in group.fighter
        next if f.dead?
        x,y = f.x,f.y
         if not $game_map.passable?(x,y,10,f) or not @efs_team_spawn.include?([x,y])
          return false
        end
      end
    return true
   
   
  end  

  def make_map_team_display(f)
    x,y = f.x,f.y
    if $game_map.passable?(x,y,10,f) and  @efs_team_spawn.include?([x,y])
    @spriteset.flash_data[x, y] = 0xfe2af2
    else
      @spriteset.flash_data[x, y] = 0xf84
    end  
      #@efs_team_spawn
      #0xf84
  end
  
  def flush_map_makers
    for x in 0..$game_map.width-1
      for y in 0..$game_map.height-1
         @spriteset.flash_data[x, y] = 0
      end  
    end  
   
  end
  
  
end  [/pre]
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部