Пример #1
0
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        OnlineMapsControlBase control = target as OnlineMapsControlBase;

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps map = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(map, OnlineMapsTarget.texture, ref dirty);

        DrawCurvedUIWarning();

        base.OnInspectorGUI();

        if (dirty)
        {
            EditorUtility.SetDirty(map);
            EditorUtility.SetDirty(control);
            if (!Application.isPlaying)
            {
#if UNITY_5_3P
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }
            else
            {
                map.Redraw();
            }
        }
    }
Пример #2
0
    public override void OnInspectorGUI()
    {
        bool dirty = false;
        OnlineMapsControlBase control = target as OnlineMapsControlBase;

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps api = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(api, OnlineMapsTarget.texture, ref dirty);

#if !IGUI
        if (GUILayout.Button("Enable iGUI"))
        {
            OnlineMapsEditor.AddCompilerDirective("IGUI");
        }
#else
        base.OnInspectorGUI();
#endif

        if (dirty)
        {
            EditorUtility.SetDirty(api);
            Repaint();
        }
    }
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        OnlineMapsControlBase control = target as OnlineMapsControlBase;

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps map = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(map, OnlineMapsTarget.texture, ref dirty);

#if !NGUI
        if (GUILayout.Button("Enable NGUI"))
        {
            if (EditorUtility.DisplayDialog("Enable NGUI", "You have NGUI in your project?", "Yes, I have NGUI", "Cancel"))
            {
                OnlineMapsEditor.AddCompilerDirective("NGUI");
            }
        }
#else
        if (noColliderWarning)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.HelpBox("Potential problem detected:\nGameObject has no BoxCollider, so you can not control the map.", MessageType.Warning);
            if (GUILayout.Button("Add BoxCollider"))
            {
                BoxCollider bc        = map.gameObject.AddComponent <BoxCollider>();
                UITexture   uiTexture = map.GetComponent <UITexture>();
                if (uiTexture != null)
                {
                    bc.size = uiTexture.localSize;
                }
            }

            EditorGUILayout.EndVertical();
        }

        base.OnInspectorGUI();
#endif

        if (dirty)
        {
            EditorUtility.SetDirty(map);
            EditorUtility.SetDirty(control);
            if (!Application.isPlaying)
            {
#if UNITY_5_3P
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }
            else
            {
                map.Redraw();
            }
        }
    }
    private void OnEnable()
    {
        OnlineMaps map = OnlineMapsControlBaseEditor.GetOnlineMaps(target as OnlineMapsControlBase);

        if (map.GetComponent <BoxCollider>() == null)
        {
            noColliderWarning = true;
        }
    }
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        OnlineMaps api = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(api, OnlineMapsTarget.texture, ref dirty);

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        DrawPropsGUI(ref dirty);
        DrawMarkersGUI(ref dirty);

        if (dirty)
        {
            EditorUtility.SetDirty(api);
            Repaint();
        }
    }
Пример #6
0
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        OnlineMapsControlBase control = target as OnlineMapsControlBase;

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps map = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(map, OnlineMapsTarget.texture, ref dirty);

#if !DFGUI
        if (GUILayout.Button("Enable DFGUI"))
        {
            if (EditorUtility.DisplayDialog("Enable DFGUI", "You have DFGUI in your project?", "Yes, I have DFGUI", "Cancel"))
            {
                OnlineMapsEditor.AddCompilerDirective("DFGUI");
            }
        }
#else
        base.OnInspectorGUI();
