コード例 #1
0
ファイル: PingPacketIn.cs プロジェクト: shuidong/Voxalia
 public override void Apply()
 {
     if (IsChunkConnection)
     {
         ClientNetworkBase.SendPacketToSecondary(new PingPacketOut(marker));
     }
     else
     {
         ClientNetworkBase.SendPacket(new PingPacketOut(marker));
         //SysConsole.Output(OutputType.INFO, (ClientMain.GlobalTickTime - Time).ToString());
         if (Math.Abs(ClientMain.GlobalTickTime - Time) > 1)
         {
             ClientMain.GlobalTickTime = Time;
         }
         else if (ClientMain.GlobalTickTime - Time > 0.1)
         {
             ClientMain.GlobalTickTime -= 0.05;
         }
         else if (ClientMain.GlobalTickTime - Time < -0.1)
         {
             ClientMain.GlobalTickTime += 0.05;
         }
         else if (ClientMain.GlobalTickTime - Time > 0.01)
         {
             ClientMain.GlobalTickTime -= 0.005;
         }
         else if (ClientMain.GlobalTickTime - Time < -0.01)
         {
             ClientMain.GlobalTickTime += 0.005;
         }
     }
 }
コード例 #2
0
 public override void Execute(CommandEntry entry)
 {
     ClientMain.QuickBarPos--;
     if (ClientMain.QuickBarPos < 0)
     {
         ClientMain.QuickBarPos += ClientMain.QuickBar.Count + 1;
     }
     if (ClientNetworkBase.Connected)
     {
         ClientNetworkBase.SendPacket(new SelectionPacketOut(ClientMain.QuickBarPos));
     }
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: shuidong/Voxalia
        public override void Tick()
        {
            Direction.X += MouseHandler.MouseDelta.X;
            Direction.Y += MouseHandler.MouseDelta.Y;
            TickMovement(ClientMain.Delta);
            ClientMain.CameraEye = Position + new Location(0, 0, Maxes.Z);
            Location forward = Utilities.ForwardVector_Deg(Direction.X, Direction.Y);

            ClientMain.CameraTarget = ClientMain.CameraEye + forward;
            ltime += ClientMain.Delta;
            Location seltarg = ClientMain.CameraEye + forward * 10;

            SelectedBlock = Collision.BoxRayTrace(new Location(-0.001), new Location(0.001), ClientMain.CameraEye, seltarg, -1);
            if (SelectedBlock == seltarg)
            {
                SelectedBlock = Location.NaN;
            }
            if ((Forward != pForward || Backward != pBackward ||
                 Leftward != pLeftward || Rightward != pRightward ||
                 Upward != pUpward || Downward != pDownward ||
                 Slow != pSlow || Use != pUse ||
                 Attack != pAttack || Secondary != pSecondary ||
                 Direction.X != pDirection.X ||
                 Direction.Y != pDirection.Y) ||
                ltime >= 0.1)
            {
                pForward   = Forward;
                pBackward  = Backward;
                pLeftward  = Leftward;
                pRightward = Rightward;
                pUpward    = Upward;
                pDownward  = Downward;
                pDirection = Direction;
                pSlow      = Slow;
                pUse       = Use;
                pAttack    = Attack;
                pSecondary = Secondary;
                ltime      = 0;
                AddMS();
                if (ClientNetworkBase.Connected)
                {
                    ClientNetworkBase.SendPacket(new MoveKeysPacketOut(MoveStates[MoveStates.Count - 1]));
                }
                if (MoveStates.Count > 250)
                {
                    MoveStates.RemoveRange(0, 50);
                }
            }
        }
コード例 #4
0
ファイル: ClientOutputter.cs プロジェクト: shuidong/Voxalia
 public override void UnknownCommand(string basecommand, string[] arguments) // TODO: Base DebugMode?
 {
     if (ClientNetworkBase.Connected)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append(basecommand);
         for (int i = 0; i < arguments.Length; i++)
         {
             sb.Append("\n").Append(ClientCommands.CommandSystem.TagSystem.ParseTags(arguments[i], TextStyle.Color_Simple, null, DebugMode.MINIMAL));
         }
         CommandPacketOut packet = new CommandPacketOut(sb.ToString());
         ClientNetworkBase.SendPacket(packet);
     }
     else
     {
         WriteLine(TextStyle.Color_Error + "Unknown command '" +
                   TextStyle.Color_Standout + basecommand + TextStyle.Color_Error + "'.");
     }
 }