コード例 #1
0
        public override void OnEnable()
        {
            base.OnEnable();
            APILoad.api = this;
            GameObject obj = new GameObject();

            APILoader = obj.AddComponent <APILoad>();
            APILoader.Initialise();

            //Used to set the parent of all debug boxes to obj
            OLogger.SetupObject(obj);
        }
コード例 #2
0
        public DebugBox(string _boxName, Rect _rect, int _maxStoredLines, int _GUIID, bool _writeToDisk)
        {
            //setup basic variables required
            m_BoxName     = _boxName;
            m_showGUI     = false;
            m_writeToDisk = _writeToDisk;

            m_GUIID  = _GUIID;
            maxLines = _maxStoredLines;

            textLines = new List <DebugType>();

            m_offset        = 0;
            m_currentScroll = maxLines;
            m_scrollStart   = m_currentScroll;

            //used to scale GUI at a later point
            m_windowRect   = _rect;
            m_virtualSize  = new Vector2(1920, 1080);
            m_currentSize  = new Vector2(Screen.width, Screen.height);
            m_scaledMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(Screen.width / m_virtualSize.x, Screen.height / m_virtualSize.y, 1));

            //setup GUIStyle
            m_guiStyle          = new GUIStyle();
            m_guiStyle.richText = true;
            m_guiStyle.wordWrap = true;
            m_guiStyle.fontSize = 16;

            //used to setup output string
            m_currentOutputText = "";
            m_updateCurrentText = true;

            if (_writeToDisk)
            {
                //Setup debug text folder
                OLogger.SetupDirectory();

                //Setup debug text file
                m_writer = new StreamWriter("mods/Debug/" + m_BoxName + ".txt", false);
            }
        }
コード例 #3
0
        internal void AddText(string _msg, string _msgColor)
        {
            textLines.Insert(0, new DebugType(m_msgCount.ToString() + ": " + _msg, _msgColor));
            m_updateCurrentText = true;

            //debug info to file
            if (m_writeToDisk)
            {
                if (m_writer == null)
                {
                    OLogger.SetupDirectory();
                    m_writer = new StreamWriter("mods/Debug/" + m_BoxName + ".txt", true);
                }
                m_writer.WriteLine(m_msgCount.ToString() + " :Message: " + _msg);
            }

            m_msgCount++;

            if (textLines.Count > maxLines)
            {
                textLines.RemoveAt(maxLines);
            }
        }