private void OnGUI_EditorRepairButton() { if (GUILayout.Button("一键清理所有不存在的skillid")) { Editor_TableTool.ClearUnExistSkillInHero(ref heroList, skillList); } }
private void OnGUI_EditorBuffItem(int index) { Buff b = buffList[index]; //bool isRepeat = buffList.GroupBy(x => x.Id).Where(x => x.Count() > 1).Where(x => x.Key == b.Id).ToList().Count() > 1; bool isRepeat = Editor_TableTool.IsRepeatHeroId((int)b.Id, buffList); if (isRepeat) { GUIStyle titleStyle2 = new GUIStyle(); titleStyle2.normal.textColor = new Color(1, 0, 0, 1); GUILayout.Label("id重复", titleStyle2); } GUILayout.BeginHorizontal(); if (GUILayout.Button("add", GUILayout.Width(50))) { Buff newBuff = new Buff(); newBuff.Params_StrValue = new List <string>(); newBuff.Params_NumValue = new List <double>(); newBuff.Params_Formula = new List <string>(); buffList.Insert(index + 1, newBuff); } bool isdel = false; if (GUILayout.Button("del", GUILayout.Width(50))) { isdel = true; buffList.Remove(b); } GUILayout.EndHorizontal(); if (!isdel) { buffList[index] = (Buff)DrawTableType.DrawWindow(b); } }
private void OnGUI_EditorRepairButton() { if (GUILayout.Button("一键清理所有不存在的buffid")) { Editor_TableTool.ClearUnExistBuffInSkill(ref skillList, buffList); } }
public void Show <T>(object aimObj, TableConfig cfg) { this._aimObj = aimObj; this._cfg = cfg; Type t = aimObj.GetType(); PropertyInfo pi = t.GetProperty(cfg.Name); selectList = (List <double>)pi.GetValue(aimObj); skillList = Editor_TableTool.GetData <T>(); base.Show(); }
private void OnGUI_EditorAddLineButton() { if (GUILayout.Button("新增加一行")) { object obj = Editor_TableTool.CreateInstance(this._target); List <object> list = new List <object>(); list.Add(obj); int maxId = Editor_TableTool.GetMaxId(heroList); PropertyInfo idProp = this._target.GetProperty("Id"); idProp.SetValue(obj, maxId + 1); heroList.Add(obj); } }
public static void DrawSelect(TableConfig config, PropertyInfo f, object o) { List <double> selectValue = (List <double>)f.GetValue(o); GUILayout.BeginHorizontal(GUILayout.Width(100)); GUILayout.Label(config.Des, GUILayout.Width(100)); string selects = Editor_TableTool.Join(selectValue); GUILayout.Label(selects, GUILayout.Width(100)); if (GUILayout.Button("选择", GUILayout.Width(50))) { Type t = GetTypeByName(config.ParameterList[0]); MethodInfo selectMethod = t.GetMethod(config.ParameterList[1]); selectMethod.Invoke(null, new object[] { o }); } GUILayout.EndHorizontal(); }
private void OnGUI_EditorSaveButton() { if (GUILayout.Button("保存为json文件")) { if (Editor_TableTool.IsRepeatBuffId(buffList)) { EditorUtility.DisplayDialog("失败", "buffid重名", "ok"); return; } if (Editor_TableTool.CheckBuffParamsNull(buffList)) { EditorUtility.DisplayDialog("失败", "列表没填写正确", "ok"); return; } Editor_TableTool.SaveBuffJsonFile(buffList); EditorWindows_CreateSkill.RefreshBuffData(); } }
private void OnGUI_EditorSaveButton() { if (GUILayout.Button("保存为json文件")) { if (!Editor_TableTool.CheckAllBuffExist(skillList, buffList)) { EditorUtility.DisplayDialog("失败", "有不存在的buffid", "ok"); return; } if (Editor_TableTool.IsRepeatSkillId(skillList)) { EditorUtility.DisplayDialog("失败", "skillid重名", "ok"); return; } Editor_TableTool.SaveSkillJsonFile(skillList); EditorWindows_CreateHero.RefreshSkillData(); } }
public static object DrawWindow(object o) { Type t = o.GetType(); PropertyInfo[] pi = t.GetProperties(); //FieldInfo[] fs = t.GetFields(flag); Dictionary <string, TableConfig> classDic = Editor_TableTool.GetClassDrawConfig(t.Name); if (classDic == null) { return(null); } for (int i = 0; i < pi.Length; i++) { PropertyInfo f = pi[i]; TableConfig config; if (!classDic.TryGetValue(f.Name, out config)) { Debug.Log("警告 " + f.Name + " 没有配置tableconfig项"); return(null); } if (config.AttributeType == "InputAttribute") { DrawInput(config, f, o); } else if (config.AttributeType == "ListGroupAttribute") { DrawGroupList(config, f, o, classDic); } else if (config.AttributeType == "SelectAttribute") { DrawSelect(config, f, o); } else if (config.AttributeType == "VariableListAttribute") { DrawVariableList(config, f, o, classDic); } } return(o); }
private void OnGUI_EditorSaveButton() { if (GUILayout.Button("保存为json文件")) { if (!Editor_TableTool.CheckAllSkillExist(heroList, skillList)) { EditorUtility.DisplayDialog("失败", "有不存在的skillid", "ok"); return; } if (Editor_TableTool.isRepeatHeroIdOrNullAttributeName(heroList)) { EditorUtility.DisplayDialog("失败", "id重名或者属性名为空", "ok"); return; } Editor_TableTool.SaveHeroJsonFile(heroList); } }
private void OnGUI_EditorSaveButton() { if (GUILayout.Button("保存为json文件")) { if (!Editor_TableTool.CheckForeignKey(heroList, _target)) { EditorUtility.DisplayDialog("失败", "有不存在的skillid", "ok"); return; } if (Editor_TableTool.IsRepeatId(heroList, _target)) { EditorUtility.DisplayDialog("失败", "id重名或者属性名为空", "ok"); return; } Editor_TableTool.SaveJsonFile(heroList, this._target); } }
/** * sortType == 1 等于0一组数据 */ public static List <object> DrawWindowWithSort(List <object> datas, int x, int y, int sortType, string sortField) { Dictionary <int, List <object> > sortList; if (sortType == 1) { sortList = Sort1(datas, sortField); } else { sortList = new Dictionary <int, List <object> >(); } List <int> keyList = new List <int>(sortList.Keys); int maxId = Editor_TableTool.GetMaxId(datas); for (int i = 0; i < keyList.Count; i++) { int k = keyList[i]; List <object> v; if (sortList.TryGetValue(k, out v)) { GUILayout.BeginHorizontal(); //展示一行数据 for (int j = 0; j < v.Count; j++) { // OnGUI_EditorHeroItem(v, j, k); GUILayout.BeginVertical(GUILayout.Width(x)); OnGUI_EditorItem(v, j, sortField, maxId); GUILayout.EndVertical(); Layout_DrawSeparatorV(Color.gray, 2); } GUILayout.EndHorizontal(); Layout_DrawSeparator(Color.gray, 2); } } return(DictToList(sortList)); }
private void OnGUI_EditorSkillItem(List <Skill> list, int index, int k) { Skill s = list[index]; GUILayout.BeginVertical(); bool isRepeat = Editor_TableTool.IsRepeatSkillId((int)s.Id, skillList); if (isRepeat) { GUIStyle titleStyle2 = new GUIStyle(); titleStyle2.normal.textColor = new Color(1, 0, 0, 1); GUILayout.Label("id重复", titleStyle2); } GUILayout.BeginHorizontal(GUILayout.Width(200)); if (GUILayout.Button("add", GUILayout.Width(50))) { Skill newSkill = new Skill(); //TODO by xiaofan // newSkill.Buffs = new List<double>(); // newSkill.AttackRatio = new List<double>(); list.Insert(index + 1, newSkill); } bool isdel = false; if (GUILayout.Button("del", GUILayout.Width(50))) { isdel = true; list.Remove(s); if (list.Count == 0) { skillList.Remove(k); } } GUILayout.EndHorizontal(); if (!isdel) { list[index] = (Skill)DrawTableType.DrawWindow(s); } GUILayout.EndVertical(); }
private void OnGUI_EditorHeroItem(List <Hero> list, int index, int k) { Hero h = list[index]; GUILayout.BeginVertical(); bool isRepeat = Editor_TableTool.IsRepeatHeroId((int)h.Id, heroList); if (isRepeat) { GUIStyle titleStyle2 = new GUIStyle(); titleStyle2.normal.textColor = new Color(1, 0, 0, 1); GUILayout.Label("id重复", titleStyle2); } GUILayout.BeginHorizontal(GUILayout.Width(200)); if (GUILayout.Button("add", GUILayout.Width(50))) { Hero newHero = new Hero(); newHero.AttributeName = new List <string>(); newHero.AttributeValue = new List <double>(); newHero.Skills = new List <double>(); list.Insert(index + 1, newHero); } bool isdel = false; if (GUILayout.Button("del", GUILayout.Width(50))) { list.Remove(h); if (list.Count == 0) { heroList.Remove(k); } isdel = true; } GUILayout.EndHorizontal(); if (!isdel) { list[index] = (Hero)DrawTableType.DrawWindow(h); } GUILayout.EndVertical(); }
//展示一份数据窗口 public static void OnGUI_EditorItem(List <object> list, int index, string sortField, int maxId) { object o = list[index]; GUILayout.BeginVertical(); // bool isRepeat = Editor_TableTool.IsRepeatHeroId((int)h.Id, heroList); // if (isRepeat) // { // GUIStyle titleStyle2 = new GUIStyle(); // titleStyle2.normal.textColor = new Color(1, 0, 0, 1); // GUILayout.Label("id重复", titleStyle2); // } GUILayout.BeginHorizontal(GUILayout.Width(200)); if (GUILayout.Button("add", GUILayout.Width(50))) { object obj = Editor_TableTool.CreateInstance(o.GetType()); list.Insert(index + 1, obj); PropertyInfo idProp = obj.GetType().GetProperty("Id"); idProp.SetValue(obj, maxId + 1); PropertyInfo sortProp = obj.GetType().GetProperty(sortField); sortProp.SetValue(obj, sortProp.GetValue(o)); sortProp.SetValue(o, maxId + 1); } bool isdel = false; if (GUILayout.Button("del", GUILayout.Width(50))) { list.Remove(o); isdel = true; } GUILayout.EndHorizontal(); if (!isdel) { list[index] = DrawTableType.DrawWindow(o); } GUILayout.EndVertical(); }
private void Awake() { Editor_TableTool.GetData_BuffData(ref buffList, "Buff"); }
public void Show <T>() { this._target = typeof(T); heroList = Editor_TableTool.GetData <T>(); }
public static void RefreshBuffData() { buffList = Editor_TableTool.Prepare_DataByName <Buff>("Buff"); }
private void Awake() { Editor_TableTool.GetData_SkillData(ref skillList, "Skill"); EditorWindows_CreateSkill.RefreshBuffData(); }
public static void RefreshSkillData() { skillList = Editor_TableTool.Prepare_DataByName <Skill>("Skill"); }
public void Awake() { Editor_TableTool.GetData_HeroData(ref heroList, "HeroLogic"); EditorWindows_CreateHero.RefreshSkillData(); }
public void Awake() { Editor_TableTool.GetData_SkillData(ref skillList, "Skill"); selectList = EditorWindows_CreateHero.handle.Skills; }
public void Awake() { Editor_TableTool.GetData_BuffData(ref buffList, "Buff"); selectList = EditorWindows_CreateSkill.handle.SkillBlocks; }
public static void DrawDisplayWindow(object o) { Type t = o.GetType(); PropertyInfo[] fs = t.GetProperties(); Dictionary <string, TableConfig> classDic = Editor_TableTool.GetClassDrawConfig(t.Name); if (classDic == null) { return; } for (int i = 0; i < fs.Length; i++) { PropertyInfo f = fs[i]; TableConfig config; if (!classDic.TryGetValue(f.Name, out config)) { Debug.LogError("警告 " + f.Name + " 没有配置tableconfig项"); return; } if (config.AttributeType == "InputAttribute") { EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, f.GetValue(o))); } else if (config.AttributeType == "ListGroupAttribute") { Type type = f.PropertyType.GetGenericArguments()[0]; if (type.Equals(typeof(string))) { List <string> value = (List <string>)f.GetValue(o); EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, Editor_TableTool.Join(value))); } else if (type.Equals(typeof(double))) { List <double> value = (List <double>)f.GetValue(o); EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, Editor_TableTool.Join(value))); } } else if (config.AttributeType == "SelectAttribute") { List <double> value = (List <double>)f.GetValue(o); EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, Editor_TableTool.Join(value))); } else if (config.AttributeType == "VariableListAttribute") { EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, f.GetValue(o))); } else if (config.AttributeType == "ChildAttribute") { Type type = f.PropertyType.GetGenericArguments()[0]; if (type.Equals(typeof(string))) { List <string> value = (List <string>)f.GetValue(o); EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, Editor_TableTool.Join(value))); } else if (type.Equals(typeof(double))) { List <double> value = (List <double>)f.GetValue(o); EditorGUILayout.LabelField(string.Format("{0}:{1}", config.Des, Editor_TableTool.Join(value))); } } } }
private void Awake() { Editor_TableTool.GetData_TableConfigData(); }