upgrade
This commit is contained in:
@@ -46,7 +46,7 @@ MonoBehaviour:
|
||||
material: {fileID: 0}
|
||||
mSprites: []
|
||||
mPixelSize: 1
|
||||
mReplacement: {fileID: 11400000, guid: 5ceb49909c25f471fb6d136b24c49d48, type: 3}
|
||||
mReplacement: {fileID: 0}
|
||||
mCoordinates: 0
|
||||
sprites: []
|
||||
_isBorrowSpriteMode: 1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79314345aa5844e9998f22d91af26b7f
|
||||
guid: 3e560000df1d4415d92481d33716f3a8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class AcceptAllCertificatesSignedWithASpecificKeyPublicKey : CertificateHandler
|
||||
{
|
||||
protected override bool ValidateCertificate(byte[] certificateData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 468c5112a721645e78cea88b0e3d1ce7
|
||||
guid: 2901315b70861406db16e2dbc7136241
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
327
Assets/trCRM/Scripts/Audio/MyAudioPlayerByUrl.cs
Normal file
327
Assets/trCRM/Scripts/Audio/MyAudioPlayerByUrl.cs
Normal file
@@ -0,0 +1,327 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using Coolape;
|
||||
using E7.Native;
|
||||
using System;
|
||||
|
||||
public class MyAudioPlayerByUrl : MonoBehaviour
|
||||
{
|
||||
public AudioSource audioSource;
|
||||
public string mUrl;
|
||||
public AudioType mDefaultAudioType = AudioType.MPEG;
|
||||
public UnityWebRequest www;
|
||||
public AudioClip myClip;
|
||||
public object finishCallback;
|
||||
public object progressCallback;
|
||||
public bool isPlaying = false;
|
||||
public bool isNativeAudio = false;
|
||||
|
||||
//===native
|
||||
public NativeAudioPointer latestLoadedAudioPointer;
|
||||
public NativeSource latestUsedNativeSource;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(int bufferSize = -1)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
//You should have a fallback to normal AudioSource playing in your game so you can also hear sounds while developing.
|
||||
Debug.Log("Please try this in a real device!");
|
||||
#else
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
DeviceAudioInformation deviceAudioInformation = NativeAudio.GetDeviceAudioInformation();
|
||||
bufferSize = deviceAudioInformation.optimalBufferSize;
|
||||
}
|
||||
NativeAudio.Initialize(new NativeAudio.InitializationOptions {
|
||||
androidAudioTrackCount = 2,
|
||||
androidMinimumBufferSize = Mathf.RoundToInt(bufferSize)
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
public UnityWebRequest getAudioClip(string url, object callback)
|
||||
{
|
||||
StartCoroutine(_getAudioClip(url, mDefaultAudioType, callback));
|
||||
return www;
|
||||
}
|
||||
|
||||
public UnityWebRequest getAudioClip(string url, AudioType audioType, object callback)
|
||||
{
|
||||
StartCoroutine(_getAudioClip(url, audioType, callback));
|
||||
return www;
|
||||
}
|
||||
|
||||
public IEnumerator _getAudioClip(string url, AudioType audioType, object callback)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
www = UnityWebRequestMultimedia.GetAudioClip(url, audioType);
|
||||
www.certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
||||
using (www)
|
||||
{
|
||||
yield return www.SendWebRequest();
|
||||
try
|
||||
{
|
||||
if (www.isNetworkError)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
myClip = DownloadHandlerAudioClip.GetContent(www);
|
||||
Utl.doCallback(callback, myClip, www.downloadHandler.data);
|
||||
}
|
||||
} catch(Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
www.certificateHandler.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void play(AudioClip clip, object progressCb, object finishCb)
|
||||
{
|
||||
release();
|
||||
if (clip == null) return;
|
||||
isNativeAudio = false;
|
||||
progressCallback = progressCb;
|
||||
finishCallback = finishCb;
|
||||
audioSource.clip = myClip;
|
||||
audioSource.time = 0;
|
||||
audioSource.Play();
|
||||
}
|
||||
|
||||
public void playByNative(AudioClip clip, object progressCb, object finishCb)
|
||||
{
|
||||
try
|
||||
{
|
||||
release();
|
||||
if (NotRealDevice() || clip == null) return;
|
||||
isNativeAudio = true;
|
||||
progressCallback = progressCb;
|
||||
finishCallback = finishCb;
|
||||
|
||||
//Loading via AudioClip will pull out and send the audio byte array to C side directly.
|
||||
latestLoadedAudioPointer = NativeAudio.Load(clip);
|
||||
latestUsedNativeSource = NativeAudio.GetNativeSourceAuto();
|
||||
isPlaying = true;
|
||||
latestUsedNativeSource.Play(latestLoadedAudioPointer);
|
||||
}catch(Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void playByNative(string clipPath, object progressCb, object finishCb)
|
||||
{
|
||||
try
|
||||
{
|
||||
release();
|
||||
if (NotRealDevice() || string.IsNullOrEmpty(clipPath)) return;
|
||||
isNativeAudio = true;
|
||||
progressCallback = progressCb;
|
||||
finishCallback = finishCb;
|
||||
|
||||
//Loading via AudioClip will pull out and send the audio byte array to C side directly.
|
||||
latestLoadedAudioPointer = NativeAudio.Load(clipPath);
|
||||
latestUsedNativeSource = NativeAudio.GetNativeSourceAuto();
|
||||
isPlaying = true;
|
||||
latestUsedNativeSource.Play(latestLoadedAudioPointer);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If you overwrite the pointer without unloading, you lose a way of unloading that audio permanently!
|
||||
/// </summary>
|
||||
private void UnloadIfLoaded4Native()
|
||||
{
|
||||
if (latestLoadedAudioPointer != null)
|
||||
{
|
||||
latestLoadedAudioPointer.Unload();
|
||||
latestUsedNativeSource = default(NativeSource);
|
||||
latestLoadedAudioPointer = null;
|
||||
}
|
||||
}
|
||||
public bool NotRealDevice()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
//You should have a fallback to normal AudioSource playing in your game so you can also hear sounds while developing.
|
||||
Debug.Log("Please try this in a real device!");
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public float getNativeSourceTime()
|
||||
{
|
||||
if (NotRealDevice()) return 0;
|
||||
if (latestUsedNativeSource.IsValid)
|
||||
{
|
||||
return latestUsedNativeSource.GetPlaybackTime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isNativeAudio)
|
||||
{
|
||||
if (latestLoadedAudioPointer == null || (!latestUsedNativeSource.IsValid)) return;
|
||||
if (isPlaying && Mathf.Abs(getNativeSourceTime() - latestLoadedAudioPointer.Length) <= 0.1)
|
||||
{
|
||||
isPlaying = false;
|
||||
Utl.doCallback(finishCallback, audioSource.clip);
|
||||
}
|
||||
else if (isPlaying)
|
||||
{
|
||||
Utl.doCallback(progressCallback, getNativeSourceTime() / latestLoadedAudioPointer.Length, getNativeSourceTime());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (audioSource == null || audioSource.clip == null) return;
|
||||
if (!audioSource.isPlaying && isPlaying && Mathf.Abs(1 - audioSource.time / audioSource.clip.length) <= 0.01)
|
||||
{
|
||||
isPlaying = audioSource.isPlaying;
|
||||
Utl.doCallback(finishCallback, audioSource.clip);
|
||||
//stop();
|
||||
audioSource.time = 0;
|
||||
}
|
||||
else if (audioSource.isPlaying)
|
||||
{
|
||||
isPlaying = audioSource.isPlaying;
|
||||
Utl.doCallback(progressCallback, audioSource.time / audioSource.clip.length, audioSource.time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float progress()
|
||||
{
|
||||
if (isNativeAudio)
|
||||
{
|
||||
if (latestLoadedAudioPointer == null || (!latestUsedNativeSource.IsValid)) return 0;
|
||||
return getNativeSourceTime() / latestLoadedAudioPointer.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (audioSource == null || audioSource.clip == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return audioSource.time / audioSource.clip.length;
|
||||
}
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
if (isNativeAudio)
|
||||
{
|
||||
|
||||
#if NATIVE_TOUCH_INTEGRATION
|
||||
Debug.Log("Native touch started!!");
|
||||
staticPointer = nativeAudioPointer;
|
||||
NativeTouch.RegisterCallback(NTCallback);
|
||||
NativeTouch.Start(new NativeTouch.StartOption { disableUnityTouch = true });
|
||||
NativeTouch.WarmUp();
|
||||
return;
|
||||
#endif
|
||||
if (NotRealDevice()) return;
|
||||
if (latestUsedNativeSource.IsValid)
|
||||
{
|
||||
latestUsedNativeSource.Stop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
audioSource.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void release()
|
||||
{
|
||||
stop();
|
||||
if (audioSource.clip != null)
|
||||
{
|
||||
Destroy(audioSource.clip);
|
||||
audioSource.clip = null;
|
||||
}
|
||||
UnloadIfLoaded4Native();
|
||||
}
|
||||
|
||||
public void pause()
|
||||
{
|
||||
if (isNativeAudio)
|
||||
{
|
||||
if (NotRealDevice()) return;
|
||||
if (latestUsedNativeSource.IsValid)
|
||||
{
|
||||
latestUsedNativeSource.Resume();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
audioSource.Pause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void rePlay()
|
||||
{
|
||||
if (isNativeAudio)
|
||||
{
|
||||
if (latestUsedNativeSource.IsValid)
|
||||
{
|
||||
latestUsedNativeSource.Pause();
|
||||
}
|
||||
} else
|
||||
{
|
||||
audioSource.UnPause();
|
||||
if (!audioSource.isPlaying)
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void seek(float persent)
|
||||
{
|
||||
if (isNativeAudio)
|
||||
{
|
||||
if (NotRealDevice()) return;
|
||||
if (latestLoadedAudioPointer != null)
|
||||
{
|
||||
float sec = latestLoadedAudioPointer.Length * persent;
|
||||
var options = NativeSource.PlayOptions.defaultOptions;
|
||||
options.offsetSeconds = sec;
|
||||
latestUsedNativeSource = NativeAudio.GetNativeSourceAuto();
|
||||
latestUsedNativeSource.Play(latestLoadedAudioPointer, options);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (audioSource != null)
|
||||
{
|
||||
float sec = audioSource.clip.length * persent;
|
||||
audioSource.time = sec;
|
||||
if (!audioSource.isPlaying)
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/trCRM/Scripts/Audio/MyAudioPlayerByUrl.cs.meta
Normal file
11
Assets/trCRM/Scripts/Audio/MyAudioPlayerByUrl.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53cdfc4670e904bdba2756414d808cf7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,131 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using Coolape;
|
||||
|
||||
public class Mp3PlayerByUrl : MonoBehaviour
|
||||
{
|
||||
public AudioSource audioSource;
|
||||
public string mUrl;
|
||||
public AudioType mDefaultAudioType = AudioType.MPEG;
|
||||
public UnityWebRequest www;
|
||||
public AudioClip myClip;
|
||||
public object finishCallback;
|
||||
public object progressCallback;
|
||||
public bool isPlaying = false;
|
||||
|
||||
public UnityWebRequest getAudioClip(string url, object callback)
|
||||
{
|
||||
StartCoroutine(_getAudioClip(url, mDefaultAudioType, callback));
|
||||
return www;
|
||||
}
|
||||
|
||||
public UnityWebRequest getAudioClip(string url, AudioType audioType , object callback)
|
||||
{
|
||||
StartCoroutine(_getAudioClip(url, audioType, callback));
|
||||
return www;
|
||||
}
|
||||
|
||||
public IEnumerator _getAudioClip(string url, AudioType audioType ,object callback)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
www = UnityWebRequestMultimedia.GetAudioClip(url, audioType);
|
||||
using (www)
|
||||
{
|
||||
yield return www.SendWebRequest();
|
||||
|
||||
if (www.isNetworkError)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
myClip = DownloadHandlerAudioClip.GetContent(www);
|
||||
Utl.doCallback(callback, myClip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void play(AudioClip clip, object progressCb, object finishCb)
|
||||
{
|
||||
if (clip == null) return;
|
||||
progressCallback = progressCb;
|
||||
finishCallback = finishCb;
|
||||
audioSource.clip = myClip;
|
||||
audioSource.time = 0;
|
||||
audioSource.Play();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (audioSource == null || audioSource.clip == null) return;
|
||||
if (!audioSource.isPlaying && isPlaying && Mathf.Abs(1 - audioSource.time / audioSource.clip.length) <= 0.01)
|
||||
{
|
||||
isPlaying = audioSource.isPlaying;
|
||||
Utl.doCallback(finishCallback, audioSource.clip);
|
||||
//stop();
|
||||
audioSource.time = 0;
|
||||
}
|
||||
else if(audioSource.isPlaying)
|
||||
{
|
||||
isPlaying = audioSource.isPlaying;
|
||||
Utl.doCallback(progressCallback, audioSource.time / audioSource.clip.length, audioSource.time);
|
||||
}
|
||||
}
|
||||
|
||||
public float progress()
|
||||
{
|
||||
if (audioSource == null || audioSource.clip == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return audioSource.time / audioSource.clip.length;
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
audioSource.Stop();
|
||||
}
|
||||
|
||||
public void release()
|
||||
{
|
||||
stop();
|
||||
if (audioSource.clip != null)
|
||||
{
|
||||
Destroy(audioSource.clip);
|
||||
audioSource.clip = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void pause()
|
||||
{
|
||||
audioSource.Pause();
|
||||
}
|
||||
|
||||
public void rePlay()
|
||||
{
|
||||
audioSource.UnPause();
|
||||
if (!audioSource.isPlaying)
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void seek(float persent)
|
||||
{
|
||||
if (audioSource != null)
|
||||
{
|
||||
float sec = audioSource.clip.length * persent;
|
||||
audioSource.time = sec;
|
||||
if (!audioSource.isPlaying)
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public static class XluaGenCodeConfig
|
||||
typeof(Dist.SpringWebsocket.Client),
|
||||
typeof(Dist.SpringWebsocket.StompFrame),
|
||||
typeof(Dist.SpringWebsocket.StatusCodeEnum),
|
||||
typeof(Mp3PlayerByUrl),
|
||||
typeof(MyAudioPlayerByUrl),
|
||||
typeof(CLUICheckbox),
|
||||
typeof(CLUIPopListPanel),
|
||||
typeof(CLUIScrollViewWithEvent),
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"2020158":{"2":{"id":"2", "host":"app.ttf-cti.com", "name":"\u6d4b\u8bd5\u670d\u52a1\u5668", "iosVer":"49a8c514f675dc39ba88795e36da4ce3", "port":29006, "androidVer":"ff78bbd5751a99f2fd109e9f64bb7470", "isDev":1}, "3":{"id":"3", "host":"192.168.1.11", "name":"\u672c\u5730\u6d4b\u8bd5", "iosVer":"49a8c514f675dc39ba88795e36da4ce3", "port":29000, "androidVer":"ff78bbd5751a99f2fd109e9f64bb7470", "isDev":1}, "1":{"id":"1", "host":"app.ttf-cti.com", "name":"\u6b63\u5f0f\u670d\u52a1\u5668", "iosVer":"49a8c514f675dc39ba88795e36da4ce3", "port":29000, "androidVer":"ff78bbd5751a99f2fd109e9f64bb7470", "isDev":0}}}
|
||||
{"2020158":{"2":{"id":"2", "host":"47.111.20.34", "name":"\u6d4b\u8bd5\u670d\u52a1\u5668", "iosVer":"49a8c514f675dc39ba88795e36da4ce3", "port":29004, "androidVer":"77b5a72418df6d6852092b2427a37656", "isDev":1}, "3":{"id":"3", "host":"192.168.1.11", "name":"\u672c\u5730\u6d4b\u8bd5", "iosVer":"49a8c514f675dc39ba88795e36da4ce3", "port":29000, "androidVer":"ff78bbd5751a99f2fd109e9f64bb7470", "isDev":1}, "1":{"id":"1", "host":"app.ttf-cti.com", "name":"\u6b63\u5f0f\u670d\u52a1\u5668", "iosVer":"49a8c514f675dc39ba88795e36da4ce3", "port":29000, "androidVer":"ff78bbd5751a99f2fd109e9f64bb7470", "isDev":0}}}
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
r8 (trCRM/resVer/Android/VerCtl/priority.ver8,aecea7a8e5df0d926cbf56c89d1becdc8 %trCRM/resVer/Android/VerCtl/other.ver8,0a763b03453ce762f67786f8d8aee352
|
||||
r8 (trCRM/resVer/Android/VerCtl/priority.ver8,9cb494cde4e58ba1a0e493fa24037e508 %trCRM/resVer/Android/VerCtl/other.ver8,0a763b03453ce762f67786f8d8aee352
|
||||
Binary file not shown.
Reference in New Issue
Block a user