예제 #1
0
 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);
     }
 }
예제 #2
0
    /**
     * 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));
    }