下载资源MD5校验问题修正,支持断点续传

下载资源MD5校验问题修正,支持断点续传
This commit is contained in:
ALEXTANG
2023-02-10 12:11:20 +08:00
parent 1edbfcc086
commit bc5f12ed88
16 changed files with 688 additions and 489 deletions

View File

@@ -336,7 +336,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bc449de9a177d854181ed6d829a72ada, type: 3} m_Script: {fileID: 11500000, guid: bc449de9a177d854181ed6d829a72ada, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ResourceMode: 1 ResourceMode: 2
m_ResourceHelperTypeName: TEngine.Runtime.DefaultResourceHelper m_ResourceHelperTypeName: TEngine.Runtime.DefaultResourceHelper
m_CustomResourceHelper: {fileID: 0} m_CustomResourceHelper: {fileID: 0}
--- !u!1 &3463045026180535776 --- !u!1 &3463045026180535776
@@ -374,6 +374,7 @@ Transform:
- {fileID: 3463045025307533286} - {fileID: 3463045025307533286}
- {fileID: 1672025514} - {fileID: 1672025514}
- {fileID: 96376812} - {fileID: 96376812}
- {fileID: 5650366479353104569}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -427,6 +428,54 @@ MonoBehaviour:
- TEngine.Runtime.ProcedureResourcesInit - TEngine.Runtime.ProcedureResourcesInit
- TEngine.Runtime.ProcedureResourcesUpdate - TEngine.Runtime.ProcedureResourcesUpdate
- TEngine.Runtime.ProcedureResourcesVerify - TEngine.Runtime.ProcedureResourcesVerify
- TEngine.Runtime.ProcedureRunPuerts
- TEngine.Runtime.ProcedureSplash - TEngine.Runtime.ProcedureSplash
- TEngine.Runtime.ProcedureStartGame - TEngine.Runtime.ProcedureStartGame
m_EntranceProcedureTypeName: TEngine.Runtime.ProcedureLaunch m_EntranceProcedureTypeName: TEngine.Runtime.ProcedureLaunch
--- !u!1 &5455811614053608841
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5650366479353104569}
- component: {fileID: 9103295844223457350}
m_Layer: 0
m_Name: PuertsMgr
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5650366479353104569
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5455811614053608841}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3463045026180535779}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9103295844223457350
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5455811614053608841}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7135f85bd7cf44f694f817356b03519e, type: 3}
m_Name:
m_EditorClassIdentifier:
WaitForDebugger: 0
RunOnAwake: 0
DebuggerRoot: G:/1_WorkSpace/TEngine_Custom/Assets/TResource/PuertsScripts
DebuggerPort: 5556

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.IO;
using TEngine.Runtime; using TEngine.Runtime;
using UnityEditor; using UnityEditor;
using UnityEngine;
namespace TEngine.Editor namespace TEngine.Editor
{ {
@@ -74,8 +76,27 @@ namespace TEngine.Editor
public static class CusInjectorDemoEditor public static class CusInjectorDemoEditor
{ {
[TEngineBuilderInjector(BuilderInjectorMoment.BeforeCollect_AssetBundle)]
public static void CopyVersion()
{
var innerVersionFile = UnityEngine.Application.streamingAssetsPath + "/TEngine/version.json";
string path = FileSystem.ResourceRoot + "/" + GameConfig.CONFIG;
if (System.IO.File.Exists(innerVersionFile))
{
FileUtil.DeleteFileOrDirectory(innerVersionFile);
FileUtil.CopyFileOrDirectory(path, innerVersionFile);
}
else
{
FileUtil.CopyFileOrDirectory(path, innerVersionFile);
}
Log.Debug("复制版本信息成功");
}
[TEngineBuilderInjector(BuilderInjectorMoment.AfterBuild_AssetBundle)] [TEngineBuilderInjector(BuilderInjectorMoment.AfterBuild_AssetBundle)]
public static void TestInjector() public static void GenMd5List()
{ {
UnityEngine.Debug.Log($"productName: {PlayerSettings.productName}"); UnityEngine.Debug.Log($"productName: {PlayerSettings.productName}");
UnityEngine.Debug.Log($"version:{GameConfig.Instance.GameBundleVersion}"); UnityEngine.Debug.Log($"version:{GameConfig.Instance.GameBundleVersion}");
@@ -83,6 +104,7 @@ namespace TEngine.Editor
long versionLong = long.Parse(versionStr); long versionLong = long.Parse(versionStr);
UnityEngine.Debug.Log($"versionStr:{versionStr}"); UnityEngine.Debug.Log($"versionStr:{versionStr}");
UnityEngine.Debug.LogError("BuilderInjectorMoment.AfterBuild_AssetBundle"); UnityEngine.Debug.LogError("BuilderInjectorMoment.AfterBuild_AssetBundle");
TEngineCore.Editor.TEngineEditorUtil.GenMd5List();
} }
} }
} }

