浏览代码

Merge pull request #419 from UnityTech/dev

Dev
/main
GitHub 5 年前
当前提交
4c9edd0e
共有 12 个文件被更改,包括 304 次插入36 次删除
  1. 2
      Runtime/external/RTree.cs
  2. 2
      Runtime/external/SplayTree.cs
  3. 2
      Runtime/painting/gradient.cs
  4. 1
      Runtime/rendering/sliver_fill.cs
  5. 2
      Runtime/ui/painting/picture.cs
  6. 48
      Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_impl.cs
  7. 2
      Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_shader.cs
  8. 2
      Runtime/ui/renderer/common/picture.cs
  9. 2
      Runtime/ui/txt/paragraph.cs
  10. 269
      Runtime/widgets/implicit_animations.cs
  11. 2
      Runtime/widgets/list_wheel_scroll_view.cs
  12. 6
      Runtime/widgets/sliver.cs

2
Runtime/external/RTree.cs


using System.Linq;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.Runtime.external
namespace Unity.UIWidgets.external
{
public interface ISpatialData
{

2
Runtime/external/SplayTree.cs


using System.Collections;
using System.Collections.Generic;
namespace Unity.UIWidgets.Runtime.external
namespace Unity.UIWidgets.external
{ class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> {
SplayTreeNode root;
int count;

2
Runtime/painting/gradient.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

1
Runtime/rendering/sliver_fill.cs


}
float paintedChildSize = this.calculatePaintOffset(this.constraints, from: 0.0f, to: extent);
Debug.Log("size" + paintedChildSize);
D.assert(paintedChildSize.isFinite());
D.assert(paintedChildSize >= 0.0);
this.geometry = new SliverGeometry(

2
Runtime/ui/painting/picture.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
namespace Unity.UIWidgets.ui {
public class Picture {

48
Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_impl.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
using UnityEngine;
using UnityEngine.Rendering;

.mapRect(this._currentLayer.layerBounds) ??
this._currentLayer.layerBounds;
if (!uiRectHelper.contains(queryBound, uiRectHelper.fromRect(picture.paintBounds).Value)) {
var indices = picture.bbh.Search(queryBound).Select(bound => bound.index);
List<int> cmdIndices = indices.ToList();
cmdIndices.AddRange(picture.stateUpdatesIndices);
cmdIndices.Sort();
drawCmds = new List<DrawCmd>();
for (int i = 0; i < cmdIndices.Count; i++) {
drawCmds.Add(picture.drawCmds[cmdIndices[i]]);
}
}
// if (!uiRectHelper.contains(queryBound, uiRectHelper.fromRect(picture.paintBounds).Value)) {
// var indices = picture.bbh.Search(queryBound).Select(bound => bound.index);
// List<int> cmdIndices = indices.ToList();
// cmdIndices.AddRange(picture.stateUpdatesIndices);
// cmdIndices.Sort();
// drawCmds = new List<DrawCmd>();
// for (int i = 0; i < cmdIndices.Count; i++) {
// drawCmds.Add(picture.drawCmds[cmdIndices[i]]);
// }
// }
foreach (var drawCmd in drawCmds) {
switch (drawCmd) {

.mapRect(this._currentLayer.layerBounds) ??
this._currentLayer.layerBounds;
if (!uiRectHelper.contains(queryBound, picture.paintBounds)) {
var indices = picture.bbh.Search(queryBound).Select(bound => bound.index);
List<int> cmdIndices = indices.ToList();
cmdIndices.Capacity += picture.stateUpdatesIndices.Count;
for (int i = 0; i < picture.stateUpdatesIndices.Count; i++) {
cmdIndices.Add(picture.stateUpdatesIndices[i]);
}
cmdIndices.Sort();
drawCmds = new List<uiDrawCmd>();
for (int i = 0; i < cmdIndices.Count; i++) {
drawCmds.Add(picture.drawCmds[cmdIndices[i]]);
}
}
// if (!uiRectHelper.contains(queryBound, picture.paintBounds)) {
// var indices = picture.bbh.Search(queryBound).Select(bound => bound.index);
// List<int> cmdIndices = indices.ToList();
// cmdIndices.Capacity += picture.stateUpdatesIndices.Count;
// for (int i = 0; i < picture.stateUpdatesIndices.Count; i++) {
// cmdIndices.Add(picture.stateUpdatesIndices[i]);
// }
// cmdIndices.Sort();
// drawCmds = new List<uiDrawCmd>();
// for (int i = 0; i < cmdIndices.Count; i++) {
// drawCmds.Add(picture.drawCmds[cmdIndices[i]]);
// }
// }
foreach (var drawCmd in drawCmds) {
switch (drawCmd) {

2
Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_shader.cs


image.texture.filterMode = paint.filterMode;
props.SetTexture(_texId, image.texture);
props.SetInt(_texModeId, image.texture is RenderTexture ? 1 : 0); // pre alpha if RT else post alpha
props.SetInt(_texModeId, image.texture is RenderTexture || image.isDynamic ? 1 : 0); // pre alpha if RT else post alpha
return PictureFlusher.CmdDraw.create(
mesh: mesh,

2
Runtime/ui/renderer/common/picture.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
namespace Unity.UIWidgets.ui {
public class uiPicture : PoolObject {

2
Runtime/ui/txt/paragraph.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
using UnityEngine;
namespace Unity.UIWidgets.ui {

269
Runtime/widgets/implicit_animations.cs


}
}
public class AnimatedAlign : ImplicitlyAnimatedWidget {
public AnimatedAlign(
Key key = null,
Alignment alignment = null,
Widget child = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(alignment != null);
this.alignment = alignment;
this.child = child;
}
public readonly Alignment alignment;
public readonly Widget child;
public override State createState() {
return new _AnimatedAlignState();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment", value: this.alignment));
}
}
class _AnimatedAlignState : AnimatedWidgetBaseState<AnimatedAlign> {
AlignmentTween _alignment;
protected override void forEachTween(TweenVisitor visitor) {
this._alignment = (AlignmentTween) visitor.visit(this, tween: this._alignment,
targetValue: this.widget.alignment, constructor: value => new AlignmentTween(begin: value));
}
public override Widget build(BuildContext context) {
return new Align(
alignment: this._alignment.evaluate(animation: this.animation),
child: this.widget.child
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(properties: description);
description.add(new DiagnosticsProperty<AlignmentTween>("alignment", value: this._alignment, defaultValue: null));
}
}
public class AnimatedPositioned : ImplicitlyAnimatedWidget {
public AnimatedPositioned(
Key key = null,
Widget child = null,
float? left = null,
float? top = null,
float? right = null,
float? bottom = null,
float? width = null,
float? height = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(left == null || right == null || width == null);
D.assert(top == null || bottom == null || height == null);
this.child = child;
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
this.width = width;
this.height = height;
}
public static AnimatedPositioned fromRect(
Key key = null,
Widget child = null,
Rect rect = null,
Curve curve = null,
TimeSpan? duration = null
) {
return new AnimatedPositioned(
child: child,
duration: duration,
left: rect.left,
top: rect.top,
right: null,
bottom: null,
width: rect.width,
height: rect.height,
curve: curve ?? Curves.linear,
key: key
);
}
public readonly Widget child;
public readonly float? left;
public readonly float? top;
public readonly float? right;
public readonly float? bottom;
public readonly float? width;
public readonly float? height;
public override State createState() {
return new _AnimatedPositionedState();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new FloatProperty("left", value: this.left, defaultValue: null));
properties.add(new FloatProperty("top", value: this.top, defaultValue: null));
properties.add(new FloatProperty("right", value: this.right, defaultValue: null));
properties.add(new FloatProperty("bottom", value: this.bottom, defaultValue: null));
properties.add(new FloatProperty("width", value: this.width, defaultValue: null));
properties.add(new FloatProperty("height", value: this.height, defaultValue: null));
}
}
class _AnimatedPositionedState : AnimatedWidgetBaseState<AnimatedPositioned> {
Tween<float?> _left;
Tween<float?> _top;
Tween<float?> _right;
Tween<float?> _bottom;
Tween<float?> _width;
Tween<float?> _height;
protected override void forEachTween(TweenVisitor visitor) {
this._left = visitor.visit(this, tween: this._left, targetValue: this.widget.left,
constructor: value => new NullableFloatTween(begin: value));
this._top = visitor.visit(this, tween: this._top, targetValue: this.widget.top,
constructor: value => new NullableFloatTween(begin: value));
this._right = visitor.visit(this, tween: this._right, targetValue: this.widget.right,
constructor: value => new NullableFloatTween(begin: value));
this._bottom = visitor.visit(this, tween: this._bottom, targetValue: this.widget.bottom,
constructor: value => new NullableFloatTween(begin: value));
this._width = visitor.visit(this, tween: this._width, targetValue: this.widget.width,
constructor: value => new NullableFloatTween(begin: value));
this._height = visitor.visit(this, tween: this._height, targetValue: this.widget.height,
constructor: value => new NullableFloatTween(begin: value));
}
public override Widget build(BuildContext context) {
return new Positioned(
child: this.widget.child,
left: this._left?.evaluate(animation: this.animation),
top: this._top?.evaluate(animation: this.animation),
right: this._right?.evaluate(animation: this.animation),
bottom: this._bottom?.evaluate(animation: this.animation),
width: this._width?.evaluate(animation: this.animation),
height: this._height?.evaluate(animation: this.animation)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(properties: description);
description.add(ObjectFlagProperty<Tween<float?>>.has("left", value: this._left));
description.add(ObjectFlagProperty<Tween<float?>>.has("top", value: this._top));
description.add(ObjectFlagProperty<Tween<float?>>.has("right", value: this._right));
description.add(ObjectFlagProperty<Tween<float?>>.has("bottom", value: this._bottom));
description.add(ObjectFlagProperty<Tween<float?>>.has("width", value: this._width));
description.add(ObjectFlagProperty<Tween<float?>>.has("height", value: this._height));
}
}
public class AnimatedPositionedDirectional : ImplicitlyAnimatedWidget {
public AnimatedPositionedDirectional(
Key key = null,
Widget child = null,
float? start = null,
float? top = null,
float? end = null,
float? bottom = null,
float? width = null,
float? height = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve, duration: duration) {
D.assert(start == null || end == null || width == null);
D.assert(top == null || bottom == null || height == null);
this.child = child;
this.start = start;
this.top = top;
this.end = end;
this.bottom = bottom;
this.width = width;
this.height = height;
}
public readonly Widget child;
public readonly float? start;
public readonly float? top;
public readonly float? end;
public readonly float? bottom;
public readonly float? width;
public readonly float? height;
public override State createState() {
return new _AnimatedPositionedDirectionalState();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new FloatProperty("start", value: this.start, defaultValue: null));
properties.add(new FloatProperty("top", value: this.top, defaultValue: null));
properties.add(new FloatProperty("end", value: this.end, defaultValue: null));
properties.add(new FloatProperty("bottom", value: this.bottom, defaultValue: null));
properties.add(new FloatProperty("width", value: this.width, defaultValue: null));
properties.add(new FloatProperty("height", value: this.height, defaultValue: null));
}
}
class _AnimatedPositionedDirectionalState : AnimatedWidgetBaseState<AnimatedPositionedDirectional> {
Tween<float?> _start;
Tween<float?> _top;
Tween<float?> _end;
Tween<float?> _bottom;
Tween<float?> _width;
Tween<float?> _height;
protected override void forEachTween(TweenVisitor visitor) {
this._start = visitor.visit(this, tween: this._start, targetValue: this.widget.start,
constructor: value => new NullableFloatTween(begin: value));
this._top = visitor.visit(this, tween: this._top, targetValue: this.widget.top,
constructor: value => new NullableFloatTween(begin: value));
this._end = visitor.visit(this, tween: this._end, targetValue: this.widget.end,
constructor: value => new NullableFloatTween(begin: value));
this._bottom = visitor.visit(this, tween: this._bottom, targetValue: this.widget.bottom,
constructor: value => new NullableFloatTween(begin: value));
this._width = visitor.visit(this, tween: this._width, targetValue: this.widget.width,
constructor: value => new NullableFloatTween(begin: value));
this._height = visitor.visit(this, tween: this._height, targetValue: this.widget.height,
constructor: value => new NullableFloatTween(begin: value));
}
public override Widget build(BuildContext context) {
D.assert(WidgetsD.debugCheckHasDirectionality(context));
return Positioned.directional(
textDirection: Directionality.of(context: context),
child: this.widget.child,
start: this._start?.evaluate(animation: this.animation),
top: this._top?.evaluate(animation: this.animation),
end: this._end?.evaluate(animation: this.animation),
bottom: this._bottom?.evaluate(animation: this.animation),
width: this._width?.evaluate(animation: this.animation),
height: this._height?.evaluate(animation: this.animation)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(properties: description);
description.add(ObjectFlagProperty<Tween<float?>>.has("start", value: this._start));
description.add(ObjectFlagProperty<Tween<float?>>.has("top", value: this._top));
description.add(ObjectFlagProperty<Tween<float?>>.has("end", value: this._end));
description.add(ObjectFlagProperty<Tween<float?>>.has("bottom", value: this._bottom));
description.add(ObjectFlagProperty<Tween<float?>>.has("width", value: this._width));
description.add(ObjectFlagProperty<Tween<float?>>.has("height", value: this._height));
}
}
public class AnimatedOpacity : ImplicitlyAnimatedWidget {
public AnimatedOpacity(
Key key = null,

2
Runtime/widgets/list_wheel_scroll_view.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.physics;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.ui;
using UnityEngine;

6
Runtime/widgets/sliver.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.Runtime.external;
using Unity.UIWidgets.external;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {

}
}
class SliverFillRemaining : SingleChildRenderObjectWidget {
public class SliverFillRemaining : SingleChildRenderObjectWidget {
public SliverFillRemaining(
Key key = null,
Widget child = null

properties.add(new DiagnosticsProperty<bool>("keepAlive", this.keepAlive));
}
}
}
}
正在加载...
取消
保存