From 38afc6f2fc317ac74b6eaeba5788bacf6239f453 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期三, 14 十一月 2018 17:13:00 +0800
Subject: [PATCH] 4792 【1.2】原随包的配置全部支持热更新。
---
System/Sound/SoundPlayer.cs | 2
Utility/ActorShadowCaster.cs | 2
Core/NetworkPackage/DTCFile/ClientPack.meta | 9 ++++
System/ClientVersion/VersionConfig.cs | 6 +-
Core/Camera/CameraController.cs | 2
Core/ResModule/BuiltInLoader.cs | 52 +++++++++++++++++++++++++-
Fight/Stage/StageManager.cs | 2
Fight/Actor/TestPlayerController.cs | 4 +-
Fight/GameActor/GA_Hero.cs | 2
Utility/MaterialUtility.cs | 12 +++---
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs | 2
Fight/GameActor/GActorFight.cs | 2
12 files changed, 77 insertions(+), 20 deletions(-)
diff --git a/Core/Camera/CameraController.cs b/Core/Camera/CameraController.cs
index 8a319eb..1c151e3 100644
--- a/Core/Camera/CameraController.cs
+++ b/Core/Camera/CameraController.cs
@@ -94,7 +94,7 @@
public void PlayAnimationClip(string name)
{
- AnimationClip _clip = Resources.Load<AnimationClip>("AnimationCurve/" + name);
+ AnimationClip _clip = BuiltInLoader.LoadAnimationClip(name);
if (_clip != null)
{
IsPlayingAnim = true;
diff --git a/Core/NetworkPackage/DTCFile/ClientPack.meta b/Core/NetworkPackage/DTCFile/ClientPack.meta
new file mode 100644
index 0000000..a5a6f03
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ClientPack.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 722e5e3d30096674e811f5bd191246a0
+folderAsset: yes
+timeCreated: 1539228128
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs b/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
index 4bf5e7d..c111b40 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
+++ b/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
@@ -164,7 +164,7 @@
// 鍒濆鍖栨憚鍍忔満
if (!CameraController.Instance)
{
- UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefabs/GameCamera"));
+ UnityEngine.Object.Instantiate(BuiltInLoader.LoadPrefab("GameCamera"));
CameraController.Instance.AcceptInput = false;
CameraController.Instance.CameraObject.enabled = false;
CameraController.Instance.QualityLevelChanged();
diff --git a/Core/ResModule/BuiltInLoader.cs b/Core/ResModule/BuiltInLoader.cs
index 6008723..429e517 100644
--- a/Core/ResModule/BuiltInLoader.cs
+++ b/Core/ResModule/BuiltInLoader.cs
@@ -20,7 +20,7 @@
}
else
{
- var assetInfo = new AssetInfo("builtin/sprite", name);
+ var assetInfo = new AssetInfo("builtin/sprites", name);
sprite = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo, typeof(Sprite)) as Sprite;
}
@@ -38,7 +38,7 @@
if (AssetSource.builtInFromEditor)
{
#if UNITY_EDITOR
- var path = StringUtility.Contact("Assets/ResourcesOut/BuiltIn/UI/Prefabs/", name, PREFAB_EXTENSION);
+ var path = StringUtility.Contact("Assets/ResourcesOut/BuiltIn/Prefabs/", name, PREFAB_EXTENSION);
prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(path);
#endif
}
@@ -88,6 +88,54 @@
return audioClip;
}
+ public static AnimationClip LoadAnimationClip(string name)
+ {
+ AnimationClip clip = null;
+ if (AssetSource.builtInFromEditor)
+ {
+#if UNITY_EDITOR
+ var path = StringUtility.Contact("Assets/ResourcesOut/BuiltIn/AnimationClip/", name, ".anim");
+ clip = UnityEditor.AssetDatabase.LoadAssetAtPath<AnimationClip>(path);
+#endif
+ }
+ else
+ {
+ var assetInfo = new AssetInfo("builtin/animationclip", name);
+ clip = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as AnimationClip;
+ }
+
+ if (clip == null)
+ {
+ DebugEx.LogErrorFormat("BuiltInLoader.LoadAnimationClip() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
+ }
+
+ return clip;
+ }
+
+ public static Material LoadMaterial(string name)
+ {
+ Material material = null;
+ if (AssetSource.builtInFromEditor)
+ {
+#if UNITY_EDITOR
+ var path = StringUtility.Contact("Assets/ResourcesOut/BuiltIn/Materials/", name, ".mat");
+ material = UnityEditor.AssetDatabase.LoadAssetAtPath<Material>(path);
+#endif
+ }
+ else
+ {
+ var assetInfo = new AssetInfo("builtin/materials", name);
+ material = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as Material;
+ }
+
+ if (material == null)
+ {
+ DebugEx.LogErrorFormat("BuiltInLoader.LoadMaterial() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
+ }
+
+ return material;
+ }
+
public static T LoadScriptableObject<T>(string name) where T : ScriptableObject
{
diff --git a/Fight/Actor/TestPlayerController.cs b/Fight/Actor/TestPlayerController.cs
index 0d7497b..1421771 100644
--- a/Fight/Actor/TestPlayerController.cs
+++ b/Fight/Actor/TestPlayerController.cs
@@ -22,7 +22,7 @@
{
if (CameraController.Instance == null)
{
- Instantiate(Resources.Load<GameObject>("Prefabs/GameCamera"));
+ Instantiate(BuiltInLoader.LoadPrefab("GameCamera"));
}
CameraController.Instance.SetLookTarget(transform);
@@ -31,7 +31,7 @@
m_Animator = gameObject.AddMissingComponent<Animator>();
SystemSetting.Instance.SetQualityLevel(GameQuality.High);
- var shadowPrefab = Resources.Load<GameObject>("Prefabs/ActorShadowCaster");
+ var shadowPrefab = BuiltInLoader.LoadPrefab("ActorShadowCaster");
var shadowCaster = Instantiate(shadowPrefab).GetComponent<ActorShadowCaster>();
if (shadowCaster != null)
diff --git a/Fight/GameActor/GA_Hero.cs b/Fight/GameActor/GA_Hero.cs
index 9b98e90..5ff5159 100644
--- a/Fight/GameActor/GA_Hero.cs
+++ b/Fight/GameActor/GA_Hero.cs
@@ -582,7 +582,7 @@
ReleaseLight();
if (PlayerDatas.Instance.baseData.MapID == 31160)
{
- m_Light = Object.Instantiate(Resources.Load<GameObject>("Prefabs/Zhujiao_Pointlight"));
+ m_Light = Object.Instantiate(BuiltInLoader.LoadPrefab("Zhujiao_Pointlight"));
m_Light.transform.SetParent(MP_Name);
m_Light.transform.localPosition = Vector3.zero;
m_Light.transform.localScale = Vector3.one;
diff --git a/Fight/GameActor/GActorFight.cs b/Fight/GameActor/GActorFight.cs
index 4627df8..13fe686 100644
--- a/Fight/GameActor/GActorFight.cs
+++ b/Fight/GameActor/GActorFight.cs
@@ -74,7 +74,7 @@
m_SkillManager = new SkillManager(ServerInstID);
// 鍒涘缓闊虫簮
- GameObject _audioSourceNode = Object.Instantiate(Resources.Load<GameObject>("Prefabs/AudioSource3D")) as GameObject;
+ GameObject _audioSourceNode = Object.Instantiate(BuiltInLoader.LoadPrefab("AudioSource3D")) as GameObject;
#if UNITY_EDITOR
_audioSourceNode.name = "AudioSource";
#endif
diff --git a/Fight/Stage/StageManager.cs b/Fight/Stage/StageManager.cs
index 86ec4e1..36d2efe 100644
--- a/Fight/Stage/StageManager.cs
+++ b/Fight/Stage/StageManager.cs
@@ -446,7 +446,7 @@
// 鍒濆鍖栨憚鍍忔満
if (!CameraController.Instance)
{
- UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefabs/GameCamera"));
+ UnityEngine.Object.Instantiate(BuiltInLoader.LoadPrefab("GameCamera"));
CameraController.Instance.AcceptInput = false;
CameraController.Instance.CameraObject.enabled = false;
}
diff --git a/System/ClientVersion/VersionConfig.cs b/System/ClientVersion/VersionConfig.cs
index d149204..dcfd176 100644
--- a/System/ClientVersion/VersionConfig.cs
+++ b/System/ClientVersion/VersionConfig.cs
@@ -10,7 +10,7 @@
[CreateAssetMenu(menuName = "Config/VersionConfig")]
public class VersionConfig : ScriptableObject
{
- public const string VERSION_ALTERNATIVE = "0.0.0";
+ public const string VERSION_ALTERNATIVE = "1.2.0";
[SerializeField] public string m_AppId = string.Empty;
public string appId { get { return m_AppId; } }
@@ -133,7 +133,7 @@
[ContextMenu("Apply")]
public void Apply()
{
- var newVersionConfigPath = StringUtility.Contact("Assets/Resources/ScriptableObject/Config/VersionConfig", ".asset");
+ var newVersionConfigPath = "Assets/Resources/VersionConfig.asset";
var fromVersionConfig = this;
var newVersionConfig = ScriptableObject.CreateInstance<VersionConfig>();
@@ -154,7 +154,7 @@
{
if (config == null)
{
- config = Resources.Load<VersionConfig>("ScriptableObject/Config/VersionConfig");
+ config = Resources.Load<VersionConfig>("VersionConfig");
}
return config;
diff --git a/System/Sound/SoundPlayer.cs b/System/Sound/SoundPlayer.cs
index 3872535..57a3355 100644
--- a/System/Sound/SoundPlayer.cs
+++ b/System/Sound/SoundPlayer.cs
@@ -45,7 +45,7 @@
public static void CreateSoundPlayer()
{
- var gameObject = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/SoundPlayer"));
+ var gameObject = GameObject.Instantiate(BuiltInLoader.LoadPrefab("SoundPlayer"));
Instance = gameObject.GetComponent<SoundPlayer>();
Instance.name = "SoundPlayer";
Instance.gameObject.SetActive(true);
diff --git a/Utility/ActorShadowCaster.cs b/Utility/ActorShadowCaster.cs
index 8390bdb..0ee0249 100644
--- a/Utility/ActorShadowCaster.cs
+++ b/Utility/ActorShadowCaster.cs
@@ -90,7 +90,7 @@
{
if (pool == null)
{
- var prefab = Resources.Load<GameObject>("Prefabs/ActorShadowCaster");
+ var prefab = BuiltInLoader.LoadPrefab("ActorShadowCaster");
if (prefab != null)
{
pool = GameObjectPoolManager.Instance.RequestPool(prefab);
diff --git a/Utility/MaterialUtility.cs b/Utility/MaterialUtility.cs
index d09dfff..0ea221d 100644
--- a/Utility/MaterialUtility.cs
+++ b/Utility/MaterialUtility.cs
@@ -7,7 +7,7 @@
public static Material GetDefaultSpriteGrayMaterial()
{
- return Resources.Load<Material>("Material/SpriteGray");
+ return BuiltInLoader.LoadMaterial("SpriteGray");
}
public static Material GetInstantiatedSpriteGrayMaterial()
@@ -18,12 +18,12 @@
public static Material GetSmoothMaskGrayMaterial()
{
- return Resources.Load<Material>("Material/SmoothMaskGray");
+ return BuiltInLoader.LoadMaterial("SmoothMaskGray");
}
public static Material GetInstantiatedSpriteTwinkleMaterial()
{
- var material = Resources.Load<Material>("Material/Flash");
+ var material = BuiltInLoader.LoadMaterial("Flash");
return new Material(material);
}
@@ -34,12 +34,12 @@
public static Material GetUIBlurMaterial()
{
- return Resources.Load<Material>("Material/GUIBlurMaterial");
+ return BuiltInLoader.LoadMaterial("GUIBlurMaterial");
}
public static Material GetGUIRenderTextureMaterial()
{
- return Resources.Load<Material>("Material/UI_RenderTexture");
+ return BuiltInLoader.LoadMaterial("UI_RenderTexture");
}
public static void SetRenderSortingOrder(this GameObject root, int sortingOrder, bool includeChildren)
@@ -76,7 +76,7 @@
get {
if (m_HudMaterial == null)
{
- m_HudMaterial = Resources.Load<Material>("Material/HUD_HeadupName");
+ m_HudMaterial = BuiltInLoader.LoadMaterial("HUD_HeadupName");
m_HudMaterial.SetTexture("_Tex1", FontUtility.preferred.material.mainTexture);
}
return m_HudMaterial;
--
Gitblit v1.8.0