| | 1 | | using DCL.Helpers; |
| | 2 | | using UnityEngine; |
| | 3 | | using UnityEngine.UI; |
| | 4 | |
|
| | 5 | | namespace DCL |
| | 6 | | { |
| | 7 | | public class UserBenchmarkToggler : MonoBehaviour |
| | 8 | | { |
| | 9 | | const string SHORTCUT_TEXT = "[Y] Debug Panel"; |
| | 10 | |
|
| | 11 | | public UserBenchmarkController userBenchmarkController; |
| | 12 | | Text text; |
| | 13 | |
|
| | 14 | | void Start() |
| | 15 | | { |
| 0 | 16 | | text = GetComponent<Text>(); |
| 0 | 17 | | text.text = SHORTCUT_TEXT; |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | void Update() |
| | 21 | | { |
| 0 | 22 | | if (Input.GetKeyUp(KeyCode.Y)) |
| | 23 | | { |
| 0 | 24 | | TogglePanel(); |
| | 25 | | } |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | private void TogglePanel() |
| | 29 | | { |
| 0 | 30 | | userBenchmarkController.gameObject.SetActive(!userBenchmarkController.gameObject.activeSelf); |
| 0 | 31 | | Utils.ForceRebuildLayoutImmediate(transform.parent.GetComponent<RectTransform>()); |
| 0 | 32 | | } |
| | 33 | | } |
| | 34 | | } |