更新热更逻辑

更新热更逻辑
This commit is contained in:
ALEXTANG
2022-07-24 13:27:21 +08:00
parent 591e3fd2b5
commit 451c97ab3c
108 changed files with 11465 additions and 27 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cb91232a4fb2efd47b8d8b4da4f22229
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,82 @@
using System.Collections;
using UnityEngine;
namespace TEngine
{
public class CoroutineUtility
{
private static GameObject _entity;
private static MonoBehaviour _behaviour;
/// <summary>
/// 开始协程
/// </summary>
/// <param name="routine">对应的迭代器</param>
/// <returns></returns>
public static Coroutine StartCoroutine(IEnumerator routine)
{
if (routine == null)
{
return null;
}
_MakeEntity();
return _behaviour.StartCoroutine(routine);
}
/// <summary>
/// 停止协程
/// </summary>
/// <param name="routine"></param>
public static void StopCoroutine(Coroutine routine)
{
if (routine == null)
return;
if (_entity != null)
{
_behaviour.StopCoroutine(routine);
routine = null;
}
}
/// <summary>
/// 停掉所有的协程
/// </summary>
public static void StopAllCoroutines()
{
if (_entity != null)
{
_behaviour.StopAllCoroutines();
}
}
private static void _MakeEntity()
{
if (_entity != null)
{
return;
}
_entity = new GameObject("__coroutine__")
{
hideFlags = HideFlags.HideAndDontSave
};
_entity.SetActive(true);
#if UNITY_EDITOR
if (Application.isPlaying)
#endif
{
Object.DontDestroyOnLoad(_entity);
}
UnityEngine.Assertions.Assert.IsFalse(_behaviour);
_behaviour = _entity.AddComponent<MainBehaviour>();
}
private class MainBehaviour : MonoBehaviour
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6da5c0d609664a44cb9634c48ad4b269
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -420,5 +420,13 @@ namespace TEngine
return path;
}
}
/// <summary>
/// 设置重新安装了
/// </summary>
internal void SignReInstall()
{
}
}
}

View File

@@ -42,6 +42,13 @@ namespace TEngine
public const string AssetBundleBuildPath = BuildPath + "/AssetBundles";
private const string AssetBundleTargetPath = "{0}/AssetBundles";
public const string Md5List = "Md5List.json";
public const string AssetFolder = "AssetLoad";
//加压缩日志列表
public const string Md5VerifyLog = "Md5VerifyText.txt";
public const string FirstPackageName = "First.zip";
public const string DllScriptPkgName = "Script.bin";
public const string DllScriptPkgBackUpName = "ScriptBackUp.bin";
/// <summary>
/// 资源更新读取根目录
/// </summary>
@@ -220,5 +227,15 @@ namespace TEngine
return www.downloadHandler.text;
}
public static string OldPersistentDataPath
{
get
{
string path = Application.persistentDataPath;
return path.FixPath();
}
}
}
}

View File

@@ -0,0 +1,200 @@
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
using TEngine;
namespace TEngine.UIEditor
{
public class LoadStyle : MonoBehaviour
{
private const string ConfigPath = "UIStyle/Style.json";
public enum StyleEnum
{
Style_Default = 0, //Ĭ<><C4AC>
Style_QuitApp = 1, //<2F>˳<EFBFBD>Ӧ<EFBFBD><D3A6>
Style_RestartApp = 2, //<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
Style_Retry = 3, //<2F><><EFBFBD><EFBFBD>
Style_StartUpdate_Notice = 4,//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
Style_DownLoadApk = 5, //<2F><><EFBFBD>صװ<D8B5>
Style_Clear = 6, //<2F>޸<EFBFBD><DEB8>ͻ<EFBFBD><CDBB><EFBFBD>
Style_DownZip = 7, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
}
public enum BtnEnum
{
BtnOK = 0, //ȷ<><C8B7><EFBFBD><EFBFBD>ť
BtnIgnore = 1,//ȡ<><C8A1><EFBFBD><EFBFBD>ť
BtnOther = 2, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>ʽ
/// </summary>
private class StyleItem
{
public Alignment Align; //<2F><><EFBFBD>ʽ
public bool Show; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
public string Desc; //<2F><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
}
/// <summary>
/// <20><><EFBFBD>ʽ
/// </summary>
private enum Alignment
{
Left = 0,
Middle = 1,
Right = 2
}
#if UNITY_EDITOR
private static string[] Desc = {"","<22>˳<EFBFBD>Ӧ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ",
"<22><><EFBFBD><EFBFBD>Ӧ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ",
"<22><><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ",
"<22>ȸ<EFBFBD><C8B8><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ",
"<22>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ",
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ",
<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ"};
private static string[] Btn = { <><C8B7><EFBFBD><EFBFBD>ť", <><C8A1><EFBFBD><EFBFBD>ť", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť" };
private static Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>> loadEditorConfig = null;
private static GUISkin _guiSkin;
private static Vector2 vecScroll = new Vector2(0, 0);
[MenuItem("TEngine/UITip<69><70>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>")]
private static void Open()
{
_guiSkin = AssetDatabase.LoadAssetAtPath<GUISkin>("Assets/TEngine/Editor/UI/UIStyleSkin.guiskin");
var window = EditorWindow.GetWindow(typeof(CustomMessageBox), true, "UITips<70><73>ʽ") as CustomMessageBox;
if (window == null) return;
window.minSize = new Vector2(500, 560);
window.maxSize = new Vector2(500, 560);
window.Show();
string url = $"{Application.dataPath}/TResources/{ConfigPath}";
if (!String.IsNullOrEmpty(url))
{
string finalPath;
#if UNITY_ANDROID
if (url.StartsWith(Application.persistentDataPath))
url = $"file://{url}";
#elif UNITY_IOS
if (url.StartsWith(Application.persistentDataPath)||url.StartsWith(Application.streamingAssetsPath))
url = $"file://{url}";
#endif
UnityWebRequest www = UnityWebRequest.Get(url);
UnityWebRequestAsyncOperation request = www.SendWebRequest();
while (!request.isDone)
{
}
if (!String.IsNullOrEmpty(www.downloadHandler.text))
{
loadEditorConfig =
JsonConvert.DeserializeObject<Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>>>(
www.downloadHandler.text);
}
www.Dispose();
}
window.OnGUIFunc = () =>
{
EditorGUILayout.BeginHorizontal();
if (loadEditorConfig != null)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
vecScroll = GUILayout.BeginScrollView(vecScroll, false, true);
foreach (var item in loadEditorConfig)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Label(Desc[(int)item.Key] + ":", _guiSkin.label);
foreach (var subitem in item.Value)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Label(Btn[(int)subitem.Key]);
EditorGUILayout.BeginHorizontal();
GUILayout.Label("<22><><EFBFBD>룺", GUILayout.Width(35));
subitem.Value.Align = (Alignment)EditorGUILayout.Popup((int)subitem.Value.Align, new string[] { "Left", "Middle", "Right" }, GUILayout.Width(100));
EditorGUILayout.EndHorizontal();
GUILayout.Space(2);
subitem.Value.Show = GUILayout.Toggle(subitem.Value.Show, "<22>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ");
GUILayout.Space(2);
EditorGUILayout.BeginHorizontal();
GUILayout.Label("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", GUILayout.Width(35));
subitem.Value.Desc = EditorGUILayout.TextField(subitem.Value.Desc, GUILayout.Width(150));
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndVertical();
GUILayout.Space(2);
}
GUILayout.EndScrollView();
if (GUILayout.Button("<22><><EFBFBD><EFBFBD>"))
{
try
{
string result = JsonConvert.SerializeObject(loadEditorConfig);
string dir = $"{Application.dataPath}/TResources/UIStyle/";
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
File.WriteAllText(url, result);
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>" + url);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
EditorGUILayout.EndVertical();
}
return 0;
};
}
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public class CustomMessageBox : EditorWindow
{
public delegate void OnWindowClose(int button, int returnValue);
public string Info = string.Empty;
public Func<int> OnGUIFunc;
public OnWindowClose OnClose;
public string[] Buttons = null;
public int ReturnValue;
int _CloseButton = -1;
public void OnDestroy()
{
if (OnClose != null)
{
try
{
OnClose(_CloseButton, ReturnValue);
}
catch (Exception e)
{
Debug.LogException(e);
}
}
}
public void OnGUI()
{
if (OnGUIFunc != null)
{
ReturnValue = OnGUIFunc();
}
}
}
#endregion
#endif
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e2f2a62a0258974468bfe8ab2fccd5f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,427 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using UnityEngine;
using UnityEngine.Networking;
namespace TEngine
{
public class FileunzipManager
{
private static FileunzipManager _instance;
#region FastUnZip
//快速解压的方法
private Thread _unpackThread;
private List<LoadResource> _zipPath;
private string _unzipPath;
private readonly ulong[] _progress = { 0 };
private int _fileIndex;
private string _fileDir = "";
private long _currentBuffSize;
private int Max = 0;
private bool _bussiness;
private bool _unpackresult;
public static FileunzipManager Instance => _instance ?? (_instance = new FileunzipManager());
/// <summary>
/// 设置版本回退
/// </summary>
/// <param name="count"></param>
public void ResetVersionCount(int count)
{
Max = count;
}
/// <summary>
/// 解压缩
/// </summary>
/// <param name="zippath">压缩包的地址</param>
/// <param name="unzippath">解压的路径</param>
public void StartFastUnZip(List<LoadResource> zippath, string dir, string unzippath)
{
_zipPath = zippath;
_unzipPath = unzippath;
_fileDir = dir;
if (_zipPath == null || zippath.Count <= 0)
return;
if (string.IsNullOrEmpty(_unzipPath))
return;
if (_unpackThread != null)
{
Finish();
}
_bussiness = true;
_progress[0] = 0;
_fileIndex = 0;
_currentBuffSize = 0;
_unpackThread = new Thread(FastUnPack);
_unpackThread.Start();
}
private void FastUnPack()
{
_unpackresult = true;
var oldersVersion = GetOldestVersion(_fileDir);
for (var i = 0; i < _zipPath.Count; i++)
{
if (_zipPath[i].Url == null)
{
_fileIndex++;
continue;
}
var targetPath = VersionCheck(_zipPath[_fileIndex].Url, _fileDir, oldersVersion);
int result = FastZip.decompress_File($"{_fileDir}/{_zipPath[_fileIndex].Url}", targetPath, null, null, _progress);
if (result != 1)
{
break;
}
if (!VerifyMd5(targetPath))
{
break;
}
if (!BackUpCurrentVersionDll(targetPath))
{
break;
}
_currentBuffSize += (long)_progress[0];
_fileIndex++;
}
_unpackresult = _fileIndex >= _zipPath.Count;
Finish();
}
/// <summary>
/// 备份当前版本需要的dll
/// </summary>
private bool BackUpCurrentVersionDll(string path)
{
#if UNITY_EDITOR
return true;
#endif
#if ENABLE_MONO
var sourcePath = $"{FileSystem.ResourceRoot}/{FileSystem.DllScriptPkgName}";
if (!File.Exists(sourcePath))
{
TLogger.LogError($"不存在dllpath:{sourcePath}");
return true;
}
var targetDll = $"{path}/{FileSystem.DllScriptPkgName}";
if (sourcePath == targetDll)
{
//将母包的dll备份
File.Copy(sourcePath, $"{FileSystem.ResourceRoot}/{FileSystem.DllScriptPkgBackUpName}", true);
return true;
}
if (!File.Exists(targetDll))
{
if (File.Exists(sourcePath))
{
File.Copy(sourcePath, targetDll, true);
}
else
{
TLogger.LogError("FileunzipManager.BackUpCurrentVersionDll, File not exit,dllPath:" + sourcePath);
return false;
}
}
else
{
File.Copy(targetDll, sourcePath, true);
}
return true;
#else
TLogger.LogInfo("非mono版本不需要备份");
return true;
#endif
}
/// <summary>
/// 拷贝dll到内部目录
/// 临时方法后面转il2cpp编译就去掉了
/// </summary>
/// <param name="exit_dll"></param>
public void CopyMonoAssembly(string version)
{
#if UNITY_EDITOR
return;
#endif
#if ENABLE_MONO
var source_path = GameConfig.Instance.FilePath($"{FileSystem.ResourceRoot}/{FileSystem.DllScriptPkgName}");
var des_path = $"{FileSystem.OldPersistentDataPath}/{FileSystem.DllScriptPkgName}";
TLogger.LogInfo($"FileUnZip.CopyMonoAssembly,source_path:{source_path}");
TLogger.LogInfo($"FileUnZip.CopyMonoAssembly,des_path:{des_path}");
if (File.Exists(des_path))
{
File.SetAttributes(des_path, FileAttributes.Normal);
}
if (File.Exists(source_path))
{
File.SetAttributes(source_path, FileAttributes.Normal);
File.Copy(source_path, des_path, true);
}
#endif
}
public void BackDllInStream()
{
#if UNITY_EDITOR
return;
#endif
#if ENABLE_MONO
//打dll备份出来,为了兼容dll更新以防止以后又需要dll更新了
var sourcePath = $"{FileSystem.ResourceRoot}/{FileSystem.DllScriptPkgName}";
string dllInStream = $"{FileSystem.ResourceRootInStreamAsset}/{FileSystem.DllScriptPkgName}";
TLogger.LogInfo($"Copy dll from {dllInStream} to {sourcePath}");
var www = UnityWebRequest.Get(dllInStream);
var dh = new DownloadHandlerFile(sourcePath) { removeFileOnAbort = true };
www.downloadHandler = dh;
www.SendWebRequest();
while (!www.isDone)
{
if (www.isHttpError || www.isNetworkError)
{
TLogger.LogInfo("FileUnzipManager.BackDllInStream,not found dll");
return;
}
}
File.Copy(sourcePath, $"{FileSystem.ResourceRoot}/{FileSystem.DllScriptPkgBackUpName}", true);
File.Copy(sourcePath, $"{FileSystem.OldPersistentDataPath}/{FileSystem.DllScriptPkgName}", true);
#endif
}
/// <summary>
/// 版本检测,低版本的资源退回到根目录下
/// </summary>
/// <param name="version">版本号</param>
/// <param name="path">解压缩目录</param>
/// <param name="oldestVersion">最低的版本号</param>
/// <returns></returns>
internal string VersionCheck(string version, string path, string oldestVersion)
{
var folder = version.Split('_');
if (folder.Length < 2) return path;
var versionLongCurrent = long.Parse(folder[1].Replace(".", ""));
var versionLongOld = long.Parse(oldestVersion.Replace(".", ""));
if (versionLongOld >= versionLongCurrent)
{
DeleteUnUsedVersion(folder[1]);
return path;
}
var newPath = $"{path}/{folder[1]}{GameConfig.SUFFIX}";
LoaderUtilities.MakeAllDirectory(newPath);
return newPath;
}
/// <summary>
/// 获取最低的需要保留的版本号
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
internal string GetOldestVersion(string path)
{
if (path.IndexOf(FileSystem.FirstPackageName) >= 0)
return "0";
var dirs = GameConfig.Instance.GetExitVersions(path);
foreach (var item in _zipPath)
{
if (string.IsNullOrEmpty(item.Url))
{
continue;
}
var folder = item.Url.Split('_');
if (folder.Length < 2)
continue;
if (!dirs.Contains(folder[1]))
{
dirs.Add(folder[1]);
}
}
Sort(dirs);
var version = "0";
if (dirs.Count > Max)
{
int versionIndex = dirs.Count - Max - 1;
version = dirs[versionIndex];
DeleteUnUsedVersion(version);
}
return version;
}
private void Sort(List<string> dirs)
{
dirs.Sort((a, b) =>
{
var versionLongA = long.Parse(a.Replace(".", ""));
var versionLongB = long.Parse(b.Replace(".", ""));
return versionLongB < versionLongA ? 1 : -1;
});
}
//删除不用了的版本
private void DeleteUnUsedVersion(string path)
{
string folder = $"{_fileDir}/{path}{GameConfig.SUFFIX}";
if (Directory.Exists(folder))
{
LoaderUtilities.CopyDirectory(folder, _fileDir);
Directory.Delete(folder, true);
}
}
/// <summary>
/// 返回压缩包里面的文件的总长度,字节为单位
/// </summary>
/// <param name="path">压缩包的路径</param>
/// <returns></returns>
public UInt64 GetZipLength(string path)
{
return FastZip.getFileInfo(path);
}
/// <summary>
/// 返回进度
/// </summary>
/// <returns></returns>
public long GetProgress()
{
return _currentBuffSize + (long)_progress[0];
}
/// <summary>
/// 线程是否在执行中
/// </summary>
/// <returns></returns>
public bool IsRunning()
{
return _unpackThread != null && _bussiness;
}
/// <summary>
/// 解压缩的结果
/// </summary>
/// <returns></returns>
public bool UnPackResult()
{
return _unpackresult;
}
/// <summary>
/// 解压缩状态
/// </summary>
/// <returns></returns>
public bool IsBusiness()
{
return _bussiness;
}
/// <summary>
/// 结束线程
/// </summary>
public void Finish()
{
_bussiness = false;
if (_unpackThread == null) return;
if (!_unpackThread.IsAlive)
{
_unpackThread = null;
}
else
{
try
{
_unpackThread.Join(2000);
}
catch (Exception e)
{
TLogger.LogError($"Fileunzipmanager.Finish,{e.StackTrace}");
}
_unpackThread = null;
}
}
#endregion
#region Md5校验
private static bool VerifyMd5(string path)
{
bool result = true;
try
{
string configPath = path + "/" + FileSystem.Md5List;
if (!File.Exists(configPath))
{
TLogger.LogError("could not find config,path:" + configPath);
result = false;
}
else
{
var fileList = File.ReadAllText(configPath);
var list = JsonUtility.FromJson<Serialization<fileMd5>>(fileList).ToList();
var logFilePath = $"{path}/{FileSystem.Md5VerifyLog}";
var fileStream = new FileStream(logFilePath, FileMode.OpenOrCreate);
var writer = new StreamWriter(fileStream);
foreach (var fileMd5 in list)
{
string log;
var tmpFile = Path.GetFullPath($"{path}/{fileMd5.fileName}");
if (!File.Exists(tmpFile))
{
log = $"file: {fileMd5.fileName} not exit";
writer.Write(log);
result = false;
continue;
}
string md5Raw = LoaderUtilities.GetMd5Hash(tmpFile);
if (!md5Raw.Equals(fileMd5.md5, StringComparison.Ordinal))
{
log = $"file: {fileMd5.fileName} \r\n Normal Md5: {md5Raw} \r\n Config Md5: {fileMd5.md5};Unpack Failed \r\n";
writer.Write(log);
result = false;
}
else
{
log = $"file: {fileMd5.fileName} \r\n Normal Md5: {md5Raw} \r\n Config Md5: {fileMd5.md5};Unpack ok \r\n";
writer.Write(log);
}
}
writer.Flush();
writer.Dispose();
writer.Close();
}
}
catch (Exception e)
{
result = false;
TLogger.LogError(e.ToString());
}
return result;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b2178f99fe2994f488ced5188bda6d0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace TEngine
{
public class Launcher:MonoBehaviour
{
void Start()
{
TLogger.Instance.Active();
LoadMgr.Instance.StartLoadInit(LaunchSuccess);
}
private void LaunchSuccess()
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c0cf65cac27fea44bbeda946bbb14abd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,12 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using TEngine.UI;
using UnityEngine;
namespace TEngine
{
public class LoadUpdateLogic
{
private static LoadUpdateLogic _instance;
public Action<int> Download_Complete_Action = null;
@@ -32,7 +35,9 @@ namespace TEngine
/// </summary>
public string LatestResId { get; set; }
private bool _loaderUpdateLaunched = false;
private Action _startGameEvent;
private Action _firstPackageEvent;
private int _curTryCount;
private const int MaxTryCount = 3;
private bool _connectBack;
@@ -40,6 +45,11 @@ namespace TEngine
private LoadData _currentData;
private UpdateType _currentType = UpdateType.None;
private readonly string _downloadFilePath = FileSystem.ResourceRoot + "/";
private Coroutine _coroutine;
//加载检测
private bool _dllLoad;
private Coroutine _load_data_check;
public DownloadImpl Downloader { get; set; }
public LoadMgr()
{
@@ -48,13 +58,32 @@ namespace TEngine
_startGameEvent = null;
}
public bool IsLaunched()
{
return _instance._loaderUpdateLaunched;
}
public void StartLoadInit(Action onUpdateComplete)
{
//热更新阶段文本初始化
LoadText.Instance.InitConfigData(null);
//热更新UI初始化
UILoadMgr.Initialize();
UILoadMgr.Show(UIDefine.UILoadUpdate);
if (LoadMgr.Instance.IsLaunched())
{
StartGame();
}
else
{
#if RELEASE_BUILD || _DEVELOPMENT_BUILD_
StartLoad(() => { FinishCallBack(onUpdateComplete); });
#else
onUpdateComplete();
onUpdateComplete?.Invoke();
#endif
}
}
/// <summary>
@@ -63,6 +92,7 @@ namespace TEngine
/// <param name="action"></param>
public void StartLoad(Action action)
{
_loaderUpdateLaunched = true;
_startGameEvent = action;
_connectBack = false;
_curTryCount = 0;
@@ -96,9 +126,30 @@ namespace TEngine
if (_curTryCount > MaxTryCount)
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Net_Error, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry,
() => {
_curTryCount = 0;
RequestVersion();
}, () =>
{
Application.Quit();
});
return;
}
UILoadMgr.Show(UIDefine.UILoadUpdate, string.Format(LoadText.Instance.Label_Load_Checking, _curTryCount));
if (string.IsNullOrEmpty(OnlineParamUrl))
{
TLogger.LogError("LoadMgr.RequestVersion, remote url is empty or null");
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_RemoteUrlisNull, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp,
Application.Quit);
return;
}
TLogger.LogInfo("LoadMgr.RequestVersion, proxy:" + OnlineParamUrl);
try
{
var onlineParamStr = LoaderUtilities.HttpGet(OnlineParamUrl);
@@ -143,8 +194,180 @@ namespace TEngine
//检测一下本地是否存在资源,如果存在了就直接解压就行了,如果不存在还需要下载
_currentData.List = _CheckLocalExitResource(_currentData.List);
_currentType = _currentData.Type;
//TODO
if (_currentData.List.Count <= 0)
{
DownLoadCallBack((int)DownLoadResult.AllDownLoaded, GameStatus.AssetLoad, _currentData.All);
_needUpdate = true;
return;
}
//展示更新类型
var exitUpdate = ShowUpdateType(_currentData);
if (exitUpdate)
{
_needUpdate = true;
}
else
{
StartGame();
}
}
/// <summary>
/// 显示更新方式
/// </summary>
/// <returns></returns>
private bool ShowUpdateType(LoadData data)
{
UILoadMgr.Show(UIDefine.UILoadUpdate, LoadText.Instance.Label_Load_Checked);
//底包更新
if (data.Type == UpdateType.PackageUpdate)
{
if (true)
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Load_Package, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_DownLoadApk,
() => {
StartUpdate(data.List);
});
}
else
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Load_Plantform, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_DownLoadApk,
() =>
{
//DownLoadPackage();
});
}
return true;
}
//资源更新
else if (data.Type == UpdateType.ResourceUpdate)
{
//强制
if (data.Style == UpdateStyle.Froce)
{
//提示
if (data.Notice == UpdateNotice.Notice)
{
NetworkReachability n = Application.internetReachability;
string desc = LoadText.Instance.Label_Load_Force_WIFI;
if (n == NetworkReachability.ReachableViaCarrierDataNetwork)
{
desc = LoadText.Instance.Label_Load_Force_NO_WIFI;
}
long totalSize = 0;
foreach (var item in data.List)
{
totalSize += item.Size;
}
desc = string.Format(desc, LoaderUtilities.FormatData(totalSize));
LoaderUtilities.ShowMessageBox(desc, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_StartUpdate_Notice,
() =>
{
StartUpdate(data.List);
}, () =>
{
StartGame();
});
}
//不提示
else if (data.Notice == UpdateNotice.NoNotice)
{
StartUpdate(data.List);
}
}
//非强制
else if (data.Style == UpdateStyle.Optional)
{
//提示
if (data.Notice == UpdateNotice.Notice)
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Load_Notice, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_StartUpdate_Notice,
() => {
StartUpdate(data.List);
}, () => {
StartGame();
});
}
//不提示
else if (data.Notice == UpdateNotice.NoNotice)
{
StartUpdate(data.List);
}
}
else
TLogger.LogError("LoadMgr._CheckUpdate, style is error,code:" + data.Style);
return true;
}
//没有更新
return false;
}
/// <summary>
/// 下载结果回调
/// </summary>
/// <param name="result"></param>
/// <param name="status"></param>
/// <param name="files"></param>
public void DownLoadCallBack(int result, GameStatus status, List<LoadResource> files = null)
{
//下载完成
if (result == (int)DownLoadResult.AllDownLoaded)
{
if (_currentType == UpdateType.PackageUpdate)
{
if (true)
{
GameConfig.Instance.SignReInstall();
if (files != null)
{
//InstallApk(_downloadFilePath + files[0].Url);
}
else
{
TLogger.LogError("LoadMgr.DownLoadCallBack, data exception");
}
}
}
else
{
UnpackFiles(_currentData, FileSystem.ResourceRoot, status, _UnPackComplete, (current, total) =>
{
_UnPackCallback(current, status, total);
});
}
_StopLoadingCheck();
}
else
{
_StopLoadingCheck();
//网络发生变化,重试继续下载
if (result == (int)DownLoadResult.NetChanged || result == (int)DownLoadResult.HeadRequestError)
{
_RetryConnect();
return;
}
if (result == (int)DownLoadResult.DownLoadingError ||
result == (int)DownLoadResult.ReceiveNullData ||
result == (int)DownLoadResult.DownError ||
result == (int)DownLoadResult.ReceiveError ||
result == (int)DownLoadResult.Md5Wrong)
{
LoaderUtilities.ShowMessageBox(string.Format(LoadText.Instance.Label_Load_Error, result), MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp,
() => {
Application.Quit();
});
}
}
ResetRetry();
}
/// <summary>
@@ -194,7 +417,7 @@ namespace TEngine
return true;
}
void StartGame()
public void StartGame()
{
if (_startGameEvent != null)
{
@@ -206,7 +429,6 @@ namespace TEngine
{
if (onlineParam == null)
{
return null;
}
var data = new LoadData();
@@ -262,11 +484,17 @@ namespace TEngine
#if UNITY_EDITOR_WIN || _DEVELOPMENT_BUILD_
StartGame();
#else
//TODO
LoaderUtilities.ShowMessageBox("response msg error", MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp,
() =>
{
Application.Quit();
});
#endif
return null;
default:
LoaderUtilities.ShowMessageBox("response msg error", MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp, Application.Quit);
return null;
}
if (GameConfig.Instance.ResId == LatestResId)
@@ -337,5 +565,328 @@ namespace TEngine
return _onlineParamUrl;
}
}
public void StartDownLoad()
{
if (Downloader == null)
return;
if (Downloader.IsLoading())
{
TLogger.LogInfo("Loadermanager.StartUpdatedown loading......");
return;
}
if (_coroutine != null)
{
CoroutineUtility.StopCoroutine(_coroutine);
_coroutine = null;
}
//开始下载
_coroutine = CoroutineUtility.StartCoroutine(Downloader.DownLoad());
LoaderUtilities.DelayFun(() =>
{
if (_load_data_check != null)
{
CoroutineUtility.StopCoroutine(_load_data_check);
}
_load_data_check = CoroutineUtility.StartCoroutine(_StartLoadingCheck());
}, new WaitForSeconds(1));
}
public void StopDownLoad()
{
if (Downloader == null)
return;
Downloader.StopDownLoad();
if (_coroutine == null) return;
CoroutineUtility.StopCoroutine(_coroutine);
_coroutine = null;
}
private void ReleaseLoader()
{
StopDownLoad();
Downloader = null;
}
#region
private long _currentSize;
private int _currentTryCount;
private Action _retryAction;
private IEnumerator _StartLoadingCheck()
{
while (Downloader.IsLoading())
{
_currentSize = Downloader.CurrentLoadSize();
yield return new WaitForSeconds(20);
long newSize = Downloader.CurrentLoadSize();
if (newSize - _currentSize < 1024)
{
StopDownLoad();
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_DownLoadFailed, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_DownZip,
() =>
{
StartDownLoad();
}, () =>
{
Application.Quit();
});
}
else
{
_currentSize = Downloader.CurrentLoadSize();
}
}
}
private void _StopLoadingCheck()
{
if (_load_data_check != null)
{
CoroutineUtility.StopCoroutine(_load_data_check);
}
}
//尝试重连
private void _RetryConnect()
{
if (_retryAction == null)
{
_retryAction = () => {
LoaderUtilities.DelayFun(() =>
{
_currentTryCount++;
UILoadMgr.Show(UIDefine.UILoadUpdate, string.Format(LoadText.Instance.Label_Net_Changed, _currentTryCount));
StartDownLoad();
}, new WaitForSeconds(3));
};
}
if (_currentTryCount >= 3)
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Net_Error, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_DownZip,
() =>
{
_currentTryCount = 0;
_retryAction.Invoke();
}, Quit);
}
else
{
_retryAction.Invoke();
}
}
private void ResetRetry()
{
_currentTryCount = 0;
_retryAction = null;
}
#endregion
/// <summary>
/// 开始更新资源
/// </summary>
public void StartUpdate(List<LoadResource> list)
{
if (list == null || list.Count <= 0)
{
TLogger.LogError("Loadermanager.StartUpdate resource list is empty");
return;
}
//检测内存是否充足
long totalSize = 0;
foreach (var item in list)
{
totalSize += item.Size;
}
if (false)
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Memory_Low_Load, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp,
() => {
Application.Quit();
});
return;
}
Downloader = new DownloadImpl(list, _downloadFilePath, (result, files) =>
{
DownLoadCallBack(result, GameStatus.AssetLoad, files);
});
StartDownLoad();
}
/// <summary>
/// 加压缩进度回调
/// </summary>
/// <param name="current"></param>
/// <param name="status"></param>
/// <param name="total"></param>
private void _UnPackCallback(long current, GameStatus status, long total)
{
float t;
if (total == 0)
t = 0;
else
{
t = (float)current / total;
}
LoadUpdateLogic.Instance._Unpacked_Progress_Action?.Invoke(t, status);
}
/// <summary>
/// 解压缩结束回调
/// </summary>
/// <param name="result"></param>
/// <param name="status"></param>
private void _UnPackComplete(bool result, GameStatus status)
{
if (result)
{
foreach (var item in _currentData.All)
{
if (item.Url == null)
{
continue;
}
LoaderUtilities.DeleteFile(FileSystem.ResourceRoot + "/" + item.Url);
}
try
{
if (string.IsNullOrEmpty(LatestResId))
{
LatestResId = GameConfig.Instance.ResId;
}
GameConfig.Instance.WriteVersion(LatestResId);
FileunzipManager.Instance.CopyMonoAssembly(LatestResId);
}
catch (Exception e)
{
TLogger.LogError(e.StackTrace);
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Load_UnPackError, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_RestartApp,
() =>
{
Application.Quit();
});
return;
}
if (status == GameStatus.AssetLoad)
{
if (_dllLoad == false)
{
StartGame();
}
else
{
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_RestartApp, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_RestartApp,
() =>
{
Quit();
});
}
}
else
{
if (_firstPackageEvent != null)
{
_firstPackageEvent.Invoke();
}
else
{
StartGame();
}
}
}
else
{
if (status == GameStatus.First)
{
LoaderUtilities.DeleteFolder(FileSystem.ResourceRoot);
}
else
{
foreach (var item in _currentData.List)
{
if (item.Url == null)
{
continue;
}
LoaderUtilities.DeleteFile(FileSystem.ResourceRoot + "/" + item.Url);
}
}
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Load_UnPackError, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp,
() => {
Application.Quit();
});
}
}
/// <summary>
/// 解压包
/// </summary>
/// <param name="file">文件地址</param>
/// <param name="dir">解压目录</param>
/// <param name="status"></param>
/// <param name="callback">解压结果回调</param>
/// <param name="progress">解压进度回调</param>
public void UnpackFiles(LoadData file, string dir, GameStatus status, Action<bool, GameStatus> callback, Action<long, long> progress)
{
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
long totalFilesize = 0;
_dllLoad = false;
foreach (var item in file.All)
{
if (_dllLoad == false)
{
_dllLoad = FastZip.entryExists($"{dir}/{item.Url}", FileSystem.DllScriptPkgName);
}
totalFilesize += item.Size;
}
FileunzipManager.Instance.StartFastUnZip(file.All, dir, dir);
CoroutineUtility.StartCoroutine(UpdateProgress(totalFilesize, status, callback, progress));
}
public IEnumerator UpdateProgress(long size, GameStatus status, Action<bool, GameStatus> callback, Action<long, long> progress)
{
long currentProgress;
while (FileunzipManager.Instance.IsRunning())
{
currentProgress = FileunzipManager.Instance.GetProgress();
progress.Invoke(currentProgress, size);
yield return null;
}
currentProgress = FileunzipManager.Instance.GetProgress();
progress.Invoke(currentProgress, size);
yield return null;
yield return null;
yield return null;
callback?.Invoke(FileunzipManager.Instance.UnPackResult(), status);
}
internal void Quit()
{
Application.Quit();
}
}
}

