Exemple #1
0
        private LPNetEvent _CreateEvent(ENetEventType eType)
        {
            LPNetEvent netEvent = null;

            switch (eType)
            {
            case ENetEventType.Recv:
            {
                netEvent = new LPRecvNetEvent();
                if (LOG_ERROR(netEvent != null))
                {
                    goto Exit0;
                }
                netEvent.eType = ENetEventType.Recv;
            }
            break;

            case ENetEventType.Terminate:
            {
                netEvent = new LPTerminateNetEvent();
                if (LOG_ERROR(netEvent != null))
                {
                    goto Exit0;
                }
                netEvent.eType = ENetEventType.Terminate;
            }
            break;

            case ENetEventType.Establish:
            {
                netEvent = new LPEstablishNetEvent();
                if (LOG_ERROR(netEvent != null))
                {
                    goto Exit0;
                }
                netEvent.eType = ENetEventType.Establish;
            }
            break;

            case ENetEventType.ConnectError:
            {
                netEvent = new LPConnectErrorNetEvent();
                if (LOG_ERROR(netEvent != null))
                {
                    goto Exit0;
                }
                netEvent.eType = ENetEventType.ConnectError;
            }
            break;

            default:
                if (LOG_ERROR(false))
                {
                    goto Exit0;
                }
                break;
            }

            return(netEvent);

Exit0:
            return(null);
        }