public void OnServerPacket(byte[] inValue) { LibCommon.Network.Types.GameMessage msg = new LibCommon.Network.Types.GameMessage(); ThriftMessageSerialize.DeSerializeCompact(msg, inValue); ClientQueue.Enqueue(msg); }
public override void SendCommandRemote(QueueType inQueue, LibCommon.Network.Types.GameMessage inEvent) { byte[] msg = ThriftMessageSerialize.SerializeCompact(inEvent); if (inQueue == QueueType.Client) { if (string.IsNullOrEmpty(inEvent.NetworkId)) { //_internalNetwork.BroadcastAll(NetworkUtils.SerializeEvent(inEvent)); _internalNetwork.BroadcastAll(msg); ClientQueue.Enqueue(inEvent); } else { Debug.Log(inEvent.NetworkId); if (inEvent.NetworkId == "-1") { ClientQueue.Enqueue(inEvent); } else { _internalNetwork.SendPacketToClient(inEvent.NetworkId, msg); } } } else { _internalNetwork.SendToServer(msg); } }
public override void SendCommandRemote(QueueType inQueue, GameMessage inMsg) { lock (_lockObject) { if (inQueue == QueueType.Client) { ClientQueue.Enqueue(inMsg); } else { ServerQueue.Enqueue(inMsg); } } }
public override void SendCommandLocal(QueueType inQueue, LibCommon.Network.Types.GameMessage inEvent) { switch (inQueue) { case QueueType.Client: ClientQueue.Enqueue(inEvent); break; case QueueType.Server: ServerQueue.Enqueue(inEvent); break; } }
public override void SendCommandRemote(QueueType inQueue, LibCommon.Network.Types.GameMessage inEvent) { byte[] msg = ThriftMessageSerialize.SerializeCompact(inEvent); if (inQueue == QueueType.Client) { ClientQueue.Enqueue(inEvent); } else { _internalNetwork.SendToServer(msg); } }
public override void SendCommandRemote(QueueType inQueue, LibCommon.Network.Types.GameMessage inMsg) { string msg = ThriftMessageSerialize.Serialize(inMsg); if (inQueue == QueueType.Client) { ClientQueue.Enqueue(inMsg); } else { _wwwSendMessageRequest.PostData = Encoding.UTF8.GetBytes(msg); AssetManager.Instance.RequestAssetLoad(_wwwSendMessageRequest); } }
public override void SendCommandLocal(QueueType inQueue, LibCommon.Network.Types.GameMessage inMsg) { if (inQueue == QueueType.Client) { ClientQueue.Enqueue(inMsg); } else { if (inQueue == QueueType.Server) { ServerQueue.Enqueue(inMsg); } } }
/// <summary> /// Set the SequenceNumber property for the specified item, then enqueue it. /// </summary> /// <param name="sp"></param> public void Enqueue(SendParameters sp, ParticipantModel participant) { lock (this) { sp.SequenceNumber = m_NextSequenceNumber; m_NextSequenceNumber++; if (m_QueueList.ContainsKey(sp.Id)) { ((ClientQueue)m_QueueList[sp.Id]).Enqueue(sp); } else { ClientQueue cq = new ClientQueue(sp.Id, participant); cq.Enqueue(sp); m_QueueList.Add(sp.Id, cq); } //Trace.WriteLine("Enqueue guid=" + sp.Tags.SlideID.ToString() + "; seq =" + sp.SequenceNumber.ToString(), this.GetType().ToString()); } }
public void OnServerPacker(AssetLoadRequest inValue) { if (!_running) { return; } if (!inValue.HasFailed) { AsyncPollingWebLoader asyncPollingWebLoader = inValue as AsyncPollingWebLoader; byte[] jsonData = asyncPollingWebLoader?.WebData; if (jsonData != null) { string jsonString = Encoding.UTF8.GetString(jsonData); try { GameMessageList mm = new GameMessageList(); ThriftMessageSerialize.DeSerialize(mm, jsonString); foreach (string item in mm.Messages) { LibCommon.Network.Types.GameMessage gm = new LibCommon.Network.Types.GameMessage(); ThriftMessageSerialize.DeSerialize(gm, item); ClientQueue.Enqueue(gm); } } catch (Exception ex) { Debug.LogErrorFormat("Error Message: {0} {1}", ex.Message, jsonString); } } } _requestingCurrently = false; }