コード例 #1
0
ファイル: KGFMapIcon.cs プロジェクト: moto2002/moba
 public static void LogError(string theError, string theCategory, MonoBehaviour theObject)
 {
             #if KGFDebug
     KGFDebug.LogError(theError, theCategory, theObject);
             #else
     Debug.LogError(string.Format("{0} - {1}", theCategory, theError));
             #endif
 }
コード例 #2
0
 public static void LogWarning(string theMessage, string theCategory, MonoBehaviour theCaller)
 {
             #if KGFDebug
     KGFDebug.LogError(theMessage, "KGFEventSystem", null);
             #else
     Debug.LogWarning(theMessage);
             #endif
 }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     KGFDebug.LogDebug("Start() method of enemy: BossLevelOne was called", "Load.methods");
     KGFDebug.LogInfo("Currently 25 enemies in the Scene", "Enemy.Count");
     KGFDebug.LogWarning("Gravitation inconsistency: Make sure gravitation is -9.81.", "Physics.forces");
     KGFDebug.LogError("Cannot open file: d:\\tmp\\mytestdata. Make sure such a file exist and check read write permissions of the directory.", "IO.filereads", this);
     KGFDebug.LogFatal("The referenced module is missing. Make sure to keep the module running if its in use.", "Module.Status");
     Debug.LogError("This error demonstrates KGFDebugs ability to capture unity3d Debug.Log messages.");
 }
コード例 #4
0
ファイル: KGFDebugFile.cs プロジェクト: manboygames/capsa
    protected override void KGFAwake()
    {
        base.KGFAwake();

        if (itsDataDebugFile.itsFilePath == string.Empty)
        {
            itsDataDebugFile.itsFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "KGFLog.txt");
        }
        // create a new file
        using (var file = new StreamWriter(itsDataDebugFile.itsFilePath, false, Encoding.ASCII))
        {
            file.WriteLine("".PadLeft("FileLogger started: ".Length + DateTime.Now.ToString().Length, '='));
        }

        KGFDebug.AddLogger(this);
    }
コード例 #5
0
 /// <summary>
 /// This method is called from Unity3D Engine when the script instance is being loaded.
 /// </summary>
 /// <remarks>
 /// Awake is called before the game starts. Any state settings and variable initialization can be placed here.
 /// In this class Awake checks if there is already an instance of KGFDebug. If there is already an instance running, the calling
 /// gameObject will be deleted.
 /// </remarks>
 /// <example>
 /// How to ensure that there is only one instance.
 /// <code>
 /// private static KGFDebug itsInstance = null;
 ///
 /// protected void Awake()
 /// {
 ///		//check if a KGFDebug instance is already running
 ///		if (itsInstance == null)
 ///			itsInstance = this;
 ///		else
 ///			Destroy(gameObject);
 ///}
 /// </code>
 /// </example>
 protected override void KGFAwake()
 {
     base.KGFAwake();
     //check if a KGFDebug instance is already running
     if (itsInstance == null)
     {
         itsInstance = this;
     }
     else
     {
         if (itsInstance != this)
         {
             UnityEngine.Debug.Log("there is more than one KFGDebug instance in this scene. please ensure there is always exactly one instance in this scene");
             Destroy(gameObject);
         }
     }
 }
コード例 #6
0
    private static void CheckInstance()
    {
        // check if the cheat module is already activated
        if (itsInstance == null)
        {
            UnityEngine.Object theObject = UnityEngine.Object.FindObjectOfType(typeof(KGFDebug));

            if (theObject != null)
            {
                itsInstance = theObject as KGFDebug;
            }
            else
            {
                if (!itsAlreadyChecked)
                {
                    UnityEngine.Debug.LogError("Kolmich Debug Module is not running. Make sure that there is an instance of the KGFDebug prefab in the current scene. Adding loggers in Awake() can cause problems, prefer to add loggers in Start().");
                    itsAlreadyChecked = true;
                }
            }
        }
    }
コード例 #7
0
 public void Awake()
 {
     KGFDebug.AddLogger(this);
 }