浏览代码

updates

/main
kg 6 年前
当前提交
70c6b681
共有 42 个文件被更改,包括 2373 次插入13 次删除
  1. 4
      .gitignore
  2. 10
      Assets/UIWidgets/foundation/node.cs
  3. 7
      Assets/UIWidgets/painting/box_border.cs
  4. 577
      Assets/UIWidgets/rendering/object.cs
  5. 11
      Assets/UIWidgets/ui/geometry.cs
  6. 74
      Assets/UIWidgets/ui/painting.cs
  7. 101
      Assets/UIWidgets/foundation/change_notifier.cs
  8. 3
      Assets/UIWidgets/foundation/change_notifier.cs.meta
  9. 64
      Assets/UIWidgets/foundation/observer_list.cs
  10. 3
      Assets/UIWidgets/foundation/observer_list.cs.meta
  11. 33
      Assets/UIWidgets/painting/basic_types.cs
  12. 3
      Assets/UIWidgets/painting/basic_types.cs.meta
  13. 12
      Assets/UIWidgets/painting/matrix_utils.cs
  14. 3
      Assets/UIWidgets/painting/matrix_utils.cs.meta
  15. 395
      Assets/UIWidgets/rendering/box.cs
  16. 3
      Assets/UIWidgets/rendering/box.cs.meta
  17. 233
      Assets/UIWidgets/rendering/layer.cs
  18. 3
      Assets/UIWidgets/rendering/layer.cs.meta
  19. 11
      Assets/UIWidgets/rendering/object.mixin.gen.cs.meta
  20. 231
      Assets/UIWidgets/rendering/object.mixin.njk
  21. 7
      Assets/UIWidgets/rendering/object.mixin.njk.meta
  22. 103
      Assets/UIWidgets/rendering/proxy_box.cs
  23. 3
      Assets/UIWidgets/rendering/proxy_box.cs.meta
  24. 11
      Assets/UIWidgets/rendering/proxy_box.mixin.gen.cs.meta
  25. 77
      Assets/UIWidgets/rendering/proxy_box.mixin.njk
  26. 3
      Assets/UIWidgets/rendering/proxy_box.mixin.njk.meta
  27. 11
      Assets/UIWidgets/rendering/sliver.cs
  28. 3
      Assets/UIWidgets/rendering/sliver.cs.meta
  29. 135
      Assets/UIWidgets/rendering/viewpoint.cs
  30. 3
      Assets/UIWidgets/rendering/viewpoint.cs.meta
  31. 29
      Assets/UIWidgets/rendering/viewport_offset.cs
  32. 3
      Assets/UIWidgets/rendering/viewport_offset.cs.meta
  33. 15
      Assets/UIWidgets/ui/compositing.cs
  34. 3
      Assets/UIWidgets/ui/compositing.cs.meta
  35. 6
      Assets/UIWidgets/ui/text.cs
  36. 3
      Assets/UIWidgets/ui/text.cs.meta
  37. 94
      scripts/cmds/codegen.js
  38. 73
      scripts/gitignore
  39. 16
      scripts/package.json
  40. 7
      scripts/uiwidgets-cli.js

4
.gitignore


# Builds
*.apk
*.unitypackage
*.unitypackage
*.gen.cs

