diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Assets/AddressableAssetsData/AddressableAssetSettings.asset index 6b78cfe2f..4d0dd8eea 100644 --- a/Assets/AddressableAssetsData/AddressableAssetSettings.asset +++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset @@ -15,7 +15,7 @@ MonoBehaviour: m_DefaultGroup: 09546aca93a801441859af2a811fe53b m_currentHash: serializedVersion: 2 - Hash: 00000000000000000000000000000000 + Hash: 0ff7da4bd5a9dda38dc01b11d13a8daf m_OptimizeCatalogSize: 0 m_BuildRemoteCatalog: 0 m_BundleLocalCatalog: 0 diff --git a/Assets/AddressableAssetsData/AssetGroups/Shared_FixSystem.asset b/Assets/AddressableAssetsData/AssetGroups/Shared_FixSystem.asset index c73b96010..0e5399432 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Shared_FixSystem.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Shared_FixSystem.asset @@ -32,6 +32,16 @@ MonoBehaviour: m_ReadOnly: 0 m_SerializedLabels: [] FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 2ad11187b3f2b9b4783d2891314b18cc + m_Address: Material/HighlightMaterial + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 191da4688baf1ea4aa8964e324d9d4a0 + m_Address: Material/AlarmMaterial + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 m_ReadOnly: 0 m_Settings: {fileID: 11400000, guid: 77169ce22e430f64fb36c771815a4a7b, type: 2} m_SchemaSet: diff --git a/Assets/Scripts/AssetRefs/FixAssetRef.cs b/Assets/Scripts/AssetRefs/FixAssetRef.cs index 29fef36fe..4801fde50 100644 --- a/Assets/Scripts/AssetRefs/FixAssetRef.cs +++ b/Assets/Scripts/AssetRefs/FixAssetRef.cs @@ -5,5 +5,8 @@ public const string EyeCoverOpenA = "Sprite/视觉模块盖子[视觉模块盖子打开A]"; public const string EyeCoverOpenB = "Sprite/视觉模块盖子[视觉模块盖子打开B]"; public const string EyeCoverClose = "Sprite/视觉模块盖子[视觉模块盖子关闭]"; + + public const string HighlightMaterial = "Material/HighlightMaterial"; + public const string AlarmMaterial = "Material/AlarmMaterial"; } } \ No newline at end of file diff --git a/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs b/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs index 2dc51c63a..2e8024e0e 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs @@ -30,8 +30,6 @@ namespace AibisDream.FixSystem private SpriteRenderer _cutSpriteRenderer; private SpriteRenderer _cutTextRenderer; // 添加cutText的SpriteRenderer引用 - private CutLine _cutLine; - [Header("CutText闪烁效果")] private float cutTextFlickerThreshold = 0.4f; // 开始闪烁的阈值 private float cutTextFlickerInterval = 0.1f; // 闪烁间隔 private bool isCutTextFlickering = false; // 是否正在闪烁 @@ -48,6 +46,7 @@ namespace AibisDream.FixSystem { // 获取组件索引 InitReference(); + StartCoroutine(LoadMaterial()); } protected virtual void InitReference() @@ -71,9 +70,25 @@ namespace AibisDream.FixSystem _cutTextRenderer = _cutSpriteRenderer.transform.Find("Cut Text")?.GetComponent(); } + } - _highlightMaterial = Resources.Load("Materials/HighlightMaterial"); - _alarmMaterial = Resources.Load("Materials/AlarmMaterial"); + private IEnumerator LoadMaterial() + { + // 异步加载材质 + var highlightHandle = ResourceSystem.LoadAsync(FixAssetRef.HighlightMaterial); + var alarmHandle = ResourceSystem.LoadAsync(FixAssetRef.AlarmMaterial); + yield return highlightHandle; + yield return alarmHandle; + + if (highlightHandle.Status == UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus.Succeeded) + _highlightMaterial = highlightHandle.Result; + else + Debug.LogError("[BodyModule] Failed to load HighlightMaterial"); + + if (alarmHandle.Status == UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus.Succeeded) + _alarmMaterial = alarmHandle.Result; + else + Debug.LogError("[BodyModule] Failed to load AlarmMaterial"); } #region 插槽功能 @@ -244,66 +259,6 @@ namespace AibisDream.FixSystem } } - // public void EnableCut() - // { - // // 打开或获取CutLine - // ShowCutLine(); - // _cutLine.OnCuttingDown += OnCuttingDown; - // _cutting = true; - - // EnumEventSystem.Global.Send(EventEnum.CutStart); - // } - - // private void OnCut() - // { - // Vector2 mousePos = CommonUtil.GetMouseWorldPos(Input.mousePosition); - // _cutLine.DetectLineClick(mousePos, clickRadius); - // } - - // private void OnCuttingDown() - // { - // _cutLine.OnCuttingDown -= OnCuttingDown; - // _cutting = false; - // // 模块脱落 - // _cutLine.HideLine(); - // _bodyModuleSystem.RemoveModule(this); - // ActionKit.Sequence() - // .Delay(0.8f) - // .DOTween(() => transform.DOMoveY(ConstRef.TweenEndY, - // (transform.position.y - ConstRef.TweenEndY) / (ConstRef.FallSpeed * 0.6f)) - // .SetEase(Ease.InQuad)) - // .Callback(() => DialogController.Instance?.StartDialogNode($"{data.moduleName}CutDown")) - // .Callback(() => EnumEventSystem.Global.Send(EventEnum.CutEnd)) - // .Start(this, () => Destroy(gameObject)); - // } - - // private void ShowCutLine() - // { - // // 切割线不存在,就新建一个 - // if (!_cutLine) - // { - // var prefab = ResourceKit.LoadAssetSync(ConstRef.CutLinePrefabName); - // var cutLineObj = Instantiate(prefab, transform); - // _cutLine = cutLineObj.GetComponent(); - // } - - // // 对切割线进行初始化 - // var shapePoints = new List(); - // _targetSpriteRenderer.sprite.GetPhysicsShape(0, shapePoints); - // if (shapePoints.Count <= 0) - // { - // Debug.LogWarning($"{name} has no shape"); - // return; - // } - - // // 本地坐标转世界坐标 - // var shapePointsV3 = shapePoints - // .Select(item => _targetSpriteRenderer.transform.TransformPoint(item)) - // .ToList(); - - // _cutLine.Init(shapePointsV3, clickRadius); - // } - #endregion } diff --git a/Assets/Scripts/FixSystemNew/BodyModule/Modules/MoleModule.cs b/Assets/Scripts/FixSystemNew/BodyModule/Modules/MoleModule.cs index 479dfbfe3..88e6c645f 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/Modules/MoleModule.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/Modules/MoleModule.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using AibisDream.Kit; using DG.Tweening; using TMPro;