Ejemplo n.º 1
0
        public void ShowBugReporter(BugReportCompleteCallback callback, bool takeScreenshotFirst,
                                    string descriptionText)
        {
            if (_isVisible)
            {
                throw new InvalidOperationException("Bug report popover is already visible.");
            }

            if (_popover == null)
            {
                Load();
            }

            if (_popover == null)
            {
                Debug.LogWarning("[SRDebugger] Bug report popover failed loading, executing callback with fail result");
                callback(false, "Resource load failed");
                return;
            }

            _callback = callback;

            _isVisible = true;
            SRDebuggerUtil.EnsureEventSystemExists();

            StartCoroutine(OpenCo(takeScreenshotFirst, descriptionText));
        }
        private void Start()
        {
            var c = GetComponent <Canvas>();

            SRDebuggerUtil.ConfigureCanvas(c);

            Destroy(this);
        }
Ejemplo n.º 3
0
        private void Refresh()
        {
            // Update total counts labels
            TextInfo.text     = SRDebuggerUtil.GetNumberString(Service.Console.InfoCount, 999, "999+");
            TextWarnings.text = SRDebuggerUtil.GetNumberString(Service.Console.WarningCount, 999, "999+");
            TextErrors.text   = SRDebuggerUtil.GetNumberString(Service.Console.ErrorCount, 999, "999+");

            _isDirty = false;
        }
Ejemplo n.º 4
0
        private void CreateTrigger()
        {
            var prefab = Resources.Load <TriggerRoot>(SRDebugPaths.TriggerPrefabPath);

            if (prefab == null)
            {
                Debug.LogError("[SRDebugger] Error loading trigger prefab");
                return;
            }

            _trigger = SRInstantiate.Instantiate(prefab);
            _trigger.CachedTransform.SetParent(CachedTransform, true);

            SetTriggerPosition(_trigger.TriggerTransform, _position);

            switch (Settings.Instance.TriggerBehaviour)
            {
            case Settings.TriggerBehaviours.TripleTap:
            {
                _trigger.TripleTapButton.onClick.AddListener(OnTriggerButtonClick);
                _trigger.TapHoldButton.gameObject.SetActive(false);

                break;
            }

            case Settings.TriggerBehaviours.TapAndHold:
            {
                _trigger.TapHoldButton.onLongPress.AddListener(OnTriggerButtonClick);
                _trigger.TripleTapButton.gameObject.SetActive(false);

                break;
            }

            case Settings.TriggerBehaviours.DoubleTap:
            {
                _trigger.TripleTapButton.RequiredTapCount = 2;
                _trigger.TripleTapButton.onClick.AddListener(OnTriggerButtonClick);
                _trigger.TapHoldButton.gameObject.SetActive(false);

                break;
            }

            default:
                throw new Exception("Unhandled TriggerBehaviour");
            }

            SRDebuggerUtil.EnsureEventSystemExists();

            UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnActiveSceneChanged;

            if (Settings.Instance.ErrorNotification)
            {
                _consoleService        = SRServiceManager.GetService <IConsoleService>();
                _consoleService.Error += OnError;
            }
        }
Ejemplo n.º 5
0
        private void Refresh()
        {
            // Update total counts labels
            ToggleInfoText.text     = SRDebuggerUtil.GetNumberString(Service.Console.InfoCount, 999, "999+");
            ToggleWarningsText.text = SRDebuggerUtil.GetNumberString(Service.Console.WarningCount, 999, "999+");
            ToggleErrorsText.text   = SRDebuggerUtil.GetNumberString(Service.Console.ErrorCount, 999, "999+");

            ConsoleLogControl.ShowErrors   = ToggleErrors.isOn;
            ConsoleLogControl.ShowWarnings = ToggleWarnings.isOn;
            ConsoleLogControl.ShowInfo     = ToggleInfo.isOn;

            PinToggle.isOn = Service.DockConsole.IsVisible;

            _isDirty = false;
        }
        private void Start()
        {
            _canvas       = GetComponent <Canvas>();
            _canvasScaler = GetComponent <CanvasScaler>();

            SRDebuggerUtil.ConfigureCanvas(_canvas);

            _originalScale            = _canvasScaler.scaleFactor;
            _canvasScaler.scaleFactor = _originalScale * SRDebug.Instance.Settings.UIScale;

            // Track the last set scale in case it is modified by the retina scaler.
            _lastSetScale = _canvasScaler.scaleFactor;

            SRDebug.Instance.Settings.PropertyChanged += SettingsOnPropertyChanged;
        }
