Beispiel #1
0
    private void OnEnable()
    {
        api = (OnlineMaps)target;

        double lng, lat;

        api.GetPosition(out lng, out lat);

        if (api._position != Vector2.zero && lng == 0 && lat == 0)
        {
            api.position  = api._position;
            api._position = Vector2.zero;
        }

        if (api.defaultMarkerTexture == null)
        {
            api.defaultMarkerTexture = GetIcon("DefaultMarker.png");
        }
        if (api.skin == null)
        {
            api.skin =
                (GUISkin)
                AssetDatabase.LoadAssetAtPath("Assets/Infinity Code/Online maps/Skin/DefaultSkin.guiskin",
                                              typeof(GUISkin));
        }

        string[] files = Directory.GetFiles("Assets", "update_available.png", SearchOption.AllDirectories);
        if (files.Length > 0)
        {
            Texture updateAvailableIcon = AssetDatabase.LoadAssetAtPath(files[0], typeof(Texture)) as Texture;
            updateAvailableContent = new GUIContent("Update Available", updateAvailableIcon, "Update available");
        }

        OnlineMapsUpdater.CheckNewVersionAvailable();
    }
Beispiel #2
0
    private void OnGUI()
    {
        if (!inited)
        {
            Init();
        }

        GUI.Box(new Rect(0, 0, 500, 58), "v" + OnlineMaps.version, headerStyle);

        GUILayoutUtility.GetRect(position.width, 60);

        scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
        EditorGUILayout.Space();

        if (DrawButton(wizardTexture, "Map Wizard", "Create your own map for a minute."))
        {
            OnlineMapsWizard.OpenWindow();
        }
        if (DrawButton(boltTexture, "Import Bolt Integration Kit", "and interact with the map without C# scripting."))
        {
            OnlineMapsPackageManager.ImportBoltIntegrationKit();
        }
        if (DrawButton(playmakerTexture, "Import Playmaker Integration Kit", "and interact with the map without C# scripting."))
        {
            OnlineMapsPackageManager.ImportPlayMakerIntegrationKit();
        }
        if (DrawButton(docTexture, "Documentation", "Online version of the documentation."))
        {
            Process.Start("http://infinity-code.com/en/docs/online-maps");
        }
        if (DrawButton(apiTexture, "API Reference", "Online Maps API Reference."))
        {
            Process.Start("http://infinity-code.com/en/docs/api/online-maps");
        }
        if (DrawButton(examplesTexture, "Atlas of Examples", "We made a lot of examples. That will help you get started quickly."))
        {
            Process.Start("http://infinity-code.com/atlas/online-maps");
        }
        if (DrawButton(supportTexture, "Support", "If you have any problems feel free to contact us."))
        {
            Process.Start("mailto:[email protected]?subject=Online maps");
        }
        if (DrawButton(forumTexture, "Forum", "Official forum of Online Maps."))
        {
            Process.Start("http://forum.infinity-code.com");
        }
        if (DrawButton(rateTexture, "Rate and Review", "Share your impression about the asset."))
        {
            RateAndReview();
        }
        if (DrawButton(updateTexture, "Check Updates", "Perhaps a new version is already waiting for you. Check it."))
        {
            OnlineMapsUpdater.OpenWindow();
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.LabelField(copyright, copyrightStyle);
    }
Beispiel #3
0
    private void OnEnable()
    {
        try
        {
            CacheSerializedProperties();
            map     = (OnlineMaps)target;
            control = map.GetComponent <OnlineMapsControlBase>();

            savableItems = map.GetComponents <IOnlineMapsSavableComponent>().SelectMany(c => c.GetSavableItems()).OrderByDescending(s => s.priority).ThenBy(s => s.label).ToList();

            providers      = OnlineMapsProvider.GetProviders();
            providersTitle = providers.Select(p => p.title).ToArray();

            trafficProviders     = OnlineMapsTrafficProvider.GetProviders();
            cTrafficProviders    = trafficProviders.Select(p => new GUIContent(p.title)).ToArray();
            trafficProviderIndex = 0;
            for (int i = 0; i < trafficProviders.Length; i++)
            {
                if (trafficProviders[i].id == pTrafficProviderID.stringValue)
                {
                    trafficProviderIndex = i;
                    break;
                }
            }

            if (pTooltipTexture.objectReferenceValue == null)
            {
                pTooltipTexture.objectReferenceValue = OnlineMapsEditorUtils.LoadAsset <Texture2D>("Textures\\Tooltip.psd");
            }

            updateAvailableContent = new GUIContent("Update Available", OnlineMapsEditorUtils.LoadAsset <Texture2D>("Icons\\update_available.png"), "Update Available");
            wizardIconContent      = new GUIContent(OnlineMapsEditorUtils.LoadAsset <Texture2D>("Icons\\WizardIcon.png"), "Wizard");

            OnlineMapsUpdater.CheckNewVersionAvailable();

            mapType       = OnlineMapsProvider.FindMapType(pMapType.stringValue);
            providerIndex = mapType.provider.index;

            serializedObject.ApplyModifiedProperties();

            map.floatZoom = map.CheckMapSize(map.floatZoom);
        }
        catch (Exception e)
        {
            Debug.Log(e.Message + "\n" + e.StackTrace);
            //throw;
        }
    }
    private void OnEnable()
    {
        CacheSerializedProperties();
        api = (OnlineMaps)target;

        providers      = OnlineMapsProvider.GetProviders();
        providersTitle = providers.Select(p => p.title).ToArray();

        if (string.IsNullOrEmpty(pMapType.stringValue))
        {
            pMapType.stringValue = OnlineMapsProvider.Upgrade(pProvider.enumValueIndex, pType.intValue);
        }

        trafficProviders     = OnlineMapsTrafficProvider.GetProviders();
        cTrafficProviders    = trafficProviders.Select(p => new GUIContent(p.title)).ToArray();
        trafficProviderIndex = 0;
        for (int i = 0; i < trafficProviders.Length; i++)
        {
            if (trafficProviders[i].id == pTrafficProviderID.stringValue)
            {
                trafficProviderIndex = i;
                break;
            }
        }

        if (pDefaultMarkerTexture.objectReferenceValue == null)
        {
            pDefaultMarkerTexture.objectReferenceValue = OnlineMapsEditorUtils.LoadAsset <Texture2D>("Textures\\Markers\\DefaultMarker.png");
        }
        if (pTooltipTexture.objectReferenceValue == null)
        {
            pTooltipTexture.objectReferenceValue = OnlineMapsEditorUtils.LoadAsset <Texture2D>("Textures\\Tooltip.psd");
        }

        updateAvailableContent = new GUIContent("Update Available", OnlineMapsEditorUtils.LoadAsset <Texture2D>("Icons\\update_available.png"), "Update Available");
        wizardIconContent      = new GUIContent(OnlineMapsEditorUtils.LoadAsset <Texture2D>("Icons\\WizardIcon.png"), "Wizard");

        OnlineMapsUpdater.CheckNewVersionAvailable();

        mapType       = OnlineMapsProvider.FindMapType(pMapType.stringValue);
        providerIndex = mapType.provider.index;

        serializedObject.ApplyModifiedProperties();
    }
Beispiel #5
0
    private void DrawToolbarGUI()
    {
        GUILayout.BeginHorizontal(EditorStyles.toolbar);

        if (OnlineMapsUpdater.hasNewVersion && updateAvailableContent != null)
        {
            Color defBackgroundColor = GUI.backgroundColor;
            GUI.backgroundColor = new Color(1, 0.5f, 0.5f);
            if (GUILayout.Button(updateAvailableContent, EditorStyles.toolbarButton))
            {
                OnlineMapsUpdater.OpenWindow();
            }
            GUI.backgroundColor = defBackgroundColor;
        }
        else
        {
            GUILayout.Label("");
        }

        if (GUILayout.Button("Help", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
        {
            GenericMenu menu = new GenericMenu();
            menu.AddItem(new GUIContent("Documentation"), false, OnViewDocs);
            menu.AddItem(new GUIContent("API Reference"), false, OnViewAPI);
            menu.AddItem(new GUIContent("Atlas of Examples"), false, OnViewAtlas);
            menu.AddSeparator("");
            menu.AddItem(new GUIContent("Product Page"), false, OnProductPage);
            menu.AddItem(new GUIContent("Forum"), false, OnViewForum);
            menu.AddItem(new GUIContent("Check Updates"), false, OnCheckUpdates);
            menu.AddItem(new GUIContent("Support"), false, OnSendMail);
            menu.AddSeparator("");
            menu.AddItem(new GUIContent("Rate and Review"), false, OnlineMapsWelcome.RateAndReview);
            menu.AddItem(new GUIContent("About"), false, OnAbout);
            menu.ShowAsContext();
        }

        GUILayout.EndHorizontal();
    }
Beispiel #6
0
    private void OnEnable()
    {
        CacheSerializedProperties();
        api = (OnlineMaps)target;

        providers      = OnlineMapsProvider.GetProviders();
        providersTitle = providers.Select(p => p.title).ToArray();

        if (string.IsNullOrEmpty(pMapType.stringValue))
        {
            pMapType.stringValue = OnlineMapsProvider.Upgrade(pProvider.enumValueIndex, pType.intValue);
        }

        if (pDefaultMarkerTexture.objectReferenceValue == null)
        {
            pDefaultMarkerTexture.objectReferenceValue = GetIcon("DefaultMarker.png");
        }
        if (pTooltipTexture.objectReferenceValue == null)
        {
            pTooltipTexture.objectReferenceValue = GetIcon("Tooltip.psd");
        }

        string[] files = Directory.GetFiles("Assets", "update_available.png", SearchOption.AllDirectories);
        if (files.Length > 0)
        {
            Texture updateAvailableIcon = AssetDatabase.LoadAssetAtPath(files[0], typeof(Texture)) as Texture;
            updateAvailableContent = new GUIContent("Update Available", updateAvailableIcon, "Update Available");
        }

        OnlineMapsUpdater.CheckNewVersionAvailable();

        mapType       = OnlineMapsProvider.FindMapType(pMapType.stringValue);
        providerIndex = mapType.provider.index;

        serializedObject.ApplyModifiedProperties();
    }
Beispiel #7
0
 private void OnCheckUpdates()
 {
     OnlineMapsUpdater.OpenWindow();
 }