热更新的代码实现

本篇介绍热更的Lua实现

1.UI界面 UpdateLayer.lua

local LocalStorage = require("framework.storage.LocalStorage")

local UpdateLayer = class("UpdateLayer", function()
    return cc.Layer:create()
end)

local director = cc.Director:getInstance()
local view = director:getOpenGLView()

function UpdateLayer:ctor(hasInitSDK, autoOpenLogin)
    self._hasInitSDK    = hasInitSDK
    self._autoOpenLogin = autoOpenLogin

	self._curProgress = 0
    self._tarProgress = 0

    --是否已经开始热更新
    self._isUpdate = nil
    self._md5DownloadStart = false
    --是否开始拉取整包更新的url
    self._showUpdateClient = nil

    
    self._updateCheck = require("version.UpdateCheck").new(
        handler(self, self._onCheckProgress), 
        handler(self, self._onCheckError),
        handler(self, self._setRemoteVersion)
    )
    G_updateCheck = self._updateCheck
    self._getUpdateUrl = require("version.

你可能感兴趣的:(cocos2dx-lua,热更新实战,lua)