Game3DInputField.cs 968 B

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