Exemplo n.º 1
0
        protected override void OnOperationResponse(OperationResponse operationResponse, SendParameters sendParameters)
        {
            GameApplication application = GameApplication.Instance as GameApplication;

            if (application == null)
            {
                return;
            }

            S2SBaseHandler handler = application.GetS2SHandler((S2SOperationCode)operationResponse.OperationCode);

            if (handler == null)
            {
                return;
            }
            byte[] data = null;
            object p    = null;

            if (operationResponse.Parameters.TryGetValue(0, out p))
            {
                data = p as byte[];
            }
            handler.OnOperationResponse((ReturnCode)operationResponse.ReturnCode, data);
        }
Exemplo n.º 2
0
        protected override void OnEvent(IEventData eventData, SendParameters sendParameters)
        {
            GameApplication application = GameApplication.Instance as GameApplication;

            if (application == null)
            {
                return;
            }

            S2SBaseHandler handler = application.GetS2SHandler((S2SOperationCode)eventData.Code);

            if (handler == null)
            {
                return;
            }
            byte[] data = null;
            object p    = null;

            if (eventData.Parameters.TryGetValue(0, out p))
            {
                data = p as byte[];
            }
            handler.OnEvent(data);
        }
Exemplo n.º 3
0
        protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
        {
            GameApplication application = GameApplication.Instance as GameApplication;

            if (application == null)
            {
                return;
            }

            S2SBaseHandler handler = application.GetS2SHandler((S2SOperationCode)operationRequest.OperationCode);

            if (handler == null)
            {
                return;
            }
            byte[] data = null;
            object p    = null;

            if (operationRequest.Parameters.TryGetValue(0, out p))
            {
                data = p as byte[];
            }
            handler.OnOperateRequest(data, this, sendParameters);
        }
Exemplo n.º 4
0
 private void RegisterS2SHandler(S2SBaseHandler handler)
 {
     s2sHandlers.Add(handler.OpCode, handler);
 }