コード例 #1
0
        // If snapToBottom is enabled, force the scrollbar to the bottom
        private void LateUpdate()
        {
            if (Input.GetKeyDown(KeyCode.F1))
            {
                if (isLogWindowVisible)
                {
                    this.Hide();
                }
                else
                {
                    this.Show();
                }
                //HideButtonPressed();
            }
            if (screenDimensionsChanged)
            {
                // Update the recycled list view
                if (isLogWindowVisible)
                {
                    recycledListView.OnViewportDimensionsChanged();
                }

                screenDimensionsChanged = false;
            }

            if (snapToBottom)
            {
                logItemsScrollRect.verticalNormalizedPosition = 0f;

                if (snapToBottomButton.activeSelf)
                {
                    snapToBottomButton.SetActive(false);
                }
            }
            else
            {
                float scrollPos = logItemsScrollRect.verticalNormalizedPosition;
                if (snapToBottomButton.activeSelf != (scrollPos > 1E-6f && scrollPos < 0.9999f))
                {
                    snapToBottomButton.SetActive(!snapToBottomButton.activeSelf);
                }
            }

#if !UNITY_EDITOR && UNITY_ANDROID
            if (logcatListener != null)
            {
                string log;
                while ((log = logcatListener.GetLog()) != null)
                {
                    ReceivedLog("LOGCAT: " + log, string.Empty, LogType.Log);
                }
            }
#endif
        }
コード例 #2
0
        // If snapToBottom is enabled, force the scrollbar to the bottom
        void LateUpdate()
        {
            if (snapToBottom)
            {
                logItemsScrollRect.verticalNormalizedPosition = 0f;
            }

            if (logcatListener != null)
            {
                string log;
                while ((log = logcatListener.GetLog()) != null)
                {
                    ReceivedLog("LOGCAT: " + log, string.Empty, LogType.Log);
                }
            }
        }
コード例 #3
0
        // If snapToBottom is enabled, force the scrollbar to the bottom
        private void LateUpdate()
        {
            int queuedLogCount = queuedLogs.Count;

            if (queuedLogCount > 0)
            {
                for (int i = 0; i < queuedLogCount; i++)
                {
                    QueuedDebugLogEntry logEntry = queuedLogs[i];
                    ReceivedLog(logEntry.logString, logEntry.stackTrace, logEntry.logType);
                }

                queuedLogs.Clear();
            }

            if (screenDimensionsChanged)
            {
                // Update the recycled list view
                if (isLogWindowVisible)
                {
                    recycledListView.OnViewportDimensionsChanged();
                }
                else
                {
                    popupManager.OnViewportDimensionsChanged();
                }

                screenDimensionsChanged = false;
            }

            if (snapToBottom)
            {
                logItemsScrollRect.verticalNormalizedPosition = 0f;

                if (snapToBottomButton.activeSelf)
                {
                    snapToBottomButton.SetActive(false);
                }
            }
            else
            {
                float scrollPos = logItemsScrollRect.verticalNormalizedPosition;
                if (snapToBottomButton.activeSelf != (scrollPos > 1E-6f && scrollPos < 0.9999f))
                {
                    snapToBottomButton.SetActive(!snapToBottomButton.activeSelf);
                }
            }

            if (toggleWithKey)
            {
                if (Input.GetKeyDown(toggleKey))
                {
                    if (isLogWindowVisible)
                    {
                        ShowPopup();
                    }
                    else
                    {
                        ShowLogWindow();
                    }
                }
            }

            if (isLogWindowVisible && commandInputField.isFocused)
            {
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    if (commandHistoryIndex == -1)
                    {
                        commandHistoryIndex = commandHistory.Count - 1;
                    }
                    else if (--commandHistoryIndex < 0)
                    {
                        commandHistoryIndex = 0;
                    }

                    if (commandHistoryIndex >= 0 && commandHistoryIndex < commandHistory.Count)
                    {
                        commandInputField.text          = commandHistory[commandHistoryIndex];
                        commandInputField.caretPosition = commandInputField.text.Length;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    if (commandHistoryIndex == -1)
                    {
                        commandHistoryIndex = commandHistory.Count - 1;
                    }
                    else if (++commandHistoryIndex >= commandHistory.Count)
                    {
                        commandHistoryIndex = commandHistory.Count - 1;
                    }

                    if (commandHistoryIndex >= 0 && commandHistoryIndex < commandHistory.Count)
                    {
                        commandInputField.text = commandHistory[commandHistoryIndex];
                    }
                }
            }

#if !UNITY_EDITOR && UNITY_ANDROID
            if (logcatListener != null)
            {
                string log;
                while ((log = logcatListener.GetLog()) != null)
                {
                    ReceivedLog("LOGCAT: " + log, string.Empty, LogType.Log);
                }
            }
#endif
        }
