Shiyun Wen
4 年前
当前提交
93f4d640
共有 31 个文件被更改,包括 1765 次插入 和 554 次删除
-
4com.unity.uiwidgets/Runtime/animation/animation.cs
-
2com.unity.uiwidgets/Runtime/animation/animations.cs
-
46com.unity.uiwidgets/Runtime/animation/tween.cs
-
24com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs
-
10com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs
-
43com.unity.uiwidgets/Runtime/cupertino/app.cs
-
11com.unity.uiwidgets/Runtime/cupertino/button.cs
-
7com.unity.uiwidgets/Runtime/cupertino/colors.cs
-
61com.unity.uiwidgets/Runtime/cupertino/context_menu.cs
-
2com.unity.uiwidgets/Runtime/cupertino/dialog.cs
-
220com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs
-
51com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs
-
126com.unity.uiwidgets/Runtime/cupertino/route.cs
-
3com.unity.uiwidgets/Runtime/cupertino/text_field.cs
-
33com.unity.uiwidgets/Runtime/painting/colors.cs
-
4com.unity.uiwidgets/Runtime/rendering/error.cs
-
320com.unity.uiwidgets/Runtime/widgets/app.cs
-
5com.unity.uiwidgets/Runtime/widgets/framework.cs
-
232com.unity.uiwidgets/Runtime/widgets/heroes.cs
-
173com.unity.uiwidgets/Runtime/widgets/media_query.cs
-
2com.unity.uiwidgets/Runtime/widgets/modal_barrier.cs
-
230com.unity.uiwidgets/Runtime/widgets/navigator.cs
-
2com.unity.uiwidgets/Runtime/widgets/preferred_size.cs
-
483com.unity.uiwidgets/Runtime/widgets/routes.cs
-
6com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
-
117com.unity.uiwidgets/Runtime/animation/tween_sequence.cs
-
11com.unity.uiwidgets/Runtime/animation/tween_sequence.cs.meta
-
38com.unity.uiwidgets/Runtime/widgets/route_notification_messages.cs
-
11com.unity.uiwidgets/Runtime/widgets/route_notification_messages.cs.meta
-
31com.unity.uiwidgets/Runtime/widgets/spacer.cs
-
11com.unity.uiwidgets/Runtime/widgets/spacer.cs.meta
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using Unity.UIWidgets.scheduler2; |
|||
using System; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.painting; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Rect = Unity.UIWidgets.ui.Rect; |
|||
using Transform = Unity.UIWidgets.widgets.Transform; |
|||
|
|||
namespace Unity.UIWidgets.animation { |
|||
class TweenSequence<T> : Animatable<T> { |
|||
public TweenSequence(List<TweenSequenceItem<T>> items) { |
|||
D.assert(items != null); |
|||
D.assert(items.isNotEmpty); |
|||
foreach (var item in items) { |
|||
_items.Add(item); |
|||
} |
|||
//_items.addAll(items);
|
|||
float totalWeight = 0.0f; |
|||
foreach (TweenSequenceItem<T> item in _items) |
|||
totalWeight += item.weight; |
|||
D.assert(totalWeight > 0.0f); |
|||
float start = 0.0f; |
|||
for (int i = 0; i < _items.Count; i += 1) { |
|||
float end = i == _items.Count - 1 ? 1.0f : start + _items[i].weight / totalWeight; |
|||
_intervals.Add(new _Interval(start, end)); |
|||
start = end; |
|||
} |
|||
} |
|||
|
|||
public readonly List<TweenSequenceItem<T>> _items = new List<TweenSequenceItem<T>>(); |
|||
public readonly List<_Interval> _intervals = new List<_Interval>(); |
|||
|
|||
public T _evaluateAt(float t, int index) { |
|||
TweenSequenceItem<T> element = _items[index]; |
|||
float tInterval = _intervals[index].value(t); |
|||
return element.tween.transform(tInterval); |
|||
} |
|||
|
|||
public override T transform(float t) { |
|||
D.assert(t >= 0.0 && t <= 1.0); |
|||
if (t == 1.0) |
|||
return _evaluateAt(t, _items.Count - 1); |
|||
for (int index = 0; index < _items.Count; index++) { |
|||
if (_intervals[index].contains(t)) |
|||
return _evaluateAt(t, index); |
|||
} |
|||
D.assert(false, ()=>"TweenSequence.evaluate() could not find an interval for $t"); |
|||
return default(T); |
|||
} |
|||
public override string ToString(){ |
|||
return $"TweenSequence({_items.Count} items)"; |
|||
} |
|||
|
|||
} |
|||
|
|||
class FlippedTweenSequence : TweenSequence<float> { |
|||
|
|||
FlippedTweenSequence(List<TweenSequenceItem<float>> items) |
|||
: base(items) { |
|||
D.assert(items != null); |
|||
} |
|||
|
|||
public override float transform(float t) => 1 - base.transform(1 - t); |
|||
} |
|||
|
|||
class TweenSequenceItem<T> { |
|||
|
|||
public TweenSequenceItem( |
|||
Animatable<T> tween = null, |
|||
float weight = 0.0f |
|||
) { |
|||
this.tween = tween; |
|||
this.weight = weight; |
|||
D.assert(tween != null); |
|||
D.assert(weight != null); |
|||
D.assert(weight > 0.0); |
|||
} |
|||
|
|||
public readonly Animatable<T> tween; |
|||
|
|||
|
|||
public readonly float weight; |
|||
} |
|||
|
|||
public class _Interval { |
|||
public _Interval(float start, float end) { |
|||
this.start = start; |
|||
this.end = end; |
|||
D.assert(end > start); |
|||
} |
|||
|
|||
public readonly float start; |
|||
public readonly float end; |
|||
|
|||
public bool contains(float t) { |
|||
return t >= start && t < end; |
|||
} |
|||
|
|||
public float value(float t) { |
|||
return (t - start) / (end - start); |
|||
} |
|||
|
|||
|
|||
public override string ToString() { |
|||
return $"<{start}," + $" {end}>"; |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: be2249b4f0c57714f98826849a6532ba |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Text; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace Unity.UIWidgets.widgets { |
|||
class RouteNotificationMessages { |
|||
public RouteNotificationMessages() { |
|||
} |
|||
|
|||
/// When the engine is Web notify the platform for a route change.
|
|||
/*public static void maybeNotifyRouteChange(string routeName, string previousRouteName) { |
|||
if(kIsWeb) { |
|||
_notifyRouteChange(routeName, previousRouteName); |
|||
} else { |
|||
// No op.
|
|||
} |
|||
}*/ |
|||
|
|||
|
|||
/*public static void _notifyRouteChange(string routeName, string previousRouteName) { |
|||
SystemChannels.navigation.invokeMethod<void>( |
|||
'routeUpdated', |
|||
<string, dynamic>{ |
|||
'previousRouteName': previousRouteName, |
|||
'routeName': routeName, |
|||
}, |
|||
); |
|||
}*/ |
|||
} |
|||
|
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ac1cab99f5369e943b27cdc6c354055c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
using Brightness = Unity.UIWidgets.ui.Brightness; |
|||
|
|||
namespace Unity.UIWidgets.widgets { |
|||
public class Spacer : StatelessWidget { |
|||
|
|||
public Spacer( |
|||
Key key = null, |
|||
int flex = 1) |
|||
: base(key: key) { |
|||
this.flex = flex; |
|||
D.assert(flex != null); |
|||
D.assert(flex > 0); |
|||
} |
|||
public readonly int flex; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Expanded( |
|||
flex: flex, |
|||
child: SizedBox.shrink() |
|||
); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b8afc6c5d924ddb4eb7854bcfdd65d04 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue