daily update on 20230111 by nitload youmu

This commit is contained in:
Nitload
2023-01-12 00:33:20 +08:00
parent 6dfc2f8d70
commit e9116ca11b
47 changed files with 190 additions and 98 deletions
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -8,7 +8,7 @@ namespace StgSharp.Control
{
public static class Add
{
public static void Point(IGeometry geometry)
public static void Point(IGeometrySimple geometry)
{
Point p = new Point();
p.getXHandler += geometry.SetArrayX;
+3 -3
View File
@@ -10,11 +10,11 @@ namespace StgSharp.Control
{
public static void Point(Point p)
{
Logic.LinkedListNode<INode> _cache = p.ID;
Logic.ContainerNode<INode> _cache = p.ID;
_cache.Previous.Next=_cache.Next;
_cache.Next.Previous = _cache.Previous;
_cache.Next = default(Logic.LinkedListNode<INode>);
_cache.Previous = default(Logic.LinkedListNode<INode>);
_cache.Next = default(Logic.ContainerNode<INode>);
_cache.Previous = default(Logic.ContainerNode<INode>);
}
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ namespace StgSharp.Entities
{
public interface IEntity:INode
{
public IGeometry CollisionShape { get; set; }
public IGeometrySimple CollisionShape { get; set; }
public Sensor CollisionSensor { get; set; }
+5 -8
View File
@@ -6,9 +6,9 @@ using System.Text;
namespace StgSharp.Geometries
{
public class Circle : IGeometry
public class Circle : IGeometrySimple
{
private Logic.LinkedListNode<INode> _id;
private Logic.ContainerNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
@@ -18,20 +18,17 @@ namespace StgSharp.Geometries
get { return _referencePoint; }
}
public float vecX
public float VecX
{
get { return _vecX; }
}
public float vecY
public float VecY
{
get { return _vecY; }
}
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
public float SetArrayX(Counter<uint> tickCounter)
{
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public interface IGeometryComplex
{
}
}
@@ -7,14 +7,19 @@ namespace StgSharp.Geometries
{
public interface IGeometry:INode
public interface IGeometrySimple:INode
{
public Point ReferencePoint
{
get;
}
public float vecX
public float VecX
{
get;
}
public float VecY
{
get;
}
+5 -8
View File
@@ -6,9 +6,10 @@ using System.Text;
namespace StgSharp.Geometries
{
public class Line:IGeometry
public class Line:IGeometrySimple
{
private Logic.LinkedListNode<INode> _id;
private Logic.ContainerNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
@@ -18,20 +19,16 @@ namespace StgSharp.Geometries
get { return _referencePoint; }
}
public float vecX
public float VecX
{
get { return _vecX; }
}
internal float vecY
public float VecY
{
get { return _vecY; }
}
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
public Line( Point referencePoint, float vecX, float vecY)
{
@@ -5,10 +5,31 @@ using System.Text;
namespace StgSharp.Geometries
{
public class Rectangle
public class Rectangle:IGeometryComplex
{
internal Point _vertex;
internal float _vecX1;
internal float _vecX2;
internal float _vecY1;
internal float _vecY2;
public Rectangle( Line side1, Line side2 )
{
_vecX1 = side1.VecX;
_vecX2 = side2.VecX;
_vecY1 = side1.VecY;
_vecY2 = side2.VecY;
if (_vecX1 * _vecX2 + _vecY1 * _vecY2 !=0 )
{
throw new ArgumentException("Given lines cannot form a rectangle!");
}
}
}
}
+13 -9
View File
@@ -5,33 +5,35 @@ using System.Text;
namespace StgSharp.Geometries
{
public class Square:IGeometry
public class Square:IGeometrySimple
{
private Logic.LinkedListNode<INode> _id;
private readonly Logic.ContainerNode<INode> _id;
internal Point _referrencePoint;
public float _vecX;
public float _vecY;
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
public Point ReferencePoint
{
get { return _referrencePoint; }
}
public float vecX
public float VecX
{
get { return _vecX; }
}
public float vecY
public float VecY
{
get { return _vecY; }
get
{
return _vecY;
}
}
public float SetArrayX(Counter<uint> tickCounter)
{
return 0.0f;
@@ -41,5 +43,7 @@ namespace StgSharp.Geometries
{
return 0.0f;
}
}
}
+5 -9
View File
@@ -12,15 +12,13 @@ namespace StgSharp.Geometries
{
public class Point: INode
{
private Logic.LinkedListNode<INode> _id;
private Logic.ContainerNode<Point> _id;
internal float x;
internal float y;
internal float _x;
internal float _y;
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
public GetLocationHandler getXHandler;
public GetLocationHandler getYHandler;
public float X
{
@@ -37,8 +35,6 @@ namespace StgSharp.Geometries
}
}
public GetLocationHandler getXHandler;
public GetLocationHandler getYHandler;
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public class ContainerNode<T> where T : INode
{
internal readonly T _this;
internal ContainerNode<T> _previous;
internal ContainerNode<T> _next;
internal ContainerNode<T> _side;
public virtual ContainerNode<T> Previous
{
get { return _previous; }
set { _previous = value; }
}
public ContainerNode<T> Next
{
get { return _next; }
set { _next = value; }
}
public ContainerNode<T> Side
{
get { return _side; }
set { _side = value; }
}
public T Value
{
get { return _this; }
}
public ContainerNode(T t)
{
_this = t;
}
}
}
+1
View File
@@ -45,6 +45,7 @@ namespace StgSharp.Logic
case TypeCode.UInt64:
break;
default:
throw new ArgumentException("Input is not number value type");
break;
}
_defualtValue = defualtValue;
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public class Dictionary<T> where T : Enum ,INode
{
internal ContainerNode<T> _indexHead;
internal ContainerNode<T> _indexTail;
}
}
+2 -4
View File
@@ -6,9 +6,7 @@ namespace StgSharp.Logic
{
public interface INode
{
public LinkedListNode<INode> ID
{
get ;
}
}
}
+9 -9
View File
@@ -6,33 +6,33 @@ namespace StgSharp.Logic
{
public class LinkedList<T> where T: INode
{
private LinkedListNode<T> _head;
private LinkedListNode<T> _tail;
internal ContainerNode<T> _head;
internal ContainerNode<T> _tail;
private LinkedListNode<T> _cache;
private ContainerNode<T> _cache;
public T Head
{
get { return _head._this; }
set { _head = new LinkedListNode<T>(value); }
set { _head = new ContainerNode<T>(value); }
}
public T Tail
{
get { return _tail._this; }
set { _tail = new LinkedListNode<T>(value); }
set { _tail = new ContainerNode<T>(value); }
}
public void Add(T t)
{
if (_head != default(LinkedListNode<T>))
if (_head != default(ContainerNode<T>))
{
Head = t;
}
else
{
_cache = new LinkedListNode<T>(t);
_cache = new ContainerNode<T>(t);
_tail._next = _cache;
_cache._previous = _tail;
_tail = _cache;
@@ -41,7 +41,7 @@ namespace StgSharp.Logic
public void RemoveTail()
{
if (_tail==default(LinkedListNode<T>))
if (_tail==default(ContainerNode<T>))
{
}
@@ -49,7 +49,7 @@ namespace StgSharp.Logic
{
_cache = _tail;
_tail = _cache._previous;
_cache._previous = default(LinkedListNode<T>);
_cache._previous = default(ContainerNode<T>);
}
}
@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public class LinkedListNode<T> where T : INode
{
internal readonly T _this;
internal LinkedListNode<T> _previous;
internal LinkedListNode<T> _next;
public virtual LinkedListNode<T> Previous
{
get { return _previous; }
set { _previous = value; }
}
public LinkedListNode<T> Next
{
get { return _next; }
set { _next = value; }
}
public LinkedListNode(T t)
{
_this = t;
}
}
}
+21 -5
View File
@@ -1,7 +1,9 @@
using StgSharp.Geometries;
using StgSharp.Control;
using StgSharp.Geometries;
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Text;
namespace StgSharp.Logic
@@ -9,17 +11,31 @@ namespace StgSharp.Logic
public class Pool
{
public LinkedList<Point> pointContainer;
public LinkedList<IGeometry> geometryContainer;
public LinkedList<IGeometrySimple> geometryContainer;
public LinkedList<Sensor> sensorContainer;
public Line leftBoader;
public Line rightBoader;
public Line topBoader;
public Line bottomBoader;
public void OnRender()
{
ContainerNode<Point> idCache = pointContainer._head;
Point p;
do
{
p = idCache._this;
p._x = p.getXHandler.Invoke(TimeLine.tickCounter);
p._y = p.getYHandler.Invoke(TimeLine.tickCounter);
idCache = idCache._next;
} while (idCache != default(ContainerNode<Point>));
}
}
}
+3 -5
View File
@@ -6,11 +6,9 @@ namespace StgSharp.Logic
{
public class Sensor : INode
{
private LinkedListNode<INode> _id;
private ContainerNode<Sensor> _id;
LinkedListNode<INode> INode.ID
{
get { return _id; }
}
}
}
+21
View File
@@ -15,6 +15,25 @@ internal class Program
a01 += asd.cwb;
a01.Invoke();
a02.Invoke();
a fff = new a();
fff._a = 10;
a ggg = fff;
fff._a = 15;
Console.WriteLine(ggg._a);
Point p = new Point();
Point p2 = new Point();
StgSharp.Logic.ContainerNode<Point> pC = new StgSharp.Logic.ContainerNode<Point>(p);
StgSharp.Logic.ContainerNode<Point> pC02 = new StgSharp.Logic.ContainerNode<Point>(p2);
pC.Next=pC02;
}
public delegate void ase();
@@ -24,6 +43,8 @@ internal class Program
class a
{
public int _a;
public void cwc()
{
Console.WriteLine("c");