コード例 #4
0
        // If snapToBottom is enabled, force the scrollbar to the bottom
        private void LateUpdate()
        {
            if (screenDimensionsChanged)
            {
                // Update the recycled list view
                if (isLogWindowVisible)
                {
                    recycledListView.OnViewportDimensionsChanged();
                }
                else
                {
                    popupManager.OnViewportDimensionsChanged();
                }

                screenDimensionsChanged = false;
            }

            if (snapToBottom)
            {
                logItemsScrollRect.verticalNormalizedPosition = 0f;

                if (snapToBottomButton.activeSelf)
                {
                    snapToBottomButton.SetActive(false);
                }
            }
            else
            {
                float scrollPos = logItemsScrollRect.verticalNormalizedPosition;
                if (snapToBottomButton.activeSelf != (scrollPos > 1E-6f && scrollPos < 0.9999f))
                {
                    snapToBottomButton.SetActive(!snapToBottomButton.activeSelf);
                }
            }
#if UNITY_EDITOR
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.Return))
            {
                DoCommand();
            }
            else if (Input.GetKeyDown(KeyCode.Return))
            {
                RectTransform inputRT   = commandInputField.GetComponent <RectTransform>();
                Vector2       size      = inputRT.sizeDelta;
                float         maxHeight = canvasTR.sizeDelta.y * (1 - logWindowTR.anchorMin.y) - 36;
                //float newHeight = 36 + size.y;
                //newHeight = Mathf.Min(maxHeight, Mathf.Max(newHeight, 36));
                size.y            = maxHeight;
                inputRT.sizeDelta = size;
            }
#endif

#if !UNITY_EDITOR && UNITY_ANDROID
            if (logcatListener != null)
            {
                string log;
                while ((log = logcatListener.GetLog()) != null)
                {
                    ReceivedLog("LOGCAT: " + log, string.Empty, LogType.Log);
                }
            }
#endif
        }
コード例 #5
0
        private void LateUpdate()
        {
#if UNITY_EDITOR
            if (isQuittingApplication)
            {
                return;
            }
#endif

            int queuedLogCount = queuedLogEntries.Count;
            if (queuedLogCount > 0)
            {
                for (int i = 0; i < queuedLogCount; i++)
                {
                    QueuedDebugLogEntry logEntry;
                    lock ( logEntriesLock )
                    {
                        logEntry = queuedLogEntries.RemoveFirst();
                    }

                    ProcessLog(logEntry);
                }
            }

            if (screenDimensionsChanged)
            {
                // Update the recycled list view
                if (isLogWindowVisible)
                {
                    recycledListView.OnViewportDimensionsChanged();
                }
                else
                {
                    popupManager.OnViewportDimensionsChanged();
                }

#if UNITY_ANDROID || UNITY_IOS
                CheckScreenCutout();
#endif

                if (searchbar)
                {
                    float logWindowWidth = logWindowTR.rect.width;
                    if (logWindowWidth >= topSearchbarMinWidth)
                    {
                        if (searchbar.parent == searchbarSlotBottom)
                        {
                            searchbarSlotTop.gameObject.SetActive(true);
                            searchbar.SetParent(searchbarSlotTop, false);
                            searchbarSlotBottom.gameObject.SetActive(false);

                            logItemsScrollRectTR.anchoredPosition = Vector2.zero;
                            logItemsScrollRectTR.sizeDelta        = logItemsScrollRectOriginalSize;
                        }
                    }
                    else
                    {
                        if (searchbar.parent == searchbarSlotTop)
                        {
                            searchbarSlotBottom.gameObject.SetActive(true);
                            searchbar.SetParent(searchbarSlotBottom, false);
                            searchbarSlotTop.gameObject.SetActive(false);

                            float searchbarHeight = searchbarSlotBottom.sizeDelta.y;
                            logItemsScrollRectTR.anchoredPosition = new Vector2(0f, searchbarHeight * -0.5f);
                            logItemsScrollRectTR.sizeDelta        = logItemsScrollRectOriginalSize - new Vector2(0f, searchbarHeight);
                        }
                    }
                }

                screenDimensionsChanged = false;
            }

            // If snapToBottom is enabled, force the scrollbar to the bottom
            if (snapToBottom)
            {
                logItemsScrollRect.verticalNormalizedPosition = 0f;

                if (snapToBottomButton.activeSelf)
                {
                    snapToBottomButton.SetActive(false);
                }
            }
            else
            {
                float scrollPos = logItemsScrollRect.verticalNormalizedPosition;
                if (snapToBottomButton.activeSelf != (scrollPos > 1E-6f && scrollPos < 0.9999f))
                {
                    snapToBottomButton.SetActive(!snapToBottomButton.activeSelf);
                }
            }


#if !UNITY_EDITOR && UNITY_ANDROID
            if (logcatListener != null)
            {
                string log;
                while ((log = logcatListener.GetLog()) != null)
                {
                    ReceivedLog("LOGCAT: " + log, string.Empty, LogType.Log);
                }
            }
#endif
        }