This commit is contained in:
2020-08-10 22:23:49 +08:00
parent 6bb6777bb9
commit 19e730574b
265 changed files with 86326 additions and 952 deletions

View File

@@ -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