示例#1
0
 public BuildCallback(string lbl, List <T> or, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > os)
 {
     Label      = lbl;
     Origins    = or;
     Mapper     = mapper;
     OnSelected = os;
 }
示例#2
0
 public bool Build(string lbl, T value, List <T> origins, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > onSelected = null, AddAction addAction = null, DeleteAction delAction = null)
 {
     return(Build(new BuildCallback(
                      lbl,
                      value,
                      origins,
                      mapper,
                      onSelected,
                      addAction,
                      delAction
                      )));
 }
示例#3
0
        public bool Build(string lbl, T value, List <T> origins, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > onSelected = null)
        {
            int cur      = origins.IndexOf(value);
            int selected = EditorGUILayout.Popup(lbl, cur, origins.Map(x => mapper(x)).ToArray());

            if (cur != selected)
            {
                onSelected.Invoke(new SelectState <T>(selected, origins[selected]));
                cur = selected;
            }

            return(cur >= 0);
        }
示例#4
0
 public BuildCallback(string lbl, T v, List <T> or, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > os)
     : this(lbl, or, mapper, os)
 {
     Value = v;
 }
示例#5
0
 public BuildCallback(string lbl, List <T> or, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > os, DeleteAction delAction)
     : this(lbl, or, mapper, os)
 {
     DelAction = delAction;
 }
示例#6
0
 public BuildCallback(string lbl, T v, List <T> or, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > os, AddAction addAction, DeleteAction delAction, Action <T> prefix, Action <T> suffix)
     : this(lbl, v, or, mapper, os, addAction, delAction, prefix)
 {
     Suffix = suffix;
 }
示例#7
0
 public BuildCallback(string lbl, T v, List <T> or, ListExt.Mapper <T, string> mapper, Action <SelectState <T> > os, AddAction addAction, DeleteAction delAction, MoveAction moveAction)
     : this(lbl, v, or, mapper, os, addAction, delAction)
 {
     MoveAction = moveAction;
 }