Ejemplo n.º 1
0
 public ScreenDamageInfo(GameCharacterController cc, string message)
 {
     TargetCC       = cc;
     DamageMessage  = message;
     StartTimeStamp = NativeEngineHelper.GetTimeSeconds();
     CountTime      = 0;
     Scale          = 1.0f;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 供外部调用判断是否可以执行
 /// </summary>
 /// <param name="forceCheck"></param>
 /// <returns></returns>
 public bool CanDoSpecialMove(SpecialMoveBase oldSM, bool forceCheck)
 {
     if (OwnerCC != null)
     {
         float currentTimeStamp = NativeEngineHelper.GetTimeSeconds();
         if (forceCheck || currentTimeStamp != LastCanDoSpecialMoveTime)
         {
             LastCanDoSpecialMove     = InternalCanDoSpecialMove(oldSM);
             LastCanDoSpecialMoveTime = currentTimeStamp;
         }
         return(LastCanDoSpecialMove);
     }
     return(false);
 }
Ejemplo n.º 3
0
        public void OnReplicateMove()
        {
            NCharacterController controller = OwnerController;

            if (controller != null)
            {
                // 发送移动消息
                C2S_Move msg;
                msg.messageId    = C2S_Move.Id;
                msg.Position     = controller.Location;
                msg.Acceleration = controller.Acceleration;
                msg.Yaw          = controller.Rotation.y;
                msg.Flag         = NSavedMove.ControllerToFlags(controller);
                msg.TimeStamp    = NativeEngineHelper.GetTimeSeconds();
                GameFrameManager.SendNetMessage <C2S_Move>(msg);
            }
        }
Ejemplo n.º 4
0
        void btnOK_Clicked(object sender, GUIEventArgs e)
        {
            // 发送登录消息
            // Create a point struct.
            C2S_LoginProof loginMsg;

            loginMsg.messageId  = C2S_LoginProof.Id;
            loginMsg.CurVersion = 0;
            loginMsg.AccountID  = NativeEngineHelper.CheckCRC(uiID.Text.ToString().Trim());
            string password = uiPassword.Text.ToString().Trim();

            loginMsg.Password = password;
            loginMsg.IP       = 0;
            loginMsg.Mac      = String.Empty;
            GameFrameManager.SendNetMessage <C2S_LoginProof>(loginMsg);

            btnOK.Disable();
        }
        public void ClientUseSkill(UInt32 spellId)
        {
            NCamera      camera   = Program.game.GameWindow.ViewportControl.Viewport.Camera;
            Ray          mouseRay = camera.GetMouseRay(PlayerInput.MouseValueX, PlayerInput.MouseValueY);
            NCheckResult hit      = new NCheckResult();

            if (GameEngine.EngineInstance.CurrentLevel.LineCheck(out hit, mouseRay.Position, mouseRay.Position + mouseRay.Direction * camera.ZFar, LineCheckType.World))
            {
                C2S_CastSpell msg;
                msg.MessageId = C2S_CastSpell.Id;
                msg.SpellID   = spellId;
                msg.TargetId  = 0;
                msg.TargetPos = hit.location;
                msg.TimeStamp = NativeEngineHelper.GetTimeSeconds();
                msg.CastCount = 1;
                GameFrameManager.SendNetMessage <C2S_CastSpell>(msg);
            }
        }
Ejemplo n.º 6
0
        void btnEnterGame_Clicked(object sender, GUIEventArgs e)
        {
            // 发送进入游戏消息
            C2S_CharEnterGame enterGameReq;

            enterGameReq.messageId = C2S_CharEnterGame.Id;
            enterGameReq.PlayerId  = 125;
            GameFrameManager.SendNetMessage <C2S_CharEnterGame>(enterGameReq);

            // 请求服务器事件
            C2S_CheckTime checkTimeReq;

            checkTimeReq.MessageId       = C2S_CheckTime.Id;
            checkTimeReq.ClientTimeStamp = NativeEngineHelper.GetTimeSeconds();
            GameFrameManager.SendNetMessage <C2S_CheckTime>(checkTimeReq);

            btnEnterGame.Disable();
        }
        public void OnReplicateMove()
        {
            LocalPlayerController controller = OwnerController;

            if (controller != null &&
                GameFrameManager.Instance.CurrentFrameType == GameFrameType.Gaming)
            {
                // 发送移动消息
                C2S_Move msg;
                msg.messageId    = C2S_Move.Id;
                msg.Position     = controller.Location;
                msg.Acceleration = controller.Acceleration;
                msg.Yaw          = Vector3.CalcYaw(controller.Acceleration);
                msg.Flag         = NSavedMove.ControllerToFlags(controller, controller.PressJump ? (Byte)MovementFlag.PressJump : Byte.MinValue);
                msg.TimeStamp    = NativeEngineHelper.GetTimeSeconds();
                GameFrameManager.SendNetMessage <C2S_Move>(msg);

                // 保存到消息队列以便验证
                controller.NetMovementMessages.Add(msg);

                //Debug.WriteLine("Send C2S_Move " + " Position:" + msg.Position + " Acceleration:" + msg.Acceleration + " Flag:" + msg.Flag);
            }
        }
Ejemplo n.º 8
0
 public MessageElement(string message)
 {
     this.Message   = message;
     this.TimeStamp = NativeEngineHelper.GetTimeSeconds();
     this.CountTime = 0;
 }