Beispiel #1
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);
         }
     }
 }
Beispiel #2
0
 private static string GetRSPFilename()
 {
     if (Helper.compareVersions("2018", Application.unityVersion) == 1)
     {
         return("csc");
     }
     return("mcs");
 }
Beispiel #3
0
 private void OnUpgrade(string oldVersion)
 {
     if (Helper.compareVersions(oldVersion, "1.4.0") < 1)
     {
         //renderQueueShaders = false;
         save();
     }
 }
Beispiel #4
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);
         }
     }
 }
Beispiel #5
0
        private static void CheckMCS()
        {
            string filename = "mcs";

            if (Helper.compareVersions("2018", Application.unityVersion) == 1)
            {
                filename = "csc";
            }
            int mcs_good = CheckRSPAvailability(filename);

            if (mcs_good == 0)
            {
                MoveRSP(filename);
            }
            else if (mcs_good == -1)
            {
                GenerateRSP(filename);
            }
            Helper.SetDefineSymbol(DEFINE_SYMBOLE_MCS_EXISTS, mcs_good == 1, true);
        }
Beispiel #6
0
        private static void CheckDrawingDll()
        {
            string rsp_path = null;
            //change to decision based on .net version
            string filename = "mcs";

            if (Helper.compareVersions("2018", Application.unityVersion) == 1)
            {
                filename = "csc";
            }

            bool rsp_good = false;

            if (DoesRSPExisit(filename, ref rsp_path))
            {
                if (ISRSPAtCorrectPath(filename, rsp_path))
                {
                    if (DoesRSPContainDrawingDLL(rsp_path))
                    {
                        rsp_good = true;
                    }
                    else
                    {
                        AddDrawingDLLToRSP(rsp_path);
                    }
                }
                else
                {
                    AssetDatabase.MoveAsset(rsp_path, PATH.RSP_NEEDED_PATH + filename + ".rsp");
                }
            }
            else
            {
                AddDrawingDLLToRSP(PATH.RSP_NEEDED_PATH + filename + ".rsp");
            }

            Helper.SetDefineSymbol(DEFINE_SYMBOLS.IMAGING_EXISTS, rsp_good, true);
        }
        public void GUIVRCToolsDownloadOptions(bool tools_installed)
        {
            GUILayout.Label("Thry's VRC Tools Installer", EditorStyles.boldLabel);


            bool needsUpdate = false;

            if (thry_vrc_tools_version_loaded && has_vrc_tools)
            {
                needsUpdate = Helper.compareVersions(thry_vrc_tools_version, thry_vrc_tools_installed_version) == -1;
            }

            if (tools_installed && !needsUpdate)
            {
                GUILayout.Label("Up to date");
            }
            EditorGUI.BeginDisabledGroup(is_installing_vrc_tools || (tools_installed && !needsUpdate));
            GUILayout.BeginHorizontal();
            string text = "Install now";

            if (tools_installed)
            {
                text = "Update";
            }
            if (GUILayout.Button(text, GUILayout.ExpandWidth(false)))
            {
                is_installing_vrc_tools = true;
                Helper.getStringFromUrl(THRY_VRC_TOOLS_REPO_URL + THRY_VRC_TOOLS_FILE_LIST_URL, thry_vrc_tools_file_list_callback);
            }
            GUILayout.Label("(v" + thry_vrc_tools_version + ", vrc_sdk_versions: " + thry_vrc_tools_vrc_sdk_versions_string + ")", GUILayout.ExpandWidth(false));
            GUILayout.EndHorizontal();
            GUILayout.Label("Includes: ");
            GUILayout.Label(" - VRC Content Manager with search function, sorting function and tags for avatars");
            GUILayout.Label(" - VRC Auto Avatar descriptor: automatically fill out your avatar descriptor");
            EditorGUI.EndDisabledGroup();
        }
 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);
         }
     }
 }
Beispiel #9
0
 public static bool operator <=(Version x, string y)
 {
     return(Helper.compareVersions(x.value, y) > -1);
 }
Beispiel #10
0
 public static bool operator >=(Version x, Version y)
 {
     return(Helper.compareVersions(x.value, y.value) < 1);
 }
        public bool Test()
        {
            string comparator = GetComparetor();

            string[] parts = Regex.Split(data, comparator);
            string   obj   = parts[0];
            string   value = parts[parts.Length - 1];

            switch (type)
            {
            case DefineableConditionType.PROPERTY_BOOL:
                ThryEditor.ShaderProperty prop = ThryEditor.currentlyDrawing.propertyDictionary[obj];
                if (prop == null)
                {
                    return(false);
                }
                if (comparator == "##")
                {
                    return(prop.materialProperty.floatValue == 1);
                }
                if (comparator == "==")
                {
                    return("" + prop.materialProperty.floatValue == parts[1]);
                }
                if (comparator == "!=")
                {
                    return("" + prop.materialProperty.floatValue != parts[1]);
                }
                break;

            case DefineableConditionType.EDITOR_VERSION:
                int c_ev = Helper.compareVersions(Config.Get().verion, value);
                if (comparator == "==")
                {
                    return(c_ev == 0);
                }
                if (comparator == "!=")
                {
                    return(c_ev != 0);
                }
                if (comparator == "<")
                {
                    return(c_ev == 1);
                }
                if (comparator == ">")
                {
                    return(c_ev == -1);
                }
                break;

            case DefineableConditionType.VRC_SDK_VERSION:
                int c_vrc = Helper.compareVersions(VRCInterface.Get().installed_sdk_version, value);
                if (comparator == "==")
                {
                    return(c_vrc == 0);
                }
                if (comparator == "!=")
                {
                    return(c_vrc != 0);
                }
                if (comparator == "<")
                {
                    return(c_vrc == 1);
                }
                if (comparator == ">")
                {
                    return(c_vrc == -1);
                }
                break;

            case DefineableConditionType.AND:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() && condition2.Test());
                }
                break;

            case DefineableConditionType.OR:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() || condition2.Test());
                }
                break;
            }

            return(true);
        }
Beispiel #12
0
 private static void LoadModule(ModuleCollectionInfo info, List <Module> modules)
 {
     WebHelper.DownloadStringASync(info.url, delegate(string data)
     {
         Module new_module           = new Module();
         new_module.url              = info.url;
         new_module.author           = info.author;
         new_module.id               = info.id;
         new_module.available_module = Parser.ParseToObject <ModuleInfo>(data);
         bool module_installed       = LoadModuleLocationData(new_module);
         if (module_installed)
         {
             InitInstalledModule(new_module);
         }
         else if (Helper.ClassExists(new_module.available_module.classname))
         {
             CheckForUnregisteredInstall(new_module);
         }
         if (new_module.available_module.requirement != null)
         {
             new_module.available_requirement_fullfilled = new_module.available_module.requirement.Test();
         }
         if (new_module.available_requirement_fullfilled && new_module.installed_module != null && Helper.compareVersions(new_module.installed_module.version, new_module.available_module.version) == 1)
         {
             new_module.update_available = true;
         }
         modules.Add(new_module);
         UnityHelper.RepaintEditorWindow(typeof(Settings));
     });
 }
Beispiel #13
0
 private bool SDKIsUpToDate()
 {
     return(Helper.compareVersions(installed_sdk_version, newest_sdk_version) != 1);
 }
