コード例 #1
0
    // 获取服务器列表地址
    public static string GetServerListUrl()
    {
#if  UNITY_WP8 && !UNITY_EDITOR
        string strServerListPath = WPSDKHelperScript.Instance().WPGetServerlistUrl();
#elif UNITY_ANDROID && !UNITY_EDITOR
        string strServerListPath = AndroidHelper.platformHelper("getServerlistUrl");
#elif UNITY_IPHONE && !UNITY_EDITOR
        string strServerListPath = IOSHelper.Common_GetServerListUrl();
#else
        string strServerListPath = "0";
#endif
        if (string.Equals(strServerListPath, "0") || string.IsNullOrEmpty(strServerListPath))
        {
            //如果从平台URL获取错误,使用包体内的IPList
#if UNITY_ANDROID && !UNITY_EDITOR
            strServerListPath = Application.streamingAssetsPath + "/IPList.txt";
#else // IOS PC Editor
            strServerListPath = "file://" + Application.streamingAssetsPath + "/IPList.txt";
#endif
        }
        else
        {
            strServerListPath = DownloadHelper.AddTimestampToUrl(strServerListPath);
        }
        return(strServerListPath);
    }