UserSelectionpanelManager.cs 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class UserSelectionpanelManager : MonoBehaviour
  5. {
  6. // Start is called before the first frame update
  7. public List<GameObject> userSelectionPanelScButton_List;
  8. public List<GameObject> userSelectionPanelScButtonClickFX_List;
  9. public List<GameObject> userSelectionPanelScButtonEnterFX_List;
  10. public GameObject buttonEnterFX;
  11. public GameObject buttonClickFX;
  12. public GameManagers gameManagers;
  13. void Start()
  14. {
  15. userSelectionPanelScButton_List.ForEach(scObj =>
  16. {
  17. scObj.GetComponent<SCButton>().onClick.AddListener(() =>
  18. {
  19. userSelectionPanelScButton(scObj.name);
  20. buttonClickFX.GetComponent<UserSelectionpaneClickFX>().moveToEndV3 = scObj.transform.position;
  21. buttonClickFX.GetComponent<UserSelectionpaneClickFX>().userClickButtonStr(scObj.name);
  22. buttonEnterFX.GetComponent<UserSelectionpaneEnterFX>().userClickButtonStr(scObj.name);
  23. });
  24. scObj.GetComponent<SCButton>().onEnter.AddListener(() =>
  25. {
  26. buttonEnterFX.GetComponent<UserSelectionpaneEnterFX>().moveToEndV3 = scObj.transform.position;
  27. buttonEnterFX.GetComponent<UserSelectionpaneEnterFX>().moevToendRotV3 = scObj.transform.rotation;
  28. buttonEnterFX.GetComponent<UserSelectionpaneEnterFX>().userEnterClick(true, scObj.name);
  29. });
  30. scObj.GetComponent<SCButton>().onExit.AddListener(() =>
  31. {
  32. });
  33. });
  34. }
  35. private string buttonNames;
  36. public void userSelectionPanelScButton(string ButtonName)
  37. {
  38. if (buttonNames == ButtonName)
  39. return;
  40. switch (ButtonName)
  41. {
  42. case "Button0":
  43. StartCoroutine(gameManagers.WaitForChildrenAnimEnd(gameManagers.currentReturnAnimName, "MainAnimation", new Vector3(0, -10f, 0), 3));
  44. break;
  45. case "Button1":
  46. StartCoroutine(gameManagers.WaitForChildrenAnimEnd(gameManagers.currentReturnAnimName, "fragmentAnimationToBasketballCourt", new Vector3(0, 172.653f, 0), 3));
  47. break;
  48. case "Button2":
  49. StartCoroutine(gameManagers.WaitForChildrenAnimEnd(gameManagers.currentReturnAnimName, "fragmentAnimationToCafe", new Vector3(0, 255.633f, 0), 3));
  50. break;
  51. case "Button3":
  52. StartCoroutine(gameManagers.WaitForChildrenAnimEnd(gameManagers.currentReturnAnimName, "fragmentAnimationToExhibitionHall", new Vector3(0, 74.08f, 0), 3));
  53. break;
  54. case "Button4":
  55. StartCoroutine(gameManagers.WaitForChildrenAnimEnd(gameManagers.currentReturnAnimName, "fragmentAnimationToConferenceRoom", new Vector3(0, -15f, 0), 3));
  56. break;
  57. }
  58. buttonNames = ButtonName;
  59. }
  60. private bool isOpen;
  61. public GameObject allGames;
  62. public GameObject uiGames;
  63. public GameObject houseGames;
  64. public GameObject maskGames;
  65. public void EditorMove()
  66. {
  67. if(!isOpen)
  68. {
  69. allGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.None;
  70. uiGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.None;
  71. houseGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.None;
  72. maskGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.None;
  73. isOpen = true;
  74. }
  75. else
  76. {
  77. allGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.Rotation;
  78. uiGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.Rotation;
  79. houseGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.Rotation;
  80. maskGames.GetComponent<BoundingBox>().ActiveHandle = BoundingBox.HandleType.Rotation;
  81. isOpen = false;
  82. }
  83. }
  84. }