这周任务:
1.搞一套热跟新到框架里面。
2.版本控制。
3.erlang的http实现版本更新。
下周:
暂时:做一个类似NGUI的图集管理器可以读取TexturePack打包的图集。
/**************************************************
* 创建人 :XingHua
* 创建时间 :2015-12-14
* 模块名字 :AddHeadScriptWin
* 基本功能 :
************************************************/
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using System.Collections.Generic;
public class AddHeadScriptWin : EditorWindow {
public string authorName = "XingHua";
public string ability = "";
public string sciptName = "";
void OnGUI()
{
EditorGUILayout.BeginVertical();
GUIStyle style = new GUIStyle();
style.fontSize = 20;
style.normal.textColor = new Color(2, 0, 0); //设置字体颜色的
EditorGUILayout.LabelField (new GUIContent ("脚本名称 : " + Selection.activeObject.name),style);
EditorGUILayout.Space ();
EditorGUILayout.Space ();
authorName = EditorGUILayout.TextField("创建人:", authorName);
EditorGUILayout.Space ();
ability = EditorGUILayout.TextField("基本功能:",ability);
EditorGUILayout.EndVertical();
if (GUILayout.Button(new GUIContent("Add"), GUILayout.Width(50), GUILayout.Height(50))) {
Object obj = Selection.activeObject;
string filePath = AssetDatabase.GetAssetPath(obj);
if(!File.Exists(filePath))
return;
FileStream file = File.Open(filePath, FileMode.Open);
StreamReader fileReader = new StreamReader(file);
List<string> listStr = new List<string>();
string strLine = fileReader.ReadLine();
while (strLine != null)
{
//Debug.Log(strLine);
listStr.Add(strLine);
strLine = fileReader.ReadLine();
}
fileReader.Close();
if(listStr.Contains("/**************************************************"))
return;
string filePathAndName = filePath.Substring(0,filePath.LastIndexOf('/')+1)+ obj.name+".cs";
//如果文件存在就删除
if (File.Exists(filePath))
{
File.Delete(filePath);
}
StreamWriter streamWriter = File.CreateText(filePathAndName);
// 注释部分
streamWriter.WriteLine("/**************************************************");
streamWriter.WriteLine("\n * 创建人 :" + authorName);
streamWriter.WriteLine("\n * 创建时间 :" + System.DateTime.Now.Year + "-" + System.DateTime.Now.Month + "-" + System.DateTime.Now.Day);
streamWriter.WriteLine("\n * 模块名字 :" + obj.name);
streamWriter.WriteLine("\n * 基本功能 :" + ability);
streamWriter.WriteLine("\n************************************************/");
streamWriter.WriteLine("");
for(int i = 0 ; i <listStr.Count ; i++)
{
streamWriter.WriteLine(listStr[i]);
}
streamWriter.Close();
AssetDatabase.Refresh();
}
}
}