GetMajorMinorVersion() public static method

public static GetMajorMinorVersion ( ) : uint
return uint
Beispiel #1
0
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorWindow window = EditorWindow.GetWindow(typeof(WwiseUpdateSettings));

        window.position = new Rect(100, 100, 850, 260);

#if !UNITY_5 || UNITY_5_0
        window.title = "Wwise Settings";
#else
        window.titleContent = new GUIContent("Wwise Settings");
#endif
        m_oldCreateWwiseGlobal   = WwiseSetupWizard.Settings.CreateWwiseGlobal;
        m_oldCreateWwiseListener = WwiseSetupWizard.Settings.CreateWwiseListener;

        uint temp  = AkSoundEngine.GetMajorMinorVersion();
        uint temp2 = AkSoundEngine.GetSubminorBuildVersion();
        m_WwiseVersionString = "Wwise v" + (temp >> 16) + "." + (temp & 0xFFFF);
        if ((temp2 >> 16) != 0)
        {
            m_WwiseVersionString += "." + (temp2 >> 16);
        }

        m_WwiseVersionString += " Build " + (temp2 & 0xFFFF) + " Settings.";
    }
    public static void OpenDoc(string platform)
    {
        if (m_WwiseVersionString == string.Empty)
        {
            uint temp  = AkSoundEngine.GetMajorMinorVersion();
            uint temp2 = AkSoundEngine.GetSubminorBuildVersion();
            m_WwiseVersionString = (temp >> 16) + "." + (temp & 0xFFFF);
            if ((temp2 >> 16) != 0)
            {
                m_WwiseVersionString += "." + (temp2 >> 16);
            }

            m_WwiseVersionString += "_" + (temp2 & 0xFFFF);
        }

        string docUrl      = "http://www.audiokinetic.com/library/" + m_WwiseVersionString + "/?source=Unity&id=main.html";
        bool   isConnected = false;

        try
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.audiokinetic.com/robots.txt");
            request.Timeout     = 1000;
            request.Credentials = CredentialCache.DefaultNetworkCredentials;
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                isConnected = true;
            }
            else
            {
                isConnected = false;
            }
        }
        catch (Exception)
        {
            isConnected = false;
        }

        if (!isConnected)
        {
            // Can't access audiokinetic.com, open local doc.
            docUrl = GetLocalDocUrl(platform);
            if (string.IsNullOrEmpty(docUrl))
            {
                return;
            }
        }

        Application.OpenURL(docUrl);
    }
    void ValidateVersion()
    {
        try
        {
            string fileName              = Path.Combine(Path.Combine(Path.Combine(Environment.GetEnvironmentVariable("WWISESDK"), "include"), "AK"), "AkWwiseSDKVersion.h");
            string fileContents          = File.ReadAllText(fileName);
            uint   installedVersionMajor = 0;
            uint   installedVersionMinor = 0;

            int startIndex = fileContents.IndexOf("AK_WWISESDK_VERSION_MAJOR");
            int stopIndex  = fileContents.IndexOf((char)0x0A, startIndex); // Line feed; find EOL for executionOrder
            if (startIndex != -1)
            {
                // Find where the digit after "AK_WWISESDK_VERSION_MAJOR" starts
                int digitStartIndex = fileContents.IndexOfAny("-1234567890".ToCharArray(), startIndex);
                int digitStopIndex  = fileContents.LastIndexOfAny("-1234567890".ToCharArray(), stopIndex);

                installedVersionMajor = Convert.ToUInt32(fileContents.Substring(digitStartIndex, digitStopIndex - digitStartIndex + 1));
            }

            startIndex = fileContents.IndexOf("AK_WWISESDK_VERSION_MINOR");
            stopIndex  = fileContents.IndexOf((char)0x0A, startIndex); // Line feed; find EOL for executionOrder
            if (startIndex != -1)
            {
                // Find where the digit after "AK_WWISESDK_VERSION_MINOR" starts
                int digitStartIndex = fileContents.IndexOfAny("-1234567890".ToCharArray(), startIndex);
                int digitStopIndex  = fileContents.LastIndexOfAny("-1234567890".ToCharArray(), stopIndex);

                installedVersionMinor = Convert.ToUInt32(fileContents.Substring(digitStartIndex, digitStopIndex - digitStartIndex + 1));
            }

            uint pluginVersion = AkSoundEngine.GetMajorMinorVersion();

            uint pluginVersionMajor = pluginVersion >> 16;
            uint pluginVersionMinor = pluginVersion & 0x0000FFFF;

            if (pluginVersionMajor != installedVersionMajor || pluginVersionMinor != installedVersionMinor)
            {
                string msg = string.Format("Plugin SDK version does not match the Wwise SDK found on your machine. Installed version: {0}.{1}; Plugin version: {2}.{3}",
                                           installedVersionMajor, installedVersionMinor, pluginVersionMajor, pluginVersionMinor);
                EditorUtility.DisplayDialog("Warning", msg, "ok");
            }
        }
        catch (Exception)
        {
        }
    }
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorWindow window = EditorWindow.GetWindow(typeof(AkWwiseSettingsWindow));

        window.position = new Rect(100, 100, 850, 330);

        window.titleContent = new GUIContent("Wwise Settings");

        m_oldCreateWwiseGlobal           = WwiseSetupWizard.Settings.CreateWwiseGlobal;
        m_oldCreateWwiseListener         = WwiseSetupWizard.Settings.CreateWwiseListener;
        m_oldShowMissingRigidBodyWarning = WwiseSetupWizard.Settings.ShowMissingRigidBodyWarning;

        uint temp  = AkSoundEngine.GetMajorMinorVersion();
        uint temp2 = AkSoundEngine.GetSubminorBuildVersion();

        m_WwiseVersionString = "Wwise v" + (temp >> 16) + "." + (temp & 0xFFFF);
        if ((temp2 >> 16) != 0)
        {
            m_WwiseVersionString += "." + (temp2 >> 16);
        }

        m_WwiseVersionString += " Build " + (temp2 & 0xFFFF) + " Settings.";
    }