mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
Added Panel in Live View and IK mode.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
33
Assets/IKModulePanel.cs
Normal file
33
Assets/IKModulePanel.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
/// <summary>
|
||||
/// IK-mode side panel: shows fixed-module hint. Text is set in the scene.
|
||||
/// </summary>
|
||||
public class IKModulePanel : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI moduleInfoText;
|
||||
|
||||
[Header("Panel Layout")]
|
||||
public float panelWidth = 260f;
|
||||
[Range(0f, 0.5f)]
|
||||
public float cornerRadius = 0.12f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
ApplyRoundedMaterial();
|
||||
}
|
||||
|
||||
void ApplyRoundedMaterial()
|
||||
{
|
||||
var img = GetComponent<Image>();
|
||||
if (img == null || (img.material != null && img.material.shader != null && img.material.shader.name == "UI/RoundedRect")) return;
|
||||
var shader = Shader.Find("UI/RoundedRect");
|
||||
if (shader == null) return;
|
||||
var mat = new Material(shader);
|
||||
mat.SetFloat("_Radius", cornerRadius);
|
||||
img.material = mat;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user