コード例 #1
0
        //Log text in given color or default to white
        public static void Log(object _obj, string _color = "ffffffff", string _panel = "Default")
        {
            if (Debug == false)
            {
                return;
            }

            //Test if appropriate color has been given
            if (_color == null || _color.Length != 8)
            {
                //Set color to white
                _color = "ffffffff";
            }

            //check if panel is good
            if (_panel == null)
            {
                //set panel to default
                _panel = "Default";
            }

            //find _chatPanel with _panel name then add text to it
            DebugBox _chatPanel = FindUIPanel(_panel);

            _chatPanel.AddText(_obj.ToString(), _color);
        }
コード例 #2
0
        //set the panel's writeToDisk on/off
        public static void SetPanelWriteToDisk(string _panel, bool _writeToDisk)
        {
            DebugBox temp = null;

            if (PanelExistTest(FindUIPanel(_panel, true), "Toggle UI Write to disk", out temp))
            {
                temp.SetWriteToDisk(_writeToDisk);
            }
        }
コード例 #3
0
        //clear text of a panel UI
        public static void ClearUIPanel(string _panel)
        {
            DebugBox temp = null;

            if (PanelExistTest(FindUIPanel(_panel, true), "Clear UI", out temp))
            {
                temp.ClearText();
            }
        }
コード例 #4
0
        //set the panel UI on/off
        public static void SetUIPanelEnabled(string _panel, bool _enabled)
        {
            DebugBox temp = null;

            if (PanelExistTest(FindUIPanel(_panel, true), "Toggle UI", out temp))
            {
                temp.SetGUIEnabled(_enabled);
            }
        }
コード例 #5
0
        public static void DestroyUIPanel(string _panel)
        {
            //grab DebugBox
            DebugBox temp = null;

            if (PanelExistTest(FindUIPanel(_panel, true), "Destroy UI", out temp))
            {
                temp.OnApplicationQuit();
                GameObject.Destroy(temp.gameObject);
                m_debugPanels.Remove(_panel);
            }
        }
コード例 #6
0
        //test if panel exists and return it
        private static bool PanelExistTest(DebugBox _panel, string _funcCalledFrom, out DebugBox _retDebugBox)
        {
            //setup output variable
            _retDebugBox = null;

            //check panel isn't null
            if (_panel != null)
            {
                //return true along with panel
                _retDebugBox = _panel;
                return(true);
            }

            //debug into specific panel that this panel does not exist then return false
            Log(_panel + " : does not exist during call: " + _funcCalledFrom + ", try creating this panel before you toggle it", null, "Debug Logger Panel");
            return(false);
        }
コード例 #7
0
        //try to return existing DebugBox
        internal static DebugBox FindUIPanel(string _panel = "Default", bool justSearching = false)
        {
            DebugBox ret = null;

            //check if debugPanel exists
            if (m_debugPanels.TryGetValue(_panel, out ret))
            {
                return(ret);
            }

            if (justSearching)
            {
                return(null);
            }

            //return newly created debug
            return(CreateUIPanel(new Rect(400, 400, 400, 400), _panel, true, true));
        }
コード例 #8
0
        //create debug box
        internal static DebugBox CreateUIPanel(Rect _rect, string _panel = "Default", bool _writeToDisk = true, bool _enabledOnCreation = false)
        {
            //check if master object is needed
            SetupObject();

            //create an object and add DebugBox component to it
            GameObject DebugObj = new GameObject("DebugObj");

            GameObject.DontDestroyOnLoad(DebugObj);
            DebugObj.transform.parent = m_obj.transform;

            DebugBox ret = DebugObj.AddComponent <DebugBox>(new DebugBox(_panel, _rect, 100, m_currentGUIID++, _writeToDisk));

            ret.SetGUIEnabled(_enabledOnCreation);

            //add panel then return
            m_debugPanels.Add(_panel, ret);
            return(ret);
        }