Пример #1
0
 /// <summary>
 /// 프로토콜 결과 수신
 /// ClientIoHandler -> IClientEventListener -> IUIEventListener.perform
 /// </summary>
 /// <param name="gameEvent"></param>
 public override void perform(ClientEventAbstract clientEvent) {
     //로그인 프로토콜
     if( clientEvent.GetProtocol() == Protocol.USER_LOGIN ) {
         if( clientEvent.GetHResult() == RCode.SUCESS ) {
             status = LoginStatus.SUCESS;
         } else {
             status = LoginStatus.FAIL;
         }
     //중복 로그인 프로토콜
     } else if( clientEvent.GetProtocol() == Protocol.DUPLICATE_LOGIN ) {
         status = LoginStatus.DUPLICATE_LOGIN;
     }
 }
Пример #2
0
        /// <summary>
        /// UIListener Callback을 위해 list에 등록해둔다.
        /// 이후 doUiEvent Thread에서 하나씩 꺼내 처리 한다.
        /// </summary>
        /// <param name="ClientEventAbstract"></param>
        public void AddClientEvent(ClientEventAbstract clientEvent)
        {
            Log.game.Debug("GameEvent added : " + clientEvent.GetProtocol().Desc);

            lock ( eventLock ) {
                if (clientEvents.Contains(clientEvent))
                {
                    return;
                }
                clientEvents.Add(clientEvent);
                //이벤트 발생 대기중인 Thread를 해제한다
                Monitor.Pulse(eventLock);
            }
        }
Пример #3
0
        /// <summary>
        /// IClieventListener.EventReceive
        /// 처리흐름 : ClientIoHandler -> [IClientEventListener] -> ClientEventAbstract -> IUIEventListener
        /// </summary>
        /// <param name="protocol"></param>
        /// <param name="buffer"></param>
        public void EventReceive(Protocol protocol, IoBuffer buffer)
        {
            Log.game.Debug("controller.EventReceived : " + protocol.Desc);

            //프로토콜에 해당하는 ClientEvent 반환
            ClientEventAbstract clientEvent = ClientEventFactory.getEvent(protocol);

            if (clientEvent == null)
            {
                return;
            }

            try{
                //이벤트 처리
                clientEvent.Set(buffer);
            }catch {
            }finally{
                //UIEventListener에 전달하기 위해 등록
                AddClientEvent(clientEvent);
            }
        }
Пример #4
0
 /// <summary>
 /// UI Listener callBack
 /// </summary>
 /// <param name="ClientEventAbstract"></param>
 private void CallBack(ClientEventAbstract clientEvent)
 {
     Log.game.Debug("UIEvent CallBack : " + clientEvent.GetProtocol().Desc);
     if (uiListeners.Count == 0)
     {
         return;
     }
     lock ( listenerLock ) {
         if (uiListeners.Count == 0)
         {
             return;
         }
         foreach (UIListenerData data in uiListeners)
         {
             if (data.Protocol == clientEvent.GetProtocol())
             {
                 data.Listener.perform(clientEvent);
             }
         }
     }
 }
Пример #5
0
 /// <summary>
 /// UI Listener callBack
 /// </summary>
 /// <param name="ClientEventAbstract"></param>
 private void CallBack(ClientEventAbstract clientEvent) {
     Log.game.Debug("UIEvent CallBack : " + clientEvent.GetProtocol().Desc);
     if( uiListeners.Count == 0 ) return;
     lock( listenerLock ) {
         if( uiListeners.Count == 0 ) return;
         foreach( UIListenerData data in uiListeners ) {
             if( data.Protocol == clientEvent.GetProtocol() ) {
                 data.Listener.perform(clientEvent);
             }
         }
     }
 }
Пример #6
0
        /// <summary>
        /// UIListener Callback을 위해 list에 등록해둔다.
        /// 이후 doUiEvent Thread에서 하나씩 꺼내 처리 한다.
        /// </summary>
        /// <param name="ClientEventAbstract"></param>
        public void AddClientEvent(ClientEventAbstract clientEvent) {
            Log.game.Debug("GameEvent added : " + clientEvent.GetProtocol().Desc);

            lock( eventLock ) {
                if( clientEvents.Contains(clientEvent) ) return;
                clientEvents.Add(clientEvent);
                //이벤트 발생 대기중인 Thread를 해제한다
                Monitor.Pulse(eventLock);
            }
        }
Пример #7
0
 public override void perform(ClientEventAbstract clientEvent) {
 }
Пример #8
0
 /// <summary>
 /// 프로토콜 결과 수신
 /// ClientIoHandler -> IClientEventListener -> IUIEventListener.perform
 /// </summary>
 /// <param name="gameEvent"></param>
 public abstract void perform(ClientEventAbstract clientEvent);