Пример #1
0
    public void CenterMapOnData()
    {
        Vector2 center;
        int     zoom;

        var listOfMarkers = mapPoints.Select(t => (t as MapPointMarker)?.getMarker2D() as OnlineMapsMarkerBase);

        //Debug.LogFormat("OnlineMapsMarkerManager count : {0}",OnlineMapsMarkerManager.instance.items.Count);
        // Get the center point and zoom the best for all markers.
        OnlineMapsUtils.GetCenterPointAndZoom(OnlineMapsMarkerManager.instance.ToArray(), out center, out zoom);

        //Debug.LogFormat("Zoom Level: {0}",zoom);
        //Debug.LogFormat("Center: {0} ; {1}",center.x,center.y);
        // Change the position and zoom of the map.


        map.fixZoomInterval(OnlineMaps.instance, 2, Mathf.Max(zoom, 14));
        map.setViewerZoom(zoom);
        //map.setViewerPosition(center.x, center.y);
    }
Пример #2
0
    // Método que instancia MapMarker, establece los parametros de inicio y
    // añade los puntos a representar desde la lista mapPoints
    private void initMarkers()
    {
        map = new MapMarker();
        map.clusterPrefab = prefabCluster;

        //map.fixPositionInterval(OnlineMaps.instance, 28.24f, -16.79f, 71.19f, 48.48f);
        map.setViewerPosition(10.23985f, 21.83287f);
        OnlineMaps.instance.zoom = 3;
        map.setViewerZoom(3);

        map.setGridingZoomData(3, 12, 8); // CAmbio 2,10,6 por 2,14,4
        map.setGridingQuadsHorizonal(8);  // cambio 16 por 8
        map.fixZoomInterval(OnlineMaps.instance, 3, 12);

        SilkMap.Instance.map = map;
        //ClonedMap.instance.setMap(map);
        if (clonedMapGroup != null)
        {
            SilkMap.instance.clonedGroupMap = clonedMapGroup;
        }

        //map.showClusters();

        map.SetDimension(2);

        UpdatePropertyManager(SilkMap.instance.map);

        OnlineMapsMarkerManager.instance.defaultTexture = getDefaultTexture();

        /*
         * GameObject lightGameObject = new GameObject("The Light");
         * Light lightComp = lightGameObject.AddComponent<Light>();
         * lightComp.type = LightType.Directional;
         * lightComp.color = Color.white;
         * lightGameObject.transform.position = new Vector3(0, 5, 0);
         * lightGameObject.transform.Rotate(new Vector3(45, 0, 0), Space.Self);
         */
        Resources.UnloadUnusedAssets();
    }