Daily update on 20221029 by Nitload Youmu
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Pool;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -8,29 +9,25 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
public abstract class Pool
|
||||
public static class Pool
|
||||
{
|
||||
private LinkedList _pool01;
|
||||
private LinkedList _pool02;
|
||||
private LinkedList _pool03;
|
||||
private LinkedList _pool04;
|
||||
internal static IPool topCollector;
|
||||
|
||||
internal static IPool pointPool
|
||||
= new PointPool();
|
||||
|
||||
public Pool()
|
||||
internal static IPool bulletPool
|
||||
= new BulletPool();
|
||||
|
||||
static Pool()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Creat()
|
||||
public static void Creat()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StgSharp.Pool;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -16,11 +17,16 @@ namespace StgSharp.Logic
|
||||
|
||||
float BottomBorder { get; set; }
|
||||
|
||||
|
||||
int Limit { get; set; }
|
||||
|
||||
IContainer Top { get; set; }
|
||||
|
||||
IContainer Bottom { get; set; }
|
||||
|
||||
IContainer Left { get; set; }
|
||||
|
||||
IContainer Right { get; set; }
|
||||
|
||||
void Add(LinkedObject o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace StgSharp.Logic
|
||||
{
|
||||
public class LinkedList
|
||||
{
|
||||
protected LinkedObject _heading;
|
||||
protected LinkedObject _heading = null;
|
||||
protected LinkedObject _ending;
|
||||
private LinkedObject _cache;
|
||||
private Counter<uint> _amountCounter;
|
||||
protected LinkedObject _cache;
|
||||
protected Counter<uint> _amountCounter;
|
||||
|
||||
public LinkedObject Heading
|
||||
{
|
||||
@@ -40,7 +40,6 @@ namespace StgSharp.Logic
|
||||
{
|
||||
this._amountCounter = new Counter<uint>();
|
||||
_amountCounter.Value = 0;
|
||||
_ending = null;
|
||||
_heading = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ namespace StgSharp.Logic
|
||||
get { return _previous; }
|
||||
set
|
||||
{
|
||||
if (value.GetType() == this.GetType())
|
||||
{
|
||||
_previous = value;
|
||||
}
|
||||
_previous = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
using StgSharp.Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Pool
|
||||
{
|
||||
internal class BulletPool:IPool
|
||||
{
|
||||
|
||||
internal static IContainer _topCollector;
|
||||
internal static IContainer _bottomCollector;
|
||||
internal static IContainer _leftCollector;
|
||||
internal static IContainer _rightCollector;
|
||||
|
||||
public IContainer TopCollector
|
||||
{
|
||||
get { return _topCollector; }
|
||||
}
|
||||
|
||||
public IContainer BottomCollector
|
||||
{
|
||||
get { return _bottomCollector; }
|
||||
}
|
||||
|
||||
public IContainer LeftCollector
|
||||
{
|
||||
get { return _leftCollector; }
|
||||
}
|
||||
|
||||
public IContainer RightCollector
|
||||
{
|
||||
get { return _rightCollector; }
|
||||
}
|
||||
|
||||
static IContainer mainContainer00;
|
||||
static IContainer mainContainer01;
|
||||
static IContainer mainContainer02;
|
||||
static IContainer mainContainer10;
|
||||
static IContainer mainContainer11;
|
||||
static IContainer mainContainer12;
|
||||
static IContainer mainContainer20;
|
||||
static IContainer mainContainer21;
|
||||
static IContainer mainContainer22;
|
||||
static IContainer mainContainer30;
|
||||
static IContainer mainContainer31;
|
||||
static IContainer mainContainer32;
|
||||
|
||||
|
||||
static BulletPool()
|
||||
{
|
||||
mainContainer00 = new EntityContainer(1000,400,-600,-150);
|
||||
|
||||
mainContainer01 = new EntityContainer(1000,400,-150,150);
|
||||
|
||||
mainContainer02 = new EntityContainer(1000,400,150,600);
|
||||
|
||||
mainContainer10 = new EntityContainer(400,0,-600,-150);
|
||||
|
||||
mainContainer11 = new EntityContainer(400,0,-150,150);
|
||||
|
||||
mainContainer12 = new EntityContainer(400,0,150,600);
|
||||
|
||||
mainContainer20 = new EntityContainer(0,-400,-600,-150);
|
||||
|
||||
mainContainer21 = new EntityContainer(0,-400,-150,150);
|
||||
|
||||
mainContainer22 = new EntityContainer(0,-400,150,600);
|
||||
|
||||
mainContainer30 = new EntityContainer(-400,-1000,-600,-150);
|
||||
|
||||
mainContainer31 = new EntityContainer(-400,-1000,-150,150);
|
||||
|
||||
mainContainer32 = new EntityContainer(-400,-1000,150,600);
|
||||
|
||||
mainContainer00.Top = _topCollector;
|
||||
mainContainer00.Bottom = mainContainer10;
|
||||
mainContainer00.Left = _leftCollector;
|
||||
mainContainer00.Right = mainContainer01;
|
||||
|
||||
mainContainer01.Top = _topCollector;
|
||||
mainContainer01.Bottom = mainContainer11;
|
||||
mainContainer01.Left = mainContainer00;
|
||||
mainContainer01.Right = mainContainer02;
|
||||
|
||||
mainContainer02.Top = _topCollector;
|
||||
mainContainer02.Bottom = mainContainer12;
|
||||
mainContainer02.Left = mainContainer01;
|
||||
mainContainer02.Right = _rightCollector;
|
||||
|
||||
mainContainer10.Top = mainContainer00;
|
||||
mainContainer10.Bottom = mainContainer20;
|
||||
mainContainer10.Left = _leftCollector;
|
||||
mainContainer10.Right = mainContainer11;
|
||||
|
||||
mainContainer11.Top = mainContainer01;
|
||||
mainContainer11.Bottom = mainContainer21;
|
||||
mainContainer11.Left = mainContainer10;
|
||||
mainContainer11.Right = mainContainer12;
|
||||
|
||||
mainContainer12.Top = mainContainer02;
|
||||
mainContainer12.Bottom = mainContainer22;
|
||||
mainContainer12.Left = mainContainer11;
|
||||
mainContainer12.Right = _rightCollector;
|
||||
|
||||
mainContainer20.Top = mainContainer10;
|
||||
mainContainer20.Bottom = mainContainer30;
|
||||
mainContainer20.Left=_leftCollector;
|
||||
mainContainer20.Right = mainContainer21;
|
||||
|
||||
mainContainer21.Top = mainContainer11;
|
||||
mainContainer21.Bottom = mainContainer31;
|
||||
mainContainer21.Left = mainContainer20;
|
||||
mainContainer21.Right = mainContainer22;
|
||||
|
||||
mainContainer22.Top = mainContainer12;
|
||||
mainContainer22.Bottom = mainContainer32;
|
||||
mainContainer22.Left = mainContainer21;
|
||||
mainContainer22.Right = _rightCollector;
|
||||
|
||||
mainContainer30.Top = mainContainer20;
|
||||
mainContainer30.Bottom = _bottomCollector;
|
||||
mainContainer30.Left = _leftCollector;
|
||||
mainContainer30.Right = mainContainer31;
|
||||
|
||||
mainContainer31.Top = mainContainer21;
|
||||
mainContainer31.Bottom = _bottomCollector;
|
||||
mainContainer31.Left = mainContainer30;
|
||||
mainContainer31.Right = mainContainer32;
|
||||
|
||||
mainContainer32.Top = mainContainer22;
|
||||
mainContainer32.Bottom = _bottomCollector;
|
||||
mainContainer32.Left = mainContainer31;
|
||||
mainContainer32.Right=_rightCollector;
|
||||
|
||||
}
|
||||
|
||||
public static void OnRender()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
-11
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -8,17 +9,13 @@ namespace StgSharp.Logic
|
||||
{
|
||||
internal class EntityContainer:LinkedList,IContainer
|
||||
{
|
||||
|
||||
private int _limit;
|
||||
private float _leftBorder;
|
||||
private float _rightBorder;
|
||||
private float _topBorder;
|
||||
private float _bottomBorder;
|
||||
|
||||
private EntityContainer left;
|
||||
private EntityContainer right;
|
||||
private EntityContainer top;
|
||||
private EntityContainer bottom;
|
||||
|
||||
public int Limit
|
||||
{
|
||||
get { return _limit; }
|
||||
@@ -46,37 +43,69 @@ namespace StgSharp.Logic
|
||||
set { _bottomBorder = value; }
|
||||
}
|
||||
|
||||
public EntityContainer()
|
||||
{
|
||||
public static IContainer _top;
|
||||
public static IContainer _bottom;
|
||||
public static IContainer _left;
|
||||
public static IContainer _right;
|
||||
|
||||
public IContainer Top
|
||||
{
|
||||
get { return _top; }
|
||||
set { }
|
||||
}
|
||||
public IContainer Bottom
|
||||
{
|
||||
get { return _bottom; }
|
||||
set { }
|
||||
}
|
||||
public IContainer Left
|
||||
{
|
||||
get { return _left; }
|
||||
set { }
|
||||
}
|
||||
public IContainer Right
|
||||
{
|
||||
get { return _right; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public EntityContainer(float top,float bottom,float left,float right)
|
||||
{
|
||||
_topBorder = top;
|
||||
_bottomBorder = bottom;
|
||||
_leftBorder = left;
|
||||
_rightBorder = right;
|
||||
this._amountCounter = new Counter<uint>();
|
||||
_amountCounter.Value = 0;
|
||||
_heading = null;
|
||||
}
|
||||
|
||||
public void MoveLeft(LinkedObject target)
|
||||
{
|
||||
target.Previous = target.Next;
|
||||
target.Next = target.Previous;
|
||||
left.Add(target);
|
||||
_left.Add(target);
|
||||
}
|
||||
|
||||
public void MoveRight(LinkedObject target)
|
||||
{
|
||||
target.Previous = target.Next;
|
||||
target.Next = target.Previous;
|
||||
right.Add(target);
|
||||
_right.Add(target);
|
||||
}
|
||||
|
||||
public void MoveUp(LinkedObject target)
|
||||
{
|
||||
target.Previous = target.Next;
|
||||
target.Next = target.Previous;
|
||||
top.Add(target);
|
||||
_top.Add(target);
|
||||
}
|
||||
|
||||
public void Movebottom(LinkedObject target)
|
||||
{
|
||||
target.Previous = target.Next;
|
||||
target.Next = target.Previous;
|
||||
bottom.Add(target);
|
||||
_bottom.Add(target);
|
||||
}
|
||||
|
||||
//What should a container do on each rendering frame
|
||||
+31
@@ -45,6 +45,37 @@ namespace StgSharp.Logic
|
||||
|
||||
private int _limit;
|
||||
|
||||
|
||||
private IContainer _top;
|
||||
private IContainer _bottom;
|
||||
private IContainer _left;
|
||||
private IContainer _right;
|
||||
|
||||
|
||||
public IContainer Top
|
||||
{
|
||||
get { return _top; }
|
||||
set { _top = value; }
|
||||
}
|
||||
|
||||
public IContainer Left
|
||||
{
|
||||
get { return _left; }
|
||||
set { _left = value; }
|
||||
}
|
||||
|
||||
public IContainer Right
|
||||
{
|
||||
get { return _right; }
|
||||
set { _right = value; }
|
||||
}
|
||||
|
||||
public IContainer Bottom
|
||||
{
|
||||
get { return _bottom; }
|
||||
set { _bottom = value; }
|
||||
}
|
||||
|
||||
public int Limit
|
||||
{
|
||||
get { return _limit; }
|
||||
@@ -7,85 +7,38 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Pool
|
||||
{
|
||||
public class PointPool:IPool
|
||||
internal class PointPool : IPool
|
||||
{
|
||||
|
||||
internal static IContainer _topCollector;
|
||||
internal static IContainer _bottomCollector;
|
||||
internal static IContainer _leftCollector;
|
||||
internal static IContainer _rightCollector;
|
||||
public static IContainer _topContainer;
|
||||
public static IContainer _bottomContainer;
|
||||
public static IContainer _leftContainer;
|
||||
public static IContainer _rightContainer;
|
||||
|
||||
public IContainer TopCollector
|
||||
{
|
||||
get { return _topCollector; }
|
||||
{
|
||||
get { return _topContainer; }
|
||||
}
|
||||
|
||||
public IContainer BottomCollector
|
||||
{
|
||||
get { return _bottomCollector; }
|
||||
{
|
||||
get { return _bottomContainer; }
|
||||
}
|
||||
|
||||
public IContainer LeftCollector
|
||||
{
|
||||
get { return _leftCollector; }
|
||||
get { return _leftContainer; }
|
||||
}
|
||||
|
||||
public IContainer RightCollector
|
||||
{
|
||||
get { return _rightCollector; }
|
||||
get { return _rightContainer; }
|
||||
}
|
||||
|
||||
static IContainer mainContainer00;
|
||||
static IContainer mainContainer01;
|
||||
static IContainer mainContainer02;
|
||||
static IContainer mainContainer10;
|
||||
static IContainer mainContainer11;
|
||||
static IContainer mainContainer12;
|
||||
static IContainer mainContainer20;
|
||||
static IContainer mainContainer21;
|
||||
static IContainer mainContainer22;
|
||||
static IContainer mainContainer30;
|
||||
static IContainer mainContainer31;
|
||||
static IContainer mainContainer32;
|
||||
public static EntityContainer mainCotainer
|
||||
= new EntityContainer(1000,-1000,-600,600);
|
||||
|
||||
|
||||
static PointPool()
|
||||
public PointPool()
|
||||
{
|
||||
mainContainer00 = new PointContainer(1000,400,-600,-150);
|
||||
|
||||
mainContainer01 = new PointContainer(1000,400,-150,150);
|
||||
|
||||
mainContainer02 = new PointContainer(1000,400,150,600);
|
||||
|
||||
mainContainer10 = new PointContainer(400,0,-600,-150);
|
||||
|
||||
mainContainer11 = new PointContainer(400,0,-150,150);
|
||||
|
||||
mainContainer12 = new PointContainer(400,0,150,600);
|
||||
|
||||
mainContainer20 = new PointContainer(0,-400,-600,-150);
|
||||
|
||||
mainContainer21 = new PointContainer(0,-400,-150,150);
|
||||
|
||||
mainContainer22 = new PointContainer(0,-400,150,600);
|
||||
|
||||
mainContainer30 = new PointContainer(-400,-1000,-600,-150);
|
||||
|
||||
mainContainer31 = new PointContainer(-400,-1000,-150,150);
|
||||
|
||||
mainContainer32 = new PointContainer(-400,-1000,150,600);
|
||||
|
||||
mainContainer00.Top = _topCollector;
|
||||
mainContainer00.Bottom = mainContainer10;
|
||||
mainContainer00.Left = _leftCollector;
|
||||
mainContainer00.Right = mainContainer01;
|
||||
|
||||
Undo01:设置其他11个容器构成完整的池
|
||||
|
||||
}
|
||||
public static void OnRender()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +55,10 @@
|
||||
<Compile Include="Geometry\IPoint.cs" />
|
||||
<Compile Include="Geometry\PointCommon.cs" />
|
||||
<Compile Include="Logic\IContainer.cs" />
|
||||
<Compile Include="Logic\PointContainer.cs" />
|
||||
<Compile Include="Pool\IPool.cs" />
|
||||
<Compile Include="Pool\PointContainer.cs" />
|
||||
<Compile Include="Pool\PointPool.cs" />
|
||||
<Compile Include="Logic\IPool.cs" />
|
||||
<Compile Include="Pool\BulletPool.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Entity\Bullet.cs" />
|
||||
<Compile Include="Entity\Player.cs" />
|
||||
@@ -66,8 +67,8 @@
|
||||
<Compile Include="Geometry\PointOnLine.cs" />
|
||||
<Compile Include="Geometry\PointOnCircle.cs" />
|
||||
<Compile Include="Geometry\Line.cs" />
|
||||
<Compile Include="Logic\GeometryContainer.cs" />
|
||||
<Compile Include="Logic\EntityContainer.cs" />
|
||||
<Compile Include="Pool\GeometryContainer.cs" />
|
||||
<Compile Include="Pool\EntityContainer.cs" />
|
||||
<Compile Include="Logic\Counter.cs" />
|
||||
<Compile Include="Logic\LinkedList.cs" />
|
||||
<Compile Include="Logic\LinkedObject.cs" />
|
||||
@@ -75,6 +76,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Control\TextFile1.txt" />
|
||||
<Content Include="TextFile1.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OpenTK.dll.config" />
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
20221030
|
||||
|
||||
重大算法bug,为减少运算量创建的子弹池结构由多个块构成,块边界附近的子弹
|
||||
不一定会参加碰撞判定运算,使不一定触发player中弹事件
|
||||
|
||||
其中一个解决方案是在边界处的子弹将被两个块共享,即同时拥有该子弹的实例成员
|
||||
此时,限制子弹数量的计数器和实例添加器应当由池管理,而非由链表本身管理。
|
||||
|
||||
若如此,子弹池本身应当拥有一个容器存放全部子弹,避免边界处子弹的OnRender方法
|
||||
被反复触发。
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
ad761ca55fb448d4a1c942b7a73d038bfb5ad3dc
|
||||
369e445224268321375e14dd582eb844e5d534bd
|
||||
|
||||
Reference in New Issue
Block a user