コード例 #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));
        }
コード例 #2
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;
            }
        }
コード例 #3
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();
        }
コード例 #4
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();
        }
コード例 #5
0
ファイル: DebugTriggerImpl.cs プロジェクト: BuCai/Hit
        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();
        }
コード例 #6
0
 private void OnLevelWasLoaded(int level)
 {
     SRDebuggerUtil.EnsureEventSystemExists();
 }
コード例 #7
0
 private static void OnActiveSceneChanged(UnityEngine.SceneManagement.Scene s1, UnityEngine.SceneManagement.Scene s2)
 {
     SRDebuggerUtil.EnsureEventSystemExists();
 }