Ejemplo n.º 7
0
        private void Load()
        {
            var prefab = Resources.Load <DebugPanelRoot>(SRDebugPaths.DebugPanelPrefabPath);

            if (prefab == null)
            {
                Debug.LogError("[SRDebugger] Error loading debug panel prefab");
                return;
            }

            _debugPanelRootObject      = SRInstantiate.Instantiate(prefab);
            _debugPanelRootObject.name = "Panel";

            _debugPanelRootObject.CachedTransform.SetParent(Hierarchy.Get("SRDebugger"), true);

            DontDestroyOnLoad(_debugPanelRootObject);

            SRDebuggerUtil.EnsureEventSystemExists();
        }
Ejemplo n.º 8
0
        public void ShowPinEntry(IList <int> requiredPin, string message, PinEntryCompleteCallback callback,
                                 bool allowCancel = true)
        {
            if (_isVisible)
            {
                throw new InvalidOperationException("Pin entry is already in progress");
            }

            VerifyPin(requiredPin);

            if (_pinControl == null)
            {
                Load();
            }

            if (_pinControl == null)
            {
                Debug.LogWarning("[PinEntry] Pin entry failed loading, executing callback with fail result");
                callback(false);
                return;
            }

            _pinControl.Clear();
            _pinControl.PromptText.text = message;

            _pinControl.CanCancel = allowCancel;

            _callback = callback;

            _requiredPin.Clear();
            _requiredPin.AddRange(requiredPin);

            _pinControl.Show();

            _isVisible = true;

            SRDebuggerUtil.EnsureEventSystemExists();
        }
Ejemplo n.º 9
0
        private void CreateTrigger()
        {
            var prefab = Resources.Load <TriggerRoot>(SRDebugPaths.TriggerPrefabPath);

            if (prefab == null)
            {
                Debug.LogError("[SRDebugger] Error loading trigger prefab");
                return;
            }

            _trigger = SRInstantiate.Instantiate(prefab);
            _trigger.CachedTransform.SetParent(CachedTransform, true);

            SetTriggerPosition(_trigger.TriggerTransform, _position);

            switch (Settings.Instance.TriggerBehaviour)
            {
            case Settings.TriggerBehaviours.TripleTap: {
                _trigger.TripleTapButton.onClick.AddListener(OnTriggerButtonClick);
                _trigger.TapHoldButton.gameObject.SetActive(false);

                break;
            }

            case Settings.TriggerBehaviours.TapAndHold: {
                _trigger.TapHoldButton.onLongPress.AddListener(OnTriggerButtonClick);
                _trigger.TripleTapButton.gameObject.SetActive(false);

                break;
            }

            default:
                throw new Exception("Unhandled TriggerBehaviour");
            }


            SRDebuggerUtil.EnsureEventSystemExists();
        }
Ejemplo n.º 10
0
        public void AddContainer(object obj)
        {
            if (_optionContainerLookup.ContainsKey(obj))
            {
                throw new Exception("An object should only be added once.");
            }

            var options = SRDebuggerUtil.ScanForOptions(obj);

            _optionContainerLookup.Add(obj, options);

            if (options.Count > 0)
            {
                _options.AddRange(options);
                OnOptionsUpdated();

                var changed = obj as INotifyPropertyChanged;
                if (changed != null)
                {
                    changed.PropertyChanged += OnPropertyChanged;
                }
            }
        }
Ejemplo n.º 11
0
 public void Scan(object obj)
 {
     _options.AddRange(SRDebuggerUtil.ScanForOptions(obj));
 }
Ejemplo n.º 12
0
 private void OnLevelWasLoaded(int level)
 {
     SRDebuggerUtil.EnsureEventSystemExists();
 }
 private static void OnActiveSceneChanged(UnityEngine.SceneManagement.Scene s1, UnityEngine.SceneManagement.Scene s2)
 {
     SRDebuggerUtil.EnsureEventSystemExists();
 }