Esempio n. 1
0
    private void OnGUI()
    {
        if (m_window == null)
        {
            m_window = GetWindow();
            return;
        }
        else
        {
            m_winWidth  = m_window.position.width;
            m_winHeight = m_window.position.height;
            RenderOptions();
        }

        if (!EditorFileManager.DataFileExist(m_colorSchemeFileName))
        {
            LoadDefaultColorSchemes();
            SaveColorSchemes();
        }
        else if (EditorFileManager.DataFileExist(m_colorSchemeFileName) && !m_colorSchemesLoaded)
        {
            LoadColorSchemes();
        }

        if (!EditorFileManager.DataFileExist(m_activeColorSchemeFileName))
        {
            m_selectedColorSchemeType = m_defaultColorSchemeType;
            SaveActiveColorScheme();
        }
        else if (EditorFileManager.DataFileExist(m_activeColorSchemeFileName) && !m_colorSchemeConfigurationLoaded)
        {
            LoadActiveColorScheme();
        }
    }
Esempio n. 2
0
    private static void LoadActiveColorScheme()
    {
        if (!EditorFileManager.DataFileExist(m_activeColorSchemeFileName))
        {
            return;
        }
        string data = EditorFileManager.ReadDataFile(m_activeColorSchemeFileName);
        Dictionary <string, object> deserializedData = MiniJSON.Json.Deserialize(data) as Dictionary <string, object>;
        Dictionary <string, object> colorSchemeData  = deserializedData["ActiveColorScheme"] as Dictionary <string, object>;

        m_activeColorScheme       = new EditorColorScheme(colorSchemeData);
        m_selectedColorSchemeType = m_activeColorScheme.Type;
        Debug.Log("Loaded Color Scheme Configuration: " + m_activeColorScheme);
        m_colorSchemeConfigurationLoaded = true;
    }
Esempio n. 3
0
    private static EditorColorScheme GetColorScheme(EEditorColorSchemes colorSchemeIdentifier)
    {
        switch (colorSchemeIdentifier)
        {
        case EEditorColorSchemes.Ocean:
            return(m_colorSchemeOcean);

        case EEditorColorSchemes.Dark:
            return(m_colorSchemeDark);

        case EEditorColorSchemes.Light:
            return(m_colorSchemeLight);
        }
        return(null);
    }
Esempio n. 4
0
    private void RenderOptions()
    {
        GUILayout.BeginArea(new Rect(10, 10, m_winWidth - 20, m_winHeight - 35));
        GUILayout.Label("Editor Configuration");
        GUILayout.Space(15);
        EEditorColorSchemes selectedColorScheme = (EEditorColorSchemes)EditorGUILayout.EnumPopup("Use Color Scheme", m_selectedColorSchemeType);

        if (selectedColorScheme != m_selectedColorSchemeType)
        {
            m_selectedColorSchemeType       = selectedColorScheme;
            m_colorSchemeConfigurationSaved = false;
        }
        GUILayout.EndArea();

        GUILayout.BeginArea(new Rect(10, m_winHeight - 35, m_winWidth - 20, 35));

        GUILayout.BeginHorizontal();

        if (m_colorSchemeConfigurationSaved)
        {
            GUILayout.Label("Style " + m_selectedColorSchemeType + " saved!");
        }
        else
        {
            GUILayout.Space(m_winWidth - 100);

            if (GUILayout.Button("Save"))
            {
                SaveActiveColorScheme();
                m_colorSchemeConfigurationSaved = true;
            }
        }

        GUILayout.Space(10);

        GUILayout.EndHorizontal();

        GUILayout.EndArea();
    }