//Control public ControConfig AddNewControl() { ControConfig controConfig = new ControConfig(); ControConfig.Add(controConfig); return(controConfig); }
//Read public List <ControConfig> ReadControlConfig(string path) { List <ControConfig> list = new List <ControConfig>(); string str = File.ReadAllText(path); string[,] array; GetControlStringArray(str, out array); string ControName = ""; ControConfig controConfig = null; int length1 = array.GetLength(0); for (int i = 0; i < length1; i++) { string controName = array[i, 0]; if (controName != ControName) { if (controConfig != null) { list.Add(controConfig); } controConfig = new ControConfig(); controConfig.ControName = controName; ControName = controName; } BoneControlConfig boneControlConfig = new BoneControlConfig(); boneControlConfig.BoneName = array[i, 1]; boneControlConfig.ControAble[0] = array[i, 2] == "1"; boneControlConfig.ControAble[1] = array[i, 3] == "1"; boneControlConfig.ControAble[2] = array[i, 4] == "1"; boneControlConfig.ControAble[3] = array[i, 5] == "1"; boneControlConfig.ControAble[4] = array[i, 6] == "1"; boneControlConfig.ControAble[5] = array[i, 7] == "1"; boneControlConfig.ControAble[6] = array[i, 8] == "1"; boneControlConfig.ControAble[7] = array[i, 9] == "1"; boneControlConfig.ControAble[8] = array[i, 10] == "1"; controConfig.ControBoneLis.Add(boneControlConfig); if (i == length1 - 1) { list.Add(controConfig); } } return(list); }
void DrawControlInspector() { //GUILayout.Label("控制杆->骨骼 配置:", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); //输入框控件 text = EditorGUILayout.TextField("控制杆名称:", text); if (GUILayout.Button("添加控制杆", GUILayout.Width(200))) { ControConfig controConfig = mCustomEditor.AddNewControl(); controConfig.ControName = text; } GUILayout.EndHorizontal(); if (mCustomEditor.ControConfig.Count > 0) { GUILayout.Label("骨骼->权限:", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); BoneTransform = EditorGUILayout.ObjectField(BoneTransform, typeof(Transform)) as Transform; for (int i = 0; i < BoneTransformAble.Length; i++) { BoneTransformAble[i] = EditorGUILayout.Toggle(BoneTransformAble[i]); } GUILayout.EndHorizontal(); } for (int i = 0; i < mCustomEditor.ControConfig.Count; ++i) { DrawControl(i); } GUILayout.Space(5); // mCustomEditor.ControConfigFileName = EditorGUILayout.TextField(mCustomEditor.ControConfigFileName); GUILayout.BeginHorizontal(); if (GUILayout.Button("保存控制Config", GUILayout.Width(200))) { mCustomEditor.saveControlConfig(); } if (GUILayout.Button("导入Config", GUILayout.Width(200))) { } GUILayout.EndHorizontal(); }