diff --git a/script/apps/Aries/Creator/Game/Login/ClientUpdater.lua b/script/apps/Aries/Creator/Game/Login/ClientUpdater.lua index bd461258..8f84d6eb 100644 --- a/script/apps/Aries/Creator/Game/Login/ClientUpdater.lua +++ b/script/apps/Aries/Creator/Game/Login/ClientUpdater.lua @@ -69,6 +69,58 @@ function ClientUpdater:Check(callbackFunc) return end -- echo({self.autoUpdater:getCurVersion(), self.autoUpdater:getLatestVersion()}); + + -- we will not update for mac if software version heighter then remote version + if System.os.GetPlatform() == 'mac' then + local function CompareVersion(a, b) + -- a < b return -1 + -- a == b return 0 + -- a > b return 1 + -- format error return nil + local function GetVersions(versionStr) + local result = {}; + for s in string.gfind(versionStr, "%d+") do + table.insert(result, tonumber(s)); + end + return result; + end + + local aVersionList = GetVersions(a); + local bVersionList = GetVersions(b); + + if (#aVersionList < 3 or #bVersionList < 3) then + return nil; + end + + if (aVersionList[1] < bVersionList[1])then + return -1; + elseif (aVersionList[1] == bVersionList[1]) then + if (aVersionList[2] < bVersionList[2]) then + return -1; + elseif (aVersionList[2] == bVersionList[2]) then + if (aVersionList[3] < bVersionList[3]) then + return -1; + elseif (aVersionList[3] == bVersionList[3]) then + return 0; + else + return 1; + end + else + return 1; + end + else + return 1; + end + end + + local compareResult = CompareVersion(self:GetCurrentVersion(), self.autoUpdater:getLatestVersion()) + + if (compareResult == 1 or compareResult == 0) then + callbackFunc(false, self:GetCurrentVersion()); + return true + end + end + if(bSucceed) then if(self.autoUpdater:isNeedUpdate())then callbackFunc(true, self.autoUpdater:getLatestVersion());