Пример #1
0
        public void Submit(int playerIndex, Cmd cmd)
        {
            if (cmd.Code == CmdCode.ExecuteTask)
            {
                TaskCmd  executeTaskCmd = (TaskCmd)cmd;
                TaskInfo task           = SerializedTask.ToTaskInfo(executeTaskCmd.Task);
                task.PlayerIndex = playerIndex;
                m_taskEngines[playerIndex].SubmitTask(task);
            }
            else
            {
                if (playerIndex >= 0 && playerIndex < m_players.Length)
                {
                    IMatchPlayerController player = m_players[playerIndex];
                    if (player != null)
                    {
                        player.Submit(cmd);
                    }
                }
            }

            if (OnSubmitted != null)
            {
                OnSubmitted(playerIndex, cmd);
            }
        }
Пример #2
0
 protected void SubmitCommand()
 {
     if (m_taskEngine.IsClient)
     {
         TaskInfo taskInfo = new TaskInfo(m_taskInfo, true);
         TaskCmd  taskCmd  = new TaskCmd(SerializedTask.FromTaskInfo(taskInfo));
         taskCmd.UnitIndex = m_taskInfo.Cmd.UnitIndex;
         m_taskEngine.MatchEngine.Submit(m_taskInfo.PlayerIndex, taskCmd);
     }
     else
     {
         if (m_taskInfo.RequiresClientSidePreprocessing)
         {
             m_taskEngine.MatchEngine.Submit(m_taskInfo.PlayerIndex, m_taskInfo.PreprocessedCmd);
         }
         else
         {
             m_taskEngine.MatchEngine.Submit(m_taskInfo.PlayerIndex, m_taskInfo.Cmd);
         }
     }
 }