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);
        }
    }
示例#2
0
    public static bool CheckForeignKey(List <object> list, Type t)
    {
        //当前数据对象拥有外键属性的列表
        List <TableConfig> tList = GetForignKeyList(t.Name);

        foreach (TableConfig tc in tList)
        {
            string[] tmpArr = tc.ForeignKey.Split('.');
            Type     tmpT   = DrawTableType.GetTypeByName(tmpArr[0]);
            //外键表的json数据
            object datas = Prepare_DataByName(tmpT);
            //json数据列表
            List <double> dataList = ObjectToForeignList(datas, tmpArr[1], tmpT);
            //比较原列表(list)中的外键是否都存在在 外键表(dataList)中
            PropertyInfo pi = t.GetProperty(tc.Name);
            foreach (object obj in list)
            {
                List <double> source = (List <double>)pi.GetValue(obj);
                foreach (double id in source)
                {
                    //源数据中的数据不存在外键表数据中时 返回false;
                    if (!dataList.Contains((id)))
                    {
                        return(false);
                    }
                }
            }
        }

        return(true);
    }
 private void OnGUI_EditorSkillItem(Skill h)
 {
     GUILayout.BeginHorizontal();
     OnGUI_EditorSkillItemToggle(h);
     GUILayout.BeginVertical();
     DrawTableType.DrawDisplayWindow(h);
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     TableToolMenu.Layout_DrawSeparatorV(Color.gray, 2);
 }
 private void OnGUI_EditorBuffItem(Buff b)
 {
     GUILayout.BeginHorizontal(GUILayout.Width(610));
     OnGUI_EditorSkillItemToggle(b);
     GUILayout.BeginVertical();
     DrawTableType.DrawDisplayWindow(b);
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     TableToolMenu.Layout_DrawSeparator(Color.gray, 2);
 }
示例#5
0
 private void OnGUI_MainWindow()
 {
     GUILayout.BeginVertical();
     windowSelectPosition =
         GUILayout.BeginScrollView(windowSelectPosition, GUILayout.Width(1500), GUILayout.Height(800));
     {
         heroList = DrawTableType.DrawWindowWithSort(heroList, 200, 800, 1, "NextLevel");
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
 }
    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();
    }