SCKeyboard3D.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UIElements;
  5. namespace SC.XR.Unity
  6. {
  7. public class SCKeyboard3D : SCKeyboardBase
  8. {
  9. private SCKeyboardMono keyboardMono;
  10. public SCKeyboard3D(Transform parent, Vector3 position, Quaternion rotation, Vector3 scale)
  11. : base(parent, position, rotation, scale) { }
  12. public override string PrefabResourceName
  13. {
  14. get
  15. {
  16. return "Keyboard/3DKeyboard";
  17. }
  18. }
  19. public override void Init()
  20. {
  21. keyboardMono = KeyboardGameObject.GetComponent<SCKeyboardMono>();
  22. if (keyboardMono == null)
  23. {
  24. Debug.LogError("This keyboard prefab do not have scripts inhert from SCKeyboardMono!");
  25. return;
  26. }
  27. keyboardMono.Initialize();
  28. //keyboardText = keyboardMono.keyboardText;
  29. keyboardMono.OnDoneButtonClick += OnDoneButtonClick;
  30. keyboardMono.OnTextChange += OnTextChange;
  31. }
  32. public override string text {
  33. get
  34. {
  35. return m_Text;
  36. }
  37. set
  38. {
  39. keyboardMono.keyboardPrompt.SetEnteredText(value);
  40. m_Text = value;
  41. }
  42. }
  43. public override void SetTextOnOpen(string openText)
  44. {
  45. keyboardMono.stringBuilder.Clear();
  46. keyboardMono.stringBuilder.Append(openText);
  47. keyboardMono.SetTextString();
  48. }
  49. }
  50. }