upgrade
This commit is contained in:
@@ -147,10 +147,9 @@ MyUtl.isImage = function(path)
|
||||
return MyUtl.Images[string.upper(extension)] or false
|
||||
end
|
||||
|
||||
---@param oldTexture UnityEngine.Texture2D
|
||||
MyUtl.CompressImage = function(imgPath, maxSize, quality)
|
||||
if not File.Exists(imgPath) then
|
||||
printe("文件不存在==".. imgPath)
|
||||
printe("文件不存在==" .. imgPath)
|
||||
return
|
||||
end
|
||||
-- int quality = 80;//图片压缩质量(1-100)
|
||||
@@ -166,4 +165,38 @@ MyUtl.CompressImage = function(imgPath, maxSize, quality)
|
||||
return newBytes
|
||||
end
|
||||
|
||||
MyUtl.installNewApk = function(url)
|
||||
if MyUtl.isDownloadingApk then
|
||||
MyUtl.toast("正在下载安装,请耐心等待")
|
||||
return
|
||||
end
|
||||
local downloadDir =
|
||||
Utl.chgToSDCard(Path.Combine(Application.persistentDataPath, CLPathCfg.self.basePath, "download"))
|
||||
local apkName
|
||||
Path.GetFileName(url)
|
||||
local localPath = joinStr(downloadDir, apkName)
|
||||
if File.Exists(localPath) then
|
||||
MyFileOpen.open(localPath)
|
||||
else
|
||||
MyUtl.isDownloadingApk = true
|
||||
WWWEx.get(
|
||||
url,
|
||||
nil,
|
||||
CLAssetType.bytes,
|
||||
function(content, orgs)
|
||||
MyUtl.isDownloadingApk = false
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(localPath))
|
||||
File.WriteAllBytes(localPath, content)
|
||||
MyFileOpen.open(localPath)
|
||||
end,
|
||||
function()
|
||||
MyUtl.isDownloadingApk = false
|
||||
end,
|
||||
nil,
|
||||
false,
|
||||
1
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return MyUtl
|
||||
|
||||
Reference in New Issue
Block a user