Esempio n. 1
0
    //bool bOut = true;
    void OnGUI()
    {
        if (!bFlag)
        {
            return;
        }

        if (GUI.Button(new Rect(0, 0, 0.05f * Screen.width, 0.03f * Screen.height), "Debug"))
        {
            show = !show;
        }

#if UNITY_STANDALONE_WIN
        if (GUI.Button(new Rect(0.1f * Screen.width, 0, 0.1f * Screen.width, 0.03f * Screen.height), "OpenLog"))
        {
            string str = ABFileLog.GetFileName("Heros_Error");
            System.Diagnostics.Process.Start("notepad.exe", str);

            str = ABFileLog.GetFileName("Heros");
            System.Diagnostics.Process.Start("notepad.exe", str);
        }
        if (GUI.Button(new Rect(0.1f * Screen.width, 0.03f * Screen.height, 0.1f * Screen.width, 0.03f * Screen.height), "ClearPlayerPrefs"))
        {
            PlayerPrefs.DeleteAll();
            PlayerPrefs.Save();
        }
#endif

        if (!show)
        {
            return;
        }

        windowRect = GUILayout.Window(123456, windowRect, ConsoleWindow, "Console");
    }
        static void HandleLog(string logString, string stackTrace, LogType type)
        {
            switch (type)
            {
            case LogType.Log:
                //  Log
                ABFileLog.Write(LogFileName, type, logString);
                break;

            default:
                ABFileLog.Write(LogFileName, type, logString);
                ABFileLog.Write(LogFileName, type, stackTrace);
                break;
            }
        }
Esempio n. 3
0
    /// <summary>
    /// Logged messages are sent through this callback function.
    /// </summary>
    /// <param name="message">The message itself.</param>
    /// <param name="stackTrace">A trace of where the message came from.</param>
    /// <param name="type">The type of message: error/exception, warning, or assert.</param>
    void HandleLog(string message, string stackTrace, LogType type)
    {
        if (type == LogType.Error ||
            type == LogType.Assert ||
            type == LogType.Exception)
        {
            ABFileLog.Write("Heros_Error", type, message + " ->  " + stackTrace);
        }
        else
        {
            if (bFlag)
            {
                ABFileLog.Write("Heros", type, message + " ->  " + stackTrace);
            }
        }

        AutoClear();

        lock (m_MsgLock)
        {
            ConsoleMessage entry = new ConsoleMessage(message, stackTrace, type);
            entries.Add(entry);
        }
    }