Example #1
0
 /// <summary>
 /// 导出Cs脚本。
 /// </summary>
 public void ExportCsScript(string path)
 {
     AppendCsHeader();
     AppendCsField();
     AppendCsCreateEntityMethod();
     AppendCsCreateEntitysMethod();
     AppendCsToTxtMethod();
     AppendCsDeepCopyMethod();
     AiukIOUtility.WriteAllText(path, m_Appender.ToString());
 }
Example #2
0
        /// <summary>
        /// 获得默认的unity项目设置实例。
        /// </summary>
        /// <returns></returns>
        public static AiukUnitySetting GetDefaultSetting()
        {
            if (!File.Exists(DefaultSettingPath))
            {
                var unitySetting = new AiukUnitySetting();
                var jsContent    = JsonUtility.ToJson(unitySetting);
                AiukIOUtility.WriteAllText(DefaultSettingPath, jsContent);
            }

            var setting = JsonUtility.FromJson <AiukUnitySetting>(File.ReadAllText(DefaultSettingPath));

            return(setting);
        }
        private void CreateScript()
        {
            if (string.IsNullOrEmpty(m_ScriptName))
            {
                EditorUtility.DisplayDialog("错误", "脚本名不能为空!", "知道了");
                return;
            }

            if (!m_TargetDir.EndsWith("/", System.StringComparison.Ordinal))
            {
                m_TargetDir += "/";
            }

            var targetPath = m_TargetDir + m_ScriptName + ".cs";

            AiukIOUtility.WriteAllText(targetPath, m_ScriptContentReview);
            AssetDatabase.Refresh();
            _Window.Close();
        }