예제 #1
0
    private void OnEnable()
    {
#if UNITY_EDITOR
        EditorApplication.update += CheckScriptCompiling;
#endif

        _instance = this;

        tooltipDrawer = new OnlineMapsGUITooltipDrawer(this);

        activeType = OnlineMapsProvider.FindMapType(mapType);
        _mapType   = mapType = activeType.fullID;

        trafficProvider = OnlineMapsTrafficProvider.GetByID(trafficProviderID);

        if (language == "")
        {
            language = activeType.provider.twoLetterLanguage ? "en" : "eng";
        }

        _language          = language;
        _labels            = labels;
        _traffic           = traffic;
        _trafficProviderID = trafficProviderID;
        izoom = (int)_zoom;

        UpdateCorners();
    }
예제 #2
0
    private void CheckBaseProps()
    {
        if (mapType != _mapType)
        {
            activeType = OnlineMapsProvider.FindMapType(mapType);
            _mapType   = mapType = activeType.fullID;
            if (_buffer != null)
            {
                _buffer.UnloadOldTypes();
            }
            Redraw();
        }

        if (_language != language || _labels != labels)
        {
            _labels   = labels;
            _language = language;

            if (_buffer != null)
            {
                _buffer.Dispose();
                _buffer = null;
#if NETFX_CORE
                if (renderThread != null)
                {
                    renderThread.Dispose();
                }
#endif
#if !UNITY_WEBGL
                renderThread = null;
#endif
            }

            Redraw();
        }
        if (traffic != _traffic || trafficProviderID != _trafficProviderID)
        {
            _traffic = traffic;

            _trafficProviderID = trafficProviderID;
            trafficProvider    = OnlineMapsTrafficProvider.GetByID(trafficProviderID);

            OnlineMapsTile[] tiles;
            lock (OnlineMapsTile.lockTiles)
            {
                tiles = OnlineMapsTile.tiles.ToArray();
            }
            if (traffic)
            {
                foreach (OnlineMapsTile tile in tiles)
                {
                    OnlineMapsRasterTile rTile = tile as OnlineMapsRasterTile;
                    rTile.trafficProvider        = trafficProvider;
                    rTile.trafficWWW             = new OnlineMapsWWW(rTile.trafficURL);
                    rTile.trafficWWW["tile"]     = tile;
                    rTile.trafficWWW.OnComplete += OnlineMapsTileManager.OnTrafficWWWComplete;
                    if (rTile.trafficTexture != null)
                    {
                        OnlineMapsUtils.Destroy(rTile.trafficTexture);
                        rTile.trafficTexture = null;
                    }
                }
            }
            else
            {
                foreach (OnlineMapsTile tile in tiles)
                {
                    OnlineMapsRasterTile rTile = tile as OnlineMapsRasterTile;
                    if (rTile.trafficTexture != null)
                    {
                        OnlineMapsUtils.Destroy(rTile.trafficTexture);
                        rTile.trafficTexture = null;
                    }
                    rTile.trafficWWW = null;
                }
            }
            Redraw();
        }
    }