#endif

        if (dirty)
        {
            EditorUtility.SetDirty(map);
            EditorUtility.SetDirty(control);
            if (!Application.isPlaying)
            {
#if UNITY_5_3P
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }
            else
            {
                map.Redraw();
            }
        }
    }
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        serializedObject.Update();

        float oldWidth = EditorGUIUtility.labelWidth;

        EditorGUIUtility.labelWidth = 170;

        OnlineMaps api = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(api, OnlineMapsTarget.texture, ref dirty);

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        DrawPropsGUI(ref dirty);
        DrawMarkersGUI(ref dirty);

        EditorGUIUtility.labelWidth = oldWidth;

        serializedObject.ApplyModifiedProperties();

        if (dirty)
        {
            EditorUtility.SetDirty(api);
            EditorUtility.SetDirty(control);
            if (!Application.isPlaying)
            {
#if UNITY_5_3P
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }
            else
            {
                api.Redraw();
            }
        }
    }
    public override void OnInspectorGUI()
    {
#if !UNITY_2017_2_OR_NEWER || ONLINEMAPS_GUITEXTURE
        bool dirty = false;

        OnlineMapsControlBase control = target as OnlineMapsControlBase;
        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps map = OnlineMapsControlBaseEditor.GetOnlineMaps(control);
        OnlineMapsControlBaseEditor.CheckTarget(map, OnlineMapsTarget.texture, ref dirty);

        base.OnInspectorGUI();

        if (dirty)
        {
            EditorUtility.SetDirty(map);
            EditorUtility.SetDirty(control);
            if (!Application.isPlaying)
            {
#if UNITY_5_3P
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }
            else
            {
                map.Redraw();
            }
        }
#else
        EditorGUILayout.HelpBox("GUITexture is part of the legacy GUI, and will be removed in future versions of Unity Editor.", MessageType.Warning);
        if (GUILayout.Button("Enable GUITexture"))
        {
            OnlineMapsEditor.AddCompilerDirective("ONLINEMAPS_GUITEXTURE");
        }
#endif
    }
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        serializedObject.Update();

        float oldWidth = EditorGUIUtility.labelWidth;

        EditorGUIUtility.labelWidth = 170;

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps map = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(map, OnlineMapsTarget.tileset, ref dirty);

        if (pTilesetShader.objectReferenceValue == null)
        {
            pTilesetShader.objectReferenceValue = defaultTilesetShader;
        }
        if (pMarkerShader.objectReferenceValue == null)
        {
            pMarkerShader.objectReferenceValue = Shader.Find("Transparent/Diffuse");
        }
        if (pDrawingShader.objectReferenceValue == null)
        {
            pDrawingShader.objectReferenceValue = Shader.Find("Infinity Code/Online Maps/Tileset DrawingElement");
        }

        if (!EditorApplication.isPlaying)
        {
            CheckCameraDistance(map);
        }

        DrawPropsGUI(ref dirty);

        EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);

        EditorGUILayout.PropertyField(pColliderType);

        if (!EditorApplication.isPlaying && pUseElevation.boolValue &&
            (pColliderType.enumValueIndex == (int)OnlineMapsTileSetControl.OnlineMapsColliderType.box || pColliderType.enumValueIndex == (int)OnlineMapsTileSetControl.OnlineMapsColliderType.flatBox))
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.HelpBox("Potential problem detected:\nWhen using BoxCollider, can be a problem in interaction with a map with elevation.", MessageType.Warning);
            if (GUILayout.Button("Set Collider Type - Full Mesh"))
            {
                pColliderType.enumValueIndex = (int)OnlineMapsTileSetControl.OnlineMapsColliderType.fullMesh;
            }

            EditorGUILayout.EndVertical();
        }

        EditorGUI.EndDisabledGroup();

        DrawMarkers3DGUI(ref dirty);
        DrawMaterialsAndShaders();
        DrawElevationGUI(ref dirty);
        DrawMoveCameraGUI(map);

        EditorGUIUtility.labelWidth = oldWidth;

        serializedObject.ApplyModifiedProperties();

        if (dirty)
        {
            EditorUtility.SetDirty(map);
            EditorUtility.SetDirty(control);
            if (!Application.isPlaying)
            {
#if UNITY_5_3P
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }
            else
            {
                map.Redraw();
            }
        }
    }
Пример #10
0
    public override void OnInspectorGUI()
    {
        bool dirty = false;

        OnlineMapsControlBaseEditor.CheckMultipleInstances(control, ref dirty);

        OnlineMaps api = OnlineMapsControlBaseEditor.GetOnlineMaps(control);

        OnlineMapsControlBaseEditor.CheckTarget(api, OnlineMapsTarget.tileset, ref dirty);

        if (tilesetControl.tilesetShader == null)
        {
            tilesetControl.tilesetShader = defaultTilesetShader;
        }
        if (tilesetControl.markerShader == null)
        {
            tilesetControl.markerShader = Shader.Find("Transparent/Diffuse");
        }
        if (tilesetControl.drawingShader == null)
        {
            tilesetControl.drawingShader = Shader.Find("Infinity Code/Online Maps/Tileset DrawingElement");
        }

        CheckCameraDistance(api);

        DrawPropsGUI(ref dirty);

        EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);
        EditorGUI.BeginChangeCheck();
        tilesetControl.colliderType = (OnlineMapsTileSetControl.OnlineMapsColliderType)EditorGUILayout.EnumPopup("Collider Type", tilesetControl.colliderType);
        if (EditorGUI.EndChangeCheck())
        {
            dirty = true;
        }

        if (tilesetControl.colliderType == OnlineMapsTileSetControl.OnlineMapsColliderType.box &&
            tilesetControl.useElevation)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.HelpBox("Potential problem detected:\nWhen using BoxCollider, can be a problem in interaction with a map with elevation.", MessageType.Warning);

            if (GUILayout.Button("Set Collider Type - Mesh"))
            {
                tilesetControl.colliderType = OnlineMapsTileSetControl.OnlineMapsColliderType.mesh;
                dirty = true;
            }

            EditorGUILayout.EndVertical();
        }


        EditorGUI.EndDisabledGroup();

        DrawMarkersGUI(ref dirty);
        DrawMaterialsAndShaders(ref dirty);
        DrawElevationGUI(tilesetControl, ref dirty);
        DrawMoveCameraGUI(api);

        if (dirty)
        {
            EditorUtility.SetDirty(api);
            Repaint();
        }
    }