Daily update on 20221229 by nitload youmu

This commit is contained in:
Nitload
2022-12-30 00:07:56 +08:00
parent 3dbf74d5a3
commit 6c1aec5d8f
35 changed files with 210 additions and 98 deletions
@@ -1,6 +1,7 @@
using OpenTK;
using StgSharp;
using StgSharp.Geometries;
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Data;
@@ -14,34 +15,19 @@ namespace Debug
{
public static void Main()
{
A a=new A();
OperationHandler operationHandler = new OperationHandler(cw);
for (int i = 0; i < 10; i++)
{
operationHandler.Invoke(i);
}
}
}
public class A
{
public static int a = 10;
public int b = 10;
}
static class b
{
public static void change(this A a, int b)
public static void cw(int x)
{
a.b = b;
Console.WriteLine(x);
}
public delegate void OperationHandler(int x);
}
static class c
{
public static void change(this A a, int b)
{
a.b = b++;
}
}
}
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Geometries
namespace StgSharp
{
public delegate void ComplexOperationHandler();
}
@@ -13,16 +13,13 @@ namespace StgSharp.Control
{
static public partial class Create
{
internal static Pool pool;
private static LinkedObject cache;
/// <summary>
/// 创建一个子弹并将其绑定在一个指定的点上
/// </summary>
/// <param name="point">表示子弹坐标的点</param>
public static void Bullet(this Pool pool , Point point)
public static void Bullet(Point point)
{
pool.bulletContainer.Add(new Bullet(point));
TimeLine.pool.bulletContainer.Add(new Bullet(point));
}
/// <summary>
@@ -33,7 +30,7 @@ namespace StgSharp.Control
/// <param name="end">终点序号</param>
public static void Bullet(int begin, int end)
{
cache = pool.pointContainer.Ending;
LinkedObject cache = TimeLine.pool.pointContainer.Ending;
for (int i = 1; i < begin; i++)
{
cache--;
@@ -41,7 +38,7 @@ namespace StgSharp.Control
for (int i = begin; i < end; i++)
{
cache--;
pool.bulletContainer.Add(new Bullet(cache as Point));
TimeLine.pool.bulletContainer.Add(new Bullet(cache as Point));
}
}
@@ -54,7 +51,7 @@ namespace StgSharp.Control
/// <param name="angle"></param>
public static void Bullet(int order,uint count,float angle)
{
cache=pool.pointContainer.Ending;
LinkedObject cache=TimeLine.pool.pointContainer.Ending;
for (int i = 1; i < count; i++)
{
cache--;
@@ -62,8 +59,8 @@ namespace StgSharp.Control
for (uint i = 0; i < count; i++)
{
PointOnCircle p = new PointOnCircle(cache as Circle, angle, i);
pool.pointContainer.Add(p);
pool.bulletContainer.Add(new Bullet(p));
TimeLine.pool.pointContainer.Add(p);
TimeLine.pool.bulletContainer.Add(new Bullet(p));
}
}
@@ -78,10 +75,23 @@ namespace StgSharp.Control
/// <param name="y"></param>
public static void Point(float beginX,float beginY,float angle,float[] x, float[] y)
{
PointCommon p = new PointCommon(beginX, beginY, angle,Pool.tickCounter);
PointCommon p = new PointCommon(beginX, beginY, angle,TimeLine.tickCounter);
p.XVelocity = x;
p.YVelocity = y;
pool.pointContainer.Add(p);
TimeLine.pool.pointContainer.Add(p);
}
/// <summary>
/// 快速创建一个不需要移动的点
/// </summary>
/// <param name="beginX">横坐标</param>
/// <param name="beginY">纵坐标</param>
public static void Point(float beginX, float beginY)
{
Point point = new Point();
point.X = beginX;
point.Y = beginY;
TimeLine.pool.pointContainer.Add(point);
}
/// <summary>
@@ -91,8 +101,8 @@ namespace StgSharp.Control
/// <param name="r"></param>
public static void Circle(Point c, float r)
{
Circle o = new Circle(c,r,Pool.tickCounter);
pool.geometryContainer.Add(o);
Circle o = new Circle(c,r,TimeLine.tickCounter);
TimeLine.pool.geometryContainer.Add(o);
}
/// <summary>
@@ -102,8 +112,8 @@ namespace StgSharp.Control
/// <param name="s"></param>
public static void Circle(Point c, Point s)
{
Circle o = new Circle(c, s,Pool.tickCounter);
pool.geometryContainer.Add(o);
Circle o = new Circle(c, s,TimeLine.tickCounter);
TimeLine.pool.geometryContainer.Add(o);
}
/// <summary>
@@ -114,7 +124,7 @@ namespace StgSharp.Control
public static void Line(Point b, Point e)
{
Line l = new Line(b,e);
pool.geometryContainer.Add(l);
TimeLine.pool.geometryContainer.Add(l);
}
@@ -132,13 +142,13 @@ namespace StgSharp.Control
int length = radiuses.Length;
for (int i = 0; i<length; i++)
{
circle = new Circle(c,radiuses[i],Pool.tickCounter);
circle = new Circle(c,radiuses[i],TimeLine.tickCounter);
float[] f = new float[10];
f[10]=rotateFunc[i];
circle.RadiusFunc = f;
o = new PointOnCircle(circle, angles[i],1);
pool.geometryContainer.Add(circle);
pool.pointContainer.Add(o);
TimeLine.pool.geometryContainer.Add(circle);
TimeLine.pool.pointContainer.Add(o);
}
}
@@ -10,18 +10,12 @@ using System.Threading.Tasks;
namespace StgSharp.Control
{
internal class Get
internal static class Get
{
static Point pointCache;
static Bullet bulletCache;
static Geometry geometryCache;
static Entity enemyCache;
public static Point Point(SelectOperation<Point> operation )
public static Point Point(this Pool pool,SelectOperation<Point> operation )
{
pointCache = Pool.pointContainer.Heading;
Point pointCache = pool.pointContainer.Heading;
for (; pointCache!= null; )
{
if (operation.Invoke(pointCache))
@@ -33,9 +27,15 @@ namespace StgSharp.Control
return null;
}
public static Bullet Bullet(SelectOperation<Bullet> operation)
public static void Point()
{
bulletCache = Pool.bulletContainer.Heading;
}
public static Bullet Bullet(this Pool pool, SelectOperation<Bullet> operation)
{
Bullet bulletCache ;
bulletCache = pool.bulletContainer.Heading;
for (; bulletCache != null; )
{
if (operation.Invoke(bulletCache))
@@ -47,38 +47,41 @@ namespace StgSharp.Control
return bulletCache;
}
public static Circle Circle(SelectOperation<Circle> operation)
public static Circle Circle( this Pool pool, SelectOperation<Circle> operation)
{
geometryCache = Pool.geometryContainer.Heading;
for (; geometryCache != null ; )
Geometry geomCache;
geomCache = pool.geometryContainer.Heading;
for (; geomCache != null ; )
{
if (geometryCache is Circle && operation.Invoke(geometryCache as Circle))
if (geomCache is Circle && operation.Invoke(geomCache as Circle))
{
break;
}
geometryCache++;
geomCache++;
}
return geometryCache as Circle;
return geomCache as Circle;
}
public static Line Line(SelectOperation<Line> operation)
public static Line Line(this Pool pool, SelectOperation<Line> operation)
{
geometryCache= Pool.geometryContainer.Heading;
for (; geometryCache != null ; )
Geometry geomCache;
geomCache= pool.geometryContainer.Heading;
for (; geomCache != null ; )
{
if (geometryCache is Line && operation.Invoke(geometryCache as Line))
if (geomCache is Line && operation.Invoke(geomCache as Line))
{
break;
}
geometryCache++;
geomCache++;
}
return geometryCache as Line;
return geomCache as Line;
}
public static Enemy Enemy(SelectOperation<LinkedObject> operation)
public static Enemy Enemy(this Pool pool, SelectOperation<LinkedObject> operation)
{
enemyCache= Pool.entityContainer.Heading ;
Entity enemyCache;
enemyCache= pool.entityContainer.Heading ;
for (; enemyCache != null ; )
{
if (enemyCache is Enemy && operation.Invoke(enemyCache as Enemy ))
@@ -90,6 +93,5 @@ namespace StgSharp.Control
return enemyCache as Enemy;
}
}
}
@@ -1 +0,0 @@
20221029未完成:内置的池初始化与控制
@@ -0,0 +1,33 @@
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Control
{
public static class TimeLine
{
public static Pool pool;
public static List<Pool> poolList;
public static ComplexOperationHandler complexOperationHandler;
public static Counter<uint> tickCounter;
public static void OnRender()
{
foreach (Pool pool in poolList)
{
TimeLine.pool = pool;
complexOperationHandler.Invoke();
}
}
}
}
@@ -19,10 +19,6 @@ namespace StgSharp.Geometries
set { _center = value; }
}
public event ComplexOperationHandler ComplexOperation;
public FreeCurve(Point c, float[] x, float[] y)
{
if (x.Length==10)
@@ -13,7 +13,8 @@ namespace StgSharp.Geometries
internal float _y;
internal float _angle;
internal float vX;
internal float vY;
public float X
{
@@ -14,8 +14,6 @@ namespace StgSharp.Logic
public class Pool
{
public Player player;
public static Counter<uint> tickCounter
= new Counter<uint>();
internal static Counter<uint> collectCounter
=new Counter<uint>();
@@ -28,10 +26,10 @@ namespace StgSharp.Logic
internal Logic.LinkedList<LinkedObject> rightCollector
=new Logic.LinkedList<LinkedObject>(collectCounter);
public float leftBoarder;
public float rightBoarder;
public float topBoarder;
public float bottomBoarder;
public Reflector leftBoarder;
public Reflector rightBoarder;
public Reflector topBoarder;
public Reflector bottomBoarder;
internal Bullet bulletCache;
internal static Counter<uint> bulletCounter
@@ -62,14 +60,6 @@ namespace StgSharp.Logic
}
public void OnRender()
{
}
}
@@ -0,0 +1,70 @@
using StgSharp.Control;
using StgSharp.Entities;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Logic
{
public class Reflector
{
internal Point _begin;
public Point Begin
{
get { return _begin; }
}
internal float vecX;
internal float vecY;
/// <summary>
/// 反射器是一个直线形无纹理实体,
/// 与反射器发生碰撞的实体将被执行对应的操作。
/// 反射器可以通过起点坐标和方向矢量定义。
/// </summary>
/// <param name="beginX">起点横坐标</param>
/// <param name="beginY">起点纵坐标</param>
/// <param name="vecX">方向矢量X分量</param>
/// <param name="vecY">方向矢量Y分量</param>
public Reflector(float beginX, float beginY,float vecX,float vecY)
{
Control.Create.Point(beginX,beginY);
this._begin = TimeLine.pool.pointContainer.Ending;
this.vecX = vecX;
this.vecY = vecY;
}
public Reflector(Point begin, Point end)
{
_begin = begin;
vecX = end.X;
vecY = end.Y;
}
/// <summary>
/// 检查某个点穿过反射器的方向,
/// 以反射器正方向向上时定义
/// </summary>
/// <param name="point">被检查的点</param>
/// <returns></returns>
public bool IsPointLeft(Point point)
{
return
vecX * point.vY+vecY*point.vX>0;
}
/// <summary>
/// 检测
/// </summary>
/// <param name="bullet"></param>
/// <returns></returns>
public bool? IsBulletLeft(Bullet bullet)
{
}
}
}
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Stg_Sharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Nitload_Space")]
[assembly: AssemblyProduct("Stg_Sharp")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyCopyright("Copyright © Nitload_Space 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -46,9 +46,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Control\Change.cs" />
<Compile Include="Control\TimeLine.cs" />
<Compile Include="Control\SelectOperation.cs" />
<Compile Include="Control\Get.cs" />
<Compile Include="Control\Set.cs" />
<Compile Include="Logic\Reflector.cs" />
<Compile Include="Logic\Pool.cs" />
<Compile Include="Control\Create.cs" />
<Compile Include="Entities\RenderedGeometry.cs" />
@@ -56,7 +58,7 @@
<Compile Include="Entities\Reward.cs" />
<Compile Include="Entities\Enemy.cs" />
<Compile Include="Game\CoreInfo.cs" />
<Compile Include="Geometries\ComplexOperationHandler.cs" />
<Compile Include="ComplexOperationHandler.cs" />
<Compile Include="Geometries\Geometry.cs" />
<Compile Include="Geometries\FreeCurve.cs" />
<Compile Include="Geometries\Point.cs" />
@@ -73,11 +75,11 @@
<Compile Include="Logic\LinkedList.cs" />
<Compile Include="Logic\LinkedObject.cs" />
<Compile Include="UI\BattleField.cs" />
<Compile Include="UI\Background.cs" />
<Compile Include="UI\SelectEventHandler.cs" />
<Compile Include="UI\Option.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Control\TextFile1.txt" />
<Content Include="TextFile1.txt" />
</ItemGroup>
<ItemGroup>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
@@ -0,0 +1,14 @@
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.UI
{
public class Background
{
}
}
@@ -39,7 +39,10 @@ namespace StgSharp.UI
get { return _bottomBoarder; }
}
public BattleField()
{
pool = new Pool();
}
}
}
@@ -1 +1 @@
78a3e5543c41d207f29c2854071e8291080d2b4f
cae813d95901df120cf6341acd23090873717337