コード例 #1
0
        private void Load()
        {
            var dockService = SRServiceManager.GetService <IPinnedUIService>();

            if (dockService == null)
            {
                Debug.LogError("[DockConsoleService] PinnedUIService not found");
                return;
            }

            var pinService = dockService as PinnedUIServiceImpl;

            if (pinService == null)
            {
                Debug.LogError("[DockConsoleService] Expected IPinnedUIService to be PinnedUIServiceImpl");
                return;
            }

            _consoleRoot = pinService.DockConsoleController;

            _consoleRoot.SetDropdownVisibility(_isExpanded);
            _consoleRoot.IsVisible = _isVisible;
            _consoleRoot.SetAlignmentMode(_alignment);

            CheckTrigger();
        }
コード例 #2
0
        public SRDebugService()
        {
            SRServiceManager.RegisterService <IDebugService>(this);

            // Load profiler
            SRServiceManager.GetService <IProfilerService>();

            // Setup trigger service
            _debugTrigger = SRServiceManager.GetService <IDebugTriggerService>();

            _informationService = SRServiceManager.GetService <ISystemInformationService>();

            _pinnedUiService = SRServiceManager.GetService <IPinnedUIService>();
            _pinnedUiService.OptionsCanvasCreated += transform =>
            {
                if (PinnedUiCanvasCreated == null)
                {
                    return;
                }
                try
                {
                    PinnedUiCanvasCreated(transform);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            };

            _optionsService = SRServiceManager.GetService <IOptionsService>();

            // Create debug panel service (this does not actually load any UI resources until opened)
            _debugPanelService = SRServiceManager.GetService <IDebugPanelService>();

            // Subscribe to visibility changes to provide API-facing event for panel open/close
            _debugPanelService.VisibilityChanged += DebugPanelServiceOnVisibilityChanged;

            _debugTrigger.IsEnabled = Settings.EnableTrigger == Settings.TriggerEnableModes.Enabled ||
                                      Settings.EnableTrigger == Settings.TriggerEnableModes.MobileOnly && Application.isMobilePlatform ||
                                      Settings.EnableTrigger == Settings.TriggerEnableModes.DevelopmentBuildsOnly && Debug.isDebugBuild;

            _debugTrigger.Position = Settings.TriggerPosition;

            if (Settings.EnableKeyboardShortcuts)
            {
                SRServiceManager.GetService <KeyboardShortcutListenerService>();
            }

            _entryCodeEnabled = Settings.Instance.RequireCode && Settings.Instance.EntryCode.Count == 4;

            if (Settings.Instance.RequireCode && !_entryCodeEnabled)
            {
                Debug.LogError("[SRDebugger] RequireCode is enabled, but pin is not 4 digits");
            }

            // Ensure that root object cannot be destroyed on scene loads
            var srDebuggerParent = Hierarchy.Get("SRDebugger");

            Object.DontDestroyOnLoad(srDebuggerParent.gameObject);
        }
コード例 #3
0
        private IEnumerator SubmitCo()
        {
            if (BugReportScreenshotUtil.ScreenshotData == null && Settings.Instance.EnableBugReportScreenshot)
            {
                if (TakingScreenshot != null)
                {
                    TakingScreenshot();
                }

                yield return(new WaitForEndOfFrame());

                yield return(StartCoroutine(BugReportScreenshotUtil.ScreenshotCaptureCo()));

                if (ScreenshotComplete != null)
                {
                    ScreenshotComplete();
                }
            }

            var s = SRServiceManager.GetService <IBugReportService>();

            var r = new BugReport();

            r.Email           = EmailField.text;
            r.UserDescription = DescriptionField.text;

            r.ConsoleLog        = Service.Console.AllEntries.ToList();
            r.SystemInformation = SRServiceManager.GetService <ISystemInformationService>().CreateReport();
            r.ScreenshotData    = BugReportScreenshotUtil.ScreenshotData;

            BugReportScreenshotUtil.ScreenshotData = null;

            s.SendBugReport(r, OnBugReportComplete, OnBugReportProgress);
        }
コード例 #4
0
        private void PromptEntryCode()
        {
            SRServiceManager.GetService <IPinEntryService>()
            .ShowPinEntry(Settings.Instance.EntryCode, SRDebugStrings.Current.PinEntryPrompt,
                          entered =>
            {
                if (entered)
                {
                    if (!Settings.Instance.RequireEntryCodeEveryTime)
                    {
                        _hasAuthorised = true;
                    }

                    if (_queuedTab.HasValue)
                    {
                        var t = _queuedTab.Value;

                        _queuedTab = null;
                        ShowDebugPanel(t, false);
                    }
                    else
                    {
                        ShowDebugPanel(false);
                    }
                }

                _queuedTab = null;
            });
        }
コード例 #5
0
 public static void OnLoadBeforeScene()
 {
     if (Settings.Instance.IsEnabled)
     {
         // Initialize console if it hasn't already initialized.
         SRServiceManager.GetService <IConsoleService>();
     }
 }
コード例 #6
0
        public StandardConsoleService()
        {
            Application.logMessageReceivedThreaded += UnityLogCallback;

            SRServiceManager.RegisterService <IConsoleService>(this);
            _collapseEnabled   = Settings.Instance.CollapseDuplicateLogEntries;
            _allConsoleEntries = new CircularBuffer <ConsoleEntry>(Settings.Instance.MaximumConsoleEntries);
        }
コード例 #7
0
    public static void Init()
    {
        // Initialize console if it hasn't already initialized.
        SRServiceManager.GetService <IConsoleService>();

        // Load the debug service
        SRServiceManager.GetService <IDebugService>();
    }
コード例 #8
0
ファイル: SRMonoBehaviourEx.cs プロジェクト: alexnaraghi/SRF
    private static void PopulateObject(IList <FieldInfo> cache, SRMonoBehaviourEx instance, bool justSet)
    {
        for (var i = 0; i < cache.Count; i++)
        {
            var f = cache[i];

            if (!EqualityComparer <Object> .Default.Equals(f.Field.GetValue(instance), null))
            {
                continue;
            }

            // If import is enabled, use SRServiceManager to import the reference
            if (f.Import)
            {
                var t = f.ImportType ?? f.Field.FieldType;

                var service = SRServiceManager.GetService(t);

                if (service == null)
                {
                    Debug.LogWarning("Field {0} import failed (Type {1})".Fmt(f.Field.Name, t));
                    continue;
                }

                f.Field.SetValue(instance, service);

                continue;
            }

            // If autoset is enabled on field, try and find the component on the GameObject

            if (f.AutoSet)
            {
                var newValue = instance.GetComponent(f.Field.FieldType);

                if (!EqualityComparer <Object> .Default.Equals(newValue, null))
                {
                    f.Field.SetValue(instance, newValue);
                    continue;
                }
            }

            if (justSet)
            {
                continue;
            }

            if (f.AutoCreate)
            {
                var newValue = instance.CachedGameObject.AddComponent(f.Field.FieldType);
                f.Field.SetValue(instance, newValue);
            }

            throw new UnassignedReferenceException(
                      "Field {0} is unassigned, but marked with RequiredFieldAttribute".Fmt(f.Field.Name));
        }
    }
コード例 #9
0
        public void Refresh()
        {
            var s = SRServiceManager.GetService <ISystemInformationService>();

            foreach (var kv in _infoBlocks)
            {
                FillInfoBlock(kv.Value, s.GetInfo(kv.Key));
            }
        }
コード例 #10
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;
            }
        }
