fix(blockpuzzle): 修复方块拼图回收逻辑和面板显示

This commit is contained in:
2026-03-09 16:00:11 +08:00
parent eaaf458de3
commit efb2ed69e3
5 changed files with 30 additions and 52 deletions
@@ -1175,31 +1175,12 @@ MonoBehaviour:
gridWidth: 6
gridHeight: 7
cellSize: 1.17
gridShapeDataInfos:
- shapeKey: "\u5171\u9E23\u8154"
rootCell: {x: 4, y: 5}
rotationAngle: 0
- shapeKey: "\u52A8\u5E73\u8861\u98DE\u8F6E\u7EC4"
rootCell: {x: 3, y: 2}
rotationAngle: 0
- shapeKey: "\u60EF\u6027\u7A33\u538B\u5668"
rootCell: {x: 0, y: 0}
rotationAngle: 0
- shapeKey: "\u8FDB\u6C14\u7CFB\u7EDF"
rootCell: {x: 2, y: 0}
rotationAngle: 0
- shapeKey: "\u8F85\u52A9\u6DA1\u8F6E"
rootCell: {x: 4, y: 0}
rotationAngle: 0
- shapeKey: "\u6563\u70ED\u7CFB\u7EDF"
rootCell: {x: 0, y: 2}
rotationAngle: 0
- shapeKey: "\u65E7\u52A8\u529B\u6838\u5FC3"
rootCell: {x: 0, y: 4}
rotationAngle: 0
gridShapeDataInfos: []
shapeInRack:
- "\u65B0\u52A8\u529B\u6838\u5FC3"
- "\u6563\u70ED\u6761"
recycleNoButtonShapes:
- "\u65E7\u52A8\u529B\u6838\u5FC3"
validatorName: "BlockPuzzleValidtor/\u5F15\u64CE\u5BA4\u89C4\u5219.asset"
initializeOnStart: 0
--- !u!1 &6175445682096451048
@@ -116,7 +116,9 @@ namespace AibisDream.FixSystem
public void OnRangeChanged(BlockPuzzleParamValue paramValue)
{
// TODO 更新进度条范围
powerProgressBar.MaxValue = paramValue.power;
noiseProgressBar.MaxValue = paramValue.noise;
heatProgressBar.MaxValue = paramValue.heat;
}
// ------------------------ 器件选择 -------------------------
@@ -169,23 +171,5 @@ namespace AibisDream.FixSystem
{
lockButton.GetComponent<BlockSubmitHander>().SetValidState(validateResult.isPass);
}
// ------------------------ 面板收放 -------------------------
public void Init()
{
}
public void Open()
{
TimelineCenter.Instance.PlayTimeline("维修面板/石头维修开启");
}
public void Close()
{
TimelineCenter.Instance.PlayTimeline("维修面板/石头维修关闭");
}
public FixState TargetState => FixState.BlockPuzzle;
}
}
@@ -642,6 +642,8 @@ namespace AibisDream
// 网格内Shape
public GridShapeData[] gridShapeDataInfos;
public string[] shapeInRack;
// 回收时不添加 DeviceButton 的 Shape 名称列表
public string[] recycleNoButtonShapes;
// 验证器
public string validatorName;
}
@@ -128,10 +128,7 @@ namespace AibisDream
// 如果验证通过, 则设置变量并弹出对话
if (validateResult.isPass)
{
// StorageSystem.Instance.SetValue("$block_puzzle_pass", true);
// DialogController.Instance.StartDialogNode("方块拼图完成");
Debug.Log("方块拼图完成");
SingleCastEventSystem.Global.Trigger(DialogEventEnum.StartNode, "BlockPuzzlePass");
}
}
@@ -240,7 +237,7 @@ namespace AibisDream
blockPuzzlePanel.ShowShapeInScreen(blockShape.BlockShapeData.blockShapeInfo);
// 播放事件节点
StorageSystem.Instance.SetValue("$selectedShape", blockShape.BlockShapeData.blockShapeInfo.shapeName);
DialogController.Instance.StartDialogNode("ShapeSelected");
SingleCastEventSystem.Global.Trigger(DialogEventEnum.StartNode, "ShapeSelected");
}
#region
@@ -289,8 +286,6 @@ namespace AibisDream
private void OnShapeDragEndDetailed(object sender, DragEndEventArgs args)
{
var blockShape = args.Shape;
// 隐藏网格
grid.GridVisualizer.SetGridVisible(false);
@@ -332,11 +327,24 @@ namespace AibisDream
blockPuzzlePanel.ClearShapeInScreen();
blockPuzzlePanel.SwitchToLogScreen();
// 向面板添加回收的形状
blockPuzzlePanel.OnDeviceRecycle(args.Shape);
// 获取 Shape 名称
string shapeName = args.Shape.ShapeName;
// 更新事件参数
args.IsHandled = true;
// 检查是否在不添加按钮的列表中
bool shouldAddButton = puzzleData.recycleNoButtonShapes == null ||
!puzzleData.recycleNoButtonShapes.Contains(shapeName);
if (shouldAddButton)
{
// 向面板添加回收的形状
blockPuzzlePanel.OnDeviceRecycle(args.Shape);
}
else
{
SingleCastEventSystem.Global.Trigger(DialogEventEnum.StartNode, "ShapeRecycled");
}
// 更新事件参数 args.IsHandled = true;
args.FinalState = DragState.Idle;
args.ResultType = DragEndResultType.Recycled;
@@ -80,6 +80,9 @@
"新动力核心",
"散热条"
],
"recycleNoButtonShapes": [
"旧动力核心"
],
"validatorName": "BlockPuzzleValidtor/引擎室规则.asset"
}
}