Exemplo n.º 1
0
    public void ZoomMap(bool increase)
    {
        _currZoom = (increase) ? _currZoom * 2 : _currZoom / 2;
        if (_currZoom > _maxZoom)
        {
            _currZoom = _maxZoom;
            _zoomInButton.interactable = false;
            return;
        }
        else
        {
            _zoomInButton.interactable = true;
        }
        if (_currZoom < _minZoom)
        {
            _currZoom = _minZoom;
            _zoomOutButton.interactable = false;
            return;
        }
        else
        {
            _zoomOutButton.interactable = true;
        }

        float   newsize = 4096 * _currZoom;
        Vector2 size    = new Vector2(newsize, newsize);

        //_scrollViewContent.GetComponent<RectTransform>().sizeDelta = size;

        _worldMapController.SetZoom(_currZoom);
        _worldMapController.SetNewSize(size);

        _worldMapController.ScrollToPosition(MainGameController.instance.player.getCurrentLocationLatLon());
        _worldMapController.CreateLocationPointers(false);
        AddMapLocationPointers();
    }
    public void OnDropDownChanged()
    {
        if (_locationDropdown.value >= _locations.Count)
        {
            _locationDropdown.value = _locations.Count - 1;
        }
        ScrollRect contentPanel = _locationDropdown.GetComponentInChildren <ScrollRect>();

        float val = 1 - (1 / ((float)(_locationDropdown.options.Count - 3) / (float)(_locationDropdown.value)));

        if (contentPanel != null)
        {
            contentPanel.normalizedPosition = new Vector2(0, val);
        }
        Location l = _locations[_locationDropdown.value];

        _worldMapController.ScrollToPosition(new Vector2(l.lat, l.lon));
    }