浏览代码

move mixin code

/imageFlow
siyao 3 年前
当前提交
71b41b4d
共有 7 个文件被更改,包括 316 次插入0 次删除
  1. 11
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs
  2. 3
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs.meta
  3. 142
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs
  4. 11
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs.meta
  5. 146
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk
  6. 3
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk.meta

11
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs


using System;
public interface TileContainerRenderObjectMixin<ChildType, ParentDataType> {
void forEachChild(Action<ChildType> f);
void remove(int index);
void _removeChild(ChildType child);
void removeAll();
}

3
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs.meta


fileFormatVersion: 2
guid: 3af8956ed28744b899a62e3b21778d83
timeCreated: 1626685582

142
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.external;
public abstract class TileContainerRenderObjectMixinRenderSliver<ChildType, ParentDataType>: RenderSliver, TileContainerRenderObjectMixin<ChildType, ParentDataType>
where ChildType : RenderObject
where ParentDataType : ParentData
{
// need to make SplayTree public
SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>();
/// The number of children.
protected int childCount
{
get => _childRenderObjects.Count;
}
protected ICollection<ChildType> children
{
get => _childRenderObjects.Values;
}
protected ICollection<int> indices
{
get => _childRenderObjects.Keys;
}
/// Checks whether the given render object has the correct [runtimeType] to be
/// a child of this render object.
///
/// Does nothing if assertions are disabled.
///
/// Always returns true.
public bool debugValidateChild(RenderObject child)
{
D.assert(() =>
{
if (!(child is ChildType))
{
throw new UIWidgetsError(
"A $runtimeType expected a child of type $ChildType but received a " +
"child of type ${child.runtimeType}.\n" +
"RenderObjects expect specific types of children because they " +
"coordinate with their children during layout and paint. For " +
"example, a RenderSliver cannot be the child of a RenderBox because " +
"a RenderSliver does not understand the RenderBox layout protocol.\n" +
"\n" +
"The $runtimeType that expected a $ChildType child was created by:\n" +
" $debugCreator\n" +
"\n" +
"The ${child.runtimeType} that did not match the expected child type " +
"was created by:\n" +
" ${child.debugCreator}\n");
}
return true;
});
return true;
}
public ChildType this[int index] {
get { return _childRenderObjects.ContainsKey(index) ? _childRenderObjects[index] : null; }
set
{
if (index < 0)
{
throw new ArgumentException($"index {index}");
}
_removeChild(_childRenderObjects.getOrDefault(index, null));
adoptChild(value);
_childRenderObjects[index] = value;
}
}
public virtual void forEachChild(Action<ChildType> f)
{
_childRenderObjects.Values.ToList().ForEach(f);
}
/// Remove the child at the specified index from the child list.
public virtual void remove(int index)
{
var child = _childRenderObjects[index];
_childRenderObjects.Remove(index);
_removeChild(child);
}
public virtual void _removeChild(ChildType child)
{
if (child != null)
{
// Remove the old child.
dropChild(child);
}
}
/// Remove all their children from this render object's child list.
///
/// More efficient than removing them individually.
public virtual void removeAll()
{
_childRenderObjects.Values.ToList().ForEach(dropChild);
_childRenderObjects.Clear();
}
public override void attach(object owner)
{
base.attach(owner);
_childRenderObjects.Values.ToList().ForEach((child) => child.attach(owner));
}
public override void detach()
{
base.detach();
_childRenderObjects.Values.ToList().ForEach((child) => child.detach());
}
public override void redepthChildren()
{
_childRenderObjects.Values.ToList().ForEach(redepthChild);
}
public override void visitChildren(RenderObjectVisitor visitor)
{
_childRenderObjects.Values.ToList().ForEach(r => visitor(r));
}
public override List<DiagnosticsNode> debugDescribeChildren()
{
List<DiagnosticsNode> children = new List<DiagnosticsNode>();
_childRenderObjects.ToList().ForEach(pair =>
children.Add(pair.Value.toDiagnosticsNode(name: $"child {pair.Key}")));
return children;
}
}

11
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs.meta


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

146
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.external;
{% macro TileContainerRenderObjectMixin(with) %}
public abstract class TileContainerRenderObjectMixin{{with}}<ChildType, ParentDataType>: {{with}}, TileContainerRenderObjectMixin<ChildType, ParentDataType>
where ChildType : RenderObject
where ParentDataType : ParentData
{
// need to make SplayTree public
SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>();
/// The number of children.
protected int childCount
{
get => _childRenderObjects.Count;
}
protected ICollection<ChildType> children
{
get => _childRenderObjects.Values;
}
protected ICollection<int> indices
{
get => _childRenderObjects.Keys;
}
/// Checks whether the given render object has the correct [runtimeType] to be
/// a child of this render object.
///
/// Does nothing if assertions are disabled.
///
/// Always returns true.
public bool debugValidateChild(RenderObject child)
{
D.assert(() =>
{
if (!(child is ChildType))
{
throw new UIWidgetsError(
"A $runtimeType expected a child of type $ChildType but received a " +
"child of type ${child.runtimeType}.\n" +
"RenderObjects expect specific types of children because they " +
"coordinate with their children during layout and paint. For " +
"example, a RenderSliver cannot be the child of a RenderBox because " +
"a RenderSliver does not understand the RenderBox layout protocol.\n" +
"\n" +
"The $runtimeType that expected a $ChildType child was created by:\n" +
" $debugCreator\n" +
"\n" +
"The ${child.runtimeType} that did not match the expected child type " +
"was created by:\n" +
" ${child.debugCreator}\n");
}
return true;
});
return true;
}
public ChildType this[int index]
{
get => _childRenderObjects[index];
set
{
if (index < 0)
{
throw new ArgumentException($"index {index}");
}
_removeChild(_childRenderObjects.getOrDefault(index, null));
adoptChild(value);
_childRenderObjects[index] = value;
}
}
public virtual void forEachChild(Action<ChildType> f)
{
_childRenderObjects.Values.ToList().ForEach(f);
}
/// Remove the child at the specified index from the child list.
public virtual void remove(int index)
{
var child = _childRenderObjects[index];
_childRenderObjects.Remove(index);
_removeChild(child);
}
public virtual void _removeChild(ChildType child)
{
if (child != null)
{
// Remove the old child.
dropChild(child);
}
}
/// Remove all their children from this render object's child list.
///
/// More efficient than removing them individually.
public virtual void removeAll()
{
_childRenderObjects.Values.ToList().ForEach(dropChild);
_childRenderObjects.Clear();
}
public override void attach(object owner)
{
base.attach(owner);
_childRenderObjects.Values.ToList().ForEach((child) => child.attach(owner));
}
public override void detach()
{
base.detach();
_childRenderObjects.Values.ToList().ForEach((child) => child.detach());
}
public override void redepthChildren()
{
_childRenderObjects.Values.ToList().ForEach(redepthChild);
}
public override void visitChildren(RenderObjectVisitor visitor)
{
_childRenderObjects.Values.ToList().ForEach(r => visitor(r));
}
public override List<DiagnosticsNode> debugDescribeChildren()
{
List<DiagnosticsNode> children = new List<DiagnosticsNode>();
_childRenderObjects.ToList().ForEach(pair =>
children.Add(pair.Value.toDiagnosticsNode(name: $"child {pair.Key}")));
return children;
}
}
{% endmacro %}
{{ TileContainerRenderObjectMixin('RenderSliver') }}

3
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk.meta


fileFormatVersion: 2
guid: cdbbb536a55f4d5da396f06ce06aa5b8
timeCreated: 1626681945
正在加载...
取消
保存