コード例 #11
0
    public static void Init()
    {
        if (!SRServiceManager.HasService <IConsoleService>())
        {
            // Force console service to be created early, so it catches more of the initialization log.
            new StandardConsoleService();
        }

        // Load the debug service
        SRServiceManager.GetService <IDebugService>();
    }
コード例 #12
0
ファイル: DebugPanelRoot.cs プロジェクト: gif-hara/Ferry
 public void Close()
 {
     if (Settings.Instance.UnloadOnClose)
     {
         SRServiceManager.GetService <IDebugService>().DestroyDebugPanel();
     }
     else
     {
         SRServiceManager.GetService <IDebugService>().HideDebugPanel();
     }
 }
コード例 #13
0
ファイル: AutoInitialize.cs プロジェクト: rab000/thappyphone
        public static void OnLoadBeforeScene()
        {
            // Populate service manager with types from SRDebugger assembly (asmdef)
            SRServiceManager.RegisterAssembly <IDebugService>();

            if (Settings.Instance.IsEnabled)
            {
                // Initialize console if it hasn't already initialized.
                SRServiceManager.GetService <IConsoleService>();
            }
        }
コード例 #14
0
        public StandardConsoleService()
        {
#if UNITY_5 || UNITY_5_3_OR_NEWER
            Application.logMessageReceivedThreaded += UnityLogCallback;
#else
            Application.RegisterLogCallbackThreaded(UnityLogCallback);
#endif

            SRServiceManager.RegisterService <IConsoleService>(this);
            _collapseEnabled   = Settings.Instance.CollapseDuplicateLogEntries;
            _allConsoleEntries = new CircularBuffer <ConsoleEntry>(Settings.Instance.MaximumConsoleEntries);
        }
