暂存修改 尝试添加热重载插件

This commit is contained in:
2024-09-23 22:56:51 +08:00
parent 5b79a2d4bb
commit 8f824e0671
373 changed files with 3835 additions and 5709 deletions

View File

@ -65,6 +65,7 @@ public class DownloadJsonFile
{
if (_request == null && !_done)
{
Debug.Log("DownloadJsonFile Start , URL: " + _uri );
if (_uri == null)
Dispose("DownloadJsonFile uri is not correctly parsed!");
else

View File

@ -1281,6 +1281,7 @@ MonoBehaviour:
receiveLogcatLogsInAndroid: 0
logcatArguments:
avoidScreenCutout: 1
popupAvoidsScreenCutout: 0
maxLogLength: 10000
autoFocusOnCommandInputField: 1
logItemPrefab: {fileID: 11408050, guid: 391be5df5ef62f345bb76a1051c04da7, type: 2}
@ -3105,6 +3106,7 @@ MonoBehaviour:
m_PreferredHeight: -1
m_FlexibleWidth: 2
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &114435636144975300
MonoBehaviour:
m_ObjectHideFlags: 1

View File

@ -1,9 +1,8 @@
fileFormatVersion: 2
guid: 796112823cc06244c9a472de097830dd
timeCreated: 1506408647
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
@ -12,6 +11,8 @@ TextureImporter:
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
@ -27,10 +28,13 @@ TextureImporter:
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: -1
mipBias: -1
wrapMode: 1
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
@ -39,8 +43,9 @@ TextureImporter:
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
@ -52,33 +57,40 @@ TextureImporter:
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag: RuntimeInspector
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,7 @@
// 在AssetBundleManager等资源管理器生成前预先处理资源问题的管理器
// 提前处理资源更新,服务器列表下载等一系列情况
// 注这个东西运作的时候没有AssetBundle没有Lua不要试图做任何相关操作。
using System.Collections.Generic;
using System.Reflection;
using AssetUpdate;
@ -17,28 +18,37 @@ public class AssetUpdateManager : MonoBehaviour
private IAssetAsyncAction _currentAction;
public static Assembly dllAssembly { get; private set; }
public static string channel { get; private set; }
private static string _channel;
public static string channel
{
get { return _channel; }
private set { _channel = value; }
}
public static string assetVersionUri { get; private set; }
public static bool useResources
{
get { return _useResources; }
}
private static bool _useResources = true;
public AssetUpdateState state { get; private set; }
public AssetUpdateError error { get; private set; }
public static string assetUri { get; private set; }
public static int assetVersion { get; private set; }
public static string apkUri { get; private set; }
public static string apkVersion { get; private set; }
public AssetUpdateState state { get; private set; }
public AssetUpdateError error { get; private set; }
public static string assetUri { get; private set; }
public static int assetVersion { get; private set; }
public static string apkUri { get; private set; }
public static string apkVersion { get; private set; }
public List<AssetDependencyItem> downloadList { get; private set; }
public AssetDependencyInfo mainInfo { get; private set; }
public List<AssetDependencyItem> downloadList { get; private set; }
public AssetDependencyInfo mainInfo { get; private set; }
public Dictionary<string, string> streamingPathInfo { get; private set; }
private const string currentVersionPref = "CurrentVersion";
public static int LoadCurrentVersion()
{
var currentVersion = PlayerPrefs.GetInt(currentVersionPref, default(int));
@ -49,6 +59,7 @@ public class AssetUpdateManager : MonoBehaviour
if (int.TryParse(versionFile, out version))
currentVersion = version;
}
return currentVersion;
}
@ -56,10 +67,10 @@ public class AssetUpdateManager : MonoBehaviour
{
PlayerPrefs.SetInt(currentVersionPref, assetVersion);
}
private void Awake()
{
Debug.Log( "AssetUpdateManager Awake" );
Debug.Log("AssetUpdateManager Awake");
_useResources = false;
AssetUpdateDownloaderTick.CreateInstance();
if (!FirstSceneBg.instance)
@ -80,7 +91,7 @@ public class AssetUpdateManager : MonoBehaviour
private void OnConfigLoad(WWW www)
{
var text = string.IsNullOrEmpty(www.error) ? www.text : string.Empty;
var text = string.IsNullOrEmpty(www.error) ? www.text : string.Empty;
var channelError = false;
if (string.IsNullOrEmpty(text))
channelError = true;
@ -91,7 +102,7 @@ public class AssetUpdateManager : MonoBehaviour
channelError = true;
else
{
channel = lines[0].Trim();
channel = lines[0].Trim();
assetVersionUri = lines[1].Trim();
if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(assetVersionUri))
channelError = true;
@ -102,7 +113,8 @@ public class AssetUpdateManager : MonoBehaviour
FirstSceneBg.instance.SetPublishText(extra);
}
}
}
}
if (channelError)
Debug.LogError("Unable to Parse Channel file! This is not recoverable!");
else
@ -110,21 +122,23 @@ public class AssetUpdateManager : MonoBehaviour
// 清理上次执行残留的rawJsonText
// 当前项目没有类似数据缓存库一样的类,暂时直接用静态传递
assetUri = string.Empty;
state = AssetUpdateState.GetUpdateInfo;
state = AssetUpdateState.GetUpdateInfo;
StartCurrentAction();
}
FirstSceneBg.instance.ShowGameVersion();
// 清理上次执行残留的rawJsonText
// 当前项目没有类似数据缓存库一样的类,暂时直接用静态传递
assetUri = string.Empty;
state = AssetUpdateState.GetUpdateInfo;
state = AssetUpdateState.GetUpdateInfo;
StartCurrentAction();
}
private void Start()
{
// 特别处理Android Resume时期的诡异情况该状况下AssetBundle未被清空但实际Bundle管理器已被析构
AssetBundle.UnloadAllAssetBundles(true);
Debug.Log("加载渠道文件" + _channelConfig);
AssetUpdateDownloaderTick.instance.LoadStreamingAsset(_channelConfig, OnConfigLoad);
}
@ -196,9 +210,10 @@ public class AssetUpdateManager : MonoBehaviour
else
jsonAssetInfo = JsonAssetInfo.Create(httpAction.jsonData);
}
return jsonAssetInfo;
}
private void EndCurrentAction()
{
error = AssetUpdateError.UnknownError;
@ -215,10 +230,10 @@ public class AssetUpdateManager : MonoBehaviour
Debug.LogError("Failed to convert jsonData to JsonAssetInfo");
else
{
assetUri = jsonAssetInfo.assetUri;
assetUri = jsonAssetInfo.assetUri;
assetVersion = jsonAssetInfo.assetVersion;
apkUri = jsonAssetInfo.apkUri;
apkVersion = jsonAssetInfo.apkVersion;
apkUri = jsonAssetInfo.apkUri;
apkVersion = jsonAssetInfo.apkVersion;
error = apkVersion == Application.version
? AssetUpdateError.Success
: AssetUpdateError.ApkUpdate;
@ -242,9 +257,9 @@ public class AssetUpdateManager : MonoBehaviour
var assetCompareAction = ConvertAction<AssetCompareAction>(_currentAction);
if (assetCompareAction != null)
{
downloadList = assetCompareAction.downloadList;
downloadList = assetCompareAction.downloadList;
streamingPathInfo = assetCompareAction.streamingPathInfo;
error = AssetUpdateError.Success;
error = AssetUpdateError.Success;
}
}
break;
@ -276,25 +291,25 @@ public class AssetUpdateManager : MonoBehaviour
case AssetUpdateError.AssetJsonError:
{
LiteConfirmWin.Open("资源同步错误", "无法获得服务器文件版本号!\n请在网络通畅的情况下再次尝试",
new LiteConfirmButtonData("确定", RestartProcess));
new LiteConfirmButtonData("确定", RestartProcess));
}
break;
case AssetUpdateError.VersionDataError:
{
LiteConfirmWin.Open("资源清单错误", "无法获得正确的服务器文件清单!\n请在网络通畅的情况下再次尝试",
new LiteConfirmButtonData("确定", RestartProcess));
new LiteConfirmButtonData("确定", RestartProcess));
}
break;
case AssetUpdateError.DownloadError:
{
LiteConfirmWin.Open("资源下载错误", "无法下载所需文件!\n请在网络通畅的情况下再次尝试",
new LiteConfirmButtonData("确定", RestartProcess));
new LiteConfirmButtonData("确定", RestartProcess));
}
break;
case AssetUpdateError.FileCreateError:
{
LiteConfirmWin.Open("读写错误", "无法更新资源文件!\n请检查硬盘容量并确保游戏拥有响应读写权限",
new LiteConfirmButtonData("确定", RestartProcess));
new LiteConfirmButtonData("确定", RestartProcess));
}
break;
case AssetUpdateError.ApkError:
@ -313,7 +328,7 @@ public class AssetUpdateManager : MonoBehaviour
{
Debug.LogError(string.Format("Unhandled error type {0} in HandleStateError", error));
LiteConfirmWin.Open("网络错误", "无法获得服务器列表\n请在网络通畅的情况下再次尝试",
new LiteConfirmButtonData("确定", RestartProcess));
new LiteConfirmButtonData("确定", RestartProcess));
}
break;
}
@ -336,9 +351,9 @@ public class AssetUpdateManager : MonoBehaviour
public static void OpenApkUri(string uri)
{
LiteConfirmWin.Open("安装包更新", "点击确定从商店下载最新版本的游戏安装包!\n" + uri,
new LiteConfirmButtonData("确定", () => OnApkUpdateConfirm(uri)));
new LiteConfirmButtonData("确定", () => OnApkUpdateConfirm(uri)));
}
private void RestartProcess()
{
SceneHub.LoadScene(SceneHub.GetActiveScene().name);
@ -370,6 +385,7 @@ public class AssetUpdateManager : MonoBehaviour
private void TryToEndProcess()
{
// if (_complete && _ui.complete) EndProcess();
GameObject.DestroyObject(this);
if (state == AssetUpdateState.Complete)
StartGame();
}