Пример #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();
    }
Пример #2
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;
        }
    }
Пример #3
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);
        }

        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();
    }
Пример #4
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();
    }