浏览代码

pathpath pathpoint => PoolItem

/main
xingwei.zhu 5 年前
当前提交
638f7d4d
共有 1 个文件被更改,包括 62 次插入16 次删除
  1. 78
      Runtime/ui/utils/basic_types/path.cs

78
Runtime/ui/utils/basic_types/path.cs


innerBevel = 0x08,
}
class uiPathPoint {
class uiPathPoint : PoolItem {
public static uiPathPoint create(float x = 0, float y = 0, float dx = 0, float dy = 0, float len = 0,
float dmx = 0, float dmy = 0,
uiPointFlags flags = uiPointFlags.corner) {
uiPathPoint newPoint = ItemPoolManager.alloc<uiPathPoint>();
newPoint.x = x;
newPoint.y = y;
newPoint.dx = dx;
newPoint.dy = dy;
newPoint.len = len;
newPoint.dmx = dmx;
newPoint.dmy = dmy;
newPoint.flags = flags;
return newPoint;
}
public uiPathPoint() {
}
class uiPathPath {
class uiPathPath : PoolItem {
public int first;
public int count;
public bool closed;

public int nstroke;
public uiPathWinding winding;
public bool convex;
public static uiPathPath create(int first = 0, int count = 0, bool closed = false, int ifill = 0, int nfill = 0,
int istroke = 0,
int nstroke = 0, uiPathWinding winding = uiPathWinding.counterClockwise, bool convex = false) {
uiPathPath newPath = ItemPoolManager.alloc<uiPathPath>();
newPath.first = first;
newPath.count = count;
newPath.closed = closed;
newPath.ifill = ifill;
newPath.nfill = nfill;
newPath.istroke = istroke;
newPath.nstroke = nstroke;
newPath.winding = winding;
newPath.convex = convex;
return newPath;
}
public uiPathPath() {
}
}
class uiPathCache : PoolItem {

}
public override void clear() {
foreach (var path in this._paths) {
path.dispose();
}
foreach (var point in this._points) {
point.dispose();
}
this._paths.Clear();
this._points.Clear();
}

}
public void addPath() {
this._paths.Add(new uiPathPath {
first = this._points.Count,
winding = uiPathWinding.counterClockwise
});
this._paths.Add(uiPathPath.create(
first : this._points.Count,
winding : uiPathWinding.counterClockwise
));
this._addPoint(new uiPathPoint {x = x, y = y, flags = flags});
this._addPoint(uiPathPoint.create(x : x, y : y, flags : flags));
}
void _addPoint(uiPathPoint point) {

for (int i = 0; i < points.Count; i++) {
var point = points[i];
if (i == points.Count - 1) {
this._addPoint(new uiPathPoint {
x = point.x + x1,
y = point.y + y1,
flags = flags,
});
this._addPoint(uiPathPoint.create(
x : point.x + x1,
y : point.y + y1,
flags : flags
));
this._addPoint(new uiPathPoint {
x = point.x + x1,
y = point.y + y1,
});
this._addPoint(uiPathPoint.create(
x : point.x + x1,
y : point.y + y1
));
}
}
}

正在加载...
取消
保存