View File

@@ -8,6 +8,7 @@ using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TEngine.UI;
using UnityEngine;
namespace TEngine
@@ -15,25 +16,6 @@ namespace TEngine
public class LoaderUtilities
{
/// <summary>
/// 删除文件
/// </summary>
/// <param name="filePath">文件路径</param>
public static void DeleteFile(string filePath)
{
try
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
catch (Exception e)
{
TLogger.LogError(e.ToString());
}
}
/// <summary>
/// 获取文件的md5码
/// </summary>
@@ -389,5 +371,188 @@ namespace TEngine
string retString = reader.ReadToEnd();
return retString;
}
/// <summary>
/// 删除文件夹
/// </summary>
/// <param name="dir"></param>
public static void DeleteFolder(string dir)
{
try
{
if (!Directory.Exists(dir))
return;
foreach (string d in Directory.GetFileSystemEntries(dir))
{
if (File.Exists(d))
{
FileInfo fi = new FileInfo(d);
if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1)
{
fi.Attributes = FileAttributes.Normal;
}
LoaderUtilities.DeleteFile(d);//直接删除其中的文件
}
else
{
DirectoryInfo d1 = new DirectoryInfo(d);
if (d1.GetFiles().Length != 0)
{
DeleteFolder(d1.FullName);////递归删除子文件夹
}
Directory.Delete(d, true);
}
}
}
catch (Exception e)
{
TLogger.LogError(e.StackTrace.ToString());
throw;
}
}
/// <summary>
/// 删除文件
/// </summary>
/// <param name="filePath">文件路径</param>
public static void DeleteFile(string filePath)
{
try
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
catch (Exception e)
{
TLogger.LogError(e.ToString());
}
}
/// <summary>
/// 显示提示框,目前最多支持三个按钮
/// </summary>
/// <param name="desc">描述</param>
/// <param name="showtype">类型MessageShowType</param>
/// <param name="OnOk">点击事件</param>
/// <param name="OnCancle">取消事件</param>
/// <param name="OnPackage">更新事件</param>
public static void ShowMessageBox(string desc, MessageShowType showtype = MessageShowType.OneButton,
LoadStyle.StyleEnum style = LoadStyle.StyleEnum.Style_Default,
Action OnOk = null,
Action OnCancle = null,
Action OnPackage = null)
{
UILoadMgr.Show(UIDefine.UILoadTip, desc);
var ui = UILoadMgr.GetActiveUI(UIDefine.UILoadTip) as UILoadTip;
if (ui == null) return;
ui.OnOk = OnOk;
ui.OnCancle = OnCancle;
ui.Showtype = showtype;
ui.OnEnter(desc);
var ls = ui.GetComponent<LoadStyle>();
if (ls)
{
ls.SetStyle(style);
}
}
/// <summary>
/// 拷贝文件夹
/// </summary>
/// <param name="srcPath">原目录地址</param>
/// <param name="destPath">目标目录地址</param>
public static void CopyDirectory(string srcPath, string destPath)
{
try
{
if (string.IsNullOrEmpty(srcPath) || !Directory.Exists(srcPath))
{
Debug.LogError("不存在的原目录地址:" + srcPath);
return;
}
if (!Directory.Exists(destPath))
Directory.CreateDirectory(destPath);
var dir = new DirectoryInfo(srcPath);
var fileinfo = dir.GetFileSystemInfos();
foreach (var i in fileinfo)
{
string sub_name = i.Name;
if (i is DirectoryInfo)
{
if (!Directory.Exists($"{destPath}/{sub_name}"))
{
Directory.CreateDirectory($"{destPath}/{sub_name}");
}
CopyDirectory(i.FullName, $"{destPath}/{sub_name}");
}
else
{
File.Copy(i.FullName, $"{destPath}/{sub_name}", true);
}
}
}
catch (Exception e)
{
TLogger.LogError(e.ToString());
throw;
}
}
private static readonly char[] DirectorySeperators =
{
Path.DirectorySeparatorChar,
Path.AltDirectorySeparatorChar,
};
/// <summary>
/// 创建文件夹
/// </summary>
/// <param name="path">目标目录地址</param>
/// <param name="is_last_file"></param>
public static void MakeAllDirectory(string path, bool is_last_file = true)
{
try
{
if (is_last_file)
{
path = Path.GetDirectoryName(path);
}
if (path == null)
return;
var pathFragments = path.Split(DirectorySeperators);
if (pathFragments.Length <= 0)
return;
path = pathFragments[0];
if (path != string.Empty && !Directory.Exists(path))
Directory.CreateDirectory(path);
for (var i = 1; i < pathFragments.Length; i++)
{
path += Path.DirectorySeparatorChar;
string pathFragment = pathFragments[i];
if (string.IsNullOrEmpty(pathFragment))
continue;
path += pathFragment;
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
}
}
catch (Exception e)
{
TLogger.LogError(e.ToString());
throw;
}
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 191f77f88aadf9f41b1a380e343727dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
namespace TEngine.UI
{
public class LoadStyle : MonoBehaviour
{
public Button _btn_ignore;
public Button _btn_update;
public Button _btn_package;
public Text _label_ignore;
public Text _label_update;
public Text _label_package;
private Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>> loadConfig;
private const string ConfigPath = "RawBytes/UIStyle/Style.json";
public enum StyleEnum
{
Style_Default = 0,//Ĭ<><C4AC>
Style_QuitApp = 1,//<2F>˳<EFBFBD>Ӧ<EFBFBD><D3A6>
Style_RestartApp = 2,//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
Style_Retry = 3,//<2F><><EFBFBD><EFBFBD>
Style_StartUpdate_Notice = 4,//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
Style_DownLoadApk = 5,//<2F><><EFBFBD>صװ<D8B5>
Style_Clear = 6,//<2F>޸<EFBFBD><DEB8>ͻ<EFBFBD><CDBB><EFBFBD>
Style_DownZip = 7,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
}
public enum BtnEnum
{
BtnOK = 0, //ȷ<><C8B7><EFBFBD><EFBFBD>ť
BtnIgnore = 1,//ȡ<><C8A1><EFBFBD><EFBFBD>ť
BtnOther = 2, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>ʽ
/// </summary>
private class StyleItem
{
public Alignment Align;//<2F><><EFBFBD>ʽ
public bool Show;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
public string Desc;//<2F><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
}
/// <summary>
/// <20><><EFBFBD>ʽ
/// </summary>
private enum Alignment
{
Left = 0,
Middle = 1,
Right = 2
}
private void Awake()
{
//<2F><><EFBFBD>ð<EFBFBD>ť<EFBFBD><C5A5>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
_label_ignore.text = LoadText.Instance.Label_Btn_Ignore;
_label_update.text = LoadText.Instance.Label_Btn_Update;
_label_package.text = LoadText.Instance.Label_Btn_Package;
InitConfig();
}
private void InitConfig()
{
string url = ResMgr.GetRawBytesFullPath(ConfigPath);
if (!String.IsNullOrEmpty(url))
{
string finalPath = SetFilePath(url);
InitConfigDic(finalPath);
}
}
#region <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
private string SetFilePath(string path)
{
#if UNITY_ANDROID
if (path.StartsWith(Application.persistentDataPath))
path = $"file://{path}";
#elif UNITY_IOS
if (path.StartsWith(Application.persistentDataPath)||path.StartsWith(Application.streamingAssetsPath))
path = $"file://{path}";
#endif
return path;
}
private void InitConfigDic(string path)
{
UnityWebRequest www = UnityWebRequest.Get(path);
UnityWebRequestAsyncOperation request = www.SendWebRequest();
while (!request.isDone)
{
}
if (!String.IsNullOrEmpty(www.downloadHandler.text))
{
loadConfig = JsonConvert.DeserializeObject<Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>>>(www.downloadHandler.text);
}
www.Dispose();
}
#endregion
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
/// </summary>
/// <param name="type"><3E><>ʽ<EFBFBD><CABD>Ӧ<EFBFBD><D3A6>id</param>
public void SetStyle(StyleEnum type)
{
//Ĭ<><C4AC><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ɶҲ<C9B6><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (type == StyleEnum.Style_Default)
return;
if (loadConfig == null)
{
TLogger.LogInfo("LoadConfig is null");
return;
}
var style = loadConfig[type];
if (style == null)
{
TLogger.LogError($"LoadConfig, Can not find type:{type},please check it");
return;
}
SetButtonStyle(style);
}
/// <summary>
/// <20><><EFBFBD>ð<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
private void SetButtonStyle(Dictionary<BtnEnum, StyleItem> list)
{
foreach (var item in list)
{
switch (item.Key)
{
case BtnEnum.BtnOK:
_label_update.text = item.Value.Desc;
_btn_update.gameObject.SetActive(item.Value.Show);
SetButtonPos(item.Value.Align, _btn_update.transform);
break;
case BtnEnum.BtnIgnore:
_label_ignore.text = item.Value.Desc;
_btn_ignore.gameObject.SetActive(item.Value.Show);
SetButtonPos(item.Value.Align, _btn_ignore.transform);
break;
case BtnEnum.BtnOther:
_label_package.text = item.Value.Desc;
_btn_package.gameObject.SetActive(item.Value.Show);
SetButtonPos(item.Value.Align, _btn_package.transform);
break;
}
}
}
/// <summary>
/// <20><><EFBFBD>ð<EFBFBD>ťλ<C5A5><CEBB>
/// </summary>
private void SetButtonPos(Alignment align, Transform item)
{
switch (align)
{
case Alignment.Left:
item.SetSiblingIndex(0);
break;
case Alignment.Middle:
item.SetSiblingIndex(1);
break;
case Alignment.Right:
item.SetSiblingIndex(2);
break;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c56a1db52fd64134881893a68f6e1371
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,131 @@
using UnityEngine;
namespace TEngine.UI
{
public class TextMode
{
public string Label_Load_Progress = "正在下载资源文件,请耐心等待\n当前下载速度{0}/s 资源文件大小:{1}";
public string Label_Load_FirstUnpack = "首次进入游戏,正在初始化游戏资源...(此过程不消耗网络流量)";
public string Label_Load_Unpacking = "正在更新本地资源版本,请耐心等待...(此过程不消耗网络流量)";
public string Label_Load_Checking = "检测版本文件{0}...";
public string Label_Load_Checked = "最新版本检测完成";
public string Label_Load_Package = "当前使用的版本过低,请下载安装最新版本";
public string Label_Load_Plantform = "当前使用的版本过低,请前往应用商店安装最新版本";
public string Label_Load_Notice = "检测到可选资源更新,推荐完成更新提升游戏体验";
public string Label_Load_Force = "检测到版本更新,取消更新将导致无法进入游戏";
public string Label_Load_Force_WIFI =
"检测到有新的游戏内容需要更新,更新包大小<color=#BA3026>{0}</color>, 取消更新将导致无法进入游戏,您当前已为<color=#BA3026>wifi网络</color>,请开始更新";
public string Label_Load_Force_NO_WIFI =
"检测到有新的游戏内容需要更新,更新包大小<color=#BA3026>{0}</color>, 取消更新将导致无法进入游戏,请开始更新";
public string Label_Load_Error = "更新参数错误{0},请点击确定重新启动游戏";
public string Label_Load_FirstEntrerGame_Error = "首次进入游戏资源异常";
public string Label_Load_UnpackComplete = "正在加载最新资源文件...(此过程不消耗网络流量)";
public string Label_Load_UnPackError = "资源解压失败,请点击确定重新启动游戏";
public string Label_Load_Load_Progress = "正在载入...{0}%";
public string Label_Load_Download_Progress = "正在下载...{0}%";
public string Label_Load_Init = "初始化...";
public string Label_Net_UnReachable = "当前网络不可用,请检查本地网络设置";
public string Label_Net_ReachableViaCarrierDataNetwork = "当前是移动网络,是否继续下载";
public string Label_Net_Error = "网络异常,请重试";
public string Label_Net_Changed = "网络切换,正在尝试重连,{0}次";
public string Label_Data_Empty = "数据异常";
public string Label_Memory_Low = "初始化资源加载失败,请检查本地内存是否充足";
public string Label_Memory_Low_Load = "内存是否充足,无法更新";
public string Label_Memory_UnZip_Low = "内存不足,无法解压";
public string Label_App_id = "游戏版本号:{0}";
public string Label_Res_id = "资源版本号:{0}";
public string Label_Clear_Comfirm = "是否清理本地资源?(清理完成后会关闭游戏且重新下载最新资源)";
public string Label_RestartApp = "本次更新需要重启应用,请点击确定重新启动游戏";
public string Label_DownLoadFailed = "网络太慢,是否继续下载";
public string Label_ClearConfig = "清除环境配置,需要重启应用";
public string Label_RegionInfoIllegal = "区服信息为空";
public string Label_RemoteUrlisNull = "热更新服地址为空";
public string Label_FirstPackageNotFound = "首包资源加载失败";
public string Label_RequestReginInfo = "正在请求区服信息{0}次";
public string Label_RequestTimeOut = "请求区服信息超时,是否重试?";
public string Label_Region_ArgumentError = "参数错误";
public string Label_Region_IndexOutOfRange = "索引越界";
public string Label_Region_NonConfigApplication = "未配置此应用";
public string Label_Region_SystemError = "系统异常";
public string Label_PreventionOfAddiction = "著作人权深圳市TEngine有限公司 软著登记号2022SR0000000\n抵制不良游戏拒绝盗版游戏。注意自我保护谨防受骗上当。适度游戏益脑" +
"沉迷游戏伤身。合理安排时间,享受健康生活。";
public string Label_Btn_Update = "确定";
public string Label_Btn_Ignore = "取消";
public string Label_Btn_Package = "更新";
public string Label_Dlc_ConfigVerificateStage = "配置校验中...";
public string Label_Dlc_ConfigLoadingStage = "下载配置中...";
public string Label_Dlc_AssetsLoading = "下载资源中...";
public string Label_Dlc_LoadingFinish = "下载结束";
public string Label_Dlc_Load_Force_WIFI =
"检测到有新的游戏内容需要更新, 取消更新将导致无法进入游戏,您当前已为<color=#BA3026>wifi网络</color>,请开始更新";
public string Label_Dlc_Load_Force_NO_WIFI =
"检测到有新的游戏内容需要更新, 取消更新将导致无法进入游戏,请开始更新";
}
public class LoadText: TextMode
{
private static LoadText _instance;
public static LoadText Instance {
get { return _instance ?? (_instance = new LoadText()); }
}
internal void InitConfigData(TextAsset asset)
{
if (asset == null)
return;
TextMode loadConfig = JsonUtility.FromJson<TextMode>(asset.text);
if (loadConfig != null)
{
Label_Load_Progress = loadConfig.Label_Load_Progress;
Label_Load_FirstUnpack = loadConfig.Label_Load_FirstUnpack;
Label_Load_Unpacking = loadConfig.Label_Load_Unpacking;
Label_Load_Checking = loadConfig.Label_Load_Checking;
Label_Load_Checked = loadConfig.Label_Load_Checked;
Label_Load_Package = loadConfig.Label_Load_Package;
Label_Load_Plantform = loadConfig.Label_Load_Plantform;
Label_Load_Notice = loadConfig.Label_Load_Notice;
Label_Load_Force = loadConfig.Label_Load_Force;
Label_Load_Force_WIFI = loadConfig.Label_Load_Force_WIFI;
Label_Load_Force_NO_WIFI = loadConfig.Label_Load_Force_NO_WIFI;
Label_Load_Error = loadConfig.Label_Load_Error;
Label_Load_FirstEntrerGame_Error = loadConfig.Label_Load_FirstEntrerGame_Error;
Label_Load_UnpackComplete = loadConfig.Label_Load_UnpackComplete;
Label_Load_UnPackError = loadConfig.Label_Load_UnPackError;
Label_Load_Load_Progress = loadConfig.Label_Load_Load_Progress;
Label_Load_Download_Progress = loadConfig.Label_Load_Download_Progress;
Label_Load_Init = loadConfig.Label_Load_Init;
Label_Net_UnReachable = loadConfig.Label_Net_UnReachable;
Label_Net_Error = loadConfig.Label_Net_Error;
Label_Net_Changed = loadConfig.Label_Net_Changed;
Label_Data_Empty = loadConfig.Label_Data_Empty;
Label_Memory_Low = loadConfig.Label_Memory_Low;
Label_Memory_Low_Load = loadConfig.Label_Memory_Low_Load;
Label_Memory_UnZip_Low = loadConfig.Label_Memory_UnZip_Low;
Label_App_id = loadConfig.Label_App_id;
Label_Res_id = loadConfig.Label_Res_id;
Label_Clear_Comfirm = loadConfig.Label_Clear_Comfirm;
Label_RestartApp = loadConfig.Label_RestartApp;
Label_DownLoadFailed = loadConfig.Label_DownLoadFailed;
Label_ClearConfig = loadConfig.Label_ClearConfig;
Label_PreventionOfAddiction = loadConfig.Label_PreventionOfAddiction;
Label_RegionInfoIllegal = loadConfig.Label_RegionInfoIllegal;
Label_RemoteUrlisNull = loadConfig.Label_RemoteUrlisNull;
Label_FirstPackageNotFound = loadConfig.Label_FirstPackageNotFound;
Label_RequestReginInfo = loadConfig.Label_RequestReginInfo;
Label_Net_ReachableViaCarrierDataNetwork = loadConfig.Label_Net_ReachableViaCarrierDataNetwork;
Label_RequestTimeOut = loadConfig.Label_RequestTimeOut;
Label_Region_ArgumentError = loadConfig.Label_Region_ArgumentError;
Label_Region_IndexOutOfRange = loadConfig.Label_Region_IndexOutOfRange;
Label_Region_NonConfigApplication = loadConfig.Label_Region_NonConfigApplication;
Label_Region_SystemError = loadConfig.Label_Region_SystemError;
Label_Btn_Ignore = loadConfig.Label_Btn_Ignore;
Label_Btn_Package = loadConfig.Label_Btn_Package;
Label_Btn_Update = loadConfig.Label_Btn_Update;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 26b25172848a83441b2cfadd771152ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using System;
namespace TEngine.UI
{
public class LoadUpdateLogic
{
private static LoadUpdateLogic _instance;
public Action<int> Download_Complete_Action = null;
public Action<long> Down_Progress_Action = null;
public Action<bool,GameStatus> _Unpacked_Complete_Action = null;
public Action<float,GameStatus> _Unpacked_Progress_Action = null;
public static LoadUpdateLogic Instance
{
get
{
if (_instance == null)
_instance = new LoadUpdateLogic();
return _instance;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4c7fe9e5620ac5d4bae49fbd58746210
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using UnityEngine;
using UnityEditor;
namespace TEngine.UI
{
public class UIBase : MonoBehaviour
{
protected object Param;
virtual public void OnEnter(object param)
{
Param = param;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b150d874e1db306419683d8fb8f50af4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
namespace TEngine.UI
{
public class UIDefine
{
public static readonly string UILoadUpdate = "UILoadUpdate";
public static readonly string UILoadTip = "UILoadTip";
/// <summary>
/// 注册ui
/// </summary>
/// <param name="list"></param>
public static void RegisitUI(Dictionary<string, string> list)
{
if (list == null)
{
TLogger.LogError("[UIManager]list is null");
return;
}
if (!list.ContainsKey(UILoadUpdate))
{
list.Add(UILoadUpdate, $"{FileSystem.AssetFolder}/{UILoadUpdate}");
}
if (!list.ContainsKey(UILoadTip))
{
list.Add(UILoadTip, $"{FileSystem.AssetFolder}/{UILoadTip}");
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8b4a6ad67f754024987f55526fa21034
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,145 @@
using System.Collections.Generic;
using UnityEngine;
namespace TEngine.UI
{
public static class UILoadMgr
{
private static GameObject _uiLoad;
private static Dictionary<string, string> _uiList = new Dictionary<string, string>();
private static readonly Dictionary<string, UIBase> _uiMap = new Dictionary<string, UIBase>();
/// <summary>
/// 初始化根节点
/// </summary>
public static void Initialize()
{
_uiLoad = GameObject.Find(FileSystem.AssetFolder);
if (_uiLoad == null)
{
var obj = Resources.Load($"{FileSystem.AssetFolder}/UILoad");
if (obj == null)
{
TLogger.LogError("Failed to load UILoad. Please check the resource path");
return;
}
_uiLoad = Object.Instantiate(obj) as GameObject;
if (_uiLoad != null)
{
_uiLoad.name = FileSystem.AssetFolder;
_uiLoad.transform.SetAsLastSibling();
}
else
{
TLogger.LogError($"{FileSystem.AssetFolder} object Instantiate Failed");
return;
}
}
RegisitUI();
}
public static void RegisitUI()
{
UIDefine.RegisitUI(_uiList);
}
/// <summary>
/// show ui
/// </summary>
/// <param name="uiinfo">对应的ui</param>
/// <param name="param">参数</param>
public static void Show(string uiinfo,object param = null)
{
if (string.IsNullOrEmpty(uiinfo))
return;
if (!_uiList.ContainsKey(uiinfo))
{
TLogger.LogError($"not define ui:{uiinfo}");
return;
}
GameObject ui = null;
if (!_uiMap.ContainsKey(uiinfo))
{
Object obj = Resources.Load(_uiList[uiinfo]);
if (obj != null)
{
ui = Object.Instantiate(obj) as GameObject;
if (ui != null)
{
ui.transform.SetParent(_uiLoad.transform);
ui.transform.localScale = Vector3.one;
ui.transform.localPosition = Vector3.zero;
RectTransform rect = ui.GetComponent<RectTransform>();
rect.sizeDelta = Vector2.zero;
}
}
UIBase compenent = ui.GetComponent<UIBase>();
if (compenent != null)
{
_uiMap.Add(uiinfo, compenent);
}
}
_uiMap[uiinfo].gameObject.SetActive(true);
if (param != null)
{
UIBase compenent = _uiMap[uiinfo].GetComponent<UIBase>();
if (compenent != null)
{
compenent.OnEnter(param);
}
}
}
/// <summary>
/// 隐藏ui对象
/// </summary>
/// <param name="uiinfo">对应的ui</param>
public static void Hide(string uiinfo)
{
if (string.IsNullOrEmpty(uiinfo))
{
return;
}
if (!_uiMap.ContainsKey(uiinfo))
{
return;
}
_uiMap[uiinfo].gameObject.SetActive(false);
Object.DestroyImmediate(_uiMap[uiinfo].gameObject);
_uiMap.Remove(uiinfo);
}
/// <summary>
/// 获取显示的ui对象
/// </summary>
/// <param name="ui"></param>
/// <returns></returns>
public static UIBase GetActiveUI(string ui)
{
return _uiMap.ContainsKey(ui) ? _uiMap[ui] : null;
}
/// <summary>
/// 隐藏ui管理器
/// </summary>
public static void HideAll()
{
foreach (var item in _uiMap)
{
if (item.Value && item.Value.gameObject)
{
item.Value.gameObject.SetActive(false);
}
}
_uiMap.Clear();
if (_uiLoad != null)
{
Object.Destroy(_uiLoad);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6381a0f5db6b61948a8fcb8176d8019b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
using UnityEngine;
using UnityEngine.UI;
using System;
namespace TEngine.UI
{
public enum MessageShowType
{
None = 0,
OneButton = 1,
TwoButton = 2,
ThreeButton = 3,
}
public class UILoadTip : UIBase
{
public Button _btn_update;
public Button _btn_ignore;
public Button _btn_package;
public Text _label_desc;
public Action OnOk;
public Action OnCancle;
public MessageShowType Showtype = MessageShowType.None;
void Start()
{
EventTriggerListener.Get(_btn_update.gameObject).OnClick = _OnGameUpdate;
EventTriggerListener.Get(_btn_ignore.gameObject).OnClick = _OnGameIgnor;
EventTriggerListener.Get(_btn_package.gameObject).OnClick = _OnInvoke;
}
public override void OnEnter(object data)
{
_btn_ignore.gameObject.SetActive(false);
_btn_package.gameObject.SetActive(false);
_btn_update.gameObject.SetActive(false);
switch (Showtype)
{
case MessageShowType.OneButton:
_btn_update.gameObject.SetActive(true);
break;
case MessageShowType.TwoButton:
_btn_update.gameObject.SetActive(true);
_btn_ignore.gameObject.SetActive(true);
break;
case MessageShowType.ThreeButton:
_btn_ignore.gameObject.SetActive(true);
_btn_package.gameObject.SetActive(true);
_btn_package.gameObject.SetActive(true);
break;
}
_label_desc.text = data.ToString();
}
private void _OnGameUpdate(GameObject obj)
{
if (OnOk == null)
{
_label_desc.text = "<color=#BA3026>该按钮不应该存在</color>";
}
else
{
OnOk();
_OnClose();
}
}
private void _OnGameIgnor(GameObject obj)
{
if (OnCancle == null)
{
_label_desc.text = "<color=#BA3026>该按钮不应该存在</color>";
}
else
{
OnCancle();
_OnClose();
}
}
private void _OnInvoke(GameObject obj)
{
if (OnOk == null)
{
_label_desc.text = "<color=#BA3026>该按钮不应该存在</color>";
}
else
{
OnOk();
_OnClose();
}
}
private void _OnClose()
{
UILoadMgr.Hide(UIDefine.UILoadTip);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d32acf4f4a006a4986b0c39320a1a99
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,156 @@
using System.IO;
using TEngine;
using UnityEngine;
using UnityEngine.PlayerLoop;
using UnityEngine.UI;
namespace TEngine.UI
{
public class UILoadUpdate : UIBase
{
#pragma warning disable 649
[SerializeField]
public Button _btn_clear;
[SerializeField]
public Scrollbar _obj_progress;
[SerializeField]
public Text _label_desc;
[SerializeField]
public Text _label_appid;
[SerializeField]
public Text _label_resid;
#pragma warning restore 649
public virtual void Start()
{
EventTriggerListener.Get(_btn_clear.gameObject).OnClick = OnClear;
_btn_clear.gameObject.SetActive(true);
}
public virtual void OnEnable()
{
LoadUpdateLogic.Instance.Download_Complete_Action += DownLoad_Complete_Action;
LoadUpdateLogic.Instance.Down_Progress_Action += DownLoad_Progress_Action;
LoadUpdateLogic.Instance._Unpacked_Complete_Action += Unpacked_Complete_Action;
LoadUpdateLogic.Instance._Unpacked_Progress_Action += Unpacked_Progress_Action;
RefreshVersion();
}
public override void OnEnter(object param)
{
base.OnEnter(param);
_label_desc.text = param.ToString();
RefreshVersion();
}
public virtual void Update()
{
}
private void RefreshVersion()
{
_label_appid.text = string.Format(LoadText.Instance.Label_App_id, GameConfig.Instance.GameBundleVersion);
_label_resid.text = string.Format(LoadText.Instance.Label_Res_id, GameConfig.Instance.ResId);
}
public virtual void OnContinue(GameObject obj)
{
LoadMgr.Instance.StartDownLoad();
}
public virtual void OnStop(GameObject obj)
{
LoadMgr.Instance.StopDownLoad();
}
/// <summary>
/// 清空本地缓存
/// </summary>
/// <param name="obj"></param>
public virtual void OnClear(GameObject obj)
{
OnStop(null);
LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_Clear_Comfirm, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Clear,
() =>
{
LoaderUtilities.DeleteFolder(FileSystem.ResourceRoot);
Application.Quit();
},()=> {
OnContinue(null);
});
}
/// <summary>
/// 下载进度完成
/// </summary>
/// <param name="type"></param>
public virtual void DownLoad_Complete_Action(int type)
{
}
/// <summary>
/// 下载进度更新
/// </summary>
/// <param name="size"></param>
public virtual void DownLoad_Progress_Action(long size)
{
if (LoadMgr.Instance.Downloader != null)
{
_obj_progress.gameObject.SetActive(true);
_label_desc.text = string.Format(LoadText.Instance.Label_Load_Progress, LoaderUtilities.FormatData(LoadMgr.Instance.Downloader.Speed), LoaderUtilities.FormatData(LoadMgr.Instance.Downloader.FileSize));
float pro = (float)(LoadMgr.Instance.Downloader.DownLoadSize + size) / LoadMgr.Instance.Downloader.FileSize;
_obj_progress.size = pro;
}
}
/// <summary>
/// 解压缩完成回调
/// </summary>
/// <param name="type"></param>
/// <param name="status"></param>
public virtual void Unpacked_Complete_Action(bool type,GameStatus status)
{
_obj_progress.gameObject.SetActive(true);
_label_desc.text = LoadText.Instance.Label_Load_UnpackComplete;
if (status == GameStatus.AssetLoad)
{
LoadMgr.Instance.StartGame();
}
else
{
TLogger.LogError("error emnu type");
}
}
/// <summary>
/// 解压缩进度更新
/// </summary>
/// <param name="progress"></param>
/// <param name="status"></param>
public virtual void Unpacked_Progress_Action(float progress,GameStatus status)
{
_obj_progress.gameObject.SetActive(true);
if (status == GameStatus.First)
{
_label_desc.text = LoadText.Instance.Label_Load_FirstUnpack;
}
else
{
_label_desc.text = LoadText.Instance.Label_Load_Unpacking;
}
_obj_progress.size = progress;
}
public virtual void OnDisable()
{
OnStop(null);
LoadUpdateLogic.Instance.Download_Complete_Action -= DownLoad_Complete_Action;
LoadUpdateLogic.Instance.Down_Progress_Action -= DownLoad_Progress_Action;
LoadUpdateLogic.Instance._Unpacked_Complete_Action -= Unpacked_Complete_Action;
LoadUpdateLogic.Instance._Unpacked_Progress_Action -= Unpacked_Progress_Action;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0fad7cbc10b815488c9e6ebfeccb210
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 295231c456308a3489cdced651aca93f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f982917076a87a479ae4841d2594028
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b56f8e932ff91f14295ddf698182a370
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 87cbb430f94b48d4ab644e722a322048
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e05c782dc204e684aae3f33a6374df84
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: e157dfd997d54274a9af3a43fcc05c0a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARM64
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 38863d726795ebb42bc114993d8cad38
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: e0ac0d8b209d6de42a752b9e7880bb4c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 363f2b1493186de48becf1eed604a2d8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 6f5e23db3d9df934c833d3710f7b60f0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8998cfdd5f0c1a941b7b01932f12c77a
timeCreated: 1567652860
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a76802e8087658142a1770e79001fb80
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 68b7bf2669a4d27419b66f374b51e8b8
timeCreated: 1578624414
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f0a6f4e5067758543af211e78476f046
timeCreated: 1578624414
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,141 @@
fileFormatVersion: 2
guid: 814f74b3a520e6a4399b7349f9eea37a
timeCreated: 1578624414
licenseType: Store
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 0
Exclude Win: 1
Exclude Win64: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: WebGL
second:
enabled: 1
settings: {}
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0d7956afb984bbd4a872305e9060446c
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6eeb9c2cb063f5246a78aa3eb527347d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4867bbb8663ab874b951dc27257f90a6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 94855ec3b9c962e498debc069aa28414
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 7e7c1a50fda7adb4794d0d16d3d49057
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f222dd79909967a4a8c7d20938ff8977
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 95ebaf5d93e8fd144a73b04d303acf24
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,44 @@
fileFormatVersion: 2
guid: d11bfa02d0f12de45a3a51d2f06b59be
folderAsset: yes
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
data:
first:
Standalone: OSXIntel
second:
enabled: 1
settings: {}
data:
first:
Standalone: OSXIntel64
second:
enabled: 1
settings: {}
data:
first:
Standalone: OSXUniversal
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e4ad9bf49a88784ca331bf8121990fc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19H2</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>libzipw</string>
<key>CFBundleIdentifier</key>
<string>com.zipwlib.libzipw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>libzipw</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>10G8</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>18G74</string>
<key>DTSDKName</key>
<string>macosx10.14</string>
<key>DTXcode</key>
<string>1030</string>
<key>DTXcodeBuild</key>
<string>10G8</string>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c86f21f95c516ff4f9a464c02b3f9142
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0c4d8edd6d4e14b4abf69fddfbb960ca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 52d3301f351ed294f98a227f33ab85f6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3937d3ee24e47974085db745e1449425
folderAsset: yes
timeCreated: 1567735096
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cab2b712c38923b4e98b890b50454d7f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: 4a473fefb2d14ed49bab6613f6816b25
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude tvOS: 0
- first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
tvOS: tvOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 37fdb245f2bbb9d4c90c97d057b1caed
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0d16f60a9aa809340a228db1e14a096e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c485bd23c13ffb64ca2e1877fb851d8e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7af8e42eb3bf3974a80b2a00e2315f6d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 216841e2f4169b841a63762297a59899
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 69b2e938d4e7b53439579d2d87b97ec2
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXIntel: 0
Exclude OSXIntel64: 0
Exclude OSXUniversal: 0
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 1
- first:
'': Editor
second:
enabled: 0
settings:
CPU: x86
OS: Windows
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86
DefaultValueInitialized: true
- first:
Facebook: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXIntel
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXIntel64
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: c9097014bda9e224d9bc17361d932bad
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 1
Exclude LinuxUniversal: 0
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
- first:
'': Editor
second:
enabled: 0
settings:
CPU: x86
OS: Linux
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86
DefaultValueInitialized: true
- first:
Facebook: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: None
- first:
WebGL: WebGL
second:
enabled: 0
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 80e52fdbb1d0f4e46bf43d6cbbd076df
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 9e780a1644e034044a7862ef812836f8
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXIntel: 0
Exclude OSXIntel64: 0
Exclude OSXUniversal: 0
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 0
- first:
'': Editor
second:
enabled: 0
settings:
CPU: x86_64
OS: Windows
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: None
- first:
Facebook: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXIntel
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: OSXIntel64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
WebGL: WebGL
second:
enabled: 0
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: b316761f19f6daa479d49fe0e46147f1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
- first:
'': Editor
second:
enabled: 0
settings:
CPU: x86
OS: Linux
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: None
- first:
Facebook: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace TEngine
@@ -299,5 +300,28 @@ namespace TEngine
go.SetActive(isActive);
}
}
/// <summary>
/// 获取RawBytes下资源完整路径
/// </summary>
/// <param name="rawPath">路径会包含RawBytes适应获取资源的其他接口使用习惯</param>
/// <returns></returns>
public static string GetRawBytesFullPath(string rawPath)
{
if (string.IsNullOrEmpty(rawPath))
return rawPath;
#if ASSETBUNDLE_ENABLE
string target = GameConfig.Instance.FilePath($"{FileSystem.ResourceRoot}/{rawPath}");
if (!File.Exists(target))
{
target = $"{FileSystem.ResourceRootInStreamAsset}/{rawPath}";
}
return target;
#else
return $"{Application.dataPath}/TResources/{rawPath}";
#endif
}
}
}