upgrade
This commit is contained in:
@@ -257,8 +257,8 @@ Client4Stomp = CS.Client4Stomp
|
||||
StompFrame = CS.Dist.SpringWebsocket.StompFrame
|
||||
---@type Dist.SpringWebsocket.StatusCodeEnum
|
||||
StompStatus = CS.Dist.SpringWebsocket.StatusCodeEnum
|
||||
---@type Mp3PlayerByUrl
|
||||
Mp3PlayerByUrl = CS.Mp3PlayerByUrl
|
||||
---@type MyAudioPlayerByUrl
|
||||
MyAudioPlayerByUrl = CS.MyAudioPlayerByUrl
|
||||
---@type CLUICheckbox
|
||||
CLUICheckbox = CS.CLUICheckbox
|
||||
---@type CLUIPopListPanel
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -168,7 +168,8 @@ end
|
||||
-- 更新安装游戏
|
||||
function CLLPSplash.upgradeGame(url)
|
||||
if not isNilOrEmpty(url) then
|
||||
Application.OpenURL(url)
|
||||
-- Application.OpenURL(url)
|
||||
MyUtl.installNewApk(url)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -124,7 +124,8 @@ function TRPAbout:upgrade()
|
||||
local newVer = MapEx.getString(map, "ver")
|
||||
if (tonumber(newVer) > tonumber(oldVer)) then
|
||||
local doUpgradeApp = function()
|
||||
Application.OpenURL(MapEx.getString(map, "url"))
|
||||
-- Application.OpenURL(MapEx.getString(map, "url"))
|
||||
MyUtl.installNewApk(MapEx.getString(map, "url"))
|
||||
end
|
||||
if MapEx.getBool(map, "force") then
|
||||
CLUIUtl.showConfirm(LGet("MsgHadNewVerApp"), true, "更新", doUpgradeApp, "", nil)
|
||||
|
||||
@@ -4,14 +4,18 @@ local TRBasePanel = require("ui.panel.TRBasePanel")
|
||||
local TRPPlaySoundRecord = class("TRPPlaySoundRecord", TRBasePanel)
|
||||
|
||||
local uiobjs = {}
|
||||
|
||||
local downloadDir = Utl.chgToSDCard(Path.Combine(Application.persistentDataPath, CLPathCfg.self.basePath, "download"))
|
||||
|
||||
-- 初始化,只会调用一次
|
||||
function TRPPlaySoundRecord:init(csObj)
|
||||
TRPPlaySoundRecord.super.init(self, csObj)
|
||||
|
||||
self:setEventDelegate()
|
||||
---@type Mp3PlayerByUrl
|
||||
uiobjs.mp3Player = self.csSelf:GetComponent("Mp3PlayerByUrl")
|
||||
---@type MyAudioPlayerByUrl
|
||||
uiobjs.mp3Player = self.csSelf:GetComponent("MyAudioPlayerByUrl")
|
||||
uiobjs.mp3Player.audioSource = SoundEx.self.singletonAudio
|
||||
uiobjs.mp3Player:Initialize(0)
|
||||
uiobjs.content = getCC(self.transform, "Bottom/content", "CLUIFormRoot")
|
||||
uiobjs.slider = getCC(uiobjs.content.transform, "Slider", "UISlider")
|
||||
uiobjs.LabelCurrent = getCC(uiobjs.slider.transform, "Thumb/LabelCurrent", "UILabel")
|
||||
@@ -30,17 +34,36 @@ function TRPPlaySoundRecord:show()
|
||||
uiobjs.LabelCurrent.text = ""
|
||||
uiobjs.slider.value = 0
|
||||
CLUIUtl.setSpriteFit(uiobjs.ButtonStatus, "cust_pause")
|
||||
showHotWheel()
|
||||
uiobjs.mp3Player:getAudioClip(
|
||||
self.mdata.recordfile,
|
||||
function(clip)
|
||||
hideHotWheel()
|
||||
if (self.csSelf.isActive) then
|
||||
CLUIUtl.setSpriteFit(uiobjs.ButtonStatus, "cust_pause")
|
||||
uiobjs.mp3Player:play(clip, self:wrapFunc(self.refreshProgress), self:wrapFunc(self.onFinishPlay))
|
||||
local strs = strSplit(self.mdata.recordfile, "?")
|
||||
local exten = string.upper(Path.GetExtension(strs[1]))
|
||||
local localPath = Path.Combine(downloadDir, Path.GetFileName(strs[1]))
|
||||
if File.Exists(localPath) then
|
||||
MyFileOpen.open(localPath)
|
||||
hideTopPanel(self.csSelf)
|
||||
else
|
||||
showHotWheel()
|
||||
uiobjs.mp3Player:getAudioClip(
|
||||
self.mdata.recordfile,
|
||||
function(clip, bytes)
|
||||
hideHotWheel()
|
||||
if (self.csSelf.isActive) then
|
||||
CLUIUtl.setSpriteFit(uiobjs.ButtonStatus, "cust_pause")
|
||||
if exten == ".WAV" then
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(localPath))
|
||||
File.WriteAllBytes(localPath, bytes)
|
||||
MyFileOpen.open(localPath)
|
||||
hideTopPanel(self.csSelf)
|
||||
else
|
||||
uiobjs.mp3Player:play(
|
||||
clip,
|
||||
self:wrapFunc(self.refreshProgress),
|
||||
self:wrapFunc(self.onFinishPlay)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function TRPPlaySoundRecord:onFinishPlay(clip)
|
||||
|
||||
@@ -99,6 +99,11 @@ function TRPSetting:setEventDelegate()
|
||||
end
|
||||
|
||||
--//TODO: 还要把已经下载了的附件也删除掉
|
||||
local downloadDir =
|
||||
Utl.chgToSDCard(
|
||||
Path.Combine(Application.persistentDataPath, CLPathCfg.self.basePath, "download")
|
||||
)
|
||||
Directory.Delete(downloadDir)
|
||||
|
||||
pcall(cleanRes)
|
||||
local panel = CLPanelManager.getPanel(CLMainBase.self.firstPanel)
|
||||
|
||||
@@ -668,8 +668,7 @@ MonoBehaviour:
|
||||
isRefeshContentWhenEffectFinish: 0
|
||||
EffectRoot: {fileID: 0}
|
||||
effectType: 1
|
||||
EffectList:
|
||||
- {fileID: 5085916832979897770}
|
||||
EffectList: []
|
||||
frameName:
|
||||
frameObj: {fileID: 0}
|
||||
titleKeyName:
|
||||
@@ -682,14 +681,15 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 1933448098774200202}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 468c5112a721645e78cea88b0e3d1ce7, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 53cdfc4670e904bdba2756414d808cf7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
audioSource: {fileID: 0}
|
||||
mUrl:
|
||||
mDefaultAudioType: 13
|
||||
mDefaultAudioType: 0
|
||||
myClip: {fileID: 0}
|
||||
isPlaying: 0
|
||||
isNativeAudio: 0
|
||||
--- !u!1 &2195943103738195833
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Reference in New Issue
Block a user