Beispiel #14
0
        private void GUIModulesInstalation()
        {
            if (ModuleHandler.GetModules() == null)
            {
                return;
            }
            if (ModuleHandler.GetModules().Count > 0)
            {
                GUILayout.Label("Extra Modules", EditorStyles.boldLabel);
            }
            bool disabled = false;

            foreach (ModuleHeader module in ModuleHandler.GetModules())
            {
                if (module.is_being_installed_or_removed)
                {
                    disabled = true;
                }
            }
            EditorGUI.BeginDisabledGroup(disabled);
            foreach (ModuleHeader module in ModuleHandler.GetModules())
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(!module.available_requirement_fullfilled);
                EditorGUI.BeginChangeCheck();
                bool is_installed     = Helper.ClassExists(module.available_module.classname);
                bool update_available = is_installed;
                if (module.installed_module != null)
                {
                    update_available = Helper.compareVersions(module.installed_module.version, module.available_module.version) == 1;
                }
                string displayName = module.available_module.name;
                if (module.installed_module != null)
                {
                    displayName += " v" + module.installed_module.version;
                }

                bool install = GUILayout.Toggle(is_installed, new GUIContent(displayName, module.available_module.description), GUILayout.ExpandWidth(false));
                if (EditorGUI.EndChangeCheck())
                {
                    ModuleHandler.InstallRemoveModule(module, install);
                }
                if (update_available)
                {
                    if (GUILayout.Button("update to v" + module.available_module.version, GUILayout.ExpandWidth(false)))
                    {
                        ModuleHandler.UpdateModule(module);
                    }
                }
                EditorGUI.EndDisabledGroup();
                if (module.available_module.requirement != null && (update_available || !is_installed))
                {
                    GUIStyle requirementStyle = new GUIStyle(EditorStyles.label);
                    requirementStyle.normal.textColor = greenStyle.normal.textColor;
                    if (!module.available_requirement_fullfilled)
                    {
                        requirementStyle.normal.textColor = redInfostyle.normal.textColor;
                    }
                    GUILayout.Label("Requirements: " + module.available_module.requirement.ToString(), requirementStyle);
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUI.EndDisabledGroup();
        }
Beispiel #15
0
        public bool Test()
        {
            switch (type)
            {
            case DefineableConditionType.NONE:
                return(true);

            case DefineableConditionType.TRUE:
                return(true);

            case DefineableConditionType.FALSE:
                return(false);
            }
            string comparator = GetComparetor();

            string[] parts = Regex.Split(data, comparator);
            string   obj   = parts[0];
            string   value = parts[parts.Length - 1];

            switch (type)
            {
            case DefineableConditionType.PROPERTY_BOOL:
                ShaderProperty prop = ShaderEditor.active.propertyDictionary[obj];
                if (prop == null)
                {
                    return(false);
                }
                if (comparator == "##")
                {
                    return(prop.materialProperty.floatValue == 1);
                }
                float f = Parser.ParseFloat(parts[1]);
                if (comparator == "==")
                {
                    return(prop.materialProperty.floatValue == f);
                }
                if (comparator == "!=")
                {
                    return(prop.materialProperty.floatValue != f);
                }
                if (comparator == "<")
                {
                    return(prop.materialProperty.floatValue < f);
                }
                if (comparator == ">")
                {
                    return(prop.materialProperty.floatValue > f);
                }
                if (comparator == ">=")
                {
                    return(prop.materialProperty.floatValue >= f);
                }
                if (comparator == "<=")
                {
                    return(prop.materialProperty.floatValue <= f);
                }
                break;

            case DefineableConditionType.EDITOR_VERSION:
                int c_ev = Helper.compareVersions(Config.Singleton.verion, value);
                if (comparator == "==")
                {
                    return(c_ev == 0);
                }
                if (comparator == "!=")
                {
                    return(c_ev != 0);
                }
                if (comparator == "<")
                {
                    return(c_ev == 1);
                }
                if (comparator == ">")
                {
                    return(c_ev == -1);
                }
                if (comparator == ">=")
                {
                    return(c_ev == -1 || c_ev == 0);
                }
                if (comparator == "<=")
                {
                    return(c_ev == 1 || c_ev == 0);
                }
                break;

            case DefineableConditionType.VRC_SDK_VERSION:
                if (VRCInterface.Get().sdk_information.type == VRCInterface.VRC_SDK_Type.NONE)
                {
                    return(false);
                }
                int c_vrc = Helper.compareVersions(VRCInterface.Get().sdk_information.installed_version, value);
                if (comparator == "==")
                {
                    return(c_vrc == 0);
                }
                if (comparator == "!=")
                {
                    return(c_vrc != 0);
                }
                if (comparator == "<")
                {
                    return(c_vrc == 1);
                }
                if (comparator == ">")
                {
                    return(c_vrc == -1);
                }
                if (comparator == ">=")
                {
                    return(c_vrc == -1 || c_vrc == 0);
                }
                if (comparator == "<=")
                {
                    return(c_vrc == 1 || c_vrc == 0);
                }
                break;

            case DefineableConditionType.TEXTURE_SET:
                ShaderProperty shaderProperty = ShaderEditor.active.propertyDictionary[data];
                if (shaderProperty == null)
                {
                    return(false);
                }
                return(shaderProperty.materialProperty.textureValue != null);

            case DefineableConditionType.DROPDOWN:
                ShaderProperty dropdownProperty = ShaderEditor.active.propertyDictionary[obj];
                if (dropdownProperty == null)
                {
                    return(false);
                }
                if (comparator == "##")
                {
                    return(dropdownProperty.materialProperty.floatValue == 1);
                }
                if (comparator == "==")
                {
                    return("" + dropdownProperty.materialProperty.floatValue == parts[1]);
                }
                if (comparator == "!=")
                {
                    return("" + dropdownProperty.materialProperty.floatValue != parts[1]);
                }
                break;

            case DefineableConditionType.AND:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() && condition2.Test());
                }
                break;

            case DefineableConditionType.OR:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() || condition2.Test());
                }
                break;
            }

            return(true);
        }
 private bool SDKIsUpToDate()
 {
     return(Helper.compareVersions(sdk_information.installed_version, sdk_information.available_version) != 1);
 }