模块拆除功能

This commit is contained in:
2025-04-22 17:07:31 +08:00
parent 9f20ef52d8
commit b47e96ea9e
23 changed files with 627 additions and 1040 deletions
+5 -33
View File
@@ -1,6 +1,5 @@
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.UI;
using DG.Tweening;
using AibisDream.Framework;
using AibisDream;
@@ -13,28 +12,19 @@ public class FavoritesManager : MonoBehaviour
private readonly ClueData _clueData = new();
public Button toggleFavoritesButton; // 用于打开/关闭收藏夹的按钮
public GameObject favoritesUI; // 收藏夹UI
private RectTransform favoritesUIRectTransform;
public Transform punchTapeContent; // 打孔带分类的Content
//public Transform screenshotContent; // 截图分类的Content
public GameObject clueItemPrefab; // 收藏夹中线索Item的预制件
public GameObject imageClueItemPrefab; // 收藏夹中线索Item的预制件
//public Button punchTapeTabButton; // 切换到打孔带
//public Button screenshotTabButton; // 切换到截图
//public ScrollRect scrollRect; // 滚动视图
public GameObject punchTapePanel; // 打孔带分类面板
//public GameObject screenshotPanel; // 截图分类面板
private Vector2 hiddenPosition; // 收藏夹隐藏时的位置
private Vector2 visiblePosition; // 收藏夹显示时的位置
public bool isFavoritesOpen = false; // 收藏夹是否打开的状态
private void Awake()
@@ -56,27 +46,11 @@ public class FavoritesManager : MonoBehaviour
hiddenPosition = new Vector2(favoritesUIRectTransform.anchoredPosition.x * 2,
favoritesUIRectTransform.anchoredPosition.y);
visiblePosition = new Vector2(favoritesUIRectTransform.anchoredPosition.x, 0);
// // 设置收藏夹的初始位置为隐藏
// 设置收藏夹的初始位置为隐藏
favoritesUIRectTransform.anchoredPosition = hiddenPosition;
favoritesUI.SetActive(false);
// // 绑定按钮事件
toggleFavoritesButton.onClick.AddListener(ToggleFavorites);
// 绑定按钮事件
//punchTapeTabButton.onClick.AddListener(ShowPunchTapeFavorites);
//screenshotTabButton.onClick.AddListener(ShowScreenshotFavorites);
ShowPunchTapeFavorites();
}
public void ToggleFavorites()
{
if (isFavoritesOpen)
{
CloseFavorites();
}
else
{
OpenFavorites();
}
ShowPunchTapeFavorites();
}
public void AddClue(Clue clue)
@@ -112,7 +86,7 @@ public class FavoritesManager : MonoBehaviour
}
// 重新创建剩余线索的UI
foreach (Clue clue in _clueData.punchTapeFavorites)
foreach (PunchTape clue in _clueData.punchTapeFavorites)
{
GameObject clueItemGO;
ClueItem clueItem;
@@ -146,7 +120,6 @@ public class FavoritesManager : MonoBehaviour
UpdateFavoritesUI();
favoritesUI.SetActive(true);
ShowPunchTapeFavorites();
isFavoritesOpen = true;
// 用DOTween从右侧移动到可见区域
favoritesUIRectTransform.DOAnchorPos(visiblePosition, 0.5f); // 移动动画,持续0.5秒
@@ -155,7 +128,6 @@ public class FavoritesManager : MonoBehaviour
public void CloseFavorites()
{
UpdateFavoritesUI();
isFavoritesOpen = false;
// 用DOTween移动回右侧屏幕外
favoritesUIRectTransform.DOAnchorPos(hiddenPosition, 0.5f).OnComplete(() =>
@@ -164,7 +136,7 @@ public class FavoritesManager : MonoBehaviour
});
}
public void ShowPunchTapeFavorites()
private void ShowPunchTapeFavorites()
{
UpdateFavoritesUI();
punchTapePanel.SetActive(true);
@@ -173,7 +145,7 @@ public class FavoritesManager : MonoBehaviour
public class ClueData : IData
{
public List<PunchTape> punchTapeFavorites = new List<PunchTape>();
public readonly List<PunchTape> punchTapeFavorites = new();
public event Action<ClueData> LoadEvent;
public IEnumerator Load()
+12 -16
View File
@@ -1,35 +1,30 @@
using System.Drawing;
using UnityEngine;
using DG.Tweening;
public class MemoryClueSlot : ClueSlotBase
{
private MemoryProcess memoryManager;
[HideInInspector]
public PunchTape punchTape;
[HideInInspector] public PunchTape punchTape;
protected override void Start()
{
base.Start(); // 初始化基类中的内容
memoryManager = FindObjectOfType<MemoryProcess>();
expectedClueType=ClueType.PunchTape;
memoryManager = FindObjectOfType<MemoryProcess>();
expectedClueType = ClueType.PunchTape;
}
// 重写基类的 OnClueInserted 方法,处理播放记忆的逻辑
protected override void OnClueInserted(Clue clue)
{
punchTape = clue as PunchTape;
coverClose.enabled=true;
coverOpen.enabled=false;
PlayMemory(punchTape);
FavoritesManager.Instance.RemoveClue(clue);
punchTape = clue as PunchTape;
coverClose.enabled = true;
coverOpen.enabled = false;
PlayMemory(punchTape);
FavoritesManager.Instance.RemoveClue(clue);
}
public override void ReleaseSlot()
{
base.ReleaseSlot(); // 保证基类的清理逻辑被执行
}
private void PlayMemory(PunchTape punchTape)
{
if (punchTape != null)
@@ -39,6 +34,7 @@ public class MemoryClueSlot : ClueSlotBase
StartCoroutine(memoryManager.SearchMemory(punchTape));
}
}
private void StartFilmAnimation()
{
// 使用 DOTween 实现胶片的循环移动
@@ -54,4 +50,4 @@ public class MemoryClueSlot : ClueSlotBase
// 重置胶片位置
filmImage.rectTransform.localPosition = Vector3.zero;
}
}
}
@@ -1,6 +1,8 @@
using System;
using AibisDream.Utility;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace AibisDream.FixSystem
{
@@ -19,6 +21,9 @@ namespace AibisDream.FixSystem
private SpriteRenderer _targetSpriteRenderer; // 目标的 SpriteRenderer
private LineRenderer _dotLine;
private LineRenderer _cutLine;
#endregion
// 模块基本数据
@@ -92,6 +97,38 @@ namespace AibisDream.FixSystem
}
#endregion
#region
public void EnableCut()
{
// 显示虚线
var dotLine = GetOrCreateDotLine();
// 指针转为锯片
}
private void OnCut()
{
//
}
private LineRenderer GetOrCreateDotLine()
{
if (_dotLine != null)
{
return _dotLine;
}
var dotLine = new GameObject("Dot Line").AddComponent<LineRenderer>();
// 设置Line的参数
dotLine.sortingLayerName = ConstRef.FixMiddleLayer;
dotLine.sortingOrder = 4;
// dotLine.materials = new[] { };
Addressables.LoadAssetAsync<Material>(ConstRef.DotLineMaterialName);
return dotLine;
}
#endregion
}
[Serializable]
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text;
using AibisDream.Framework;
using AibisDream.Kit;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@@ -215,16 +214,6 @@ namespace AibisDream
DialogRecord.Clear();
}
/// <summary>
/// 切换对话回顾展示状态
/// </summary>
public void ControlDialogHistory()
{
var logObj = transform.Find("Dialogue Log").gameObject;
logObj.SetActive(!logObj.activeSelf);
EnumEventSystem.Global.Send(EventEnum.Menu, logObj.activeSelf);
}
#endregion
}
+4
View File
@@ -13,5 +13,9 @@ namespace AibisDream.Utility
public const string SurveyURL = "https://wj.qq.com/s2/15348910/3c8c/";
public static readonly string TestSaveFilePath = Application.streamingAssetsPath + "/TestSaveFiles";
public const string FixMiddleLayer = "FixMiddle";
public const string DotLineMaterialName = "DotLine";
}
}