|
- PKFramework={}
-
- local paths={}
-
- local files={}
-
- function PKFramework.PKImport(name,gameId)
- local fileName=string.gsub(name, "%.", "/")
-
-
- local gameConfig = getSubGameConfig(gameId or app.gameId)
- local rootName=gameConfig.rootName
-
- local newFileName=string.gsub(fileName, "PK", gameConfig.fileName)
- newFileName=string.gsub(newFileName, "pk_base", rootName)
-
- local newName=string.gsub(name, "PK", gameConfig.fileName)
- newName=string.gsub(newName, "pk_base", rootName)
-
- local luaFile = newFileName..".lua"
- local luacFile = newFileName..".luac"
- local isFileExist = cc.FileUtils:getInstance():isFileExist(luacFile)
- if not isFileExist then
- isFileExist = cc.FileUtils:getInstance():isFileExist(luaFile)
- end
-
-
- if isFileExist then
- name=newName
- end
- files[name]=true
- print("PKImport:"..name)
- return require(name)
- end
-
- function PKFramework.ImportWanFa(name,gameId)
- local fileName=string.gsub(name, "%.", "/")
-
- local gameConfig = getSubGameConfig(gameId or app.gameId)
- local rootName=gameConfig.rootName
-
- local newFileName=string.gsub(fileName, "PK", gameConfig.fileName)
- local newName=string.gsub(name, "PK", gameConfig.fileName)
-
- local luaFile = newFileName..".lua"
- local luacFile = newFileName..".luac"
- local isFileExist = cc.FileUtils:getInstance():isFileExist(luacFile)
- if not isFileExist then
- isFileExist = cc.FileUtils:getInstance():isFileExist(luaFile)
- end
-
- if isFileExist then
- name=newName
- end
-
- print("ImportWanFa:"..name)
- files[name]=true
- return require(name)
- end
-
- function PKFramework.Clean()
- for fileName,v in pairs(files) do
- print("Clean:"..fileName)
- package.loaded[fileName] = nil
- end
- files={}
- end
-
- function PKFramework.PKFrameworkClassImprot(name)
- print("PKFrameworkClassImprot:"..name)
- files[name]=true
- return require(name)
- end
|