Example #1
0
    public bool CheckGameHotUpdate(int productId)
    {
#if STREAM_ASSET
        if (!TableGameConfig.openHotUpdate || !TableGameConfig.openGameHp)
        {
            return(false);
        }

        LocalResConfigMgr localResConfigMgr = LocalResConfigMgr.Instance;
        localResConfigMgr.LoadGameResConfig(productId);

        BaseRes gameResConfig = localResConfigMgr.FindGameRes(productId);
        string  serverGameVer = TableGameConfig.GetGameVersion(productId);
        if (string.IsNullOrEmpty(serverGameVer) ||
            string.IsNullOrEmpty(gameResConfig.version) ||
            CheckVersion(serverGameVer, gameResConfig.version) <= 0)
        {
            Debugger.Log("Game version code is same! product id==" + productId);
            return(false);
        }

        return(true);
#else
        return(false);
#endif
    }
Example #2
0
    // 检查是否下载服务器资源配置表
    private bool CheckDownLoadResConfig()
    {
        // 检查是否需要热更新
        if (!TableGameConfig.openHotUpdate)
        {
            return(false);
        }

        LocalResConfigMgr localResConfigMgr = LocalResConfigMgr.Instance;

        // 比对大厅资源版本
        LobbyResConfig lobbyResConfig = localResConfigMgr.LocalLobbyResConfig;

        if (TableGameConfig.openLobbyHp && CheckVersion(TableGameConfig.version, lobbyResConfig.version) > 0)
        {
            return(true);
        }

        // 判断是否游戏是否需要更新
        if (!TableGameConfig.openGameHp)
        {
            return(false);
        }

        // 比对游戏资源版本
        GameResConfig gameResConfig = localResConfigMgr.LocalGameResConfig;
        var           enumerator    = TableGameConfig.gameVersion.GetEnumerator();

        while (enumerator.MoveNext())
        {
            int     productId = enumerator.Current.Key;
            string  gameVer   = enumerator.Current.Value;
            BaseRes gameRes   = gameResConfig.FindProductRes(productId);
            if (gameRes == null || CheckVersion(gameVer, gameRes.version) > 0)
            {
                return(true);
            }
        }

        return(false);
    }