コード例 #15
0
        public StandardConsoleService()
        {
#if UNITY_5
            Application.logMessageReceived += UnityLogCallback;
#else
            Application.RegisterLogCallback(UnityLogCallback);
#endif

            SRServiceManager.RegisterService <IConsoleService>(this);

            _collapseEnabled = Settings.Instance.CollapseDuplicateLogEntries;

            _allConsoleEntriesReadOnly = _allConsoleEntries.AsReadOnly();
            _consoleEntriesReadOnly    = _consoleEntries.AsReadOnly();
        }
コード例 #16
0
        public void ShowBugReportSheet(ActionCompleteCallback onComplete = null, bool takeScreenshot = true, string descriptionContent = null)
        {
            var popoverService = SRServiceManager.GetService <BugReportPopoverService>();

            if (popoverService.IsShowingPopover)
            {
                return;
            }

            popoverService.ShowBugReporter((succeed, message) => {
                if (onComplete != null)
                {
                    onComplete(succeed);
                }
            }, takeScreenshot, descriptionContent);
        }
コード例 #17
0
        public void Refresh()
        {
            var s = SRServiceManager.GetService <ISystemInformationService>();

            foreach (var category in s.GetCategories())
            {
                if (!_infoBlocks.ContainsKey(category))
                {
                    var block = CreateBlock(category);
                    _infoBlocks.Add(category, block);
                }
            }

            foreach (var kv in _infoBlocks)
            {
                FillInfoBlock(kv.Value, s.GetInfo(kv.Key));
            }
        }
コード例 #18
0
        private void Construct()
        {
            var s = SRServiceManager.GetService <ISystemInformationService>();

            foreach (var category in s.GetCategories())
            {
                var info = s.GetInfo(category);

                if (info.Count == 0)
                {
                    continue;
                }

                var block = CreateBlock(category);
                FillInfoBlock(block, info);

                _infoBlocks.Add(category, block);
            }
        }
コード例 #19
0
        public SRDebugService()
        {
            SRServiceManager.RegisterService <IDebugService>(this);

            // Load profiler
            SRServiceManager.GetService <IProfilerService>();

            // Setup trigger service
            _debugTrigger = SRServiceManager.GetService <IDebugTriggerService>();

            // Create debug panel service (this does not actually load any UI resources until opened)
            _debugPanelService = SRServiceManager.GetService <IDebugPanelService>();

            // Subscribe to visibility changes to provide API-facing event for panel open/close
            _debugPanelService.VisibilityChanged += DebugPanelServiceOnVisibilityChanged;

            _debugTrigger.IsEnabled = Settings.EnableTrigger == Settings.TriggerEnableModes.Always ||
                                      Settings.EnableTrigger == Settings.TriggerEnableModes.MobileOnly &&
                                      Application.isMobilePlatform;

            _debugTrigger.Position = Settings.TriggerPosition;

            if (Settings.EnableKeyboardShortcuts)
            {
                SRServiceManager.GetService <KeyboardShortcutListenerService>();
            }

            _entryCodeEnabled = Settings.Instance.RequireCode && Settings.Instance.EntryCode.Count == 4;

            if (Settings.Instance.RequireCode && !_entryCodeEnabled)
            {
                Debug.LogError("[SRDebugger] RequireCode is enabled, but pin is not 4 digits");
            }

            // Ensure that root object cannot be destroyed on scene loads
            var srDebuggerParent = Hierarchy.Get("SRDebugger");

            Object.DontDestroyOnLoad(srDebuggerParent.gameObject);
        }
コード例 #20
0
 protected override void Awake()
 {
     base.Awake();
     _profilerService = SRServiceManager.GetService <IProfilerService>();
 }
コード例 #21
0
 public void Close()
 {
     SRServiceManager.GetService <IDebugService>().HideDebugPanel();
 }
コード例 #22
0
ファイル: DebugPanelRoot.cs プロジェクト: gif-hara/Ferry
 public void CloseAndDestroy()
 {
     SRServiceManager.GetService <IDebugService>().DestroyDebugPanel();
 }
コード例 #23
0
ファイル: SRServiceBase.cs プロジェクト: BuCai/Hit
 protected override void OnDestroy()
 {
     base.OnDestroy();
     SRServiceManager.UnRegisterService <T>();
 }
コード例 #24
0
ファイル: SRServiceBase.cs プロジェクト: BuCai/Hit
 protected override void Awake()
 {
     base.Awake();
     SRServiceManager.RegisterService <T>(this);
 }
コード例 #25
0
ファイル: SROptions.cs プロジェクト: malering/ET
 public static void OnStartup()
 {
     SRServiceManager.GetService <SRDebugger.Internal.InternalOptionsRegistry>().AddOptionContainer(Current);
 }