10
Assets/UIWidgets/foundation/node.cs


}
}
public void redepthChildren() {
public virtual void redepthChildren() {
}
public object owner {

get { return this._owner != null; }
}
public void attach(object owner) {
public virtual void attach(object owner) {
public void detach() {
public virtual void detach() {
this._owner = null;
}

public AbstractNode _parent;
public void adoptChild(AbstractNode child) {
public virtual void adoptChild(AbstractNode child) {
child._parent = this;
if (this.attached) {
child.attach(this._owner);

}
public void dropChild(AbstractNode child) {
public virtual void dropChild(AbstractNode child) {
child._parent = null;
if (this.attached) {
child.detach();

7
Assets/UIWidgets/painting/box_border.cs


this.size = size;
}
public ImageConfiguration copyWith(
Size size = null) {
return new ImageConfiguration(
size: size ?? this.size
);
}
public readonly Size size;
}
}

577
Assets/UIWidgets/rendering/object.cs


using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using TMPro;
using UIWidgets.ui;
using UnityEditor.Rendering;
using UnityEngine.XR.WSA.Persistence;
using Canvas = UIWidgets.ui.Canvas;
using Rect = UIWidgets.ui.Rect;
public class ParentData {
public virtual void detach() {
}
}
public delegate void PaintingContextCallback(PaintingContext context, Offset offset);
public delegate void LayoutCallback<T>(T constraints) where T : Constraints;
public class PaintingContext {
private PaintingContext(ContainerLayer containerLayer) {
this._containerLayer = containerLayer;
}
public readonly ContainerLayer _containerLayer;
public static void repaintCompositedChild(RenderObject child) {
if (child._layer == null) {
child._layer = new OffsetLayer();
} else {
child._layer.removeAllChildren();
}
var childContext = new PaintingContext(child._layer);
child._paintWithContext(childContext, Offset.zero);
childContext._stopRecordingIfNeeded();
}
public void paintChild(RenderObject child, Offset offset) {
if (child.isRepaintBoundary) {
this._stopRecordingIfNeeded();
this._compositeChild(child, offset);
} else {
child._paintWithContext(this, offset);
}
}
public void _compositeChild(RenderObject child, Offset offset) {
if (child._needsPaint) {
PaintingContext.repaintCompositedChild(child);
} else {
}
child._layer.offset = offset;
this._appendLayer(child._layer);
}
public void _appendLayer(Layer layer) {
layer.remove();
this._containerLayer.append(layer);
}
public bool _isRecording {
get {
bool hasCanvas = this._canvas != null;
return hasCanvas;
}
}
public PictureLayer _currentLayer;
public PictureRecorder _recorder;
public Canvas _canvas;
public Canvas canvas {
get {
if (this._canvas == null) {
this._startRecording();
}
return this._canvas;
}
}
public void _startRecording() {
this._currentLayer = new PictureLayer();
this._recorder = new PictureRecorder();
this._canvas = new Canvas(this._recorder);
this._containerLayer.append(this._currentLayer);
}
public void _stopRecordingIfNeeded() {
if (!this._isRecording) {
return;
}
this._currentLayer.picture = this._recorder.endRecording();
this._currentLayer = null;
this._recorder = null;
this._canvas = null;
}
public void addLayer(Layer layer) {
this._stopRecordingIfNeeded();
this._appendLayer(layer);
}
void pushLayer(Layer childLayer, PaintingContextCallback painter, Offset offset) {
this._stopRecordingIfNeeded();
this._appendLayer(childLayer);
var childContext = new PaintingContext((ContainerLayer) childLayer);
painter(childContext, offset);
childContext._stopRecordingIfNeeded();
}
public void pushClipRect(bool needsCompositing, Offset offset, Rect clipRect, PaintingContextCallback painter) {
Rect offsetClipRect = clipRect.shift(offset);
if (needsCompositing) {
this.pushLayer(new ClipRectLayer(clipRect: offsetClipRect), painter, offset);
} else {
// canvas
// ..save()
// ..clipRect(offsetClipRect);
// painter(this, offset);
// canvas
// ..restore();
}
}
void pushTransform(Offset offset, Matrix4x4 transform, PaintingContextCallback painter) {
}
void pushOpacity(Offset offset, int alpha, PaintingContextCallback painter) {
this.pushLayer(new OpacityLayer(alpha: alpha), painter, offset);
}
}
public class PipelineOwner {
public PipelineOwner(VoidCallback onNeedVisualUpdate = null) {
this.onNeedVisualUpdate = onNeedVisualUpdate;
}
public readonly VoidCallback onNeedVisualUpdate;
public void requestVisualUpdate() {
if (this.onNeedVisualUpdate != null) {
this.onNeedVisualUpdate();
}
}
public AbstractNode rootNode {
get { return this._rootNode; }
set {
if (this._rootNode == value) {
return;
}
if (this._rootNode != null) {
this._rootNode.detach();
}
this._rootNode = value;
if (this._rootNode != null) {
this._rootNode.attach(this);
}
}
}
public AbstractNode _rootNode;
public List<RenderObject> _nodesNeedingLayout = new List<RenderObject>();
public void flushLayout() {
while (this._nodesNeedingLayout.Count > 0) {
var dirtyNodes = this._nodesNeedingLayout;
this._nodesNeedingLayout = new List<RenderObject>();
dirtyNodes.Sort((a, b) => a.depth - b.depth);
foreach (var node in dirtyNodes) {
if (node._needsLayout && node.owner == this) {
node._layoutWithoutResize();
}
}
}
}
public List<RenderObject> _nodesNeedingCompositingBitsUpdate = new List<RenderObject>();
public void flushCompositingBits() {
this._nodesNeedingCompositingBitsUpdate.Sort((a, b) => a.depth - b.depth);
foreach (RenderObject node in this._nodesNeedingCompositingBitsUpdate) {
if (node._needsCompositingBitsUpdate && node.owner == this) {
node._updateCompositingBits();
}
}
this._nodesNeedingCompositingBitsUpdate.Clear();
}
public List<RenderObject> _nodesNeedingPaint = new List<RenderObject>();
public void flushPaint() {
var dirtyNodes = this._nodesNeedingPaint;
this._nodesNeedingPaint = new List<RenderObject>();
dirtyNodes.Sort((a, b) => a.depth - b.depth);
foreach (var node in dirtyNodes) {
if (node._needsPaint && node.owner == this) {
if (node._layer.attached) {
PaintingContext.repaintCompositedChild(node);
} else {
node._skippedPaintingOnLayer();
}
}
}
}
}
public abstract class Constraints {
public abstract bool isTight { get; }
public abstract bool isNormalized { get; }
}
public delegate void RenderObjectVisitor(RenderObject child);
public abstract class ContainerParentDataMixin<ChildType> : ParentData where ChildType : RenderObject {
public ChildType previousSibling;
public ChildType nextSibling;
public override void detach() {
base.detach();
if (this.previousSibling != null) {
var previousSiblingParentData = (ContainerParentDataMixin<ChildType>) this.previousSibling.parentData;
previousSiblingParentData.nextSibling = this.nextSibling;
}
if (this.nextSibling != null) {
var nextSiblingParentData = (ContainerParentDataMixin<ChildType>) this.nextSibling.parentData;
nextSiblingParentData.previousSibling = this.previousSibling;
}
this.previousSibling = null;
this.nextSibling = null;
}
}
public void onGUI(GUIContext context) {
public ParentData parentData;
public virtual void setupParentData(RenderObject child) {
if (!(child.parentData is ParentData)) {
child.parentData = new ParentData();
}
}
public override void adoptChild(AbstractNode childNode) {
var child = (RenderObject) childNode;
this.setupParentData(child);
base.adoptChild(child);
this.markNeedsLayout();
}
public override void dropChild(AbstractNode childNode) {
var child = (RenderObject) childNode;
child._cleanRelayoutBoundary();
child.parentData.detach();
child.parentData = null;
base.dropChild(child);
this.markNeedsLayout();
}
public virtual void visitChildren(RenderObjectVisitor visitor) {
}
public new PipelineOwner owner {
get { return (PipelineOwner) base.owner; }
}
public override void attach(object ownerObject) {
var owner = (PipelineOwner) ownerObject;
base.attach(owner);
if (this._needsLayout && this._relayoutBoundary == null) {
this._needsLayout = false;
this.markNeedsLayout();
}
if (this._needsPaint) {
}
}
public bool _needsLayout = true;
public RenderObject _relayoutBoundary;
bool _doingThisLayoutWithCallback = false;
public Constraints constraints {
get { return this._constraints; }
}
public Constraints _constraints;
public virtual void markNeedsLayout() {
if (this._needsLayout) {
return;
}
if (this._relayoutBoundary != this) {
this.markNeedsLayout();
} else {
this._needsLayout = true;
if (this.owner != null) {
this.owner._nodesNeedingLayout.Add(this);
this.owner.requestVisualUpdate();
}
}
}
public void markParentNeedsLayout() {
this._needsLayout = true;
var parent = (RenderObject) this.parent;
if (!this._doingThisLayoutWithCallback) {
parent.markNeedsLayout();
}
}
public void markNeedsLayoutForSizedByParentChange() {
this.markNeedsLayout();
this.markParentNeedsLayout();
}
public void _cleanRelayoutBoundary() {
if (this._relayoutBoundary != this) {
this._relayoutBoundary = null;
this._needsLayout = true;
this.visitChildren(child => { child._cleanRelayoutBoundary(); });
}
}
public void scheduleInitialLayout() {
this._relayoutBoundary = this;
this.owner._nodesNeedingLayout.Add(this);
}
public void _layoutWithoutResize() {
try {
this.performLayout();
}
catch (Exception ex) {
Debug.LogError("error in performLayout: " + ex);
}
this._needsLayout = false;
this.markNeedsPaint();
}
public void layout(Constraints constraints, bool parentUsesSize = false) {
RenderObject relayoutBoundary;
if (!parentUsesSize || this.sizedByParent || constraints.isTight || !(parent is RenderObject)) {
relayoutBoundary = this;
} else {
var parent1 = (RenderObject) this.parent;
relayoutBoundary = parent1._relayoutBoundary;
}
if (!this._needsLayout && constraints == this._constraints && relayoutBoundary == this._relayoutBoundary) {
return;
}
this._constraints = constraints;
this._relayoutBoundary = relayoutBoundary;
if (this.sizedByParent) {
try {
this.performResize();
}
catch (Exception ex) {
Debug.LogError("error in performResize: " + ex);
}
}
try {
this.performLayout();
}
catch (Exception ex) {
Debug.LogError("error in performLayout: " + ex);
}
this._needsLayout = false;
this.markNeedsPaint();
}
public bool sizedByParent {
get { return false; }
}
public abstract void performResize();
public abstract void performLayout();
public void invokeLayoutCallback<T>(LayoutCallback<T> callback) where T : Constraints {
this._doingThisLayoutWithCallback = true;
try {
callback((T) this.constraints);
}
finally {
this._doingThisLayoutWithCallback = false;
}
}
public bool isRepaintBoundary {
get { return false; }
}
public bool alwaysNeedsCompositing {
get { return false; }
}
public OffsetLayer _layer;
public OffsetLayer layer {
get { return this._layer; }
}
public bool _needsCompositingBitsUpdate = false;
public void markNeedsCompositingBitsUpdate() {
if (!this._needsCompositingBitsUpdate) {
return;
}
this._needsCompositingBitsUpdate = true;
if (this.parent is RenderObject) {
var parent = (RenderObject) this.parent;
if (parent._needsCompositingBitsUpdate) {
return;
}
if (!this.isRepaintBoundary && !parent.isRepaintBoundary) {
parent.markNeedsCompositingBitsUpdate();
return;
}
}
if (this.owner != null) {
this.owner._nodesNeedingCompositingBitsUpdate.Add(this);
}
}
public bool _needsCompositing;
public bool needsCompositing {
get { return _needsCompositing; }
}
public void _updateCompositingBits() {
if (!this._needsCompositingBitsUpdate) {
return;
}
bool oldNeedsCompositing = this._needsCompositing;
this._needsCompositing = false;
this.visitChildren(child => {
child._updateCompositingBits();
if (child.needsCompositing) {
this._needsCompositing = true;
}
});
if (this.isRepaintBoundary || this.alwaysNeedsCompositing) {
this._needsCompositing = true;
}
if (oldNeedsCompositing != this._needsCompositing) {
this.markNeedsPaint();
}
this._needsCompositingBitsUpdate = false;
}
public bool _needsPaint = true;
public void markNeedsPaint() {
if (this._needsPaint) {
return;
}
if (this.isRepaintBoundary) {
if (this.owner != null) {
this.owner._nodesNeedingPaint.Add(this);
this.owner.requestVisualUpdate();
}
} else if (this.parent is RenderObject) {
var parent = (RenderObject) this.parent;
parent.markNeedsPaint();
} else {
if (this.owner != null) {
this.owner.requestVisualUpdate();
}
}
}
public void _skippedPaintingOnLayer() {
AbstractNode ancestor = this.parent;
while (ancestor is RenderObject) {
var node = (RenderObject) ancestor;
if (node.isRepaintBoundary) {
if (node._layer == null) {
break;
}
if (node._layer.attached) {
break;
}
node._needsPaint = true;
}
ancestor = ancestor.parent;
}
}
public void scheduleInitialPaint(ContainerLayer rootLayer) {
this._layer = (OffsetLayer) rootLayer;
this.owner._nodesNeedingPaint.Add(this);
}
public void replaceRootLayer(OffsetLayer rootLayer) {
this._layer.detach();
this._layer = rootLayer;
this.markNeedsPaint();
}
public void _paintWithContext(PaintingContext context, Offset offset) {
if (this._needsLayout) {
return;
}
this._needsPaint = false;
try {
this.paint(context, offset);
}
catch (Exception ex) {
Debug.LogError("error in paint: " + ex);
}
}
public abstract Rect paintBounds { get; }
public virtual void paint(PaintingContext context, Offset offset) {
}
public virtual void applyPaintTransform(RenderObject child, Matrix4x4 transform) {
}
public Matrix4x4 getTransformTo(RenderObject ancestor) {
if (ancestor == null) {
AbstractNode rootNode = this.owner.rootNode;
if (rootNode is RenderObject)
ancestor = (RenderObject) rootNode;
}
var renderers = new List<RenderObject>();
for (RenderObject renderer = this; renderer != ancestor; renderer = (RenderObject) renderer.parent) {
renderers.Add(renderer);
}
var transform = Matrix4x4.identity;
for (int index = renderers.Count - 1; index > 0; index -= 1) {
renderers[index].applyPaintTransform(renderers[index - 1], transform);
}
return transform;
child.onGUI(this);
//child.onGUI(this);
}
}

}
public class TextSpan {
}
}

11
Assets/UIWidgets/ui/geometry.cs


return new Offset(this.dx + translateX, this.dy + translateY);
}
public static Offset operator -(Offset a, Offset b) {
return new Offset(a.dx - b.dx, a.dy - b.dy);
}
public static Offset operator +(Offset a, Offset b) {
return new Offset(a.dx + b.dx, a.dy + b.dy);
}
public static Rect operator &(Offset a, Size other) {
return Rect.fromLTWH(a.dx, a.dy, other.width, other.height);
}

return Rect.fromLTRB(this.left - delta, this.top - delta, this.right + delta, this.bottom + delta);
}
public bool contains(Offset offset) {
return offset.dx >= this.left && offset.dx < this.right && offset.dy >= this.top && offset.dy < this.bottom;
}
public bool Equals(Rect other) {
if (object.ReferenceEquals(null, other)) return false;

74
Assets/UIWidgets/ui/painting.cs


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UIWidgets.painting;
using UnityEditor;
using UnityEngine;

}
}
public abstract class Canvas {
public abstract void drawPloygon4(Paint paint, params Offset[] points);
public class Canvas {
public Canvas(PictureRecorder recorder) {
this.recorder = recorder;
}
public abstract void drawRect(Paint paint, Rect rect, BorderWidth borderWidth, BorderRadius borderRadius);
public readonly PictureRecorder recorder;
public abstract void drawRectShadow(Paint paint, Rect rect);
public void drawPloygon4(Paint paint, params Offset[] points) {
this.recorder.addDrawCmd(new drawPloygon4 {
color = paint.color,
points = points,
});
}
public void drawRect(Paint paint, Rect rect, BorderWidth borderWidth, BorderRadius borderRadius) {
this.recorder.addDrawCmd(new drawRect {
color = paint.color,
rect = rect,
borderWidth = borderWidth,
borderRadius = borderRadius,
});
}
public void drawRectShadow(Paint paint, Rect rect) {
this.recorder.addDrawCmd(new drawRectShadow {
color = paint.color,
blurSigma = paint.blurSigma,
rect = rect,
});
}
}
public class Picture {
public Picture(List<object> drawCmds) {
this.drawCmds = drawCmds;
}
public readonly List<object> drawCmds;
}
public class PictureRecorder {
public List<object> _drawCmds = new List<object>();
public Picture endRecording() {
var drawCmd = this._drawCmds;
this._drawCmds = new List<object>();
return new Picture(drawCmd);
}
public void addDrawCmd(object drawCmd) {
this._drawCmds.Add(drawCmd);
}
}
public class drawPloygon4 {
public Color color;
public Offset[] points;
}
public class drawRect {
public Color color;
public Rect rect;
public BorderWidth borderWidth;
public BorderRadius borderRadius;
}
public class drawRectShadow {
public Color color;
public double blurSigma;
public Rect rect;
}
public class Paint {

101
Assets/UIWidgets/foundation/change_notifier.cs


using System;
using System.Collections.Generic;
using UnityEngine;
namespace UIWidgets.foundation {
public interface Listenable {
void addListener(VoidCallback listener);
void removeListener(VoidCallback listener);
}
public static class ListenableUtils {
public static Listenable merge(List<Listenable> listenables) {
return new _MergingListenable(listenables);
}
}
public interface ValueListenable<T> : Listenable {
T value { get; }
}
public class ChangeNotifier : Listenable {
public ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public bool hasListeners {
get { return this._listeners.Count > 0; }
}
public void addListener(VoidCallback listener) {
this._listeners.Add(listener);
}
public void removeListener(VoidCallback listener) {
this._listeners.Remove(listener);
}
public virtual void dispose() {
this._listeners = null;
}
public void notifyListeners() {
if (this._listeners != null) {
var localListeners = new List<VoidCallback>(this._listeners);
foreach (VoidCallback listener in localListeners) {
try {
if (this._listeners.Contains(listener)) {
listener();
}
}
catch (Exception ex) {
Debug.LogError("error while dispatching notifications: " + ex);
}
}
}
}
}
public class _MergingListenable : ChangeNotifier {
public _MergingListenable(List<Listenable> _children) {
this._children = _children;
foreach (Listenable child in _children) {
if (child != null) {
child.addListener(this.notifyListeners);
}
}
}
public readonly List<Listenable> _children;
public override void dispose() {
foreach (Listenable child in this._children) {
if (child != null) {
child.removeListener(this.notifyListeners);
}
}
base.dispose();
}
}
public class ValueNotifier<T> : ChangeNotifier, ValueListenable<T> {
public ValueNotifier(T value) {
this._value = value;
}
public T value {
get { return this._value; }
set {
if (object.Equals(value, this._value)) {
return;
}
this._value = value;
this.notifyListeners();
}
}
public T _value;
}
}

3
Assets/UIWidgets/foundation/change_notifier.cs.meta


fileFormatVersion: 2
guid: b6eab85d4579444c90cea2d7d68154a7
timeCreated: 1534050460

64
Assets/UIWidgets/foundation/observer_list.cs


using System.Collections;
using System.Collections.Generic;
namespace UIWidgets.foundation {
public class ObserverList<T> : ICollection<T> {
public readonly List<T> _list = new List<T>();
public bool _isDirty = false;
public HashSet<T> _set = null;
IEnumerator IEnumerable.GetEnumerator() {
return this.GetEnumerator();
}
public IEnumerator<T> GetEnumerator() {
return this._list.GetEnumerator();
}
public void Add(T item) {
this._isDirty = true;
this._list.Add(item);
}
public void Clear() {
this._isDirty = true;
this._list.Clear();
}
public bool Contains(T item) {
if (this._list.Count < 3) {
return this._list.Contains(item);
}
if (this._isDirty) {
if (this._set == null) {
this._set = new HashSet<T>(this._list);
} else {
this._set.Clear();
this._set.UnionWith(this._list);
}
this._isDirty = false;
}
return this._set.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex) {
this._list.CopyTo(array, arrayIndex);
}
public bool Remove(T item) {
this._isDirty = true;
return this._list.Remove(item);
}
public int Count {
get { return this._list.Count; }
}
public bool IsReadOnly {
get { return false; }
}
}
}

3
Assets/UIWidgets/foundation/observer_list.cs.meta


fileFormatVersion: 2
guid: abc157b09ab5425dbdad92fad9bdfc4d
timeCreated: 1534050868

33
Assets/UIWidgets/painting/basic_types.cs


using System;
using System.ComponentModel;
namespace UIWidgets.painting {
public enum AxisDirection {
up,
right,
down,
left,
}
public enum Axis {
horizontal,
vertical,
}
public static class AxisUtils {
public static Axis axisDirectionToAxis(AxisDirection axisDirection) {
switch (axisDirection) {
case AxisDirection.up:
case AxisDirection.down:
return Axis.vertical;
case AxisDirection.left:
case AxisDirection.right:
return Axis.horizontal;
}
throw new Exception("unknown axisDirection");
}
}
}

3
Assets/UIWidgets/painting/basic_types.cs.meta


fileFormatVersion: 2
guid: 979995af3be3441bb7b91f7f732dad0a
timeCreated: 1534049827

12
Assets/UIWidgets/painting/matrix_utils.cs


using UIWidgets.ui;
using UnityEngine;
namespace UIWidgets.painting {
public class MatrixUtils {
public static Offset transformPoint(Matrix4x4 transform, Offset point) {
var position3 = new Vector3((float) point.dx, (float) point.dy, 0);
var transformed3 = transform.MultiplyPoint(position3);
return new Offset(transformed3.x, transformed3.y);
}
}
}

3
Assets/UIWidgets/painting/matrix_utils.cs.meta


fileFormatVersion: 2
guid: a5c132e5f9af4c8ba6b46fc4d9ec32a0
timeCreated: 1534149883

395
Assets/UIWidgets/rendering/box.cs


using System;
using System.Collections.Generic;
using UIWidgets.painting;
using UIWidgets.ui;
using UnityEngine;
using Rect = UIWidgets.ui.Rect;
namespace UIWidgets.rendering {
public class BoxConstraints : Constraints {
public BoxConstraints(
double minWidth = 0.0,
double maxWidth = double.PositiveInfinity,
double minHeight = 0.0,
double maxHeight = double.PositiveInfinity) {
this.minWidth = minWidth;
this.maxWidth = maxWidth;
this.minHeight = minHeight;
this.maxHeight = maxHeight;
}
public readonly double minWidth;
public readonly double maxWidth;
public readonly double minHeight;
public readonly double maxHeight;
public static BoxConstraints tight(Size size) {
return new BoxConstraints(
size.width,
size.width,
size.height,
size.height
);
}
public BoxConstraints widthConstraints() {
return new BoxConstraints(minWidth: this.minWidth, maxWidth: this.maxWidth);
}
public BoxConstraints heightConstraints() {
return new BoxConstraints(minHeight: this.minHeight, maxHeight: this.maxHeight);
}
public double constrainWidth(double width = double.PositiveInfinity) {
return Mathf.Clamp((float) width, (float) this.minWidth, (float) this.maxWidth);
}
public double constrainHeight(double height = double.PositiveInfinity) {
return Mathf.Clamp((float) height, (float) this.minHeight, (float) this.maxHeight);
}
public Size constrain(Size size) {
return new Size(this.constrainWidth(size.width), this.constrainHeight(size.height));
}
public Size constrainDimensions(double width, double height) {
return new Size(this.constrainWidth(width), this.constrainHeight(height));
}
public Size constrainSizeAndAttemptToPreserveAspectRatio(Size size) {
if (this.isTight) {
Size result = this.smallest;
return result;
}
double width = size.width;
double height = size.height;
double aspectRatio = width / height;
if (width > this.maxWidth) {
width = this.maxWidth;
height = width / aspectRatio;
}
if (height > this.maxHeight) {
height = this.maxHeight;
width = height * aspectRatio;
}
if (width < this.minWidth) {
width = this.minWidth;
height = width / aspectRatio;
}
if (height < this.minHeight) {
height = this.minHeight;
width = height * aspectRatio;
}
return new Size(this.constrainWidth(width), this.constrainHeight(height));
}
public Size biggest {
get { return new Size(this.constrainWidth(), this.constrainHeight()); }
}
public Size smallest {
get { return new Size(this.constrainWidth(0.0), this.constrainHeight(0.0)); }
}
public bool hasTightWidth {
get { return this.minWidth >= this.maxWidth; }
}
public bool hasTightHeight {
get { return this.minHeight >= this.maxHeight; }
}
public override bool isTight {
get { return this.hasTightWidth && this.hasTightHeight; }
}
public bool hasBoundedWidth {
get { return this.minWidth < double.PositiveInfinity; }
}
public bool hasBoundedHeight {
get { return this.minHeight < double.PositiveInfinity; }
}
public bool hasInfiniteWidth {
get { return this.minWidth >= double.PositiveInfinity; }
}
public bool hasInfiniteHeight {
get { return this.minHeight >= double.PositiveInfinity; }
}
public bool isSatisfiedBy(Size size) {
return this.minWidth <= size.width && size.width <= this.maxWidth &&
this.minHeight <= size.height && size.height <= this.maxHeight;
}
public override bool isNormalized {
get {
return this.minWidth >= 0.0 &&
this.minWidth <= this.maxWidth &&
this.minHeight >= 0.0 &&
this.minHeight <= this.maxHeight;
}
}
public BoxConstraints normalize() {
if (this.isNormalized) {
return this;
}
var minWidth = this.minWidth >= 0.0 ? this.minWidth : 0.0;
var minHeight = this.minHeight >= 0.0 ? this.minHeight : 0.0;
return new BoxConstraints(
minWidth,
minWidth > this.maxWidth ? minWidth : this.maxWidth,
minHeight,
minHeight > this.maxHeight ? minHeight : this.maxHeight
);
}
protected bool Equals(BoxConstraints other) {
return this.minWidth.Equals(other.minWidth)
&& this.maxWidth.Equals(other.maxWidth)
&& this.minHeight.Equals(other.minHeight)
&& this.maxHeight.Equals(other.maxHeight);
}
public override bool Equals(object obj) {
if (object.ReferenceEquals(null, obj)) return false;
if (object.ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return this.Equals((BoxConstraints) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = this.minWidth.GetHashCode();
hashCode = (hashCode * 397) ^ this.maxWidth.GetHashCode();
hashCode = (hashCode * 397) ^ this.minHeight.GetHashCode();
hashCode = (hashCode * 397) ^ this.maxHeight.GetHashCode();
return hashCode;
}
}
public static bool operator ==(BoxConstraints a, BoxConstraints b) {
return object.Equals(a, b);
}
public static bool operator !=(BoxConstraints a, BoxConstraints b) {
return !(a == b);
}
}
public class BoxParentData : ParentData {
public Offset offset = Offset.zero;
}
public enum _IntrinsicDimension {
minWidth,
maxWidth,
minHeight,
maxHeight
}
public class _IntrinsicDimensionsCacheEntry : IEquatable<_IntrinsicDimensionsCacheEntry> {
public _IntrinsicDimensionsCacheEntry(_IntrinsicDimension dimension, double argument) {
this.dimension = dimension;
this.argument = argument;
}
public readonly _IntrinsicDimension dimension;
public readonly double argument;
public bool Equals(_IntrinsicDimensionsCacheEntry other) {
if (object.ReferenceEquals(null, other)) return false;
if (object.ReferenceEquals(this, other)) return true;
return this.dimension == other.dimension && this.argument.Equals(other.argument);
}
public override bool Equals(object obj) {
if (object.ReferenceEquals(null, obj)) return false;
if (object.ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return this.Equals((_IntrinsicDimensionsCacheEntry) obj);
}
public override int GetHashCode() {
unchecked {
return ((int) this.dimension * 397) ^ this.argument.GetHashCode();
}
}
public static bool operator ==(_IntrinsicDimensionsCacheEntry a, _IntrinsicDimensionsCacheEntry b) {
return object.Equals(a, b);
}
public static bool operator !=(_IntrinsicDimensionsCacheEntry a, _IntrinsicDimensionsCacheEntry b) {
return !(a == b);
}
}
public abstract class RenderBox : RenderObject {
public override void setupParentData(RenderObject child) {
if (!(child.parentData is BoxParentData)) {
child.parentData = new BoxParentData();
}
}
public Dictionary<_IntrinsicDimensionsCacheEntry, double> _cachedIntrinsicDimensions;
public double _computeIntrinsicDimension(_IntrinsicDimension dimension, double argument,
Func<double, double> computer) {
if (this._cachedIntrinsicDimensions == null) {
this._cachedIntrinsicDimensions = new Dictionary<_IntrinsicDimensionsCacheEntry, double>();
}
var key = new _IntrinsicDimensionsCacheEntry(dimension, argument);
double result;
if (this._cachedIntrinsicDimensions.TryGetValue(key, out result)) {
return result;
}
return this._cachedIntrinsicDimensions[key] = computer(argument);
}
public double getMinIntrinsicWidth(double height) {
return this._computeIntrinsicDimension(_IntrinsicDimension.minWidth, height, this.computeMinIntrinsicWidth);
}
public virtual double computeMinIntrinsicWidth(double height) {
return 0.0;
}
public double getMaxIntrinsicWidth(double height) {
return this._computeIntrinsicDimension(_IntrinsicDimension.maxWidth, height, this.computeMaxIntrinsicWidth);
}
public virtual double computeMaxIntrinsicWidth(double height) {
return 0.0;
}
public double getMinIntrinsicHeight(double width) {
return this._computeIntrinsicDimension(_IntrinsicDimension.minHeight, width,
this.computeMinIntrinsicHeight);
}
public virtual double computeMinIntrinsicHeight(double width) {
return 0.0;
}
public double getMaxIntrinsicHeight(double width) {
return this._computeIntrinsicDimension(_IntrinsicDimension.maxHeight, width,
this.computeMaxIntrinsicHeight);
}
public virtual double computeMaxIntrinsicHeight(double width) {
return 0.0;
}
public bool hasSize {
get { return this._size != null; }
}
public Size size {
get { return this._size; }
set { this._size = value; }
}
public Size _size;
public Dictionary<TextBaseline, double?> _cachedBaselines;
public double? getDistanceToBaseline(TextBaseline baseline, bool onlyReal = false) {
double? result = this.getDistanceToActualBaseline(baseline);
if (result == null && !onlyReal) {
return this.size.height;
}
return result;
}
public double? getDistanceToActualBaseline(TextBaseline baseline) {
if (this._cachedBaselines == null) {
this._cachedBaselines = new Dictionary<TextBaseline, double?>();
}
double? result;
if (this._cachedBaselines.TryGetValue(baseline, out result)) {
return result;
}
return this._cachedBaselines[baseline] = this.computeDistanceToActualBaseline(baseline);
}
public virtual double? computeDistanceToActualBaseline(TextBaseline baseline) {
return null;
}
public new BoxConstraints constraints {
get { return (BoxConstraints) base.constraints; }
}
public override void markNeedsLayout() {
if (this._cachedBaselines != null && this._cachedBaselines.Count > 0 ||
this._cachedIntrinsicDimensions != null && this._cachedIntrinsicDimensions.Count > 0) {
if (this._cachedBaselines != null) {
this._cachedBaselines.Clear();
}
if (this._cachedIntrinsicDimensions != null) {
this._cachedIntrinsicDimensions.Clear();
}
if (this.parent is RenderObject) {
this.markParentNeedsLayout();
return;
}
}
base.markNeedsLayout();
}
public override void performResize() {
this.size = this.constraints.smallest;
}
public override void performLayout() {
}
public override void applyPaintTransform(RenderObject child, Matrix4x4 transform) {
var childParentData = (BoxParentData) child.parentData;
var offset = childParentData.offset;
transform.SetTRS(new Vector2((float) offset.dx, (float) offset.dy), Quaternion.identity, Vector3.one);
}
public Offset globalToLocal(Offset point, RenderObject ancestor = null) {
var transform = this.getTransformTo(ancestor);
var det = transform.determinant;
if (det == 0f) {
return Offset.zero;
}
transform = transform.inverse;
return MatrixUtils.transformPoint(transform, point);
}
public Offset localToGlobal(Offset point, RenderObject ancestor = null) {
return MatrixUtils.transformPoint(this.getTransformTo(ancestor), point);
}
public override Rect paintBounds {
get { return Offset.zero & this.size; }
}
}
}

3
Assets/UIWidgets/rendering/box.cs.meta


fileFormatVersion: 2
guid: 6e883eb5b6464bd4ad3a8e61da880f3a
timeCreated: 1533893883

233
Assets/UIWidgets/rendering/layer.cs


using UIWidgets.foundation;
using UIWidgets.ui;
namespace UIWidgets.rendering {
public abstract class Layer : AbstractNode {
public new ContainerLayer parent {
get { return (ContainerLayer) base.parent; }
}
public Layer nextSibling {
get { return this._nextSibling; }
}
public Layer _nextSibling;
public Layer previousSibling {
get { return this._previousSibling; }
}
public Layer _previousSibling;
public virtual void remove() {
if (this.parent != null) {
this.parent._removeChild(this);
}
}
public void replaceWith(Layer newLayer) {
newLayer._nextSibling = this.nextSibling;
if (this._nextSibling != null) {
this._nextSibling._previousSibling = newLayer;
}
newLayer._previousSibling = this.previousSibling;
if (this._previousSibling != null) {
this._previousSibling._nextSibling = newLayer;
}
this.parent.adoptChild(newLayer);
if (this.parent.firstChild == this) {
this.parent._firstChild = newLayer;
}
if (this.parent.lastChild == this) {
this.parent._lastChild = newLayer;
}
this._nextSibling = null;
this._previousSibling = null;
this.parent.dropChild(this);
}
public abstract S find<S>(Offset regionOffset);
public abstract void addToScene(SceneBuilder builder, Offset layerOffset);
}
public class PictureLayer : Layer {
public Picture picture;
public override S find<S>(Offset regionOffset) {
return default(S);
}
public override void addToScene(SceneBuilder builder, Offset layerOffset) {
builder.addPicture(layerOffset, this.picture);
}
}
public class ContainerLayer : Layer {
public Layer firstChild {
get { return this._firstChild; }
}
public Layer _firstChild;
public Layer lastChild {
get { return this._lastChild; }
}
public Layer _lastChild;
public override S find<S>(Offset regionOffset) {
Layer current = this.lastChild;
while (current != null) {
var value = current.find<S>(regionOffset);
if (value != null) {
return value;
}
current = current.previousSibling;
}
return default(S);
}
public override void attach(object owner) {
base.attach(owner);
var child = this.firstChild;
while (child != null) {
child.attach(owner);
child = child.nextSibling;
}
}
public override void detach() {
base.detach();
var child = this.firstChild;
while (child != null) {
child.detach();
child = child.nextSibling;
}
}
public void append(Layer child) {
this.adoptChild(child);
child._previousSibling = this.lastChild;
if (this.lastChild != null) {
this.lastChild._nextSibling = child;
}
this._lastChild = child;
if (this._firstChild == null) {
this._firstChild = child;
}
}
public void _removeChild(Layer child) {
if (child._previousSibling == null) {
this._firstChild = child.nextSibling;
} else {
child._previousSibling._nextSibling = child.nextSibling;
}
if (child._nextSibling == null) {
this._lastChild = child.previousSibling;
} else {
child._nextSibling._previousSibling = child.previousSibling;
}
child._nextSibling = null;
child._previousSibling = null;
this.dropChild(child);
}
public void removeAllChildren() {
Layer child = this.firstChild;
while (child != null) {
Layer next = child.nextSibling;
child._previousSibling = null;
child._nextSibling = null;
this.dropChild(child);
child = next;
}
this._firstChild = null;
this._lastChild = null;
}
public override void addToScene(SceneBuilder builder, Offset layerOffset) {
this.addChildrenToScene(builder, layerOffset);
}
public void addChildrenToScene(SceneBuilder builder, Offset childOffset) {
Layer child = this.firstChild;
while (child != null) {
child.addToScene(builder, childOffset);
child = child.nextSibling;
}
}
public virtual void applyTransform(Layer child, UnityEngine.Matrix4x4 transform) {
}
}
public class OffsetLayer : ContainerLayer {
public OffsetLayer(Offset offset = null) {
this.offset = offset ?? Offset.zero;
}
public Offset offset;
public override S find<S>(Offset regionOffset) {
return base.find<S>(regionOffset - this.offset);
}
public override void addToScene(SceneBuilder builder, Offset layerOffset) {
this.addChildrenToScene(builder, this.offset + layerOffset);
}
}
public class ClipRectLayer : ContainerLayer {
public ClipRectLayer(Rect clipRect) {
this.clipRect = clipRect;
}
public Rect clipRect;
public override S find<S>(Offset regionOffset) {
if (!this.clipRect.contains(regionOffset)) {
return default(S);
}
return base.find<S>(regionOffset);
}
public override void addToScene(SceneBuilder builder, Offset layerOffset) {
builder.pushClipRect(this.clipRect.shift(layerOffset));
this.addChildrenToScene(builder, layerOffset);
builder.pop();
}
}
public class TransformLayer : OffsetLayer {
}
public class OpacityLayer : ContainerLayer {
public OpacityLayer(int alpha) {
this.alpha = alpha;
}
public int alpha;
public override void addToScene(SceneBuilder builder, Offset layerOffset) {
builder.pushOpacity(this.alpha);
this.addChildrenToScene(builder, layerOffset);
builder.pop();
}
}
}

3
Assets/UIWidgets/rendering/layer.cs.meta


fileFormatVersion: 2
guid: f3491a508e094c1caeaff938e233a914
timeCreated: 1534131134

11
Assets/UIWidgets/rendering/object.mixin.gen.cs.meta


fileFormatVersion: 2
guid: b71787cfc1b1b480c95430f2a21d3ea2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

231
Assets/UIWidgets/rendering/object.mixin.njk


// AUTO-GENERATED, DO NOT EDIT BY HAND
using System.Collections.Generic;
using UIWidgets.foundation;
using UnityEngine;
namespace UIWidgets.rendering {
{% macro ContainerRenderObjectMixin(with) %}
public class Container{{with}}<ChildType, ParentDataType> : {{with}}
where ChildType : RenderObject
where ParentDataType : ContainerParentDataMixin<ChildType> {
public int _childCount = 0;
public int countCount {
get { return this._childCount; }
}
public ChildType _firstChild;
public ChildType _lastChild;
public void _insertIntoChildList(ChildType child, ChildType after = null) {
var childParentData = (ParentDataType) child.parentData;
this._childCount++;
if (after == null) {
childParentData.nextSibling = this._firstChild;
if (this._firstChild != null) {
var firstChildParentData = (ParentDataType) this._firstChild.parentData;
firstChildParentData.previousSibling = child;
}
this._firstChild = child;
if (this._lastChild == null) {
this._lastChild = child;
}
} else {
var afterParentData = (ParentDataType) after.parentData;
if (afterParentData.nextSibling == null) {
childParentData.previousSibling = after;
afterParentData.nextSibling = child;
this._lastChild = child;
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childPreviousSiblingParentData.nextSibling = child;
childNextSiblingParentData.previousSibling = child;
}
}
}
public void insert(ChildType child, ChildType after = null) {
this.adoptChild(child);
this._insertIntoChildList(child, after);
}
public void add(ChildType child) {
this.insert(child, this._lastChild);
}
public void addAll(List<ChildType> children) {
if (children != null) {
children.ForEach(this.add);
}
}
public void _removeFromChildList(ChildType child) {
var childParentData = (ParentDataType) child.parentData;
if (childParentData.previousSibling == null) {
this._firstChild = childParentData.nextSibling;
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}
if (childParentData.nextSibling == null) {
this._lastChild = childParentData.previousSibling;
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}
childParentData.previousSibling = null;
childParentData.nextSibling = null;
this._childCount--;
}
public void remove(ChildType child) {
this._removeFromChildList(child);
this.dropChild(child);
}
public void removeAll() {
ChildType child = this._firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
var next = childParentData.nextSibling;
childParentData.previousSibling = null;
childParentData.nextSibling = null;
this.dropChild(child);
child = next;
}
this._firstChild = null;
this._lastChild = null;
this._childCount = 0;
}
public void move(ChildType child, ChildType after = null) {
var childParentData = (ParentDataType) child.parentData;
if (childParentData.previousSibling == after) {
return;
}
this._removeFromChildList(child);
this._insertIntoChildList(child, after);
// this.markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
ChildType child = this._firstChild;
while (child != null) {
child.attach(owner);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void detach() {
base.detach();
ChildType child = this._firstChild;
while (child != null) {
child.detach();
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void redepthChildren() {
ChildType child = this._firstChild;
while (child != null) {
this.redepthChild(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void vivitChildren(RenderObjectVisitor visitor) {
ChildType child = this._firstChild;
while (child != null) {
visitor(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public ChildType firstChild {
get { return this._firstChild; }
}
public ChildType lastChild {
get { return this._lastChild; }
}
public ChildType childBefore(ChildType child) {
var childParentData = (ParentDataType) child.parentData;
return childParentData.previousSibling;
}
public ChildType childAfter(ChildType child) {
var childParentData = (ParentDataType) child.parentData;
return childParentData.nextSibling;
}
}
{% endmacro %}
{{ ContainerRenderObjectMixin('RenderBox') }}
{{ ContainerRenderObjectMixin('RenderSliver') }}
{% macro RenderObjectWithChildMixin(with) %}
public abstract class RenderObjectWithChildMixin{{with}}<ChildType> : {{with}} where ChildType : RenderObject {
public ChildType _child;
public ChildType child {
get { return this._child; }
set {
if (this._child != null) {
this.dropChild(this._child);
}
this._child = value;
if (this._child != null) {
this.adoptChild(this._child);
}
}
}
public override void attach(object owner) {
base.attach(owner);
if (this._child != null) {
this._child.attach(owner);
}
}
public override void detach() {
base.detach();
if (this._child != null) {
this._child.detach();
}
}
public override void redepthChildren() {
if (this._child != null) {
this.redepthChild(this._child);
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
if (this._child != null) {
visitor(this._child);
}
}
}
{% endmacro %}
{{ RenderObjectWithChildMixin('RenderBox') }}
}

7
Assets/UIWidgets/rendering/object.mixin.njk.meta


fileFormatVersion: 2
guid: f509c0b4f02024b16a996d1473d88216
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

103
Assets/UIWidgets/rendering/proxy_box.cs


using UIWidgets.painting;
using UIWidgets.ui;
using UnityEngine;
namespace UIWidgets.rendering {
public class RenderProxyBox : RenderProxyBoxMixinRenderObjectWithChildMixinRenderBox<RenderBox> {
public RenderProxyBox(RenderBox child = null) {
this.child = child;
}
}
public enum DecorationPosition {
background,
foreground,
}
public class RenderDecoratedBox : RenderProxyBox {
public RenderDecoratedBox(
Decoration decoration,
DecorationPosition position = DecorationPosition.background,
ImageConfiguration configuration = null,
RenderBox child = null
) {
}
public BoxPainter _painter;
public Decoration decoration {
get { return this._decoration; }
set {
if (value == this._decoration) {
return;
}
if (this._painter != null) {
this._painter.dispose();
this._painter = null;
}
this._decoration = value;
this.markNeedsPaint();
}
}
public Decoration _decoration;
public DecorationPosition position {
get { return this._position; }
set {
if (value == this._position) {
return;
}
this._position = value;
this.markNeedsPaint();
}
}
public DecorationPosition _position;
public ImageConfiguration configuration {
get { return this._configuration; }
set {
if (value == this._configuration) {
return;
}
this._configuration = value;
this.markNeedsPaint();
}
}
public ImageConfiguration _configuration;
public override void detach() {
if (this._painter != null) {
this._painter.dispose();
this._painter = null;
}
base.detach();
this.markNeedsPaint();
}
public override void paint(PaintingContext context, Offset offset) {
if (this._painter == null) {
this._painter = this._decoration.createBoxPainter(this.markNeedsPaint);
}
var filledConfiguration = this.configuration.copyWith(size: this.size);
if (this.position == DecorationPosition.background) {
this._painter.paint(context.canvas, offset, filledConfiguration);
}
base.paint(context, offset);
if (this.position == DecorationPosition.foreground) {
this._painter.paint(context.canvas, offset, filledConfiguration);
}
}
}
}

3
Assets/UIWidgets/rendering/proxy_box.cs.meta


fileFormatVersion: 2
guid: 6da4b97fadea449e974cbfdc2ca4554e
timeCreated: 1534167031

11
Assets/UIWidgets/rendering/proxy_box.mixin.gen.cs.meta


fileFormatVersion: 2
guid: 4d673221d8ca64c51bf770758d10eb9a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

77
Assets/UIWidgets/rendering/proxy_box.mixin.njk


using UIWidgets.ui;
using UnityEngine;
namespace UIWidgets.rendering {
{% macro RenderProxyBoxMixin(with) %}
public abstract class RenderProxyBoxMixin{{with}}<T> : {{with}}<T> where T : RenderBox {
public override void setupParentData(RenderObject child) {
if (!(child.parentData is ParentData)) {
child.parentData = new ParentData();
}
}
public override double computeMinIntrinsicWidth(double height) {
if (this.child != null) {
return this.child.getMinIntrinsicWidth(height);
}
return 0.0;
}
public override double computeMaxIntrinsicWidth(double height) {
if (this.child != null) {
return this.child.getMaxIntrinsicWidth(height);
}
return 0.0;
}
public override double computeMinIntrinsicHeight(double width) {
if (this.child != null) {
return this.child.getMinIntrinsicHeight(width);
}
return 0.0;
}
public override double computeMaxIntrinsicHeight(double width) {
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(width);
}
return 0.0;
}
public override double? computeDistanceToActualBaseline(TextBaseline baseline) {
if (this.child != null) {
return this.child.getDistanceToActualBaseline(baseline);
}
return base.computeDistanceToActualBaseline(baseline);
}
public override void performLayout() {
if (this.child != null) {
this.child.layout(this.constraints, true);
this.size = this.child.size;
} else {
this.performResize();
}
}
public override void applyPaintTransform(RenderObject child, Matrix4x4 transform) {
}
public override void paint(PaintingContext context, Offset offset) {
if (this.child != null) {
context.paintChild(this.child, offset);
}
}
}
{% endmacro %}
{{ RenderProxyBoxMixin('RenderObjectWithChildMixinRenderBox') }}
}

3
Assets/UIWidgets/rendering/proxy_box.mixin.njk.meta


fileFormatVersion: 2
guid: e85e0b7a5a0b4190b7dfaa5821258d91
timeCreated: 1534167051

11
Assets/UIWidgets/rendering/sliver.cs


namespace UIWidgets.rendering {
public class SliverPhysicalParentData : ContainerParentDataMixin<RenderSliver> {
}
public class SliverPhysicalContainerParentData : SliverPhysicalParentData {
}
public abstract class RenderSliver : RenderObject {
}
}

3
Assets/UIWidgets/rendering/sliver.cs.meta


fileFormatVersion: 2
guid: 9bc8ebc37a3f4115806c8bf444ea6aa8
timeCreated: 1533888575

135
Assets/UIWidgets/rendering/viewpoint.cs


using UIWidgets.painting;
using UnityEngine;
using Rect = UIWidgets.ui.Rect;
namespace UIWidgets.rendering {
public interface RenderAbstractViewport {
RevealedOffset getOffsetToReveal(RenderObject target, double alignment, Rect rect = null);
}
public static class RenderAbstractViewportUtils {
public static RenderAbstractViewport of(RenderObject obj) {
while (obj != null) {
if (obj is RenderAbstractViewport)
return (RenderAbstractViewport) obj;
obj = (RenderObject) obj.parent;
}
return null;
}
public const double defaultCacheExtent = 250.0;
}
public class RevealedOffset {
public RevealedOffset(double offset, Rect rect) {
this.offset = offset;
this.rect = rect;
}
public readonly double offset;
public readonly Rect rect;
}
public abstract class RenderViewportBase<ParentDataClass> : ContainerRenderBox<RenderSliver, ParentDataClass>,
RenderAbstractViewport
where ParentDataClass : ContainerParentDataMixin<RenderSliver> {
protected RenderViewportBase(
AxisDirection crossAxisDirection,
ViewportOffset offset,
double cacheExtent = RenderAbstractViewportUtils.defaultCacheExtent,
AxisDirection axisDirection = AxisDirection.down
) {
Debug.Assert(AxisUtils.axisDirectionToAxis(axisDirection) !=
AxisUtils.axisDirectionToAxis(crossAxisDirection));
this._axisDirection = axisDirection;
this._crossAxisDirection = crossAxisDirection;
this._offset = offset;
this._cacheExtent = cacheExtent;
}
public AxisDirection axisDirection {
get { return this._axisDirection; }
set {
if (value == this._axisDirection) {
return;
}
this._axisDirection = value;
this.markNeedsLayout();
}
}
public AxisDirection _axisDirection;
public AxisDirection crossAxisDirection {
get { return this._crossAxisDirection; }
set {
if (value == this._crossAxisDirection) {
return;
}
this._crossAxisDirection = value;
this.markNeedsLayout();
}
}
public AxisDirection _crossAxisDirection;
public Axis axis {
get { return AxisUtils.axisDirectionToAxis(this.axisDirection); }
}
public ViewportOffset offset {
get { return this._offset; }
set {
if (object.Equals(value, this._offset)) {
return;
}
if (this.attached) {
this._offset.removeListener(this.markNeedsLayout);
}
this._offset = value;
if (this.attached) {
this._offset.addListener(this.markNeedsLayout);
}
this.markNeedsLayout();
}
}
public ViewportOffset _offset;
public double cacheExtent {
get { return this._cacheExtent; }
set {
if (value == this._cacheExtent) {
return;
}
this._cacheExtent = value;
this.markNeedsLayout();
}
}
public double _cacheExtent;
public override void attach(object owner) {
base.attach(owner);
this._offset.addListener(this.markNeedsLayout);
}
public override void detach() {
this._offset.removeListener(this.markNeedsLayout);
base.detach();
}
}
public class RenderViewport : RenderViewportBase<SliverPhysicalContainerParentData> {
}
}

3
Assets/UIWidgets/rendering/viewpoint.cs.meta


fileFormatVersion: 2
guid: 50063f63063d49b480c04ad07dee202d
timeCreated: 1533882907

29
Assets/UIWidgets/rendering/viewport_offset.cs


using UIWidgets.foundation;
namespace UIWidgets.rendering {
public enum ScrollDirection {
idle,
forward,
reverse,
}
public abstract class ViewportOffset : ChangeNotifier {
protected ViewportOffset() {
}
public static ViewportOffset @fixed(double value) {
return null;
}
public static ViewportOffset zero() {
return null;
}
public abstract double pixels { get; }
public abstract bool applyViewportDimension(double viewportDimension);
public abstract bool applyContentDimensions(double minScrollExtent, double maxScrollExtent);
public abstract void correctBy(double correction);
public abstract void jumpTo(double pixels);
}
}

3
Assets/UIWidgets/rendering/viewport_offset.cs.meta


fileFormatVersion: 2
guid: 2e503b46edcd498e89fb19c2060fbe2d
timeCreated: 1534050410

15
Assets/UIWidgets/ui/compositing.cs


namespace UIWidgets.ui {
public class SceneBuilder {
public void pushClipRect(Rect rect) {
}
public void pushOpacity(int alpha) {
}
public void pop() {
}
public void addPicture(Offset offset, Picture picture) {
}
}
}

3
Assets/UIWidgets/ui/compositing.cs.meta


fileFormatVersion: 2
guid: 1d8e458df9c1464293490d761d28514a
timeCreated: 1534133020

6
Assets/UIWidgets/ui/text.cs


namespace UIWidgets.ui {
public enum TextBaseline {
alphabetic,
ideographic,
}
}

3
Assets/UIWidgets/ui/text.cs.meta


fileFormatVersion: 2
guid: 677c26ed1782492c9b9e6e95b44093dc
timeCreated: 1534152450

94
scripts/cmds/codegen.js


var path = require('path');
var chalk = require('chalk');
var glob = require("glob");
var fs = require('fs');
var nunjucks = require('nunjucks');
var chokidar = require('chokidar');
exports.command = 'codegen [dir]';
exports.desc = "codegen";
exports.builder = function (yargs) {
return yargs.positional('dir', {
describe: 'the working directory',
type: 'string',
default: '.'
}).option('watch', {
alias: 'w',
describe: 'Watch for file changes',
boolean: true
});
};
exports.handler = function (argv) {
var cwd = path.resolve(__dirname, '../..', argv.dir);
var data = {};
var env = nunjucks.configure(cwd, {
trimBlocks: true,
lstripBlocks: true,
noCache: true
});
glob('**/*.njk', {
strict: true,
cwd: cwd,
ignore: '**/_*.*'
}, function (err, files) {
if (err) {
return console.error(chalk.red(err));
}
renderAll(env, cwd, files, data);
});
if (argv.watch) {
var watcher = chokidar.watch('**/*.njk', {
persistent: true,
cwd: cwd,
awaitWriteFinish: {
stabilityThreshold: 300,
pollInterval: 50
}
});
var layouts = [];
var templates = [];
watcher.on('ready', function () {
console.log(chalk.gray('Watching templates...'));
});
watcher.on('add', function (file) {
if (path.basename(file).indexOf('_') === 0) {
layouts.push(file);
} else {
templates.push(file);
}
});
watcher.on('change', function (file) {
if (layouts.indexOf(file) >= 0) {
renderAll(env, cwd, templates, data);
} else {
render(env, cwd, file, data);
}
});
}
};
function render(env, cwd, file, data) {
env.render(file, data, function (err, res) {
if (err) {
return console.error(chalk.red(err));
}
var outputFile = file.replace(/\.\w+$/, '') + '.gen.cs';
console.log(chalk.blue('Rendering: ' + file));
fs.writeFileSync(path.resolve(cwd, outputFile), res);
});
}
function renderAll(env, cwd, files, data) {
for (var i = 0; i < files.length; i++) {
render(env, cwd, files[i], data);
}
}

73
scripts/gitignore


# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless

16
scripts/package.json


{
"name": "uiwidgets-cli",
"version": "1.0.0",
"description": "cli for uiwidgets",
"main": "uiwidgets-cli.js",
"scripts": {},
"author": "",
"license": "ISC",
"dependencies": {
"chalk": "^2.4.1",
"chokidar": "^2.0.4",
"glob": "^7.1.2",
"nunjucks": "^3.1.3",
"yargs": "^12.0.1"
}
}

7
scripts/uiwidgets-cli.js


#! /usr/bin/env node
require('yargs')
.commandDir('cmds')
.demandCommand()
.help()
.argv;
正在加载...
取消
保存