private static IEnumerator TeleportAndEditRoutine(Vector2Int targetCoords)
    {
        inProgress = true;
        OnTeleportStart?.Invoke(targetCoords);

        bool isPlayerTeleported = false;

        void OnPlayerTeleportToNewPosition(Vector3 current, Vector3 prev)
        {
            isPlayerTeleported = true;
        }

        DataStore.i.player.lastTeleportPosition.OnChange += OnPlayerTeleportToNewPosition;

        WebInterface.GoTo(targetCoords.x, targetCoords.y);

        yield return(new WaitUntil(() => isPlayerTeleported));

        DataStore.i.player.lastTeleportPosition.OnChange -= OnPlayerTeleportToNewPosition;

        yield return(new WaitUntil(() => CommonScriptableObjects.rendererState.Get()));

        yield return(null);

        inProgress = false;
        OnTeleportEnd?.Invoke(targetCoords);
    }
示例#2
0
        private void OnGotoClick()
        {
            OnGotoClicked?.Invoke();

            WebInterface.GoTo(location.x, location.y);

            OnCloseClick();
        }
        private void OnGoToGenesisButtonClick()
        {
            CommonScriptableObjects.rendererState.OnChange += RendererState_OnChange;

            SetVisibility(false);
            WebInterface.GoTo(0, 0);
            OnBeforeGoToGenesisPlaza?.Invoke();
        }
示例#4
0
    void OnJumpIn(Vector2Int coords, string serverName, string layerName)
    {
        if (view.IsVisible())
        {
            toggleExploreTrigger.RaiseOnTriggered();
        }

        if (string.IsNullOrEmpty(serverName) || string.IsNullOrEmpty(layerName))
        {
            WebInterface.GoTo(coords.x, coords.y);
        }
        else
        {
            WebInterface.JumpIn(coords.x, coords.y, serverName, layerName);
        }
    }
    private void OnTeleportPressed()
    {
        switch (teleportData.destination)
        {
        case TELEPORT_COMMAND_CROWD:
            WebInterface.GoToCrowd();
            break;

        case TELEPORT_COMMAND_MAGIC:
            WebInterface.GoToMagic();
            break;

        default:
            int      x, y;
            string[] coordSplit = teleportData.destination.Split(',');
            if (coordSplit.Length == 2 && int.TryParse(coordSplit[0], out x) && int.TryParse(coordSplit[1], out y))
            {
                WebInterface.GoTo(x, y);
            }
            break;
        }
    }
示例#6
0
 private void GoToCoords(Vector2Int coords)
 {
     WebInterface.GoTo(coords.x, coords.y);
     SetVisibility(false);
     OnJumpInOrEdit?.Invoke();
 }