//从FduClusterCommandDispatcher中获取一次数据
        public void RefreshData()
        {
            if (!isRunnig || ClusterHelper.Instance == null)
            {
                return;
            }

            List <ClusterCommand> .Enumerator Commands = FduClusterCommandDispatcher.getCommands();
            while (Commands.MoveNext())
            {
                if (_CommandQueue.Count >= MAX_Command_COUNT)
                {
                    _CommandQueue.Dequeue();
                }

                if (_CommandAccumulatedTimes.ContainsKey(Commands.Current.getCommandName()))
                {
                    _CommandAccumulatedTimes[Commands.Current.getCommandName()]++;
                }
                else
                {
                    _CommandAccumulatedTimes[Commands.Current.getCommandName()] = 0;
                }

                _CommandQueue.Enqueue(new ClusterCommandShowData(ClusterCommand.createSnapShot(Commands.Current), ClusterHelper.Instance.FrameCount));
            }
        }
Esempio n. 2
0
 public override void Init(string para)
 {
     if (para == null)
     {
         Debug.LogError("[FduDTS_OnClusterCommand]Command name set to FduDTS_OnClusterCommand can not be null");
     }
     _CommandName = para;
     //dtsId = FduDTS_OnCommandIDGenerator.getNextId();
     dtsId = FduClusterCommandDispatcher.AddCommandExecutor(_CommandName, onReceiveCommand);
 }
 public override void Serialize()
 {
     BufferedNetworkUtilsServer.SendInt(_clusterCommandWatingList.Count);//total number of cluster Commands
     try
     {
         foreach (ClusterCommand e in _clusterCommandWatingList)
         {
             e.SerializeParameterData();
             e.SerializeGenericData();
         }
         ClusterCommandStatisticClass.instance.RefreshData();
         FduClusterCommandDispatcher.NotifyDispatch();
     }
     catch (InvalidSendableDataException e)
     {
         Debug.LogError(e.Message);
     }
     finally
     {
         clearClusterCommands();
     }
 }
        public override NetworkState.NETWORK_STATE_TYPE Deserialize()
        {
            NetworkState.NETWORK_STATE_TYPE state = NetworkState.NETWORK_STATE_TYPE.SUCCESS;
            clearClusterCommands();
            int CommandCount = BufferedNetworkUtilsClient.ReadInt(ref state); //total number of cluster Commands

            try
            {
                for (int i = 0; i < CommandCount; ++i)
                {
                    ClusterCommand newCommand = new ClusterCommand("1");
                    newCommand.DeserializeParameterData(ref state);
                    newCommand.DeserializeGenericData(ref state);
                    _clusterCommandWatingList.Add(newCommand);
                }
                ClusterCommandStatisticClass.instance.RefreshData();
                FduClusterCommandDispatcher.NotifyDispatch();
            }
            catch (InvalidSendableDataException e)
            {
                Debug.LogError(e.Message);
            }
            return(state);
        }
Esempio n. 5
0
 public override void Destroy()
 {
     FduClusterCommandDispatcher.RemoveCommandExecutor(_CommandName, dtsId);
 }
 public ClusterCommandManager()
     : base()
 {
     FduClusterCommandDispatcher.setClusterCommandManager(this);
 }
Esempio n. 7
0
 public void Send(bool multiCommandAllow = true)
 {
     FduClusterCommandDispatcher.SendClusterCommand(this, multiCommandAllow);
 }