xingweizhu
4 年前
当前提交
c646105b
共有 40 个文件被更改,包括 204 次插入 和 220 次删除
-
2Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demos.cs
-
5Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ToDoAppSample.cs
-
11com.unity.uiwidgets/Runtime/cupertino/date_picker.cs
-
88com.unity.uiwidgets/Runtime/external/SplayTree.cs
-
2com.unity.uiwidgets/Runtime/external/simplejson/SimpleJSON.cs
-
7com.unity.uiwidgets/Runtime/foundation/assertions.cs
-
2com.unity.uiwidgets/Runtime/foundation/collections.cs
-
16com.unity.uiwidgets/Runtime/foundation/diagnostics.cs
-
2com.unity.uiwidgets/Runtime/gestures/hit_test.cs
-
4com.unity.uiwidgets/Runtime/material/bottom_navigation_bar.cs
-
4com.unity.uiwidgets/Runtime/material/button_bar.cs
-
7com.unity.uiwidgets/Runtime/material/data_table.cs
-
7com.unity.uiwidgets/Runtime/material/dropdown.cs
-
5com.unity.uiwidgets/Runtime/material/navigation_rail.cs
-
18com.unity.uiwidgets/Runtime/material/paginated_data_table.cs
-
4com.unity.uiwidgets/Runtime/material/range_slider.cs
-
2com.unity.uiwidgets/Runtime/material/text_selection.cs
-
5com.unity.uiwidgets/Runtime/painting/borders.cs
-
8com.unity.uiwidgets/Runtime/painting/gradient.cs
-
9com.unity.uiwidgets/Runtime/painting/image_stream.cs
-
3com.unity.uiwidgets/Runtime/painting/text_span.cs
-
4com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
-
2com.unity.uiwidgets/Runtime/ui2/painting.cs
-
4com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.gen.cs
-
3com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.njk
-
20com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.gen.cs
-
21com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.njk
-
7com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
-
12com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs
-
14com.unity.uiwidgets/Runtime/widgets/framework.cs
-
3com.unity.uiwidgets/Runtime/widgets/gesture_detector.cs
-
2com.unity.uiwidgets/Runtime/widgets/heroes.cs
-
2com.unity.uiwidgets/Runtime/widgets/localizations.cs
-
16com.unity.uiwidgets/Runtime/widgets/navigator.cs
-
2com.unity.uiwidgets/Runtime/widgets/page_storage.cs
-
2com.unity.uiwidgets/Runtime/widgets/shortcuts.cs
-
2com.unity.uiwidgets/Runtime/widgets/sliver.cs
-
4com.unity.uiwidgets/Runtime/widgets/viewport.cs
-
8com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
-
85com.unity.uiwidgets/Runtime/external/LinqUtils.cs
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace Unity.UIWidgets.external |
|||
{ |
|||
public static class LinqUtils<T, S> |
|||
{ |
|||
public delegate T CreateItem(S item); |
|||
|
|||
public delegate bool FilterDict(S value); |
|||
|
|||
public static List<T> SelectList(IEnumerable<S> items, CreateItem createItem) |
|||
{ |
|||
if (items == null) |
|||
return null; |
|||
var results = new List<T>(); |
|||
foreach (var item in items) results.Add(createItem(item)); |
|||
|
|||
return results; |
|||
} |
|||
|
|||
public static T[] SelectArray(List<S> items, CreateItem createItem) |
|||
{ |
|||
if (items == null) |
|||
return null; |
|||
|
|||
var itemCount = items.Count; |
|||
var results = new T[itemCount]; |
|||
for (var i= 0; i < itemCount; i++) |
|||
{ |
|||
results[i] = createItem(items[i]); |
|||
} |
|||
|
|||
return results; |
|||
} |
|||
|
|||
public static Dictionary<T, S> SelectDictionary(IEnumerable<S> items, CreateItem createItem) |
|||
{ |
|||
if (items == null) |
|||
return null; |
|||
var results = new Dictionary<T, S>(); |
|||
foreach (var item in items) results.Add(createItem(item), item); |
|||
return results; |
|||
} |
|||
|
|||
public static Dictionary<T, S> WhereDictionary(Dictionary<T, S> items, FilterDict filterDict) |
|||
{ |
|||
if (items == null) |
|||
return null; |
|||
var results = new Dictionary<T, S>(); |
|||
foreach (var item in items) |
|||
if (filterDict(item.Value)) |
|||
results.Add(item.Key, item.Value); |
|||
return results; |
|||
} |
|||
} |
|||
|
|||
public static class LinqUtils<T> |
|||
{ |
|||
public delegate T CreateItem(T item); |
|||
|
|||
public delegate bool FilterItem(T item); |
|||
|
|||
public static List<T> SelectList(IEnumerable<T> items, CreateItem createItem) |
|||
{ |
|||
if (items == null) |
|||
return null; |
|||
var results = new List<T>(); |
|||
foreach (var item in items) results.Add(createItem(item)); |
|||
|
|||
return results; |
|||
} |
|||
|
|||
public static List<T> WhereList(IEnumerable<T> items, FilterItem filterItem) |
|||
{ |
|||
if (items == null) |
|||
return null; |
|||
var results = new List<T>(); |
|||
foreach (var item in items) |
|||
if (filterItem(item)) |
|||
results.Add(item); |
|||
|
|||
return results; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue