Example #1
0
    public static void Show(string tips, Action ok)
    {
        GameObject goTips = GameObject.Find("Canvas/UpdateNoticePanel");

        if (goTips == null)
        {
            goTips = GameObject.Instantiate(Resources.Load <GameObject>("UI/Update/UpdateNoticePanel")) as GameObject;
            Util.BindParent(GameObject.Find("Canvas").transform, goTips.transform);
        }
        UpdateNoticePanel panel = Util.GetOrAddComponent <UpdateNoticePanel>(goTips);

        panel.Init(tips, ok);
    }
Example #2
0
    /// <summary>
    /// 检测apk版本,确认是否需要强制更新
    /// </summary>
    /// <returns> false:需要强更; true:不需要强更 </returns>
    private static bool CheckAPKVersion()
    {
        string url = ServerInfoConfig.GetApkURL();

        if (string.IsNullOrEmpty(url))
        {
            return(true);
        }

        url += "?sign=" + SDK.GetInstance().GetBundleID() + "&game=" + ServerInfoConfig.GetGame();
        string result = HttpUtil.Get(url);

        if (string.IsNullOrEmpty(result))
        {
            return(true);
        }

        ApkVersionInfo versionInfo = JsonFx.Json.JsonReader.Deserialize <ApkVersionInfo>(result);

        if (null == versionInfo)
        {
            return(true);
        }

        int toVersion  = Util.ParseVersion(versionInfo.version);
        int curVersion = Util.ParseVersion(ServerInfoConfig.GetVersion());

        if (curVersion < toVersion)
        {
            UpdateNoticePanel.Show(versionInfo.notice, () =>
            {
                Application.OpenURL(versionInfo.url);
            });
            return(false);
        }

        return(true);
    }