InputDeviceKSPartUI.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 ModleK102Blend modleK102Blend { get { return GetComponentInChildren<ModleK102Blend>(true); } }
  12. private ModelK101 modelK101 { get { return GetComponentInChildren<ModelK101>(true); } }
  13. private ModelK11 modelK11 { get { return GetComponentInChildren<ModelK11>(true); } }
  14. private ModelK07 modelK07 { get { return GetComponentInChildren<ModelK07>(true); } }
  15. private ModelNolo modelNolo { get { return GetComponentInChildren<ModelNolo>(true); } }
  16. private ModelLuci modelLuci { get { return GetComponentInChildren<ModelLuci>(true); } }
  17. public override void OnSCAwake() {
  18. base.OnSCAwake();
  19. RemoveModule(modelBase);
  20. AddModule(modelK102);
  21. AddModule(modleK102Blend);
  22. AddModule(modelK101);
  23. AddModule(modelK11);
  24. AddModule(modelK07);
  25. AddModule(modelNolo);
  26. AddModule(modelLuci);
  27. }
  28. public override void OnSCStart() {
  29. base.OnSCStart();
  30. modelBase?.ModuleStop();
  31. if (inputDeviceKSPart.inputDataGC.GCType == GCType.K102 && modleK102Blend) {
  32. modelBase = ModelGC = modleK102Blend;
  33. } else if (inputDeviceKSPart.inputDataGC.GCType == GCType.K101 && modelK101) {
  34. modelBase = ModelGC = modelK101;
  35. } else if (inputDeviceKSPart.inputDataGC.GCType == GCType.K11 && modelK11) {
  36. modelBase = ModelGC = modelK11;
  37. } else if (inputDeviceKSPart.inputDataGC.GCType == GCType.K07 && modelK07) {
  38. modelBase = ModelGC = modelK07;
  39. } else if (inputDeviceKSPart.inputDataGC.GCType == GCType.Nolo && modelNolo) {
  40. modelBase = ModelGC = modelNolo;
  41. } else if (inputDeviceKSPart.inputDataGC.GCType == GCType.Luci && modelLuci) {
  42. modelBase = ModelGC = modelLuci;
  43. } else {
  44. DebugMy.Log("Error No find inputDeviceKSPart.inputDataGC.GCType Model Module,Use Default !", this, true);
  45. modelBase = ModelGC = modleK102Blend;
  46. }
  47. AddModule(modelBase);
  48. modelBase?.ModuleStart();
  49. DebugMy.Log("Model Type:" + modelBase?.GetType(),this,true);
  50. }
  51. public override void OnSCDisable() {
  52. base.OnSCDisable();
  53. RemoveModule(modelBase);
  54. modelBase = ModelGC = null;
  55. }
  56. }
  57. }