From 284d53f23b058c650749f03f0079a76dce7f4347 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 19 五月 2025 17:42:25 +0800
Subject: [PATCH] 18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建
---
Main/Manager/StageManager.cs | 3
Main/Manager/ResManager.cs | 134 ++++++++++++++++++++++++++++++++++++++++++++
Main/Login/ClientVersion/VersionUtility.cs | 2
Main/Manager/ResManager.cs.meta | 11 +++
4 files changed, 148 insertions(+), 2 deletions(-)
diff --git a/Main/Login/ClientVersion/VersionUtility.cs b/Main/Login/ClientVersion/VersionUtility.cs
index 9fae7c5..448259d 100644
--- a/Main/Login/ClientVersion/VersionUtility.cs
+++ b/Main/Login/ClientVersion/VersionUtility.cs
@@ -71,7 +71,7 @@
//versionUrl = url;
//Debug.Log("http鍦板潃:versionUrl " + url);
//HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult);
- OnVersionCheckResult(true, ResManager.versionUrlResult);
+ OnVersionCheckResult(true, LocalResManager.versionUrlResult);
}
private void OnVersionCheckResult(bool _ok, string _result)
diff --git a/Main/Manager/ResManager.cs b/Main/Manager/ResManager.cs
new file mode 100644
index 0000000..d9bddf8
--- /dev/null
+++ b/Main/Manager/ResManager.cs
@@ -0,0 +1,134 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
+using System;
+using UnityEngine.U2D;
+using LitJson;
+using System.IO;
+using UnityEngine.Networking;
+
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+using LaunchCommon;
+
+public class ResManager : Singleton<ResManager>
+{
+
+
+ //涓嶄笅杞芥椂鏈湴瀹夊崜娴嬭瘯璺緞
+ // public string assetBundlesPath = Application.dataPath + "/../AssetBundles/Android/";
+ // public static string bytesFolderName = "logicbytes/";
+ public string StreamingAssetPath
+ {
+ get
+ {
+ return ResourcesPath.Instance.StreamingAssetPath;
+ }
+ }
+ public string ExternalStorePath
+ {
+ get
+ {
+ return ResourcesPath.Instance.ExternalStorePath;
+ }
+ }
+
+ //鐢ㄤ簬editor 涓嬬殑璧勬簮璺緞
+ public string ResourcesOutPath
+ {
+ get
+ {
+ return ResourcesPath.ResourcesOutPath;
+ }
+ }
+
+ public string CONFIG_FODLER
+ {
+ get
+ {
+ return ResourcesPath.CONFIG_FODLER;
+ }
+ }
+
+ public string ResourcesOutAssetPath
+ {
+ get
+ {
+ return ResourcesPath.ResourcesOutAssetPath;
+ }
+ }
+
+
+
+ public void Init()
+ {
+
+ }
+
+ public void Release()
+ {
+
+ }
+
+ private string GetExtension(Type type)
+ {
+ if (type == typeof(GameObject))
+ return ".prefab";
+ else if (type == typeof(Sprite))
+ return ".png";
+ else if (type == typeof(Texture2D))
+ return ".png";
+ else if (type == typeof(Shader))
+ return ".shader";
+ else if (type == typeof(TextAsset))
+ return ".txt";
+ else if (type == typeof(AudioClip))
+ return ".wav";
+ else if (type == typeof(Font))
+ return ".ttf";
+ else if (type == typeof(Material))
+ return ".mat";
+ else
+ {
+ Debug.LogErrorFormat("GetExtension() => 涓嶆敮鎸佺殑璧勬簮绫诲瀷: {0}.", type.Name);
+ return "";
+ }
+ }
+
+ public T LoadAsset<T> (string directory, string name) where T : UnityEngine.Object
+ {
+ T asset = null;
+#if UNITY_EDITOR
+ var path = string.Concat($"Assets/ResourcesOut/{directory}/{name}", GetExtension(typeof(T)));
+ asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path);
+#else
+ if (prefabBundle == null)
+ {
+ // string _path = GetAssetFilePath("builtin/prefabs");
+ string _path = GetAssetFilePath($"builtin/{directory}");
+ prefabBundle = AssetBundle.LoadFromFile(_path);
+ }
+ asset = prefabBundle.LoadAsset(name) as t;
+#endif
+ if (asset == null)
+ {
+ Debug.LogErrorFormat("LoadBuiltInPrefab() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
+ }
+
+ return asset;
+ }
+
+
+
+ public void UnloadAsset(string assetBundleName)
+ {
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/Main/Manager/ResManager.cs.meta b/Main/Manager/ResManager.cs.meta
new file mode 100644
index 0000000..2831c10
--- /dev/null
+++ b/Main/Manager/ResManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bc3c737470ea4ee43956edd5249aa939
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Manager/StageManager.cs b/Main/Manager/StageManager.cs
index 5459f9c..04ddcc0 100644
--- a/Main/Manager/StageManager.cs
+++ b/Main/Manager/StageManager.cs
@@ -26,7 +26,8 @@
public void Release()
{
-
+ AfterEnterGame = null;
+ BeforeEnterGame = null;
}
public async UniTaskVoid ToLoginScene()
--
Gitblit v1.8.0