master
zc 2025-08-18 08:30:34 +08:00
parent dc4e465183
commit 52b6309c39
11 changed files with 26 additions and 97 deletions

View File

@ -1,57 +0,0 @@
using System;
using Cysharp.Threading.Tasks;
using UnityEngine;
using YooAsset;
namespace HK
{
public class Global : MonoBehaviour
{
/// <summary>
/// 资源系统运行模式
/// </summary>
public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
public string packageName = "DefaultPackage";
public string hostServerIP = "http://192.168.0.144:8080/NetworkServer/AssetsFolder/Framework";
public string sceneName = "Assets/Res/Scene/Game.unity";
private void Awake()
{
DontDestroyOnLoad(this.gameObject);
AdjustScreenResolution();
}
void Start()
{
InitAsync().Forget();
async UniTask InitAsync()
{
var initializePackage = new InitializePackage(PlayMode, packageName, hostServerIP);
await initializePackage.Start();
// 切换到主页面场景
// SceneEventDefine.ChangeToHomeScene.SendEventMessage();
// YooAssets.LoadSceneSync(SceneName);
YooAssets.LoadSceneSync(sceneName);
}
}
private void AdjustScreenResolution()
{
float w = Screen.currentResolution.width;
float h = Screen.currentResolution.height;
if (w * 16 > h * 9)
{
Screen.SetResolution((int)(h * (float)((float)9 / 16)), (int)h, true);
}
else
{
Screen.SetResolution((int)w, (int)(w * (float)((float)16 / 9)), true);
}
//#endif
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7aa30ccbd3cd46ceb33069108465e8ea
timeCreated: 1749127314

View File

@ -37,7 +37,7 @@ public class Init : MonoBehaviour
async UniTask InitAsync()
{
var initializePackage = new InitializePackage(PlayMode, packageName, hostServerIP);
var initializePackage = new InitializePackage(PlayMode, packageName, hostServerIP,Application.version);
await initializePackage.Start();
// 切换到主页面场景
// SceneEventDefine.ChangeToHomeScene.SendEventMessage();

View File

@ -15,13 +15,15 @@ namespace HK
/// 资源系统运行模式
/// </summary>
private EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
private string PackageName = "DefaultPackage";
public InitializePackage(EPlayMode playMode, string packageName, string hostServerIP)
public InitializePackage(EPlayMode playMode, string packageName, string hostServerIP, string appVersion)
{
PlayMode = playMode;
PackageName = packageName;
this.hostServerIP = hostServerIP;
this.appVersion = appVersion;
}
public async UniTask Start()
@ -169,6 +171,7 @@ namespace HK
}
string hostServerIP = "http://127.0.0.1";
string appVersion = "v1.0";
/// <summary>
/// 获取资源服务器地址
@ -177,26 +180,26 @@ namespace HK
{
//string hostServerIP = "http://10.0.2.2"; //安卓模拟器地址
// string hostServerIP = "http://127.0.0.1";
string appVersion = "v1.0";
// string appVersion = "v1.0";
#if UNITY_EDITOR
if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.Android)
return $"{hostServerIP}/CDN/Android/{appVersion}";
return $"{hostServerIP}/CDN/Android/{Application.productName}/{appVersion}";
else if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.iOS)
return $"{hostServerIP}/CDN/IPhone/{appVersion}";
return $"{hostServerIP}/CDN/IPhone/{Application.productName}/{appVersion}";
else if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)
return $"{hostServerIP}/CDN/WebGL/{appVersion}";
return $"{hostServerIP}/CDN/WebGL/{Application.productName}/{appVersion}";
else
return $"{hostServerIP}/CDN/PC/{appVersion}";
return $"{hostServerIP}/CDN/PC/{Application.productName}/{appVersion}";
#else
if (Application.platform == RuntimePlatform.Android)
return $"{hostServerIP}/CDN/Android/{appVersion}";
return $"{hostServerIP}/CDN/Android/{Application.productName}/{appVersion}";
else if (Application.platform == RuntimePlatform.IPhonePlayer)
return $"{hostServerIP}/CDN/IPhone/{appVersion}";
return $"{hostServerIP}/CDN/IPhone/{Application.productName}/{appVersion}";
else if (Application.platform == RuntimePlatform.WebGLPlayer)
return $"{hostServerIP}/CDN/WebGL/{appVersion}";
return $"{hostServerIP}/CDN/WebGL/{Application.productName}/{appVersion}";
else
return $"{hostServerIP}/CDN/PC/{appVersion}";
return $"{hostServerIP}/CDN/PC/{Application.productName}/{appVersion}";
#endif
}

View File

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

View File

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

View File

@ -1,7 +1,7 @@
{
"FileVersion": "1.0.0",
"PackageName": "DefaultPackage",
"PackageVersion": "2025-07-13-1206",
"PackageVersion": "2025-08-06-570",
"Wrappers": [
{
"BundleGUID": "08c900c29bd28ba1346a58d19b3fe243",
@ -11,10 +11,6 @@
"BundleGUID": "0b4dc00af5d205c1bf3aed91b3b5e92b",
"FileName": "0b4dc00af5d205c1bf3aed91b3b5e92b.bundle"
},
{
"BundleGUID": "0e513bbf47b99a979393fd9dff8ffffb",
"FileName": "0e513bbf47b99a979393fd9dff8ffffb.bundle"
},
{
"BundleGUID": "1c07305c77e11628cd99ab7e05db9eb5",
"FileName": "1c07305c77e11628cd99ab7e05db9eb5.bundle"
@ -63,6 +59,10 @@
"BundleGUID": "6508c6680c1c4691da60a5712340b6d1",
"FileName": "6508c6680c1c4691da60a5712340b6d1.bundle"
},
{
"BundleGUID": "67cdac1f320c88fe624069a608acd5a7",
"FileName": "67cdac1f320c88fe624069a608acd5a7.bundle"
},
{
"BundleGUID": "69c2adda6688d228bd957ed8b51ef37a",
"FileName": "69c2adda6688d228bd957ed8b51ef37a.bundle"
@ -72,20 +72,20 @@
"FileName": "7cdae5f0ebfa5de1da41fb5c09c99067.bundle"
},
{
"BundleGUID": "7ea7aec5f87951e47a94583481539f0a",
"FileName": "7ea7aec5f87951e47a94583481539f0a.bundle"
"BundleGUID": "7e36d7fa5658eb2826949d988f268ab1",
"FileName": "7e36d7fa5658eb2826949d988f268ab1.bundle"
},
{
"BundleGUID": "97385e966d5a71b47c6ac49a8c1d92ba",
"FileName": "97385e966d5a71b47c6ac49a8c1d92ba.bundle"
"BundleGUID": "83b6f3997fe8c5685d1b1c763628afb8",
"FileName": "83b6f3997fe8c5685d1b1c763628afb8.bundle"
},
{
"BundleGUID": "c1a8dd3d922aee48411e7065f3266ae3",
"FileName": "c1a8dd3d922aee48411e7065f3266ae3.bundle"
},
{
"BundleGUID": "cca6e809893e1cca79e8b787025a5314",
"FileName": "cca6e809893e1cca79e8b787025a5314.bundle"
"BundleGUID": "c4c33f2e94491b4153079924c4fe1aa2",
"FileName": "c4c33f2e94491b4153079924c4fe1aa2.bundle"
},
{
"BundleGUID": "d27005ce6b873f1f367e9184c39933c3",

View File

@ -1 +1 @@
2025-07-13-1206
2025-08-06-570