From e4e502816f0641ee6b76cfae38f290ba8b803af1 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 22 五月 2025 18:12:17 +0800
Subject: [PATCH] 登录流程前的所有预备流程
---
Assets/Launch/Common/ResourcesPath.cs | 2
Assets/Resources/VersionConfig.asset | 36 +++
Assets/Launch/Common/DownLoadAndDiscompressTask.cs | 225 +++++++++---------
Assets/Resources/Scenes/Launch.unity | 111 ---------
Assets/Resources/VersionConfigEx.txt | 2
Assets/Launch/Launch.cs | 33 ++
Assets/Launch/UI/LaunchWins/LaunchLoadingWin.cs | 156 +++++++++++-
Assets/Resources/VersionConfig.asset.meta | 8
Assets/Launch/Config/InitialFunctionConfig.cs | 3
Assets/Editor/ConfigGen/ConfigDataTemplate.txt | 6
Assets/Editor/UI/PSDTOUGUIProcessor.cs | 91 +++++++
11 files changed, 424 insertions(+), 249 deletions(-)
diff --git a/Assets/Editor/ConfigGen/ConfigDataTemplate.txt b/Assets/Editor/ConfigGen/ConfigDataTemplate.txt
index 18b6bd7..aa8895a 100644
--- a/Assets/Editor/ConfigGen/ConfigDataTemplate.txt
+++ b/Assets/Editor/ConfigGen/ConfigDataTemplate.txt
@@ -23,7 +23,13 @@
public override void LoadConfig(string input)
{
+ try {
string[] tables = input.Split('\t');
#Read#
+ }
+ catch (Exception exception)
+ {
+ Debug.LogError(exception);
+ }
}
}
diff --git a/Assets/Editor/UI/PSDTOUGUIProcessor.cs b/Assets/Editor/UI/PSDTOUGUIProcessor.cs
index f95457b..42da342 100644
--- a/Assets/Editor/UI/PSDTOUGUIProcessor.cs
+++ b/Assets/Editor/UI/PSDTOUGUIProcessor.cs
@@ -4,6 +4,8 @@
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
+using System.IO;
+using System.Text;
public class PSDTOUGUIProcessor
{
@@ -47,4 +49,93 @@
g.raycastTarget = false;
}
}
+
+ [UnityEditor.MenuItem("GameObject/鐢熸垚UI鑴氭湰", false, 10)]
+ public static void GenerateUIScript()
+ {
+ GameObject go = Selection.activeGameObject;
+ if (go == null)
+ {
+ Debug.LogError("璇峰厛閫夋嫨涓�涓狦ameObject");
+ return;
+ }
+
+ string className = go.name;
+ string targetFolder = Path.Combine(Application.dataPath, "Scripts/Main/UI");
+
+ // 纭繚鐩爣鏂囦欢澶瑰瓨鍦�
+ if (!Directory.Exists(targetFolder))
+ {
+ Directory.CreateDirectory(targetFolder);
+ }
+
+ string filePath = Path.Combine(targetFolder, className + ".cs");
+
+ // 妫�鏌ユ枃浠舵槸鍚﹀凡瀛樺湪
+ if (File.Exists(filePath))
+ {
+ if (!EditorUtility.DisplayDialog("鏂囦欢宸插瓨鍦�", $"鏂囦欢 {className}.cs 宸插瓨鍦紝鏄惁瑕嗙洊锛�", "瑕嗙洊", "鍙栨秷"))
+ {
+ return;
+ }
+ }
+
+ // 鐢熸垚鑴氭湰鍐呭
+ StringBuilder sb = new StringBuilder();
+ sb.AppendLine("using UnityEngine;");
+ sb.AppendLine("using System.Collections;");
+ sb.AppendLine("using System.Collections.Generic;");
+ sb.AppendLine("using UnityEngine.UI;");
+ sb.AppendLine("using DG.Tweening;");
+ sb.AppendLine("using Cysharp.Threading.Tasks;");
+ sb.AppendLine("");
+ sb.AppendLine($"public class {className} : UIBase");
+ sb.AppendLine("{");
+ sb.AppendLine(" // 缁勪欢寮曠敤");
+ sb.AppendLine("");
+ sb.AppendLine(" // 鐢熷懡鍛ㄦ湡");
+ sb.AppendLine(" protected override void Awake()");
+ sb.AppendLine(" {");
+ sb.AppendLine(" base.Awake();");
+ sb.AppendLine(" // 鍒濆鍖栫粍浠跺紩鐢�");
+ sb.AppendLine(" }");
+ sb.AppendLine("");
+ sb.AppendLine(" protected override void Start()");
+ sb.AppendLine(" {");
+ sb.AppendLine(" base.Start();");
+ sb.AppendLine(" // 鍒濆鍖栨暟鎹�");
+ sb.AppendLine(" }");
+ sb.AppendLine("");
+ sb.AppendLine(" // UI浜嬩欢");
+ sb.AppendLine(" protected override void OnOpen()");
+ sb.AppendLine(" {");
+ sb.AppendLine(" base.OnOpen();");
+ sb.AppendLine(" // 绐楀彛鎵撳紑鏃剁殑閫昏緫");
+ sb.AppendLine(" }");
+ sb.AppendLine("");
+ sb.AppendLine(" protected override void OnClose()");
+ sb.AppendLine(" {");
+ sb.AppendLine(" base.OnClose();");
+ sb.AppendLine(" // 绐楀彛鍏抽棴鏃剁殑閫昏緫");
+ sb.AppendLine(" }");
+ sb.AppendLine("");
+ sb.AppendLine(" public override void Refresh()");
+ sb.AppendLine(" {");
+ sb.AppendLine(" base.Refresh();");
+ sb.AppendLine(" // 鍒锋柊UI鏄剧ず");
+ sb.AppendLine(" }");
+ sb.AppendLine("}");
+
+ // 鍐欏叆鏂囦欢
+ File.WriteAllText(filePath, sb.ToString(), Encoding.UTF8);
+
+ Debug.Log($"UI鑴氭湰宸茬敓鎴�: {filePath}");
+
+ // 鍒锋柊璧勬簮鏁版嵁搴撲互鏄剧ず鏂版枃浠�
+ AssetDatabase.Refresh();
+
+ // 鎵撳紑鐢熸垚鐨勮剼鏈�
+ UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(filePath, 1);
+
+ }
}
\ No newline at end of file
diff --git a/Assets/Launch/Common/DownLoadAndDiscompressTask.cs b/Assets/Launch/Common/DownLoadAndDiscompressTask.cs
index cd5002b..e1d806a 100644
--- a/Assets/Launch/Common/DownLoadAndDiscompressTask.cs
+++ b/Assets/Launch/Common/DownLoadAndDiscompressTask.cs
@@ -3,148 +3,143 @@
using UnityEngine;
using System;
using LaunchCommon;
+using Cysharp.Threading.Tasks;
- public class DownLoadAndDiscompressTask : Singleton<DownLoadAndDiscompressTask>
+public class DownLoadAndDiscompressTask : Singleton<DownLoadAndDiscompressTask>
+{
+ public const int BYTE_PER_KILOBYTE = 1024;
+ public float progress { get { return Mathf.Clamp01((float)DownloadMgr.Instance.DownloadedBytes / totalSize); } }
+
+ List<AssetVersion> tasks = new List<AssetVersion>();
+ public bool isDone { get { return step == Step.Completed; } }
+ public int totalSize { get; private set; }
+ public int totalCount { get; private set; }
+
+ public event Action<Step> downLoadStepChangeEvent;
+
+ Action downLoadOkCallBack;
+
+ Step m_Step = Step.None;
+ public Step step
{
- public const int BYTE_PER_KILOBYTE = 1024;
-
- public float progress { get { return Mathf.Clamp01((float)DownloadMgr.Instance.DownloadedBytes / totalSize); } }
-
- List<AssetVersion> tasks = new List<AssetVersion>();
- public bool isDone { get { return step == Step.Completed; } }
- public int totalSize { get; private set; }
- public int totalCount { get; private set; }
-
- public event Action<Step> downLoadStepChangeEvent;
-
- Action downLoadOkCallBack;
-
- Step m_Step = Step.None;
- public Step step
+ get { return m_Step; }
+ set
{
- get { return m_Step; }
- set
+ if (m_Step != value)
{
- if (m_Step != value)
- {
- m_Step = value;
+ m_Step = value;
- if (downLoadStepChangeEvent != null)
- {
- downLoadStepChangeEvent(m_Step);
- }
+ if (downLoadStepChangeEvent != null)
+ {
+ downLoadStepChangeEvent(m_Step);
}
}
}
+ }
- public void Prepare(List<AssetVersion> _downLoadTasks, Action _downLoadOkCallBack)
+ public void Prepare(List<AssetVersion> _downLoadTasks, Action _downLoadOkCallBack)
+ {
+ tasks = _downLoadTasks;
+ downLoadOkCallBack = _downLoadOkCallBack;
+
+ totalCount = tasks.Count;
+ step = Step.DownLoadPrepared;
+ totalSize = 0;
+
+ for (int i = 0; i < tasks.Count; i++)
{
- tasks = _downLoadTasks;
- downLoadOkCallBack = _downLoadOkCallBack;
+ var task = tasks[i];
+ totalSize += task.size;
+ }
- totalCount = tasks.Count;
- step = Step.DownLoadPrepared;
- totalSize = 0;
+ StartDownLoad();
+ }
+ public void StartDownLoad()
+ {
+ step = Step.DownLoad;
+ Co_StartDownLoad().Forget();
+ }
+
+ async UniTask Co_StartDownLoad()
+ {
+ int downLoadTryCount = 0;
+ List<bool> checkDownFile = new List<bool>();
+ while (tasks.Count > 0)
+ {
+ DownloadMgr.MaxDownLoadTask = 10;
+ DownloadMgr.Instance.Prepare();
for (int i = 0; i < tasks.Count; i++)
{
- var task = tasks[i];
- totalSize += task.size;
+ var assetVersion = tasks[i];
+ var remoteURL = StringUtility.Contact(LocalResManager.Instance.versionInfo.GetResourcesURL(VersionConfigEx.Get().branch), LocalResManager.fixPath, "/", assetVersion.relativePath);
+ var localURL = StringUtility.Contact(LocalResManager.Instance.ExternalStorePath, assetVersion.relativePath);
+ DownloadMgr.Instance.AddTask(new DownloadTask(remoteURL, localURL));
}
- StartDownLoad();
+ DownloadMgr.Instance.Begin();
- }
-
- public void StartDownLoad()
- {
- step = Step.DownLoad;
- DownloadMgr.Instance.StartCoroutine(Co_StartDownLoad());
-
- }
-
- IEnumerator Co_StartDownLoad()
- {
- int downLoadTryCount = 0;
- List<bool> checkDownFile = new List<bool>();
- while (tasks.Count > 0)
+ while (!DownloadMgr.Instance.IsFinished)
{
- DownloadMgr.MaxDownLoadTask = 10;
- DownloadMgr.Instance.Prepare();
- for (int i = 0; i < tasks.Count; i++)
- {
- var assetVersion = tasks[i];
- var remoteURL = StringUtility.Contact(LocalResManager.Instance.versionInfo.GetResourcesURL(VersionConfigEx.Get().branch), LocalResManager.fixPath, "/", assetVersion.relativePath);
- var localURL = StringUtility.Contact(LocalResManager.Instance.ExternalStorePath, assetVersion.relativePath);
- DownloadMgr.Instance.AddTask(new DownloadTask(remoteURL, localURL));
- }
-
- DownloadMgr.Instance.Begin();
-
- while (!DownloadMgr.Instance.IsFinished)
- {
- yield return null;
- }
-
- checkDownFile = new List<bool>();
- //妫�鏌ヤ笅杞藉畬鎴愬悗鐨勬枃浠舵槸鍚︽湁鏁�
- var filledTasks = new List<AssetVersion>();//鏃犳晥鐨勬枃浠�
- for (int i = 0; i < tasks.Count; i++)
- {
- var assetVersion = tasks[i];
- var correctFile = assetVersion.CheckLocalFileValid(checkDownFile);
- if (correctFile)
- assetVersion.localValid = true;
- else
- filledTasks.Add(assetVersion);
- }
-
- if (filledTasks.Count > 0)
- {
- //鏂囦欢澶у皬鎴栬�匨D5涓嶅锛�1. cdn璧勬簮纭疄閿欒 2.cdn鎺ㄩ�佽繃绋嬩腑 鏂囦欢涓嶅尮閰�
- //闇�瑕侀噸鏂颁笅杞絃ogicVersion鏂囦欢
- if (checkDownFile.Count > 0)
- {
- downLoadTryCount++;
- }
- Debug.LogErrorFormat("璧勬簮涓嬭浇瀹屽悗鏈墈0}涓枃浠舵棤鏁�({1})锛岄噸鏂板紑濮嬩笅杞�", filledTasks.Count, filledTasks[0].fileName);
-
- }
- tasks = filledTasks;
- if (downLoadTryCount >= 1)
- {
- LocalResManager.step = LocalResManager.LoadDllStep.PrepareDownLoad;
- break;
- }
+ await UniTask.Yield();
}
+ checkDownFile = new List<bool>();
+ //妫�鏌ヤ笅杞藉畬鎴愬悗鐨勬枃浠舵槸鍚︽湁鏁�
+ var filledTasks = new List<AssetVersion>();//鏃犳晥鐨勬枃浠�
+ for (int i = 0; i < tasks.Count; i++)
+ {
+ var assetVersion = tasks[i];
+ var correctFile = assetVersion.CheckLocalFileValid(checkDownFile);
+ if (correctFile)
+ assetVersion.localValid = true;
+ else
+ filledTasks.Add(assetVersion);
+ }
+
+ if (filledTasks.Count > 0)
+ {
+ //鏂囦欢澶у皬鎴栬�匨D5涓嶅锛�1. cdn璧勬簮纭疄閿欒 2.cdn鎺ㄩ�佽繃绋嬩腑 鏂囦欢涓嶅尮閰�
+ //闇�瑕侀噸鏂颁笅杞絃ogicVersion鏂囦欢
+ if (checkDownFile.Count > 0)
+ {
+ downLoadTryCount++;
+ }
+ Debug.LogErrorFormat("璧勬簮涓嬭浇瀹屽悗鏈墈0}涓枃浠舵棤鏁�({1})锛岄噸鏂板紑濮嬩笅杞�", filledTasks.Count, filledTasks[0].fileName);
+ }
+ tasks = filledTasks;
if (downLoadTryCount >= 1)
{
- Debug.LogError("logic璧勬簮涓嬭浇澶辫触锛岃鍛婃彁绀猴紝閫�鍑哄崗绋�");
- LocalResManager.downLoadCount++;
- yield break;
+ LocalResManager.step = LocalResManager.LoadDllStep.PrepareDownLoad;
+ break;
}
-
- Debug.Log("璧勬簮鍏ㄩ儴涓嬭浇瀹屾垚");
-
- step = Step.Completed;
-
- if (downLoadOkCallBack != null)
- {
- downLoadOkCallBack();
- downLoadOkCallBack = null;
- }
-
}
- public enum Step
+ if (downLoadTryCount >= 1)
{
- None,
- DownLoadPrepared,
- DownLoad,
- Completed,
+ Debug.LogError("logic璧勬簮涓嬭浇澶辫触锛岃鍛婃彁绀猴紝閫�鍑哄崗绋�");
+ LocalResManager.downLoadCount++;
+ return;
}
- }
\ No newline at end of file
+ Debug.Log("璧勬簮鍏ㄩ儴涓嬭浇瀹屾垚");
+
+ step = Step.Completed;
+
+ if (downLoadOkCallBack != null)
+ {
+ downLoadOkCallBack();
+ downLoadOkCallBack = null;
+ }
+ }
+
+ public enum Step
+ {
+ None,
+ DownLoadPrepared,
+ DownLoad,
+ Completed,
+ }
+}
\ No newline at end of file
diff --git a/Assets/Launch/Common/ResourcesPath.cs b/Assets/Launch/Common/ResourcesPath.cs
index 63dea84..1e2efa2 100644
--- a/Assets/Launch/Common/ResourcesPath.cs
+++ b/Assets/Launch/Common/ResourcesPath.cs
@@ -37,7 +37,7 @@
public static readonly string UI_FONT_SUFFIX = "UI/Font";
public static readonly string UI_PREFAB_SUFFIX = "UI/Prefab";
- public static readonly string CONFIG_FODLER = ResourcesOutPath + "Config/Configs/";
+ public static readonly string CONFIG_FODLER = ResourcesOutPath + "Config/";
public static readonly string AUDIO_SUFFIX = "Audio/";
public static readonly string VIDEO_SUFFIX = "Video/";
diff --git a/Assets/Launch/Config/InitialFunctionConfig.cs b/Assets/Launch/Config/InitialFunctionConfig.cs
index 0896432..2913c7d 100644
--- a/Assets/Launch/Config/InitialFunctionConfig.cs
+++ b/Assets/Launch/Config/InitialFunctionConfig.cs
@@ -8,6 +8,8 @@
using System;
using UnityEngine;
+namespace LaunchCommon
+{
public class InitialFunctionConfig
{
@@ -147,3 +149,4 @@
}
}
+}
\ No newline at end of file
diff --git a/Assets/Launch/Launch.cs b/Assets/Launch/Launch.cs
index 9480f8e..4fa543b 100644
--- a/Assets/Launch/Launch.cs
+++ b/Assets/Launch/Launch.cs
@@ -10,6 +10,7 @@
using System.Reflection;
using UnityEngine.Networking;
using LaunchCommon;
+using HybridCLR;
public class Launch : MonoBehaviour
{
@@ -58,13 +59,13 @@
async void Start()
{
Debug.Log("Launch Start");
+
+ LaunchLoadingWin.OpenWindow();
InitPlugins();
InitSetting();
- SDKInit();
// 1. 鎵撳紑鍔犺浇鐣岄潰
- LaunchLoadingWin.OpenWindow();
}
private void InitSetting()
@@ -87,7 +88,6 @@
LocalResManager.Instance.InitTable(() =>
{
LocalResManager.Instance.InitDefaultLanguage();
- LaunchLoadingWin.OpenWindow();
// LocalResManager.Instance.OpenWindow("LaunchExWin", m_UICanvas);
#if !UNITY_EDITOR
LocalResManager.step = LocalResManager.LoadDllStep.RequestVersion;
@@ -114,6 +114,31 @@
}
+ /// <summary>
+ /// 涓篴ot assembly鍔犺浇鍘熷metadata锛� 杩欎釜浠g爜鏀綼ot鎴栬�呯儹鏇存柊閮借銆�
+ /// 涓�鏃﹀姞杞藉悗锛屽鏋淎OT娉涘瀷鍑芥暟瀵瑰簲native瀹炵幇涓嶅瓨鍦紝鍒欒嚜鍔ㄦ浛鎹负瑙i噴妯″紡鎵ц
+ /// </summary>
+ private void LoadMetadataForAOTAssemblies()
+ {
+ /// 娉ㄦ剰锛岃ˉ鍏呭厓鏁版嵁鏄粰AOT dll琛ュ厖鍏冩暟鎹紝鑰屼笉鏄粰鐑洿鏂癲ll琛ュ厖鍏冩暟鎹��
+ /// 鐑洿鏂癲ll涓嶇己鍏冩暟鎹紝涓嶉渶瑕佽ˉ鍏咃紝濡傛灉璋冪敤LoadMetadataForAOTAssembly浼氳繑鍥為敊璇�
+ ///
+ HomologousImageMode mode = HomologousImageMode.SuperSet;
+ foreach (var aotDllName in AOTMetaAssemblyFiles)
+ {
+ if (aotDllName == "Main.dll.bytes")
+ continue;
+ // 鍔犺浇assembly瀵瑰簲鐨刣ll锛屼細鑷姩涓哄畠hook銆備竴鏃ot娉涘瀷鍑芥暟鐨刵ative鍑芥暟涓嶅瓨鍦紝鐢ㄨВ閲婂櫒鐗堟湰浠g爜
+ LoadImageErrorCode err = RuntimeApi.LoadMetadataForAOTAssembly(ReadBytesFromStreamingAssets(aotDllName), mode);
+ Debug.Log($"LoadMetadataForAOTAssembly:{aotDllName}. mode:{mode} ret:{err}");
+ }
+ }
+
+ public static byte[] ReadBytesFromStreamingAssets(string dllName)
+ {
+ return s_assetDatas[dllName];
+ }
+
private void StartGame()
{
#if !UNITY_EDITOR
@@ -245,7 +270,7 @@
{
// 鐗规畩澶勭悊
byte[] assetData;
- if (asset == "Assembly-CSharp.dll.bytes")
+ if (asset == "Main.dll.bytes")
{
assetData = new byte[www.downloadHandler.data.Length - 3];
Array.Copy(www.downloadHandler.data, 3, assetData, 0, assetData.Length);
diff --git a/Assets/Launch/UI/LaunchWins/LaunchLoadingWin.cs b/Assets/Launch/UI/LaunchWins/LaunchLoadingWin.cs
index 7216f95..39f6a8c 100644
--- a/Assets/Launch/UI/LaunchWins/LaunchLoadingWin.cs
+++ b/Assets/Launch/UI/LaunchWins/LaunchLoadingWin.cs
@@ -44,15 +44,146 @@
private float tipChangeTimer = 0f;
private const float TIP_CHANGE_INTERVAL = 3f; // 鎻愮ず鍒囨崲闂撮殧鏃堕棿
+ // 涓婁竴娆¤褰曠殑鍔犺浇姝ラ
+ private int lastStep = -1;
+
+ // 鐩爣杩涘害鍊�
+ private float targetProgress = 0f;
+
+ // 褰撳墠鏄剧ず鐨勮繘搴﹀��
+ private float currentDisplayProgress = 0f;
+
+ // 杩涘害骞虫粦杩囨浮鏃堕棿
+ private const float PROGRESS_SMOOTH_TIME = 0.5f;
+
private void Awake()
{
_instance = this;
+ Canvas canvas = GetComponent<Canvas>();
+ canvas.sortingOrder = -32768;
+ canvas.overrideSorting = false; // 涓嶈鐩栨帓搴�
+
+ // transform.SetAsFirstSibling();
+
// 鍒濆鍖栨彁绀哄垪琛�
InitTipsList();
// 鍒濆鍖栬繘搴︽潯
SetProgress(0f);
+ }
+
+ private void Update()
+ {
+ // 妫�鏌ュ姞杞芥楠ゆ槸鍚﹀彂鐢熷彉鍖�
+ CheckLoadingStepChange();
+
+ // 骞虫粦鏇存柊杩涘害鏉℃樉绀�
+ UpdateProgressDisplay();
+ }
+
+ /// <summary>
+ /// 骞虫粦鏇存柊杩涘害鏉℃樉绀�
+ /// </summary>
+ private void UpdateProgressDisplay()
+ {
+ // 濡傛灉褰撳墠鏄剧ず杩涘害涓庣洰鏍囪繘搴︿笉鍚岋紝骞虫粦杩囨浮
+ if (Mathf.Abs(currentDisplayProgress - targetProgress) > 0.001f)
+ {
+ // 璁$畻骞虫粦杩囨浮鐨勬柊杩涘害鍊�
+ currentDisplayProgress = Mathf.Lerp(currentDisplayProgress, targetProgress, Time.deltaTime / PROGRESS_SMOOTH_TIME);
+
+ // 鏇存柊杩涘害鏉℃樉绀�
+ UpdateProgressUI(currentDisplayProgress);
+ }
+ }
+
+ /// <summary>
+ /// 鏇存柊杩涘害鏉I鏄剧ず
+ /// </summary>
+ /// <param name="progress">杩涘害鍊�(0-1)</param>
+ private void UpdateProgressUI(float progress)
+ {
+ // 闄愬埗杩涘害鍊艰寖鍥�
+ progress = Mathf.Clamp01(progress);
+
+ // 鏇存柊杩涘害鏉�
+ if (progressBar != null)
+ {
+ progressBar.fillAmount = progress;
+ }
+
+ // 鏇存柊杩涘害鏂囨湰
+ if (progressText != null)
+ {
+ progressText.text = $"{(int)(progress * 100)}%";
+ }
+ }
+
+ /// <summary>
+ /// 妫�鏌ュ姞杞芥楠ゅ彉鍖栧苟鏇存柊杩涘害鏉�
+ /// </summary>
+ private void CheckLoadingStepChange()
+ {
+ // 濡傛灉LocalResManager涓嶅瓨鍦紝鐩存帴杩斿洖
+ if (!LocalResManager.IsValid())
+ return;
+
+ // 鑾峰彇褰撳墠鍔犺浇姝ラ
+ int currentStep = (int)LocalResManager.step;
+
+ // 濡傛灉姝ラ娌℃湁鍙樺寲涓斾笉鏄笅杞介樁娈碉紝鐩存帴杩斿洖
+ if (currentStep == lastStep && LocalResManager.step != LocalResManager.LoadDllStep.DownLoad)
+ return;
+
+ // 鏇存柊涓婁竴娆¤褰曠殑姝ラ
+ lastStep = currentStep;
+
+ // 鏍规嵁姝ラ鏇存柊杩涘害鏉�
+ UpdateProgressByStep(currentStep);
+ }
+
+ /// <summary>
+ /// 鏍规嵁鍔犺浇姝ラ鏇存柊杩涘害鏉�
+ /// </summary>
+ /// <param name="step">褰撳墠鍔犺浇姝ラ</param>
+ private void UpdateProgressByStep(int step)
+ {
+ // 鏍规嵁涓嶅悓姝ラ璁剧疆涓嶅悓鐨勮繘搴﹀��
+ switch ((LocalResManager.LoadDllStep)step)
+ {
+ case LocalResManager.LoadDllStep.None:
+ targetProgress = 0.0f;
+ break;
+ case LocalResManager.LoadDllStep.Wait:
+ targetProgress = 0.05f;
+ SetCurrentState(FirstPackLang.TextIndex.InitSDK);
+ break;
+ case LocalResManager.LoadDllStep.RequestVersion:
+ targetProgress = 0.1f;
+ SetCurrentState(FirstPackLang.TextIndex.CheckVersion);
+ break;
+ case LocalResManager.LoadDllStep.PrepareDownLoad:
+ targetProgress = 0.2f;
+ SetCurrentState(FirstPackLang.TextIndex.ExtractResources);
+ break;
+ case LocalResManager.LoadDllStep.DownLoad:
+ // 涓嬭浇闃舵鍗犳�昏繘搴︾殑50%锛屼粠20%鍒�70%
+ if (DownLoadAndDiscompressTask.Instance != null)
+ {
+ float downloadProgress = DownLoadAndDiscompressTask.Instance.progress;
+ targetProgress = 0.2f + downloadProgress * 0.5f;
+ }
+ SetCurrentState(FirstPackLang.TextIndex.HotUpdate);
+ break;
+ case LocalResManager.LoadDllStep.ReadBytes:
+ targetProgress = 0.8f;
+ SetCurrentState(FirstPackLang.TextIndex.EnterHotUpdateAssembly);
+ break;
+ case LocalResManager.LoadDllStep.Completed:
+ targetProgress = 1.0f;
+ break;
+ }
}
/// <summary>
@@ -78,8 +209,7 @@
DestroyImmediate(_instance.gameObject);
_instance = null;
}
-
-
+
GameObject.Instantiate(LocalResManager.Instance.LoadBuiltInPrefab("LaunchLoadingWin"));
}
@@ -101,20 +231,8 @@
/// <param name="progress">杩涘害鍊�(0-1)</param>
public void SetProgress(float progress)
{
- // 闄愬埗杩涘害鍊艰寖鍥�
- progress = Mathf.Clamp01(progress);
-
- // 鏇存柊杩涘害鏉�
- if (progressBar != null)
- {
- progressBar.fillAmount = progress;
- }
-
- // 鏇存柊杩涘害鏂囨湰
- if (progressText != null)
- {
- progressText.text = $"{(int)(progress * 100)}%";
- }
+ // 璁剧疆鐩爣杩涘害鍊�
+ targetProgress = Mathf.Clamp01(progress);
}
/// <summary>
@@ -157,7 +275,7 @@
/// 褰撳墠鐘舵�佺储寮�
/// </summary>
private int currentStateIndex = -1;
-
+
/// <summary>
/// 璁剧疆褰撳墠鐘舵��
/// </summary>
@@ -165,7 +283,7 @@
public void SetCurrentState(int stateIndex)
{
currentStateIndex = stateIndex;
-
+
// 鏍规嵁鐘舵�佺储寮曟洿鏂版彁绀烘枃鏈�
UpdateTipsByState();
}
@@ -176,7 +294,7 @@
private void UpdateTipsByState()
{
string tip = "";
-
+
// 鏍规嵁鐘舵�佺储寮曡缃搴旂殑鎻愮ず鏂囨湰
switch (currentStateIndex)
{
diff --git a/Assets/Resources/Scenes/Launch.unity b/Assets/Resources/Scenes/Launch.unity
index 6ab9ad5..31654f3 100644
--- a/Assets/Resources/Scenes/Launch.unity
+++ b/Assets/Resources/Scenes/Launch.unity
@@ -230,103 +230,6 @@
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82528803}
m_CullTransparentMesh: 1
---- !u!1001 &268124820
-PrefabInstance:
- m_ObjectHideFlags: 0
- serializedVersion: 2
- m_Modification:
- serializedVersion: 3
- m_TransformParent: {fileID: 0}
- m_Modifications:
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_Pivot.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_Pivot.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_AnchorMax.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_AnchorMax.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_AnchorMin.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_AnchorMin.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_SizeDelta.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_SizeDelta.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalPosition.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalRotation.w
- value: 1
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalRotation.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalRotation.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalRotation.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_AnchoredPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_AnchoredPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalEulerAnglesHint.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalEulerAnglesHint.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1798569891721238403, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_LocalEulerAnglesHint.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7323825802519045259, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
- propertyPath: m_Name
- value: LaunchLoadingWin
- objectReference: {fileID: 0}
- m_RemovedComponents: []
- m_RemovedGameObjects: []
- m_AddedGameObjects: []
- m_AddedComponents: []
- m_SourcePrefab: {fileID: 100100000, guid: c594a46018b14f54699ec0c2cc8e60c8, type: 3}
--- !u!1 &421128700
GameObject:
m_ObjectHideFlags: 0
@@ -564,7 +467,6 @@
m_Component:
- component: {fileID: 519420032}
- component: {fileID: 519420031}
- - component: {fileID: 519420029}
- component: {fileID: 519420033}
m_Layer: 0
m_Name: UICamera
@@ -573,14 +475,6 @@
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!81 &519420029
-AudioListener:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 519420028}
- m_Enabled: 1
--- !u!20 &519420031
Camera:
m_ObjectHideFlags: 0
@@ -832,8 +726,8 @@
addedObject: {fileID: 503479953}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 861a0f8791bb1624da118c150ad63b2b, type: 3}
---- !u!4 &1580332508 stripped
-Transform:
+--- !u!224 &1580332508 stripped
+RectTransform:
m_CorrespondingSourceObject: {fileID: 1807634080894636761, guid: 861a0f8791bb1624da118c150ad63b2b, type: 3}
m_PrefabInstance: {fileID: 1494541948}
m_PrefabAsset: {fileID: 0}
@@ -880,4 +774,3 @@
- {fileID: 519420032}
- {fileID: 421128702}
- {fileID: 1494541948}
- - {fileID: 268124820}
diff --git a/Assets/Resources/VersionConfig.asset b/Assets/Resources/VersionConfig.asset
new file mode 100644
index 0000000..867e4db
--- /dev/null
+++ b/Assets/Resources/VersionConfig.asset
@@ -0,0 +1,36 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: e797e662113028e4cb1c302969102134, type: 3}
+ m_Name: VersionConfig
+ m_EditorClassIdentifier:
+ m_AppId: test
+ m_SpID: test
+ m_VersionAuthority: 0
+ m_Version: 1.000.0
+ m_ClientPackageFlag: 2025
+ m_Branch: 1
+ m_AssetAccess: 3
+ m_PartAssetPackage: 0
+ m_ProductName: testname
+ m_BundleIdentifier: com.testapk.game
+ m_KeystoreFileName:
+ m_KeystorePassword:
+ m_KeystoreAlias:
+ m_KeystoreAliasPassword:
+ m_AppleDeveloperTeamID:
+ m_DebugVersion: 1
+ m_IsBanShu: 0
+ m_BuildTime: 2025/05/22--1549
+ m_BuildIndex: 6
+ m_LogoPosition: {x: 0, y: 0}
+ m_BanHao: 1
+ m_SdkFileName:
diff --git a/Assets/Resources/VersionConfig.asset.meta b/Assets/Resources/VersionConfig.asset.meta
new file mode 100644
index 0000000..c544387
--- /dev/null
+++ b/Assets/Resources/VersionConfig.asset.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d4f0b8e55c9261d4a878f29de216784c
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/VersionConfigEx.txt b/Assets/Resources/VersionConfigEx.txt
index 9a618ec..81fc74c 100644
--- a/Assets/Resources/VersionConfigEx.txt
+++ b/Assets/Resources/VersionConfigEx.txt
@@ -1 +1 @@
-{"m_AppId":"test","m_SpID":"test","m_VersionAuthority":0,"m_Version":"1.105.1","m_ClientPackageFlag":"2021","m_Branch":1,"m_AssetAccess":3,"m_PartAssetPackage":false,"m_ProductName":"Tru Ti锚n Quy岷縯","m_BundleIdentifier":"com.djmxyn.gp","m_KeystoreFileName":"ald_game","m_KeystorePassword":"aldgame688","m_KeystoreAlias":"ald_alias","m_KeystoreAliasPassword":"aldgame688","m_AppleDeveloperTeamID":"","m_DebugVersion":true,"m_IsBanShu":false,"m_BuildTime":"24/03/14--20:57","m_BuildIndex":6,"m_LogoPosition":{"x":0.0,"y":144.0},"m_BanHao":"1","m_SdkFileName":""}
\ No newline at end of file
+{"m_AppId":"test","m_SpID":"test","m_VersionAuthority":0,"m_Version":"1.000.0","m_ClientPackageFlag":"2025","m_Branch":1,"m_AssetAccess":3,"m_PartAssetPackage":false,"m_ProductName":"testname","m_BundleIdentifier":"com.testapk.game","m_KeystoreFileName":"","m_KeystorePassword":"","m_KeystoreAlias":"","m_KeystoreAliasPassword":"","m_AppleDeveloperTeamID":"","m_DebugVersion":true,"m_IsBanShu":false,"m_BuildTime":"2025/05/22--1549","m_BuildIndex":6,"m_LogoPosition":{"x":0.0,"y":0.0},"m_BanHao":"1","m_SdkFileName":""}
\ No newline at end of file
--
Gitblit v1.8.0