FM/Assets/Scripts/FUJIFILM/UI/Other/UpdateTargetUI.cs

46 lines
1.1 KiB
C#
Raw Normal View History

2025-08-22 22:37:04 +08:00
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace HK.FUJIFILM
{
public class UpdateTargetUI : MonoBehaviour
{
public int ID;
public bool isText;
public TMP_Text txtTarget;
private TMP_Text txtSelf;
public bool isInputField;
public TMP_InputField inpTarget;
private TMP_InputField inpSelf;
public bool isImage;
public Image imgTarget;
private Image imgSelf;
private void Awake()
{
if (isText)
txtSelf = GetComponent<TMP_Text>();
if (isInputField)
inpSelf = GetComponent<TMP_InputField>();
if (isImage)
imgSelf = GetComponent<Image>();
}
private void Update()
{
if (isText && txtTarget != null)
txtSelf.text = txtTarget.text;
if (isInputField && inpTarget != null)
inpSelf.text = inpTarget.text;
if (isImage && imgTarget != null)
imgSelf.sprite = imgTarget.sprite;
}
}
}