예제 #1
0
 public void OnFrameAsyn(SCFrameNotify frameAsyn)
 {
     if (!_isGaming)
     {
         return;
     }
     //无操作的帧直接跑
     if (_nextFrameStep < frameAsyn.CurrentFrame)
     {
         TickerManager.Instance.DriveToTickCount(frameAsyn.CurrentFrame - 1);
         _nextFrameStep = frameAsyn.CurrentFrame;
     }
     //当前帧判断内容
     if (_nextFrameStep == frameAsyn.CurrentFrame)
     {
         //按键
         foreach (var frameControlList in frameAsyn.Keys)
         {
             IInputListener listener = _inputListeners[frameControlList.Uin];
             foreach (var con in frameControlList.Keys)
             {
                 #region 解析按键
                 UInt16 key = (UInt16)con;
                 //后两位是类型 up down
                 UInt16 type = (Byte)(key & 0x3);
                 key >>= 2;
                 //值 0~2^10 范围
                 UInt16 value = (UInt16)(key & 0x3ff);
                 key >>= 10;
                 //自定义类型
                 key &= 0xf;
                 #endregion
                 if (key == InputDefine.DIRCTION_KEY)
                 {
                     float angle = value;
                     if (CommonFunction.GreatOrEqualZero(angle - 180f))
                     {
                         angle -= 360f;
                     }
                     listener.OnMove(angle, (MoveType)type);
                 }
                 else
                 {
                     if (type > 0)
                     {
                         listener.OnFunctionKeyDown(key);
                     }
                     else
                     {
                         listener.OnFunctionKeyUp(key);
                     }
                 }
             }
         }
         _nextFrameStep = frameAsyn.NextFrame;
         TickerManager.Instance.DriveToTickCount(_nextFrameStep - 1);
     }
 }
예제 #2
0
 public override void DeSerialize(MemoryStream stream)
 {
     data = SCFrameNotify.Parser.ParseFrom(stream);
 }