View File

@@ -1,11 +1,14 @@
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using TEngine; using TEngine;
using TEngine.Editor; using TEngine.Editor;
using TEngine.Runtime; using TEngine.Runtime;
using UnityEditor; using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization; using UnityEngine.Serialization;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
using Type = System.Type; using Type = System.Type;
@@ -110,7 +113,7 @@ namespace TEngineCore.Editor
[FormerlySerializedAs("_scriptingBackend")] [FormerlySerializedAs("_scriptingBackend")]
[SerializeField] [SerializeField]
[BuilderEditor("编译类型", ContentType.Enum, "FlowA:disPlayType:1&platform:0r1r2,CB:SwitchScriptingBackend")] [BuilderEditor("编译类型", ContentType.Enum, "FlowA:disPlayType:1&platform:0r1r2,CB:SwitchScriptingBackend")]
internal BuilderUtility.ScriptBackend scriptingBackend = BuilderUtility.ScriptBackend.Mono; internal BuilderUtility.ScriptBackend scriptingBackend = BuilderUtility.ScriptBackend.IL2CPP;
#endregion #endregion
@@ -215,7 +218,7 @@ namespace TEngineCore.Editor
[FormerlySerializedAs("_ABVersion")] [FormerlySerializedAs("_ABVersion")]
[SerializeField] [SerializeField]
[BuilderEditor("资源版本号", ContentType.TextField, "FlowA:disPlayType:1,CB:ChangeABVersion")] [BuilderEditor("内部资源版本号", ContentType.TextField, "FlowA:disPlayType:1,CB:ChangeABVersion")]
internal string ABVersion = "0"; internal string ABVersion = "0";
[BuilderEditor("15", ContentType.Space)] [BuilderEditor("15", ContentType.Space)]
@@ -233,10 +236,10 @@ namespace TEngineCore.Editor
[BuilderEditor("Gen Md5(生成MD5)", ContentType.Button, ",CB:GenMd5,FlowA:disPlayType:1")] [BuilderEditor("Gen Md5(生成MD5)", ContentType.Button, ",CB:GenMd5,FlowA:disPlayType:1")]
private int genMd5; private int genMd5;
[BuilderEditor("Build", ContentType.Button, "CB:BuildApk")] [BuilderEditor("Build", ContentType.Button, "CB:BuildActive")]
private int build; private int build;
[BuilderEditor("直接出包跳过ab环节", ContentType.Button, "CB:DirectBuildApk,FlowA:disPlayType:1")] [BuilderEditor("直接出包跳过ab环节", ContentType.Button, "CB:DirectBuild,FlowA:disPlayType:1")]
private int directBuild; private int directBuild;
#endregion #endregion
@@ -448,8 +451,8 @@ namespace TEngineCore.Editor
/// <param name="args"></param> /// <param name="args"></param>
private void ChangeProductName(string args) private void ChangeProductName(string args)
{ {
if (!autoUdate) if (!autoUdate)
return; return;
PlayerSettings.productName = args; PlayerSettings.productName = args;
} }
@@ -459,9 +462,10 @@ namespace TEngineCore.Editor
/// <param name="args"></param> /// <param name="args"></param>
private void ChangeBundleVersion(string args) private void ChangeBundleVersion(string args)
{ {
if (!autoUdate) if (!autoUdate)
return; return;
PlayerSettings.bundleVersion = args; PlayerSettings.bundleVersion = args;
GameConfig.Instance.WriteAppVersion(args);
} }
/// <summary> /// <summary>
@@ -470,8 +474,9 @@ namespace TEngineCore.Editor
/// <param name="args"></param> /// <param name="args"></param>
private void ChangeABVersion(string args) private void ChangeABVersion(string args)
{ {
if (!autoUdate) if (!autoUdate)
return; return;
GameConfig.Instance.WriteBaseResVersion(args);
GameConfig.Instance.WriteResVersion(args); GameConfig.Instance.WriteResVersion(args);
} }
@@ -607,7 +612,7 @@ namespace TEngineCore.Editor
destFile = Path.Combine(targetFilePath, fileName); destFile = Path.Combine(targetFilePath, fileName);
File.Copy(s, destFile, true); File.Copy(s, destFile, true);
} }
string[] filefolders = Directory.GetFiles(sourceFilePath); string[] filefolders = Directory.GetFiles(sourceFilePath);
DirectoryInfo dirinfo = new DirectoryInfo(sourceFilePath); DirectoryInfo dirinfo = new DirectoryInfo(sourceFilePath);
@@ -662,7 +667,7 @@ namespace TEngineCore.Editor
ApplyArgs(""); ApplyArgs("");
BuildAssetsCommand.BuildAndCopyABAOTHotUpdateDlls(); BuildAssetsCommand.BuildAndCopyABAOTHotUpdateDlls();
TLogger.LogInfoSuccessd("1.生成DLL的bytes成功"); TLogger.LogInfoSuccessd("1.生成DLL的bytes成功");
AssetDatabase.Refresh(); AssetDatabase.Refresh();
@@ -702,29 +707,22 @@ namespace TEngineCore.Editor
GUIUtility.ExitGUI(); GUIUtility.ExitGUI();
} }
private void BuildApk(string args) private void BuildActive(string args)
{ {
if (EditorApplication.isCompiling) if (EditorApplication.isCompiling)
{ {
EditorUtility.DisplayDialog("Build Apk", "请等待编译完成", "ok"); EditorUtility.DisplayDialog("Build Active", "请等待编译完成", "ok");
return; return;
} }
Save(); Save();
if (bundleVersion.Split('.').Length != 2)
{
Debug.LogError("版本号需要两位(*.*");
return;
}
if (buildType == (BuilderUtility.BuildType)BuilderUtility.BuildType.Editor) if (buildType == (BuilderUtility.BuildType)BuilderUtility.BuildType.Editor)
{ {
Debug.LogError("编辑器模式不支持打包,请看描述"); Debug.LogError("编辑器模式不支持打包,请看描述");
} }
else else
{ {
if (!BuilderUtility.PolicyEasyCheck(builderBundlePolicy, bundleConfig))
if (!BuilderUtility.PolicyEasyCheck(builderBundlePolicy, bundleConfig))
{ {
if (!EditorUtility.DisplayDialog("资源检查警告", "发现策略未覆盖到的资源,是否继续", "继续", "退出打包")) if (!EditorUtility.DisplayDialog("资源检查警告", "发现策略未覆盖到的资源,是否继续", "继续", "退出打包"))
{ {
@@ -734,7 +732,8 @@ namespace TEngineCore.Editor
ApplyArgs(""); ApplyArgs("");
Builder.Instance.SetBuilderConfig(this); Builder.Instance.SetBuilderConfig(this);
Builder.Instance.Build(false); Builder.Instance.BuildActive(false);
} }
@@ -742,25 +741,19 @@ namespace TEngineCore.Editor
} }
/// <summary> /// <summary>
/// 直接打APK /// 直接打包
/// </summary> /// </summary>
/// <param name="args"></param> /// <param name="args"></param>
private void DirectBuildApk(string args) private void DirectBuild(string args)
{ {
if (EditorApplication.isCompiling) if (EditorApplication.isCompiling)
{ {
EditorUtility.DisplayDialog("Direct Build Apk", "请等待编译完成", "ok"); EditorUtility.DisplayDialog("Direct Build", "请等待编译完成", "ok");
return; return;
} }
Save(); Save();
if (bundleVersion.Split('.').Length != 2)
{
Debug.LogError("版本号需要两位(*.*");
return;
}
if (buildType == (BuilderUtility.BuildType)BuilderUtility.BuildType.Editor) if (buildType == (BuilderUtility.BuildType)BuilderUtility.BuildType.Editor)
{ {
Debug.LogError("编辑器模式不支持打包,请看描述"); Debug.LogError("编辑器模式不支持打包,请看描述");
@@ -775,7 +768,7 @@ namespace TEngineCore.Editor
ApplyArgs(""); ApplyArgs("");
Builder.Instance.SetBuilderConfig(this); Builder.Instance.SetBuilderConfig(this);
Builder.Instance.Build(true); Builder.Instance.BuildActive(true);
} }
GUIUtility.ExitGUI(); GUIUtility.ExitGUI();

View File

@@ -35,6 +35,7 @@ namespace TEngine.Runtime
public void Load() public void Load()
{ {
#if ASSETBUNDLE_ENABLE #if ASSETBUNDLE_ENABLE
Log.Debug("AssetBundleData ASSETBUNDLE_ENABLE Mode");
Stream stream = FileSystem.OpenRead(FileSystem.GetAssetBundlePathInVersion(AssetBundleMeta)); Stream stream = FileSystem.OpenRead(FileSystem.GetAssetBundlePathInVersion(AssetBundleMeta));
BinaryReader reader = new BinaryReader(stream); BinaryReader reader = new BinaryReader(stream);
uint resVersion = reader.ReadUInt32(); uint resVersion = reader.ReadUInt32();
@@ -56,7 +57,6 @@ namespace TEngine.Runtime
{ {
assetPaths[j] = reader.ReadString(); assetPaths[j] = reader.ReadString();
_assetPath2BundleDatas.Add(assetPaths[j], bundleName); _assetPath2BundleDatas.Add(assetPaths[j], bundleName);
Log.Error($"Init Ab {assetPaths[j]} bundleName {bundleName}");
} }
depCount = reader.ReadInt32(); depCount = reader.ReadInt32();
if (!_bundleDatas.TryGetValue(bundleName, out assetBundleData)) if (!_bundleDatas.TryGetValue(bundleName, out assetBundleData))
@@ -85,6 +85,8 @@ namespace TEngine.Runtime
} }
} }
stream.Close(); stream.Close();
#else
Log.Debug("AssetBundleData Editor Mode");
#endif #endif
} }

View File

@@ -5,6 +5,11 @@ namespace TEngine.Runtime
{ {
public class DefaultResourceHelper : ResourceHelperBase public class DefaultResourceHelper : ResourceHelperBase
{ {
private void Start()
{
ResMgr.Instance.Active();
}
public override GameObject Load(string path) public override GameObject Load(string path)
{ {
return ResMgr.Instance.Load(path); return ResMgr.Instance.Load(path);

View File

@@ -9,6 +9,7 @@ namespace TEngine.Runtime
public class TResources public class TResources
{ {
private static IResourceHelper m_ResourceHelper; private static IResourceHelper m_ResourceHelper;
public static bool Initalize => m_ResourceHelper != null;
/// <summary> /// <summary>
/// 设置游戏资源加载辅助器。 /// 设置游戏资源加载辅助器。

View File

@@ -236,6 +236,24 @@ namespace TEngine.Runtime
return InitAppVersionInfo(); return InitAppVersionInfo();
} }
/// <summary>
/// 写入App版本号
/// </summary>
/// <param name="appVersion"></param>
public void WriteAppVersion(string appVersion)
{
if (string.IsNullOrEmpty(appVersion))
{
TLogger.LogWarning("ResVersion is null or empty,please check!");
return;
}
_versionConfig.AppVersion = appVersion;
UpdateConfig();
SetLoadFilePath(FileSystem.ResourceRoot, ResId);
TLogger.LogInfo("GameConfig,WriteVersion to sdk:" + GameConfig.Instance.GameBundleVersion);
}
/// <summary> /// <summary>
/// 写入App内部资源版本号 /// 写入App内部资源版本号
/// </summary> /// </summary>

View File

@@ -73,8 +73,6 @@ namespace TEngine.Runtime
{ {
base.OnEnter(procedureOwner); base.OnEnter(procedureOwner);
LoadJobManager.Instance.LoadSceneAsync("L2Scene");
m_procedureOwner = procedureOwner; m_procedureOwner = procedureOwner;
if (!NeedLoadDll) if (!NeedLoadDll)

View File

@@ -8,12 +8,12 @@ namespace TEngine.Runtime
public class ProcedureResourcesInit : ProcedureBase public class ProcedureResourcesInit : ProcedureBase
{ {
public static int OnInitResourceCompleteEvent = StringId.StringToHash("OnInitResourceComplete"); public static int OnInitResourceCompleteEvent = StringId.StringToHash("OnInitResourceComplete");
private bool m_initResourceComplete = false; private bool m_initResourceComplete = false;
protected internal override void OnEnter(IFsm<IProcedureManager> procedureOwner) protected internal override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{ {
ResMgr.Instance.Active();
base.OnEnter(procedureOwner); base.OnEnter(procedureOwner);
GameEvent.AddEventListener(OnInitResourceCompleteEvent, OnInitResourceComplete); GameEvent.AddEventListener(OnInitResourceCompleteEvent, OnInitResourceComplete);
m_initResourceComplete = false; m_initResourceComplete = false;

View File

@@ -4,7 +4,7 @@
{ {
public static readonly int OnStartGame = StringId.StringToHash("TEngineEvent.OnStartGame"); public static readonly int OnStartGame = StringId.StringToHash("TEngineEvent.OnStartGame");
} }
/// <summary> /// <summary>
/// 流程加载器 - 终点StartGame /// 流程加载器 - 终点StartGame
/// </summary> /// </summary>

View File

@@ -1,7 +1,7 @@
{ {
"GameVersion": "0.1.0", "GameVersion": "0.1.0",
"InternalGameVersion": 0, "InternalGameVersion": 0,
"CheckVersionUrl": "http://1.12.241.46:8081/TEngine/Demo/{0}Version.txt", "CheckVersionUrl": "http://127.0.0.1:8081/TEngine/Demo/{0}Version.txt",
"WindowsAppUrl": "https://www.game.com", "WindowsAppUrl": "https://www.game.com",
"MacOSAppUrl": "https://www.game.com", "MacOSAppUrl": "https://www.game.com",
"IOSAppUrl": "https://www.game.com", "IOSAppUrl": "https://www.game.com",

View File

@@ -31,6 +31,8 @@ namespace TEngine.Runtime.HotUpdate
_path = path; _path = path;
_md5 = md5; _md5 = md5;
_path = path + "_md5_" + md5;
var dirPath = Path.GetDirectoryName(_path); var dirPath = Path.GetDirectoryName(_path);
if (dirPath != null) if (dirPath != null)
{ {
@@ -119,7 +121,7 @@ namespace TEngine.Runtime.HotUpdate
_unityWebRequest = null; _unityWebRequest = null;
} }
} }
#region #region
public float Progress => _totalFileSize == 0 ? 0 : ((float)_curFileSize) / _totalFileSize; public float Progress => _totalFileSize == 0 ? 0 : ((float)_curFileSize) / _totalFileSize;
public long TotalSize => _totalFileSize; public long TotalSize => _totalFileSize;

View File

@@ -28,15 +28,15 @@ namespace TEngine.Runtime.HotUpdate
{ {
StartDownLoad = 0, //开始下载 StartDownLoad = 0, //开始下载
HeadRequestFail = 1, //请求头失败 HeadRequestFail = 1, //请求头失败
DownLoadRequestFail = 2, //现在请求失败 DownLoadRequestFail = 2, //现在请求失败
AreadyDownLoaded = 3, //已经下载过而且下载好了 AreadyDownLoaded = 3, //已经下载过而且下载好了
DownLoading = 4, //下载中 DownLoading = 4, //下载中
NetChanged = 5, NetChanged = 5,
DownLoaded = 6, //下载完成 DownLoaded = 6, //下载完成
DownLoadingError = 7,//接收数据的那个过程中出错 DownLoadingError = 7,//接收数据的那个过程中出错
HeadRequestError = 8,//获取下载包大小报错 HeadRequestError = 8,//获取下载包大小报错
ReceiveNullData = 9,//接受到空数据 ReceiveNullData = 9,//接受到空数据
DownError = 10,//数据没有接受完但是isDone为true DownError = 10,//数据没有接受完但是isDone为true
ReceiveError = 11,//接收数据失败 ReceiveError = 11,//接收数据失败
Md5Wrong = 12,//md5错误 Md5Wrong = 12,//md5错误
AllDownLoaded = 13//全部下载完成 AllDownLoaded = 13//全部下载完成
@@ -119,7 +119,7 @@ namespace TEngine.Runtime.HotUpdate
bool _DealWithDownLoadOk(DownLoadResult downloadType, BackgroundDownloadStatus status, LoadResource data) bool _DealWithDownLoadOk(DownLoadResult downloadType, BackgroundDownloadStatus status, LoadResource data)
{ {
string fileLocalPath = _path + data.Url; string fileLocalPath = _path + data.Url + "_md5_" + data.Md5;
if (status == BackgroundDownloadStatus.NetworkError) if (status == BackgroundDownloadStatus.NetworkError)
{ {

View File

@@ -13,7 +13,7 @@ namespace TEngine.Runtime.HotUpdate
/// </summary> /// </summary>
public static void Initialize() public static void Initialize()
{ {
_uiLoad = GameObject.Find(FileSystem.AssetFolder); _uiLoad = GameObject.Find(FileSystem.AssetFolder);
if (_uiLoad == null) if (_uiLoad == null)
{ {
var obj = Resources.Load($"{FileSystem.AssetFolder}/UILoad"); var obj = Resources.Load($"{FileSystem.AssetFolder}/UILoad");
@@ -35,8 +35,8 @@ namespace TEngine.Runtime.HotUpdate
} }
} }
RegisitUI(); RegisitUI();
} }
public static void RegisitUI() public static void RegisitUI()
{ {
UIDefine.RegisitUI(_uiList); UIDefine.RegisitUI(_uiList);
@@ -60,7 +60,7 @@ namespace TEngine.Runtime.HotUpdate
GameObject ui = null; GameObject ui = null;
if (!_uiMap.ContainsKey(uiinfo)) if (!_uiMap.ContainsKey(uiinfo))
{ {
Object obj = Resources.Load(_uiList[uiinfo]); Object obj = Resources.Load(_uiList[uiinfo]);
if (obj != null) if (obj != null)
{ {
@@ -72,14 +72,19 @@ namespace TEngine.Runtime.HotUpdate
ui.transform.localPosition = Vector3.zero; ui.transform.localPosition = Vector3.zero;
RectTransform rect = ui.GetComponent<RectTransform>(); RectTransform rect = ui.GetComponent<RectTransform>();
rect.sizeDelta = Vector2.zero; rect.sizeDelta = Vector2.zero;
} }
} }
UIBase compenent = ui.GetComponent<UIBase>(); UIBase compenent = ui.GetComponent<UIBase>();
if (compenent != null) if (compenent != null)
{ {
_uiMap.Add(uiinfo, compenent); _uiMap.Add(uiinfo, compenent);
} }
}
if (_uiMap[uiinfo] == null || _uiMap[uiinfo].gameObject == null)
{
return;
} }
_uiMap[uiinfo].gameObject.SetActive(true); _uiMap[uiinfo].gameObject.SetActive(true);
if (param != null) if (param != null)
@@ -89,7 +94,7 @@ namespace TEngine.Runtime.HotUpdate
{ {
compenent.OnEnter(param); compenent.OnEnter(param);
} }
} }
} }
/// <summary> /// <summary>
/// 隐藏ui对象 /// 隐藏ui对象
@@ -109,7 +114,7 @@ namespace TEngine.Runtime.HotUpdate
_uiMap[uiinfo].gameObject.SetActive(false); _uiMap[uiinfo].gameObject.SetActive(false);
Object.DestroyImmediate(_uiMap[uiinfo].gameObject); Object.DestroyImmediate(_uiMap[uiinfo].gameObject);
_uiMap.Remove(uiinfo); _uiMap.Remove(uiinfo);
} }
/// <summary> /// <summary>

View File

@@ -2,7 +2,8 @@
"name": "TEngine.Runtime", "name": "TEngine.Runtime",
"rootNamespace": "", "rootNamespace": "",
"references": [ "references": [
"GUID:13ba8ce62aa80c74598530029cb2d649" "GUID:13ba8ce62aa80c74598530029cb2d649",
"GUID:88d491a7059d6f24393c76d9a4cbf684"
], ],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],