Esempio 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;

            if (operationResponse.Parameters.TryGetValue(0, out p))
            {
                data = p as byte[];
            }
            handler.OnOperationResponse((ReturnCode)operationResponse.ReturnCode, data);
        }
Esempio 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;

            if (eventData.Parameters.TryGetValue(0, out p))
            {
                data = p as byte[];
            }
            handler.OnEvent(data);
        }
Esempio 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;

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