12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using UnityEngine;
- using System.Collections;
- using System;
- public class DebugViewManager : MonoBehaviour
- {
- public static Action OnDebugView;
- #if UNITY_EDITOR || DEBUG
- private bool _showDebug = false;
- private bool _isExpanded = false;
-
- #if UNITY_EDITOR || UNITY_WEBPLAYER
- void Start()
- {
- _showDebug = true;
- }
- #endif
-
- #if UNITY_IPHONE || UNITY_ANDROID
- void Update()
- {
- if (Input.touchCount == 4 && Input.touches[0].phase == TouchPhase.Ended)
- {
- _showDebug = !_showDebug;
- }
- }
- #endif
-
- void OnGUI()
- {
- if (_showDebug)
- {
- //if (GUILayout.Button(_isExpanded ? "Hide Debug Menu" : "Show Debug Menu", GameConstants.DebugButtonWidth, GameConstants.DebugButtonHeight))
- {
- //_isExpanded = !_isExpanded;
- }
- if (_isExpanded)
- {
- if (GUILayout.Button("Delete PlayerPrefs (Restart app suggested)", GameConstants.DebugButtonWidth, GameConstants.DebugButtonHeight))
- {
- PlayerPrefs.DeleteAll();
- }
- if (GUILayout.Button("Clean cache (asset bundles)", GameConstants.DebugButtonWidth, GameConstants.DebugButtonHeight))
- {
- Caching.ClearCache();
- }
- if (GUILayout.Button("Reset Data", GameConstants.DebugButtonWidth, GameConstants.DebugButtonHeight))
- {
- CoreNotificationCenter.Post(CoreNotificationType.ResetData);
- }
- if (OnDebugView != null)
- {
- OnDebugView();
- }
- }
- }
- }
- #endif
- }
|