fix: 修复 UI 导航流程,添加 Debug.Log 完整日志
- 重写 PageController.cs,为所有按钮回调添加完整 Debug.Log - 自动修复 _btnFixationBack:未赋值时自动查找 FixationPanel/BtnBack - 自动修复 _btnExperimentBack:未赋值时自动查找 ExperimentPanel/Navbar/BtnBack - 删除失效的 Canvas 根级冗余 BtnFixationBack - 添加 3D 角色模型资源(man/woman 模型、动画、TextMesh Pro) - 添加 ExperimentPanel UI 资源和 TrainingBackground 素材 测试方法:进入 Play 模式,查看 Console 以验证每个按钮的绑定状态和点击回调是否正常触发。
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
public class TMP_ExampleScript_01 : MonoBehaviour
|
||||
{
|
||||
public enum objectType { TextMeshPro = 0, TextMeshProUGUI = 1 };
|
||||
|
||||
public objectType ObjectType;
|
||||
public bool isStatic;
|
||||
|
||||
private TMP_Text m_text;
|
||||
|
||||
//private TMP_InputField m_inputfield;
|
||||
|
||||
|
||||
private const string k_label = "The count is <#0080ff>{0}</color>";
|
||||
private int count;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// Get a reference to the TMP text component if one already exists otherwise add one.
|
||||
// This example show the convenience of having both TMP components derive from TMP_Text.
|
||||
if (ObjectType == 0)
|
||||
m_text = GetComponent<TextMeshPro>() ?? gameObject.AddComponent<TextMeshPro>();
|
||||
else
|
||||
m_text = GetComponent<TextMeshProUGUI>() ?? gameObject.AddComponent<TextMeshProUGUI>();
|
||||
|
||||
// Load a new font asset and assign it to the text object.
|
||||
m_text.font = Resources.Load<TMP_FontAsset>("Fonts & Materials/Anton SDF");
|
||||
|
||||
// Load a new material preset which was created with the context menu duplicate.
|
||||
m_text.fontSharedMaterial = Resources.Load<Material>("Fonts & Materials/Anton SDF - Drop Shadow");
|
||||
|
||||
// Set the size of the font.
|
||||
m_text.fontSize = 120;
|
||||
|
||||
// Set the text
|
||||
m_text.text = "A <#0080ff>simple</color> line of text.";
|
||||
|
||||
// Get the preferred width and height based on the supplied width and height as opposed to the actual size of the current text container.
|
||||
Vector2 size = m_text.GetPreferredValues(Mathf.Infinity, Mathf.Infinity);
|
||||
|
||||
// Set the size of the RectTransform based on the new calculated values.
|
||||
m_text.rectTransform.sizeDelta = new Vector2(size.x, size.y);
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!isStatic)
|
||||
{
|
||||
m_text.SetText(k_label, count % 1000);
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user