Game3DInputField.cs 953 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Game3DInputField : MonoBehaviour
  5. {
  6. [SerializeField]
  7. public GameKey3Dboard keyboard;
  8. [SerializeField]
  9. private TextMesh placeholderCompontent;
  10. [SerializeField]
  11. private TextMesh textCompontent;
  12. private string _text;
  13. [SerializeField]
  14. public int maxLength;//字符数量
  15. public string text
  16. {
  17. set
  18. {
  19. _text = value;
  20. textCompontent.text = _text;
  21. placeholderCompontent.gameObject.SetActive(_text == string.Empty);
  22. }
  23. get
  24. {
  25. return _text;
  26. }
  27. }
  28. void Start()
  29. {
  30. //text = string.Empty;
  31. keyboard.done();
  32. }
  33. public void onClick()
  34. {
  35. keyboard.show(this, _text);
  36. }
  37. private void OnDisable()
  38. {
  39. keyboard.done();
  40. }
  41. }