protected void OnEnable() { if (!CheckAllExteral()) { LogWithTimestamp.LogError("外部文件检查未通过!!!!!"); } }
/// <summary> /// API:重新检查外部文件 /// </summary> public virtual void ReCheck() { #if UNITY_EDITOR // This simply does "LogEntries.Clear()" the long way: //var logEntries = System.Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll"); //var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); //clearMethod.Invoke(null, null); //LogEntries.Clear(); //Debug.ClearDeveloperConsole(); if (!CheckAllExteral()) { LogWithTimestamp.LogError("外部文件检查未通过!!!!!"); } #endif }
//初始化外部资源 bool InitializeMediaFolder() { DirectoryInfo appDataDirInfo = new DirectoryInfo(Application.dataPath); DirectoryInfo mediaDirInfo = new DirectoryInfo(appDataDirInfo.Parent.FullName + @"\Media"); if (mediaDirInfo.Exists) { if (!mute) { LogWithTimestamp.Log("正常检测到Media文件夹"); } return(true); } else { LogWithTimestamp.Log("未检测到Media文件夹在程序根目录下。。。"); return(false); } }
//初始化外部配置 bool InitializeConfigXML() { XmlDocument xmlconfig = new XmlDocument(); DirectoryInfo appDataDirInfo = new DirectoryInfo(Application.dataPath); FileInfo localConfig = new FileInfo(appDataDirInfo.Parent.FullName + @"\Config.xml"); if (localConfig.Exists) { ConfigXML.AppRootPath = appDataDirInfo.Parent.FullName; ConfigXML.AppMediaPath = appDataDirInfo.Parent.FullName + @"\Media\"; xmlconfig.Load(appDataDirInfo.Parent.FullName + @"\Config.xml"); ConfigXML.XMLData = xmlconfig.ChildNodes[1]; if (!mute) { LogWithTimestamp.Log("正常检测到XML文件"); } return(true); } else { LogWithTimestamp.Log("Config文件未在程序根目录下。。。"); return(false); } }