Exemple #1
0
        private static void Text(string configField, string text, string tooltip, bool createHorizontal)
        {
            Config config = Config.Singleton;

            System.Reflection.FieldInfo field = typeof(Config).GetField(configField);
            if (field != null)
            {
                string value = (string)field.GetValue(config);
                if (createHorizontal)
                {
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
                }
                GUILayout.Space(57);
                GUILayout.Label(new GUIContent(text, tooltip), GUILayout.ExpandWidth(false));
                EditorGUI.BeginChangeCheck();
                value = EditorGUILayout.DelayedTextField("", value, GUILayout.ExpandWidth(false));
                if (EditorGUI.EndChangeCheck())
                {
                    field.SetValue(config, value);
                    config.save();
                }
                if (createHorizontal)
                {
                    GUILayout.EndHorizontal();
                }
            }
        }
Exemple #2
0
 public static void OnCompile()
 {
     if (!File.Exists(PATH_CONFIG_FILE))
     {
         //Settings.firstTimePopup();
     }
     else
     {
         string prevVersion        = Singleton.verion;
         string installedVersion   = VERSION;
         int    versionComparision = Helper.compareVersions(installedVersion, prevVersion);
         if (versionComparision != 0)
         {
             config.verion = VERSION;
             config.save();
         }
         if (versionComparision == 1)
         {
             Settings.updatedPopup(versionComparision);
         }
         else if (versionComparision == -1)
         {
             config.OnUpgrade(prevVersion);
             Debug.Log(">>> Thry Editor has been updated to version " + installedVersion);
         }
     }
 }
Exemple #3
0
        private static void Toggle(string configField, string label, string hover, GUIStyle label_style = null)
        {
            Config config = Config.Singleton;

            System.Reflection.FieldInfo field = typeof(Config).GetField(configField);
            if (field != null)
            {
                bool value = (bool)field.GetValue(config);
                if (Toggle(value, label, hover, label_style) != value)
                {
                    field.SetValue(config, !value);
                    config.save();
                    ShaderEditor.Repaint();
                }
            }
        }
Exemple #4
0
        private static void Toggle(string configField, string label, string hover)
        {
            Config config = Config.Get();

            System.Reflection.FieldInfo field = typeof(Config).GetField(configField);
            if (field != null)
            {
                bool value = (bool)field.GetValue(config);
                if (Toggle(value, label, hover) != value)
                {
                    field.SetValue(config, !value);
                    config.save();
                    ThryEditor.repaint();
                }
            }
        }
Exemple #5
0
 public static void OnCompile()
 {
     if (!File.Exists(PATH_CONFIG_FILE))
     {
         Settings.firstTimePopup();
     }
     else
     {
         int versionComparision = Helper.compareVersions(VERSION, Get().verion);
         if (versionComparision != 0)
         {
             config.verion = VERSION;
             config.save();
             Settings.updatedPopup(versionComparision);
         }
     }
 }
Exemple #6
0
        //load the config from file
        private static Config LoadConfig()
        {
            Config config = null;

            if (File.Exists(CONFIG_FILE_PATH))
            {
                StreamReader reader = new StreamReader(CONFIG_FILE_PATH);
                config = JsonUtility.FromJson <Config>(reader.ReadToEnd());
                reader.Close();
            }
            else
            {
                File.CreateText(CONFIG_FILE_PATH).Close();
                config = new Config();
                config.save();
            }
            return(config);
        }
Exemple #7
0
        private static void Dropdown(string configField, string label, string hover, GUIStyle label_style = null)
        {
            Config config = Config.Singleton;

            System.Reflection.FieldInfo field = typeof(Config).GetField(configField);
            if (field != null)
            {
                Enum value = (Enum)field.GetValue(config);
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(57);
                GUILayout.Label(new GUIContent(label, hover), GUILayout.ExpandWidth(false));
                value = EditorGUILayout.EnumPopup(value, GUILayout.ExpandWidth(false));
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    field.SetValue(config, value);
                    config.save();
                    ShaderEditor.Repaint();
                }
            }
        }
        public static void GUIVRCToolsOptions()
        {
            Config config = Config.Get();

            GUILayout.Label("VRChat features", EditorStyles.boldLabel);

            Toggle("vrchatAutoFillAvatarDescriptor", SETTINGS_CONTENT[(int)SETTINGS_IDX.vrc_aad]);

            string[] options = new string[] { "Male", "Female", "None" };
            GUILayout.BeginHorizontal();
            int newVRCFallbackAnimationSet = EditorGUILayout.Popup(config.vrchatDefaultAnimationSetFallback, options, GUILayout.MaxWidth(45));

            if (newVRCFallbackAnimationSet != config.vrchatDefaultAnimationSetFallback)
            {
                config.vrchatDefaultAnimationSetFallback = newVRCFallbackAnimationSet;
                config.save();
            }
            GUILayout.Label(new GUIContent(SETTINGS_CONTENT[(int)SETTINGS_IDX.vrc_fallback_anim][0], SETTINGS_CONTENT[(int)SETTINGS_IDX.vrc_fallback_anim][1]));
            GUILayout.EndHorizontal();

            Toggle("vrchatForceFallbackAnimationSet", SETTINGS_CONTENT[(int)SETTINGS_IDX.vrc_force_fallback_anim]);
        }
 public static void OnCompile()
 {
     if (!File.Exists(PATH_CONFIG_FILE))
     {
         Settings.firstTimePopup();
     }
     else
     {
         int versionComparision = Helper.compareVersions(VERSION, Get().verion);
         if (versionComparision != 0)
         {
             config.verion = VERSION;
             config.save();
         }
         if (versionComparision == 1)
         {
             Settings.updatedPopup(versionComparision);
         }
         else if (versionComparision == -1)
         {
             Debug.Log(">>> Thry Editor has been updated to version " + VERSION);
         }
     }
 }