InputDeviceKSPartUI.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 ModelK101 modelK101 { get { return GetComponentInChildren<ModelK101>(true); } }
  11. private ModelK11 modelK11 { get { return GetComponentInChildren<ModelK11>(true); } }
  12. public override void OnSCAwake() {
  13. base.OnSCAwake();
  14. RemoveModule(modelBase);
  15. AddModule(modelK101);
  16. AddModule(modelK11);
  17. }
  18. public override void OnSCStart() {
  19. base.OnSCStart();
  20. modelBase.ModuleStop();
  21. if(inputDeviceKSPart.inputDataGC.GCType == GCType.K101 && modelK101) {
  22. modelBase = ModelGC = modelK101;
  23. } else if(inputDeviceKSPart.inputDataGC.GCType == GCType.K11 && modelK11) {
  24. modelBase = ModelGC = modelK11;
  25. }
  26. AddModule(modelBase);
  27. modelBase?.ModuleStart();
  28. DebugMy.Log("Model Type:" + modelBase?.GetType(),this,true);
  29. }
  30. public override void OnSCDisable() {
  31. base.OnSCDisable();
  32. RemoveAllModule();
  33. modelBase = ModelGC = null;
  34. }
  35. }
  36. }