feat(blockpuzzle): 重构方块拼图系统支持完整流程
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
@@ -606,16 +607,16 @@ namespace AibisDream
|
||||
BlockPuzzleSystem.LoadShapeRack();
|
||||
}
|
||||
|
||||
[YarnCommand("switch_block_puzzle_state")]
|
||||
public static void PlayShapeAnimation(string triggerName)
|
||||
[YarnCommand("unlock_block_puzzle_system")]
|
||||
public static IEnumerator UnlockSystem()
|
||||
{
|
||||
BlockPuzzleSystem.PlayShapeAnimation(triggerName);
|
||||
yield return BlockPuzzleSystem.UnlockSystem();
|
||||
}
|
||||
|
||||
[YarnCommand("unlock_block_puzzle_system")]
|
||||
public static void UnlockSystem()
|
||||
[YarnCommand("lock_block_puzzle_system")]
|
||||
public static IEnumerator LockSystem()
|
||||
{
|
||||
BlockPuzzleSystem.SetLocked(false);
|
||||
yield return BlockPuzzleSystem.LockSystem();
|
||||
}
|
||||
|
||||
[YarnCommand("enable_drag")]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.FixSystem;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -34,6 +35,7 @@ namespace AibisDream
|
||||
private void Start()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
RepairSystemManager.Register(this);
|
||||
blockPuzzlePanel = FixPanelSystem.GetRepairPanel<BlockPuzzlePanel>();
|
||||
|
||||
if (initializeOnStart)
|
||||
@@ -120,6 +122,8 @@ namespace AibisDream
|
||||
}
|
||||
|
||||
var validateResult = validator.Validate(grid.GetShapes());
|
||||
var shapesInGrid = grid.GetShapes().Select(s => s.BlockShapeData.blockShapeInfo.shapeName).ToArray();
|
||||
StorageSystem.Instance.SetValue("$shapesInGrid", string.Join(",", shapesInGrid));
|
||||
|
||||
// 如果验证通过, 则设置变量并弹出对话
|
||||
if (validateResult.isPass)
|
||||
@@ -151,6 +155,18 @@ namespace AibisDream
|
||||
UpdateInteractionState();
|
||||
}
|
||||
|
||||
public IEnumerator LockSystem()
|
||||
{
|
||||
SetLocked(true);
|
||||
yield return TimelineCenter.Instance.PlayTimelineAsync("卡扣/卡扣锁定");
|
||||
}
|
||||
|
||||
public IEnumerator UnlockSystem()
|
||||
{
|
||||
yield return TimelineCenter.Instance.PlayTimelineAsync("卡扣/卡扣解锁");
|
||||
SetLocked(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新所有交互组件的状态
|
||||
/// </summary>
|
||||
@@ -181,12 +197,6 @@ namespace AibisDream
|
||||
shapeFactory.SetAllShapesInteractionMode(InteractionMode.Drag);
|
||||
}
|
||||
|
||||
public void PlayShapeAnimation(string triggerName)
|
||||
{
|
||||
// 播放Timeline
|
||||
TimelineCenter.Instance.PlayTimeline("维修面板");
|
||||
}
|
||||
|
||||
public void LoadShapeRack()
|
||||
{
|
||||
blockPuzzlePanel.LoadBackupDevices();
|
||||
@@ -224,15 +234,13 @@ namespace AibisDream
|
||||
blockPuzzlePanel.ShowShapeInScreen(shapeData);
|
||||
}
|
||||
|
||||
// 旧的事件处理方法已迁移到新的详细事件处理器
|
||||
// OnShapeDragStart -> OnShapeDragStartDetailed
|
||||
// OnShapeDragEnd -> OnShapeDragEndDetailed
|
||||
// OnShapeDragUpdate -> OnShapeDragUpdateDetailed
|
||||
|
||||
public void OnShapeClick(BlockShape blockShape)
|
||||
{
|
||||
// 点击形状
|
||||
blockPuzzlePanel.ShowShapeInScreen(blockShape.BlockShapeData.blockShapeInfo);
|
||||
// 播放事件节点
|
||||
StorageSystem.Instance.SetValue("$selectedShape", blockShape.BlockShapeData.blockShapeInfo.shapeName);
|
||||
DialogController.Instance.StartDialogNode("ShapeSelected");
|
||||
}
|
||||
|
||||
#region 新的事件驱动处理器
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace AibisDream.Test
|
||||
{
|
||||
@@ -20,10 +21,12 @@ namespace AibisDream.Test
|
||||
ActionKit.Sequence()
|
||||
.Coroutine(() =>
|
||||
{
|
||||
Debug.Log("PlayTimeline");
|
||||
return TimelineCenter.Instance.PlayTimelineAsync("卡扣/卡扣解锁");
|
||||
})
|
||||
.Callback(() =>
|
||||
{
|
||||
Debug.Log("UnlockBlockPuzzle");
|
||||
BlockPuzzleYarnCommand.UnlockSystem();
|
||||
})
|
||||
.Start(this);
|
||||
@@ -41,12 +44,19 @@ namespace AibisDream.Test
|
||||
|
||||
public void Open()
|
||||
{
|
||||
BlockPuzzleYarnCommand.PlayShapeAnimation("Open");
|
||||
StartCoroutine(OpenCoroutine());
|
||||
}
|
||||
|
||||
public IEnumerator OpenCoroutine()
|
||||
{
|
||||
yield return TimelineCenter.Instance.PlayTimelineAsync(TimelineAssetRef.CablePanelExit);
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
yield return TimelineCenter.Instance.PlayTimelineAsync(TimelineAssetRef.BlockPuzzleEnter);
|
||||
BlockPuzzleYarnCommand.UnlockSystem();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
BlockPuzzleYarnCommand.PlayShapeAnimation("Close");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user