Esempio n. 1
0
        private void FetchUpdate()
        {
            try
            {
                Release latestRelease  = GitUtils.GetLatestVersion();
                int[]   latestVersion  = GitUtils.DecomposeVersion(latestRelease);
                int[]   currentVersion = GitUtils.DecomposeVersion(MapBuilder.Program.Version);

                if (GitUtils.CompareVersion(latestVersion, currentVersion))
                {
                    DialogResult choice = MessageBox.Show("A new version is available ! (Current : " + MapBuilder.Program.Version + " | Latest : " + latestRelease.TagName + ") \n Would you like to go to the downloads page ?", "Updater", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (choice == DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start("https://github.com/EdwinMindcraft/PelicamonTools/releases");
                    }
                }
                else
                {
                    Console.Out.WriteLine("Current version matches latest release");
                }
                OnUpdateFinish.Invoke();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Seems like an error occured, please verify your connection and try again. \n If the problem still occurs, please contact EdwinMindcraft or Edern via Discord with the following error report attached. \n \n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                OnUpdateFinish.Invoke();
                return;
            }
        }
Esempio n. 2
0
 public async Task InitializeUserList(Action onFinish = null)
 {
     lastUpdate = Functions.TimeStamp;
     deltaTime  = (int)(Functions.TimeStamp - lastUpdate);
     api.GetFriends(user =>
     {
         data.UpdateUser(user);
     }
                    , () =>
     {
         onFinish?.Invoke();
         OnUpdateFinish?.Invoke();
     }
                    );
 }
Esempio n. 3
0
 public async Task UpdateUserList(Action onFinish = null)
 {
     api.GetOnlineFriend(user =>
     {
         data.UpdateUser(user);
     },
                         (users) =>
     {
         OnUpdateFinish?.Invoke();
         data.UpdateOfflineUser(users, (u, l) =>
         {
             OnUpdateFinish?.Invoke();
             onFinish?.Invoke();
             log.LogUsers(l, deltaTime);
         });
     });
 }
Esempio n. 4
0
    internal void LateUpdate()
    {
        deltaTime = Mathf.Min(deltaTimeCap, Time.deltaTime);

        if (transform.position.y < minimumYPosition)
        {
            SetPosition(characterPosition.worldPosition);
            return;
        }

        if (freeMovementController.IsActive())
        {
            velocity = freeMovementController.CalculateMovement();
        }
        else
        {
            velocity.x  = 0f;
            velocity.z  = 0f;
            velocity.y += gravity * deltaTime;

            bool previouslyGrounded = isGrounded;

            if (!isJumping || velocity.y <= 0f)
            {
                CheckGround();
            }

            if (isGrounded)
            {
                isJumping  = false;
                velocity.y = gravity * deltaTime; // to avoid accumulating gravity in velocity.y while grounded
            }
            else if (previouslyGrounded && !isJumping)
            {
                lastUngroundedTime = Time.time;
            }

            if (Utils.isCursorLocked && characterForward.HasValue())
            {
                // Horizontal movement
                var speed = movementSpeed * (isSprinting ? runningSpeedMultiplier : 1f);

                transform.forward = characterForward.Get().Value;

                var xzPlaneForward = Vector3.Scale(cameraForward.Get(), new Vector3(1, 0, 1));
                var xzPlaneRight   = Vector3.Scale(cameraRight.Get(), new Vector3(1, 0, 1));

                Vector3 forwardTarget = Vector3.zero;

                if (characterYAxis.GetValue() > 0)
                {
                    forwardTarget += xzPlaneForward;
                }
                if (characterYAxis.GetValue() < 0)
                {
                    forwardTarget -= xzPlaneForward;
                }

                if (characterXAxis.GetValue() > 0)
                {
                    forwardTarget += xzPlaneRight;
                }
                if (characterXAxis.GetValue() < 0)
                {
                    forwardTarget -= xzPlaneRight;
                }


                forwardTarget.Normalize();
                velocity += forwardTarget * speed;
                CommonScriptableObjects.playerUnityEulerAngles.Set(transform.eulerAngles);
            }

            bool jumpButtonPressedWithGraceTime = jumpButtonPressed && (Time.time - lastJumpButtonPressedTime < 0.15f);

            if (jumpButtonPressedWithGraceTime) // almost-grounded jump button press allowed time
            {
                bool justLeftGround = (Time.time - lastUngroundedTime) < 0.1f;

                if (isGrounded || justLeftGround) // just-left-ground jump allowed time
                {
                    Jump();
                }
            }

            //NOTE(Mordi): Detecting when the character hits the ground (for landing-SFX)
            if (isGrounded && !previouslyGrounded && (Time.time - lastUngroundedTime) > 0.4f)
            {
                OnHitGround?.Invoke();
            }
        }

        bool movingPlatformMovedTooMuch = Vector3.Distance(lastPosition, transform.position) > movingPlatformAllowedPosDelta;

        if (isOnMovingPlatform && !characterPosition.RepositionedWorldLastFrame() && movingPlatformMovedTooMuch)
        {
            ResetGround();
            // As the character has already been moved faster-than-we-want, we reposition it
            characterController.transform.position = lastPosition;
        }

        if (characterController.enabled)
        {
            //NOTE(Brian): Transform has to be in sync before the Move call, otherwise this call
            //             will reset the character controller to its previous position.
            Environment.i.platform.physicsSyncController.Sync();
            characterController.Move(velocity * deltaTime);
        }

        SetPosition(PositionUtils.UnityToWorldPosition(transform.position));

        if ((DCLTime.realtimeSinceStartup - lastMovementReportTime) > PlayerSettings.POSITION_REPORTING_DELAY)
        {
            ReportMovement();
        }

        if (isOnMovingPlatform)
        {
            lastLocalGroundPosition = groundTransform.InverseTransformPoint(transform.position);
        }

        OnUpdateFinish?.Invoke(deltaTime);
    }