public SortedViewableList(IEditableList <T> list, Func <T, TKey> keySelector) : base(list) { FSortedList = new System.Collections.Generic.SortedList <TKey, T>(); FKeySelector = keySelector; foreach (var item in list) { FSortedList.Add(FKeySelector(item), item); } }
public void Populate(IEditorData data) { m_data = data; if (data == null) { m_list = null; return; } m_helper.StartPopulating(); CurrentList = m_helper.Populate(data); listBox.IsEnabled = !data.ReadOnly && m_helper.CanEdit(data); toolbar.ReadOnly = !listBox.IsEnabled; m_helper.FinishedPopulating(); }
private string GetDisplayString(object value) { IEditableScripts scriptValue = value as IEditableScripts; IEditableList <string> listStringValue = value as IEditableList <string>; IEditableDictionary <string> dictionaryStringValue = value as IEditableDictionary <string>; IEditableDictionary <IEditableScripts> dictionaryScriptValue = value as IEditableDictionary <IEditableScripts>; IDataWrapper wrappedValue = value as IDataWrapper; string result = null; if (scriptValue != null) { result = scriptValue.DisplayString(); } else if (listStringValue != null) { result = GetListDisplayString(listStringValue.DisplayItems); } else if (dictionaryStringValue != null) { result = GetDictionaryDisplayString(dictionaryStringValue.DisplayItems); } else if (dictionaryScriptValue != null) { result = GetDictionaryDisplayString(dictionaryScriptValue.DisplayItems); } else if (wrappedValue != null) { result = wrappedValue.DisplayString(); } else if (value == null) { result = "(null)"; } else { result = value.ToString(); } return(EditorUtility.FormatAsOneLine(result)); }
private string[] GetItemListKeys(IEditableList<string> list) { return list.Items.Select(i => i.Key).ToArray(); }
private string GetItemListString(IEditableList<string> list) { return string.Join(";", list.Items.Select(i => i.Value.Value)); }
public override void DoExtraInitialisation() { m_listattr = Controller.GetEditorData("testobj").GetAttribute("listattr"); m_list = m_listattr as IEditableList<string>; }
private string[] GetItemListKeys(IEditableList <string> list) { return(list.Items.Select(i => i.Key).ToArray()); }
private string GetItemListString(IEditableList <string> list) { return(string.Join(";", list.Items.Select(i => i.Value.Value))); }
public override void DoExtraInitialisation() { m_listattr = Controller.GetEditorData("testobj").GetAttribute("listattr"); m_list = m_listattr as IEditableList <string>; }
void ReadJsonArray(JsonReader reader, IEditableList destination) { while (reader.Read()) { if (reader.TokenType == JsonToken.Comment) { continue; } if (reader.TokenType == JsonToken.Null) { destination.Set(null); return; } if (reader.TokenType == JsonToken.StartArray) { break; } throw new Exception("StartArray token expected"); } while (reader.Read()) { switch (reader.TokenType) { case JsonToken.StartObject: if (destination.ItemSchema.DataType != DataType.Class) { throw new Exception("StartObject token unexpected (list item is not an object)"); } ReadJson(reader, destination.Add()); break; case JsonToken.StartArray: if (destination.ItemSchema.DataType != DataType.List || destination.ItemSchema.DataType != DataType.MultiChoice) { throw new Exception("StartArray token unexpected (list item is not a list)"); } ReadJson(reader, destination.Add()); break; case JsonToken.EndArray: return; case JsonToken.EndObject: throw new Exception("EndObject token was unexpected"); case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Null: destination.Add().Set(reader.Value); break; case JsonToken.Bytes: destination.Add().Set(reader.ReadAsBytes()); break; } } }
public EditableListMultiEditable(IEditableList <T> list) { _List = list; }
public ViewableList(IEditableList <T> list) : base(list) { FInternalList = list; FInternalList.OrderChanged += InternalList_OrderChanged; }