InputDeviceKSPartUI.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using UnityEngine;
  3. namespace SC.XR.Unity.Module_InputSystem.InputDeviceGC.KS {
  4. public class InputDeviceKSPartUI : InputDeviceGCPartUI {
  5. public InputDeviceKSPart inputDeviceKSPart {
  6. get {
  7. return inputDevicePartBase as InputDeviceKSPart;
  8. }
  9. }
  10. private ModelK102 modelK102 { get { return GetComponentInChildren<ModelK102>(true); } }
  11. private ModelK101 modelK101 { get { return GetComponentInChildren<ModelK101>(true); } }
  12. private ModelK11 modelK11 { get { return GetComponentInChildren<ModelK11>(true); } }
  13. public override void OnSCAwake() {
  14. base.OnSCAwake();
  15. RemoveModule(modelBase);
  16. AddModule(modelK102);
  17. AddModule(modelK101);
  18. AddModule(modelK11);
  19. }
  20. public override void OnSCStart() {
  21. base.OnSCStart();
  22. modelBase?.ModuleStop();
  23. if (inputDeviceKSPart.inputDataGC.GCType == GCType.K102 && modelK102) {
  24. modelBase = ModelGC = modelK102;
  25. }else if (inputDeviceKSPart.inputDataGC.GCType == GCType.K101 && modelK101) {
  26. modelBase = ModelGC = modelK101;
  27. } else if(inputDeviceKSPart.inputDataGC.GCType == GCType.K11 && modelK11) {
  28. modelBase = ModelGC = modelK11;
  29. }
  30. AddModule(modelBase);
  31. modelBase?.ModuleStart();
  32. DebugMy.Log("Model Type:" + modelBase?.GetType(),this,true);
  33. }
  34. public override void OnSCDisable() {
  35. base.OnSCDisable();
  36. RemoveModule(modelBase);
  37. modelBase = ModelGC = null;
  38. }
  39. }
  40. }