Esempio n. 1
0
 public void OnEnable()
 {
     Console.singleton = this;
     if (Console.Get().disabled)
     {
         return;
     }
     if (this.skin.IsNull())
     {
         this.skin            = File.GetAsset <GUISkin>("Console.guiskin");
         this.background      = File.GetAsset <Material>("ConsoleBackground.mat");
         this.inputBackground = File.GetAsset <Material>("ConsoleInput.mat");
         this.textArrow       = File.GetAsset <Material>("ConsoleArrow.mat");
     }
     Proxy.AddLogCallback(Console.HandleLog);
     if (!this.logFile.IsEmpty())
     {
         string logPath = Application.persistentDataPath + "/" + this.logFile;
         try{
             using (StreamWriter file = new StreamWriter(logPath, true)){
                 file.WriteLine("-----------------------");
                 file.WriteLine(DateTime.Now);
                 file.WriteLine("-----------------------");
             }
             Console.logFileUsable = true;
         }
         catch {
             Console.logFileUsable = false;
             Console.AddLog("Log file is not writable. File in use or has bad path.");
         }
     }
     Events.Add("On Application Quit", this.OnApplicationQuit);
     Events.Add("On GUI", this.OnGUI);
     Events.Add("On Start", this.Start);
 }