Exemplo n.º 1
0
 private static void CheckVRCSDK()
 {
     if (!Settings.is_changing_vrc_sdk)
     {
         Helper.SetDefineSymbol(DEFINE_SYMBOLE_VRC_SDK_INSTALLED, VRCInterface.Get().sdk_is_installed);
     }
 }
Exemplo n.º 2
0
 private void GUIVRC()
 {
     if (VRCInterface.Get().sdk_information.type != VRCInterface.VRC_SDK_Type.NONE)
     {
         GUILayout.BeginHorizontal();
         string sdkUptodateString = (VRCInterface.Get().sdk_information.is_sdk_up_to_date ? " (" + Locale.editor.Get("newest") + " " + Locale.editor.Get("version") + ")" : "");
         GUILayout.Label("VRC Sdk " + Locale.editor.Get("version") + ": " + VRCInterface.Get().sdk_information.installed_version + sdkUptodateString);
         RemoveVRCSDKButton();
         GUILayout.EndHorizontal();
         if (!VRCInterface.Get().sdk_information.is_sdk_up_to_date)
         {
             GUILayout.Label(Locale.editor.Get("newest") + " VRC SDK " + Locale.editor.Get("version") + ": " + VRCInterface.Get().sdk_information.available_version);
             UpdateVRCSDKButton();
         }
         if (VRCInterface.Get().sdk_information.is_user_logged_in)
         {
             GUILayout.Label("VRChat " + Locale.editor.Get("user") + ": " + EditorPrefs.GetString("sdk#username"));
         }
     }
     else
     {
         InstallVRCSDKButton();
     }
     drawLine();
 }
Exemplo n.º 3
0
        void InitVRCSDKVersion()
        {
            if (VRCInterface.Get().Sdk_information.type == VRCInterface.VRC_SDK_Type.NONE)
            {
                _constantValue = false;
                return;
            }
            int c_vrc = Helper.CompareVersions(VRCInterface.Get().Sdk_information.installed_version, _value);

            if (_compareType == CompareType.EQUAL)
            {
                _constantValue = c_vrc == 0;
            }
            if (_compareType == CompareType.NOT_EQUAL)
            {
                _constantValue = c_vrc != 0;
            }
            if (_compareType == CompareType.SMALLER)
            {
                _constantValue = c_vrc == 1;
            }
            if (_compareType == CompareType.BIGGER)
            {
                _constantValue = c_vrc == -1;
            }
            if (_compareType == CompareType.BIGGER_EQ)
            {
                _constantValue = c_vrc == -1 || c_vrc == 0;
            }
            if (_compareType == CompareType.SMALLER_EQ)
            {
                _constantValue = c_vrc == 1 || c_vrc == 0;
            }
        }
Exemplo n.º 4
0
 private void UpdateVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button("Update VRC SDK"))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.Get().UpdateVRCSDK();
     }
     EditorGUI.EndDisabledGroup();
 }
Exemplo n.º 5
0
 private void RemoveVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button("Remove VRC SDK", GUILayout.ExpandWidth(false)))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.Get().RemoveVRCSDK(true);
     }
     EditorGUI.EndDisabledGroup();
 }
Exemplo n.º 6
0
        private static void CheckVRCSDK(string[] importedAssets)
        {
            bool vrcImported = false;

            foreach (string s in importedAssets)
            {
                if (s.Contains("VRCSDK2.dll"))
                {
                    vrcImported = true;
                }
            }

            bool currently_deleteing_sdk = (Helper.LoadValueFromFile("delete_vrc_sdk", ".thry_after_compile_data") == "true");

            if (!Settings.is_changing_vrc_sdk && !currently_deleteing_sdk)
            {
                Helper.SetDefineSymbol(DEFINE_SYMBOLE_VRC_SDK_INSTALLED, VRCInterface.Get().sdk_is_installed | vrcImported);
            }
        }
Exemplo n.º 7
0
 private void GUIVRC()
 {
     if (VRCInterface.Get().sdk_is_installed)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label("VRC Sdk " + Locale.editor.Get("version") + ": " + VRCInterface.Get().installed_sdk_version + (VRCInterface.Get().sdk_is_up_to_date ? " (" + Locale.editor.Get("newest") + " " + Locale.editor.Get("version") + ")(not reliably reported in 2018)" : ""));
         RemoveVRCSDKButton();
         GUILayout.EndHorizontal();
         if (!VRCInterface.Get().sdk_is_up_to_date)
         {
             GUILayout.Label(Locale.editor.Get("newest") + " VRC SDK " + Locale.editor.Get("version") + ": " + VRCInterface.Get().newest_sdk_version);
             UpdateVRCSDKButton();
         }
         if (VRCInterface.Get().user_logged_in)
         {
             GUILayout.Label("VRChat " + Locale.editor.Get("user") + ": " + EditorPrefs.GetString("sdk#username"));
         }
     }
     else
     {
         InstallVRCSDKButton();
     }
     drawLine();
 }
Exemplo n.º 8
0
 private void GUIVRC()
 {
     if (VRCInterface.Get().sdk_is_installed)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label("VRC Sdk version: " + VRCInterface.Get().installed_sdk_version + (VRCInterface.Get().sdk_is_up_to_date ? " (newest version)" : ""));
         RemoveVRCSDKButton();
         GUILayout.EndHorizontal();
         if (!VRCInterface.Get().sdk_is_up_to_date)
         {
             GUILayout.Label("Newest VRC SDK version: " + VRCInterface.Get().newest_sdk_version);
             UpdateVRCSDKButton();
         }
         if (VRCInterface.Get().user_logged_in)
         {
             GUILayout.Label("VRChat user: "******"sdk#username"));
         }
     }
     else
     {
         InstallVRCSDKButton();
     }
     drawLine();
 }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
 public static void UpdateVRCSDK()
 {
     FileHelper.SaveValueToFile("update_vrc_sdk", "true", PATH.AFTER_COMPILE_DATA);
     FileHelper.SaveValueToFile("update_vrc_sdk_type", "" + (int)VRCInterface.Get().GetInstalledSDKType(), PATH.AFTER_COMPILE_DATA);
     RemoveVRCSDK();
 }