void OnRelayConnectedProc(byte[] data) { ConnectorResult result = convertConnectorResult(data); ADebug.Log("c#:OnRelayConnectedProc: " + result); if (result == ConnectorErrorCode.Success) { Connected = true; } else { Connected = false; } if (RelayConnectEvent != null) { try { RelayConnectEvent(result); } catch (Exception ex) { ADebug.LogException(ex); } } else { ADebug.Log("OnRelayConnectedProc RelayConnectEvent is null"); } }
public override void PerformVoidMethodWithId(int methodId) { ADebug.Log("PerformVoidMethodWithId"); if (methodId == 1001) { if (RecvedDataEvent != null) { try { RecvedDataEvent(); } catch (Exception ex) { ADebug.LogException(ex); } } } else if (methodId == 1002) { if (RecvedUDPDataEvent != null) { try { RecvedUDPDataEvent(); } catch (Exception ex) { ADebug.LogException(ex); } } } }
void OnStateChangedProc(int state, byte[] resultdata) { ConnectorResult result = convertConnectorResult(resultdata); ConnectorState s = (ConnectorState)state; ADebug.Log("OnStateChangedProc state: " + s + " " + result.ToString()); if (s == ConnectorState.Reconnected && result.IsSuccess()) { Connected = true; } else { Connected = false; } if (StateChangedEvent != null) { try { StateChangedEvent(s, result); } catch (Exception ex) { ADebug.LogException(ex); } } }
void OnRouteChangedProc(string msg) { UInt64 serverId = UInt64.Parse(msg); ADebug.Log("OnStateChangedProc msg: " + msg + ", serverId:" + serverId); if (RouteChangedEvent != null) { try { RouteChangedEvent(serverId); } catch (Exception ex) { ADebug.LogException(ex); } } }
public bool Encode(out byte[] buffer) { try { ApolloBufferWriter writer = new ApolloBufferWriter(); BeforeEncode(writer); WriteTo(writer); buffer = writer.GetBufferData(); return(true); } catch (Exception ex) { buffer = null; ADebug.LogException(ex); return(false); } }
public bool Decode(ApolloBufferReader reader) { if (reader != null) { try { BeforeDecode(reader); ReadFrom(reader); return(true); } catch (Exception ex) { ADebug.LogException(ex); return(false); } } return(false); }
public bool Encode(ApolloBufferWriter writer) { if (writer == null) { return(false); } try { BeforeEncode(writer); WriteTo(writer); return(true); } catch (Exception ex) { ADebug.LogException(ex); return(false); } }
public bool Decode(byte[] data) { if (data != null) { try { ApolloBufferReader reader = new ApolloBufferReader(data); BeforeDecode(reader); ReadFrom(reader); return(true); } catch (Exception ex) { ADebug.LogException(ex); return(false); } } return(false); }
void OnDisconnectProc(byte[] data) { ConnectorResult result = convertConnectorResult(data); ADebug.Log("c#:OnDisconnectProc: " + result); if (result.IsSuccess()) { Connected = false; } if (DisconnectEvent != null) { try { DisconnectEvent(result); } catch (Exception ex) { ADebug.LogException(ex); } } }