组装
This commit is contained in:
@@ -576,6 +576,7 @@ namespace AibisDream
|
||||
[Header("基础属性")]
|
||||
[Tooltip("可以后面在Json文件里改,更方便")]
|
||||
public ShapeProperty[] shapeProperties;
|
||||
public string shapeDescription;
|
||||
|
||||
[Header("额外限制")]
|
||||
public bool extraLimits;
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using Febucci.UI.Core;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BlockPuzzleScreen : MonoBehaviour
|
||||
{
|
||||
[Header("详情界面")]
|
||||
[SerializeField] private GameObject detailRoot;
|
||||
[SerializeField] private TMP_Text titleText;
|
||||
[SerializeField] private TMP_Text propInfo;
|
||||
[SerializeField] private TMP_Text detailContent;
|
||||
|
||||
[Header("Log界面")]
|
||||
[SerializeField] private TypewriterCore logText;
|
||||
|
||||
// --------------------------------- 详情展示 ---------------------------------
|
||||
|
||||
public void ShowDetail(BlockShapeData data)
|
||||
{
|
||||
ShowDetail();
|
||||
|
||||
titleText.text = data.shapeName;
|
||||
propInfo.text = ShapePropertyToString(data.shapeProperties);
|
||||
detailContent.text = data.shapeDescription;
|
||||
}
|
||||
|
||||
private string ShapePropertyToString(ShapeProperty[] properties)
|
||||
{
|
||||
string result = "|";
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var sign = property.value > 0 ? "+" : "-";
|
||||
result += $" {property.property}: {sign}{property.value} |";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void AddLog(string log)
|
||||
{
|
||||
ShowLog();
|
||||
|
||||
var oldText = logText.TextAnimator.textFull;
|
||||
if (!string.IsNullOrEmpty(oldText))
|
||||
{
|
||||
oldText = oldText.Replace("<notype>", "").Replace("</notype>", "");
|
||||
}
|
||||
|
||||
var newLog = $"{oldText}\n{log}";
|
||||
logText.ShowText(newLog);
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
{
|
||||
logText.TextAnimator.SetText("");
|
||||
}
|
||||
|
||||
// --------------------------------- 显示控制 ---------------------------------
|
||||
public void ShowLog()
|
||||
{
|
||||
logText.gameObject.SetActive(true);
|
||||
detailRoot.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ShowDetail()
|
||||
{
|
||||
logText.gameObject.SetActive(false);
|
||||
detailRoot.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void HideAll()
|
||||
{
|
||||
logText.gameObject.SetActive(false);
|
||||
detailRoot.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfc6e9508f6e40443a5847ac5ef7c485
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,6 +17,7 @@ namespace AibisDream
|
||||
[SerializeField] private Transform shapeRoot;
|
||||
[SerializeField] public BlockShapeRack shapeRack;
|
||||
[SerializeField] private Canvas canvas;
|
||||
|
||||
|
||||
[Header("临时按钮")]
|
||||
// 临时按钮
|
||||
|
||||
Reference in New Issue
Block a user