示例#1
0
    private void DrawSource(ref bool allowCreate)
    {
        source = (OnlineMapsSource)EditorGUILayout.EnumPopup("Source: ", source);

        if (source != OnlineMapsSource.Resources)
        {
            webplayerProxyURL = EditorGUILayout.TextField("Proxy (for Webplayer): ", webplayerProxyURL);

            DrawProvider(ref allowCreate);

            GUIContent[] aviableTypes = activeMapType.provider.types.Select(t => new GUIContent(t.title)).ToArray();
            if (aviableTypes != null)
            {
                int index = activeMapType.index;
                EditorGUI.BeginChangeCheck();
                index = EditorGUILayout.Popup(new GUIContent("Type: ", "Type of map texture"), index, aviableTypes);
                if (EditorGUI.EndChangeCheck())
                {
                    activeMapType = activeMapType.provider.types[index];
                }
            }

            DrawLabels();
        }
    }
    private static IEnumerator StartDownloadTileAsync(OnlineMapsTile tile)
    {
        bool loadOnline = true;

        OnlineMapsSource source = tile.map.source;

        if (source != OnlineMapsSource.Online)
        {
            if (source == OnlineMapsSource.Resources || source == OnlineMapsSource.ResourcesAndOnline)
            {
                yield return(TryLoadFromResources(tile));

                if (tile.status == OnlineMapsTileStatus.error)
                {
                    yield break;
                }
                if (tile.status == OnlineMapsTileStatus.loaded)
                {
                    loadOnline = false;
                }
            }
            else if (source == OnlineMapsSource.StreamingAssets || source == OnlineMapsSource.StreamingAssetsAndOnline)
            {
                TryLoadFromStreamingAssets(tile);
                if (tile.status == OnlineMapsTileStatus.error)
                {
                    yield break;
                }
                if (tile.status == OnlineMapsTileStatus.loaded)
                {
                    loadOnline = false;
                }
            }
        }

        if (loadOnline)
        {
            if (tile.www != null)
            {
                Debug.Log("tile has www " + tile + "   " + tile.status);
                yield break;
            }

            tile.www             = new OnlineMapsWWW(tile.url);
            tile.www["tile"]     = tile;
            tile.www.OnComplete += OnTileWWWComplete;
            tile.status          = OnlineMapsTileStatus.loading;
        }

        OnlineMapsRasterTile rTile = tile as OnlineMapsRasterTile;

        if (tile.map.traffic && !string.IsNullOrEmpty(rTile.trafficURL))
        {
            rTile.trafficWWW             = new OnlineMapsWWW(rTile.trafficURL);
            rTile.trafficWWW["tile"]     = tile;
            rTile.trafficWWW.OnComplete += OnTrafficWWWComplete;
        }
    }
示例#3
0
    private void DrawSource(ref bool allowCreate)
    {
        source = (OnlineMapsSource)EditorGUILayout.EnumPopup("Source: ", source);

        if (source != OnlineMapsSource.Resources)
        {
            webplayerProxyURL = EditorGUILayout.TextField("Proxy (for Webplayer): ", webplayerProxyURL);

            DrawProvider(ref allowCreate);

            if (availableTypes != null)
            {
                GUIContent[] aviableTypes = availableTypes.Select(t => new GUIContent(t)).ToArray();
                if (aviableTypes != null)
                {
                    mapProviderType = EditorGUILayout.Popup(new GUIContent("Type: ", "Type of map texture"),
                                                            mapProviderType, aviableTypes);
                }
            }

            DrawLabels(ref allowCreate);
        }
    }
    private void DrawSource(ref bool allowCreate)
    {
        source = (OnlineMapsSource) EditorGUILayout.EnumPopup("Source: ", source);

        if (source != OnlineMapsSource.Resources)
        {
            webplayerProxyURL = EditorGUILayout.TextField("Proxy (for Webplayer): ", webplayerProxyURL);

            DrawProvider(ref allowCreate);

            if (availableTypes != null)
            {
                GUIContent[] aviableTypes = availableTypes.Select(t => new GUIContent(t)).ToArray();
                if (aviableTypes != null)
                {
                    mapProviderType = EditorGUILayout.Popup(new GUIContent("Type: ", "Type of map texture"),
                        mapProviderType, aviableTypes);
                }
            }

            DrawLabels(ref allowCreate);
        }
    }
示例#5
0
    private void DrawSourceGUI(ref bool dirty)
    {
        EditorGUI.BeginDisabledGroup(isPlay);

        OnlineMapsSource source = (OnlineMapsSource)EditorGUILayout.EnumPopup("Source: ", api.source);

        if (source != api.source)
        {
            api.source = source;
            dirty      = true;
        }

#if UNITY_WEBPLAYER
        if (source != OnlineMapsSource.Resources)
        {
            api.webplayerProxyURL = EditorGUILayout.TextField("Proxy: ", api.webplayerProxyURL);
        }
#endif

        if (source != OnlineMapsSource.Online)
        {
            if (GUILayout.Button("Fix import settings for tiles"))
            {
                FixImportSettings();
            }
            if (GUILayout.Button("Import from GMapCatcher"))
            {
                ImportFromGMapCatcher();
            }
            api.resourcesPath = EditorGUILayout.TextField("Resources Path:", api.resourcesPath);

            EditorGUILayout.BeginVertical(GUI.skin.box);
            showResourcesTokens = Foldout(showResourcesTokens, "Available tokens");
            if (showResourcesTokens)
            {
                GUILayout.Label("{zoom}");
                GUILayout.Label("{x}");
                GUILayout.Label("{y}");
                GUILayout.Label("{quad}");
                GUILayout.Space(10);
            }
            EditorGUILayout.EndVertical();
        }

        EditorGUI.EndDisabledGroup();

        if (source != OnlineMapsSource.Resources)
        {
            DrawProviderGUI(ref dirty);

            string[] availableTypes = api.availableTypes;
            if (availableTypes != null)
            {
                GUIContent[] aviableTypes = availableTypes.Select(t => new GUIContent(t)).ToArray();
                if (aviableTypes != null)
                {
                    int type = api.type;
                    api.type = EditorGUILayout.Popup(new GUIContent("Type: ", "Type of map texture"), api.type, aviableTypes);
                    if (type != api.type)
                    {
                        dirty = true;
                    }
                }
            }

            DrawLabelsGUI(ref dirty);
        }
    }