一大波优化
This commit is contained in:
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
+1
-43
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: Dy4asi2uAXPSRLtfrAXmNGo8rX/KQN2CcdpDaGMA4CgXobkltjbRQ8w=
|
||||
guid: CnkasiL4AnIXKHpzla4mCR9uO0t74g/sF/nOx1EMdKve+q+dqG0KN8A=
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -112,48 +112,6 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
maxPlaceholderSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: HMIAndroid
|
||||
maxTextureSize: 2048
|
||||
maxPlaceholderSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: OpenHarmony
|
||||
maxTextureSize: 2048
|
||||
maxPlaceholderSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
+1
-43
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: DSsbsSuuVi58o7D3QwqOseqio8g1ATIkYVOwcZk70qbC8UtJT5u9diM=
|
||||
guid: CS8b5yr7UC2oP9/o+YSbdAyXctWdoeaSPwLy6JKTBjPaGBTBSFCLwtU=
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -112,48 +112,6 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
maxPlaceholderSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: HMIAndroid
|
||||
maxTextureSize: 2048
|
||||
maxPlaceholderSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: OpenHarmony
|
||||
maxTextureSize: 2048
|
||||
maxPlaceholderSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB |
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: CCgd4Sn+VyhSX6Sy1vJRD19RHy1W+JPDmy9XAVXah14m2R0Z1sqGCZw=
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: XHNM4CqvASia0jo0hG6m5P9t/1WoqAwZ2zwrPjjJXY6Fd1JeD5HXmaQ=
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- 392-SS Ni Chang Ti
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using IndianOceanAssets.Engine2_5D;
|
||||
|
||||
namespace GameFramework
|
||||
@@ -14,9 +15,12 @@ namespace GameFramework
|
||||
/// </summary>
|
||||
public class GameHUD : MonoBehaviour
|
||||
{
|
||||
/// <summary>魂灵图标的 RectTransform(供魂灵掉落物飞行定位)</summary>
|
||||
public static RectTransform SoulIconRect { get; private set; }
|
||||
|
||||
[Header("魂灵计数(左上角)")]
|
||||
[SerializeField] private Image soulIcon;
|
||||
[SerializeField] private Text soulCountText;
|
||||
[SerializeField] private TextMeshProUGUI soulCountText;
|
||||
|
||||
[Header("生命图标(左下角)")]
|
||||
[SerializeField] private Image[] lifeIcons; // 5个生命图标
|
||||
@@ -52,9 +56,16 @@ namespace GameFramework
|
||||
if (pauseButton != null)
|
||||
pauseButton.onClick.AddListener(OnPauseClick);
|
||||
|
||||
// 暴露魂灵图标 RectTransform(供魂灵掉落物飞行定位)
|
||||
if (soulIcon != null)
|
||||
SoulIconRect = soulIcon.rectTransform;
|
||||
|
||||
// 订阅分数事件(魂灵计数复用分数系统)
|
||||
ScoreManager.onScoreChanged += UpdateSoulCount;
|
||||
UpdateSoulCount(ScoreManager.Instance != null ? ScoreManager.Instance.CurrentScore : 0);
|
||||
if (ScoreManager.Instance != null)
|
||||
{
|
||||
ScoreManager.onScoreChanged += UpdateSoulCount;
|
||||
UpdateSoulCount(ScoreManager.Instance.CurrentScore);
|
||||
}
|
||||
|
||||
UpdateLifeIcons();
|
||||
|
||||
@@ -83,7 +94,14 @@ namespace GameFramework
|
||||
private void UpdateSoulCount(int count)
|
||||
{
|
||||
if (soulCountText != null)
|
||||
{
|
||||
soulCountText.text = count.ToString();
|
||||
Debug.Log($"[GameHUD] UpdateSoulCount: {count}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[GameHUD] soulCountText 未赋值!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace GameFramework
|
||||
{
|
||||
@@ -8,25 +9,34 @@ namespace GameFramework
|
||||
/// 让 EventSystem 通过 DontDestroyOnLoad 跨场景存活。
|
||||
/// 这样 Gameplay、Scoring 等场景的按钮都能正常响应点击。
|
||||
///
|
||||
/// 如果场景里没有 EventSystem,也可以挂到任意空物体上,
|
||||
/// 脚本会自动创建一个。
|
||||
/// 场景切换时如果新场景自带 EventSystem,会自动销毁重复的那个,
|
||||
/// 始终保证场景中只有一个 EventSystem。
|
||||
/// </summary>
|
||||
public class PersistentEventSystem : MonoBehaviour
|
||||
{
|
||||
void Awake()
|
||||
{
|
||||
// 如果场景里没有 EventSystem,自动创建
|
||||
if (FindObjectOfType<EventSystem>() == null)
|
||||
{
|
||||
var go = new GameObject("EventSystem");
|
||||
go.AddComponent<EventSystem>();
|
||||
go.AddComponent<StandaloneInputModule>();
|
||||
}
|
||||
|
||||
// 让 EventSystem 跨场景存活
|
||||
var eventSystem = FindObjectOfType<EventSystem>();
|
||||
if (eventSystem != null)
|
||||
DontDestroyOnLoad(eventSystem.gameObject);
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
// 监听场景加载,清理重复的 EventSystem
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
// 新场景加载后,找到所有 EventSystem,保留自己所在的,销毁其余的
|
||||
var allES = FindObjectsOfType<EventSystem>();
|
||||
foreach (var es in allES)
|
||||
{
|
||||
if (es.gameObject != gameObject)
|
||||
Destroy(es.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ namespace GameFramework
|
||||
[SerializeField] AudioData pickUpSFX;
|
||||
[SerializeField] float respawnTime = 0f; // 0=不复活(永久消失)
|
||||
|
||||
[Header("Auto Assign")]
|
||||
[SerializeField] bool findScoreManagerAutomatically = true;
|
||||
|
||||
Collider pickupCollider;
|
||||
MeshRenderer meshRenderer;
|
||||
SpriteRenderer spriteRenderer;
|
||||
|
||||
Reference in New Issue
Block a user