no more windows??

This commit is contained in:
lewd-alt
2025-05-07 10:45:18 -07:00
parent eecd2a0399
commit 9d89d2cb6a
933 changed files with 408908 additions and 407973 deletions

View File

@@ -9,7 +9,7 @@
<Platforms>AnyCPU</Platforms> <Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<LangVersion>10.0</LangVersion> <LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -1,6 +1,9 @@
namespace System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.CodeAnalysis
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
internal sealed class AllowNullAttribute : Attribute
{ {
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
internal sealed class AllowNullAttribute : Attribute
{
}
} }

View File

@@ -1,12 +1,13 @@
namespace System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.CodeAnalysis
[AttributeUsage(AttributeTargets.Parameter)]
internal class DoesNotReturnIfAttribute : Attribute
{ {
public DoesNotReturnIfAttribute(bool parameterValue) [AttributeUsage(AttributeTargets.Parameter)]
internal class DoesNotReturnIfAttribute : Attribute
{ {
ParameterValue = parameterValue; public DoesNotReturnIfAttribute(bool parameterValue)
} {
ParameterValue = parameterValue;
}
public bool ParameterValue { get; } public bool ParameterValue { get; }
}
} }

View File

@@ -1,7 +1,8 @@
namespace System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.CodeAnalysis
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
AttributeTargets.ReturnValue)]
internal sealed class MaybeNullAttribute : Attribute
{ {
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
AttributeTargets.ReturnValue)]
internal sealed class MaybeNullAttribute : Attribute
{
}
} }

View File

@@ -1,8 +1,9 @@
namespace System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.CodeAnalysis
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
AttributeTargets.ReturnValue, AllowMultiple = true)]
internal sealed class NotNullAttribute : Attribute
{ {
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
AttributeTargets.ReturnValue, AllowMultiple = true)]
internal sealed class NotNullAttribute : Attribute
{
}
} }

View File

@@ -1,12 +1,13 @@
namespace System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.CodeAnalysis
[AttributeUsage(AttributeTargets.Parameter)]
internal sealed class NotNullWhenAttribute : Attribute
{ {
public NotNullWhenAttribute(bool returnValue) [AttributeUsage(AttributeTargets.Parameter)]
internal sealed class NotNullWhenAttribute : Attribute
{ {
ReturnValue = returnValue; public NotNullWhenAttribute(bool returnValue)
} {
ReturnValue = returnValue;
}
public bool ReturnValue { get; } public bool ReturnValue { get; }
}
} }

View File

@@ -2,200 +2,201 @@ using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Are : Rect
{ {
public Bitmap Dis; public class Are : Rect
protected Graphics gd;
protected Bitmap Hit;
protected Graphics gh;
protected double unit;
protected double disUnit;
protected double hitUnit;
protected Size WH = System.Drawing.Size.Empty;
protected Size WHH = System.Drawing.Size.Empty;
protected Size WHA = System.Drawing.Size.Empty;
private Color ClearColor = Color.Transparent;
public Vector2D BasePoint = Dat.Vec2DZero;
public Vector2D Position = Dat.Vec2DZero;
protected Vector2D p;
protected Rectangle r;
protected ColorMatrix cm = new ColorMatrix();
protected ImageAttributes ia = new ImageAttributes();
protected InterpolationMode im;
public Graphics GD => gd;
public Graphics GH => gh;
public double Unit => unit;
public double DisUnit => disUnit;
public Are() { }
public Are(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
{
Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag);
}
public Are(Med Med, bool Hit)
{
if (Hit)
{
Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality, Med.HitAccuracy);
}
else
{
Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality);
}
}
private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag)
{ {
SetXYRatio(XRatio, YRatio); public Bitmap Dis;
base.Size = Size;
unit = Unit; protected Graphics gd;
disUnit = Unit * DisMag;
WH.Width = (int)(base.LocalWidth * Unit); protected Bitmap Hit;
WH.Height = (int)(base.LocalHeight * Unit);
WHA.Width = (int)(base.LocalWidth * disUnit); protected Graphics gh;
WHA.Height = (int)(base.LocalHeight * disUnit);
Dis = new Bitmap((int)((double)WH.Width * DisMag), (int)((double)WH.Height * DisMag)); protected double unit;
gd = Graphics.FromImage(Dis);
protected double disUnit;
protected double hitUnit;
protected Size WH = System.Drawing.Size.Empty;
protected Size WHH = System.Drawing.Size.Empty;
protected Size WHA = System.Drawing.Size.Empty;
private Color ClearColor = Color.Transparent;
public Vector2D BasePoint = Dat.Vec2DZero;
public Vector2D Position = Dat.Vec2DZero;
protected Vector2D p;
protected Rectangle r;
protected ColorMatrix cm = new ColorMatrix();
protected ImageAttributes ia = new ImageAttributes();
protected InterpolationMode im;
public Graphics GD => gd;
public Graphics GH => gh;
public double Unit => unit;
public double DisUnit => disUnit;
public Are() { }
public Are(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
{
Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag);
}
public Are(Med Med, bool Hit)
{
if (Hit)
{
Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality, Med.HitAccuracy);
}
else
{
Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality);
}
}
private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag)
{
SetXYRatio(XRatio, YRatio);
base.Size = Size;
unit = Unit;
disUnit = Unit * DisMag;
WH.Width = (int)(base.LocalWidth * Unit);
WH.Height = (int)(base.LocalHeight * Unit);
WHA.Width = (int)(base.LocalWidth * disUnit);
WHA.Height = (int)(base.LocalHeight * disUnit);
Dis = new Bitmap((int)((double)WH.Width * DisMag), (int)((double)WH.Height * DisMag));
gd = Graphics.FromImage(Dis);
gd.SmoothingMode = SmoothingMode.None; gd.SmoothingMode = SmoothingMode.None;
gd.PixelOffsetMode = PixelOffsetMode.HighSpeed; gd.PixelOffsetMode = PixelOffsetMode.HighSpeed;
gd.InterpolationMode = InterpolationMode.NearestNeighbor; gd.InterpolationMode = InterpolationMode.NearestNeighbor;
//needed for text or smthn //needed for text or smthn
gd.CompositingMode = CompositingMode.SourceOver; gd.CompositingMode = CompositingMode.SourceOver;
}
private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
{
Setting(Unit, XRatio, YRatio, Size, DisMag);
hitUnit = Unit * HitMag;
WHH.Width = (int)(base.LocalWidth * hitUnit);
WHH.Height = (int)(base.LocalHeight * hitUnit);
Hit = new Bitmap(WHH.Width, WHH.Height);
gh = Graphics.FromImage(Hit);
gh.SmoothingMode = SmoothingMode.None;
gh.PixelOffsetMode = PixelOffsetMode.HighSpeed;
gh.InterpolationMode = InterpolationMode.NearestNeighbor;
gh.CompositingMode = CompositingMode.SourceCopy;
}
public Vector2D GetPosition()
{
return new Vector2D(Position.X - BasePoint.X * XRatio * Size, Position.Y - BasePoint.Y * YRatio * Size);
}
public void Draw(Par Par)
{
Par.Draw(disUnit, gd);
if (gh != null)
{
Par.DrawH(hitUnit, gh);
}
}
public void Draw(ParT ParT)
{
ParT.Draw(disUnit, gd);
if (gh != null)
{
ParT.DrawH(hitUnit, gh);
}
}
public void Draw(Pars Pars)
{
Pars.Draw(disUnit, gd);
if (gh != null)
{
Pars.DrawH(hitUnit, gh);
}
}
public void Draw(Graphics GD)
{
p = GetPosition();
GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
}
public void Draw(Graphics GD, Graphics GH)
{
p = GetPosition();
GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
if (gh != null)
{
GH.DrawImage(Hit, (int)(p.X * hitUnit), (int)(p.Y * hitUnit), WHH.Width, WHH.Height);
}
}
public void Draw(Are Are)
{
p = Are.GetPosition();
GD.DrawImage(Are.Dis, (float)(p.X * Are.disUnit), (float)(p.Y * Are.disUnit), Are.WHA.Width, Are.WHA.Height);
if (Are.gh != null && GH != null)
{
GH.DrawImage(Are.Hit, (int)(p.X * Are.hitUnit), (int)(p.Y * Are.hitUnit), Are.WHH.Width, Are.WHH.Height);
}
}
public void Clear()
{
gd.Clear(ClearColor);
if (gh != null)
{
gh.Clear(ClearColor);
}
}
public void Clear(Color Color)
{
gd.Clear(Color);
if (gh != null)
{
gh.Clear(ClearColor);
}
}
public void Dispose()
{
Dis.Dispose();
gd.Dispose();
if (Hit != null)
{
Hit.Dispose();
gh.Dispose();
}
}
} }
private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
{
Setting(Unit, XRatio, YRatio, Size, DisMag);
hitUnit = Unit * HitMag;
WHH.Width = (int)(base.LocalWidth * hitUnit);
WHH.Height = (int)(base.LocalHeight * hitUnit);
Hit = new Bitmap(WHH.Width, WHH.Height);
gh = Graphics.FromImage(Hit);
gh.SmoothingMode = SmoothingMode.None;
gh.PixelOffsetMode = PixelOffsetMode.HighSpeed;
gh.InterpolationMode = InterpolationMode.NearestNeighbor;
gh.CompositingMode = CompositingMode.SourceCopy;
}
public Vector2D GetPosition()
{
return new Vector2D(Position.X - BasePoint.X * XRatio * Size, Position.Y - BasePoint.Y * YRatio * Size);
}
public void Draw(Par Par)
{
Par.Draw(disUnit, gd);
if (gh != null)
{
Par.DrawH(hitUnit, gh);
}
}
public void Draw(ParT ParT)
{
ParT.Draw(disUnit, gd);
if (gh != null)
{
ParT.DrawH(hitUnit, gh);
}
}
public void Draw(Pars Pars)
{
Pars.Draw(disUnit, gd);
if (gh != null)
{
Pars.DrawH(hitUnit, gh);
}
}
public void Draw(Graphics GD)
{
p = GetPosition();
GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
}
public void Draw(Graphics GD, Graphics GH)
{
p = GetPosition();
GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
if (gh != null)
{
GH.DrawImage(Hit, (int)(p.X * hitUnit), (int)(p.Y * hitUnit), WHH.Width, WHH.Height);
}
}
public void Draw(Are Are)
{
p = Are.GetPosition();
GD.DrawImage(Are.Dis, (float)(p.X * Are.disUnit), (float)(p.Y * Are.disUnit), Are.WHA.Width, Are.WHA.Height);
if (Are.gh != null && GH != null)
{
GH.DrawImage(Are.Hit, (int)(p.X * Are.hitUnit), (int)(p.Y * Are.hitUnit), Are.WHH.Width, Are.WHH.Height);
}
}
public void Clear()
{
gd.Clear(ClearColor);
if (gh != null)
{
gh.Clear(ClearColor);
}
}
public void Clear(Color Color)
{
gd.Clear(Color);
if (gh != null)
{
gh.Clear(ClearColor);
}
}
public void Dispose()
{
Dis.Dispose();
gd.Dispose();
if (Hit != null)
{
Hit.Dispose();
gh.Dispose();
}
}
} }

View File

@@ -1,84 +1,85 @@
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class AreM : Are
{ {
private double strength; public class AreM : Are
{
private double strength;
private double unitS; private double unitS;
public AreM(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength) public AreM(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength)
{ {
Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag, Strength); Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag, Strength);
} }
private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength) private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength)
{ {
SetXYRatio(XRatio, YRatio); SetXYRatio(XRatio, YRatio);
base.Size = Size; base.Size = Size;
unit = Unit; unit = Unit;
strength = Strength; strength = Strength;
disUnit = Unit * DisMag; disUnit = Unit * DisMag;
double num = 1.0 - Strength; double num = 1.0 - Strength;
unitS = disUnit * num; unitS = disUnit * num;
WH.Width = (int)(base.LocalWidth * Unit); WH.Width = (int)(base.LocalWidth * Unit);
WH.Height = (int)(base.LocalHeight * Unit); WH.Height = (int)(base.LocalHeight * Unit);
WHA.Width = (int)(base.LocalWidth * disUnit); WHA.Width = (int)(base.LocalWidth * disUnit);
WHA.Height = (int)(base.LocalHeight * disUnit); WHA.Height = (int)(base.LocalHeight * disUnit);
Dis = new Bitmap((int)((double)WH.Width * DisMag * num), (int)((double)WH.Height * DisMag * num)); Dis = new Bitmap((int)((double)WH.Width * DisMag * num), (int)((double)WH.Height * DisMag * num));
gd = Graphics.FromImage(Dis); gd = Graphics.FromImage(Dis);
gd.SmoothingMode = SmoothingMode.None; gd.SmoothingMode = SmoothingMode.None;
gd.PixelOffsetMode = PixelOffsetMode.None; gd.PixelOffsetMode = PixelOffsetMode.None;
hitUnit = Unit * HitMag; hitUnit = Unit * HitMag;
WHH.Width = (int)(base.LocalWidth * hitUnit); WHH.Width = (int)(base.LocalWidth * hitUnit);
WHH.Height = (int)(base.LocalHeight * hitUnit); WHH.Height = (int)(base.LocalHeight * hitUnit);
Hit = new Bitmap(WHH.Width, WHH.Height); Hit = new Bitmap(WHH.Width, WHH.Height);
gh = Graphics.FromImage(Hit); gh = Graphics.FromImage(Hit);
gh.SmoothingMode = SmoothingMode.None; gh.SmoothingMode = SmoothingMode.None;
gh.PixelOffsetMode = PixelOffsetMode.None; gh.PixelOffsetMode = PixelOffsetMode.None;
} }
public new void Draw(ParT ParT) public new void Draw(ParT ParT)
{ {
ParT.Draw(unitS, gd); ParT.Draw(unitS, gd);
if (gh != null) if (gh != null)
{ {
ParT.DrawH(hitUnit, gh); ParT.DrawH(hitUnit, gh);
} }
} }
public new void Draw(Pars Pars) public new void Draw(Pars Pars)
{ {
Pars.Draw(unitS, gd); Pars.Draw(unitS, gd);
if (gh != null) if (gh != null)
{ {
Pars.DrawH(hitUnit, gh); Pars.DrawH(hitUnit, gh);
} }
} }
public new void Draw(Graphics GD) public new void Draw(Graphics GD)
{ {
im = GD.InterpolationMode; im = GD.InterpolationMode;
GD.InterpolationMode = InterpolationMode.NearestNeighbor; GD.InterpolationMode = InterpolationMode.NearestNeighbor;
p = GetPosition(); p = GetPosition();
GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height); GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
GD.InterpolationMode = im; GD.InterpolationMode = im;
} }
public new void Draw(Graphics GD, double Opacity) public new void Draw(Graphics GD, double Opacity)
{ {
im = GD.InterpolationMode; im = GD.InterpolationMode;
GD.InterpolationMode = InterpolationMode.NearestNeighbor; GD.InterpolationMode = InterpolationMode.NearestNeighbor;
cm.Matrix33 = (float)Opacity; cm.Matrix33 = (float)Opacity;
ia.SetColorMatrix(cm); ia.SetColorMatrix(cm);
p = GetPosition(); p = GetPosition();
r.X = (int)(p.X * unit); r.X = (int)(p.X * unit);
r.Y = (int)(p.Y * unit); r.Y = (int)(p.Y * unit);
r.Width = WH.Width; r.Width = WH.Width;
r.Height = WH.Height; r.Height = WH.Height;
GD.DrawImage(Dis, r, 0, 0, Dis.Width, Dis.Height, GraphicsUnit.Pixel, ia); GD.DrawImage(Dis, r, 0, 0, Dis.Width, Dis.Height, GraphicsUnit.Pixel, ia);
GD.InterpolationMode = im; GD.InterpolationMode = im;
} }
}
} }

View File

@@ -1,166 +1,167 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class But
{ {
private bool dra = true; public class But
{
private bool dra = true;
private Color hc = Color.Transparent; private Color hc = Color.Transparent;
protected Pars pars; protected Pars pars;
protected Action<But> Over = delegate protected Action<But> Over = delegate
{ {
}; };
protected Action<But> Push = delegate protected Action<But> Push = delegate
{ {
}; };
protected Action<But> Release = delegate protected Action<But> Release = delegate
{ {
}; };
protected Action<But> Out = delegate protected Action<But> Out = delegate
{ {
}; };
public Action<But> Action = delegate public Action<But> Action = delegate
{ {
}; };
private bool f1; private bool f1;
private bool f2; private bool f2;
public bool Dra public bool Dra
{ {
get get
{ {
return dra; return dra;
} }
set set
{ {
Move(ref hc); Move(ref hc);
dra = value; dra = value;
} }
} }
public Pars Pars => pars; public Pars Pars => pars;
public But(Par Par, Action<But> Action) public But(Par Par, Action<But> Action)
{ {
pars = new Pars(Par); pars = new Pars(Par);
this.Action = Action; this.Action = Action;
} }
public But(ParT ParT, Action<But> Action) public But(ParT ParT, Action<But> Action)
{ {
pars = new Pars(ParT); pars = new Pars(ParT);
this.Action = Action; this.Action = Action;
} }
public But(Pars Pars, Action<But> Action) public But(Pars Pars, Action<But> Action)
{ {
pars = Pars; pars = Pars;
this.Action = Action; this.Action = Action;
} }
public bool Move(ref Color HitColor) public bool Move(ref Color HitColor)
{ {
if (Dra && !f2 && pars.IsHit(ref HitColor)) if (Dra && !f2 && pars.IsHit(ref HitColor))
{ {
f2 = true; f2 = true;
Over(this); Over(this);
return true; return true;
} }
if (Dra && f2 && !pars.IsHit(ref HitColor)) if (Dra && f2 && !pars.IsHit(ref HitColor))
{ {
f1 = false; f1 = false;
f2 = false; f2 = false;
Out(this); Out(this);
return true; return true;
} }
return false; return false;
} }
public bool Leave() public bool Leave()
{ {
if (Dra && f2) if (Dra && f2)
{ {
f1 = false; f1 = false;
f2 = false; f2 = false;
Out(this); Out(this);
return true; return true;
} }
return false; return false;
} }
public bool Down(ref Color HitColor) public bool Down(ref Color HitColor)
{ {
if (Dra && !f1 && pars.IsHit(ref HitColor)) if (Dra && !f1 && pars.IsHit(ref HitColor))
{ {
f1 = true; f1 = true;
Push(this); Push(this);
return true; return true;
} }
return false; return false;
} }
public bool Up(ref Color HitColor) public bool Up(ref Color HitColor)
{ {
if (Dra && f1 && pars.IsHit(ref HitColor)) if (Dra && f1 && pars.IsHit(ref HitColor))
{ {
f1 = false; f1 = false;
Release(this); Release(this);
Action(this); Action(this);
return true; return true;
} }
return false; return false;
} }
public void Draw(Are Are) public void Draw(Are Are)
{ {
if (dra) if (dra)
{ {
Are.Draw(pars); Are.Draw(pars);
} }
} }
public void Draw(AreM AreM) public void Draw(AreM AreM)
{ {
if (dra) if (dra)
{ {
AreM.Draw(pars); AreM.Draw(pars);
} }
} }
public void SetHitColor(Med Med) public void SetHitColor(Med Med)
{ {
foreach (Par item in pars.EnumAllPar()) foreach (Par item in pars.EnumAllPar())
{ {
if (item.HitColor != Color.Transparent) if (item.HitColor != Color.Transparent)
{ {
Med.RemUniqueColor(item.HitColor); Med.RemUniqueColor(item.HitColor);
} }
item.HitColor = Med.GetUniqueColor(); item.HitColor = Med.GetUniqueColor();
} }
} }
public void Dispose() public void Dispose()
{ {
pars.Dispose(); pars.Dispose();
} }
public bool IsBut1() public bool IsBut1()
{ {
return this is But1; return this is But1;
} }
public But1 ToBut1() public But1 ToBut1()
{ {
return (But1)this; return (But1)this;
} }
}
} }

View File

@@ -3,108 +3,109 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class But1 : But
{ {
public List<Color> BaseColors = new List<Color>(); public class But1 : But
{
public List<Color> BaseColors = new List<Color>();
public List<Color> OverColors = new List<Color>(); public List<Color> OverColors = new List<Color>();
public List<Color> PushColors = new List<Color>(); public List<Color> PushColors = new List<Color>();
public List<Color> TextColors = new List<Color>(); public List<Color> TextColors = new List<Color>();
public But1(Par Par, Action<But> Action) public But1(Par Par, Action<But> Action)
: base(Par, Action) : base(Par, Action)
{ {
Setting(); Setting();
} }
public But1(ParT ParT, Action<But> Action) public But1(ParT ParT, Action<But> Action)
: base(ParT, Action) : base(ParT, Action)
{ {
Setting(); Setting();
} }
public But1(Pars Pars, Action<But> Action) public But1(Pars Pars, Action<But> Action)
: base(Pars, Action) : base(Pars, Action)
{ {
Setting(); Setting();
} }
private void Setting() private void Setting()
{ {
foreach (Par item in pars.EnumAllPar()) foreach (Par item in pars.EnumAllPar())
{ {
BaseColors.Add(item.BrushColor); BaseColors.Add(item.BrushColor);
OverColors.Add(BaseColors.Last().FuncHSV(delegate(Hsv hsv) OverColors.Add(BaseColors.Last().FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
})); }));
PushColors.Add(OverColors.Last().FuncHSV(delegate(Hsv hsv) PushColors.Add(OverColors.Last().FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
})); }));
TextColors.Add(item.IsParT() ? item.ToParT().TextColor : Color.Empty); TextColors.Add(item.IsParT() ? item.ToParT().TextColor : Color.Empty);
} }
Over = delegate Over = delegate
{ {
int num4 = 0; int num4 = 0;
foreach (Par item2 in pars.EnumAllPar()) foreach (Par item2 in pars.EnumAllPar())
{ {
item2.BrushColor = OverColors[num4]; item2.BrushColor = OverColors[num4];
if (item2.IsParT()) if (item2.IsParT())
{ {
item2.ToParT().TextColor = TextColors[num4].Reverse(); item2.ToParT().TextColor = TextColors[num4].Reverse();
} }
num4++; num4++;
} }
}; };
Push = delegate Push = delegate
{ {
int num3 = 0; int num3 = 0;
foreach (Par item3 in pars.EnumAllPar()) foreach (Par item3 in pars.EnumAllPar())
{ {
item3.BrushColor = PushColors[num3]; item3.BrushColor = PushColors[num3];
if (item3.IsParT()) if (item3.IsParT())
{ {
item3.ToParT().TextColor = TextColors[num3].Reverse(); item3.ToParT().TextColor = TextColors[num3].Reverse();
} }
num3++; num3++;
} }
}; };
Release = delegate Release = delegate
{ {
int num2 = 0; int num2 = 0;
foreach (Par item4 in pars.EnumAllPar()) foreach (Par item4 in pars.EnumAllPar())
{ {
item4.BrushColor = OverColors[num2]; item4.BrushColor = OverColors[num2];
if (item4.IsParT()) if (item4.IsParT())
{ {
item4.ToParT().TextColor = TextColors[num2].Reverse(); item4.ToParT().TextColor = TextColors[num2].Reverse();
} }
num2++; num2++;
} }
}; };
Out = delegate Out = delegate
{ {
int num = 0; int num = 0;
foreach (Par item5 in pars.EnumAllPar()) foreach (Par item5 in pars.EnumAllPar())
{ {
item5.BrushColor = BaseColors[num]; item5.BrushColor = BaseColors[num];
if (item5.IsParT()) if (item5.IsParT())
{ {
item5.ToParT().TextColor = TextColors[num]; item5.ToParT().TextColor = TextColors[num];
} }
num++; num++;
} }
}; };
} }
}
} }

View File

@@ -2,87 +2,88 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Buts
{ {
private OrderedDictionary<string, But> buts = new OrderedDictionary<string, But>(); public class Buts
{
private OrderedDictionary<string, But> buts = new OrderedDictionary<string, But>();
public But this[string Name] => buts[Name]; public But this[string Name] => buts[Name];
public IEnumerable<But> EnumBut => buts.Values; public IEnumerable<But> EnumBut => buts.Values;
public void Add(string Name, But But) public void Add(string Name, But But)
{ {
buts.Add(Name, But); buts.Add(Name, But);
} }
public void Down(ref Color HitColor) public void Down(ref Color HitColor)
{ {
using IEnumerator<But> enumerator = buts.Values.GetEnumerator(); using IEnumerator<But> enumerator = buts.Values.GetEnumerator();
while (enumerator.MoveNext() && !enumerator.Current.Down(ref HitColor)) while (enumerator.MoveNext() && !enumerator.Current.Down(ref HitColor))
{ {
} }
} }
public void Up(ref Color HitColor) public void Up(ref Color HitColor)
{ {
using IEnumerator<But> enumerator = buts.Values.GetEnumerator(); using IEnumerator<But> enumerator = buts.Values.GetEnumerator();
while (enumerator.MoveNext() && !enumerator.Current.Up(ref HitColor)) while (enumerator.MoveNext() && !enumerator.Current.Up(ref HitColor))
{ {
} }
} }
public void Move(ref Color HitColor) public void Move(ref Color HitColor)
{ {
foreach (But value in buts.Values) foreach (But value in buts.Values)
{ {
value.Move(ref HitColor); value.Move(ref HitColor);
} }
} }
public void Leave() public void Leave()
{ {
using IEnumerator<But> enumerator = buts.Values.GetEnumerator(); using IEnumerator<But> enumerator = buts.Values.GetEnumerator();
while (enumerator.MoveNext() && !enumerator.Current.Leave()) while (enumerator.MoveNext() && !enumerator.Current.Leave())
{ {
} }
} }
public void SetHitColor(Med Med) public void SetHitColor(Med Med)
{ {
foreach (But item in EnumBut) foreach (But item in EnumBut)
{ {
item.SetHitColor(Med); item.SetHitColor(Med);
} }
} }
public void Draw(Are Are) public void Draw(Are Are)
{ {
foreach (But value in buts.Values) foreach (But value in buts.Values)
{ {
value.Draw(Are); value.Draw(Are);
} }
} }
public void Draw(AreM AreM) public void Draw(AreM AreM)
{ {
foreach (But value in buts.Values) foreach (But value in buts.Values)
{ {
value.Draw(AreM); value.Draw(AreM);
} }
} }
public void Dispose() public void Dispose()
{ {
foreach (But value in buts.Values) foreach (But value in buts.Values)
{ {
value.Dispose(); value.Dispose();
} }
} }
public bool IsHit(Color hc) public bool IsHit(Color hc)
{ {
return EnumBut.Any((But e) => e.Pars.Values.First().ToPar().HitColor == hc); return EnumBut.Any((But e) => e.Pars.Values.First().ToPar().HitColor == hc);
} }
}
} }

View File

@@ -1,17 +1,18 @@
namespace _2DGAMELIB; namespace _2DGAMELIB
public class ConstProp
{ {
private int c = -1; public class ConstProp
{
private int c = -1;
public bool GetFlag(double Proportion) public bool GetFlag(double Proportion)
{ {
c++; c++;
return c % (int)(1.0 / Proportion) == 0; return c % (int)(1.0 / Proportion) == 0;
} }
public void Reset() public void Reset()
{ {
c = -1; c = -1;
} }
}
} }

View File

@@ -1,19 +1,20 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace _2DGAMELIB; namespace _2DGAMELIB
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct Dat
{ {
public static MatrixD MatDZero = new MatrixD(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); [StructLayout(LayoutKind.Sequential, Size = 1)]
public struct Dat
{
public static MatrixD MatDZero = new MatrixD(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
public static MatrixD MatDIdentity = new MatrixD(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0); public static MatrixD MatDIdentity = new MatrixD(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
public static Vector2D Vec2DZero = new Vector2D(0.0, 0.0); public static Vector2D Vec2DZero = new Vector2D(0.0, 0.0);
public static Vector2D Vec2DOne = new Vector2D(1.0, 1.0); public static Vector2D Vec2DOne = new Vector2D(1.0, 1.0);
public static Vector2D Vec2DUnitX = new Vector2D(1.0, 0.0); public static Vector2D Vec2DUnitX = new Vector2D(1.0, 0.0);
public static Vector2D Vec2DUnitY = new Vector2D(0.0, 1.0); public static Vector2D Vec2DUnitY = new Vector2D(0.0, 1.0);
}
} }

View File

@@ -2,289 +2,290 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class Dif
{ {
public string Tag = ""; [Serializable]
public class Dif
{
public string Tag = "";
private List<Pars> parss = new List<Pars>(); private List<Pars> parss = new List<Pars>();
public List<Pars> Parss => parss; public List<Pars> Parss => parss;
public int Count => parss.Count; public int Count => parss.Count;
public Pars this[int Index] public Pars this[int Index]
{ {
get get
{ {
return parss[Index]; return parss[Index];
} }
set set
{ {
parss[Index] = value; parss[Index] = value;
} }
} }
public double PositionSize public double PositionSize
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.PositionSize = value; item.PositionSize = value;
} }
} }
} }
public Vector2D PositionVector public Vector2D PositionVector
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.PositionVector = value; item.PositionVector = value;
} }
} }
} }
public double AngleBase public double AngleBase
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.AngleBase = value; item.AngleBase = value;
} }
} }
} }
public double AngleCont public double AngleCont
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.AngleCont = value; item.AngleCont = value;
} }
} }
} }
public double SizeBase public double SizeBase
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SizeBase = value; item.SizeBase = value;
} }
} }
} }
public double SizeCont public double SizeCont
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SizeCont = value; item.SizeCont = value;
} }
} }
} }
public double SizeXBase public double SizeXBase
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SizeXBase = value; item.SizeXBase = value;
} }
} }
} }
public double SizeXCont public double SizeXCont
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SizeXCont = value; item.SizeXCont = value;
} }
} }
} }
public double SizeYBase public double SizeYBase
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SizeYBase = value; item.SizeYBase = value;
} }
} }
} }
public double SizeYCont public double SizeYCont
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SizeYCont = value; item.SizeYCont = value;
} }
} }
} }
public bool Dra public bool Dra
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.Dra = value; item.Dra = value;
} }
} }
} }
public bool Hit public bool Hit
{ {
set set
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.Hit = value; item.Hit = value;
} }
} }
} }
public IEnumerable<Par> EnumAllPar() public IEnumerable<Par> EnumAllPar()
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
foreach (Par item2 in item.EnumAllPar()) foreach (Par item2 in item.EnumAllPar())
{ {
yield return item2; yield return item2;
} }
} }
} }
public void SetDefault() public void SetDefault()
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.SetDefault(); item.SetDefault();
} }
} }
public Dif() public Dif()
{ {
} }
public Dif(Dif Dif) public Dif(Dif Dif)
{ {
Copy(Dif); Copy(Dif);
} }
private void Copy(Dif Dif) private void Copy(Dif Dif)
{ {
Tag = Dif.Tag; Tag = Dif.Tag;
foreach (Pars item in Dif.parss) foreach (Pars item in Dif.parss)
{ {
parss.Add(new Pars(item)); parss.Add(new Pars(item));
} }
} }
public void Add(Pars Pars) public void Add(Pars Pars)
{ {
parss.Add(Pars); parss.Add(Pars);
} }
public void Insert(int Index, Pars Pars) public void Insert(int Index, Pars Pars)
{ {
parss.Insert(Index, Pars); parss.Insert(Index, Pars);
} }
public void Remove(Pars Pars) public void Remove(Pars Pars)
{ {
parss.Remove(Pars); parss.Remove(Pars);
} }
public void RemoveAt(int Index) public void RemoveAt(int Index)
{ {
parss.RemoveAt(Index); parss.RemoveAt(Index);
} }
public void Draws(Are Are) public void Draws(Are Are)
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
Are.Draw(item); Are.Draw(item);
} }
} }
public void Draws(AreM AreM) public void Draws(AreM AreM)
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
AreM.Draw(item); AreM.Draw(item);
} }
} }
public List<string> GetHitTags(ref Color HitColor) public List<string> GetHitTags(ref Color HitColor)
{ {
List<string> list = new List<string>(); List<string> list = new List<string>();
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
list.AddRange(item.GetHitTags(ref HitColor)); list.AddRange(item.GetHitTags(ref HitColor));
} }
return list; return list;
} }
public List<Par> GetHitPars(ref Color HitColor) public List<Par> GetHitPars(ref Color HitColor)
{ {
List<Par> list = new List<Par>(); List<Par> list = new List<Par>();
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
list.AddRange(item.GetHitPars(ref HitColor)); list.AddRange(item.GetHitPars(ref HitColor));
} }
return list; return list;
} }
public bool IsHit(ref Color HitColor) public bool IsHit(ref Color HitColor)
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
if (item.IsHit(ref HitColor)) if (item.IsHit(ref HitColor))
{ {
return true; return true;
} }
} }
return false; return false;
} }
public void ReverseX() public void ReverseX()
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.ReverseX(); item.ReverseX();
} }
} }
public void ReverseY() public void ReverseY()
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.ReverseY(); item.ReverseY();
} }
} }
public void Dispose() public void Dispose()
{ {
foreach (Pars item in parss) foreach (Pars item in parss)
{ {
item.Dispose(); item.Dispose();
} }
} }
}
} }

View File

@@ -4,471 +4,472 @@ using System.Drawing;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class Difs
{ {
public string Tag = ""; [Serializable]
public class Difs
{
public string Tag = "";
public double ValueX; public double ValueX;
public double ValueY; public double ValueY;
private List<Dif> difs = new List<Dif>(); private List<Dif> difs = new List<Dif>();
public Dictionary<Pars, Joints> pj; public Dictionary<Pars, Joints> pj;
public Dictionary<Pars, Par> pr; public Dictionary<Pars, Par> pr;
public List<Dif> Difss => difs; public List<Dif> Difss => difs;
public int CountX => difs.Count; public int CountX => difs.Count;
public int CountY public int CountY
{ {
get get
{ {
if (difs.Count > 0) if (difs.Count > 0)
{ {
return difs[IndexX].Count; return difs[IndexX].Count;
} }
return 0; return 0;
} }
} }
public int IndexX public int IndexX
{ {
get get
{ {
if (!(ValueX >= 1.0)) if (!(ValueX >= 1.0))
{ {
return (int)((double)CountX * ValueX); return (int)((double)CountX * ValueX);
} }
return CountX - 1; return CountX - 1;
} }
set set
{ {
ValueX = (double)value / (double)CountX; ValueX = (double)value / (double)CountX;
} }
} }
public int IndexY public int IndexY
{ {
get get
{ {
if (!(ValueY >= 1.0)) if (!(ValueY >= 1.0))
{ {
return (int)((double)CountY * ValueY); return (int)((double)CountY * ValueY);
} }
return CountY - 1; return CountY - 1;
} }
set set
{ {
ValueY = (double)value / (double)CountY; ValueY = (double)value / (double)CountY;
} }
} }
public Dif this[int Index] public Dif this[int Index]
{ {
get get
{ {
return difs[Index]; return difs[Index];
} }
set set
{ {
difs[Index] = value; difs[Index] = value;
} }
} }
public Pars Current => difs[IndexX][IndexY]; public Pars Current => difs[IndexX][IndexY];
public double PositionSize public double PositionSize
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.PositionSize = value; dif.PositionSize = value;
} }
} }
} }
public Vector2D PositionVector public Vector2D PositionVector
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.PositionVector = value; dif.PositionVector = value;
} }
} }
} }
public double AngleBase public double AngleBase
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.AngleBase = value; dif.AngleBase = value;
} }
} }
} }
public double AngleCont public double AngleCont
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.AngleCont = value; dif.AngleCont = value;
} }
} }
} }
public double SizeBase public double SizeBase
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SizeBase = value; dif.SizeBase = value;
} }
} }
} }
public double SizeCont public double SizeCont
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SizeCont = value; dif.SizeCont = value;
} }
} }
} }
public double SizeXBase public double SizeXBase
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SizeXBase = value; dif.SizeXBase = value;
} }
} }
} }
public double SizeXCont public double SizeXCont
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SizeXCont = value; dif.SizeXCont = value;
} }
} }
} }
public double SizeYBase public double SizeYBase
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SizeYBase = value; dif.SizeYBase = value;
} }
} }
} }
public double SizeYCont public double SizeYCont
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SizeYCont = value; dif.SizeYCont = value;
} }
} }
} }
public bool Dra public bool Dra
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.Dra = value; dif.Dra = value;
} }
} }
} }
public bool Hit public bool Hit
{ {
set set
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.Hit = value; dif.Hit = value;
} }
} }
} }
[JsonIgnore] [JsonIgnore]
public Par CurJoinRoot public Par CurJoinRoot
{ {
get get
{ {
Pars current = Current; Pars current = Current;
if (pr.ContainsKey(current)) if (pr.ContainsKey(current))
{ {
return pr[current]; return pr[current];
} }
return null; return null;
} }
} }
[JsonIgnore] [JsonIgnore]
public IEnumerable<Par> EnumJoinRoot => pr.Values; public IEnumerable<Par> EnumJoinRoot => pr.Values;
public IEnumerable<Par> EnumAllPar() public IEnumerable<Par> EnumAllPar()
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
foreach (Par item in dif.EnumAllPar()) foreach (Par item in dif.EnumAllPar())
{ {
yield return item; yield return item;
} }
} }
} }
public IEnumerable<Pars> EnumAllPars() public IEnumerable<Pars> EnumAllPars()
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
foreach (Pars item in dif.Parss) foreach (Pars item in dif.Parss)
{ {
yield return item; yield return item;
} }
} }
} }
public void SetDefault() public void SetDefault()
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.SetDefault(); dif.SetDefault();
} }
} }
public Difs() public Difs()
{ {
} }
public Difs(Difs Difs) public Difs(Difs Difs)
{ {
Copy(Difs); Copy(Difs);
} }
private void Copy(Difs Difs) private void Copy(Difs Difs)
{ {
Tag = Difs.Tag; Tag = Difs.Tag;
ValueX = Difs.ValueX; ValueX = Difs.ValueX;
ValueY = Difs.ValueY; ValueY = Difs.ValueY;
foreach (Dif dif in Difs.difs) foreach (Dif dif in Difs.difs)
{ {
difs.Add(new Dif(dif)); difs.Add(new Dif(dif));
} }
} }
public void Add(Dif Dif) public void Add(Dif Dif)
{ {
difs.Add(Dif); difs.Add(Dif);
} }
public void Insert(int Index, Dif Dif) public void Insert(int Index, Dif Dif)
{ {
difs.Insert(Index, Dif); difs.Insert(Index, Dif);
} }
public void Remove(Dif Dif) public void Remove(Dif Dif)
{ {
difs.Remove(Dif); difs.Remove(Dif);
} }
public void RemoveAt(int Index) public void RemoveAt(int Index)
{ {
difs.RemoveAt(Index); difs.RemoveAt(Index);
} }
public void Draw(Are Are) public void Draw(Are Are)
{ {
Are.Draw(Current); Are.Draw(Current);
} }
public void Draws(Are Are) public void Draws(Are Are)
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.Draws(Are); dif.Draws(Are);
} }
} }
public void Draw(AreM AreM) public void Draw(AreM AreM)
{ {
AreM.Draw(Current); AreM.Draw(Current);
} }
public void Draws(AreM AreM) public void Draws(AreM AreM)
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.Draws(AreM); dif.Draws(AreM);
} }
} }
private Par GetJoinRoot(Pars ps) private Par GetJoinRoot(Pars ps)
{ {
Par[] array = ps.EnumAllPar().ToArray(); Par[] array = ps.EnumAllPar().ToArray();
if (array.Length <= 1) if (array.Length <= 1)
{ {
return array.FirstOrDefault(); return array.FirstOrDefault();
} }
Par[] array2 = array; Par[] array2 = array;
foreach (Par p0 in array2) foreach (Par p0 in array2)
{ {
Vector2D p = p0.Position; Vector2D p = p0.Position;
if (array.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance)))) if (array.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance))))
{ {
return p0; return p0;
} }
} }
Par par = array.FirstOrDefault((Par e) => e.JP.Count > 0); Par par = array.FirstOrDefault((Par e) => e.JP.Count > 0);
if (par != null) if (par != null)
{ {
return par; return par;
} }
return array.First(); return array.First();
} }
public void SetJoints() public void SetJoints()
{ {
pj = new Dictionary<Pars, Joints>(); pj = new Dictionary<Pars, Joints>();
pr = new Dictionary<Pars, Par>(); pr = new Dictionary<Pars, Par>();
foreach (Pars item in EnumAllPars()) foreach (Pars item in EnumAllPars())
{ {
Par joinRoot = GetJoinRoot(item); Par joinRoot = GetJoinRoot(item);
if (joinRoot != null) if (joinRoot != null)
{ {
pj.Add(item, joinRoot.GetJoints(item.EnumAllPar())); pj.Add(item, joinRoot.GetJoints(item.EnumAllPar()));
pr.Add(item, joinRoot); pr.Add(item, joinRoot);
} }
} }
} }
public void JoinP() public void JoinP()
{ {
pj[Current].JoinP(); pj[Current].JoinP();
} }
public void JoinPA() public void JoinPA()
{ {
pj[Current].JoinPA(); pj[Current].JoinPA();
} }
public void JoinPall() public void JoinPall()
{ {
foreach (Joints value in pj.Values) foreach (Joints value in pj.Values)
{ {
value.JoinP(); value.JoinP();
} }
} }
public void JoinPAall() public void JoinPAall()
{ {
foreach (Joints value in pj.Values) foreach (Joints value in pj.Values)
{ {
value.JoinPA(); value.JoinPA();
} }
} }
public void JoinP(Pars ps) public void JoinP(Pars ps)
{ {
if (pj.ContainsKey(ps)) if (pj.ContainsKey(ps))
{ {
pj[ps].JoinP(); pj[ps].JoinP();
} }
} }
public void JoinPA(Pars ps) public void JoinPA(Pars ps)
{ {
if (pj.ContainsKey(ps)) if (pj.ContainsKey(ps))
{ {
pj[ps].JoinPA(); pj[ps].JoinPA();
} }
} }
public Par GetHitPar_(Color HitColor) public Par GetHitPar_(Color HitColor)
{ {
return difs.FirstOrDefault((Dif d) => d.IsHit(ref HitColor)).Parss.FirstOrDefault((Pars ps) => ps.IsHit(ref HitColor)).EnumAllPar().FirstOrDefault((Par e) => e.HitColor == HitColor); return difs.FirstOrDefault((Dif d) => d.IsHit(ref HitColor)).Parss.FirstOrDefault((Pars ps) => ps.IsHit(ref HitColor)).EnumAllPar().FirstOrDefault((Par e) => e.HitColor == HitColor);
} }
public List<string> GetHitTags(ref Color HitColor) public List<string> GetHitTags(ref Color HitColor)
{ {
List<string> list = new List<string>(); List<string> list = new List<string>();
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
list.AddRange(dif.GetHitTags(ref HitColor)); list.AddRange(dif.GetHitTags(ref HitColor));
} }
return list; return list;
} }
public List<Par> GetHitPars(ref Color HitColor) public List<Par> GetHitPars(ref Color HitColor)
{ {
List<Par> list = new List<Par>(); List<Par> list = new List<Par>();
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
list.AddRange(dif.GetHitPars(ref HitColor)); list.AddRange(dif.GetHitPars(ref HitColor));
} }
return list; return list;
} }
public bool IsHit(ref Color HitColor) public bool IsHit(ref Color HitColor)
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
if (dif.IsHit(ref HitColor)) if (dif.IsHit(ref HitColor))
{ {
return true; return true;
} }
} }
return false; return false;
} }
public void ReverseX() public void ReverseX()
{ {
SetJoints(); SetJoints();
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.ReverseX(); dif.ReverseX();
} }
JoinP(); JoinP();
} }
public void ReverseY() public void ReverseY()
{ {
SetJoints(); SetJoints();
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.ReverseY(); dif.ReverseY();
} }
JoinP(); JoinP();
} }
public void Dispose() public void Dispose()
{ {
foreach (Dif dif in difs) foreach (Dif dif in difs)
{ {
dif.Dispose(); dif.Dispose();
} }
} }
}
} }

View File

@@ -1,38 +1,39 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class FPS
{ {
public Stopwatch sw = new Stopwatch(); public class FPS
{
public Stopwatch sw = new Stopwatch();
private long last_frame; private long last_frame;
public double Value; public double Value;
private int count; private int count;
private double ticks_per_frame; private double ticks_per_frame;
public FPS(double FPS) public FPS(double FPS)
{ {
Value = FPS; Value = FPS;
ticks_per_frame = (double)Stopwatch.Frequency / FPS; ticks_per_frame = (double)Stopwatch.Frequency / FPS;
sw.Start(); sw.Start();
last_frame = sw.ElapsedTicks; last_frame = sw.ElapsedTicks;
} }
public void FPSFixed(Action Action) public void FPSFixed(Action Action)
{ {
long current_time = sw.ElapsedTicks; long current_time = sw.ElapsedTicks;
if (current_time - last_frame >= ticks_per_frame) if (current_time - last_frame >= ticks_per_frame)
{ {
Action(); Action();
Value = (9 * Value + ((double)Stopwatch.Frequency / (sw.ElapsedTicks - last_frame)))/10; Value = (9 * Value + ((double)Stopwatch.Frequency / (sw.ElapsedTicks - last_frame)))/10;
last_frame = current_time; last_frame = current_time;
} }
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,306 +1,307 @@
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class HSV
{ {
public static void ToHSV(int r, int g, int b, out int h, out int s, out int v) public static class HSV
{ {
v = GetMax(r, g, b); public static void ToHSV(int r, int g, int b, out int h, out int s, out int v)
int num = v - GetMin(r, g, b); {
if (num == 0) v = GetMax(r, g, b);
{ int num = v - GetMin(r, g, b);
s = 0; if (num == 0)
} {
else s = 0;
{ }
s = (int)((double)(num * 255) / (double)v); else
} {
if (s == 0) s = (int)((double)(num * 255) / (double)v);
{ }
h = 0; if (s == 0)
return; {
} h = 0;
double num2 = num; return;
if (r == v) }
{ double num2 = num;
h = v - (int)((double)(b * 60) / num2) - (v - (int)((double)(g * 60) / num2)); if (r == v)
} {
else if (g == v) h = v - (int)((double)(b * 60) / num2) - (v - (int)((double)(g * 60) / num2));
{ }
h = 120 + (v - (int)((double)(r * 60) / num2)) - (v - (int)((double)(b * 60) / num2)); else if (g == v)
} {
else h = 120 + (v - (int)((double)(r * 60) / num2)) - (v - (int)((double)(b * 60) / num2));
{ }
h = 240 + (v - (int)((double)(g * 60) / num2)) - (v - (int)((double)(r * 60) / num2)); else
} {
if (h < 0) h = 240 + (v - (int)((double)(g * 60) / num2)) - (v - (int)((double)(r * 60) / num2));
{ }
h += 360; if (h < 0)
} {
} h += 360;
}
}
public static void ToRGB(int h, int s, int v, out int r, out int g, out int b) public static void ToRGB(int h, int s, int v, out int r, out int g, out int b)
{ {
if (s == 0) if (s == 0)
{ {
r = (g = (b = v)); r = (g = (b = v));
return; return;
} }
int num = h * 6; int num = h * 6;
switch (num / 360) switch (num / 360)
{ {
case 0: case 0:
r = v; r = v;
g = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0); g = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
b = (int)((double)(v * (255 - s)) / 255.0); b = (int)((double)(v * (255 - s)) / 255.0);
break; break;
case 1: case 1:
r = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0); r = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
g = v; g = v;
b = (int)((double)(v * (255 - s)) / 255.0); b = (int)((double)(v * (255 - s)) / 255.0);
break; break;
case 2: case 2:
r = (int)((double)(v * (255 - s)) / 255.0); r = (int)((double)(v * (255 - s)) / 255.0);
g = v; g = v;
b = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0); b = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
break; break;
case 3: case 3:
r = (int)((double)(v * (255 - s)) / 255.0); r = (int)((double)(v * (255 - s)) / 255.0);
g = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0); g = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
b = v; b = v;
break; break;
case 4: case 4:
r = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0); r = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
g = (int)((double)(v * (255 - s)) / 255.0); g = (int)((double)(v * (255 - s)) / 255.0);
b = v; b = v;
break; break;
default: default:
r = v; r = v;
g = (int)((double)(v * (255 - s)) / 255.0); g = (int)((double)(v * (255 - s)) / 255.0);
b = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0); b = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
break; break;
} }
} }
public static void ToHSV(this Color col, out int h, out int s, out int v) public static void ToHSV(this Color col, out int h, out int s, out int v)
{ {
ToHSV(col.R, col.G, col.B, out h, out s, out v); ToHSV(col.R, col.G, col.B, out h, out s, out v);
} }
public static void ToHSV(ref Color col, out int h, out int s, out int v) public static void ToHSV(ref Color col, out int h, out int s, out int v)
{ {
ToHSV(col.R, col.G, col.B, out h, out s, out v); ToHSV(col.R, col.G, col.B, out h, out s, out v);
} }
public static void ToRGB(int h, int s, int v, out Color ret) public static void ToRGB(int h, int s, int v, out Color ret)
{ {
ToRGB(h, s, v, out var r, out var g, out var b); ToRGB(h, s, v, out var r, out var g, out var b);
ret = Color.FromArgb(r, g, b); ret = Color.FromArgb(r, g, b);
} }
public static void ToRGB(int h, int s, int v, int a, out Color ret) public static void ToRGB(int h, int s, int v, int a, out Color ret)
{ {
ToRGB(h, s, v, out var r, out var g, out var b); ToRGB(h, s, v, out var r, out var g, out var b);
ret = Color.FromArgb(a, r, g, b); ret = Color.FromArgb(a, r, g, b);
} }
public static void ToRGB(this Hsv hsv, out int r, out int g, out int b) public static void ToRGB(this Hsv hsv, out int r, out int g, out int b)
{ {
ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b); ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
} }
public static void ToRGB(ref Hsv hsv, out int r, out int g, out int b) public static void ToRGB(ref Hsv hsv, out int r, out int g, out int b)
{ {
ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b); ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
} }
public static Hsv ToHSV(int r, int g, int b) public static Hsv ToHSV(int r, int g, int b)
{ {
Hsv result = default(Hsv); Hsv result = default(Hsv);
ToHSV(r, g, b, out result.H, out result.S, out result.V); ToHSV(r, g, b, out result.H, out result.S, out result.V);
return result; return result;
} }
public static Hsv ToHSV(this Color col) public static Hsv ToHSV(this Color col)
{ {
Hsv result = default(Hsv); Hsv result = default(Hsv);
ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V); ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
return result; return result;
} }
public static Hsv ToHSV(ref Color col) public static Hsv ToHSV(ref Color col)
{ {
Hsv result = default(Hsv); Hsv result = default(Hsv);
ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V); ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
return result; return result;
} }
public static Color ToRGB(this Hsv hsv) public static Color ToRGB(this Hsv hsv)
{ {
ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b); ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
return Color.FromArgb(r, g, b); return Color.FromArgb(r, g, b);
} }
public static Color ToRGB(ref Hsv hsv) public static Color ToRGB(ref Hsv hsv)
{ {
ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b); ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
return Color.FromArgb(r, g, b); return Color.FromArgb(r, g, b);
} }
private static int GetMax(int x, int y, int z) private static int GetMax(int x, int y, int z)
{ {
if (x < y) if (x < y)
{ {
if (z >= y) if (z >= y)
{ {
return z; return z;
} }
return y; return y;
} }
if (z < x) if (z < x)
{ {
return x; return x;
} }
return z; return z;
} }
private static int GetMin(int x, int y, int z) private static int GetMin(int x, int y, int z)
{ {
if (x > y) if (x > y)
{ {
if (z <= y) if (z <= y)
{ {
return z; return z;
} }
return y; return y;
} }
if (z > x) if (z > x)
{ {
return x; return x;
} }
return z; return z;
} }
} }
public struct Hsv public struct Hsv
{ {
public int H; public int H;
public int S; public int S;
public int V; public int V;
public int Hue public int Hue
{ {
get get
{ {
return H; return H;
} }
set set
{ {
H = value; H = value;
HueLimit(); HueLimit();
} }
} }
public int Sat public int Sat
{ {
get get
{ {
return S; return S;
} }
set set
{ {
S = value; S = value;
SatLimit(); SatLimit();
} }
} }
public int Val public int Val
{ {
get get
{ {
return V; return V;
} }
set set
{ {
V = value; V = value;
ValLimit(); ValLimit();
} }
} }
public Hsv(Color Color) public Hsv(Color Color)
{ {
HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V); HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V);
} }
public Hsv(ref Color Color) public Hsv(ref Color Color)
{ {
HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V); HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V);
} }
public Hsv(int Hue, int Sat, int Val) public Hsv(int Hue, int Sat, int Val)
{ {
H = Hue; H = Hue;
S = Sat; S = Sat;
V = Val; V = Val;
} }
private void HueLimit() private void HueLimit()
{ {
H %= 360; H %= 360;
} }
private void SatLimit() private void SatLimit()
{ {
if (S > 255) if (S > 255)
{ {
S = 255; S = 255;
} }
else if (S < 0) else if (S < 0)
{ {
S = 0; S = 0;
} }
} }
private void ValLimit() private void ValLimit()
{ {
if (V > 255) if (V > 255)
{ {
V = 255; V = 255;
} }
else if (V < 0) else if (V < 0)
{ {
V = 0; V = 0;
} }
} }
public Color GetColor() public Color GetColor()
{ {
HSV.ToRGB(H, S, V, out var r, out var g, out var b); HSV.ToRGB(H, S, V, out var r, out var g, out var b);
return Color.FromArgb(r, g, b); return Color.FromArgb(r, g, b);
} }
public Color GetColor(int a) public Color GetColor(int a)
{ {
HSV.ToRGB(H, S, V, out var r, out var g, out var b); HSV.ToRGB(H, S, V, out var r, out var g, out var b);
return Color.FromArgb(a, r, g, b); return Color.FromArgb(a, r, g, b);
} }
public void GetColor(out Color ret) public void GetColor(out Color ret)
{ {
HSV.ToRGB(H, S, V, out var r, out var g, out var b); HSV.ToRGB(H, S, V, out var r, out var g, out var b);
ret = Color.FromArgb(r, g, b); ret = Color.FromArgb(r, g, b);
} }
public void GetColor(int a, out Color ret) public void GetColor(int a, out Color ret)
{ {
HSV.ToRGB(H, S, V, out var r, out var g, out var b); HSV.ToRGB(H, S, V, out var r, out var g, out var b);
ret = Color.FromArgb(a, r, g, b); ret = Color.FromArgb(a, r, g, b);
} }
public override string ToString() public override string ToString()
{ {
return "H : " + H + " S : " + S + " V : " + V; return "H : " + H + " S : " + S + " V : " + V;
} }
}
} }

View File

@@ -1,31 +1,32 @@
using System; using System;
using System.IO; using System.IO;
namespace _2DGAMELIB; namespace _2DGAMELIB
//its the position of a joint
[Serializable]
public class Joi
{ {
public Vector2D Joint = Dat.Vec2DZero;
public Joi() //its the position of a joint
{ [Serializable]
} public class Joi
{
public Vector2D Joint = Dat.Vec2DZero;
public Joi(Joi Joi) public Joi()
{ {
Joint = Joi.Joint; }
}
public Joi(Vector2D Joint) public Joi(Joi Joi)
{ {
this.Joint = Joint; Joint = Joi.Joint;
} }
public Joi(ref Vector2D Joint) public Joi(Vector2D Joint)
{ {
this.Joint = Joint; this.Joint = Joint;
} }
public Joi(ref Vector2D Joint)
{
this.Joint = Joint;
}
}
} }

View File

@@ -2,195 +2,196 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class Join
{ {
public static double IdentityDistance = System.Math.Pow(5E-05, 2.0); public static class Join
{
public static double IdentityDistance = System.Math.Pow(5E-05, 2.0);
public static Joints GetJoints(this Par JoinRoot, IEnumerable<Par> EnumPar) public static Joints GetJoints(this Par JoinRoot, IEnumerable<Par> EnumPar)
{ {
Joints joints = new Joints(); Joints joints = new Joints();
int num = 0; int num = 0;
List<int> list = new List<int>(); List<int> list = new List<int>();
List<Par> list2 = EnumPar.ToList(); List<Par> list2 = EnumPar.ToList();
foreach (Joi item in JoinRoot.JP) foreach (Joi item in JoinRoot.JP)
{ {
Vector2D v = JoinRoot.ToGlobal(item.Joint); Vector2D v = JoinRoot.ToGlobal(item.Joint);
int num2 = 0; int num2 = 0;
list.Clear(); list.Clear();
foreach (Par item2 in list2) foreach (Par item2 in list2)
{ {
if (JoinRoot != item2) if (JoinRoot != item2)
{ {
if (v.DistanceSquared(item2.Position) <= IdentityDistance) if (v.DistanceSquared(item2.Position) <= IdentityDistance)
{ {
joints.Joins.Add(new Joint(JoinRoot, num, item2)); joints.Joins.Add(new Joint(JoinRoot, num, item2));
if (!list.Contains(num2)) if (!list.Contains(num2))
{ {
list.Add(num2); list.Add(num2);
} }
} }
} }
else if (!list.Contains(num2)) else if (!list.Contains(num2))
{ {
list.Add(num2); list.Add(num2);
} }
num2++; num2++;
} }
for (int num3 = list.Count - 1; num3 > -1; num3--) for (int num3 = list.Count - 1; num3 > -1; num3--)
{ {
list2.RemoveAt(list[num3]); list2.RemoveAt(list[num3]);
} }
num++; num++;
} }
GetJoints(list2, joints, list); GetJoints(list2, joints, list);
return joints; return joints;
} }
private static void GetJoints(List<Par> pl, Joints js, List<int> del) private static void GetJoints(List<Par> pl, Joints js, List<int> del)
{ {
int num = -1; int num = -1;
int num2 = 0; int num2 = 0;
while (num != js.Joins.Count) while (num != js.Joins.Count)
{ {
num = js.Joins.Count; num = js.Joins.Count;
for (int i = num2; i < num; i++) for (int i = num2; i < num; i++)
{ {
Par par = js.Joins[i].Par1; Par par = js.Joins[i].Par1;
int num3 = 0; int num3 = 0;
foreach (Joi item in par.JP) foreach (Joi item in par.JP)
{ {
Vector2D v = par.ToGlobal(item.Joint); Vector2D v = par.ToGlobal(item.Joint);
int num4 = 0; int num4 = 0;
del.Clear(); del.Clear();
foreach (Par item2 in pl) foreach (Par item2 in pl)
{ {
if (par != item2) if (par != item2)
{ {
if (v.DistanceSquared(item2.Position) <= IdentityDistance) if (v.DistanceSquared(item2.Position) <= IdentityDistance)
{ {
js.Joins.Add(new Joint(par, num3, item2)); js.Joins.Add(new Joint(par, num3, item2));
if (!del.Contains(num4)) if (!del.Contains(num4))
{ {
del.Add(num4); del.Add(num4);
} }
} }
} }
else if (!del.Contains(num4)) else if (!del.Contains(num4))
{ {
del.Add(num4); del.Add(num4);
} }
num4++; num4++;
} }
for (int num5 = del.Count - 1; num5 > -1; num5--) for (int num5 = del.Count - 1; num5 > -1; num5--)
{ {
pl.RemoveAt(del[num5]); pl.RemoveAt(del[num5]);
} }
num3++; num3++;
} }
} }
num2 = num; num2 = num;
} }
} }
public static JointsD GetJointsD(this Difs JoinRoot, IEnumerable<Difs> EnumDifs) public static JointsD GetJointsD(this Difs JoinRoot, IEnumerable<Difs> EnumDifs)
{ {
JointsD jointsD = new JointsD(); JointsD jointsD = new JointsD();
List<int> list = new List<int>(); List<int> list = new List<int>();
List<Difs> list2 = EnumDifs.ToList(); List<Difs> list2 = EnumDifs.ToList();
foreach (Par item in JoinRoot.EnumAllPar()) foreach (Par item in JoinRoot.EnumAllPar())
{ {
int num = 0; int num = 0;
list.Clear(); list.Clear();
foreach (Difs item2 in list2) foreach (Difs item2 in list2)
{ {
if (JoinRoot != item2) if (JoinRoot != item2)
{ {
int num2 = 0; int num2 = 0;
foreach (Joi item3 in item.JP) foreach (Joi item3 in item.JP)
{ {
Vector2D v = item.ToGlobal(item3.Joint); Vector2D v = item.ToGlobal(item3.Joint);
foreach (Par item4 in item2.EnumJoinRoot) foreach (Par item4 in item2.EnumJoinRoot)
{ {
if (v.DistanceSquared(item4.Position) <= IdentityDistance) if (v.DistanceSquared(item4.Position) <= IdentityDistance)
{ {
jointsD.Joins.Add(new JointD(JoinRoot, item, num2, item2)); jointsD.Joins.Add(new JointD(JoinRoot, item, num2, item2));
if (!list.Contains(num)) if (!list.Contains(num))
{ {
list.Add(num); list.Add(num);
} }
break; break;
} }
} }
num2++; num2++;
} }
} }
else if (!list.Contains(num)) else if (!list.Contains(num))
{ {
list.Add(num); list.Add(num);
} }
num++; num++;
} }
for (int num3 = list.Count - 1; num3 > -1; num3--) for (int num3 = list.Count - 1; num3 > -1; num3--)
{ {
list2.RemoveAt(list[num3]); list2.RemoveAt(list[num3]);
} }
} }
GetJointsD(list2, jointsD, list); GetJointsD(list2, jointsD, list);
return jointsD; return jointsD;
} }
private static void GetJointsD(List<Difs> dl, JointsD jsd, List<int> del) private static void GetJointsD(List<Difs> dl, JointsD jsd, List<int> del)
{ {
int num = -1; int num = -1;
int num2 = 0; int num2 = 0;
while (num != jsd.Joins.Count) while (num != jsd.Joins.Count)
{ {
num = jsd.Joins.Count; num = jsd.Joins.Count;
for (int i = num2; i < num; i++) for (int i = num2; i < num; i++)
{ {
Difs difs = jsd.Joins[i].Difs1; Difs difs = jsd.Joins[i].Difs1;
foreach (Par item in difs.EnumAllPar()) foreach (Par item in difs.EnumAllPar())
{ {
int num3 = 0; int num3 = 0;
del.Clear(); del.Clear();
foreach (Difs item2 in dl) foreach (Difs item2 in dl)
{ {
if (difs != item2) if (difs != item2)
{ {
int num4 = 0; int num4 = 0;
foreach (Joi item3 in item.JP) foreach (Joi item3 in item.JP)
{ {
Vector2D v = item.ToGlobal(item3.Joint); Vector2D v = item.ToGlobal(item3.Joint);
foreach (Par item4 in item2.EnumJoinRoot) foreach (Par item4 in item2.EnumJoinRoot)
{ {
if (v.DistanceSquared(item4.Position) <= IdentityDistance) if (v.DistanceSquared(item4.Position) <= IdentityDistance)
{ {
jsd.Joins.Add(new JointD(difs, item, num4, item2)); jsd.Joins.Add(new JointD(difs, item, num4, item2));
if (!del.Contains(num3)) if (!del.Contains(num3))
{ {
del.Add(num3); del.Add(num3);
} }
break; break;
} }
} }
num4++; num4++;
} }
} }
else if (!del.Contains(num3)) else if (!del.Contains(num3))
{ {
del.Add(num3); del.Add(num3);
} }
num3++; num3++;
} }
for (int num5 = del.Count - 1; num5 > -1; num5--) for (int num5 = del.Count - 1; num5 > -1; num5--)
{ {
dl.RemoveAt(del[num5]); dl.RemoveAt(del[num5]);
} }
} }
} }
num2 = num; num2 = num;
} }
} }
}
} }

View File

@@ -1,30 +1,31 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class Joint
{ {
public Par Par0; [Serializable]
public class Joint
{
public Par Par0;
public int Index; public int Index;
public Par Par1; public Par Par1;
public Joint(Par Par0, int Index, Par Par1) public Joint(Par Par0, int Index, Par Par1)
{ {
this.Par0 = Par0; this.Par0 = Par0;
this.Index = Index; this.Index = Index;
this.Par1 = Par1; this.Par1 = Par1;
} }
public void JoinP() public void JoinP()
{ {
Par0.SetJointP(Index, Par1); Par0.SetJointP(Index, Par1);
} }
public void JoinPA() public void JoinPA()
{ {
Par0.SetJointPA(Index, Par1); Par0.SetJointPA(Index, Par1);
} }
}
} }

View File

@@ -1,72 +1,73 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class JointD
{ {
public Difs Difs0; [Serializable]
public class JointD
{
public Difs Difs0;
public List<int> Path0; public List<int> Path0;
public int Index; public int Index;
public Difs Difs1; public Difs Difs1;
public JointD(Difs Difs0, Par Par0, int Index, Difs Difs1) public JointD(Difs Difs0, Par Par0, int Index, Difs Difs1)
{ {
this.Difs0 = Difs0; this.Difs0 = Difs0;
Path0 = Par0.GetPath(); Path0 = Par0.GetPath();
this.Index = Index; this.Index = Index;
this.Difs1 = Difs1; this.Difs1 = Difs1;
} }
public JointD(Difs Difs1) public JointD(Difs Difs1)
{ {
this.Difs1 = Difs1; this.Difs1 = Difs1;
} }
public void JoinP() public void JoinP()
{ {
Difs0.Current.GetPar(Path0).SetJointP(Index, Difs1.CurJoinRoot); Difs0.Current.GetPar(Path0).SetJointP(Index, Difs1.CurJoinRoot);
Difs1.JoinPA(); Difs1.JoinPA();
} }
public void JoinPA() public void JoinPA()
{ {
Difs0.Current.GetPar(Path0).SetJointPA(Index, Difs1.CurJoinRoot); Difs0.Current.GetPar(Path0).SetJointPA(Index, Difs1.CurJoinRoot);
Difs1.JoinPA(); Difs1.JoinPA();
} }
public void JoinPall() public void JoinPall()
{ {
foreach (Par item in Difs1.EnumJoinRoot) foreach (Par item in Difs1.EnumJoinRoot)
{ {
Difs0.Current.GetPar(Path0).SetJointP(Index, item); Difs0.Current.GetPar(Path0).SetJointP(Index, item);
} }
foreach (Pars item2 in Difs1.EnumAllPars()) foreach (Pars item2 in Difs1.EnumAllPars())
{ {
Difs1.JoinPA(item2); Difs1.JoinPA(item2);
} }
} }
public void JoinPAall() public void JoinPAall()
{ {
foreach (Par item in Difs1.EnumJoinRoot) foreach (Par item in Difs1.EnumJoinRoot)
{ {
Difs0.Current.GetPar(Path0).SetJointPA(Index, item); Difs0.Current.GetPar(Path0).SetJointPA(Index, item);
} }
foreach (Pars item2 in Difs1.EnumAllPars()) foreach (Pars item2 in Difs1.EnumAllPars())
{ {
Difs1.JoinPA(item2); Difs1.JoinPA(item2);
} }
} }
public void Set(JointS ) public void Set(JointS )
{ {
Difs0 = .Difs; Difs0 = .Difs;
Path0 = .Path; Path0 = .Path;
Index = .Index; Index = .Index;
} }
}
} }

View File

@@ -1,46 +1,47 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class Joints
{ {
public List<Joint> Joins = new List<Joint>(); [Serializable]
public class Joints
{
public List<Joint> Joins = new List<Joint>();
public void JoinP() public void JoinP()
{ {
foreach (Joint join in Joins) foreach (Joint join in Joins)
{ {
join.JoinP(); join.JoinP();
} }
} }
public void JoinPA() public void JoinPA()
{ {
foreach (Joint join in Joins) foreach (Joint join in Joins)
{ {
join.JoinPA(); join.JoinPA();
} }
} }
} }
[Serializable] [Serializable]
public class JointS public class JointS
{ {
public Difs Difs; public Difs Difs;
public List<int> Path; public List<int> Path;
public int Index; public int Index;
public JointS() public JointS()
{ {
} }
public JointS(Difs Difs, Par Par, int Index) public JointS(Difs Difs, Par Par, int Index)
{ {
this.Difs = Difs; this.Difs = Difs;
Path = Par.GetPath(); Path = Par.GetPath();
this.Index = Index; this.Index = Index;
} }
}
} }

View File

@@ -1,42 +1,43 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class JointsD
{ {
public List<JointD> Joins = new List<JointD>(); [Serializable]
public class JointsD
{
public List<JointD> Joins = new List<JointD>();
public void JoinP() public void JoinP()
{ {
foreach (JointD join in Joins) foreach (JointD join in Joins)
{ {
join.JoinP(); join.JoinP();
} }
} }
public void JoinPA() public void JoinPA()
{ {
foreach (JointD join in Joins) foreach (JointD join in Joins)
{ {
join.JoinPA(); join.JoinPA();
} }
} }
public void JoinPall() public void JoinPall()
{ {
foreach (JointD join in Joins) foreach (JointD join in Joins)
{ {
join.JoinPall(); join.JoinPall();
} }
} }
public void JoinPAall() public void JoinPAall()
{ {
foreach (JointD join in Joins) foreach (JointD join in Joins)
{ {
join.JoinPAall(); join.JoinPAall();
} }
} }
}
} }

View File

@@ -1,181 +1,182 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Lab
{ {
private ParT parT; public class Lab
{
private ParT parT;
private Med Med; private Med Med;
private Are Are; private Are Are;
private double Width; private double Width;
private bool Input; private bool Input;
private double Min; private double Min;
public ParT ParT => parT; public ParT ParT => parT;
public string Text public string Text
{ {
get get
{ {
return parT.Text; return parT.Text;
} }
set set
{ {
//TODO fix?
//if (!Med.BaseControl.Contains(tb))
{
SetText(value);
}
}
}
private void SetText(string Text)
{
parT.Text = Text;
SetRect();
}
public Lab(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
{
//Note: Input is always false
Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
}
public Lab(Med Med, Are Are, string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input)
{
Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
}
private void Setting(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
{
this.Med = Med;
this.Are = Are;
this.Width = Width;
this.Input = Input;
Out[] array = new Out[1] { Shas.Get正方形() };
if (FramColor == Color.Empty || FramColor == Color.Transparent)
{
array.OutlineFalse();
}
parT = new ParT
{
Tag = Name,
InitializeOP = array,
BasePointBase = array[0].ps[0],
PositionBase = Position,
SizeBase = Size,
Closed = true,
BrushColor = BackColor,
PenColor = FramColor,
Font = Font,
FontSize = TextSize,
TextColor = TextColor,
Text = "A"
};
if (ShadColor != Color.Empty)
{
parT.ShadBrush = new SolidBrush(ShadColor);
}
SetRect();
Min = parT.RectSize.Y;
SetText(Text);
}
private void Lab_Resize(object sender, EventArgs e)
{
//TODO fix? //TODO fix?
//if (!Med.BaseControl.Contains(tb)) //Med.BaseControl.Controls.Remove(tb);
{ //SetText(tb.Text);
SetText(value); }
}
}
}
private void SetText(string Text) public void SetHitColor(Med Med)
{ {
parT.Text = Text; if (parT.HitColor != Color.Transparent)
SetRect(); {
} Med.RemUniqueColor(parT.HitColor);
}
parT.HitColor = Med.GetUniqueColor();
}
public Lab(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input) private void SetRect()
{ {
//Note: Input is always false if (!string.IsNullOrEmpty(parT.Text))
Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input); {
} parT.RectSize = new Vector2D(Width, 10.0);
Vector2D_2 stringRect = parT.GetStringRect(Are.DisUnit, Are.GD);
double x = ((stringRect.v2.X > Min) ? stringRect.v2.X : Min) + 0.07;
parT.RectSize = new Vector2D(x, stringRect.v2.Y);
}
else
{
double x2 = Min + 0.07;
parT.RectSize = new Vector2D(x2, Min);
}
parT.OP[0].ps[0] = new Vector2D(0.0, 0.0);
parT.OP[0].ps[1] = new Vector2D(parT.RectSize.X, 0.0);
parT.OP[0].ps[2] = new Vector2D(parT.RectSize.X, parT.RectSize.Y);
parT.OP[0].ps[3] = new Vector2D(0.0, parT.RectSize.Y);
}
public Lab(Med Med, Are Are, string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input) private void SetRectT()
{ {
Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input); /*
} double resMag = Med.ResMag;
Vector2D vector2D = (parT.Position + Are.GetPosition()) * Med.Unit / resMag + Med.ResVector;
private void Setting(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input) tb.Location = new Point((int)vector2D.X - 1, (int)vector2D.Y - 1);
{ double num = parT.Size * Med.Unit;
this.Med = Med;
this.Are = Are;
this.Width = Width;
this.Input = Input;
Out[] array = new Out[1] { Shas.Get正方形() }; if (tb.Font != null)
if (FramColor == Color.Empty || FramColor == Color.Transparent) {
{ tb.Font.Dispose();
array.OutlineFalse(); }
} tb.Font = new Font(parT.Font.FontFamily, (float)(parT.FontSize * num / resMag));
parT = new ParT Vector2D vector2D2 = parT.RectSize * num / resMag;
{ tb.Size = new Size((int)(vector2D2.X + 2.0), (int)(vector2D2.Y + 10.0));*/
Tag = Name, }
InitializeOP = array,
BasePointBase = array[0].ps[0],
PositionBase = Position,
SizeBase = Size,
Closed = true,
BrushColor = BackColor,
PenColor = FramColor,
Font = Font,
FontSize = TextSize,
TextColor = TextColor,
Text = "A"
};
if (ShadColor != Color.Empty)
{
parT.ShadBrush = new SolidBrush(ShadColor);
}
SetRect();
Min = parT.RectSize.Y;
SetText(Text);
}
private void Lab_Resize(object sender, EventArgs e) public bool Double(ref Color HitColor)
{ {
//TODO fix?
//Med.BaseControl.Controls.Remove(tb);
//SetText(tb.Text);
}
public void SetHitColor(Med Med)
{
if (parT.HitColor != Color.Transparent)
{
Med.RemUniqueColor(parT.HitColor);
}
parT.HitColor = Med.GetUniqueColor();
}
private void SetRect()
{
if (!string.IsNullOrEmpty(parT.Text))
{
parT.RectSize = new Vector2D(Width, 10.0);
Vector2D_2 stringRect = parT.GetStringRect(Are.DisUnit, Are.GD);
double x = ((stringRect.v2.X > Min) ? stringRect.v2.X : Min) + 0.07;
parT.RectSize = new Vector2D(x, stringRect.v2.Y);
}
else
{
double x2 = Min + 0.07;
parT.RectSize = new Vector2D(x2, Min);
}
parT.OP[0].ps[0] = new Vector2D(0.0, 0.0);
parT.OP[0].ps[1] = new Vector2D(parT.RectSize.X, 0.0);
parT.OP[0].ps[2] = new Vector2D(parT.RectSize.X, parT.RectSize.Y);
parT.OP[0].ps[3] = new Vector2D(0.0, parT.RectSize.Y);
}
private void SetRectT()
{
/*
double resMag = Med.ResMag;
Vector2D vector2D = (parT.Position + Are.GetPosition()) * Med.Unit / resMag + Med.ResVector;
tb.Location = new Point((int)vector2D.X - 1, (int)vector2D.Y - 1);
double num = parT.Size * Med.Unit;
if (tb.Font != null)
{
tb.Font.Dispose();
}
tb.Font = new Font(parT.Font.FontFamily, (float)(parT.FontSize * num / resMag));
Vector2D vector2D2 = parT.RectSize * num / resMag;
tb.Size = new Size((int)(vector2D2.X + 2.0), (int)(vector2D2.Y + 10.0));*/
}
public bool Double(ref Color HitColor)
{
//TODO fix?
//if (Input && parT.HitColor == HitColor && !Med.BaseControl.Controls.Contains(tb))
/*{
tb.Text = parT.Text;
parT.Text = "";
SetRectT();
//Med.BaseControl.Controls.Add(tb);
tb.SelectAll();
tb.Focus();
tb.BringToFront();
return true;
}*/
return false;
}
public void Click(ref Color HitColor)
{
//TODO fix?
/*if (Input && parT.HitColor != HitColor && Med.BaseControl.Controls.Contains(tb))
{
//Med.BaseControl.Controls.Remove(tb);
SetText(tb.Text);
}*/
}
public void Dispose()
{
parT.Dispose();
if (Input)
{
//TODO fix? //TODO fix?
//((Control)Med.BaseControl).Resize -= Lab_Resize; //if (Input && parT.HitColor == HitColor && !Med.BaseControl.Controls.Contains(tb))
} /*{
} tb.Text = parT.Text;
parT.Text = "";
SetRectT();
//Med.BaseControl.Controls.Add(tb);
tb.SelectAll();
tb.Focus();
tb.BringToFront();
return true;
}*/
return false;
}
public void Click(ref Color HitColor)
{
//TODO fix?
/*if (Input && parT.HitColor != HitColor && Med.BaseControl.Controls.Contains(tb))
{
//Med.BaseControl.Controls.Remove(tb);
SetText(tb.Text);
}*/
}
public void Dispose()
{
parT.Dispose();
if (Input)
{
//TODO fix?
//((Control)Med.BaseControl).Resize -= Lab_Resize;
}
}
}
} }

View File

@@ -1,79 +1,80 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Labs
{ {
private OrderedDictionary<string, Lab> labs = new OrderedDictionary<string, Lab>(); public class Labs
{
private OrderedDictionary<string, Lab> labs = new OrderedDictionary<string, Lab>();
private Med Med; private Med Med;
private Are Are; private Are Are;
public Lab this[string Name] => labs[Name]; public Lab this[string Name] => labs[Name];
public Labs(Med Med, Are Are) public Labs(Med Med, Are Are)
{ {
this.Med = Med; this.Med = Med;
this.Are = Are; this.Are = Are;
} }
public void Add(string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input) public void Add(string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input)
{ {
labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input)); labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input));
} }
public void Add(string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input) public void Add(string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
{ {
labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input)); labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input));
} }
public void Double(ref Color HitColor) public void Double(ref Color HitColor)
{ {
using IEnumerator<Lab> enumerator = labs.Values.GetEnumerator(); using IEnumerator<Lab> enumerator = labs.Values.GetEnumerator();
while (enumerator.MoveNext() && !enumerator.Current.Double(ref HitColor)) while (enumerator.MoveNext() && !enumerator.Current.Double(ref HitColor))
{ {
} }
} }
public void Click(ref Color HitColor) public void Click(ref Color HitColor)
{ {
foreach (Lab value in labs.Values) foreach (Lab value in labs.Values)
{ {
value.Click(ref HitColor); value.Click(ref HitColor);
} }
} }
public void SetHitColor(Med Med) public void SetHitColor(Med Med)
{ {
foreach (Lab value in labs.Values) foreach (Lab value in labs.Values)
{ {
value.SetHitColor(Med); value.SetHitColor(Med);
} }
} }
public void Draw(Are Are) public void Draw(Are Are)
{ {
foreach (Lab value in labs.Values) foreach (Lab value in labs.Values)
{ {
Are.Draw(value.ParT); Are.Draw(value.ParT);
} }
} }
public void Draw(AreM AreM) public void Draw(AreM AreM)
{ {
foreach (Lab value in labs.Values) foreach (Lab value in labs.Values)
{ {
AreM.Draw(value.ParT); AreM.Draw(value.ParT);
} }
} }
public void Dispose() public void Dispose()
{ {
foreach (Lab value in labs.Values) foreach (Lab value in labs.Values)
{ {
value.Dispose(); value.Dispose();
} }
} }
}
} }

View File

@@ -1,98 +1,99 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
//TODO remove these...
public static class Math
{ {
public static double RoundDown(this double Value, int Digits) //TODO remove these...
public static class Math
{ {
double num = System.Math.Pow(10.0, Digits); public static double RoundDown(this double Value, int Digits)
if (!(Value > 0.0))
{ {
return System.Math.Ceiling(Value * num) / num; double num = System.Math.Pow(10.0, Digits);
if (!(Value > 0.0))
{
return System.Math.Ceiling(Value * num) / num;
}
return System.Math.Floor(Value * num) / num;
} }
return System.Math.Floor(Value * num) / num;
}
public static double Inverse(this double Rate) public static double Inverse(this double Rate)
{
if (Rate == 0.0)
{ {
return 1.0; if (Rate == 0.0)
{
return 1.0;
}
return (double)System.Math.Sign(Rate) - Rate;
} }
return (double)System.Math.Sign(Rate) - Rate;
}
public static double Reciprocal(this double Rate) public static double Reciprocal(this double Rate)
{
if (Rate == 0.0)
{ {
return 1.0; if (Rate == 0.0)
{
return 1.0;
}
return 1.0 / Rate;
} }
return 1.0 / Rate; public static double ToRadian(this double Degree)
{
return System.Math.PI * Degree / 180.0;
}
public static double ToDegree(this double Radian)
{
return Radian * 180.0 / System.Math.PI;
}
public static double Pow(this double x, double n)
{
return System.Math.Pow(x, n);
}
public static double Sin(this double θ)
{
return System.Math.Sin(θ);
}
public static double Abs(this double x)
{
return System.Math.Abs(x);
}
public static int Abs(this int x)
{
return System.Math.Abs(x);
}
public static int Sign(this double x)
{
return System.Math.Sign(x);
}
public static int Sign(this int x)
{
return System.Math.Sign(x);
}
public static double Sqrt(this double x)
{
return System.Math.Sqrt(x);
}
public static double Max(this double a, double b)
{
return System.Math.Max(a, b);
}
public static int Clamp(this int Value, int Min, int Max)
{
return System.Math.Min(Max, System.Math.Max(Min, Value));
}
public static double Clamp(this double Value, double Min, double Max)
{
return System.Math.Min(Max, System.Math.Max(Min, Value));
}
public static int Limit(this int Value, int Sta, int Les)
{
return System.Math.Min(Les-1, System.Math.Max(Sta, Value));
}
} }
public static double ToRadian(this double Degree)
{
return System.Math.PI * Degree / 180.0;
}
public static double ToDegree(this double Radian)
{
return Radian * 180.0 / System.Math.PI;
}
public static double Pow(this double x, double n)
{
return System.Math.Pow(x, n);
}
public static double Sin(this double θ)
{
return System.Math.Sin(θ);
}
public static double Abs(this double x)
{
return System.Math.Abs(x);
}
public static int Abs(this int x)
{
return System.Math.Abs(x);
}
public static int Sign(this double x)
{
return System.Math.Sign(x);
}
public static int Sign(this int x)
{
return System.Math.Sign(x);
}
public static double Sqrt(this double x)
{
return System.Math.Sqrt(x);
}
public static double Max(this double a, double b)
{
return System.Math.Max(a, b);
}
public static int Clamp(this int Value, int Min, int Max)
{
return System.Math.Min(Max, System.Math.Max(Min, Value));
}
public static double Clamp(this double Value, double Min, double Max)
{
return System.Math.Min(Max, System.Math.Max(Min, Value));
}
public static int Limit(this int Value, int Sta, int Les)
{
return System.Math.Min(Les-1, System.Math.Max(Sta, Value));
}
} }

View File

@@ -1,154 +1,155 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class Matrix
{ {
public static MatrixD RotationZ(this double angle) public static class Matrix
{ {
MatrixD result = default(MatrixD); public static MatrixD RotationZ(this double angle)
result.M11 = System.Math.Cos(angle); {
result.M12 = System.Math.Sin(angle); MatrixD result = default(MatrixD);
result.M13 = 0.0; result.M11 = System.Math.Cos(angle);
result.M14 = 0.0; result.M12 = System.Math.Sin(angle);
result.M21 = 0.0 - result.M12; result.M13 = 0.0;
result.M22 = result.M11; result.M14 = 0.0;
result.M23 = 0.0; result.M21 = 0.0 - result.M12;
result.M24 = 0.0; result.M22 = result.M11;
result.M31 = 0.0; result.M23 = 0.0;
result.M32 = 0.0; result.M24 = 0.0;
result.M33 = 1.0; result.M31 = 0.0;
result.M34 = 0.0; result.M32 = 0.0;
result.M41 = 0.0; result.M33 = 1.0;
result.M42 = 0.0; result.M34 = 0.0;
result.M43 = 0.0; result.M41 = 0.0;
result.M44 = 1.0; result.M42 = 0.0;
return result; result.M43 = 0.0;
} result.M44 = 1.0;
return result;
}
public static void RotationZ(this double angle, out MatrixD result) public static void RotationZ(this double angle, out MatrixD result)
{ {
result.M11 = System.Math.Cos(angle); result.M11 = System.Math.Cos(angle);
result.M12 = System.Math.Sin(angle); result.M12 = System.Math.Sin(angle);
result.M13 = 0.0; result.M13 = 0.0;
result.M14 = 0.0; result.M14 = 0.0;
result.M21 = 0.0 - result.M12; result.M21 = 0.0 - result.M12;
result.M22 = result.M11; result.M22 = result.M11;
result.M23 = 0.0; result.M23 = 0.0;
result.M24 = 0.0; result.M24 = 0.0;
result.M31 = 0.0; result.M31 = 0.0;
result.M32 = 0.0; result.M32 = 0.0;
result.M33 = 1.0; result.M33 = 1.0;
result.M34 = 0.0; result.M34 = 0.0;
result.M41 = 0.0; result.M41 = 0.0;
result.M42 = 0.0; result.M42 = 0.0;
result.M43 = 0.0; result.M43 = 0.0;
result.M44 = 1.0; result.M44 = 1.0;
} }
public static Vector2D TransformCoordinate(this Vector2D coord, MatrixD transform) public static Vector2D TransformCoordinate(this Vector2D coord, MatrixD transform)
{ {
double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44); double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num); return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num);
} }
public static Vector2D TransformCoordinate(ref Vector2D coord, ref MatrixD transform) public static Vector2D TransformCoordinate(ref Vector2D coord, ref MatrixD transform)
{ {
double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44); double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num); return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num);
} }
public static void TransformCoordinate(this Vector2D coord, MatrixD transform, out Vector2D result) public static void TransformCoordinate(this Vector2D coord, MatrixD transform, out Vector2D result)
{ {
double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44); double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num; result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num;
result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num; result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num;
} }
public static void TransformCoordinate(ref Vector2D coord, ref MatrixD transform, out Vector2D result) public static void TransformCoordinate(ref Vector2D coord, ref MatrixD transform, out Vector2D result)
{ {
double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44); double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num; result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num;
result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num; result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num;
} }
public static Vector2D[] TransformCoordinate(this Vector2D[] coords, MatrixD transform) public static Vector2D[] TransformCoordinate(this Vector2D[] coords, MatrixD transform)
{ {
int num = coords.Length; int num = coords.Length;
Vector2D[] array = new Vector2D[num]; Vector2D[] array = new Vector2D[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44); double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2; array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2; array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
} }
return array; return array;
} }
public static Vector2D[] TransformCoordinate(this Vector2D[] coords, ref MatrixD transform) public static Vector2D[] TransformCoordinate(this Vector2D[] coords, ref MatrixD transform)
{ {
int num = coords.Length; int num = coords.Length;
Vector2D[] array = new Vector2D[num]; Vector2D[] array = new Vector2D[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44); double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2; array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2; array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
} }
return array; return array;
} }
public static void TransformCoordinate(this Vector2D[] coords, MatrixD transform, out Vector2D[] results) public static void TransformCoordinate(this Vector2D[] coords, MatrixD transform, out Vector2D[] results)
{ {
int num = coords.Length; int num = coords.Length;
results = new Vector2D[num]; results = new Vector2D[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44); double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2; results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2; results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
} }
} }
public static void TransformCoordinate(this Vector2D[] coords, ref MatrixD transform, out Vector2D[] results) public static void TransformCoordinate(this Vector2D[] coords, ref MatrixD transform, out Vector2D[] results)
{ {
int num = coords.Length; int num = coords.Length;
results = new Vector2D[num]; results = new Vector2D[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44); double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2; results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2; results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
} }
} }
public static Vector2D TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform) public static Vector2D TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform)
{ {
Vec.Subtract(ref coord, ref BasePoint, out coord); Vec.Subtract(ref coord, ref BasePoint, out coord);
TransformCoordinate(ref coord, ref transform, out var result); TransformCoordinate(ref coord, ref transform, out var result);
Vec.Add(ref result, ref BasePoint, out result); Vec.Add(ref result, ref BasePoint, out result);
return result; return result;
} }
public static Vector2D TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform) public static Vector2D TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform)
{ {
Vec.Subtract(ref coord, ref BasePoint, out var r); Vec.Subtract(ref coord, ref BasePoint, out var r);
TransformCoordinate(ref r, ref transform, out var result); TransformCoordinate(ref r, ref transform, out var result);
Vec.Add(ref result, ref BasePoint, out result); Vec.Add(ref result, ref BasePoint, out result);
return result; return result;
} }
public static void TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform, out Vector2D result) public static void TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform, out Vector2D result)
{ {
Vec.Subtract(ref coord, ref BasePoint, out coord); Vec.Subtract(ref coord, ref BasePoint, out coord);
TransformCoordinate(ref coord, ref transform, out result); TransformCoordinate(ref coord, ref transform, out result);
Vec.Add(ref result, ref BasePoint, out result); Vec.Add(ref result, ref BasePoint, out result);
} }
public static void TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform, out Vector2D result) public static void TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform, out Vector2D result)
{ {
Vec.Subtract(ref coord, ref BasePoint, out var r); Vec.Subtract(ref coord, ref BasePoint, out var r);
TransformCoordinate(ref r, ref transform, out result); TransformCoordinate(ref r, ref transform, out result);
Vec.Add(ref result, ref BasePoint, out result); Vec.Add(ref result, ref BasePoint, out result);
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -5,465 +5,466 @@ using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Med
{ {
public static object obj; public class Med
{
public static object obj;
private GlImage baseControl; private GlImage baseControl;
public double Unit = 1762.4; public double Unit = 1762.4;
public Rect Base = new Rect(4.0, 3.0, 0.4); public Rect Base = new Rect(4.0, 3.0, 0.4);
public double DisQuality = 1.0; public double DisQuality = 1.0;
public double HitAccuracy = 0.5; public double HitAccuracy = 0.5;
public Bitmap BD; public Bitmap BD;
public Graphics GD; public Graphics GD;
public Bitmap BH; public Bitmap BH;
public Graphics GH; public Graphics GH;
private Color ClearColor = Color.Transparent; private Color ClearColor = Color.Transparent;
public bool Drive = true; public bool Drive = true;
private Size BaseSize = Size.Empty; private Size BaseSize = Size.Empty;
private double resMag = 1.0; private double resMag = 1.0;
private Vector2D resVector = Dat.Vec2DZero; private Vector2D resVector = Dat.Vec2DZero;
private Sce Sce; private Sce Sce;
private string mode; private string mode;
public string Modeb; public string Modeb;
private Dictionary<string, Module> Modes; private Dictionary<string, Module> Modes;
private Func<Med, Dictionary<string, Module>> GetModes; private Func<Med, Dictionary<string, Module>> GetModes;
private int WidthM; private int WidthM;
private int HeightM; private int HeightM;
public static double FPS; public static double FPS;
public FPS FPSF = new FPS(FPS); public FPS FPSF = new FPS(FPS);
private bool cur = true; private bool cur = true;
public HashSet<Color> HitColors = new HashSet<Color> public HashSet<Color> HitColors = new HashSet<Color>
{ {
Color.Transparent, Color.Transparent,
Color.Black Color.Black
}; };
private const int LOGPIXELSX = 88; private const int LOGPIXELSX = 88;
private const int LOGPIXELSY = 90; private const int LOGPIXELSY = 90;
public static double dpiX; public static double dpiX;
public static double dpiY; public static double dpiY;
public static double DpiX; public static double DpiX;
public static double DpiY; public static double DpiY;
public string UITitle; public string UITitle;
public bool ShowFPS; public bool ShowFPS;
//public Control BaseControlC => baseControl; //public Control BaseControlC => baseControl;
public GlImage BaseControl => baseControl; public GlImage BaseControl => baseControl;
public double ResMag => resMag; public double ResMag => resMag;
public Vector2D ResVector => resVector; public Vector2D ResVector => resVector;
public string Mode public string Mode
{ {
get get
{ {
return mode; return mode;
} }
set set
{ {
Modes[mode].Up(MouseButtons.None, Dat.Vec2DZero, Color.Empty); Modes[mode].Up(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty); Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
Modeb = mode; Modeb = mode;
mode = value; mode = value;
Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty); Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
Modes[mode].Setting(); Modes[mode].Setting();
} }
} }
public Vector2D CursorPosition => ToBasePosition(baseControl.GetCursorPoint()); //ToBasePosition(baseControl.PointToClient(System.Windows.Forms.Cursor.Position)); public Vector2D CursorPosition => ToBasePosition(baseControl.GetCursorPoint()); //ToBasePosition(baseControl.PointToClient(System.Windows.Forms.Cursor.Position));
public Med() public Med()
{ {
Point dpi = GetDpi(); Point dpi = GetDpi();
dpiX = dpi.X; dpiX = dpi.X;
dpiY = dpi.Y; dpiY = dpi.Y;
DpiX = 96.0 / dpiX; DpiX = 96.0 / dpiX;
DpiY = 96.0 / dpiY; DpiY = 96.0 / dpiY;
} }
public void FadeIn(double Rate) public void FadeIn(double Rate)
{ {
Sce.TransformAlpha(GD, Rate); Sce.TransformAlpha(GD, Rate);
} }
public void FadeOut(double Rate) public void FadeOut(double Rate)
{ {
Sce.TransD(GD, Rate); Sce.TransD(GD, Rate);
} }
public void DrawStart(Are Are) public void DrawStart(Are Are)
{ {
Sce.DrawStart(Are); Sce.DrawStart(Are);
} }
public void DrawEnd(Are Are) public void DrawEnd(Are Are)
{ {
Sce.DrawEnd(Are); Sce.DrawEnd(Are);
} }
public void ClearSta(Color ClearColor) public void ClearSta(Color ClearColor)
{ {
Sce.ClearStart(ref ClearColor); Sce.ClearStart(ref ClearColor);
} }
public void InitializeModes(string Mode, Func<Med, Dictionary<string, Module>> GetModes) public void InitializeModes(string Mode, Func<Med, Dictionary<string, Module>> GetModes)
{ {
mode = Mode; mode = Mode;
this.GetModes = GetModes; this.GetModes = GetModes;
} }
public Size Setting(GlImage BaseControl) public Size Setting(GlImage BaseControl)
{ {
baseControl = BaseControl; baseControl = BaseControl;
BaseSize = new Size((int)(Base.LocalWidth * Unit), (int)(Base.LocalHeight * Unit)); BaseSize = new Size((int)(Base.LocalWidth * Unit), (int)(Base.LocalHeight * Unit));
BD = new Bitmap(BaseSize.Width, BaseSize.Height); BD = new Bitmap(BaseSize.Width, BaseSize.Height);
GD = Graphics.FromImage(BD); GD = Graphics.FromImage(BD);
GD.InterpolationMode = InterpolationMode.HighQualityBilinear; GD.InterpolationMode = InterpolationMode.HighQualityBilinear;
BH = new Bitmap((int)((double)BaseSize.Width * HitAccuracy), (int)((double)BaseSize.Height * HitAccuracy)); BH = new Bitmap((int)((double)BaseSize.Width * HitAccuracy), (int)((double)BaseSize.Height * HitAccuracy));
GH = Graphics.FromImage(BH); GH = Graphics.FromImage(BH);
GH.InterpolationMode = InterpolationMode.Bilinear; GH.InterpolationMode = InterpolationMode.Bilinear;
WidthM = BH.Width - 1; WidthM = BH.Width - 1;
HeightM = BH.Height - 1; HeightM = BH.Height - 1;
Clear(); Clear();
Sce = new Sce(BaseSize.Width, BaseSize.Height); Sce = new Sce(BaseSize.Width, BaseSize.Height);
Modes = GetModes(this); Modes = GetModes(this);
BaseControl.Click = delegate (IntPtr window, GLFW.MouseButton button, InputState state, GLFW.ModifierKeys modifiers) BaseControl.Click = delegate (IntPtr window, GLFW.MouseButton button, InputState state, GLFW.ModifierKeys modifiers)
{
double x, y;
Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
Point Position5 = new Point((int)x, (int)y);
MouseButtons arg2 = MouseButtons.None;
switch (button)
{ {
case GLFW.MouseButton.Left: double x, y;
arg2 = MouseButtons.Left; Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
break; Point Position5 = new Point((int)x, (int)y);
case GLFW.MouseButton.Middle: MouseButtons arg2 = MouseButtons.None;
arg2 = MouseButtons.Middle; switch (button)
break;
case GLFW.MouseButton.Right:
arg2 = MouseButtons.Right;
break;
case GLFW.MouseButton.Button4:
arg2 = MouseButtons.Button4;
break;
case GLFW.MouseButton.Button5:
arg2 = MouseButtons.Button5;
break;
}
(state == InputState.Press ? Modes[mode].Down : Modes[mode].Up)(arg2, ToBasePosition(Position5), GetHitColor(ref Position5));
};
BaseControl.Move = delegate (IntPtr window, double x, double y)
{
Point Position3 = new Point((int)x, (int)y);
Modes[mode].Move(BaseControl.GetMouseButtons(), ToBasePosition(Position3), GetHitColor(ref Position3));
};
BaseControl.Leave = delegate (IntPtr window, bool entered)
{
if (!entered)
{
double x, y;
Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
Point Position2 = new Point((int)x, (int)y);
Modes[mode].Leave(BaseControl.GetMouseButtons(), ToBasePosition(Position2), GetHitColor(ref Position2));
}
};
BaseControl.Scroll = delegate (IntPtr window, double xo, double yo)
{
double x, y;
Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
Point Position = new Point((int)x, (int)y);
//Note: yo may be inverted
Modes[mode].Wheel(BaseControl.GetMouseButtons(), ToBasePosition(Position), (int)yo, GetHitColor(ref Position));
};
BaseControl.Resize = delegate (IntPtr window, int width, int height)
{
//TODO mess with viewport
if (BaseSize.Width >= BaseSize.Height)
{
double num = (double)BaseSize.Width / (double)BaseSize.Height;
if ((double)width / (double)height <= num)
{ {
resMag = (double)BaseSize.Width / (double)width; case GLFW.MouseButton.Left:
resVector.X = 0.0; arg2 = MouseButtons.Left;
resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5; break;
case GLFW.MouseButton.Middle:
arg2 = MouseButtons.Middle;
break;
case GLFW.MouseButton.Right:
arg2 = MouseButtons.Right;
break;
case GLFW.MouseButton.Button4:
arg2 = MouseButtons.Button4;
break;
case GLFW.MouseButton.Button5:
arg2 = MouseButtons.Button5;
break;
}
(state == InputState.Press ? Modes[mode].Down : Modes[mode].Up)(arg2, ToBasePosition(Position5), GetHitColor(ref Position5));
};
BaseControl.Move = delegate (IntPtr window, double x, double y)
{
Point Position3 = new Point((int)x, (int)y);
Modes[mode].Move(BaseControl.GetMouseButtons(), ToBasePosition(Position3), GetHitColor(ref Position3));
};
BaseControl.Leave = delegate (IntPtr window, bool entered)
{
if (!entered)
{
double x, y;
Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
Point Position2 = new Point((int)x, (int)y);
Modes[mode].Leave(BaseControl.GetMouseButtons(), ToBasePosition(Position2), GetHitColor(ref Position2));
}
};
BaseControl.Scroll = delegate (IntPtr window, double xo, double yo)
{
double x, y;
Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
Point Position = new Point((int)x, (int)y);
//Note: yo may be inverted
Modes[mode].Wheel(BaseControl.GetMouseButtons(), ToBasePosition(Position), (int)yo, GetHitColor(ref Position));
};
BaseControl.Resize = delegate (IntPtr window, int width, int height)
{
//TODO mess with viewport
if (BaseSize.Width >= BaseSize.Height)
{
double num = (double)BaseSize.Width / (double)BaseSize.Height;
if ((double)width / (double)height <= num)
{
resMag = (double)BaseSize.Width / (double)width;
resVector.X = 0.0;
resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
}
else
{
resMag = (double)BaseSize.Height / (double)height;
resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5;
resVector.Y = 0.0;
}
} }
else else
{ {
resMag = (double)BaseSize.Height / (double)height; double num2 = (double)BaseSize.Height / (double)BaseSize.Width;
resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5; if ((double)height / (double)width <= num2)
resVector.Y = 0.0; {
resMag = (double)BaseSize.Height / (double)height;
resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5;
resVector.Y = 0.0;
}
else
{
resMag = (double)BaseSize.Width / (double)width;
resVector.X = 0.0;
resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
}
} }
} };
else
return BaseSize;
}
public Vector2D ToBasePosition(Point Position)
{
return new Vector2D(((double)Position.X - resVector.X) / Unit * resMag, ((double)Position.Y - resVector.Y) / Unit * resMag);
}
public Point FromBasePosition(Vector2D Position)
{
return new Point((int)(Position.X / resMag * Unit + resVector.X), (int)(Position.Y / resMag * Unit + resVector.Y));
}
public Color GetHitColor(Point Position)
{
double num = HitAccuracy * resMag;
Point point = ((Position.ToVector2D() - resVector) * num).ToPoint();
if (point.X < 0)
{
point.X = 0;
}
if (point.Y < 0)
{
point.Y = 0;
}
if (point.X > WidthM)
{
point.X = WidthM;
}
if (point.Y > HeightM)
{
point.Y = HeightM;
}
return BH.GetPixel(point.X, point.Y);
}
public Color GetHitColor(ref Point Position)
{
double num = HitAccuracy * resMag;
Point point = ((Position.ToVector2D() - resVector) * num).ToPoint();
if (point.X < 0)
{
point.X = 0;
}
if (point.Y < 0)
{
point.Y = 0;
}
if (point.X > WidthM)
{
point.X = WidthM;
}
if (point.Y > HeightM)
{
point.Y = HeightM;
}
return BH.GetPixel(point.X, point.Y);
}
public void Drawing()
{
baseControl.BitmapSetting(BD);
Modes[mode].Setting();
double FPS = 0.0;
Action action = delegate
{
FPS = FPSF.Value;
if (FPS > 1.0)
{
Modes[mode].Draw(FPSF);
}
baseControl.SetBitmap(BD);
};
while (Drive)
{
FPSF.FPSFixed(action);
if (ShowFPS)
{
baseControl.SetTitle(UITitle + " - FPS: " + System.Math.Round(FPSF.Value, 2));
}
baseControl.PollEvents();
}
}
public void Clear()
{
GD.Clear(ClearColor);
GH.Clear(ClearColor);
}
public void Draw(Are Are)
{
Are.Draw(GD, GH);
}
public void CursorHide()
{
if (cur)
{
//TODO fix?
//System.Windows.Forms.Cursor.Hide();
cur = false;
}
}
public void CursorShow()
{
if (!cur)
{ {
double num2 = (double)BaseSize.Height / (double)BaseSize.Width; //TODO fix?
if ((double)height / (double)width <= num2) //System.Windows.Forms.Cursor.Show();
{ cur = true;
resMag = (double)BaseSize.Height / (double)height; }
resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5; }
resVector.Y = 0.0;
}
else
{
resMag = (double)BaseSize.Width / (double)width;
resVector.X = 0.0;
resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
}
}
};
return BaseSize; public void InvokeL(Action a)
} {
//TODO this look right?
a();
//baseControl.Invoke(a);
}
public Vector2D ToBasePosition(Point Position) public Color GetUniqueColor()
{ {
return new Vector2D(((double)Position.X - resVector.X) / Unit * resMag, ((double)Position.Y - resVector.Y) / Unit * resMag); Oth.GetRandomColor(out var ret);
} while (HitColors.Contains(ret))
{
Oth.GetRandomColor(out ret);
}
HitColors.Add(ret);
return ret;
}
public Point FromBasePosition(Vector2D Position) public void GetUniqueColor(out Color c)
{ {
return new Point((int)(Position.X / resMag * Unit + resVector.X), (int)(Position.Y / resMag * Unit + resVector.Y)); Oth.GetRandomColor(out c);
} while (HitColors.Contains(c))
{
Oth.GetRandomColor(out c);
}
HitColors.Add(c);
}
public Color GetHitColor(Point Position) public void SetUniqueColor(IEnumerable<Par> ps)
{ {
double num = HitAccuracy * resMag; foreach (Par p in ps)
Point point = ((Position.ToVector2D() - resVector) * num).ToPoint(); {
if (point.X < 0) p.HitColor = GetUniqueColor();
{ }
point.X = 0; }
}
if (point.Y < 0)
{
point.Y = 0;
}
if (point.X > WidthM)
{
point.X = WidthM;
}
if (point.Y > HeightM)
{
point.Y = HeightM;
}
return BH.GetPixel(point.X, point.Y);
}
public Color GetHitColor(ref Point Position) public void RemUniqueColor(Color Color)
{ {
double num = HitAccuracy * resMag; HitColors.Remove(Color);
Point point = ((Position.ToVector2D() - resVector) * num).ToPoint(); }
if (point.X < 0)
{
point.X = 0;
}
if (point.Y < 0)
{
point.Y = 0;
}
if (point.X > WidthM)
{
point.X = WidthM;
}
if (point.Y > HeightM)
{
point.Y = HeightM;
}
return BH.GetPixel(point.X, point.Y);
}
public void Drawing() public void RemUniqueColor(IEnumerable<Par> ps)
{ {
baseControl.BitmapSetting(BD); foreach (Par p in ps)
Modes[mode].Setting(); {
double FPS = 0.0; HitColors.Remove(p.HitColor);
}
}
public void Dispose()
{
Drive = false;
foreach (Module value in Modes.Values)
{
value.Dispose();
}
BD.Dispose();
GD.Dispose();
BH.Dispose();
GH.Dispose();
Sce.Dispose();
}
Action action = delegate [DllImport("user32.dll")]
{ private static extern bool SetProcessDPIAware();
FPS = FPSF.Value;
if (FPS > 1.0)
{
Modes[mode].Draw(FPSF);
}
baseControl.SetBitmap(BD);
};
[DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hwnd);
while (Drive) [DllImport("gdi32.dll")]
{ private static extern int GetDeviceCaps(IntPtr hdc, int index);
FPSF.FPSFixed(action);
if (ShowFPS) [DllImport("user32.dll")]
{ private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
baseControl.SetTitle(UITitle + " - FPS: " + System.Math.Round(FPSF.Value, 2));
}
baseControl.PollEvents();
}
}
public void Clear() public static Point GetDpi()
{ {
GD.Clear(ClearColor); SetProcessDPIAware();
GH.Clear(ClearColor); IntPtr windowDC = GetWindowDC(IntPtr.Zero);
} Point result = new Point(GetDeviceCaps(windowDC, 88), GetDeviceCaps(windowDC, 90));
ReleaseDC(IntPtr.Zero, windowDC);
return result;
}
public void Draw(Are Are) static Med()
{ {
Are.Draw(GD, GH); obj = new object();
} FPS = 60.0;
}
public void CursorHide() }
{
if (cur)
{
//TODO fix?
//System.Windows.Forms.Cursor.Hide();
cur = false;
}
}
public void CursorShow()
{
if (!cur)
{
//TODO fix?
//System.Windows.Forms.Cursor.Show();
cur = true;
}
}
public void InvokeL(Action a)
{
//TODO this look right?
a();
//baseControl.Invoke(a);
}
public Color GetUniqueColor()
{
Oth.GetRandomColor(out var ret);
while (HitColors.Contains(ret))
{
Oth.GetRandomColor(out ret);
}
HitColors.Add(ret);
return ret;
}
public void GetUniqueColor(out Color c)
{
Oth.GetRandomColor(out c);
while (HitColors.Contains(c))
{
Oth.GetRandomColor(out c);
}
HitColors.Add(c);
}
public void SetUniqueColor(IEnumerable<Par> ps)
{
foreach (Par p in ps)
{
p.HitColor = GetUniqueColor();
}
}
public void RemUniqueColor(Color Color)
{
HitColors.Remove(Color);
}
public void RemUniqueColor(IEnumerable<Par> ps)
{
foreach (Par p in ps)
{
HitColors.Remove(p.HitColor);
}
}
public void Dispose()
{
Drive = false;
foreach (Module value in Modes.Values)
{
value.Dispose();
}
BD.Dispose();
GD.Dispose();
BH.Dispose();
GH.Dispose();
Sce.Dispose();
}
[DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
[DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hwnd);
[DllImport("gdi32.dll")]
private static extern int GetDeviceCaps(IntPtr hdc, int index);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
public static Point GetDpi()
{
SetProcessDPIAware();
IntPtr windowDC = GetWindowDC(IntPtr.Zero);
Point result = new Point(GetDeviceCaps(windowDC, 88), GetDeviceCaps(windowDC, 90));
ReleaseDC(IntPtr.Zero, windowDC);
return result;
}
static Med()
{
obj = new object();
FPS = 60.0;
}
} }

View File

@@ -1,39 +1,40 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Module
{ {
public Action<MouseButtons, Vector2D, Color> Down = delegate public class Module
{ {
}; public Action<MouseButtons, Vector2D, Color> Down = delegate
{
};
public Action<MouseButtons, Vector2D, Color> Up = delegate public Action<MouseButtons, Vector2D, Color> Up = delegate
{ {
}; };
public Action<MouseButtons, Vector2D, Color> Move = delegate public Action<MouseButtons, Vector2D, Color> Move = delegate
{ {
}; };
public Action<MouseButtons, Vector2D, Color> Leave = delegate public Action<MouseButtons, Vector2D, Color> Leave = delegate
{ {
}; };
public Action<MouseButtons, Vector2D, int, Color> Wheel = delegate public Action<MouseButtons, Vector2D, int, Color> Wheel = delegate
{ {
}; };
public Action<FPS> Draw = delegate public Action<FPS> Draw = delegate
{ {
}; };
public Action Dispose = delegate public Action Dispose = delegate
{ {
}; };
public Action Setting = delegate public Action Setting = delegate
{ {
}; };
}
} }

View File

@@ -1,76 +1,77 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Mot : MotV
{ {
public Action<Mot> Staing; public class Mot : MotV
{
public Action<Mot> Staing;
public Action<Mot> Runing; public Action<Mot> Runing;
public Action<Mot> Reaing; public Action<Mot> Reaing;
public Action<Mot> Rouing; public Action<Mot> Rouing;
public Action<Mot> Ending; public Action<Mot> Ending;
private bool run; private bool run;
private bool rou; private bool rou;
public bool Run => run; public bool Run => run;
public Mot(double Min, double Max) public Mot(double Min, double Max)
: base(Min, Max) : base(Min, Max)
{ {
} }
public new void GetValue(FPS FPS) public new void GetValue(FPS FPS)
{ {
if (!run) if (!run)
{ {
return; return;
} }
base.GetValue(FPS); base.GetValue(FPS);
if (Runing != null) if (Runing != null)
{ {
Runing(this); Runing(this);
} }
if (Value == min) if (Value == min)
{ {
if (rou && Rouing != null) if (rou && Rouing != null)
{ {
Rouing(this); Rouing(this);
} }
rou = false; rou = false;
} }
else if (Value == max) else if (Value == max)
{ {
if (Reaing != null) if (Reaing != null)
{ {
Reaing(this); Reaing(this);
} }
rou = true; rou = true;
} }
} }
public void Start() public void Start()
{ {
if (Staing != null) if (Staing != null)
{ {
Staing(this); Staing(this);
} }
run = true; run = true;
} }
public void End() public void End()
{ {
run = false; run = false;
if (Ending != null) if (Ending != null)
{ {
Ending(this); Ending(this);
} }
ResetValue(); ResetValue();
rou = false; rou = false;
} }
}
} }

View File

@@ -1,108 +1,109 @@
namespace _2DGAMELIB; namespace _2DGAMELIB
public class MotV
{ {
public double Value; public class MotV
{
public double Value;
protected double min = -1.0; protected double min = -1.0;
protected double max = 1.0; protected double max = 1.0;
private double Frame; private double Frame;
private double FrameHalf; private double FrameHalf;
private double MinFrameHalf; private double MinFrameHalf;
public double BaseSpeed = 1.0; public double BaseSpeed = 1.0;
public double GotoSpeed = 1.0; public double GotoSpeed = 1.0;
public double RetuSpeed = 1.0; public double RetuSpeed = 1.0;
public double Interval; public double Interval;
private long st; private long st;
public double LowestIncrease = 1.0; public double LowestIncrease = 1.0;
private int s = 1; private int s = 1;
private double d; private double d;
private double m; private double m;
public double Min public double Min
{ {
get get
{ {
return min; return min;
} }
set set
{ {
min = value; min = value;
SetFrame(); SetFrame();
} }
} }
public double Max public double Max
{ {
get get
{ {
return max; return max;
} }
set set
{ {
max = value; max = value;
SetFrame(); SetFrame();
} }
} }
public MotV(double Min, double Max) public MotV(double Min, double Max)
{ {
min = Min; min = Min;
max = Max; max = Max;
SetFrame(); SetFrame();
ResetValue(); ResetValue();
} }
private void SetFrame() private void SetFrame()
{ {
Frame = max - min; Frame = max - min;
FrameHalf = Frame * 0.5; FrameHalf = Frame * 0.5;
MinFrameHalf = Min + FrameHalf; MinFrameHalf = Min + FrameHalf;
} }
public void ResetValue() public void ResetValue()
{ {
Value = min; Value = min;
} }
private void Count(FPS FPS) private void Count(FPS FPS)
{ {
m = Frame / FPS.Value; m = Frame / FPS.Value;
Value += (m * d + m * LowestIncrease) * BaseSpeed * ((s > 0) ? GotoSpeed : RetuSpeed) * (double)s; Value += (m * d + m * LowestIncrease) * BaseSpeed * ((s > 0) ? GotoSpeed : RetuSpeed) * (double)s;
} }
public void GetValue(FPS FPS) public void GetValue(FPS FPS)
{ {
if (!((double)(FPS.sw.ElapsedMilliseconds - st) < Interval) && FPS.Value > 0.0) if (!((double)(FPS.sw.ElapsedMilliseconds - st) < Interval) && FPS.Value > 0.0)
{ {
d = (MinFrameHalf - Value) / FrameHalf; d = (MinFrameHalf - Value) / FrameHalf;
d *= d.Sign(); d *= d.Sign();
d = d.Inverse(); d = d.Inverse();
Count(FPS); Count(FPS);
if (Value >= max) if (Value >= max)
{ {
Value = max; Value = max;
s = -s; s = -s;
} }
else if (Value <= min) else if (Value <= min)
{ {
Value = min; Value = min;
s = -s; s = -s;
st = FPS.sw.ElapsedMilliseconds; st = FPS.sw.ElapsedMilliseconds;
} }
} }
} }
}
} }

View File

@@ -1,43 +1,44 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Mots
{ {
public Dictionary<string, Mot> ms; public class Mots
{
public Dictionary<string, Mot> ms;
public Mot this[string Name] public Mot this[string Name]
{ {
get get
{ {
return ms[Name]; return ms[Name];
} }
set set
{ {
ms[Name] = value; ms[Name] = value;
} }
} }
public Mots() public Mots()
{ {
ms = new Dictionary<string, Mot>(); ms = new Dictionary<string, Mot>();
} }
public void Add(string Name, Mot Mot) public void Add(string Name, Mot Mot)
{ {
ms.Add(Name, Mot); ms.Add(Name, Mot);
} }
public void Rem(string Name) public void Rem(string Name)
{ {
ms.Remove(Name); ms.Remove(Name);
} }
public void Drive(FPS FPS) public void Drive(FPS FPS)
{ {
foreach (Mot value in ms.Values) foreach (Mot value in ms.Values)
{ {
value.GetValue(FPS); value.GetValue(FPS);
} }
} }
}
} }

View File

@@ -1,221 +1,222 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class MyRandom : Random
{ {
protected uint x; public class MyRandom : Random
{
protected uint x;
protected uint y; protected uint y;
protected uint z; protected uint z;
protected uint w; protected uint w;
private const double d_4294967296 = 2.3283064365386963E-10; private const double d_4294967296 = 2.3283064365386963E-10;
private const double d_9007199254740992 = 1.1102230246251565E-16; private const double d_9007199254740992 = 1.1102230246251565E-16;
protected uint InitMtSub(uint s, uint i) protected uint InitMtSub(uint s, uint i)
{ {
return 1812433253 * (s ^ (s >> 30)) + i + 1; return 1812433253 * (s ^ (s >> 30)) + i + 1;
} }
public void Initialize(uint s) public void Initialize(uint s)
{ {
x = InitMtSub(s, 0u); x = InitMtSub(s, 0u);
y = InitMtSub(x, 1u); y = InitMtSub(x, 1u);
z = InitMtSub(y, 2u); z = InitMtSub(y, 2u);
w = InitMtSub(z, 3u); w = InitMtSub(z, 3u);
} }
public MyRandom(uint s) public MyRandom(uint s)
{ {
Initialize(s); Initialize(s);
} }
public MyRandom() public MyRandom()
: this(4357u) : this(4357u)
{ {
} }
public void Initialize(uint[] key) public void Initialize(uint[] key)
{ {
uint num = (uint)key.Length; uint num = (uint)key.Length;
uint[] array = new uint[4]; uint[] array = new uint[4];
Initialize(1u); Initialize(1u);
array[0] = x; array[0] = x;
array[1] = y; array[1] = y;
array[2] = z; array[2] = z;
array[3] = w; array[3] = w;
uint s = w; uint s = w;
uint num2; uint num2;
for (num2 = 0u; num2 < num; num2++) for (num2 = 0u; num2 < num; num2++)
{ {
array[num2 & 3] ^= (s = InitMtSub(s, key[num2] + num2)); array[num2 & 3] ^= (s = InitMtSub(s, key[num2] + num2));
} }
uint num3 = 0u; uint num3 = 0u;
while (num3 < 3) while (num3 < 3)
{ {
array[num2 & 3] ^= (s = InitMtSub(s, num3)); array[num2 & 3] ^= (s = InitMtSub(s, num3));
num3++; num3++;
num2++; num2++;
} }
x = array[0]; x = array[0];
y = array[1]; y = array[1];
z = array[2]; z = array[2];
w = array[3]; w = array[3];
if (x == 0 && y == 0 && z == 0 && w == 0) if (x == 0 && y == 0 && z == 0 && w == 0)
{ {
x = 1u; x = 1u;
} }
} }
public MyRandom(uint[] key) public MyRandom(uint[] key)
{ {
Initialize(key); Initialize(key);
} }
public override int Next() public override int Next()
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (int)(0.5 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))); return (int)(0.5 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
} }
public override int Next(int les) public override int Next(int les)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))); return (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
} }
public void Next(int les, out int o) public void Next(int les, out int o)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
o = (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))); o = (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
} }
public override int Next(int sta, int les) public override int Next(int sta, int les)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (int)((double)(les - sta) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + sta; return (int)((double)(les - sta) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + sta;
} }
public int NextM(int max) public int NextM(int max)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (int)((double)((long)max + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))); return (int)((double)((long)max + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
} }
public int NextM(int min, int max) public int NextM(int min, int max)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (int)((double)((long)(max - min) + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + min; return (int)((double)((long)(max - min) + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + min;
} }
public override double NextDouble() public override double NextDouble()
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11; uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
num = x ^ (x << 11); num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2); return 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
} }
public double NextDouble(double les) public double NextDouble(double les)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11; uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
num = x ^ (x << 11); num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return les * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2); return les * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
} }
public double NextDouble(double sta, double les) public double NextDouble(double sta, double les)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11; uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
num = x ^ (x << 11); num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (les - sta) * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2) + sta; return (les - sta) * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2) + sta;
} }
public bool NextBool() public bool NextBool()
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
return (w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 == 0; return (w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 == 0;
} }
public int NextSign() public int NextSign()
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
if ((w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 != 0) if ((w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 != 0)
{ {
return -1; return -1;
} }
return 1; return 1;
} }
public double NextNorCos(double mu = 0.0, double sigma = 1.0) public double NextNorCos(double mu = 0.0, double sigma = 1.0)
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11; uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
num = x ^ (x << 11); num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
double d = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2); double d = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
num = x ^ (x << 11); num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11; num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
num = x ^ (x << 11); num = x ^ (x << 11);
x = y; x = y;
y = z; y = z;
z = w; z = w;
double num3 = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2); double num3 = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
return System.Math.Sqrt(-2.0 * System.Math.Log(d)) * System.Math.Cos(System.Math.PI * 2.0 * num3) * sigma + mu; return System.Math.Sqrt(-2.0 * System.Math.Log(d)) * System.Math.Cos(System.Math.PI * 2.0 * num3) * sigma + mu;
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -2,205 +2,206 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public class OrderedDictionary<T1, T2>
{ {
private List<T1> keys; [Serializable]
public class OrderedDictionary<T1, T2>
{
private List<T1> keys;
private Dictionary<T1, T2> values; private Dictionary<T1, T2> values;
public T2 this[T1 Key] public T2 this[T1 Key]
{ {
get get
{ {
return values[Key]; return values[Key];
} }
set set
{ {
values[Key] = value; values[Key] = value;
} }
} }
public T2 this[int Index] public T2 this[int Index]
{ {
get get
{ {
return values[keys[Index]]; return values[keys[Index]];
} }
set set
{ {
values[keys[Index]] = value; values[keys[Index]] = value;
} }
} }
public IEnumerable<T1> Keys => keys; public IEnumerable<T1> Keys => keys;
public IEnumerable<T2> Values public IEnumerable<T2> Values
{ {
get get
{ {
foreach (T1 key in keys) foreach (T1 key in keys)
{ {
yield return values[key]; yield return values[key];
} }
} }
} }
public int Count => keys.Count; public int Count => keys.Count;
public OrderedDictionary() public OrderedDictionary()
{ {
keys = new List<T1>(); keys = new List<T1>();
values = new Dictionary<T1, T2>(); values = new Dictionary<T1, T2>();
} }
public OrderedDictionary(int capacity) public OrderedDictionary(int capacity)
{ {
keys = new List<T1>(capacity); keys = new List<T1>(capacity);
values = new Dictionary<T1, T2>(capacity); values = new Dictionary<T1, T2>(capacity);
} }
public int IndexOf(T1 Key) public int IndexOf(T1 Key)
{ {
return keys.IndexOf(Key); return keys.IndexOf(Key);
} }
public int IndexOf(ref T1 Key) public int IndexOf(ref T1 Key)
{ {
return keys.IndexOf(Key); return keys.IndexOf(Key);
} }
public int IndexOf(T2 Value) public int IndexOf(T2 Value)
{ {
int num = 0; int num = 0;
foreach (T2 value in Values) foreach (T2 value in Values)
{ {
if (value.Equals(Value)) if (value.Equals(Value))
{ {
return num; return num;
} }
num++; num++;
} }
return -1; return -1;
} }
public int IndexOf(ref T2 Value) public int IndexOf(ref T2 Value)
{ {
int num = 0; int num = 0;
foreach (T2 value in Values) foreach (T2 value in Values)
{ {
if (value.Equals(Value)) if (value.Equals(Value))
{ {
return num; return num;
} }
num++; num++;
} }
return -1; return -1;
} }
public int LastIndexOf(T1 Key) public int LastIndexOf(T1 Key)
{ {
return keys.LastIndexOf(Key); return keys.LastIndexOf(Key);
} }
public int LastIndexOf(ref T1 Key) public int LastIndexOf(ref T1 Key)
{ {
return keys.LastIndexOf(Key); return keys.LastIndexOf(Key);
} }
public int LastIndexOf(T2 Value) public int LastIndexOf(T2 Value)
{ {
int num = keys.Count - 1; int num = keys.Count - 1;
foreach (T2 item in Values.Reverse()) foreach (T2 item in Values.Reverse())
{ {
if (item.Equals(Value)) if (item.Equals(Value))
{ {
return num; return num;
} }
num--; num--;
} }
return -1; return -1;
} }
public int LastIndexOf(ref T2 Value) public int LastIndexOf(ref T2 Value)
{ {
int num = keys.Count - 1; int num = keys.Count - 1;
foreach (T2 item in Values.Reverse()) foreach (T2 item in Values.Reverse())
{ {
if (item.Equals(Value)) if (item.Equals(Value))
{ {
return num; return num;
} }
num--; num--;
} }
return -1; return -1;
} }
public void Add(T1 Key, T2 Value) public void Add(T1 Key, T2 Value)
{ {
keys.Add(Key); keys.Add(Key);
values.Add(Key, Value); values.Add(Key, Value);
} }
public void Add(ref T1 Key, ref T2 Value) public void Add(ref T1 Key, ref T2 Value)
{ {
keys.Add(Key); keys.Add(Key);
values.Add(Key, Value); values.Add(Key, Value);
} }
public void Insert(int Index, T1 Key, T2 Value) public void Insert(int Index, T1 Key, T2 Value)
{ {
keys.Insert(Index, Key); keys.Insert(Index, Key);
values.Add(Key, Value); values.Add(Key, Value);
} }
public void Insert(int Index, ref T1 Key, ref T2 Value) public void Insert(int Index, ref T1 Key, ref T2 Value)
{ {
keys.Insert(Index, Key); keys.Insert(Index, Key);
values.Add(Key, Value); values.Add(Key, Value);
} }
public void Remove(T1 Key) public void Remove(T1 Key)
{ {
keys.Remove(Key); keys.Remove(Key);
values.Remove(Key); values.Remove(Key);
} }
public void Remove(ref T1 Key) public void Remove(ref T1 Key)
{ {
keys.Remove(Key); keys.Remove(Key);
values.Remove(Key); values.Remove(Key);
} }
public void Reverse() public void Reverse()
{ {
keys.Reverse(); keys.Reverse();
} }
public void Reverse(int Index, int Count) public void Reverse(int Index, int Count)
{ {
keys.Reverse(Index, Count); keys.Reverse(Index, Count);
} }
public bool ContainsKey(T1 Key) public bool ContainsKey(T1 Key)
{ {
return values.ContainsKey(Key); return values.ContainsKey(Key);
} }
public bool ContainsKey(ref T1 Key) public bool ContainsKey(ref T1 Key)
{ {
return values.ContainsKey(Key); return values.ContainsKey(Key);
} }
public bool ContainsValue(T2 Value) public bool ContainsValue(T2 Value)
{ {
return values.ContainsValue(Value); return values.ContainsValue(Value);
} }
public bool ContainsValue(ref T2 Value) public bool ContainsValue(ref T2 Value)
{ {
return values.ContainsValue(Value); return values.ContainsValue(Value);
} }
}
} }

View File

@@ -5,360 +5,361 @@ using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class Oth
{ {
private static double s1; public static class Oth
{
private static double s1;
private static double s0; private static double s0;
public static double GetDiagonalLength(this double Width, double Height) public static double GetDiagonalLength(this double Width, double Height)
{ {
return System.Math.Sqrt(Width * Width + Height * Height); return System.Math.Sqrt(Width * Width + Height * Height);
} }
public static Color Reverse(this Color c) public static Color Reverse(this Color c)
{ {
return Color.FromArgb(c.A, 255 - c.R, 255 - c.G, 255 - c.B); return Color.FromArgb(c.A, 255 - c.R, 255 - c.G, 255 - c.B);
} }
public static void GetRandomColor(out Color ret) public static void GetRandomColor(out Color ret)
{ {
ret = Color.FromArgb(255, RNG.XS.Next(256), RNG.XS.Next(256), RNG.XS.Next(256)); ret = Color.FromArgb(255, RNG.XS.Next(256), RNG.XS.Next(256), RNG.XS.Next(256));
} }
public static Color GetInter(ref Color c1, ref Color c2) public static Color GetInter(ref Color c1, ref Color c2)
{ {
return Color.FromArgb((c1.A + c2.A) / 2, (c1.R + c2.R) / 2, (c1.G + c2.G) / 2, (c1.B + c2.B) / 2); return Color.FromArgb((c1.A + c2.A) / 2, (c1.R + c2.R) / 2, (c1.G + c2.G) / 2, (c1.B + c2.B) / 2);
} }
public static void GetInter(ref Color c1, ref Color c2, out Color ret) public static void GetInter(ref Color c1, ref Color c2, out Color ret)
{ {
ret = Color.FromArgb((c1.A + c2.A) / 2, (c1.R + c2.R) / 2, (c1.G + c2.G) / 2, (c1.B + c2.B) / 2); ret = Color.FromArgb((c1.A + c2.A) / 2, (c1.R + c2.R) / 2, (c1.G + c2.G) / 2, (c1.B + c2.B) / 2);
} }
public static Vector2D GetRandomVector() public static Vector2D GetRandomVector()
{ {
return new Vector2D(RNG.XS.NextDouble() * (double)(RNG.XS.NextBool() ? 1 : (-1)), RNG.XS.NextDouble() * (double)(RNG.XS.NextBool() ? 1 : (-1))); return new Vector2D(RNG.XS.NextDouble() * (double)(RNG.XS.NextBool() ? 1 : (-1)), RNG.XS.NextDouble() * (double)(RNG.XS.NextBool() ? 1 : (-1)));
} }
public static Color FuncHSV(this Color Color, Func<Hsv, Hsv> Func) public static Color FuncHSV(this Color Color, Func<Hsv, Hsv> Func)
{ {
return Func(new Hsv(ref Color)).GetColor(); return Func(new Hsv(ref Color)).GetColor();
} }
public static Rectangle GetRect(this Bitmap Bmp) public static Rectangle GetRect(this Bitmap Bmp)
{ {
return new Rectangle(0, 0, Bmp.Width, Bmp.Height); return new Rectangle(0, 0, Bmp.Width, Bmp.Height);
} }
public static LinearGradientBrush GetLGB(double Unit, Vector2D[] MM, Color Color1, Color Color2) public static LinearGradientBrush GetLGB(double Unit, Vector2D[] MM, Color Color1, Color Color2)
{ {
return new LinearGradientBrush((MM[0] * Unit * s0).ToPointF(), (MM[1] * Unit * s1).ToPointF(), Color1, Color2) return new LinearGradientBrush((MM[0] * Unit * s0).ToPointF(), (MM[1] * Unit * s1).ToPointF(), Color1, Color2)
{ {
GammaCorrection = true GammaCorrection = true
}; };
} }
public static LinearGradientBrush GetLGB(double Unit, Vector2D[] MM, ref Color Color1, ref Color Color2) public static LinearGradientBrush GetLGB(double Unit, Vector2D[] MM, ref Color Color1, ref Color Color2)
{ {
return new LinearGradientBrush((MM[0] * Unit * s0).ToPointF(), (MM[1] * Unit * s1).ToPointF(), Color1, Color2) return new LinearGradientBrush((MM[0] * Unit * s0).ToPointF(), (MM[1] * Unit * s1).ToPointF(), Color1, Color2)
{ {
GammaCorrection = true GammaCorrection = true
}; };
} }
private static void GetMinMaxX(Par Par, ref double MinX, ref double MaxX) private static void GetMinMaxX(Par Par, ref double MinX, ref double MaxX)
{ {
foreach (Out item in Par.OP) foreach (Out item in Par.OP)
{ {
foreach (Vector2D p in item.ps) foreach (Vector2D p in item.ps)
{ {
Vector2D vector2D = Par.ToGlobal(p); Vector2D vector2D = Par.ToGlobal(p);
if (MinX > vector2D.X) if (MinX > vector2D.X)
{ {
MinX = vector2D.X; MinX = vector2D.X;
} }
else if (MaxX < vector2D.X) else if (MaxX < vector2D.X)
{ {
MaxX = vector2D.X; MaxX = vector2D.X;
} }
} }
} }
} }
private static void GetMinMaxY(Par Par, ref double MinY, ref double MaxY) private static void GetMinMaxY(Par Par, ref double MinY, ref double MaxY)
{ {
foreach (Out item in Par.OP) foreach (Out item in Par.OP)
{ {
foreach (Vector2D p in item.ps) foreach (Vector2D p in item.ps)
{ {
Vector2D vector2D = Par.ToGlobal(p); Vector2D vector2D = Par.ToGlobal(p);
if (MinY > vector2D.Y) if (MinY > vector2D.Y)
{ {
MinY = vector2D.Y; MinY = vector2D.Y;
} }
else if (MaxY < vector2D.Y) else if (MaxY < vector2D.Y)
{ {
MaxY = vector2D.Y; MaxY = vector2D.Y;
} }
} }
} }
} }
private static void GetMinMaxY(Par[] Pars, ref double MinY, ref double MaxY) private static void GetMinMaxY(Par[] Pars, ref double MinY, ref double MaxY)
{ {
for (int i = 0; i < Pars.Length; i++) for (int i = 0; i < Pars.Length; i++)
{ {
GetMinMaxY(Pars[i], ref MinY, ref MaxY); GetMinMaxY(Pars[i], ref MinY, ref MaxY);
} }
} }
public static void GetMiX_MaX(this Par Par, out Vector2D[] MM) public static void GetMiX_MaX(this Par Par, out Vector2D[] MM)
{ {
Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First()); Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First());
MM = new Vector2D[2]; MM = new Vector2D[2];
MM[0].X = vector2D.X; MM[0].X = vector2D.X;
MM[1].X = vector2D.X; MM[1].X = vector2D.X;
GetMinMaxX(Par, ref MM[0].X, ref MM[1].X); GetMinMaxX(Par, ref MM[0].X, ref MM[1].X);
} }
public static void GetMaX_MiX(this Par Par, out Vector2D[] MM) public static void GetMaX_MiX(this Par Par, out Vector2D[] MM)
{ {
Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First()); Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First());
MM = new Vector2D[2]; MM = new Vector2D[2];
MM[0].X = vector2D.X; MM[0].X = vector2D.X;
MM[1].X = vector2D.X; MM[1].X = vector2D.X;
GetMinMaxX(Par, ref MM[1].X, ref MM[0].X); GetMinMaxX(Par, ref MM[1].X, ref MM[0].X);
} }
public static void GetMiY_MaY(this Par Par, out Vector2D[] MM) public static void GetMiY_MaY(this Par Par, out Vector2D[] MM)
{ {
Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First()); Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First());
MM = new Vector2D[2]; MM = new Vector2D[2];
MM[0].Y = vector2D.Y; MM[0].Y = vector2D.Y;
MM[1].Y = vector2D.Y; MM[1].Y = vector2D.Y;
GetMinMaxY(Par, ref MM[0].Y, ref MM[1].Y); GetMinMaxY(Par, ref MM[0].Y, ref MM[1].Y);
} }
public static void GetMiY_MaY(this Par[] Pars, out Vector2D[] MM) public static void GetMiY_MaY(this Par[] Pars, out Vector2D[] MM)
{ {
Par par = Pars.First(); Par par = Pars.First();
Vector2D vector2D = par.ToGlobal(par.OP.First().ps.First()); Vector2D vector2D = par.ToGlobal(par.OP.First().ps.First());
MM = new Vector2D[2]; MM = new Vector2D[2];
MM[0].Y = vector2D.Y; MM[0].Y = vector2D.Y;
MM[1].Y = vector2D.Y; MM[1].Y = vector2D.Y;
GetMinMaxY(Pars, ref MM[0].Y, ref MM[1].Y); GetMinMaxY(Pars, ref MM[0].Y, ref MM[1].Y);
} }
public static void GetMaY_MiY(this Par Par, out Vector2D[] MM) public static void GetMaY_MiY(this Par Par, out Vector2D[] MM)
{ {
Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First()); Vector2D vector2D = Par.ToGlobal(Par.OP.First().ps.First());
MM = new Vector2D[2]; MM = new Vector2D[2];
MM[0].Y = vector2D.Y; MM[0].Y = vector2D.Y;
MM[1].Y = vector2D.Y; MM[1].Y = vector2D.Y;
GetMinMaxY(Par, ref MM[1].Y, ref MM[0].Y); GetMinMaxY(Par, ref MM[1].Y, ref MM[0].Y);
} }
public static Obj ObjLoad(this byte[] bd) public static Obj ObjLoad(this byte[] bd)
{ {
return bd.Load<byte[]>().ToDeserialObject<Obj>().SetDefaultR(); return bd.Load<byte[]>().ToDeserialObject<Obj>().SetDefaultR();
} }
public static bool Lot(this double p) public static bool Lot(this double p)
{ {
return RNG.XS.NextDouble() < p; return RNG.XS.NextDouble() < p;
} }
public static int GetRandomIndex(params double[] WeightTable) public static int GetRandomIndex(params double[] WeightTable)
{ {
double les = WeightTable.Sum(); double les = WeightTable.Sum();
double num = RNG.XS.NextDouble(les); double num = RNG.XS.NextDouble(les);
int result = -1; int result = -1;
for (int i = 0; i < WeightTable.Length; i++) for (int i = 0; i < WeightTable.Length; i++)
{ {
if (WeightTable[i] >= num) if (WeightTable[i] >= num)
{ {
result = i; result = i;
break; break;
} }
num -= WeightTable[i]; num -= WeightTable[i];
} }
return result; return result;
} }
public static Encoding GetEncoding(this byte[] Bytes) public static Encoding GetEncoding(this byte[] Bytes)
{ {
byte[] array = null; byte[] array = null;
if (Bytes.Length > 4000) if (Bytes.Length > 4000)
{ {
array = new byte[4000]; array = new byte[4000];
Array.Copy(Bytes, array, 4000); Array.Copy(Bytes, array, 4000);
} }
else else
{ {
array = Bytes; array = Bytes;
} }
int num = array.Length; int num = array.Length;
bool flag = false; bool flag = false;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
byte b = array[i]; byte b = array[i];
if (b <= 6 || b == 127 || b == byte.MaxValue) if (b <= 6 || b == 127 || b == byte.MaxValue)
{ {
flag = true; flag = true;
if (b == 0 && i < num - 1 && array[i + 1] <= 127) if (b == 0 && i < num - 1 && array[i + 1] <= 127)
{ {
return Encoding.Unicode; return Encoding.Unicode;
} }
} }
} }
if (flag) if (flag)
{ {
return null; return null;
} }
bool flag2 = true; bool flag2 = true;
byte[] array2 = array; byte[] array2 = array;
foreach (byte b2 in array2) foreach (byte b2 in array2)
{ {
if (b2 == 27 || 128 <= b2) if (b2 == 27 || 128 <= b2)
{ {
flag2 = false; flag2 = false;
break; break;
} }
} }
if (flag2) if (flag2)
{ {
return Encoding.ASCII; return Encoding.ASCII;
} }
for (int k = 0; k < num - 2; k++) for (int k = 0; k < num - 2; k++)
{ {
byte b = array[k]; byte b = array[k];
byte b3 = array[k + 1]; byte b3 = array[k + 1];
byte b4 = array[k + 2]; byte b4 = array[k + 2];
if (b != 27) if (b != 27)
{ {
continue; continue;
} }
if (b3 == 36 && b4 == 64) if (b3 == 36 && b4 == 64)
{ {
return Encoding.GetEncoding(50220); return Encoding.GetEncoding(50220);
} }
if (b3 == 36 && b4 == 66) if (b3 == 36 && b4 == 66)
{ {
return Encoding.GetEncoding(50220); return Encoding.GetEncoding(50220);
} }
if (b3 == 40 && (b4 == 66 || b4 == 74)) if (b3 == 40 && (b4 == 66 || b4 == 74))
{ {
return Encoding.GetEncoding(50220); return Encoding.GetEncoding(50220);
} }
if (b3 == 40 && b4 == 73) if (b3 == 40 && b4 == 73)
{ {
return Encoding.GetEncoding(50220); return Encoding.GetEncoding(50220);
} }
if (k < num - 3) if (k < num - 3)
{ {
byte b5 = array[k + 3]; byte b5 = array[k + 3];
if (b3 == 36 && b4 == 40 && b5 == 68) if (b3 == 36 && b4 == 40 && b5 == 68)
{ {
return Encoding.GetEncoding(50220); return Encoding.GetEncoding(50220);
} }
if (k < num - 5 && b3 == 38 && b4 == 64 && b5 == 27 && array[k + 4] == 36 && array[k + 5] == 66) if (k < num - 5 && b3 == 38 && b4 == 64 && b5 == 27 && array[k + 4] == 36 && array[k + 5] == 66)
{ {
return Encoding.GetEncoding(50220); return Encoding.GetEncoding(50220);
} }
} }
} }
int num2 = 0; int num2 = 0;
int num3 = 0; int num3 = 0;
int num4 = 0; int num4 = 0;
for (int l = 0; l < num - 1; l++) for (int l = 0; l < num - 1; l++)
{ {
byte b = array[l]; byte b = array[l];
byte b3 = array[l + 1]; byte b3 = array[l + 1];
if (((129 <= b && b <= 159) || (224 <= b && b <= 252)) && ((64 <= b3 && b3 <= 126) || (128 <= b3 && b3 <= 252))) if (((129 <= b && b <= 159) || (224 <= b && b <= 252)) && ((64 <= b3 && b3 <= 126) || (128 <= b3 && b3 <= 252)))
{ {
num2 += 2; num2 += 2;
l++; l++;
} }
} }
for (int m = 0; m < num - 1; m++) for (int m = 0; m < num - 1; m++)
{ {
byte b = array[m]; byte b = array[m];
byte b3 = array[m + 1]; byte b3 = array[m + 1];
if ((161 <= b && b <= 254 && 161 <= b3 && b3 <= 254) || (b == 142 && 161 <= b3 && b3 <= 223)) if ((161 <= b && b <= 254 && 161 <= b3 && b3 <= 254) || (b == 142 && 161 <= b3 && b3 <= 223))
{ {
num3 += 2; num3 += 2;
m++; m++;
} }
else if (m < num - 2) else if (m < num - 2)
{ {
byte b4 = array[m + 2]; byte b4 = array[m + 2];
if (b == 143 && 161 <= b3 && b3 <= 254 && 161 <= b4 && b4 <= 254) if (b == 143 && 161 <= b3 && b3 <= 254 && 161 <= b4 && b4 <= 254)
{ {
num3 += 3; num3 += 3;
m += 2; m += 2;
} }
} }
} }
for (int n = 0; n < num - 1; n++) for (int n = 0; n < num - 1; n++)
{ {
byte b = array[n]; byte b = array[n];
byte b3 = array[n + 1]; byte b3 = array[n + 1];
if (192 <= b && b <= 223 && 128 <= b3 && b3 <= 191) if (192 <= b && b <= 223 && 128 <= b3 && b3 <= 191)
{ {
num4 += 2; num4 += 2;
n++; n++;
} }
else if (n < num - 2) else if (n < num - 2)
{ {
byte b4 = array[n + 2]; byte b4 = array[n + 2];
if (224 <= b && b <= 239 && 128 <= b3 && b3 <= 191 && 128 <= b4 && b4 <= 191) if (224 <= b && b <= 239 && 128 <= b3 && b3 <= 191 && 128 <= b4 && b4 <= 191)
{ {
num4 += 3; num4 += 3;
n += 2; n += 2;
} }
} }
} }
if (num3 > num2 && num3 > num4) if (num3 > num2 && num3 > num4)
{ {
return Encoding.GetEncoding(51932); return Encoding.GetEncoding(51932);
} }
if (num2 > num3 && num2 > num4) if (num2 > num3 && num2 > num4)
{ {
return Encoding.GetEncoding(932); return Encoding.GetEncoding(932);
} }
if (num4 > num3 && num4 > num2) if (num4 > num3 && num4 > num2)
{ {
return Encoding.UTF8; return Encoding.UTF8;
} }
return null; return null;
} }
public static string Join(this IEnumerable<string> strs, string Separator) public static string Join(this IEnumerable<string> strs, string Separator)
{ {
return string.Join(Separator, strs); return string.Join(Separator, strs);
} }
public static string[] Split(this string str, string Separator) public static string[] Split(this string str, string Separator)
{ {
return str.Split(new string[1] { Separator }, StringSplitOptions.None); return str.Split(new string[1] { Separator }, StringSplitOptions.None);
} }
static Oth() static Oth()
{ {
s1 = 1.01; s1 = 1.01;
s0 = s1.Reciprocal(); s0 = s1.Reciprocal();
} }
public static void SaveExMod<T>(this T Obj, string Path) public static void SaveExMod<T>(this T Obj, string Path)
{ {
Obj.ToSerialBytes().Save(Path); Obj.ToSerialBytes().Save(Path);
} }
public static T LoadExMod<T>(this string Path) public static T LoadExMod<T>(this string Path)
{ {
return Path.Load<byte[]>().ToDeserialObject<T>(); return Path.Load<byte[]>().ToDeserialObject<T>();
} }
}
} }

View File

@@ -1,26 +1,27 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace _2DGAMELIB; namespace _2DGAMELIB
//outline/path/line basically represents a curve :3
[Serializable]
public class Out
{ {
public List<Vector2D> ps = new List<Vector2D>();
public float Tension = 0.5f; //outline/path/line basically represents a curve :3
public bool Outline = true; [Serializable]
public class Out
{
public List<Vector2D> ps = new List<Vector2D>();
public Out() public float Tension = 0.5f;
{ public bool Outline = true;
}
public Out(Out Out) public Out()
{ {
ps = new List<Vector2D>(Out.ps); }
Tension = Out.Tension;
Outline = Out.Outline; public Out(Out Out)
} {
ps = new List<Vector2D>(Out.ps);
Tension = Out.Tension;
Outline = Out.Outline;
}
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -3,373 +3,374 @@ using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace _2DGAMELIB; namespace _2DGAMELIB
// renders text
[Serializable]
public class ParT : Par
{ {
[NonSerialized, JsonIgnore] // renders text
private Font font = new Font("", 1f); [Serializable]
public class ParT : Par
{
[NonSerialized, JsonIgnore]
private Font font = new Font("", 1f);
private double fontSize = 1.0; private double fontSize = 1.0;
private bool EditF = true; private bool EditF = true;
[NonSerialized, JsonIgnore] [NonSerialized, JsonIgnore]
private Brush brusht = new SolidBrush(Color.Black); private Brush brusht = new SolidBrush(Color.Black);
private const double Shift = 1.0; private const double Shift = 1.0;
[NonSerialized, JsonIgnore] [NonSerialized, JsonIgnore]
private Brush brushs; private Brush brushs;
[NonSerialized, JsonIgnore] [NonSerialized, JsonIgnore]
private StringFormat stringformat = new StringFormat(); private StringFormat stringformat = new StringFormat();
private Vector2D positionT = Dat.Vec2DZero; private Vector2D positionT = Dat.Vec2DZero;
private Vector2D rectSize = Dat.Vec2DOne; private Vector2D rectSize = Dat.Vec2DOne;
public string Text = ""; public string Text = "";
private RectangleF rect; private RectangleF rect;
private double us; private double us;
private double usx; private double usx;
private double usy; private double usy;
private Vector2D bp; private Vector2D bp;
private Vector2D p; private Vector2D p;
private Vector2D v; private Vector2D v;
private double a0; private double a0;
private double a1; private double a1;
private double M11; private double M11;
private double M12; private double M12;
private float af; private float af;
private float xf; private float xf;
private float yf; private float yf;
private bool EditT = true; private bool EditT = true;
private bool EditTS = true; private bool EditTS = true;
private CharacterRange[] crr = new CharacterRange[1]; private CharacterRange[] crr = new CharacterRange[1];
private CharacterRange[] cre = new CharacterRange[1]; private CharacterRange[] cre = new CharacterRange[1];
public Font Font public Font Font
{ {
get get
{ {
return font; return font;
} }
set set
{ {
if (font != value && font != null) if (font != value && font != null)
{ {
font.Dispose(); font.Dispose();
} }
font = value; font = value;
EditF = true; EditF = true;
} }
} }
public double FontSize public double FontSize
{ {
get get
{ {
return fontSize; return fontSize;
} }
set set
{ {
fontSize = value; fontSize = value;
EditF = true; EditF = true;
} }
} }
public Brush TextBrush public Brush TextBrush
{ {
get get
{ {
return brusht; return brusht;
} }
set set
{ {
if (brusht != value && brusht != null) if (brusht != value && brusht != null)
{ {
brusht.Dispose(); brusht.Dispose();
} }
brusht = value; brusht = value;
} }
} }
public Color TextColor public Color TextColor
{ {
get get
{ {
return ((SolidBrush)brusht).Color; return ((SolidBrush)brusht).Color;
} }
set set
{ {
((SolidBrush)brusht).Color = value; ((SolidBrush)brusht).Color = value;
} }
} }
public Brush ShadBrush public Brush ShadBrush
{ {
get get
{ {
return brushs; return brushs;
} }
set set
{ {
if (brushs != value && brushs != null) if (brushs != value && brushs != null)
{ {
brushs.Dispose(); brushs.Dispose();
} }
brushs = value; brushs = value;
} }
} }
public Color ShadColor public Color ShadColor
{ {
get get
{ {
return ((SolidBrush)brushs).Color; return ((SolidBrush)brushs).Color;
} }
set set
{ {
((SolidBrush)brushs).Color = value; ((SolidBrush)brushs).Color = value;
} }
} }
public StringFormat StringFormat public StringFormat StringFormat
{ {
get get
{ {
return stringformat; return stringformat;
} }
set set
{ {
if (stringformat != value && stringformat != null) if (stringformat != value && stringformat != null)
{ {
stringformat.Dispose(); stringformat.Dispose();
} }
stringformat = value; stringformat = value;
} }
} }
public Vector2D PositionT public Vector2D PositionT
{ {
get get
{ {
return positionT; return positionT;
} }
set set
{ {
positionT = value; positionT = value;
EditT = true; EditT = true;
} }
} }
public Vector2D RectSize public Vector2D RectSize
{ {
get get
{ {
return rectSize; return rectSize;
} }
set set
{ {
rectSize = value; rectSize = value;
EditT = true; EditT = true;
} }
} }
public new void SetDefault() public new void SetDefault()
{ {
base.SetDefault(); base.SetDefault();
font = new Font("", 1f); font = new Font("", 1f);
brusht = new SolidBrush(Color.Black); brusht = new SolidBrush(Color.Black);
brushs = null; brushs = null;
stringformat = new StringFormat(); stringformat = new StringFormat();
} }
public ParT() public ParT()
{ {
} }
public ParT(ParT ParT) public ParT(ParT ParT)
{ {
CopyT(ParT); CopyT(ParT);
} }
private void CopyT(ParT ParT) private void CopyT(ParT ParT)
{ {
Copy(ParT); Copy(ParT);
fontSize = ParT.fontSize; fontSize = ParT.fontSize;
if (ParT.font != null) if (ParT.font != null)
{ {
Font = ParT.font.Copy(); Font = ParT.font.Copy();
} }
if (ParT.brusht != null) if (ParT.brusht != null)
{ {
TextBrush = ParT.brusht.Copy(); TextBrush = ParT.brusht.Copy();
} }
if (ParT.brushs != null) if (ParT.brushs != null)
{ {
ShadBrush = ParT.brushs.Copy(); ShadBrush = ParT.brushs.Copy();
} }
if (ParT.stringformat != null) if (ParT.stringformat != null)
{ {
StringFormat = ParT.stringformat.Copy(); StringFormat = ParT.stringformat.Copy();
} }
positionT = ParT.positionT; positionT = ParT.positionT;
rectSize = ParT.rectSize; rectSize = ParT.rectSize;
Text = ParT.Text; Text = ParT.Text;
} }
public new void Draw(double Unit, Graphics Graphics) public new void Draw(double Unit, Graphics Graphics)
{ {
if (Edit) if (Edit)
{ {
EditT = true; EditT = true;
} }
if (EditS || EditPS) if (EditS || EditPS)
{ {
EditTS = true; EditTS = true;
} }
base.Draw(Unit, Graphics); base.Draw(Unit, Graphics);
DrawString(Unit, Graphics); DrawString(Unit, Graphics);
} }
private void Calculation(double Unit) private void Calculation(double Unit)
{ {
us = Unit * base.Size; us = Unit * base.Size;
usx = us * base.SizeX; usx = us * base.SizeX;
usy = us * base.SizeY; usy = us * base.SizeY;
bp = base.BasePoint; bp = base.BasePoint;
bp.X *= usx; bp.X *= usx;
bp.Y *= usy; bp.Y *= usy;
a0 = base.Angle; a0 = base.Angle;
a1 = System.Math.PI * a0 / 180.0; a1 = System.Math.PI * a0 / 180.0;
M11 = System.Math.Cos(a1); M11 = System.Math.Cos(a1);
M12 = System.Math.Sin(a1); M12 = System.Math.Sin(a1);
v.X = bp.X * M11 + bp.Y * (0.0 - M12); v.X = bp.X * M11 + bp.Y * (0.0 - M12);
v.Y = bp.X * M12 + bp.Y * M11; v.Y = bp.X * M12 + bp.Y * M11;
p = base.Position; p = base.Position;
bp.X = p.X * Unit - v.X; bp.X = p.X * Unit - v.X;
bp.Y = p.Y * Unit - v.Y; bp.Y = p.Y * Unit - v.Y;
rect.X = (float)(positionT.X * us); rect.X = (float)(positionT.X * us);
rect.Y = (float)(positionT.Y * us); rect.Y = (float)(positionT.Y * us);
rect.Width = (float)(rectSize.X * us); rect.Width = (float)(rectSize.X * us);
rect.Height = (float)(rectSize.Y * us); rect.Height = (float)(rectSize.Y * us);
} }
private void DrawString(double Unit, Graphics Graphics) private void DrawString(double Unit, Graphics Graphics)
{ {
if (EditT) if (EditT)
{ {
Calculation(Unit); Calculation(Unit);
EditT = false; EditT = false;
} }
if (EditF || EditTS) if (EditF || EditTS)
{ {
Font = new Font(font.FontFamily, (float)(us * fontSize * Med.DpiY)); Font = new Font(font.FontFamily, (float)(us * fontSize * Med.DpiY));
EditF = false; EditF = false;
EditTS = false; EditTS = false;
} }
af = (float)a0; af = (float)a0;
xf = (float)base.SizeX; xf = (float)base.SizeX;
yf = (float)base.SizeY; yf = (float)base.SizeY;
if (brushs != null) if (brushs != null)
{ {
Graphics.TranslateTransform((float)(bp.X + 1.0), (float)(bp.Y + 1.0)); Graphics.TranslateTransform((float)(bp.X + 1.0), (float)(bp.Y + 1.0));
Graphics.RotateTransform(af); Graphics.RotateTransform(af);
Graphics.ScaleTransform(xf, yf); Graphics.ScaleTransform(xf, yf);
Graphics.DrawString(Text, font, brushs, rect, stringformat); Graphics.DrawString(Text, font, brushs, rect, stringformat);
Graphics.ResetTransform(); Graphics.ResetTransform();
} }
Graphics.TranslateTransform((float)bp.X, (float)bp.Y); Graphics.TranslateTransform((float)bp.X, (float)bp.Y);
Graphics.RotateTransform(af); Graphics.RotateTransform(af);
Graphics.ScaleTransform(xf, yf); Graphics.ScaleTransform(xf, yf);
Graphics.DrawString(Text, font, brusht, rect, stringformat); Graphics.DrawString(Text, font, brusht, rect, stringformat);
Graphics.ResetTransform(); Graphics.ResetTransform();
} }
public Vector2D_2 GetStringRect(double Unit, Graphics Graphics) public Vector2D_2 GetStringRect(double Unit, Graphics Graphics)
{ {
double num = Unit * base.Size; double num = Unit * base.Size;
if (EditF || EditS || EditPS || EditTS) if (EditF || EditS || EditPS || EditTS)
{ {
Font = new Font(font.FontFamily, (float)(num * fontSize * Med.DpiY)); Font = new Font(font.FontFamily, (float)(num * fontSize * Med.DpiY));
EditF = false; EditF = false;
EditTS = false; EditTS = false;
} }
crr[0] = new CharacterRange(0, Text.Length); crr[0] = new CharacterRange(0, Text.Length);
stringformat.SetMeasurableCharacterRanges(crr); stringformat.SetMeasurableCharacterRanges(crr);
RectangleF bounds = Graphics.MeasureCharacterRanges(Text, font, new RectangleF((float)(positionT.X * num), (float)(positionT.Y * num), (float)(rectSize.X * num), (float)(rectSize.Y * num)), stringformat)[0].GetBounds(Graphics); RectangleF bounds = Graphics.MeasureCharacterRanges(Text, font, new RectangleF((float)(positionT.X * num), (float)(positionT.Y * num), (float)(rectSize.X * num), (float)(rectSize.Y * num)), stringformat)[0].GetBounds(Graphics);
return new Vector2D_2(new Vector2D((double)bounds.X / num, (double)bounds.Y / num), new Vector2D((double)bounds.Width / num, (double)bounds.Height / num)); return new Vector2D_2(new Vector2D((double)bounds.X / num, (double)bounds.Y / num), new Vector2D((double)bounds.Width / num, (double)bounds.Height / num));
} }
public Vector2D[] GetStringRectPoints(double Unit, Graphics Graphics) public Vector2D[] GetStringRectPoints(double Unit, Graphics Graphics)
{ {
Vector2D_2 stringRect = GetStringRect(Unit, Graphics); Vector2D_2 stringRect = GetStringRect(Unit, Graphics);
stringRect.v2.X *= 1.07; stringRect.v2.X *= 1.07;
return new Vector2D[4] return new Vector2D[4]
{ {
stringRect.v1, stringRect.v1,
new Vector2D(stringRect.v2.X, stringRect.v1.Y), new Vector2D(stringRect.v2.X, stringRect.v1.Y),
stringRect.v2, stringRect.v2,
new Vector2D(stringRect.v1.X, stringRect.v2.Y) new Vector2D(stringRect.v1.X, stringRect.v2.Y)
}; };
} }
public void SetStringRectOutline(double Unit, Graphics Graphics) public void SetStringRectOutline(double Unit, Graphics Graphics)
{ {
Vector2D[] stringRectPoints = GetStringRectPoints(Unit, Graphics); Vector2D[] stringRectPoints = GetStringRectPoints(Unit, Graphics);
Out @out = new Out Out @out = new Out
{ {
Tension = 0f Tension = 0f
}; };
Vector2D vector2D = Dat.Vec2DZero - stringRectPoints[0]; Vector2D vector2D = Dat.Vec2DZero - stringRectPoints[0];
double x = 0.05; double x = 0.05;
double num = 0.025; double num = 0.025;
@out.ps.Add(stringRectPoints[0].AddY(0.0 - num) + vector2D); @out.ps.Add(stringRectPoints[0].AddY(0.0 - num) + vector2D);
@out.ps.Add(stringRectPoints[1].AddXY(x, 0.0 - num) + vector2D); @out.ps.Add(stringRectPoints[1].AddXY(x, 0.0 - num) + vector2D);
@out.ps.Add(stringRectPoints[2].AddXY(x, num) + vector2D); @out.ps.Add(stringRectPoints[2].AddXY(x, num) + vector2D);
@out.ps.Add(stringRectPoints[3].AddY(num) + vector2D); @out.ps.Add(stringRectPoints[3].AddY(num) + vector2D);
base.OP.Add(@out); base.OP.Add(@out);
} }
public new void Dispose() public new void Dispose()
{ {
base.Dispose(); base.Dispose();
if (font != null) if (font != null)
{ {
font.Dispose(); font.Dispose();
} }
if (brusht != null) if (brusht != null)
{ {
brusht.Dispose(); brusht.Dispose();
} }
if (brushs != null) if (brushs != null)
{ {
brushs.Dispose(); brushs.Dispose();
} }
if (stringformat != null) if (stringformat != null)
{ {
stringformat.Dispose(); stringformat.Dispose();
} }
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,51 +1,52 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class Qua
{ {
public static QuaternionD RotationZQ(this double angle) public static class Qua
{ {
double num = angle * 0.5; public static QuaternionD RotationZQ(this double angle)
QuaternionD result = default(QuaternionD); {
result.X = 0.0; double num = angle * 0.5;
result.Y = 0.0; QuaternionD result = default(QuaternionD);
result.Z = System.Math.Sin(num); result.X = 0.0;
result.W = System.Math.Cos(num); result.Y = 0.0;
return result; result.Z = System.Math.Sin(num);
result.W = System.Math.Cos(num);
return result;
}
public static void TransformCoordinate(ref Vector2D coord, ref QuaternionD rotation, out Vector2D result)
{
double num = rotation.Y + rotation.Y;
double num2 = rotation.Z + rotation.Z;
double num3 = rotation.W * num2;
double num4 = rotation.X * num;
double num5 = rotation.Z * num2;
result.X = coord.X * (1.0 - rotation.Y * num - num5) + coord.Y * (num4 - num3);
result.Y = coord.X * (num4 + num3) + coord.Y * (1.0 - rotation.X * (rotation.X + rotation.X) - num5);
}
public static Vector2D TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, QuaternionD rotation)
{
Vec.Subtract(ref coord, ref BasePoint, out coord);
TransformCoordinate(ref coord, ref rotation, out var result);
Vec.Add(ref result, ref BasePoint, out result);
return result;
}
} }
public static void TransformCoordinate(ref Vector2D coord, ref QuaternionD rotation, out Vector2D result)
{
double num = rotation.Y + rotation.Y;
double num2 = rotation.Z + rotation.Z;
double num3 = rotation.W * num2;
double num4 = rotation.X * num;
double num5 = rotation.Z * num2;
result.X = coord.X * (1.0 - rotation.Y * num - num5) + coord.Y * (num4 - num3);
result.Y = coord.X * (num4 + num3) + coord.Y * (1.0 - rotation.X * (rotation.X + rotation.X) - num5);
}
public static Vector2D TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, QuaternionD rotation) //used in a total of 1 places
[Serializable]
public struct QuaternionD
{ {
Vec.Subtract(ref coord, ref BasePoint, out coord); public double X;
TransformCoordinate(ref coord, ref rotation, out var result);
Vec.Add(ref result, ref BasePoint, out result); public double Y;
return result;
public double Z;
public double W;
} }
} }
//used in a total of 1 places
[Serializable]
public struct QuaternionD
{
public double X;
public double Y;
public double Z;
public double W;
}

View File

@@ -1,9 +1,10 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class RNG
{ {
public static MyRandom XS = new MyRandom((uint)(Environment.TickCount + DateTime.Now.ToBinary())); public static class RNG
{
public static MyRandom XS = new MyRandom((uint)(Environment.TickCount + DateTime.Now.ToBinary()));
}
} }

View File

@@ -1,47 +1,48 @@
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Rect
{ {
public double XRatio = 1.0; public class Rect
{
public double XRatio = 1.0;
public double YRatio = 1.0; public double YRatio = 1.0;
public double Size = 1.0; public double Size = 1.0;
public double LocalWidth => XRatio * Size; public double LocalWidth => XRatio * Size;
public double LocalHeight => YRatio * Size; public double LocalHeight => YRatio * Size;
public Vector2D LocalCenter => new Vector2D(LocalWidth * 0.5, LocalHeight * 0.5); public Vector2D LocalCenter => new Vector2D(LocalWidth * 0.5, LocalHeight * 0.5);
public Rect() public Rect()
{ {
} }
public Rect(double XRatio, double YRatio, double Size) public Rect(double XRatio, double YRatio, double Size)
{ {
SetXYRatio(XRatio, YRatio); SetXYRatio(XRatio, YRatio);
this.Size = Size; this.Size = Size;
} }
public void SetXYRatio(double X, double Y) public void SetXYRatio(double X, double Y)
{ {
XRatio = X / Y; XRatio = X / Y;
YRatio = 1.0; YRatio = 1.0;
} }
public Vector2D GetPosition(double X, double Y) public Vector2D GetPosition(double X, double Y)
{ {
return new Vector2D(LocalWidth * X, LocalHeight * Y); return new Vector2D(LocalWidth * X, LocalHeight * Y);
} }
public Vector2D GetPosition(Vector2D p) public Vector2D GetPosition(Vector2D p)
{ {
return new Vector2D(LocalWidth * p.X, LocalHeight * p.Y); return new Vector2D(LocalWidth * p.X, LocalHeight * p.Y);
} }
public Vector2D GetPosition(ref Vector2D p) public Vector2D GetPosition(ref Vector2D p)
{ {
return new Vector2D(LocalWidth * p.X, LocalHeight * p.Y); return new Vector2D(LocalWidth * p.X, LocalHeight * p.Y);
} }
}
} }

View File

@@ -1,80 +1,81 @@
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
namespace _2DGAMELIB; namespace _2DGAMELIB
//Basically used to animate switching between two static images
public class Sce
{ {
private Bitmap Start;
private Graphics GS; //Basically used to animate switching between two static images
public class Sce
{
private Bitmap Start;
private Bitmap End; private Graphics GS;
private Graphics GE; private Bitmap End;
private int w; private Graphics GE;
private int h; private int w;
private int o; private int h;
private Rectangle r; private int o;
private ColorMatrix cm = new ColorMatrix(); private Rectangle r;
private ImageAttributes ia = new ImageAttributes(); private ColorMatrix cm = new ColorMatrix();
public Sce(int Width, int Height) private ImageAttributes ia = new ImageAttributes();
{
w = Width;
h = Height;
Start = new Bitmap(w, h);
GS = Graphics.FromImage(Start);
End = new Bitmap(w, h);
GE = Graphics.FromImage(End);
r = new Rectangle(0, 0, w, h);
}
public void TransformAlpha(Graphics Graphics, double Rate) public Sce(int Width, int Height)
{ {
Graphics.DrawImage(Start, 0, 0); w = Width;
cm.Matrix33 = (float)Rate; h = Height;
ia.SetColorMatrix(cm); Start = new Bitmap(w, h);
Graphics.DrawImage(End, r, 0, 0, w, h, GraphicsUnit.Pixel, ia); GS = Graphics.FromImage(Start);
} End = new Bitmap(w, h);
GE = Graphics.FromImage(End);
r = new Rectangle(0, 0, w, h);
}
public void TransD(Graphics Graphics, double Rate) public void TransformAlpha(Graphics Graphics, double Rate)
{ {
Graphics.DrawImage(End, 0, 0); Graphics.DrawImage(Start, 0, 0);
cm.Matrix33 = (float)Rate.Inverse(); cm.Matrix33 = (float)Rate;
ia.SetColorMatrix(cm); ia.SetColorMatrix(cm);
Graphics.DrawImage(Start, r, 0, 0, w, h, GraphicsUnit.Pixel, ia); Graphics.DrawImage(End, r, 0, 0, w, h, GraphicsUnit.Pixel, ia);
} }
public void DrawStart(Are Are) public void TransD(Graphics Graphics, double Rate)
{ {
Are.Draw(GS); Graphics.DrawImage(End, 0, 0);
} cm.Matrix33 = (float)Rate.Inverse();
ia.SetColorMatrix(cm);
Graphics.DrawImage(Start, r, 0, 0, w, h, GraphicsUnit.Pixel, ia);
}
public void DrawEnd(Are Are) public void DrawStart(Are Are)
{ {
Are.Draw(GE); Are.Draw(GS);
} }
public void ClearStart(ref Color ClearColor) public void DrawEnd(Are Are)
{ {
GS.Clear(ClearColor); Are.Draw(GE);
} }
public void Dispose() public void ClearStart(ref Color ClearColor)
{ {
Start.Dispose(); GS.Clear(ClearColor);
GS.Dispose(); }
End.Dispose();
GE.Dispose(); public void Dispose()
ia.Dispose(); {
} Start.Dispose();
GS.Dispose();
End.Dispose();
GE.Dispose();
ia.Dispose();
}
}
} }

View File

@@ -3,90 +3,91 @@ using System.IO;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace _2DGAMELIB; namespace _2DGAMELIB
//serialization stuff
public static class Ser
{ {
private static SerializableAttribute s = new SerializableAttribute();
public static T DeepCopy<T>(this T Object) //serialization stuff
{ public static class Ser
BinaryFormatter binaryFormatter = new BinaryFormatter(); {
using MemoryStream memoryStream = new MemoryStream(); private static SerializableAttribute s = new SerializableAttribute();
binaryFormatter.Serialize(memoryStream, Object);
memoryStream.Position = 0L;
return (T)binaryFormatter.Deserialize(memoryStream);
}
public static byte[] ToSerialBytes<T>(this T Object) public static T DeepCopy<T>(this T Object)
{ {
using MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter();
new BinaryFormatter().Serialize(memoryStream, Object); using MemoryStream memoryStream = new MemoryStream();
return memoryStream.ToArray(); binaryFormatter.Serialize(memoryStream, Object);
} memoryStream.Position = 0L;
return (T)binaryFormatter.Deserialize(memoryStream);
}
public static T ToDeserialObject<T>(this byte[] Bytes) public static byte[] ToSerialBytes<T>(this T Object)
{ {
using MemoryStream serializationStream = new MemoryStream(Bytes); using MemoryStream memoryStream = new MemoryStream();
return (T)new BinaryFormatter().Deserialize(serializationStream); new BinaryFormatter().Serialize(memoryStream, Object);
} return memoryStream.ToArray();
}
public static void Save<T>(this T Object, string Path) public static T ToDeserialObject<T>(this byte[] Bytes)
{ {
using FileStream serializationStream = new FileStream(Path, FileMode.Create, FileAccess.Write); using MemoryStream serializationStream = new MemoryStream(Bytes);
new BinaryFormatter().Serialize(serializationStream, Object); return (T)new BinaryFormatter().Deserialize(serializationStream);
} }
public static T Load<T>(this string Path) public static void Save<T>(this T Object, string Path)
{ {
using FileStream serializationStream = new FileStream(Path, FileMode.Open, FileAccess.Read); using FileStream serializationStream = new FileStream(Path, FileMode.Create, FileAccess.Write);
return (T)new BinaryFormatter().Deserialize(serializationStream); new BinaryFormatter().Serialize(serializationStream, Object);
} }
public static T Load<T>(this byte[] bd) public static T Load<T>(this string Path)
{ {
using MemoryStream serializationStream = new MemoryStream(bd); using FileStream serializationStream = new FileStream(Path, FileMode.Open, FileAccess.Read);
return (T)new BinaryFormatter().Deserialize(serializationStream); return (T)new BinaryFormatter().Deserialize(serializationStream);
} }
/*
public static void ToXml<T>(this T Object, string Path)
{
using FileStream output = new FileStream(Path, FileMode.Create, FileAccess.Write);
using XmlWriter writer = XmlWriter.Create(output, new XmlWriterSettings
{
Indent = true
});
new DataContractSerializer(typeof(T)).WriteObject(writer, Object);
}
public static T FromXml<T>(this string Path) public static T Load<T>(this byte[] bd)
{ {
using FileStream input = new FileStream(Path, FileMode.Open, FileAccess.Read); using MemoryStream serializationStream = new MemoryStream(bd);
using XmlReader reader = XmlReader.Create(input); return (T)new BinaryFormatter().Deserialize(serializationStream);
return (T)new DataContractSerializer(typeof(T)).ReadObject(reader); }
} /*
*/ public static void ToXml<T>(this T Object, string Path)
static Ser(){} {
using FileStream output = new FileStream(Path, FileMode.Create, FileAccess.Write);
using XmlWriter writer = XmlWriter.Create(output, new XmlWriterSettings
{
Indent = true
});
new DataContractSerializer(typeof(T)).WriteObject(writer, Object);
}
public static void ToJson<T>(this T Object, string Path) public static T FromXml<T>(this string Path)
{ {
using StreamWriter textWriter = File.CreateText(Path); using FileStream input = new FileStream(Path, FileMode.Open, FileAccess.Read);
JsonSerializer jsonSerializer = new JsonSerializer(); using XmlReader reader = XmlReader.Create(input);
jsonSerializer.PreserveReferencesHandling = PreserveReferencesHandling.Objects; return (T)new DataContractSerializer(typeof(T)).ReadObject(reader);
jsonSerializer.TypeNameHandling = TypeNameHandling.All; }
jsonSerializer.Formatting = Newtonsoft.Json.Formatting.Indented; */
jsonSerializer.Serialize(textWriter, Object); static Ser(){}
}
public static T UnJson<T>(string Path) public static void ToJson<T>(this T Object, string Path)
{ {
using StreamReader reader = File.OpenText(Path); using StreamWriter textWriter = File.CreateText(Path);
return (T)new JsonSerializer JsonSerializer jsonSerializer = new JsonSerializer();
{ jsonSerializer.PreserveReferencesHandling = PreserveReferencesHandling.Objects;
NullValueHandling = NullValueHandling.Ignore, jsonSerializer.TypeNameHandling = TypeNameHandling.All;
TypeNameHandling = TypeNameHandling.All jsonSerializer.Formatting = Newtonsoft.Json.Formatting.Indented;
}.Deserialize(reader, typeof(T)); jsonSerializer.Serialize(textWriter, Object);
} }
public static T UnJson<T>(string Path)
{
using StreamReader reader = File.OpenText(Path);
return (T)new JsonSerializer
{
NullValueHandling = NullValueHandling.Ignore,
TypeNameHandling = TypeNameHandling.All
}.Deserialize(reader, typeof(T));
}
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,58 +1,59 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class SoundPlayer
{ {
//Todo Fix public class SoundPlayer
//public MediaPlayer mp = new MediaPlayer(); {
//Todo Fix
//public MediaPlayer mp = new MediaPlayer();
private bool l; private bool l;
private TimeSpan ts = new TimeSpan(0L); private TimeSpan ts = new TimeSpan(0L);
public bool Loop public bool Loop
{ {
get get
{ {
return l; return l;
} }
set set
{ {
if (value) if (value)
{ {
if (l != value) if (l != value)
{ {
//mp.MediaEnded += loop; //mp.MediaEnded += loop;
} }
} }
else if (l != value) else if (l != value)
{ {
//mp.MediaEnded -= loop; //mp.MediaEnded -= loop;
} }
l = value; l = value;
} }
} }
public SoundPlayer(string Path, bool Loop) public SoundPlayer(string Path, bool Loop)
{ {
//mp.Open(new Uri(Path)); //mp.Open(new Uri(Path));
this.Loop = Loop; this.Loop = Loop;
//mp.Volume = 1.0; //mp.Volume = 1.0;
} }
public void Play() public void Play()
{ {
//mp.Play(); //mp.Play();
} }
public void Stop() public void Stop()
{ {
//mp.Stop(); //mp.Stop();
} }
public void Close() public void Close()
{ {
//mp.Close(); //mp.Close();
} }
}
} }

View File

@@ -1,167 +1,168 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Swi
{ {
private bool flag; public class Swi
{
private bool flag;
private Color OnColor = Color.Red; private Color OnColor = Color.Red;
private List<Color> colors; private List<Color> colors;
public bool Flag => flag; public bool Flag => flag;
public Swi(Color OnColor) public Swi(Color OnColor)
{ {
this.OnColor = OnColor; this.OnColor = OnColor;
} }
public Swi(ref Color OnColor) public Swi(ref Color OnColor)
{ {
this.OnColor = OnColor; this.OnColor = OnColor;
} }
public void OnOff(But But) public void OnOff(But But)
{ {
But1 but = (But1)But; But1 but = (But1)But;
if (!flag) if (!flag)
{ {
flag = true; flag = true;
if (colors == null) if (colors == null)
{ {
colors = new List<Color>(but.BaseColors); colors = new List<Color>(but.BaseColors);
} }
int i; int i;
for (i = 0; i < but.BaseColors.Count; i++) for (i = 0; i < but.BaseColors.Count; i++)
{ {
but.BaseColors[i] = OnColor; but.BaseColors[i] = OnColor;
but.OverColors[i] = but.BaseColors[i].FuncHSV(delegate(Hsv hsv) but.OverColors[i] = but.BaseColors[i].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
but.PushColors[i] = but.OverColors[i].FuncHSV(delegate(Hsv hsv) but.PushColors[i] = but.OverColors[i].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
} }
i = 0; i = 0;
{ {
foreach (Par item in but.Pars.EnumAllPar()) foreach (Par item in but.Pars.EnumAllPar())
{ {
item.BrushColor = but.OverColors[i]; item.BrushColor = but.OverColors[i];
i++; i++;
} }
return; return;
} }
} }
flag = false; flag = false;
if (colors != null) if (colors != null)
{ {
but.BaseColors = colors; but.BaseColors = colors;
colors = null; colors = null;
} }
int j; int j;
for (j = 0; j < but.BaseColors.Count; j++) for (j = 0; j < but.BaseColors.Count; j++)
{ {
but.OverColors[j] = but.BaseColors[j].FuncHSV(delegate(Hsv hsv) but.OverColors[j] = but.BaseColors[j].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
but.PushColors[j] = but.OverColors[j].FuncHSV(delegate(Hsv hsv) but.PushColors[j] = but.OverColors[j].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
} }
j = 0; j = 0;
foreach (Par item2 in but.Pars.EnumAllPar()) foreach (Par item2 in but.Pars.EnumAllPar())
{ {
item2.BrushColor = but.OverColors[j]; item2.BrushColor = but.OverColors[j];
j++; j++;
} }
} }
public void SetFlag(But But, bool On) public void SetFlag(But But, bool On)
{ {
But1 but = (But1)But; But1 but = (But1)But;
if (On) if (On)
{ {
flag = true; flag = true;
if (colors == null) if (colors == null)
{ {
colors = new List<Color>(but.BaseColors); colors = new List<Color>(but.BaseColors);
} }
int i; int i;
for (i = 0; i < but.BaseColors.Count; i++) for (i = 0; i < but.BaseColors.Count; i++)
{ {
but.BaseColors[i] = OnColor; but.BaseColors[i] = OnColor;
but.OverColors[i] = but.BaseColors[i].FuncHSV(delegate(Hsv hsv) but.OverColors[i] = but.BaseColors[i].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
but.PushColors[i] = but.OverColors[i].FuncHSV(delegate(Hsv hsv) but.PushColors[i] = but.OverColors[i].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
} }
i = 0; i = 0;
{ {
foreach (Par item in but.Pars.EnumAllPar()) foreach (Par item in but.Pars.EnumAllPar())
{ {
item.BrushColor = but.BaseColors[i]; item.BrushColor = but.BaseColors[i];
i++; i++;
} }
return; return;
} }
} }
flag = false; flag = false;
if (colors != null) if (colors != null)
{ {
but.BaseColors = colors; but.BaseColors = colors;
colors = null; colors = null;
} }
int j; int j;
for (j = 0; j < but.BaseColors.Count; j++) for (j = 0; j < but.BaseColors.Count; j++)
{ {
but.OverColors[j] = but.BaseColors[j].FuncHSV(delegate(Hsv hsv) but.OverColors[j] = but.BaseColors[j].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
but.PushColors[j] = but.OverColors[j].FuncHSV(delegate(Hsv hsv) but.PushColors[j] = but.OverColors[j].FuncHSV(delegate(Hsv hsv)
{ {
hsv.Hue += 30; hsv.Hue += 30;
hsv.Sat -= 30; hsv.Sat -= 30;
hsv.Val += 100; hsv.Val += 100;
return hsv; return hsv;
}); });
} }
j = 0; j = 0;
foreach (Par item2 in but.Pars.EnumAllPar()) foreach (Par item2 in but.Pars.EnumAllPar())
{ {
item2.BrushColor = but.BaseColors[j]; item2.BrushColor = but.BaseColors[j];
j++; j++;
} }
} }
}
} }

View File

@@ -3,403 +3,404 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class Tex
{ {
private Pars pars; public class Tex
{
private Pars pars;
private ParT parT; private ParT parT;
private Par feed; private Par feed;
public int Space; public int Space;
private string text; private string text;
private double speed = 1.0; private double speed = 1.0;
private Action<Tex> Action = delegate private Action<Tex> Action = delegate
{ {
}; };
private MotV mv; private MotV mv;
private bool f1; private bool f1;
private bool f2; private bool f2;
private double Count; private double Count;
private int Max; private int Max;
public Action<Tex> Done; public Action<Tex> Done;
private byte a0; private byte a0;
private byte a1; private byte a1;
private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini"; private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini";
private bool FastText; private bool FastText;
public Pars Pars => pars; public Pars Pars => pars;
public ParT ParT => parT; public ParT ParT => parT;
public Par Feed => feed; public Par Feed => feed;
public string TextIm public string TextIm
{ {
get get
{ {
return text.Substring(Space, text.Length - Space); return text.Substring(Space, text.Length - Space);
} }
set set
{ {
if (feed != null) if (feed != null)
{ {
a0 = feed.BrushColor.A; a0 = feed.BrushColor.A;
a1 = feed.PenColor.A; a1 = feed.PenColor.A;
feed.BrushColor = Color.FromArgb(0, feed.BrushColor); feed.BrushColor = Color.FromArgb(0, feed.BrushColor);
feed.PenColor = Color.FromArgb(0, feed.PenColor); feed.PenColor = Color.FromArgb(0, feed.PenColor);
} }
text = new string(' ', Space) + value; text = new string(' ', Space) + value;
Max = text.Length; Max = text.Length;
Count = Max; Count = Max;
f1 = false; f1 = false;
if (parT != null) if (parT != null)
{ {
parT.Text = text; parT.Text = text;
} }
} }
} }
public string Text public string Text
{ {
get get
{ {
return text.Substring(Space, text.Length - Space); return text.Substring(Space, text.Length - Space);
} }
set set
{ {
if (feed != null) if (feed != null)
{ {
a0 = feed.BrushColor.A; a0 = feed.BrushColor.A;
a1 = feed.PenColor.A; a1 = feed.PenColor.A;
feed.BrushColor = Color.FromArgb(0, feed.BrushColor); feed.BrushColor = Color.FromArgb(0, feed.BrushColor);
feed.PenColor = Color.FromArgb(0, feed.PenColor); feed.PenColor = Color.FromArgb(0, feed.PenColor);
} }
text = new string(' ', Space) + value; text = new string(' ', Space) + value;
Max = text.Length; Max = text.Length;
Count = Space; Count = Space;
f1 = false; f1 = false;
} }
} }
public double Speed public double Speed
{ {
get get
{ {
return speed; return speed;
} }
set set
{ {
speed = value; speed = value;
} }
} }
public Vector2D Position public Vector2D Position
{ {
get get
{ {
return parT.PositionBase; return parT.PositionBase;
} }
set set
{ {
parT.PositionBase = value; parT.PositionBase = value;
if (feed != null) if (feed != null)
{ {
feed.PositionBase = parT.ToGlobal(parT.OP[0].ps[2] * 0.95); feed.PositionBase = parT.ToGlobal(parT.OP[0].ps[2] * 0.95);
} }
} }
} }
public bool IsPlaying => !f1; public bool IsPlaying => !f1;
public Tex(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, double Speed, ref Color FeedColor, Action<Tex> Action) public Tex(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, double Speed, ref Color FeedColor, Action<Tex> Action)
{ {
try try
{ {
if (!File.Exists(ConfigPath)) if (!File.Exists(ConfigPath))
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
else else
{ {
string[] source = ConfigPath.ReadLines(); string[] source = ConfigPath.ReadLines();
FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1'; FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1';
} }
} }
catch catch
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
if (FastText) if (FastText)
{ {
this.Speed = 50.0; this.Speed = 50.0;
speed = 50.0; speed = 50.0;
} }
else else
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
this.Space = Space; this.Space = Space;
this.Text = Text; this.Text = Text;
this.Action = Action; this.Action = Action;
SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor); SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor);
SetFeed(Name, Size, ref FeedColor); SetFeed(Name, Size, ref FeedColor);
mv = new MotV(0.0, 255.0); mv = new MotV(0.0, 255.0);
mv.BaseSpeed = 2.0; mv.BaseSpeed = 2.0;
} }
public Tex(string Name, Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, Color TextColor, Color ShadColor, Color BackColor, double Speed, Color FeedColor, Action<Tex> Action) public Tex(string Name, Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, Color TextColor, Color ShadColor, Color BackColor, double Speed, Color FeedColor, Action<Tex> Action)
{ {
try try
{ {
if (!File.Exists(ConfigPath)) if (!File.Exists(ConfigPath))
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
else else
{ {
string[] source = ConfigPath.ReadLines(); string[] source = ConfigPath.ReadLines();
FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1'; FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1';
} }
} }
catch catch
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
if (FastText) if (FastText)
{ {
this.Speed = 50.0; this.Speed = 50.0;
speed = 50.0; speed = 50.0;
} }
else else
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
this.Space = Space; this.Space = Space;
this.Text = Text; this.Text = Text;
this.Action = Action; this.Action = Action;
SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor); SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor);
SetFeed(Name, Size, ref FeedColor); SetFeed(Name, Size, ref FeedColor);
mv = new MotV(0.0, 255.0); mv = new MotV(0.0, 255.0);
mv.BaseSpeed = 2.0; mv.BaseSpeed = 2.0;
} }
public Tex(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, double Speed) public Tex(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, double Speed)
{ {
try try
{ {
if (!File.Exists(ConfigPath)) if (!File.Exists(ConfigPath))
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
else else
{ {
string[] source = ConfigPath.ReadLines(); string[] source = ConfigPath.ReadLines();
FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1'; FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1';
} }
} }
catch catch
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
if (FastText) if (FastText)
{ {
this.Speed = 50.0; this.Speed = 50.0;
speed = 50.0; speed = 50.0;
} }
else else
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
this.Space = Space; this.Space = Space;
this.Text = Text; this.Text = Text;
SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor); SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor);
} }
public Tex(string Name, Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, Color TextColor, Color ShadColor, Color BackColor, double Speed) public Tex(string Name, Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, int Space, string Text, Color TextColor, Color ShadColor, Color BackColor, double Speed)
{ {
try try
{ {
if (!File.Exists(ConfigPath)) if (!File.Exists(ConfigPath))
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
else else
{ {
string[] source = ConfigPath.ReadLines(); string[] source = ConfigPath.ReadLines();
FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1'; FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1';
} }
} }
catch catch
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
if (FastText) if (FastText)
{ {
this.Speed = 50.0; this.Speed = 50.0;
speed = 50.0; speed = 50.0;
} }
else else
{ {
this.Speed = Speed; this.Speed = Speed;
speed = Speed; speed = Speed;
} }
this.Space = Space; this.Space = Space;
this.Text = Text; this.Text = Text;
SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor); SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor);
} }
private void SetParT(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor) private void SetParT(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor)
{ {
pars = new Pars(); pars = new Pars();
Out[] array = new Out[1] { Shas.Get正方形() }; Out[] array = new Out[1] { Shas.Get正方形() };
array.OutlineFalse(); array.OutlineFalse();
parT = new ParT parT = new ParT
{ {
Tag = Name, Tag = Name,
InitializeOP = array, InitializeOP = array,
PositionBase = Position, PositionBase = Position,
SizeBase = Size, SizeBase = Size,
Closed = true, Closed = true,
BrushColor = BackColor, BrushColor = BackColor,
Font = Font, Font = Font,
FontSize = TextSize, FontSize = TextSize,
TextColor = TextColor, TextColor = TextColor,
RectSize = new Vector2D(Width, Height), RectSize = new Vector2D(Width, Height),
Text = Text Text = Text
}; };
ParT.OP.ScalingX(ParT.BasePointBase, Width); ParT.OP.ScalingX(ParT.BasePointBase, Width);
ParT.OP.ScalingY(ParT.BasePointBase, Height); ParT.OP.ScalingY(ParT.BasePointBase, Height);
if (ShadColor != Color.Empty) if (ShadColor != Color.Empty)
{ {
parT.ShadBrush = new SolidBrush(ShadColor); parT.ShadBrush = new SolidBrush(ShadColor);
} }
pars.Add(parT.Tag, parT); pars.Add(parT.Tag, parT);
} }
private void SetFeed(string Name, double Size, ref Color FeedColor) private void SetFeed(string Name, double Size, ref Color FeedColor)
{ {
Out[] array = new Out[1] { Shas.Get三角形() }; Out[] array = new Out[1] { Shas.Get三角形() };
feed = new Par feed = new Par
{ {
Tag = Name + "_Feed", Tag = Name + "_Feed",
InitializeOP = array, InitializeOP = array,
BasePointBase = array.GetCenter(), BasePointBase = array.GetCenter(),
PositionBase = parT.ToGlobal(parT.OP[0].ps[2] * 0.96), PositionBase = parT.ToGlobal(parT.OP[0].ps[2] * 0.96),
SizeBase = Size * 0.07, SizeBase = Size * 0.07,
SizeYBase = 0.9, SizeYBase = 0.9,
Closed = true, Closed = true,
PenColor = Color.FromArgb(0, Color.Black), PenColor = Color.FromArgb(0, Color.Black),
BrushColor = Color.FromArgb(0, FeedColor), BrushColor = Color.FromArgb(0, FeedColor),
Hit = false Hit = false
}; };
feed.OP.ReverseY(feed.BasePointBase); feed.OP.ReverseY(feed.BasePointBase);
pars.Add(feed.Tag, feed); pars.Add(feed.Tag, feed);
} }
public void SetHitColor(Med Med) public void SetHitColor(Med Med)
{ {
if (parT.HitColor != Color.Transparent) if (parT.HitColor != Color.Transparent)
{ {
Med.RemUniqueColor(parT.HitColor); Med.RemUniqueColor(parT.HitColor);
} }
parT.HitColor = Med.GetUniqueColor(); parT.HitColor = Med.GetUniqueColor();
} }
public void Progression(FPS FPS) public void Progression(FPS FPS)
{ {
if (!f1) if (!f1)
{ {
Count += Speed / FPS.Value; Count += Speed / FPS.Value;
int num = (int)Count; int num = (int)Count;
if (num <= Max) if (num <= Max)
{ {
parT.Text = text.Substring(0, num); parT.Text = text.Substring(0, num);
return; return;
} }
parT.Text = text; parT.Text = text;
f1 = true; f1 = true;
if (feed != null) if (feed != null)
{ {
feed.BrushColor = Color.FromArgb(a0, feed.BrushColor); feed.BrushColor = Color.FromArgb(a0, feed.BrushColor);
feed.PenColor = Color.FromArgb(a1, feed.PenColor); feed.PenColor = Color.FromArgb(a1, feed.PenColor);
} }
if (Done != null) if (Done != null)
{ {
Done(this); Done(this);
Done = null; Done = null;
} }
} }
else if (feed != null && feed.Dra) else if (feed != null && feed.Dra)
{ {
mv.GetValue(FPS); mv.GetValue(FPS);
feed.BrushColor = Color.FromArgb((int)mv.Value, feed.BrushColor); feed.BrushColor = Color.FromArgb((int)mv.Value, feed.BrushColor);
feed.PenColor = Color.FromArgb(feed.BrushColor.A, feed.PenColor); feed.PenColor = Color.FromArgb(feed.BrushColor.A, feed.PenColor);
} }
} }
public bool Down(ref Color HitColor) public bool Down(ref Color HitColor)
{ {
if (parT.HitColor == HitColor) if (parT.HitColor == HitColor)
{ {
f2 = true; f2 = true;
if (!f1 && Speed == speed) if (!f1 && Speed == speed)
{ {
Speed *= 10.0; Speed *= 10.0;
return true; return true;
} }
} }
return false; return false;
} }
public bool Up(ref Color HitColor) public bool Up(ref Color HitColor)
{ {
if (f1 && f2 && parT.HitColor == HitColor && Speed == speed) if (f1 && f2 && parT.HitColor == HitColor && Speed == speed)
{ {
f1 = false; f1 = false;
f2 = false; f2 = false;
if (feed != null) if (feed != null)
{ {
feed.BrushColor = Color.FromArgb(0, feed.BrushColor); feed.BrushColor = Color.FromArgb(0, feed.BrushColor);
feed.PenColor = Color.FromArgb(feed.BrushColor.A, feed.PenColor); feed.PenColor = Color.FromArgb(feed.BrushColor.A, feed.PenColor);
mv.ResetValue(); mv.ResetValue();
} }
Action(this); Action(this);
return true; return true;
} }
Speed = speed; Speed = speed;
f2 = false; f2 = false;
return false; return false;
} }
public void Dispose() public void Dispose()
{ {
pars.Dispose(); pars.Dispose();
} }
}
} }

View File

@@ -1,27 +1,28 @@
using System.IO; using System.IO;
using System.Text; using System.Text;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class Text
{ {
public static void ToText(this string str, string Path, Encoding Encoding) public static class Text
{ {
using StreamWriter streamWriter = new StreamWriter(Path, append: false, Encoding); public static void ToText(this string str, string Path, Encoding Encoding)
streamWriter.Write(str); {
} using StreamWriter streamWriter = new StreamWriter(Path, append: false, Encoding);
streamWriter.Write(str);
}
public static string FromText(this string Path) public static string FromText(this string Path)
{ {
using FileStream fileStream = new FileStream(Path, FileMode.Open, FileAccess.Read); using FileStream fileStream = new FileStream(Path, FileMode.Open, FileAccess.Read);
byte[] array = new byte[fileStream.Length]; byte[] array = new byte[fileStream.Length];
fileStream.Read(array, 0, array.Length); fileStream.Read(array, 0, array.Length);
using StreamReader streamReader = new StreamReader(new MemoryStream(array), array.GetEncoding()); using StreamReader streamReader = new StreamReader(new MemoryStream(array), array.GetEncoding());
return streamReader.ReadToEnd(); return streamReader.ReadToEnd();
} }
public static string[] ReadLines(this string Path) public static string[] ReadLines(this string Path)
{ {
return Path.FromText().Replace("\r", "").Split('\n'); return Path.FromText().Replace("\r", "").Split('\n');
} }
}
} }

View File

@@ -3,117 +3,118 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
namespace _2DGAMELIB; namespace _2DGAMELIB
public class UI //: Form
{ {
private Med Med; public class UI //: Form
{
private Med Med;
private IContainer components; private IContainer components;
private GlImage wpfImage1; private GlImage wpfImage1;
//private System.Windows.Controls.Image hostedComponent1; //private System.Windows.Controls.Image hostedComponent1;
private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini"; private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini";
private bool BigWindow; private bool BigWindow;
public UI(Med Med) public UI(Med Med)
{ {
this.Med = Med; this.Med = Med;
InitializeComponent(); InitializeComponent();
} }
private void UI_Load(object sender, EventArgs e) private void UI_Load(object sender, EventArgs e)
{ {
//base.ClientSize = //base.ClientSize =
Med.Setting(wpfImage1); Med.Setting(wpfImage1);
//base.ClientSize = new Size(1024, 768); //base.ClientSize = new Size(1024, 768);
try try
{ {
if (!File.Exists(ConfigPath)) if (!File.Exists(ConfigPath))
{ {
BigWindow = false; BigWindow = false;
} }
else else
{ {
string[] source = ConfigPath.ReadLines(); string[] source = ConfigPath.ReadLines();
BigWindow = source.First((string s) => s.StartsWith("BigWindow:")).Last() == '1'; BigWindow = source.First((string s) => s.StartsWith("BigWindow:")).Last() == '1';
} }
} }
catch catch
{ {
BigWindow = false; BigWindow = false;
} }
if (BigWindow) if (BigWindow)
{ {
//base.ClientSize = new Size(1280, 960); //base.ClientSize = new Size(1280, 960);
} }
UI_Resize(null, null); UI_Resize(null, null);
} }
private void UI_FormClosing() private void UI_FormClosing()
{ {
Med.Drive = false; Med.Drive = false;
} }
private void UI_Resize(object sender, EventArgs e) private void UI_Resize(object sender, EventArgs e)
{ {
//wpfImage1.ImageSetting(); //wpfImage1.ImageSetting();
//wpfImage1.Image.Width = (double)base.ClientSize.Width * Med.DpiX; //wpfImage1.Image.Width = (double)base.ClientSize.Width * Med.DpiX;
//wpfImage1.Image.Height = (double)base.ClientSize.Height * Med.DpiY; //wpfImage1.Image.Height = (double)base.ClientSize.Height * Med.DpiY;
} }
/* /*
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && components != null) if (disposing && components != null)
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
}*/ }*/
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(_2DGAMELIB.UI)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(_2DGAMELIB.UI));
this.wpfImage1 = new GlImage(); this.wpfImage1 = new GlImage();
//this.hostedComponent1 = new System.Windows.Controls.Image(); //this.hostedComponent1 = new System.Windows.Controls.Image();
//base.SuspendLayout(); //base.SuspendLayout();
/* /*
this.wpfImage1.BackColor = System.Drawing.Color.Black; this.wpfImage1.BackColor = System.Drawing.Color.Black;
this.wpfImage1.Dock = System.Windows.Forms.DockStyle.Fill; this.wpfImage1.Dock = System.Windows.Forms.DockStyle.Fill;
this.wpfImage1.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.wpfImage1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.wpfImage1.Location = new System.Drawing.Point(0, 0); this.wpfImage1.Location = new System.Drawing.Point(0, 0);
this.wpfImage1.Name = "wpfImage1"; this.wpfImage1.Name = "wpfImage1";
this.wpfImage1.Text = "wpfImage1"; this.wpfImage1.Text = "wpfImage1";
this.wpfImage1.TabIndex = 0; this.wpfImage1.TabIndex = 0;
this.wpfImage1.Child = this.hostedComponent1;*/ this.wpfImage1.Child = this.hostedComponent1;*/
//this.Text = "UI"; //this.Text = "UI";
//base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f); //base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
//base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; //base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
//base.Controls.Add(this.wpfImage1); //base.Controls.Add(this.wpfImage1);
//base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; //base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
//base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); //base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
//base.Name = "UI"; //base.Name = "UI";
//base.StartPosition = System.Windows.Forms.FormStartPosition.Manual; //base.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
//base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(UI_FormClosing); //base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(UI_FormClosing);
//beauty //beauty
this.wpfImage1.Closing = delegate () { UI_FormClosing(); }; this.wpfImage1.Closing = delegate () { UI_FormClosing(); };
//TODO fix? //TODO fix?
//base.Load += new System.EventHandler(UI_Load); //base.Load += new System.EventHandler(UI_Load);
UI_Load(null, null); UI_Load(null, null);
//base.Resize += new System.EventHandler(UI_Resize); //base.Resize += new System.EventHandler(UI_Resize);
//base.ResumeLayout(false); //base.ResumeLayout(false);
} }
}
} }

View File

@@ -1,67 +1,68 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class Vec
{ {
public static class Vec
{
public static void Add(ref Vector2D v1, ref Vector2D v2, out Vector2D r) public static void Add(ref Vector2D v1, ref Vector2D v2, out Vector2D r)
{ {
r.X = v1.X + v2.X; r.X = v1.X + v2.X;
r.Y = v1.Y + v2.Y; r.Y = v1.Y + v2.Y;
} }
public static void Subtract(ref Vector2D v1, ref Vector2D v2, out Vector2D r) public static void Subtract(ref Vector2D v1, ref Vector2D v2, out Vector2D r)
{ {
r.X = v1.X - v2.X; r.X = v1.X - v2.X;
r.Y = v1.Y - v2.Y; r.Y = v1.Y - v2.Y;
} }
public static double DistanceSquared(this Vector2D v1, Vector2D v2) public static double DistanceSquared(this Vector2D v1, Vector2D v2)
{ {
double num = v1.X - v2.X; double num = v1.X - v2.X;
double num2 = v1.Y - v2.Y; double num2 = v1.Y - v2.Y;
return num * num + num2 * num2; return num * num + num2 * num2;
} }
public static void Dot(ref Vector2D v1, ref Vector2D v2, out double r) public static void Dot(ref Vector2D v1, ref Vector2D v2, out double r)
{ {
r = v1.X * v2.X + v1.Y * v2.Y; r = v1.X * v2.X + v1.Y * v2.Y;
} }
public static double Cross(ref Vector2D v1, ref Vector2D v2) public static double Cross(ref Vector2D v1, ref Vector2D v2)
{ {
return v1.X * v2.Y - v1.Y * v2.X; return v1.X * v2.Y - v1.Y * v2.X;
} }
public static Vector2D newNormalize(this Vector2D vector) public static Vector2D newNormalize(this Vector2D vector)
{ {
vector.Normalize(); vector.Normalize();
return vector; return vector;
} }
public static double Angle(ref Vector2D v1, ref Vector2D v2) public static double Angle(ref Vector2D v1, ref Vector2D v2)
{ {
Dot(ref v1, ref v2, out var r); Dot(ref v1, ref v2, out var r);
r /= v1.Length() * v2.Length(); r /= v1.Length() * v2.Length();
if (r > 1.0) if (r > 1.0)
{ {
r = 1.0; r = 1.0;
} }
else if (r < -1.0) else if (r < -1.0)
{ {
r = -1.0; r = -1.0;
} }
return System.Math.Acos(r); return System.Math.Acos(r);
} }
public static double Angle02π(this Vector2D v1, Vector2D v2) public static double Angle02π(this Vector2D v1, Vector2D v2)
{ {
double num = Angle(ref v1, ref v2); double num = Angle(ref v1, ref v2);
if (Cross(ref v1, ref v2) < 0.0) if (Cross(ref v1, ref v2) < 0.0)
{ {
num = System.Math.PI * 2.0 - num; num = System.Math.PI * 2.0 - num;
} }
return num; return num;
} }
}
} }

View File

@@ -1,126 +1,127 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public struct Vector2D
{ {
public double X; [Serializable]
public struct Vector2D
{
public double X;
public double Y; public double Y;
public double this[int index] public double this[int index]
{ {
get get
{ {
return index switch return index switch
{ {
0 => X, 0 => X,
1 => Y, 1 => Y,
_ => throw new ArgumentOutOfRangeException("index", "Indices for Vector2D run from 0 to 1, inclusive."), _ => throw new ArgumentOutOfRangeException("index", "Indices for Vector2D run from 0 to 1, inclusive."),
}; };
} }
set set
{ {
switch (index) switch (index)
{ {
case 0: case 0:
X = value; X = value;
break; break;
case 1: case 1:
Y = value; Y = value;
break; break;
default: default:
throw new ArgumentOutOfRangeException("index", "Indices for Vector2D run from 0 to 1, inclusive."); throw new ArgumentOutOfRangeException("index", "Indices for Vector2D run from 0 to 1, inclusive.");
} }
} }
} }
public Vector2D(int value) public Vector2D(int value)
{ {
X = value; X = value;
Y = value; Y = value;
} }
public Vector2D(float value) public Vector2D(float value)
{ {
X = value; X = value;
Y = value; Y = value;
} }
public Vector2D(double value) public Vector2D(double value)
{ {
X = value; X = value;
Y = value; Y = value;
} }
public Vector2D(int x, int y) public Vector2D(int x, int y)
{ {
X = x; X = x;
Y = y; Y = y;
} }
public Vector2D(float x, float y) public Vector2D(float x, float y)
{ {
X = x; X = x;
Y = y; Y = y;
} }
public Vector2D(double x, double y) public Vector2D(double x, double y)
{ {
X = x; X = x;
Y = y; Y = y;
} }
public double Length() public double Length()
{ {
return System.Math.Sqrt(X * X + Y * Y); return System.Math.Sqrt(X * X + Y * Y);
} }
public double LengthSquared() public double LengthSquared()
{ {
return X * X + Y * Y; return X * X + Y * Y;
} }
public void Normalize() public void Normalize()
{ {
double num = Length(); double num = Length();
if (num != 0.0) if (num != 0.0)
{ {
double num2 = 1.0 / num; double num2 = 1.0 / num;
X *= num2; X *= num2;
Y *= num2; Y *= num2;
} }
} }
public static Vector2D operator +(Vector2D left, Vector2D right) public static Vector2D operator +(Vector2D left, Vector2D right)
{ {
return new Vector2D(left.X + right.X, left.Y + right.Y); return new Vector2D(left.X + right.X, left.Y + right.Y);
} }
public static Vector2D operator -(Vector2D left, Vector2D right) public static Vector2D operator -(Vector2D left, Vector2D right)
{ {
return new Vector2D(left.X - right.X, left.Y - right.Y); return new Vector2D(left.X - right.X, left.Y - right.Y);
} }
public static Vector2D operator -(Vector2D value) public static Vector2D operator -(Vector2D value)
{ {
return new Vector2D(0.0 - value.X, 0.0 - value.Y); return new Vector2D(0.0 - value.X, 0.0 - value.Y);
} }
public static Vector2D operator *(Vector2D value, double scale) public static Vector2D operator *(Vector2D value, double scale)
{ {
return new Vector2D(value.X * scale, value.Y * scale); return new Vector2D(value.X * scale, value.Y * scale);
} }
public static Vector2D operator *(double scale, Vector2D value) public static Vector2D operator *(double scale, Vector2D value)
{ {
return new Vector2D(value.X * scale, value.Y * scale); return new Vector2D(value.X * scale, value.Y * scale);
} }
public static Vector2D operator /(Vector2D value, double scale) public static Vector2D operator /(Vector2D value, double scale)
{ {
return new Vector2D(value.X / scale, value.Y / scale); return new Vector2D(value.X / scale, value.Y / scale);
} }
}
} }

View File

@@ -1,23 +1,24 @@
using System; using System;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public struct Vector2D_2
{ {
public Vector2D v1; [Serializable]
public struct Vector2D_2
{
public Vector2D v1;
public Vector2D v2; public Vector2D v2;
public Vector2D_2(Vector2D v1, Vector2D v2) public Vector2D_2(Vector2D v1, Vector2D v2)
{ {
this.v1 = v1; this.v1 = v1;
this.v2 = v2; this.v2 = v2;
} }
public Vector2D_2(ref Vector2D v1, ref Vector2D v2) public Vector2D_2(ref Vector2D v1, ref Vector2D v2)
{ {
this.v1 = v1; this.v1 = v1;
this.v2 = v2; this.v2 = v2;
} }
}
} }

View File

@@ -1,189 +1,190 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public struct Vector3D
{ {
public double X; [Serializable]
public struct Vector3D
{
public double X;
public double Y; public double Y;
public double Z; public double Z;
public double this[int index] public double this[int index]
{ {
get get
{ {
return index switch return index switch
{ {
0 => X, 0 => X,
1 => Y, 1 => Y,
2 => Z, 2 => Z,
_ => throw new ArgumentOutOfRangeException("index", "Indices for Vector3D run from 0 to 2, inclusive."), _ => throw new ArgumentOutOfRangeException("index", "Indices for Vector3D run from 0 to 2, inclusive."),
}; };
} }
set set
{ {
switch (index) switch (index)
{ {
case 0: case 0:
X = value; X = value;
break; break;
case 1: case 1:
Y = value; Y = value;
break; break;
case 2: case 2:
Z = value; Z = value;
break; break;
default: default:
throw new ArgumentOutOfRangeException("index", "Indices for Vector3D run from 0 to 2, inclusive."); throw new ArgumentOutOfRangeException("index", "Indices for Vector3D run from 0 to 2, inclusive.");
} }
} }
} }
public Vector3D(double value) public Vector3D(double value)
{ {
X = value; X = value;
Y = value; Y = value;
Z = value; Z = value;
} }
public Vector3D(Vector2D value, double z) public Vector3D(Vector2D value, double z)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
Z = z; Z = z;
} }
public Vector3D(ref Vector2D value, double z) public Vector3D(ref Vector2D value, double z)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
Z = z; Z = z;
} }
public Vector3D(double x, double y, double z) public Vector3D(double x, double y, double z)
{ {
X = x; X = x;
Y = y; Y = y;
Z = z; Z = z;
} }
public double Length() public double Length()
{ {
return System.Math.Sqrt(X * X + Y * Y + Z * Z); return System.Math.Sqrt(X * X + Y * Y + Z * Z);
} }
public double LengthSquared() public double LengthSquared()
{ {
return X * X + Y * Y + Z * Z; return X * X + Y * Y + Z * Z;
} }
public void Normalize() public void Normalize()
{ {
double num = Length(); double num = Length();
if (num != 0.0) if (num != 0.0)
{ {
double num2 = 1.0 / num; double num2 = 1.0 / num;
X *= num2; X *= num2;
Y *= num2; Y *= num2;
Z *= num2; Z *= num2;
} }
} }
public static Vector3D operator +(Vector3D left, Vector3D right) public static Vector3D operator +(Vector3D left, Vector3D right)
{ {
return new Vector3D(left.X + right.X, left.Y + right.Y, left.Z + right.Z); return new Vector3D(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
} }
public static Vector3D operator -(Vector3D left, Vector3D right) public static Vector3D operator -(Vector3D left, Vector3D right)
{ {
return new Vector3D(left.X - right.X, left.Y - right.Y, left.Z - right.Z); return new Vector3D(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
} }
public static Vector3D operator -(Vector3D value) public static Vector3D operator -(Vector3D value)
{ {
return new Vector3D(0.0 - value.X, 0.0 - value.Y, 0.0 - value.Z); return new Vector3D(0.0 - value.X, 0.0 - value.Y, 0.0 - value.Z);
} }
public static Vector3D operator *(Vector3D value, double scale) public static Vector3D operator *(Vector3D value, double scale)
{ {
return new Vector3D(value.X * scale, value.Y * scale, value.Z * scale); return new Vector3D(value.X * scale, value.Y * scale, value.Z * scale);
} }
public static Vector3D operator *(double scale, Vector3D value) public static Vector3D operator *(double scale, Vector3D value)
{ {
return new Vector3D(value.X * scale, value.Y * scale, value.Z * scale); return new Vector3D(value.X * scale, value.Y * scale, value.Z * scale);
} }
public static Vector3D operator /(Vector3D value, double scale) public static Vector3D operator /(Vector3D value, double scale)
{ {
return new Vector3D(value.X / scale, value.Y / scale, value.Z / scale); return new Vector3D(value.X / scale, value.Y / scale, value.Z / scale);
} }
public static bool operator ==(Vector3D left, Vector3D right) public static bool operator ==(Vector3D left, Vector3D right)
{ {
if (left.X == right.X && left.Y == right.Y) if (left.X == right.X && left.Y == right.Y)
{ {
return left.Z == right.Z; return left.Z == right.Z;
} }
return false; return false;
} }
public static bool operator !=(Vector3D left, Vector3D right) public static bool operator !=(Vector3D left, Vector3D right)
{ {
if (left.X == right.X && left.Y == right.Y) if (left.X == right.X && left.Y == right.Y)
{ {
return left.Z != right.Z; return left.Z != right.Z;
} }
return true; return true;
} }
public override string ToString() public override string ToString()
{ {
return string.Format(CultureInfo.CurrentCulture, "X:{0} Y:{1} Z:{2}", new object[3] return string.Format(CultureInfo.CurrentCulture, "X:{0} Y:{1} Z:{2}", new object[3]
{ {
X.ToString(CultureInfo.CurrentCulture), X.ToString(CultureInfo.CurrentCulture),
Y.ToString(CultureInfo.CurrentCulture), Y.ToString(CultureInfo.CurrentCulture),
Z.ToString(CultureInfo.CurrentCulture) Z.ToString(CultureInfo.CurrentCulture)
}); });
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode(); return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode();
} }
public override bool Equals(object value) public override bool Equals(object value)
{ {
if (value == null) if (value == null)
{ {
return false; return false;
} }
if (value.GetType() != GetType()) if (value.GetType() != GetType())
{ {
return false; return false;
} }
return Equals((Vector3D)value); return Equals((Vector3D)value);
} }
public bool Equals(Vector3D value) public bool Equals(Vector3D value)
{ {
if (X == value.X && Y == value.Y) if (X == value.X && Y == value.Y)
{ {
return Z == value.Z; return Z == value.Z;
} }
return false; return false;
} }
public bool Equals(ref Vector3D value) public bool Equals(ref Vector3D value)
{ {
if (X == value.X && Y == value.Y) if (X == value.X && Y == value.Y)
{ {
return Z == value.Z; return Z == value.Z;
} }
return false; return false;
} }
}
} }

View File

@@ -1,211 +1,212 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace _2DGAMELIB; namespace _2DGAMELIB
[Serializable]
public struct Vector4D
{ {
public double X; [Serializable]
public struct Vector4D
{
public double X;
public double Y; public double Y;
public double Z; public double Z;
public double W; public double W;
public double this[int index] public double this[int index]
{ {
get get
{ {
return index switch return index switch
{ {
0 => X, 0 => X,
1 => Y, 1 => Y,
2 => Z, 2 => Z,
3 => W, 3 => W,
_ => throw new ArgumentOutOfRangeException("index", "Indices for Vector4D run from 0 to 3, inclusive."), _ => throw new ArgumentOutOfRangeException("index", "Indices for Vector4D run from 0 to 3, inclusive."),
}; };
} }
set set
{ {
switch (index) switch (index)
{ {
case 0: case 0:
X = value; X = value;
break; break;
case 1: case 1:
Y = value; Y = value;
break; break;
case 2: case 2:
Z = value; Z = value;
break; break;
case 3: case 3:
W = value; W = value;
break; break;
default: default:
throw new ArgumentOutOfRangeException("index", "Indices for Vector4D run from 0 to 3, inclusive."); throw new ArgumentOutOfRangeException("index", "Indices for Vector4D run from 0 to 3, inclusive.");
} }
} }
} }
public Vector4D(double value) public Vector4D(double value)
{ {
X = value; X = value;
Y = value; Y = value;
Z = value; Z = value;
W = value; W = value;
} }
public Vector4D(Vector2D value, double z, double w) public Vector4D(Vector2D value, double z, double w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
Z = z; Z = z;
W = w; W = w;
} }
public Vector4D(ref Vector2D value, double z, double w) public Vector4D(ref Vector2D value, double z, double w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
Z = z; Z = z;
W = w; W = w;
} }
public Vector4D(Vector3D value, double w) public Vector4D(Vector3D value, double w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
Z = value.Z; Z = value.Z;
W = w; W = w;
} }
public Vector4D(ref Vector3D value, double w) public Vector4D(ref Vector3D value, double w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
Z = value.Z; Z = value.Z;
W = w; W = w;
} }
public Vector4D(double x, double y, double z, double w) public Vector4D(double x, double y, double z, double w)
{ {
X = x; X = x;
Y = y; Y = y;
Z = z; Z = z;
W = w; W = w;
} }
public double Length() public double Length()
{ {
return System.Math.Sqrt(X * X + Y * Y + Z * Z + W * W); return System.Math.Sqrt(X * X + Y * Y + Z * Z + W * W);
} }
public double LengthSquared() public double LengthSquared()
{ {
return X * X + Y * Y + Z * Z + W * W; return X * X + Y * Y + Z * Z + W * W;
} }
public void Normalize() public void Normalize()
{ {
double num = Length(); double num = Length();
if (num != 0.0) if (num != 0.0)
{ {
double num2 = 1.0 / num; double num2 = 1.0 / num;
X *= num2; X *= num2;
Y *= num2; Y *= num2;
Z *= num2; Z *= num2;
W *= num2; W *= num2;
} }
} }
public static Vector4D operator +(Vector4D left, Vector4D right) public static Vector4D operator +(Vector4D left, Vector4D right)
{ {
return new Vector4D(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); return new Vector4D(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
} }
public static Vector4D operator -(Vector4D left, Vector4D right) public static Vector4D operator -(Vector4D left, Vector4D right)
{ {
return new Vector4D(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); return new Vector4D(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
} }
public static Vector4D operator -(Vector4D value) public static Vector4D operator -(Vector4D value)
{ {
return new Vector4D(0.0 - value.X, 0.0 - value.Y, 0.0 - value.Z, 0.0 - value.W); return new Vector4D(0.0 - value.X, 0.0 - value.Y, 0.0 - value.Z, 0.0 - value.W);
} }
public static Vector4D operator *(Vector4D value, double scale) public static Vector4D operator *(Vector4D value, double scale)
{ {
return new Vector4D(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale); return new Vector4D(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale);
} }
public static Vector4D operator *(double scale, Vector4D value) public static Vector4D operator *(double scale, Vector4D value)
{ {
return new Vector4D(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale); return new Vector4D(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale);
} }
public static Vector4D operator /(Vector4D value, double scale) public static Vector4D operator /(Vector4D value, double scale)
{ {
return new Vector4D(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale); return new Vector4D(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale);
} }
public static bool operator ==(Vector4D left, Vector4D right) public static bool operator ==(Vector4D left, Vector4D right)
{ {
if (left.X == right.X && left.Y == right.Y && left.Z == right.Z) if (left.X == right.X && left.Y == right.Y && left.Z == right.Z)
{ {
return left.W == right.W; return left.W == right.W;
} }
return false; return false;
} }
public static bool operator !=(Vector4D left, Vector4D right) public static bool operator !=(Vector4D left, Vector4D right)
{ {
if (left.X == right.X && left.Y == right.Y && left.Z == right.Z) if (left.X == right.X && left.Y == right.Y && left.Z == right.Z)
{ {
return left.W != right.W; return left.W != right.W;
} }
return true; return true;
} }
public override string ToString() public override string ToString()
{ {
return string.Format(CultureInfo.CurrentCulture, "X:{0} Y:{1} Z:{2} W:{3}", X.ToString(CultureInfo.CurrentCulture), Y.ToString(CultureInfo.CurrentCulture), Z.ToString(CultureInfo.CurrentCulture), W.ToString(CultureInfo.CurrentCulture)); return string.Format(CultureInfo.CurrentCulture, "X:{0} Y:{1} Z:{2} W:{3}", X.ToString(CultureInfo.CurrentCulture), Y.ToString(CultureInfo.CurrentCulture), Z.ToString(CultureInfo.CurrentCulture), W.ToString(CultureInfo.CurrentCulture));
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode(); return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode();
} }
public override bool Equals(object value) public override bool Equals(object value)
{ {
if (value == null) if (value == null)
{ {
return false; return false;
} }
if (value.GetType() != GetType()) if (value.GetType() != GetType())
{ {
return false; return false;
} }
return Equals((Vector4D)value); return Equals((Vector4D)value);
} }
public bool Equals(Vector4D value) public bool Equals(Vector4D value)
{ {
if (X == value.X && Y == value.Y && Z == value.Z) if (X == value.X && Y == value.Y && Z == value.Z)
{ {
return W == value.W; return W == value.W;
} }
return false; return false;
} }
public bool Equals(ref Vector4D value) public bool Equals(ref Vector4D value)
{ {
if (X == value.X && Y == value.Y && Z == value.Z) if (X == value.X && Y == value.Y && Z == value.Z)
{ {
return W == value.W; return W == value.W;
} }
return false; return false;
} }
}
} }

View File

@@ -6,146 +6,146 @@ using System.Drawing.Imaging;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
namespace _2DGAMELIB; namespace _2DGAMELIB
public enum MouseButtons {
None = 0,
Left = 1,
Right = 2,
Middle = 4,
Button4 = 8,
Button5 = 16
}
public class GlImage
{ {
public enum MouseButtons {
None = 0,
Left = 1,
Right = 2,
Middle = 4,
Button4 = 8,
Button5 = 16
}
//yeah this is a little bit sketchy public class GlImage
public static unsafe GLFW.Window PtrToWindow(IntPtr source)
{ {
var sourceRef = __makeref(source);
var dest = default(GLFW.Window);
var destRef = __makeref(dest);
*(IntPtr*)&destRef = *(IntPtr*)&sourceRef;
return __refvalue(destRef, GLFW.Window);
}
public GLFW.Window window; //yeah this is a little bit sketchy
private uint shader_program; public static unsafe GLFW.Window PtrToWindow(IntPtr source)
private uint texture; {
private uint vertex_buf; var sourceRef = __makeref(source);
private uint vao; var dest = default(GLFW.Window);
var destRef = __makeref(dest);
*(IntPtr*)&destRef = *(IntPtr*)&sourceRef;
return __refvalue(destRef, GLFW.Window);
}
public GLFW.Window window;
private uint shader_program;
private uint texture;
private uint vertex_buf;
private uint vao;
public GlImage() { } public GlImage() { }
public void ImageSetting() { } public void ImageSetting() { }
public System.Drawing.Point GetCursorPoint() { public System.Drawing.Point GetCursorPoint() {
double x, y; double x, y;
Glfw.GetCursorPosition(window, out x, out y); Glfw.GetCursorPosition(window, out x, out y);
return new System.Drawing.Point((int)x, (int)y); return new System.Drawing.Point((int)x, (int)y);
} }
public MouseButtons GetMouseButtons() { public MouseButtons GetMouseButtons() {
MouseButtons btns = 0; MouseButtons btns = 0;
if (Glfw.GetMouseButton(window, MouseButton.Left) == InputState.Press) if (Glfw.GetMouseButton(window, MouseButton.Left) == InputState.Press)
btns |= MouseButtons.Left; btns |= MouseButtons.Left;
if (Glfw.GetMouseButton(window, MouseButton.Right) == InputState.Press) if (Glfw.GetMouseButton(window, MouseButton.Right) == InputState.Press)
btns |= MouseButtons.Right; btns |= MouseButtons.Right;
if (Glfw.GetMouseButton(window, MouseButton.Middle) == InputState.Press) if (Glfw.GetMouseButton(window, MouseButton.Middle) == InputState.Press)
btns |= MouseButtons.Middle; btns |= MouseButtons.Middle;
if (Glfw.GetMouseButton(window, MouseButton.Button4) == InputState.Press) if (Glfw.GetMouseButton(window, MouseButton.Button4) == InputState.Press)
btns |= MouseButtons.Button4; btns |= MouseButtons.Button4;
if (Glfw.GetMouseButton(window, MouseButton.Button5) == InputState.Press) if (Glfw.GetMouseButton(window, MouseButton.Button5) == InputState.Press)
btns |= MouseButtons.Button5; btns |= MouseButtons.Button5;
return btns; return btns;
} }
public delegate void ShouldCloseCallback(); public delegate void ShouldCloseCallback();
public ShouldCloseCallback Closing = delegate () { }; public ShouldCloseCallback Closing = delegate () { };
public MouseButtonCallback Click = delegate (IntPtr window, MouseButton button, InputState state, ModifierKeys modifiers) { }; public MouseButtonCallback Click = delegate (IntPtr window, MouseButton button, InputState state, ModifierKeys modifiers) { };
public MouseCallback Move = delegate (IntPtr window, double x, double y) { }; public MouseCallback Move = delegate (IntPtr window, double x, double y) { };
public SizeCallback Resize = delegate (IntPtr window, int width, int height) { }; public SizeCallback Resize = delegate (IntPtr window, int width, int height) { };
public MouseCallback Scroll = delegate (IntPtr window, double x, double y) { }; public MouseCallback Scroll = delegate (IntPtr window, double x, double y) { };
public MouseEnterCallback Leave = delegate (IntPtr window, bool entered) { }; public MouseEnterCallback Leave = delegate (IntPtr window, bool entered) { };
public void SetTitle(string title) { public void SetTitle(string title) {
Glfw.SetWindowTitle(window, title); Glfw.SetWindowTitle(window, title);
} }
public void PollEvents() { public void PollEvents() {
Glfw.PollEvents(); Glfw.PollEvents();
if (Glfw.WindowShouldClose(window)) if (Glfw.WindowShouldClose(window))
Closing(); Closing();
} }
public void SetBitmap(Bitmap bmp) public void SetBitmap(Bitmap bmp)
{ {
Gl.UseProgram(shader_program); Gl.UseProgram(shader_program);
Gl.Viewport(0, 0, bmp.Width, bmp.Height); Gl.Viewport(0, 0, bmp.Width, bmp.Height);
Gl.ActiveTexture(TextureUnit.Texture0); Gl.ActiveTexture(TextureUnit.Texture0);
Gl.BindTexture(TextureTarget.Texture2d, texture); Gl.BindTexture(TextureTarget.Texture2d, texture);
BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Gl.TexImage2D(TextureTarget.Texture2d, 0, InternalFormat.Rgba8, bmp.Width, bmp.Height, 0, OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); Gl.TexImage2D(TextureTarget.Texture2d, 0, InternalFormat.Rgba8, bmp.Width, bmp.Height, 0, OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
bmp.UnlockBits(data); bmp.UnlockBits(data);
int res_pos = Gl.GetUniformLocation(shader_program, "res"); int res_pos = Gl.GetUniformLocation(shader_program, "res");
Gl.Uniform2(res_pos, (float)bmp.Width, (float)bmp.Height); Gl.Uniform2(res_pos, (float)bmp.Width, (float)bmp.Height);
Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf); Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf);
uint vert_pos = (uint)Gl.GetAttribLocation(shader_program, "vertPos"); uint vert_pos = (uint)Gl.GetAttribLocation(shader_program, "vertPos");
Gl.EnableVertexAttribArray(vert_pos); Gl.EnableVertexAttribArray(vert_pos);
Gl.BindVertexArray(vao); Gl.BindVertexArray(vao);
Gl.VertexAttribPointer( Gl.VertexAttribPointer(
vert_pos, vert_pos,
2, 2,
VertexAttribType.Float, VertexAttribType.Float,
false, false,
0, 0,
IntPtr.Zero IntPtr.Zero
); );
Gl.DrawArrays(PrimitiveType.TriangleStrip, 0, 4); Gl.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
Glfw.SwapBuffers(window); Glfw.SwapBuffers(window);
} }
public void BitmapSetting(Bitmap bmp) public void BitmapSetting(Bitmap bmp)
{ {
Glfw.WindowHint(Hint.ClientApi, ClientApi.OpenGL); Glfw.WindowHint(Hint.ClientApi, ClientApi.OpenGL);
Glfw.WindowHint(Hint.ContextVersionMajor, 3); Glfw.WindowHint(Hint.ContextVersionMajor, 3);
Glfw.WindowHint(Hint.ContextVersionMinor, 3); Glfw.WindowHint(Hint.ContextVersionMinor, 3);
Glfw.WindowHint(Hint.OpenglProfile, Profile.Core); Glfw.WindowHint(Hint.OpenglProfile, Profile.Core);
Glfw.WindowHint(Hint.Doublebuffer, true); Glfw.WindowHint(Hint.Doublebuffer, true);
Glfw.WindowHint(Hint.Decorated, true); Glfw.WindowHint(Hint.Decorated, true);
Glfw.WindowHint(Hint.OpenglForwardCompatible, true); Glfw.WindowHint(Hint.OpenglForwardCompatible, true);
window = Glfw.CreateWindow(bmp.Width, bmp.Height, "yayy", Monitor.None, GLFW.Window.None); window = Glfw.CreateWindow(bmp.Width, bmp.Height, "yayy", Monitor.None, GLFW.Window.None);
Glfw.SetWindowSizeCallback(window, Resize); Glfw.SetWindowSizeCallback(window, Resize);
Glfw.SetMouseButtonCallback(window, Click); Glfw.SetMouseButtonCallback(window, Click);
Glfw.SetCursorPositionCallback(window, Move); Glfw.SetCursorPositionCallback(window, Move);
Glfw.SetScrollCallback(window, Scroll); Glfw.SetScrollCallback(window, Scroll);
Glfw.SetCursorEnterCallback(window, Leave); Glfw.SetCursorEnterCallback(window, Leave);
GCHandle handle = GCHandle.Alloc(this); GCHandle handle = GCHandle.Alloc(this);
Glfw.SetWindowUserPointer(window, GCHandle.ToIntPtr(handle)); Glfw.SetWindowUserPointer(window, GCHandle.ToIntPtr(handle));
Gl.Initialize(); Gl.Initialize();
Glfw.MakeContextCurrent(window); Glfw.MakeContextCurrent(window);
string[] vertexShaderSource = { string[] vertexShaderSource = {
@" @"
#version 100 #version 100
precision mediump float; precision mediump float;
@@ -156,10 +156,10 @@ void main()
gl_Position = vec4(vertPos, 0.0, 1.0); gl_Position = vec4(vertPos, 0.0, 1.0);
} }
" "
}; };
string[] fragmentShaderSource = { string[] fragmentShaderSource = {
@" @"
#version 100 #version 100
precision mediump float; precision mediump float;
@@ -174,151 +174,153 @@ void main()
gl_FragColor = texture2D(sTexture, tc); gl_FragColor = texture2D(sTexture, tc);
} }
" "
}; };
uint vertexShader = Gl.CreateShader(ShaderType.VertexShader); uint vertexShader = Gl.CreateShader(ShaderType.VertexShader);
Gl.ShaderSource(vertexShader, vertexShaderSource); Gl.ShaderSource(vertexShader, vertexShaderSource);
Gl.CompileShader(vertexShader); Gl.CompileShader(vertexShader);
uint fragmentShader = Gl.CreateShader(ShaderType.FragmentShader); uint fragmentShader = Gl.CreateShader(ShaderType.FragmentShader);
Gl.ShaderSource(fragmentShader, fragmentShaderSource); Gl.ShaderSource(fragmentShader, fragmentShaderSource);
Gl.CompileShader(fragmentShader); Gl.CompileShader(fragmentShader);
shader_program = Gl.CreateProgram(); shader_program = Gl.CreateProgram();
Gl.AttachShader(shader_program, vertexShader); Gl.AttachShader(shader_program, vertexShader);
Gl.AttachShader(shader_program, fragmentShader); Gl.AttachShader(shader_program, fragmentShader);
Gl.LinkProgram(shader_program); Gl.LinkProgram(shader_program);
int length; int length;
StringBuilder stringBuilder = new StringBuilder(10000); StringBuilder stringBuilder = new StringBuilder(10000);
Gl.GetShaderInfoLog(fragmentShader, 10000, out length, stringBuilder); Gl.GetShaderInfoLog(fragmentShader, 10000, out length, stringBuilder);
System.Diagnostics.Debug.WriteLine(stringBuilder); System.Diagnostics.Debug.WriteLine(stringBuilder);
stringBuilder.Clear(); stringBuilder.Clear();
Gl.GetShaderInfoLog(vertexShader, 10000, out length, stringBuilder); Gl.GetShaderInfoLog(vertexShader, 10000, out length, stringBuilder);
System.Diagnostics.Debug.WriteLine(stringBuilder); System.Diagnostics.Debug.WriteLine(stringBuilder);
stringBuilder.Clear(); stringBuilder.Clear();
Gl.GetProgramInfoLog(shader_program, 10000, out length, stringBuilder); Gl.GetProgramInfoLog(shader_program, 10000, out length, stringBuilder);
System.Diagnostics.Debug.WriteLine(stringBuilder); System.Diagnostics.Debug.WriteLine(stringBuilder);
stringBuilder.Clear(); stringBuilder.Clear();
Gl.UseProgram(shader_program); Gl.UseProgram(shader_program);
Gl.Uniform1(Gl.GetUniformLocation(shader_program, "sTexture"), 0); Gl.Uniform1(Gl.GetUniformLocation(shader_program, "sTexture"), 0);
texture = Gl.GenTexture(); texture = Gl.GenTexture();
Gl.ActiveTexture(TextureUnit.Texture0); Gl.ActiveTexture(TextureUnit.Texture0);
Gl.BindTexture(TextureTarget.Texture2d, texture); Gl.BindTexture(TextureTarget.Texture2d, texture);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.ClampToEdge); Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.ClampToEdge);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.ClampToEdge); Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.ClampToEdge);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, TextureMagFilter.Nearest); Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, TextureMagFilter.Nearest);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMagFilter.Nearest); Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMagFilter.Nearest);
float[] buf = { 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f }; float[] buf = { 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f };
vertex_buf = Gl.GenBuffer(); vertex_buf = Gl.GenBuffer();
Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf); Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf);
Gl.BufferData(BufferTarget.ArrayBuffer, (uint)(sizeof(float) * buf.Length), buf, BufferUsage.StaticDraw); Gl.BufferData(BufferTarget.ArrayBuffer, (uint)(sizeof(float) * buf.Length), buf, BufferUsage.StaticDraw);
vao = Gl.GenVertexArray(); vao = Gl.GenVertexArray();
}
} }
/*
public class WPFImage : ElementHost
{
public GlImage gl_img;
private int ByteSize;
private Rectangle rect1;
private Int32Rect rect2;
private BitmapData data;
public WriteableBitmap wb;
private bool HighQuality;
private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini";
public System.Windows.Controls.Image Image => (System.Windows.Controls.Image)base.Child;
public WPFImage()
{
System.Windows.Controls.Image child = new System.Windows.Controls.Image
{
Stretch = Stretch.Uniform
};
base.Child = child;
gl_img = new GlImage();
}
public void PollEvents() {
gl_img.PollEvents();
}
public void ImageSetting()
{
try
{
if (!File.Exists(ConfigPath))
{
HighQuality = false;
}
else
{
string[] source = ConfigPath.ReadLines();
HighQuality = source.First((string s) => s.StartsWith("AntiAliasing:")).Last() == '1';
}
}
catch
{
HighQuality = false;
}
if (HighQuality)
{
RenderOptions.SetBitmapScalingMode(Image, BitmapScalingMode.LowQuality);
}
else
{
RenderOptions.SetBitmapScalingMode(Image, BitmapScalingMode.NearestNeighbor);
}
RenderOptions.SetEdgeMode(Image, EdgeMode.Aliased);
}
[DllImport("Kernel32.dll")]
public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int ByteSize);
//the guy that gets called to update a frame
public void SetBitmap(Bitmap bmp)
{
data = bmp.LockBits(rect1, ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
wb.Lock();
CopyMemory(wb.BackBuffer, data.Scan0, ByteSize);
wb.AddDirtyRect(rect2);
wb.Unlock();
bmp.UnlockBits(data);
gl_img.SetBitmap(bmp);
}
public void BitmapSetting(Bitmap bmp)
{
int pixelWidth = bmp.Width;
int num = bmp.Height;
rect1 = new Rectangle(0, 0, pixelWidth, num);
rect2 = new Int32Rect(0, 0, pixelWidth, num);
wb = new WriteableBitmap(pixelWidth, num, bmp.HorizontalResolution, bmp.VerticalResolution, PixelFormats.Bgra32, null);
ByteSize = wb.BackBufferStride * num;
Image.Source = wb;
gl_img.BitmapSetting(bmp);
}
}
*/
} }
/*
public class WPFImage : ElementHost
{
public GlImage gl_img;
private int ByteSize;
private Rectangle rect1;
private Int32Rect rect2;
private BitmapData data;
public WriteableBitmap wb;
private bool HighQuality;
private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini";
public System.Windows.Controls.Image Image => (System.Windows.Controls.Image)base.Child;
public WPFImage()
{
System.Windows.Controls.Image child = new System.Windows.Controls.Image
{
Stretch = Stretch.Uniform
};
base.Child = child;
gl_img = new GlImage();
}
public void PollEvents() {
gl_img.PollEvents();
}
public void ImageSetting()
{
try
{
if (!File.Exists(ConfigPath))
{
HighQuality = false;
}
else
{
string[] source = ConfigPath.ReadLines();
HighQuality = source.First((string s) => s.StartsWith("AntiAliasing:")).Last() == '1';
}
}
catch
{
HighQuality = false;
}
if (HighQuality)
{
RenderOptions.SetBitmapScalingMode(Image, BitmapScalingMode.LowQuality);
}
else
{
RenderOptions.SetBitmapScalingMode(Image, BitmapScalingMode.NearestNeighbor);
}
RenderOptions.SetEdgeMode(Image, EdgeMode.Aliased);
}
[DllImport("Kernel32.dll")]
public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int ByteSize);
//the guy that gets called to update a frame
public void SetBitmap(Bitmap bmp)
{
data = bmp.LockBits(rect1, ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
wb.Lock();
CopyMemory(wb.BackBuffer, data.Scan0, ByteSize);
wb.AddDirtyRect(rect2);
wb.Unlock();
bmp.UnlockBits(data);
gl_img.SetBitmap(bmp);
}
public void BitmapSetting(Bitmap bmp)
{
int pixelWidth = bmp.Width;
int num = bmp.Height;
rect1 = new Rectangle(0, 0, pixelWidth, num);
rect2 = new Int32Rect(0, 0, pixelWidth, num);
wb = new WriteableBitmap(pixelWidth, num, bmp.HorizontalResolution, bmp.VerticalResolution, PixelFormats.Bgra32, null);
ByteSize = wb.BackBufferStride * num;
Image.Source = wb;
gl_img.BitmapSetting(bmp);
}
}
*/

View File

@@ -1,66 +1,67 @@
using System.Drawing; using System.Drawing;
namespace _2DGAMELIB; namespace _2DGAMELIB
public static class _Con
{ {
public static Vector2D ToVector2D(this Point Point) public static class _Con
{ {
return new Vector2D(Point.X, Point.Y); public static Vector2D ToVector2D(this Point Point)
} {
return new Vector2D(Point.X, Point.Y);
}
public static Point ToPoint(this Vector2D Vector) public static Point ToPoint(this Vector2D Vector)
{ {
return new Point((int)Vector.X, (int)Vector.Y); return new Point((int)Vector.X, (int)Vector.Y);
} }
public static Point ToPoint(ref Vector2D Vector) public static Point ToPoint(ref Vector2D Vector)
{ {
return new Point((int)Vector.X, (int)Vector.Y); return new Point((int)Vector.X, (int)Vector.Y);
} }
public static Vector2D ToVector2D(this PointF Point) public static Vector2D ToVector2D(this PointF Point)
{ {
return new Vector2D(Point.X, Point.Y); return new Vector2D(Point.X, Point.Y);
} }
public static PointF ToPointF(this Vector2D Vector) public static PointF ToPointF(this Vector2D Vector)
{ {
return new PointF((float)Vector.X, (float)Vector.Y); return new PointF((float)Vector.X, (float)Vector.Y);
} }
public static PointF ToPointF(ref Vector2D Vector) public static PointF ToPointF(ref Vector2D Vector)
{ {
return new PointF((float)Vector.X, (float)Vector.Y); return new PointF((float)Vector.X, (float)Vector.Y);
} }
public static Vector2D ToVector2D(this Size Size) public static Vector2D ToVector2D(this Size Size)
{ {
return new Vector2D(Size.Width, Size.Height); return new Vector2D(Size.Width, Size.Height);
} }
public static Size ToSize(this Vector2D Vector) public static Size ToSize(this Vector2D Vector)
{ {
return new Size((int)Vector.X, (int)Vector.Y); return new Size((int)Vector.X, (int)Vector.Y);
} }
public static Size ToSize(ref Vector2D Vector) public static Size ToSize(ref Vector2D Vector)
{ {
return new Size((int)Vector.X, (int)Vector.Y); return new Size((int)Vector.X, (int)Vector.Y);
} }
public static Vector2D ToVector2D(this SizeF Size) public static Vector2D ToVector2D(this SizeF Size)
{ {
return new Vector2D(Size.Width, Size.Height); return new Vector2D(Size.Width, Size.Height);
} }
public static SizeF ToSizeF(this Vector2D Vector) public static SizeF ToSizeF(this Vector2D Vector)
{ {
return new SizeF((float)Vector.X, (float)Vector.Y); return new SizeF((float)Vector.X, (float)Vector.Y);
} }
public static SizeF ToSizeF(ref Vector2D Vector) public static SizeF ToSizeF(ref Vector2D Vector)
{ {
return new SizeF((float)Vector.X, (float)Vector.Y); return new SizeF((float)Vector.X, (float)Vector.Y);
} }
}
} }

View File

@@ -8,7 +8,7 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<LangVersion>10.0</LangVersion> <LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -1,427 +1,428 @@
using System; using System;
using System.Runtime.Serialization; using System.Runtime.Serialization;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public enum ConnectionInfo
{ {
none, [Serializable]
_基髪_接続, public enum ConnectionInfo
_目左_接続, {
_目右_接続, none,
__接続, _基髪_接続,
__接続, _目左_接続,
_頬左_接続, _目右_接続,
_頬右_接続, __接続,
__接続, __接続,
_左_接続, _左_接続,
_右_接続, _右_接続,
_耳左_接続, __接続,
_耳右_接続, _眉左_接続,
_鼻肌_接続, _眉右_接続,
_単眼目_接続, _耳左_接続,
_単眼眉_接続, _耳右_接続,
_大顎基_接続, _鼻肌_接続,
_顔面_接続, _単眼目_接続,
_頭頂_接続, _単眼眉_接続,
_頬肌左_接続, _大顎基_接続,
_頬肌右_接続, _顔面_接続,
_触覚左_接続, _頭頂_接続,
_触覚右_接続, _頬肌左_接続,
_頭頂左_接続, _頬肌右_接続,
_頭頂右_接続, _触覚左_接続,
_横髪左_接続, _触覚右_接続,
_横髪右_接続, _頭頂左_接続,
_前髪_接続, _頭頂右_接続,
_後髪_接続, _横髪左_接続,
0__左5_接続, _横髪右_接続,
0__左4_接続, _前髪_接続,
0__左3_接続, _後髪_接続,
0__左2_接続, 0__左5_接続,
0__左1_接続, 0__左4_接続,
0__中央_接続, 0__左3_接続,
0__右1_接続, 0__左2_接続,
0__右2_接続, 0__左1_接続,
0__右3_接続, 0__中央_接続,
0__右4_接続, 0__右1_接続,
0__右5_接続, 0__右2_接続,
_肢系_肢_接続, 0__右3_接続,
__接続, 0__右4_接続,
_宇_涙_接続, 0__右5_接続,
__接続, _肢系_肢_接続,
_瞼_接続, _瞼_接続,
_瞼_接続, _宇_涙_接続,
_人_鼻水左_接続, _瞼_接続,
_人_鼻水右_接続, _瞼_接続,
_獣_鼻水左_接続, _瞼_接続,
__鼻水_接続, __鼻水_接続,
_吹出し_接続, _人_鼻水右_接続,
__接続, _獣_鼻水左_接続,
__接続, _獣_鼻水右_接続,
_肩左_接続, _吹出し_接続,
_肩右_接続, __接続,
_胸左_接続, __接続,
_胸右_接続, _肩左_接続,
__接続, _肩右_接続,
_翼上左_接続, _左_接続,
_翼上右_接続, _右_接続,
_翼下左_接続, __接続,
_翼下右_接続, _翼上左_接続,
_背中_接続, _翼上右_接続,
_噴乳_接続, _翼下左_接続,
_上腕_接続, _翼下右_接続,
__接続, _背中_接続,
__接続, _噴乳_接続,
_翼左_接続, _上腕_接続,
_翼右_接続, __接続,
__接続, __接続,
_左_接続, _左_接続,
_右_接続, _右_接続,
_膣基_接続, __接続,
_肛門_接続, _腿左_接続,
_半身_接続, _腿右_接続,
__接続, _膣基_接続,
_上着_接続, _肛門_接続,
__接続, _半身_接続,
_翼左_接続, __接続,
_翼右_接続, _上着_接続,
_人_腹板_接続, _肌_接続,
_獣_腹板_接続, _翼左_接続,
_人_肛門精液_接続, _翼右_接続,
_獣_肛門精液_接続, _人_腹板_接続,
_人_陰核_接続, _獣_腹板_接続,
_人_尿道_接続, _人_肛門精液_接続,
_人_膣口_接続, _獣_肛門精液_接続,
__陰核_接続, __陰核_接続,
__尿道_接続, __尿道_接続,
__膣口_接続, __膣口_接続,
_クロス_上着ボトム後_接続, _獣_陰核_接続,
_甲_触覚左_接続, _獣_尿道_接続,
_甲_触覚右_接続, _獣_膣口_接続,
_虫_触覚左_接続, _クロス_上着ボトム後_接続,
__触覚_接続, __触覚_接続,
__触覚_接続, __触覚_接続,
__触覚_接続, __触覚_接続,
_宇_頭部後_接続, _虫_触覚右_接続,
_蜘_出糸_接続, _蟲_触覚左_接続,
_ヘ_尾先_接続, _蟲_触覚右_接続,
_ウ_尾先_接続, _宇_頭部後_接続,
_魚_左1_接続, _蜘_出糸_接続,
_魚_右1_接続, _ヘ_尾先_接続,
_魚_左2_接続, _ウ_尾先_接続,
_魚_右2_接続, _魚_左1_接続,
_魚_左3_接続, _魚_右1_接続,
_魚_右3_接続, _魚_左2_接続,
_魚_左4_接続, _魚_右2_接続,
_魚_右4_接続, _魚_左3_接続,
_魚_左5_接続, _魚_右3_接続,
_魚_右5_接続, _魚_左4_接続,
_魚_左6_接続, _魚_右4_接続,
_魚_右6_接続, _魚_左5_接続,
_魚_左7_接続, _魚_右5_接続,
_魚_右7_接続, _魚_左6_接続,
_魚_左8_接続, _魚_右6_接続,
_魚_右8_接続, _魚_左7_接続,
_魚_左9_接続, _魚_右7_接続,
_魚_右9_接続, _魚_左8_接続,
_魚_左10_接続, _魚_右8_接続,
_魚_右10_接続, _魚_左9_接続,
_魚_左11_接続, _魚_右9_接続,
_魚_右11_接続, _魚_左10_接続,
_魚_左12_接続, _魚_右10_接続,
_魚_右12_接続, _魚_左11_接続,
_魚_左13_接続, _魚_右11_接続,
_魚_右13_接続, _魚_左12_接続,
_魚_左14_接続, _魚_右12_接続,
_魚_右14_接続, _魚_左13_接続,
_魚_左15_接続, _魚_右13_接続,
_魚_右15_接続, _魚_左14_接続,
_魚_左16_接続, _魚_右14_接続,
_魚_右16_接続, _魚_左15_接続,
_魚_左17_接続, _魚_右15_接続,
_魚_右17_接続, _魚_左16_接続,
_魚_左18_接続, _魚_右16_接続,
_魚_右18_接続, _魚_左17_接続,
_魚_左19_接続, _魚_右17_接続,
_魚_右19_接続, _魚_左18_接続,
_魚_左20_接続, _魚_右18_接続,
_魚_右20_接続, _魚_左19_接続,
_魚_左21_接続, _魚_右19_接続,
_魚_右21_接続, _魚_左20_接続,
_魚_左22_接続, _魚_右20_接続,
_魚_右22_接続, _魚_左21_接続,
_魚_左23_接続, _魚_右21_接続,
_魚_右23_接続, _魚_左22_接続,
_魚_左24_接続, _魚_右22_接続,
_魚_右24_接続, _魚_左23_接続,
_魚_左25_接続, _魚_右23_接続,
_魚_右25_接続, _魚_左24_接続,
_魚_左26_接続, _魚_右24_接続,
_魚_右26_接続, _魚_左25_接続,
_魚_左27_接続, _魚_右25_接続,
_魚_右27_接続, _魚_左26_接続,
_魚_左28_接続, _魚_右26_接続,
_魚_右28_接続, _魚_左27_接続,
_魚_左29_接続, _魚_右27_接続,
_魚_右29_接続, _魚_左28_接続,
_魚_左30_接続, _魚_右28_接続,
_魚_右30_接続, _魚_左29_接続,
_魚_左31_接続, _魚_右29_接続,
_魚_右31_接続, _魚_左30_接続,
_魚_左32_接続, _魚_右30_接続,
_魚_右32_接続, _魚_左31_接続,
_魚_左33_接続, _魚_右31_接続,
_魚_右33_接続, _魚_左32_接続,
_魚_左34_接続, _魚_右32_接続,
_魚_右34_接続, _魚_左33_接続,
_魚_尾先_接続, _魚_右33_接続,
__左1_接続, __左34_接続,
__右1_接続, __右34_接続,
_鯨_左2_接続, _魚_尾先_接続,
_鯨_右2_接続, _鯨_左1_接続,
_鯨_左3_接続, _鯨_右1_接続,
_鯨_右3_接続, _鯨_左2_接続,
_鯨_左4_接続, _鯨_右2_接続,
_鯨_右4_接続, _鯨_左3_接続,
_鯨_左5_接続, _鯨_右3_接続,
_鯨_右5_接続, _鯨_左4_接続,
_鯨_左6_接続, _鯨_右4_接続,
_鯨_右6_接続, _鯨_左5_接続,
_鯨_左7_接続, _鯨_右5_接続,
_鯨_右7_接続, _鯨_左6_接続,
_鯨_左8_接続, _鯨_右6_接続,
_鯨_右8_接続, _鯨_左7_接続,
_鯨_左9_接続, _鯨_右7_接続,
_鯨_右9_接続, _鯨_左8_接続,
_鯨_左10_接続, _鯨_右8_接続,
_鯨_右10_接続, _鯨_左9_接続,
_鯨_左11_接続, _鯨_右9_接続,
_鯨_右11_接続, _鯨_左10_接続,
_鯨_左12_接続, _鯨_右10_接続,
_鯨_右12_接続, _鯨_左11_接続,
_鯨_左13_接続, _鯨_右11_接続,
_鯨_右13_接続, _鯨_左12_接続,
_鯨_左14_接続, _鯨_右12_接続,
_鯨_右14_接続, _鯨_左13_接続,
_鯨_左15_接続, _鯨_右13_接続,
_鯨_右15_接続, _鯨_左14_接続,
_鯨_左16_接続, _鯨_右14_接続,
_鯨_右16_接続, _鯨_左15_接続,
_鯨_左17_接続, _鯨_右15_接続,
_鯨_右17_接続, _鯨_左16_接続,
_鯨_左18_接続, _鯨_右16_接続,
_鯨_右18_接続, _鯨_左17_接続,
_鯨_左19_接続, _鯨_右17_接続,
_鯨_右19_接続, _鯨_左18_接続,
_鯨_左20_接続, _鯨_右18_接続,
_鯨_右20_接続, _鯨_左19_接続,
_鯨_左21_接続, _鯨_右19_接続,
_鯨_右21_接続, _鯨_左20_接続,
_鯨_左22_接続, _鯨_右20_接続,
_鯨_右22_接続, _鯨_左21_接続,
_鯨_左23_接続, _鯨_右21_接続,
_鯨_右23_接続, _鯨_左22_接続,
_鯨_左24_接続, _鯨_右22_接続,
_鯨_右24_接続, _鯨_左23_接続,
_鯨_左25_接続, _鯨_右23_接続,
_鯨_右25_接続, _鯨_左24_接続,
_鯨_左26_接続, _鯨_右24_接続,
_鯨_右26_接続, _鯨_左25_接続,
_鯨_左27_接続, _鯨_右25_接続,
_鯨_右27_接続, _鯨_左26_接続,
_鯨_左28_接続, _鯨_右26_接続,
_鯨_右28_接続, _鯨_左27_接続,
_鯨_左29_接続, _鯨_右27_接続,
_鯨_右29_接続, _鯨_左28_接続,
_鯨_左30_接続, _鯨_右28_接続,
_鯨_右30_接続, _鯨_左29_接続,
_鯨_左31_接続, _鯨_右29_接続,
_鯨_右31_接続, _鯨_左30_接続,
_鯨_左32_接続, _鯨_右30_接続,
_鯨_右32_接続, _鯨_左31_接続,
_鯨_左33_接続, _鯨_右31_接続,
_鯨_右33_接続, _鯨_左32_接続,
_鯨_左34_接続, _鯨_右32_接続,
_鯨_右34_接続, _鯨_左33_接続,
_鯨_尾先_接続, _鯨_右33_接続,
__左1_接続, __左34_接続,
__右1_接続, __右34_接続,
_蟲_左2_接続, _鯨_尾先_接続,
_蟲_右2_接続, _蟲_左1_接続,
_蟲_左3_接続, _蟲_右1_接続,
_蟲_右3_接続, _蟲_左2_接続,
_蟲_左4_接続, _蟲_右2_接続,
_蟲_右4_接続, _蟲_左3_接続,
_蟲_左5_接続, _蟲_右3_接続,
_蟲_右5_接続, _蟲_左4_接続,
_蟲_尾左_接続, _蟲_右4_接続,
_蟲_尾右_接続, _蟲_左5_接続,
_甲_軸1_接続, _蟲_右5_接続,
_甲_軸2_接続, _蟲_尾左_接続,
_甲_軸3_接続, _蟲_尾右_接続,
_犬_頭_接続, _甲_軸1_接続,
_犬_上腕左_接続, _甲_軸2_接続,
_犬_上腕右_接続, _甲_軸3_接続,
_犬_下腕左_接続, _犬__接続,
_犬_下腕右_接続, _犬_上腕左_接続,
_犬_手左_接続, _犬_上腕右_接続,
_犬_手右_接続, _犬_下腕左_接続,
_蔦_節1_接続, _犬_下腕右_接続,
_蔦_節2_接続, _犬_手左_接続,
_蔦_節3_接続, _犬_手右_接続,
_蔦_節4_接続, _蔦_節1_接続,
_蔦_節5_接続, _蔦_節2_接続,
_蔦_節6_接続, _蔦_節3_接続,
_蔦_節7_接続, _蔦_節4_接続,
_蔦_節8_接続, _蔦_節5_接続,
_蔦_節9_接続, _蔦_節6_接続,
_蔦_節10_接続, _蔦_節7_接続,
_蔦_節11_接続, _蔦_節8_接続,
_蔦_節12_接続, _蔦_節9_接続,
_蔦_節13_接続, _蔦_節10_接続,
_蔦_節14_接続, _蔦_節11_接続,
_蔦_節15_接続, _蔦_節12_接続,
_蔦_節16_接続, _蔦_節13_接続,
_蔦_節17_接続, _蔦_節14_接続,
_蔦_節18_接続, _蔦_節15_接続,
_蔦_節19_接続, _蔦_節16_接続,
_蔦_節20_接続, _蔦_節17_接続,
_蔦_節21_接続, _蔦_節18_接続,
_蔦_節22_接続, _蔦_節19_接続,
_蔦_節23_接続, _蔦_節20_接続,
_蔦_節24_接続, _蔦_節21_接続,
_蔦_先端_接続, _蔦_節22_接続,
_人_下腕_接続, _蔦_節23_接続,
_鳥_下腕_接続, _蔦_節24_接続,
_蝙_下腕_接続, _蔦_先端_接続,
__下腕_接続, __下腕_接続,
__下腕_接続, __下腕_接続,
_人_外腕_接続, _蝙_下腕_接続,
_人_手_接続, _獣_下腕_接続,
_人_虫鎌_接続, _蹄_下腕_接続,
_鳥_手_接続, _人_外腕_接続,
__手_接続, __手_接続,
_蝙_腕輪_接続, _人_虫鎌_接続,
__手_接続, __手_接続,
__手_接続, __手_接続,
_人_脚_接続, _蝙_腕輪_接続,
_獣__接続, _獣__接続,
_蹄__接続, _蹄__接続,
__脚_接続, __脚_接続,
__脚_接続, __脚_接続,
_人_足_接続, _蹄_脚_接続,
__脚輪下_接続, __脚_接続,
__脚輪上_接続, __脚_接続,
__足_接続, __足_接続,
_蹄_足_接続, _人_脚輪下_接続,
_鳥_足_接続, _人_脚輪上_接続,
__足_接続, __足_接続,
_魚_左0_接続, _蹄_足_接続,
_魚_右0_接続, _鳥_足_接続,
_魚_左1_接続, _竜_足_接続,
_魚_右1_接続, _魚_左0_接続,
_魚_左2_接続, _魚_右0_接続,
_魚_右2_接続, _魚_左1_接続,
_魚_左3_接続, _魚_右1_接続,
_魚_右3_接続, _魚_左2_接続,
_魚_左4_接続, _魚_右2_接続,
_魚_右4_接続, _魚_左3_接続,
_魚_左5_接続, _魚_右3_接続,
_魚_右5_接続, _魚_左4_接続,
_魚_左6_接続, _魚_右4_接続,
_魚_右6_接続, _魚_左5_接続,
_魚__接続, _魚_右5_接続,
__左0_接続, __左6_接続,
__右0_接続, __右6_接続,
_鯨_左1_接続, _魚_尾_接続,
_鯨_右1_接続, _鯨_左0_接続,
_鯨_左2_接続, _鯨_右0_接続,
_鯨_右2_接続, _鯨_左1_接続,
_鯨_左3_接続, _鯨_右1_接続,
_鯨_右3_接続, _鯨_左2_接続,
_鯨_左4_接続, _鯨_右2_接続,
_鯨_右4_接続, _鯨_左3_接続,
_鯨_左5_接続, _鯨_右3_接続,
_鯨_右5_接続, _鯨_左4_接続,
_鯨_左6_接続, _鯨_右4_接続,
_鯨_右6_接続, _鯨_左5_接続,
_鯨__接続, _鯨_右5_接続,
__左_接続, __左6_接続,
__右_接続, __右6_接続,
_蛇_胴_接続, _鯨_尾_接続,
__左0_接続, __左_接続,
__右0_接続, __右_接続,
_蟲_左1_接続, _蛇_胴_接続,
_蟲_右1_接続, _蟲_左0_接続,
_蟲__接続, _蟲_右0_接続,
_脇左_接続, _蟲_左1_接続,
_脇右_接続, _蟲_右1_接続,
_胴_接続, _蟲_胴_接続,
_左_接続, _左_接続,
_右_接続, _右_接続,
__接続, __接続,
_翼上左_接続, _左_接続,
_翼上右_接続, _右_接続,
_翼下左_接続, __接続,
_翼下右_接続, _翼上左_接続,
_背中_接続, _翼上右_接続,
_上腕_接続, _翼下左_接続,
__接続, _翼下右_接続,
__接続, _背中_接続,
_翼左_接続, _上腕_接続,
_翼右_接続, __接続,
_腿左_接続, __接続,
_腿右_接続, _翼左_接続,
_膣基_接続, _翼右_接続,
_肛門_接続, _腿左_接続,
__接続, _腿右_接続,
_半身_接続, _膣基_接続,
_上着_接続, _肛門_接続,
__接続, __接続,
_翼左_接続, _半身_接続,
_翼右_接続, _上着_接続,
_蛸_軟体外左_接続, _肌_接続,
_蛸_軟体外右_接続, _翼左_接続,
_蛸_軟体内左_接続, _翼右_接続,
_蛸_軟体内右_接続, _蛸_軟体外左_接続,
_蜘_触肢左_接続, _蛸_軟体外右_接続,
_蜘_触肢右_接続, _蛸_軟体内左_接続,
_蜘_節足左1_接続, _蛸_軟体内右_接続,
_蜘_節足左2_接続, _蜘_触肢左_接続,
_蜘_節足左3_接続, _蜘_触肢右_接続,
_蜘_節足左4_接続, _蜘_節足左1_接続,
_蜘_節足右1_接続, _蜘_節足左2_接続,
_蜘_節足右2_接続, _蜘_節足左3_接続,
_蜘_節足右3_接続, _蜘_節足左4_接続,
_蜘_節足右4_接続, _蜘_節足右1_接続,
_蜘__接続, _蜘_節足右2_接続,
_蠍_触肢左_接続, _蜘_節足右3_接続,
__節足左1_接続, __節足右4_接続,
_蠍_節足左2_接続, _蜘_尾_接続,
_蠍_節足左3_接続, _蠍_触肢左_接続,
_蠍_節足左4_接続, _蠍_節足左1_接続,
_蠍_触肢右_接続, _蠍_節足左2_接続,
_蠍_節足右1_接続, _蠍_節足左3_接続,
_蠍_節足右2_接続, _蠍_節足左4_接続,
_蠍_節足右3_接続, _蠍_触肢右_接続,
_蠍_節足右4_接続, _蠍_節足右1_接続,
_蠍_櫛状板左_接続, _蠍_節足右2_接続,
_蠍_櫛状板右_接続, _蠍_節足右3_接続,
_蠍__接続, _蠍_節足右4_接続,
_植_根外左_接続, _蠍_櫛状板左_接続,
_植_根内左_接続, _蠍_櫛状板右_接続,
_植_根中央_接続, _蠍_尾_接続,
_植_根内右_接続, _植_根外左_接続,
_植_根外右_接続, _植_根内左_接続,
_蛇_左_接続, _植_根中央_接続,
_蛇_右_接続, _植_根内右_接続,
_蛇_胴_接続, _植_根外右_接続,
__左_接続, __左_接続,
__右_接続, __右_接続,
__胴_接続, __胴_接続,
_左_接続, _蟲_左_接続,
_右_接続, _蟲_右_接続,
__接続, _蟲_胴_接続,
_尿道_接続 _顎左_接続,
_顎右_接続,
_花_接続,
_尿道_接続
}
} }

View File

@@ -1,17 +1,18 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public struct ContactD
{ {
public ContactType c; public struct ContactD
{
public ContactType c;
public Ele e; public Ele e;
public Par p; public Par p;
public override string ToString() public override string ToString()
{ {
return ("接触:" + c).ToString() + "\r\n" + ("Ele:" + ((e == null) ? "null" : e.ToString())).ToString() + "\r\n" + ("Par:" + ((p == null) ? "null" : p.ToString())).ToString(); return ("接触:" + c).ToString() + "\r\n" + ("Ele:" + ((e == null) ? "null" : e.ToString())).ToString() + "\r\n" + ("Par:" + ((p == null) ? "null" : p.ToString())).ToString();
} }
}
} }

View File

@@ -3,358 +3,359 @@ using System.Drawing;
using System.Linq; using System.Linq;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class InfoPanel
{ {
public Are Are; public class InfoPanel
{
public Are Are;
private Med Med; private Med Med;
public Par MaiB; public Par MaiB;
public Tex Mai; public Tex Mai;
public Par Mai2B; public Par Mai2B;
public Tex Mai2; public Tex Mai2;
public Par SubB; public Par SubB;
public Tex Sub; public Tex Sub;
public Par Sub2B; public Par Sub2B;
public Tex Sub2; public Tex Sub2;
private Lab SubInnfo_l; private Lab SubInnfo_l;
public bool MaiShow = true; public bool MaiShow = true;
public bool Mai2Show = true; public bool Mai2Show = true;
public bool SubShow = true; public bool SubShow = true;
public bool Sub2Show = true; public bool Sub2Show = true;
private ParT yp; private ParT yp;
private ParT np; private ParT np;
public But1 yb; public But1 yb;
public But1 nb; public But1 nb;
public string TextIm public string TextIm
{ {
get get
{ {
return Mai.TextIm; return Mai.TextIm;
} }
set set
{ {
Mai.TextIm = value; Mai.TextIm = value;
} }
} }
public string Text public string Text
{ {
get get
{ {
return Mai.Text; return Mai.Text;
} }
set set
{ {
Mai.Text = value; Mai.Text = value;
} }
} }
public string Mai2Im public string Mai2Im
{ {
get get
{ {
return Mai2.TextIm; return Mai2.TextIm;
} }
set set
{ {
Mai2.TextIm = value; Mai2.TextIm = value;
} }
} }
public string SubInfoIm public string SubInfoIm
{ {
get get
{ {
return Sub.TextIm; return Sub.TextIm;
} }
set set
{ {
Sub.TextIm = value; Sub.TextIm = value;
} }
} }
public string SubInfo public string SubInfo
{ {
get get
{ {
return Sub.Text; return Sub.Text;
} }
set set
{ {
Sub.Text = value; Sub.Text = value;
} }
} }
public bool public bool
{ {
get get
{ {
return yp.Dra; return yp.Dra;
} }
set set
{ {
SetButPos(); SetButPos();
yp.Dra = value; yp.Dra = value;
np.Dra = value; np.Dra = value;
} }
} }
public Action<But> yAct public Action<But> yAct
{ {
set set
{ {
yb.Action = delegate(But a) yb.Action = delegate(But a)
{ {
value(a); value(a);
}; };
} }
} }
public Action<But> nAct public Action<But> nAct
{ {
set set
{ {
nb.Action = delegate(But a) nb.Action = delegate(But a)
{ {
value(a); value(a);
}; };
} }
} }
public InfoPanel(Med Med, Are Are) public InfoPanel(Med Med, Are Are)
{ {
this.Med = Med; this.Med = Med;
this.Are = Are; this.Are = Are;
double num = 0.015; double num = 0.015;
double num2 = 0.1; double num2 = 0.1;
double num3 = Are.LocalWidth * 0.6 / num2; double num3 = Are.LocalWidth * 0.6 / num2;
double num4 = Are.LocalHeight * (1.0 / 6.0) / num2; double num4 = Are.LocalHeight * (1.0 / 6.0) / num2;
Vector2D vector2D = Are.GetPosition(0.2, 1.0 - num4 * num2 / Are.LocalHeight).AddY(0.0 - num); Vector2D vector2D = Are.GetPosition(0.2, 1.0 - num4 * num2 / Are.LocalHeight).AddY(0.0 - num);
double y = 1.01; double y = 1.01;
MaiB = new Par(); MaiB = new Par();
MaiB.BasePointBase = Dat.Vec2DZero; MaiB.BasePointBase = Dat.Vec2DZero;
MaiB.PositionBase = vector2D; MaiB.PositionBase = vector2D;
MaiB.SizeBase = num2; MaiB.SizeBase = num2;
MaiB.OP.AddRange(new Out[1] { Shas.Get正方形() }); MaiB.OP.AddRange(new Out[1] { Shas.Get正方形() });
MaiB.OP.ScalingX(MaiB.BasePointBase, num3); MaiB.OP.ScalingX(MaiB.BasePointBase, num3);
MaiB.OP.ScalingY(MaiB.BasePointBase, num4); MaiB.OP.ScalingY(MaiB.BasePointBase, num4);
MaiB.Closed = true; MaiB.Closed = true;
MaiB.BrushColor = Color.FromArgb(160, Col.Black); MaiB.BrushColor = Color.FromArgb(160, Col.Black);
MaiB.Hit = false; MaiB.Hit = false;
MaiB.JP.Add(new Joi(MaiB.OP.GetCenter())); MaiB.JP.Add(new Joi(MaiB.OP.GetCenter()));
Mai = new Tex("Tex1", vector2D, num2, num3 * 0.98, num4 * 0.91, new Font("MS Gothic", 1f), 0.08, 0, " ", Col.White, Col.Black, Color.Transparent, 19.0, Col.White, delegate(Tex sp) Mai = new Tex("Tex1", vector2D, num2, num3 * 0.98, num4 * 0.91, new Font("MS Gothic", 1f), 0.08, 0, " ", Col.White, Col.Black, Color.Transparent, 19.0, Col.White, delegate(Tex sp)
{ {
sp.Text = sp.Text; sp.Text = sp.Text;
}); });
Mai.ParT.BasePointBase = Mai.ParT.OP.GetCenter().MulY(y); Mai.ParT.BasePointBase = Mai.ParT.OP.GetCenter().MulY(y);
Mai.Position = MaiB.ToGlobal(MaiB.JP[0].Joint); Mai.Position = MaiB.ToGlobal(MaiB.JP[0].Joint);
Mai.Feed.OP.OutlineFalse(); Mai.Feed.OP.OutlineFalse();
double num5 = num4 * 4.53; double num5 = num4 * 4.53;
Mai2B = new Par(); Mai2B = new Par();
Mai2B.BasePointBase = Dat.Vec2DZero; Mai2B.BasePointBase = Dat.Vec2DZero;
Mai2B.PositionBase = new Vector2D(vector2D.X, 0.01); Mai2B.PositionBase = new Vector2D(vector2D.X, 0.01);
Mai2B.SizeBase = num2; Mai2B.SizeBase = num2;
Mai2B.OP.AddRange(new Out[1] { Shas.Get正方形() }); Mai2B.OP.AddRange(new Out[1] { Shas.Get正方形() });
Mai2B.OP.ScalingX(Mai2B.BasePointBase, num3); Mai2B.OP.ScalingX(Mai2B.BasePointBase, num3);
Mai2B.OP.ScalingY(Mai2B.BasePointBase, num5); Mai2B.OP.ScalingY(Mai2B.BasePointBase, num5);
Mai2B.Closed = true; Mai2B.Closed = true;
Mai2B.BrushColor = Color.FromArgb(160, Col.Black); Mai2B.BrushColor = Color.FromArgb(160, Col.Black);
Mai2B.Hit = false; Mai2B.Hit = false;
Mai2B.JP.Add(new Joi(Mai2B.OP.GetCenter())); Mai2B.JP.Add(new Joi(Mai2B.OP.GetCenter()));
Mai2 = new Tex("Tex3", vector2D, num2, num3 * 0.98, num5 * 0.97, new Font("MS Gothic", 1f), 0.08, 0, " ", Col.White, Col.Black, Color.Transparent, 19.0, Col.White, delegate(Tex sp) Mai2 = new Tex("Tex3", vector2D, num2, num3 * 0.98, num5 * 0.97, new Font("MS Gothic", 1f), 0.08, 0, " ", Col.White, Col.Black, Color.Transparent, 19.0, Col.White, delegate(Tex sp)
{ {
sp.Text = sp.Text; sp.Text = sp.Text;
}); });
Mai2.ParT.BasePointBase = Mai2.ParT.OP.GetCenter().MulY(y); Mai2.ParT.BasePointBase = Mai2.ParT.OP.GetCenter().MulY(y);
Mai2.Position = Mai2B.ToGlobal(Mai2B.JP[0].Joint); Mai2.Position = Mai2B.ToGlobal(Mai2B.JP[0].Joint);
Mai2.Feed.OP.OutlineFalse(); Mai2.Feed.OP.OutlineFalse();
num3 = Are.LocalWidth * 0.19 / num2; num3 = Are.LocalWidth * 0.19 / num2;
vector2D = Are.GetPosition(1.0 - (num3 * num2 / Are.LocalWidth + 0.005), 1.0 - num4 * num2 / Are.LocalHeight).AddY(0.0 - num); vector2D = Are.GetPosition(1.0 - (num3 * num2 / Are.LocalWidth + 0.005), 1.0 - num4 * num2 / Are.LocalHeight).AddY(0.0 - num);
SubB = new Par(); SubB = new Par();
SubB.BasePointBase = Dat.Vec2DZero; SubB.BasePointBase = Dat.Vec2DZero;
SubB.PositionBase = vector2D; SubB.PositionBase = vector2D;
SubB.SizeBase = num2; SubB.SizeBase = num2;
SubB.OP.AddRange(new Out[1] { Shas.Get正方形() }); SubB.OP.AddRange(new Out[1] { Shas.Get正方形() });
SubB.OP.ScalingX(SubB.BasePointBase, num3); SubB.OP.ScalingX(SubB.BasePointBase, num3);
SubB.OP.ScalingY(SubB.BasePointBase, num4); SubB.OP.ScalingY(SubB.BasePointBase, num4);
SubB.Closed = true; SubB.Closed = true;
SubB.BrushColor = Color.FromArgb(160, Col.Black); SubB.BrushColor = Color.FromArgb(160, Col.Black);
SubB.Hit = false; SubB.Hit = false;
SubB.JP.Add(new Joi(SubB.OP.GetCenter())); SubB.JP.Add(new Joi(SubB.OP.GetCenter()));
Sub = new Tex("Tex4", vector2D, num2 * 1.01, num3 * 0.98, num4 * 0.91, new Font("MS Gothic", 1f), 0.07, 0, " ", Col.White, Col.Black, Color.Transparent, 15.0); Sub = new Tex("Tex4", vector2D, num2 * 1.01, num3 * 0.98, num4 * 0.91, new Font("MS Gothic", 1f), 0.07, 0, " ", Col.White, Col.Black, Color.Transparent, 15.0);
Sub.ParT.BasePointBase = Sub.ParT.OP.GetCenter().MulY(y); Sub.ParT.BasePointBase = Sub.ParT.OP.GetCenter().MulY(y);
Sub.Position = SubB.ToGlobal(SubB.JP[0].Joint); Sub.Position = SubB.ToGlobal(SubB.JP[0].Joint);
SubInnfo_l = new Lab(Med, Are, "SubInfo", vector2D, num2, 1.0, new Font("MS Gothic", 1f), 0.07, "Sub Info.", Col.White, Col.Black, Color.FromArgb(160, Col.Black), Col.Empty, Input: false); SubInnfo_l = new Lab(Med, Are, "SubInfo", vector2D, num2, 1.0, new Font("MS Gothic", 1f), 0.07, "Sub Info.", Col.White, Col.Black, Color.FromArgb(160, Col.Black), Col.Empty, Input: false);
SubInnfo_l.ParT.PositionBase = SubInnfo_l.ParT.PositionBase.AddY((0.0 - SubInnfo_l.ParT.OP[0].ps[3].Y) * SubInnfo_l.ParT.SizeBase); SubInnfo_l.ParT.PositionBase = SubInnfo_l.ParT.PositionBase.AddY((0.0 - SubInnfo_l.ParT.OP[0].ps[3].Y) * SubInnfo_l.ParT.SizeBase);
Sub2B = new Par(); Sub2B = new Par();
Sub2B.BasePointBase = Dat.Vec2DZero; Sub2B.BasePointBase = Dat.Vec2DZero;
Sub2B.PositionBase = new Vector2D(0.0025, vector2D.Y); Sub2B.PositionBase = new Vector2D(0.0025, vector2D.Y);
Sub2B.SizeBase = num2; Sub2B.SizeBase = num2;
Sub2B.OP.AddRange(new Out[1] { Shas.Get正方形() }); Sub2B.OP.AddRange(new Out[1] { Shas.Get正方形() });
Sub2B.OP.ScalingX(Sub2B.BasePointBase, num3); Sub2B.OP.ScalingX(Sub2B.BasePointBase, num3);
Sub2B.OP.ScalingY(Sub2B.BasePointBase, num4); Sub2B.OP.ScalingY(Sub2B.BasePointBase, num4);
Sub2B.Closed = true; Sub2B.Closed = true;
Sub2B.BrushColor = Color.FromArgb(160, Col.Black); Sub2B.BrushColor = Color.FromArgb(160, Col.Black);
Sub2B.Hit = false; Sub2B.Hit = false;
Sub2B.JP.Add(new Joi(SubB.OP.GetCenter())); Sub2B.JP.Add(new Joi(SubB.OP.GetCenter()));
Sub2 = new Tex("Tex3", Sub2B.PositionBase, num2 * 1.01, num3 * 0.98, num4 * 0.91, new Font("MS Gothic", 1f), 0.07, 0, "", Col.White, Col.Black, Color.Transparent, 15.0); Sub2 = new Tex("Tex3", Sub2B.PositionBase, num2 * 1.01, num3 * 0.98, num4 * 0.91, new Font("MS Gothic", 1f), 0.07, 0, "", Col.White, Col.Black, Color.Transparent, 15.0);
Sub2.ParT.BasePointBase = Sub2.ParT.OP.GetCenter().MulY(y); Sub2.ParT.BasePointBase = Sub2.ParT.OP.GetCenter().MulY(y);
Sub2.Position = Sub2B.ToGlobal(Sub2B.JP[0].Joint); Sub2.Position = Sub2B.ToGlobal(Sub2B.JP[0].Joint);
yp = new ParT(); yp = new ParT();
yp.Text = "・" + GameText.; yp.Text = "・" + GameText.;
yp.SizeBase = Mai.ParT.SizeBase; yp.SizeBase = Mai.ParT.SizeBase;
yp.Font = new Font("MS Gothic", 1f); yp.Font = new Font("MS Gothic", 1f);
yp.FontSize = Mai.ParT.FontSize; yp.FontSize = Mai.ParT.FontSize;
yp.SetStringRectOutline(Are.Unit, Are.GD); yp.SetStringRectOutline(Are.Unit, Are.GD);
yp.RectSize = new Vector2D(yp.OP[0].ps[1].X, yp.OP[0].ps[2].Y); yp.RectSize = new Vector2D(yp.OP[0].ps[1].X, yp.OP[0].ps[2].Y);
yp.OP.ScalingY(yp.BasePointBase, 0.9); yp.OP.ScalingY(yp.BasePointBase, 0.9);
yp.OP.OutlineFalse(); yp.OP.OutlineFalse();
yp.Closed = true; yp.Closed = true;
yp.TextColor = Col.White; yp.TextColor = Col.White;
yp.BrushColor = Color.FromArgb(0, Col.Black); yp.BrushColor = Color.FromArgb(0, Col.Black);
yp.ShadBrush = new SolidBrush(Col.Black); yp.ShadBrush = new SolidBrush(Col.Black);
yp.StringFormat.Alignment = StringAlignment.Center; yp.StringFormat.Alignment = StringAlignment.Center;
yp.StringFormat.LineAlignment = StringAlignment.Center; yp.StringFormat.LineAlignment = StringAlignment.Center;
yp.PositionBase = new Vector2D(MaiB.Position.X + 0.001, MaiB.Position.Y); yp.PositionBase = new Vector2D(MaiB.Position.X + 0.001, MaiB.Position.Y);
yp.Dra = false; yp.Dra = false;
yb = new But1(yp, delegate yb = new But1(yp, delegate
{ {
}); });
np = new ParT(); np = new ParT();
np.Text = "・" + GameText.; np.Text = "・" + GameText.;
np.SizeBase = Mai.ParT.SizeBase; np.SizeBase = Mai.ParT.SizeBase;
np.Font = new Font("MS Gothic", 1f); np.Font = new Font("MS Gothic", 1f);
np.FontSize = Mai.ParT.FontSize; np.FontSize = Mai.ParT.FontSize;
np.SetStringRectOutline(Are.Unit, Are.GD); np.SetStringRectOutline(Are.Unit, Are.GD);
np.RectSize = new Vector2D(np.OP[0].ps[1].X, np.OP[0].ps[2].Y); np.RectSize = new Vector2D(np.OP[0].ps[1].X, np.OP[0].ps[2].Y);
np.OP.ScalingY(np.BasePointBase, 0.9); np.OP.ScalingY(np.BasePointBase, 0.9);
np.OP.OutlineFalse(); np.OP.OutlineFalse();
np.Closed = true; np.Closed = true;
np.TextColor = Col.White; np.TextColor = Col.White;
np.BrushColor = Color.FromArgb(0, Col.Black); np.BrushColor = Color.FromArgb(0, Col.Black);
np.ShadBrush = new SolidBrush(Col.Black); np.ShadBrush = new SolidBrush(Col.Black);
np.StringFormat.Alignment = StringAlignment.Center; np.StringFormat.Alignment = StringAlignment.Center;
np.StringFormat.LineAlignment = StringAlignment.Center; np.StringFormat.LineAlignment = StringAlignment.Center;
np.PositionBase = new Vector2D(MaiB.Position.X + 0.001, MaiB.Position.Y); np.PositionBase = new Vector2D(MaiB.Position.X + 0.001, MaiB.Position.Y);
np.Dra = false; np.Dra = false;
nb = new But1(np, delegate nb = new But1(np, delegate
{ {
}); });
} }
public void SetHitColor(Med Med) public void SetHitColor(Med Med)
{ {
Mai.SetHitColor(Med); Mai.SetHitColor(Med);
Sub.SetHitColor(Med); Sub.SetHitColor(Med);
SubInnfo_l.SetHitColor(Med); SubInnfo_l.SetHitColor(Med);
Mai2.SetHitColor(Med); Mai2.SetHitColor(Med);
Sub2.SetHitColor(Med); Sub2.SetHitColor(Med);
yb.SetHitColor(Med); yb.SetHitColor(Med);
nb.SetHitColor(Med); nb.SetHitColor(Med);
} }
public void UpdateSub2() public void UpdateSub2()
{ {
Sub2.TextIm = GameText. + "\r\n" + Sta.GameData..ToString("#,0") + "\r\n" + GameText. + "\r\n" + Sta.GameData..ToString("#,0") + "\r\n" + Sta.GameData. + GameText. + "/" + Sta.GameData.; Sub2.TextIm = GameText. + "\r\n" + Sta.GameData..ToString("#,0") + "\r\n" + GameText. + "\r\n" + Sta.GameData..ToString("#,0") + "\r\n" + Sta.GameData. + GameText. + "/" + Sta.GameData.;
} }
private void SetButPos() private void SetButPos()
{ {
yp.PositionBase = new Vector2D(yp.PositionBase.X, Mai.ParT.ToGlobal(Mai.ParT.GetStringRect(Are.Unit, Are.GD).v2).Y + 0.0025); yp.PositionBase = new Vector2D(yp.PositionBase.X, Mai.ParT.ToGlobal(Mai.ParT.GetStringRect(Are.Unit, Are.GD).v2).Y + 0.0025);
np.PositionBase = new Vector2D(np.PositionBase.X, yp.ToGlobal(yp.OP.Last().ps.Last()).Y + 0.0025); np.PositionBase = new Vector2D(np.PositionBase.X, yp.ToGlobal(yp.OP.Last().ps.Last()).Y + 0.0025);
} }
public void Move(ref Color HitColor) public void Move(ref Color HitColor)
{ {
yb.Move(ref HitColor); yb.Move(ref HitColor);
nb.Move(ref HitColor); nb.Move(ref HitColor);
} }
public void Down(ref Color HitColor) public void Down(ref Color HitColor)
{ {
Sub.Down(ref HitColor); Sub.Down(ref HitColor);
yb.Down(ref HitColor); yb.Down(ref HitColor);
nb.Down(ref HitColor); nb.Down(ref HitColor);
} }
public void DownB(ref Color HitColor) public void DownB(ref Color HitColor)
{ {
yb.Down(ref HitColor); yb.Down(ref HitColor);
nb.Down(ref HitColor); nb.Down(ref HitColor);
} }
public void Up(ref Color HitColor) public void Up(ref Color HitColor)
{ {
Sub.Up(ref HitColor); Sub.Up(ref HitColor);
yb.Up(ref HitColor); yb.Up(ref HitColor);
nb.Up(ref HitColor); nb.Up(ref HitColor);
} }
public void Draw(Are Are, FPS FPS) public void Draw(Are Are, FPS FPS)
{ {
if (MaiShow) if (MaiShow)
{ {
Are.Draw(MaiB); Are.Draw(MaiB);
Mai.Progression(FPS); Mai.Progression(FPS);
Are.Draw(Mai.Pars); Are.Draw(Mai.Pars);
} }
if (Mai2Show) if (Mai2Show)
{ {
Are.Draw(Mai2B); Are.Draw(Mai2B);
Are.Draw(Mai2.Pars); Are.Draw(Mai2.Pars);
} }
if (SubShow) if (SubShow)
{ {
Are.Draw(SubB); Are.Draw(SubB);
Sub.Progression(FPS); Sub.Progression(FPS);
Are.Draw(Sub.Pars); Are.Draw(Sub.Pars);
Are.Draw(SubInnfo_l.ParT); Are.Draw(SubInnfo_l.ParT);
} }
if (Sub2Show) if (Sub2Show)
{ {
Are.Draw(Sub2B); Are.Draw(Sub2B);
Are.Draw(Sub2.Pars); Are.Draw(Sub2.Pars);
} }
if (yp.Dra) if (yp.Dra)
{ {
Are.Draw(yp); Are.Draw(yp);
} }
if (np.Dra) if (np.Dra)
{ {
Are.Draw(np); Are.Draw(np);
} }
} }
public void Dispose() public void Dispose()
{ {
MaiB.Dispose(); MaiB.Dispose();
Mai.Dispose(); Mai.Dispose();
Mai2B.Dispose(); Mai2B.Dispose();
Mai2.Dispose(); Mai2.Dispose();
SubB.Dispose(); SubB.Dispose();
Sub.Dispose(); Sub.Dispose();
SubInnfo_l.Dispose(); SubInnfo_l.Dispose();
Sub2B.Dispose(); Sub2B.Dispose();
Sub2.Dispose(); Sub2.Dispose();
} }
}
} }

View File

@@ -3,110 +3,111 @@ using System.Drawing;
using System.Linq; using System.Linq;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public struct sep
{ {
public Ele Sta; public struct sep
{
public Ele Sta;
public Ele Ele; public Ele Ele;
public Par Par; public Par Par;
public List<int> Path; public List<int> Path;
public Vector2D Pos; public Vector2D Pos;
} }
//three subclasses: one for bukkake, kiss marks, and whip marks //three subclasses: one for bukkake, kiss marks, and whip marks
public class Stamp public class Stamp
{ {
public Med Med; public Med Med;
public Are Are; public Are Are;
public Cha Cha; public Cha Cha;
public Bod Bod; public Bod Bod;
protected EleD EleD; protected EleD EleD;
protected List<sep> sta = new List<sep>(); protected List<sep> sta = new List<sep>();
protected const int Max = 33; protected const int Max = 33;
protected Par p; protected Par p;
protected Color2 c2; protected Color2 c2;
protected Ele he; protected Ele he;
protected sep sep; protected sep sep;
public virtual void Draw(Are Are) public virtual void Draw(Are Are)
{ {
} }
public virtual void Add(Vector2D cp, Color hc) public virtual void Add(Vector2D cp, Color hc)
{ {
} }
public Stamp() public Stamp()
{ {
} }
public Stamp(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD) public Stamp(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD)
{ {
this.Med = Med; this.Med = Med;
this.Are = Are; this.Are = Are;
this.Cha = Cha; this.Cha = Cha;
this.Bod = Bod; this.Bod = Bod;
this.EleD = EleD; this.EleD = EleD;
} }
public virtual void Dispose() public virtual void Dispose()
{ {
foreach (sep stum in sta) foreach (sep stum in sta)
{ {
stum.Sta.Dispose(); stum.Sta.Dispose();
} }
} }
public void Clear() public void Clear()
{ {
foreach (sep stum in sta) foreach (sep stum in sta)
{ {
stum.Sta.Dispose(); stum.Sta.Dispose();
} }
sta.Clear(); sta.Clear();
} }
public void Clear() public void Clear()
{ {
sep[] array = sta.Where((sep e) => e.Ele is _人 || e.Ele is _人 || e.Ele is _人).ToArray(); sep[] array = sta.Where((sep e) => e.Ele is _人 || e.Ele is _人 || e.Ele is _人).ToArray();
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
sep item = array[i]; sep item = array[i];
item.Sta.Dispose(); item.Sta.Dispose();
sta.Remove(item); sta.Remove(item);
} }
} }
public bool 1(Ele e) public bool 1(Ele e)
{ {
if (e != null && !(e is ) && !(e is )) if (e != null && !(e is ) && !(e is ))
{ {
return !(e is ); return !(e is );
} }
return false; return false;
} }
public bool 2(Ele e) public bool 2(Ele e)
{ {
if (e != null && !(e is _人) && !(e is ) && !(e is )) if (e != null && !(e is _人) && !(e is ) && !(e is ))
{ {
return !(e is ); return !(e is );
} }
return false; return false;
} }
}
} }

View File

@@ -2,241 +2,242 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public struct ryps
{ {
public Par r; public struct ryps
{
public Par r;
public Vector2D c; public Vector2D c;
public Vector2D[] ps; public Vector2D[] ps;
} }
public class Sweat public class Sweat
{ {
private HashSet<string> = new HashSet<string> private HashSet<string> = new HashSet<string>
{ {
Sta.t.ToString(), Sta.t.ToString(),
Sta.t.ToString(), Sta.t.ToString(),
Sta.t.ToString(), Sta.t.ToString(),
Sta.t.ToString() Sta.t.ToString()
}; };
private ryps[] ; private ryps[] ;
private List<Ele> = new List<Ele>(); private List<Ele> = new List<Ele>();
private List<double> = new List<double>(); private List<double> = new List<double>();
public Mot ; public Mot ;
private Mot ; private Mot ;
private bool = true; private bool = true;
private int i; private int i;
private Ele ; private Ele ;
private Vector2D tp; private Vector2D tp;
public void Draw(Are Are) public void Draw(Are Are)
{ {
if (!.Run && !.Run) if (!.Run && !.Run)
{ {
return; return;
} }
this.i = 0; this.i = 0;
ryps[] array = ; ryps[] array = ;
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
ryps ryps2 = array[i]; ryps ryps2 = array[i];
Vector2D[] ps = ryps2.ps; Vector2D[] ps = ryps2.ps;
foreach (Vector2D local in ps) foreach (Vector2D local in ps)
{ {
= [this.i]; = [this.i];
if (. != 0.0) if (. != 0.0)
{ {
tp = ryps2.r.ToGlobal(local); tp = ryps2.r.ToGlobal(local);
..CurJoinRoot.PositionBase = tp + (ryps2.r.ToGlobal(ryps2.c) - tp) * [this.i]; ..CurJoinRoot.PositionBase = tp + (ryps2.r.ToGlobal(ryps2.c) - tp) * [this.i];
..JoinPA(); ..JoinPA();
.(); .();
..Draw(Are); ..Draw(Are);
} }
this.i++; this.i++;
} }
} }
} }
public Sweat(Med Med, Are Are, Cha Cha, Mots Mots) public Sweat(Med Med, Are Are, Cha Cha, Mots Mots)
{ {
Ele[] es = null; Ele[] es = null;
Ele n = null; Ele n = null;
bool re = false; bool re = false;
= new Mot(0.0, 1.0) = new Mot(0.0, 1.0)
{ {
BaseSpeed = 1.0, BaseSpeed = 1.0,
Staing = delegate Staing = delegate
{ {
if () if ()
{ {
es = .Where((Ele e) => e. != 0.0).ToArray(); es = .Where((Ele e) => e. != 0.0).ToArray();
Ele[] array5 = es; Ele[] array5 = es;
for (int num3 = 0; num3 < array5.Length; num3++) for (int num3 = 0; num3 < array5.Length; num3++)
{ {
array5[num3]. = 0.0; array5[num3]. = 0.0;
} }
} }
}, },
Runing = delegate(Mot m) Runing = delegate(Mot m)
{ {
if () if ()
{ {
Ele[] array4 = es; Ele[] array4 = es;
for (int num2 = 0; num2 < array4.Length; num2++) for (int num2 = 0; num2 < array4.Length; num2++)
{ {
array4[num2]. = m.Value; array4[num2]. = m.Value;
} }
} }
else if (!re) else if (!re)
{ {
n.Yv = m.Value; n.Yv = m.Value;
} }
else else
{ {
n. = m.Value; n. = m.Value;
} }
}, },
Reaing = delegate(Mot m) Reaing = delegate(Mot m)
{ {
if () if ()
{ {
Ele[] array3 = es; Ele[] array3 = es;
for (int l = 0; l < array3.Length; l++) for (int l = 0; l < array3.Length; l++)
{ {
array3[l]. = 1.0; array3[l]. = 1.0;
} }
m.ResetValue(); m.ResetValue();
= false; = false;
es = .Where((Ele e) => e. != 0.0).ToArray(); es = .Where((Ele e) => e. != 0.0).ToArray();
n = es[RNG.XS.Next(es.Length)]; n = es[RNG.XS.Next(es.Length)];
} }
else else
{ {
re = true; re = true;
} }
}, },
Rouing = delegate(Mot m) Rouing = delegate(Mot m)
{ {
if (!) if (!)
{ {
n.Yv = 0.0; n.Yv = 0.0;
n. = 0.0; n. = 0.0;
es = .Where((Ele e) => e. != 0.0).ToArray(); es = .Where((Ele e) => e. != 0.0).ToArray();
if (es.Length != 0) if (es.Length != 0)
{ {
n = es[RNG.XS.Next(es.Length)]; n = es[RNG.XS.Next(es.Length)];
} }
es = .Where((Ele e) => e. == 0.0).ToArray(); es = .Where((Ele e) => e. == 0.0).ToArray();
if (es.Length != 0) if (es.Length != 0)
{ {
es[RNG.XS.Next(es.Length)]. = 1.0; es[RNG.XS.Next(es.Length)]. = 1.0;
} }
re = false; re = false;
m.ResetValue(); m.ResetValue();
} }
}, },
Ending = delegate(Mot m) Ending = delegate(Mot m)
{ {
if (!) if (!)
{ {
n.Yv = 0.0; n.Yv = 0.0;
n. = 0.0; n. = 0.0;
es = .Where((Ele e) => e. != 0.0).ToArray(); es = .Where((Ele e) => e. != 0.0).ToArray();
n = es[RNG.XS.Next(es.Length)]; n = es[RNG.XS.Next(es.Length)];
es = .Where((Ele e) => e. == 0.0).ToArray(); es = .Where((Ele e) => e. == 0.0).ToArray();
es[RNG.XS.Next(es.Length)]. = 1.0; es[RNG.XS.Next(es.Length)]. = 1.0;
re = false; re = false;
m.ResetValue(); m.ResetValue();
.Start(); .Start();
} }
} }
}; };
Mots.Add(.GetHashCode().ToString(), ); Mots.Add(.GetHashCode().ToString(), );
= new Mot(0.0, 1.0) = new Mot(0.0, 1.0)
{ {
BaseSpeed = 1.0, BaseSpeed = 1.0,
Staing = delegate Staing = delegate
{ {
es = .Where((Ele e) => e. != 0.0).ToArray(); es = .Where((Ele e) => e. != 0.0).ToArray();
}, },
Runing = delegate(Mot m) Runing = delegate(Mot m)
{ {
Ele[] array2 = es; Ele[] array2 = es;
for (int k = 0; k < array2.Length; k++) for (int k = 0; k < array2.Length; k++)
{ {
array2[k]. = m.Value.Inverse(); array2[k]. = m.Value.Inverse();
} }
}, },
Reaing = delegate(Mot m) Reaing = delegate(Mot m)
{ {
m.End(); m.End();
m.ResetValue(); m.ResetValue();
Ele[] array = es; Ele[] array = es;
for (int j = 0; j < array.Length; j++) for (int j = 0; j < array.Length; j++)
{ {
array[j]. = 1.0; array[j]. = 1.0;
} }
= true; = true;
}, },
Rouing = delegate Rouing = delegate
{ {
}, },
Ending = delegate Ending = delegate
{ {
} }
}; };
Mots.Add(.GetHashCode().ToString(), ); Mots.Add(.GetHashCode().ToString(), );
List<ryps> list = new List<ryps>(); List<ryps> list = new List<ryps>();
int num = 0; int num = 0;
D e2 = new D(); D e2 = new D();
ryps ryps; ryps ryps;
foreach (Ele item in Cha.Bod.Elements.Where((Ele e) => .Contains(e.GetType().ToString()))) foreach (Ele item in Cha.Bod.Elements.Where((Ele e) => .Contains(e.GetType().ToString())))
{ {
ryps = default(ryps); ryps = default(ryps);
ryps.r = item..CurJoinRoot; ryps.r = item..CurJoinRoot;
ryps.c = ryps.r.OP.GetCenter(); ryps.c = ryps.r.OP.GetCenter();
ryps.ps = (from p in ryps.r.OP.EnumPoints() ryps.ps = (from p in ryps.r.OP.EnumPoints()
where ryps.c.Y > p.Y where ryps.c.Y > p.Y
select p).ToArray(); select p).ToArray();
list.Add(ryps); list.Add(ryps);
Vector2D[] ps = ryps.ps; Vector2D[] ps = ryps.ps;
for (int i = 0; i < ps.Length; i++) for (int i = 0; i < ps.Length; i++)
{ {
_ = ref ps[i]; _ = ref ps[i];
= new (Are.DisUnit, .N0, Cha., Med, e2); = new (Are.DisUnit, .N0, Cha., Med, e2);
.SetHitFalse(); .SetHitFalse();
. = ((RNG.XS.NextDouble() < 0.2) ? 1.0 : 0.0); . = ((RNG.XS.NextDouble() < 0.2) ? 1.0 : 0.0);
.Add(num switch .Add(num switch
{ {
1 => 0.5, 1 => 0.5,
0 => 0.7, 0 => 0.7,
_ => 0.3, _ => 0.3,
}); });
.Add(); .Add();
num = ((num != 2) ? (num + 1) : 0); num = ((num != 2) ? (num + 1) : 0);
} }
} }
= list.ToArray(); = list.ToArray();
} }
public void Dispose() public void Dispose()
{ {
foreach (Ele item in ) foreach (Ele item in )
{ {
item.Dispose(); item.Dispose();
} }
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,58 +1,59 @@
using System; using System;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class T剃刀D : EleD
{ {
public bool _表示 = true; [Serializable]
public class T剃刀D : EleD
{
public bool _表示 = true;
public bool _刃1_表示 = true; public bool _刃1_表示 = true;
public bool _刃2_表示 = true; public bool _刃2_表示 = true;
public bool _表示 = true; public bool _表示 = true;
public bool _グリップ0_表示 = true; public bool _グリップ0_表示 = true;
public bool _グリップ1_表示 = true; public bool _グリップ1_表示 = true;
public bool _グリップ2_表示 = true; public bool _グリップ2_表示 = true;
public bool _グリップ3_表示 = true; public bool _グリップ3_表示 = true;
public bool _グリップ4_表示 = true; public bool _グリップ4_表示 = true;
public bool _グリップ5_表示 = true; public bool _グリップ5_表示 = true;
public bool _グリップ6_表示 = true; public bool _グリップ6_表示 = true;
public bool _グリップ7_表示 = true; public bool _グリップ7_表示 = true;
public bool _グリップ8_表示 = true; public bool _グリップ8_表示 = true;
public bool _グリップ9_表示 = true; public bool _グリップ9_表示 = true;
public bool _グリップ10_表示 = true; public bool _グリップ10_表示 = true;
public bool _グリップ11_表示 = true; public bool _グリップ11_表示 = true;
public bool _グリップ12_表示 = true; public bool _グリップ12_表示 = true;
public bool _グリップ13_表示 = true; public bool _グリップ13_表示 = true;
public bool _グリップ14_表示 = true; public bool _グリップ14_表示 = true;
public bool _グリップ15_表示 = true; public bool _グリップ15_表示 = true;
public T剃刀D() public T剃刀D()
{ {
ThisType = GetType(); ThisType = GetType();
} }
public override Ele GetEle(double DisUnit, Med Med, ) public override Ele GetEle(double DisUnit, Med Med, )
{ {
return new T剃刀(DisUnit, , , Med, this); return new T剃刀(DisUnit, , , Med, this);
} }
}
} }

View File

@@ -1,8 +1,9 @@
namespace SlaveMatrix; namespace SlaveMatrix
public enum UsageStatus
{ {
Standby, public enum UsageStatus
InUse, {
Attach Standby,
InUse,
Attach
}
} }

View File

@@ -1,12 +1,13 @@
namespace SlaveMatrix; namespace SlaveMatrix
public class 1 : 0
{ {
public virtual bool _髪縛1_表示 { get; set; } public class 1 : 0
{
public virtual bool _髪縛1_表示 { get; set; }
public virtual bool _髪縛2_表示 { get; set; } public virtual bool _髪縛2_表示 { get; set; }
public virtual void ( ) public virtual void ( )
{ {
} }
}
} }

View File

@@ -1,8 +1,9 @@
using System; using System;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class 1D : 0D
{ {
[Serializable]
public class 1D : 0D
{
}
} }

View File

@@ -1,16 +1,17 @@
namespace SlaveMatrix; namespace SlaveMatrix
public class 2 : 0
{ {
public virtual bool _髪縛1_表示 { get; set; } public class 2 : 0
{
public virtual bool _髪縛1_表示 { get; set; }
public virtual bool _髪縛2_表示 { get; set; } public virtual bool _髪縛2_表示 { get; set; }
public virtual bool _髪縛1_表示 { get; set; } public virtual bool _髪縛1_表示 { get; set; }
public virtual bool _髪縛2_表示 { get; set; } public virtual bool _髪縛2_表示 { get; set; }
public virtual void ( , ) public virtual void ( , )
{ {
} }
}
} }

View File

@@ -1,8 +1,9 @@
using System; using System;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class 2D : 0D
{ {
[Serializable]
public class 2D : 0D
{
}
} }

View File

@@ -1,200 +1,201 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class _大 : Ele
{ {
public Par X0Y0_精液; public class _大 : Ele
{
public Par X0Y0_精液;
public Par X0Y1_精液; public Par X0Y1_精液;
public Par X0Y2_精液; public Par X0Y2_精液;
public Par X0Y3_精液; public Par X0Y3_精液;
public Par X0Y4_精液; public Par X0Y4_精液;
public ColorD CD; public ColorD CD;
public ColorP X0Y0_精液CP; public ColorP X0Y0_精液CP;
public ColorP X0Y1_精液CP; public ColorP X0Y1_精液CP;
public ColorP X0Y2_精液CP; public ColorP X0Y2_精液CP;
public ColorP X0Y3_精液CP; public ColorP X0Y3_精液CP;
public ColorP X0Y4_精液CP; public ColorP X0Y4_精液CP;
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_精液.Dra; return X0Y0_精液.Dra;
} }
set set
{ {
X0Y0_精液.Dra = value; X0Y0_精液.Dra = value;
X0Y1_精液.Dra = value; X0Y1_精液.Dra = value;
X0Y2_精液.Dra = value; X0Y2_精液.Dra = value;
X0Y3_精液.Dra = value; X0Y3_精液.Dra = value;
X0Y4_精液.Dra = value; X0Y4_精液.Dra = value;
X0Y0_精液.Hit = value; X0Y0_精液.Hit = value;
X0Y1_精液.Hit = value; X0Y1_精液.Hit = value;
X0Y2_精液.Hit = value; X0Y2_精液.Hit = value;
X0Y3_精液.Hit = value; X0Y3_精液.Hit = value;
X0Y4_精液.Hit = value; X0Y4_精液.Hit = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _表示; return _表示;
} }
set set
{ {
_表示 = value; _表示 = value;
} }
} }
public override double public override double
{ {
get get
{ {
return CD.; return CD.;
} }
set set
{ {
CD. = value; CD. = value;
} }
} }
public _大(double DisUnit, , , Med Med, _大D e) public _大(double DisUnit, , , Med Med, _大D e)
{ {
ThisType = GetType(); ThisType = GetType();
Dif dif = new Dif(Sta.["ぶっかけ"][1]); Dif dif = new Dif(Sta.["ぶっかけ"][1]);
= new Difs(); = new Difs();
.Tag = dif.Tag; .Tag = dif.Tag;
.Add(dif); .Add(dif);
Pars pars = [0][0]; Pars pars = [0][0];
X0Y0_精液 = pars["精液"].ToPar(); X0Y0_精液 = pars["精液"].ToPar();
pars = [0][1]; pars = [0][1];
X0Y1_精液 = pars["精液"].ToPar(); X0Y1_精液 = pars["精液"].ToPar();
pars = [0][2]; pars = [0][2];
X0Y2_精液 = pars["精液"].ToPar(); X0Y2_精液 = pars["精液"].ToPar();
pars = [0][3]; pars = [0][3];
X0Y3_精液 = pars["精液"].ToPar(); X0Y3_精液 = pars["精液"].ToPar();
pars = [0][4]; pars = [0][4];
X0Y4_精液 = pars["精液"].ToPar(); X0Y4_精液 = pars["精液"].ToPar();
.SetJoints(); .SetJoints();
= new JointD(); = new JointD();
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
C = e.C; C = e.C;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
XB = e.XB; XB = e.XB;
XC = e.XC; XC = e.XC;
YB = e.YB; YB = e.YB;
YC = e.YC; YC = e.YC;
= e.; = e.;
= e.; = e.;
Xv = e.Xv; Xv = e.Xv;
Yv = e.Yv; Yv = e.Yv;
Xi = e.Xi; Xi = e.Xi;
Yi = e.Yi; Yi = e.Yi;
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
_表示 = e._表示; _表示 = e._表示;
= e.; = e.;
= e.; = e.;
= e.; = e.;
if (!e.) if (!e.)
{ {
= false; = false;
} }
base. = ; base. = ;
(); ();
X0Y0_精液CP = new ColorP(X0Y0_精液, CD, DisUnit, abj: true); X0Y0_精液CP = new ColorP(X0Y0_精液, CD, DisUnit, abj: true);
X0Y1_精液CP = new ColorP(X0Y1_精液, CD, DisUnit, abj: true); X0Y1_精液CP = new ColorP(X0Y1_精液, CD, DisUnit, abj: true);
X0Y2_精液CP = new ColorP(X0Y2_精液, CD, DisUnit, abj: true); X0Y2_精液CP = new ColorP(X0Y2_精液, CD, DisUnit, abj: true);
X0Y3_精液CP = new ColorP(X0Y3_精液, CD, DisUnit, abj: true); X0Y3_精液CP = new ColorP(X0Y3_精液, CD, DisUnit, abj: true);
X0Y4_精液CP = new ColorP(X0Y4_精液, CD, DisUnit, abj: true); X0Y4_精液CP = new ColorP(X0Y4_精液, CD, DisUnit, abj: true);
= e.; = e.;
} }
public override void () public override void ()
{ {
switch (.IndexY) switch (.IndexY)
{ {
case 0: case 0:
X0Y0_精液CP.Update(); X0Y0_精液CP.Update();
break; break;
case 1: case 1:
X0Y1_精液CP.Update(); X0Y1_精液CP.Update();
break; break;
case 2: case 2:
X0Y2_精液CP.Update(); X0Y2_精液CP.Update();
break; break;
case 3: case 3:
X0Y3_精液CP.Update(); X0Y3_精液CP.Update();
break; break;
default: default:
X0Y4_精液CP.Update(); X0Y4_精液CP.Update();
break; break;
} }
} }
private void ( ) private void ( )
{ {
N0(); N0();
} }
private void N0( ) private void N0( )
{ {
CD = new ColorD(ref ., ref .); CD = new ColorD(ref ., ref .);
} }
}
} }

View File

@@ -1,20 +1,21 @@
using System; using System;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class _大D : EleD
{ {
public bool _表示 = true; [Serializable]
public class _大D : EleD
{
public bool _表示 = true;
public _大D() public _大D()
{ {
ThisType = GetType(); ThisType = GetType();
} }
public override Ele GetEle(double DisUnit, Med Med, ) public override Ele GetEle(double DisUnit, Med Med, )
{ {
return new _大(DisUnit, , , Med, this); return new _大(DisUnit, , , Med, this);
} }
}
} }

View File

@@ -1,200 +1,201 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class _小 : Ele
{ {
public Par X0Y0_精液; public class _小 : Ele
{
public Par X0Y0_精液;
public Par X0Y1_精液; public Par X0Y1_精液;
public Par X0Y2_精液; public Par X0Y2_精液;
public Par X0Y3_精液; public Par X0Y3_精液;
public Par X0Y4_精液; public Par X0Y4_精液;
public ColorD CD; public ColorD CD;
public ColorP X0Y0_精液CP; public ColorP X0Y0_精液CP;
public ColorP X0Y1_精液CP; public ColorP X0Y1_精液CP;
public ColorP X0Y2_精液CP; public ColorP X0Y2_精液CP;
public ColorP X0Y3_精液CP; public ColorP X0Y3_精液CP;
public ColorP X0Y4_精液CP; public ColorP X0Y4_精液CP;
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_精液.Dra; return X0Y0_精液.Dra;
} }
set set
{ {
X0Y0_精液.Dra = value; X0Y0_精液.Dra = value;
X0Y1_精液.Dra = value; X0Y1_精液.Dra = value;
X0Y2_精液.Dra = value; X0Y2_精液.Dra = value;
X0Y3_精液.Dra = value; X0Y3_精液.Dra = value;
X0Y4_精液.Dra = value; X0Y4_精液.Dra = value;
X0Y0_精液.Hit = value; X0Y0_精液.Hit = value;
X0Y1_精液.Hit = value; X0Y1_精液.Hit = value;
X0Y2_精液.Hit = value; X0Y2_精液.Hit = value;
X0Y3_精液.Hit = value; X0Y3_精液.Hit = value;
X0Y4_精液.Hit = value; X0Y4_精液.Hit = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _表示; return _表示;
} }
set set
{ {
_表示 = value; _表示 = value;
} }
} }
public override double public override double
{ {
get get
{ {
return CD.; return CD.;
} }
set set
{ {
CD. = value; CD. = value;
} }
} }
public _小(double DisUnit, , , Med Med, _小D e) public _小(double DisUnit, , , Med Med, _小D e)
{ {
ThisType = GetType(); ThisType = GetType();
Dif dif = new Dif(Sta.["ぶっかけ"][0]); Dif dif = new Dif(Sta.["ぶっかけ"][0]);
= new Difs(); = new Difs();
.Tag = dif.Tag; .Tag = dif.Tag;
.Add(dif); .Add(dif);
Pars pars = [0][0]; Pars pars = [0][0];
X0Y0_精液 = pars["精液"].ToPar(); X0Y0_精液 = pars["精液"].ToPar();
pars = [0][1]; pars = [0][1];
X0Y1_精液 = pars["精液"].ToPar(); X0Y1_精液 = pars["精液"].ToPar();
pars = [0][2]; pars = [0][2];
X0Y2_精液 = pars["精液"].ToPar(); X0Y2_精液 = pars["精液"].ToPar();
pars = [0][3]; pars = [0][3];
X0Y3_精液 = pars["精液"].ToPar(); X0Y3_精液 = pars["精液"].ToPar();
pars = [0][4]; pars = [0][4];
X0Y4_精液 = pars["精液"].ToPar(); X0Y4_精液 = pars["精液"].ToPar();
.SetJoints(); .SetJoints();
= new JointD(); = new JointD();
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
C = e.C; C = e.C;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
XB = e.XB; XB = e.XB;
XC = e.XC; XC = e.XC;
YB = e.YB; YB = e.YB;
YC = e.YC; YC = e.YC;
= e.; = e.;
= e.; = e.;
Xv = e.Xv; Xv = e.Xv;
Yv = e.Yv; Yv = e.Yv;
Xi = e.Xi; Xi = e.Xi;
Yi = e.Yi; Yi = e.Yi;
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
_表示 = e._表示; _表示 = e._表示;
= e.; = e.;
= e.; = e.;
= e.; = e.;
if (!e.) if (!e.)
{ {
= false; = false;
} }
base. = ; base. = ;
(); ();
X0Y0_精液CP = new ColorP(X0Y0_精液, CD, DisUnit, abj: true); X0Y0_精液CP = new ColorP(X0Y0_精液, CD, DisUnit, abj: true);
X0Y1_精液CP = new ColorP(X0Y1_精液, CD, DisUnit, abj: true); X0Y1_精液CP = new ColorP(X0Y1_精液, CD, DisUnit, abj: true);
X0Y2_精液CP = new ColorP(X0Y2_精液, CD, DisUnit, abj: true); X0Y2_精液CP = new ColorP(X0Y2_精液, CD, DisUnit, abj: true);
X0Y3_精液CP = new ColorP(X0Y3_精液, CD, DisUnit, abj: true); X0Y3_精液CP = new ColorP(X0Y3_精液, CD, DisUnit, abj: true);
X0Y4_精液CP = new ColorP(X0Y4_精液, CD, DisUnit, abj: true); X0Y4_精液CP = new ColorP(X0Y4_精液, CD, DisUnit, abj: true);
= e.; = e.;
} }
public override void () public override void ()
{ {
switch (.IndexY) switch (.IndexY)
{ {
case 0: case 0:
X0Y0_精液CP.Update(); X0Y0_精液CP.Update();
break; break;
case 1: case 1:
X0Y1_精液CP.Update(); X0Y1_精液CP.Update();
break; break;
case 2: case 2:
X0Y2_精液CP.Update(); X0Y2_精液CP.Update();
break; break;
case 3: case 3:
X0Y3_精液CP.Update(); X0Y3_精液CP.Update();
break; break;
default: default:
X0Y4_精液CP.Update(); X0Y4_精液CP.Update();
break; break;
} }
} }
private void ( ) private void ( )
{ {
N0(); N0();
} }
private void N0( ) private void N0( )
{ {
CD = new ColorD(ref ., ref .); CD = new ColorD(ref ., ref .);
} }
}
} }

View File

@@ -1,20 +1,21 @@
using System; using System;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class _小D : EleD
{ {
public bool _表示 = true; [Serializable]
public class _小D : EleD
{
public bool _表示 = true;
public _小D() public _小D()
{ {
ThisType = GetType(); ThisType = GetType();
} }
public override Ele GetEle(double DisUnit, Med Med, ) public override Ele GetEle(double DisUnit, Med Med, )
{ {
return new _小(DisUnit, , , Med, this); return new _小(DisUnit, , , Med, this);
} }
}
} }

View File

@@ -1,5 +1,6 @@
namespace SlaveMatrix; namespace SlaveMatrix
public class : 1
{ {
public class : 1
{
}
} }

View File

@@ -1,8 +1,9 @@
using System; using System;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class D : 1D
{ {
[Serializable]
public class D : 1D
{
}
} }

View File

@@ -1,144 +1,145 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class : Ele
{ {
public Par X0Y0_キスマーク; public class : Ele
{
public Par X0Y0_キスマーク;
public ColorD CD; public ColorD CD;
public ColorP X0Y0_キスマークCP; public ColorP X0Y0_キスマークCP;
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_キスマーク.Dra; return X0Y0_キスマーク.Dra;
} }
set set
{ {
X0Y0_キスマーク.Dra = value; X0Y0_キスマーク.Dra = value;
X0Y0_キスマーク.Hit = value; X0Y0_キスマーク.Hit = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _表示; return _表示;
} }
set set
{ {
_表示 = value; _表示 = value;
} }
} }
public override double public override double
{ {
get get
{ {
return CD.; return CD.;
} }
set set
{ {
CD. = value; CD. = value;
} }
} }
public (double DisUnit, , , Med Med, D e) public (double DisUnit, , , Med Med, D e)
{ {
ThisType = GetType(); ThisType = GetType();
= new Difs(Sta.["キスマーク"]); = new Difs(Sta.["キスマーク"]);
Pars pars = [0][0]; Pars pars = [0][0];
X0Y0_キスマーク = pars["キスマーク"].ToPar(); X0Y0_キスマーク = pars["キスマーク"].ToPar();
.SetJoints(); .SetJoints();
= new JointD(); = new JointD();
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
C = e.C; C = e.C;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
XB = e.XB; XB = e.XB;
XC = e.XC; XC = e.XC;
YB = e.YB; YB = e.YB;
YC = e.YC; YC = e.YC;
= e.; = e.;
= e.; = e.;
Xv = e.Xv; Xv = e.Xv;
Yv = e.Yv; Yv = e.Yv;
Xi = e.Xi; Xi = e.Xi;
Yi = e.Yi; Yi = e.Yi;
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
_表示 = e._表示; _表示 = e._表示;
= e.; = e.;
= e.; = e.;
= e.; = e.;
if (!e.) if (!e.)
{ {
= false; = false;
} }
base. = ; base. = ;
(); ();
X0Y0_キスマークCP = new ColorP(X0Y0_キスマーク, CD, DisUnit, abj: true); X0Y0_キスマークCP = new ColorP(X0Y0_キスマーク, CD, DisUnit, abj: true);
= e.; = e.;
} }
public override void () public override void ()
{ {
X0Y0_キスマークCP.Update(); X0Y0_キスマークCP.Update();
} }
private void ( ) private void ( )
{ {
N0(); N0();
} }
private void N0( ) private void N0( )
{ {
CD = new ColorD(ref Col.Empty, ref .); CD = new ColorD(ref Col.Empty, ref .);
} }
}
} }

View File

@@ -1,20 +1,21 @@
using System; using System;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class D : EleD
{ {
public bool _表示 = true; [Serializable]
public class D : EleD
{
public bool _表示 = true;
public D() public D()
{ {
ThisType = GetType(); ThisType = GetType();
} }
public override Ele GetEle(double DisUnit, Med Med, ) public override Ele GetEle(double DisUnit, Med Med, )
{ {
return new (DisUnit, , , Med, this); return new (DisUnit, , , Med, this);
} }
}
} }

View File

@@ -1,195 +1,196 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class 1 : Ele
{ {
public Par X0Y0_根本; public class 1 : Ele
{
public Par X0Y0_根本;
public Par X0Y0_先端; public Par X0Y0_先端;
public ColorD CD; public ColorD CD;
public ColorD CD; public ColorD CD;
public ColorP X0Y0_根本CP; public ColorP X0Y0_根本CP;
public ColorP X0Y0_先端CP; public ColorP X0Y0_先端CP;
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_根本.Dra; return X0Y0_根本.Dra;
} }
set set
{ {
X0Y0_根本.Dra = value; X0Y0_根本.Dra = value;
X0Y0_根本.Hit = value; X0Y0_根本.Hit = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_先端.Dra; return X0Y0_先端.Dra;
} }
set set
{ {
X0Y0_先端.Dra = value; X0Y0_先端.Dra = value;
X0Y0_先端.Hit = value; X0Y0_先端.Hit = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _表示; return _表示;
} }
set set
{ {
_表示 = value; _表示 = value;
_表示 = value; _表示 = value;
} }
} }
public override double public override double
{ {
get get
{ {
return CD.; return CD.;
} }
set set
{ {
CD. = value; CD. = value;
CD. = value; CD. = value;
} }
} }
public override double public override double
{ {
set set
{ {
} }
} }
public override double public override double
{ {
set set
{ {
} }
} }
public 1(double DisUnit, , , Med Med, 1D e) public 1(double DisUnit, , , Med Med, 1D e)
{ {
ThisType = GetType(); ThisType = GetType();
= new Difs(Sta.["キャップ中"]); = new Difs(Sta.["キャップ中"]);
Pars pars = [0][0]; Pars pars = [0][0];
X0Y0_根本 = pars["根本"].ToPar(); X0Y0_根本 = pars["根本"].ToPar();
X0Y0_先端 = pars["先端"].ToPar(); X0Y0_先端 = pars["先端"].ToPar();
.SetJoints(); .SetJoints();
= new JointD(); = new JointD();
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
C = e.C; C = e.C;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
XB = e.XB; XB = e.XB;
XC = e.XC; XC = e.XC;
YB = e.YB; YB = e.YB;
YC = e.YC; YC = e.YC;
= e.; = e.;
= e.; = e.;
Xv = e.Xv; Xv = e.Xv;
Yv = e.Yv; Yv = e.Yv;
Xi = e.Xi; Xi = e.Xi;
Yi = e.Yi; Yi = e.Yi;
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
_表示 = e._表示; _表示 = e._表示;
_表示 = e._表示; _表示 = e._表示;
= e.; = e.;
= e.; = e.;
= e.; = e.;
if (!e.) if (!e.)
{ {
= false; = false;
} }
base. = ; base. = ;
(); ();
X0Y0_根本CP = new ColorP(X0Y0_根本, CD, DisUnit, abj: true); X0Y0_根本CP = new ColorP(X0Y0_根本, CD, DisUnit, abj: true);
X0Y0_先端CP = new ColorP(X0Y0_先端, CD, DisUnit, abj: true); X0Y0_先端CP = new ColorP(X0Y0_先端, CD, DisUnit, abj: true);
= e.; = e.;
Vector2D local = X0Y0_根本.OP[0].ps[2]; Vector2D local = X0Y0_根本.OP[0].ps[2];
foreach (Par item in .EnumJoinRoot) foreach (Par item in .EnumJoinRoot)
{ {
item.BasePointBase = item.ToLocal(X0Y0_根本.ToGlobal(local)); item.BasePointBase = item.ToLocal(X0Y0_根本.ToGlobal(local));
} }
} }
public override void () public override void ()
{ {
X0Y0_根本CP.Update(); X0Y0_根本CP.Update();
X0Y0_先端CP.Update(); X0Y0_先端CP.Update();
} }
private void ( ) private void ( )
{ {
N0(); N0();
} }
private void N0( ) private void N0( )
{ {
CD = new ColorD(); CD = new ColorD();
CD = new ColorD(); CD = new ColorD();
} }
public void ( ) public void ( )
{ {
CD. = .; CD. = .;
CD. = .; CD. = .;
} }
}
} }

View File

@@ -1,22 +1,23 @@
using System; using System;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class 1D : EleD
{ {
public bool _表示; [Serializable]
public class 1D : EleD
{
public bool _表示;
public bool _表示; public bool _表示;
public 1D() public 1D()
{ {
ThisType = GetType(); ThisType = GetType();
} }
public override Ele GetEle(double DisUnit, Med Med, ) public override Ele GetEle(double DisUnit, Med Med, )
{ {
return new 1(DisUnit, , , Med, this); return new 1(DisUnit, , , Med, this);
} }
}
} }

View File

@@ -1,190 +1,191 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class 2 : Ele
{ {
public Par X0Y0_根本; public class 2 : Ele
{
public Par X0Y0_根本;
public Par X0Y0_先端; public Par X0Y0_先端;
public ColorD CD; public ColorD CD;
public ColorD CD; public ColorD CD;
public ColorP X0Y0_根本CP; public ColorP X0Y0_根本CP;
public ColorP X0Y0_先端CP; public ColorP X0Y0_先端CP;
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _; return _;
} }
set set
{ {
_ = value; _ = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_根本.Dra; return X0Y0_根本.Dra;
} }
set set
{ {
X0Y0_根本.Dra = value; X0Y0_根本.Dra = value;
X0Y0_根本.Hit = value; X0Y0_根本.Hit = value;
} }
} }
public bool _表示 public bool _表示
{ {
get get
{ {
return X0Y0_先端.Dra; return X0Y0_先端.Dra;
} }
set set
{ {
X0Y0_先端.Dra = value; X0Y0_先端.Dra = value;
X0Y0_先端.Hit = value; X0Y0_先端.Hit = value;
} }
} }
public override bool public override bool
{ {
get get
{ {
return _表示; return _表示;
} }
set set
{ {
_表示 = value; _表示 = value;
_表示 = value; _表示 = value;
} }
} }
public override double public override double
{ {
get get
{ {
return CD.; return CD.;
} }
set set
{ {
CD. = value; CD. = value;
CD. = value; CD. = value;
} }
} }
public override double public override double
{ {
set set
{ {
} }
} }
public override double public override double
{ {
set set
{ {
} }
} }
public 2(double DisUnit, , , Med Med, 2D e) public 2(double DisUnit, , , Med Med, 2D e)
{ {
ThisType = GetType(); ThisType = GetType();
= new Difs(Sta.["キャップ左"]); = new Difs(Sta.["キャップ左"]);
Pars pars = [0][0]; Pars pars = [0][0];
X0Y0_根本 = pars["根本"].ToPar(); X0Y0_根本 = pars["根本"].ToPar();
X0Y0_先端 = pars["先端"].ToPar(); X0Y0_先端 = pars["先端"].ToPar();
.SetJoints(); .SetJoints();
= new JointD(); = new JointD();
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
C = e.C; C = e.C;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
B = e.B; B = e.B;
C = e.C; C = e.C;
XB = e.XB; XB = e.XB;
XC = e.XC; XC = e.XC;
YB = e.YB; YB = e.YB;
YC = e.YC; YC = e.YC;
= e.; = e.;
= e.; = e.;
Xv = e.Xv; Xv = e.Xv;
Yv = e.Yv; Yv = e.Yv;
Xi = e.Xi; Xi = e.Xi;
Yi = e.Yi; Yi = e.Yi;
= e.; = e.;
X = e.X; X = e.X;
Y = e.Y; Y = e.Y;
_表示 = e._表示; _表示 = e._表示;
_表示 = e._表示; _表示 = e._表示;
= e.; = e.;
= e.; = e.;
= e.; = e.;
if (!e.) if (!e.)
{ {
= false; = false;
} }
base. = ; base. = ;
(); ();
X0Y0_根本CP = new ColorP(X0Y0_根本, CD, DisUnit, abj: true); X0Y0_根本CP = new ColorP(X0Y0_根本, CD, DisUnit, abj: true);
X0Y0_先端CP = new ColorP(X0Y0_先端, CD, DisUnit, abj: true); X0Y0_先端CP = new ColorP(X0Y0_先端, CD, DisUnit, abj: true);
= e.; = e.;
} }
public override void () public override void ()
{ {
X0Y0_根本CP.Update(); X0Y0_根本CP.Update();
X0Y0_先端CP.Update(); X0Y0_先端CP.Update();
} }
private void ( ) private void ( )
{ {
N0(); N0();
} }
private void N0( ) private void N0( )
{ {
CD = new ColorD(); CD = new ColorD();
CD = new ColorD(); CD = new ColorD();
} }
public void ( ) public void ( )
{ {
CD. = .; CD. = .;
CD. = .; CD. = .;
} }
}
} }

View File

@@ -1,22 +1,23 @@
using System; using System;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class 2D : EleD
{ {
public bool _表示; [Serializable]
public class 2D : EleD
{
public bool _表示;
public bool _表示; public bool _表示;
public 2D() public 2D()
{ {
ThisType = GetType(); ThisType = GetType();
} }
public override Ele GetEle(double DisUnit, Med Med, ) public override Ele GetEle(double DisUnit, Med Med, )
{ {
return new 2(DisUnit, , , Med, this); return new 2(DisUnit, , , Med, this);
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,27 +1,28 @@
using System; using System;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct
{ {
public bool _表示; [Serializable]
public struct
{
public bool _表示;
public bool _表示; public bool _表示;
public ; public ;
public void SetDefault() public void SetDefault()
{ {
_表示 = true; _表示 = true;
_表示 = true; _表示 = true;
.SetDefault(); .SetDefault();
} }
public static GetDefault() public static GetDefault()
{ {
result = default(); result = default();
result.SetDefault(); result.SetDefault();
return result; return result;
} }
}
} }

View File

@@ -1,36 +1,37 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct
{ {
public Color ; [Serializable]
public struct
{
public Color ;
public Color ; public Color ;
public Color2 ; public Color2 ;
public Color2 ; public Color2 ;
public void SetDefault() public void SetDefault()
{ {
= Color.HotPink; = Color.HotPink;
= Color.HotPink; = Color.HotPink;
SetColor2(); SetColor2();
} }
public void SetRandom() public void SetRandom()
{ {
Col.GetRandomClothesColor(out ); Col.GetRandomClothesColor(out );
= ; = ;
SetColor2(); SetColor2();
} }
public void SetColor2() public void SetColor2()
{ {
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
} }
}
} }

View File

@@ -1,29 +1,30 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class
{ {
private Med Med; public class
{
private Med Med;
private hd; private hd;
public (Med Med, hd) public (Med Med, hd)
{ {
this.Med = Med; this.Med = Med;
this.hd = hd; this.hd = hd;
} }
public void Set() public void Set()
{ {
string text = ""; string text = "";
text = hd.Text; text = hd.Text;
hd.Text = text; hd.Text = text;
} }
public void Set状態() public void Set状態()
{ {
string 6 = GameText.6; string 6 = GameText.6;
hd.Text = 6; hd.Text = 6;
} }
}
} }

View File

@@ -1,36 +1,37 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct B色
{ {
public Color 1; [Serializable]
public struct B色
{
public Color 1;
public Color 2; public Color 2;
public Color2 1; public Color2 1;
public Color2 2; public Color2 2;
public void SetDefault() public void SetDefault()
{ {
1 = Color.OldLace; 1 = Color.OldLace;
2 = Color.OldLace; 2 = Color.OldLace;
SetColor2(); SetColor2();
} }
public void SetRandom() public void SetRandom()
{ {
Col.GetRandomClothesColor(out 1); Col.GetRandomClothesColor(out 1);
2 = 1; 2 = 1;
SetColor2(); SetColor2();
} }
public void SetColor2() public void SetColor2()
{ {
Col.GetGrad(ref 1, out 1); Col.GetGrad(ref 1, out 1);
Col.GetGrad(ref 2, out 2); Col.GetGrad(ref 2, out 2);
} }
}
} }

View File

@@ -1,36 +1,37 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct T色
{ {
public Color ; [Serializable]
public struct T色
{
public Color ;
public Color ; public Color ;
public Color2 ; public Color2 ;
public Color2 ; public Color2 ;
public void SetDefault() public void SetDefault()
{ {
= Color.OldLace; = Color.OldLace;
= Color.OldLace; = Color.OldLace;
SetColor2(); SetColor2();
} }
public void SetRandom() public void SetRandom()
{ {
Col.GetRandomClothesColor(out ); Col.GetRandomClothesColor(out );
= ; = ;
SetColor2(); SetColor2();
} }
public void SetColor2() public void SetColor2()
{ {
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
} }
}
} }

View File

@@ -1,5 +1,6 @@
namespace SlaveMatrix; namespace SlaveMatrix
public class : 1
{ {
public class : 1
{
}
} }

View File

@@ -1,8 +1,9 @@
using System; using System;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public class D : 1D
{ {
[Serializable]
public class D : 1D
{
}
} }

View File

@@ -3,96 +3,97 @@ using System.Drawing;
using System.Linq; using System.Linq;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class B : Stamp
{ {
private Mot ; public class B : Stamp
{
private Mot ;
public override void Draw(Are Are) public override void Draw(Are Are)
{ {
try try
{ {
if (sta.Count <= 0) if (sta.Count <= 0)
{ {
return; return;
} }
foreach (sep stum in sta) foreach (sep stum in sta)
{ {
if (stum.Sta.) if (stum.Sta.)
{ {
p = stum.Ele..Current.GetPar(stum.Path); p = stum.Ele..Current.GetPar(stum.Path);
stum.Sta.B = p.ToGlobal(stum.Pos); stum.Sta.B = p.ToGlobal(stum.Pos);
stum.Sta.(); stum.Sta.();
stum.Sta..Draw(Are); stum.Sta..Draw(Are);
} }
} }
} }
catch catch
{ {
} }
} }
public void Add(Vector2D cp, Color hc, Dictionary<Ele, List<Ele>> ) public void Add(Vector2D cp, Color hc, Dictionary<Ele, List<Ele>> )
{ {
he = Bod.GetHitEle(hc); he = Bod.GetHitEle(hc);
if (2(he)) if (2(he))
{ {
if (sta.Count >= 33) if (sta.Count >= 33)
{ {
sep = sta[0]; sep = sta[0];
sta.RemoveAt(0); sta.RemoveAt(0);
sep.Sta.Dispose(); sep.Sta.Dispose();
} }
sep = default(sep); sep = default(sep);
sep.Sta = EleD.GetEle(Are.DisUnit, Med, Sta.GameData.); sep.Sta = EleD.GetEle(Are.DisUnit, Med, Sta.GameData.);
sep.Sta.SetHitFalse(); sep.Sta.SetHitFalse();
sep.Sta.Xv = RNG.XS.NextDouble(); sep.Sta.Xv = RNG.XS.NextDouble();
sep.Sta. = RNG.XS.NextBool(); sep.Sta. = RNG.XS.NextBool();
sep.Ele = he; sep.Ele = he;
sep.Par = he..GetHitPar_(hc); sep.Par = he..GetHitPar_(hc);
sep.Path = sep.Par.GetPath(); sep.Path = sep.Par.GetPath();
sep.Pos = sep.Par.ToLocal(cp); sep.Pos = sep.Par.ToLocal(cp);
if (.ContainsKey(he)) if (.ContainsKey(he))
{ {
[he].Add(sep.Sta); [he].Add(sep.Sta);
} }
else else
{ {
[he] = new List<Ele> { sep.Sta }; [he] = new List<Ele> { sep.Sta };
} }
sta.Add(sep); sta.Add(sep);
.Start(); .Start();
} }
} }
public B(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD, Mots Mots) public B(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD, Mots Mots)
: base(Med, Are, Cha, Bod, EleD) : base(Med, Are, Cha, Bod, EleD)
{ {
Ele e = null; Ele e = null;
= new Mot(0.0, 1.0) = new Mot(0.0, 1.0)
{ {
BaseSpeed = 1.0, BaseSpeed = 1.0,
Staing = delegate(Mot m) Staing = delegate(Mot m)
{ {
e = sta.Last().Sta; e = sta.Last().Sta;
m.Max = RNG.XS.NextDouble(); m.Max = RNG.XS.NextDouble();
}, },
Runing = delegate(Mot m) Runing = delegate(Mot m)
{ {
e.Yv = m.Value; e.Yv = m.Value;
}, },
Reaing = delegate(Mot m) Reaing = delegate(Mot m)
{ {
m.End(); m.End();
}, },
Rouing = delegate Rouing = delegate
{ {
}, },
Ending = delegate Ending = delegate
{ {
} }
}; };
Mots.Add(EleD.GetHashCode().ToString(), ); Mots.Add(EleD.GetHashCode().ToString(), );
} }
}
} }

View File

@@ -1,65 +1,66 @@
using System.Drawing; using System.Drawing;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class K : Stamp
{ {
private Ele Par; public class K : Stamp
{
private Ele Par;
public override void Draw(Are Are) public override void Draw(Are Are)
{ {
try try
{ {
if (sta.Count <= 0) if (sta.Count <= 0)
{ {
return; return;
} }
foreach (sep stum in sta) foreach (sep stum in sta)
{ {
p = stum.Ele..Current.GetPar(stum.Path); p = stum.Ele..Current.GetPar(stum.Path);
stum.Sta.B = p.AngleBase - stum.Par.AngleBase; stum.Sta.B = p.AngleBase - stum.Par.AngleBase;
stum.Sta.B = p.ToGlobal(stum.Pos); stum.Sta.B = p.ToGlobal(stum.Pos);
stum.Sta.(); stum.Sta.();
stum.Sta..Draw(Are); stum.Sta..Draw(Are);
} }
} }
catch catch
{ {
} }
} }
public Add(Vector2D cp, Color hc, Ele he) public Add(Vector2D cp, Color hc, Ele he)
{ {
if (1(he) && he == Par) if (1(he) && he == Par)
{ {
p = he..GetHitPar_(hc); p = he..GetHitPar_(hc);
c2 = he.GetParOfColorP(p).ColorD.; c2 = he.GetParOfColorP(p).ColorD.;
if (c2.Col1 == Cha..O.Col1 || c2.Col2 == Cha..O.Col1) if (c2.Col1 == Cha..O.Col1 || c2.Col2 == Cha..O.Col1)
{ {
if (sta.Count >= 33) if (sta.Count >= 33)
{ {
sep = sta[0]; sep = sta[0];
sta.RemoveAt(0); sta.RemoveAt(0);
sep.Sta.Dispose(); sep.Sta.Dispose();
} }
sep = default(sep); sep = default(sep);
sep.Sta = EleD.GetEle(Are.DisUnit, Med, Cha.); sep.Sta = EleD.GetEle(Are.DisUnit, Med, Cha.);
sep.Sta.SetHitFalse(); sep.Sta.SetHitFalse();
sep.Ele = he; sep.Ele = he;
sep.Par = p; sep.Par = p;
sep.Path = sep.Par.GetPath(); sep.Path = sep.Par.GetPath();
sep.Pos = sep.Par.ToLocal(cp); sep.Pos = sep.Par.ToLocal(cp);
sta.Add(sep); sta.Add(sep);
} }
return ()sep.Sta; return ()sep.Sta;
} }
return null; return null;
} }
public K(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD, Ele Par) public K(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD, Ele Par)
: base(Med, Are, Cha, Bod, EleD) : base(Med, Are, Cha, Bod, EleD)
{ {
this.Par = Par; this.Par = Par;
} }
}
} }

View File

@@ -1,67 +1,68 @@
using System.Drawing; using System.Drawing;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class W : Stamp
{ {
private Ele Par; public class W : Stamp
{
private Ele Par;
public override void Draw(Are Are) public override void Draw(Are Are)
{ {
try try
{ {
if (sta.Count <= 0) if (sta.Count <= 0)
{ {
return; return;
} }
foreach (sep stum in sta) foreach (sep stum in sta)
{ {
p = stum.Ele..Current.GetPar(stum.Path); p = stum.Ele..Current.GetPar(stum.Path);
stum.Sta.B = p.AngleBase - stum.Par.AngleBase; stum.Sta.B = p.AngleBase - stum.Par.AngleBase;
stum.Sta.B = p.ToGlobal(stum.Pos); stum.Sta.B = p.ToGlobal(stum.Pos);
stum.Sta.(); stum.Sta.();
stum.Sta..Draw(Are); stum.Sta..Draw(Are);
} }
} }
catch catch
{ {
} }
} }
public bool Add(Vector2D cp, Color hc, Ele he) public bool Add(Vector2D cp, Color hc, Ele he)
{ {
if (2(he) && he == Par) if (2(he) && he == Par)
{ {
p = he..GetHitPar_(hc); p = he..GetHitPar_(hc);
c2 = he.GetParOfColorP(p).ColorD.; c2 = he.GetParOfColorP(p).ColorD.;
if (c2.Col1 == Cha..O.Col1 || c2.Col2 == Cha..O.Col1) if (c2.Col1 == Cha..O.Col1 || c2.Col2 == Cha..O.Col1)
{ {
if (sta.Count >= 33) if (sta.Count >= 33)
{ {
sep = sta[0]; sep = sta[0];
sta.RemoveAt(0); sta.RemoveAt(0);
sep.Sta.Dispose(); sep.Sta.Dispose();
} }
sep = default(sep); sep = default(sep);
sep.Sta = EleD.GetEle(Are.DisUnit, Med, Cha.); sep.Sta = EleD.GetEle(Are.DisUnit, Med, Cha.);
sep.Sta.SetHitFalse(); sep.Sta.SetHitFalse();
sep.Sta.C = 45.0 * (double)(RNG.XS.NextBool() ? 1 : (-1)) * RNG.XS.NextDouble(); sep.Sta.C = 45.0 * (double)(RNG.XS.NextBool() ? 1 : (-1)) * RNG.XS.NextDouble();
sep.Ele = he; sep.Ele = he;
sep.Par = p; sep.Par = p;
sep.Path = sep.Par.GetPath(); sep.Path = sep.Par.GetPath();
sep.Pos = sep.Par.ToLocal(cp + (he. - cp).newNormalize() * 0.01); sep.Pos = sep.Par.ToLocal(cp + (he. - cp).newNormalize() * 0.01);
sta.Add(sep); sta.Add(sep);
} }
return true; return true;
} }
return false; return false;
} }
public W(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD, Ele Par) public W(Med Med, Are Are, Cha Cha, Bod Bod, EleD EleD, Ele Par)
: base(Med, Are, Cha, Bod, EleD) : base(Med, Are, Cha, Bod, EleD)
{ {
this.Par = Par; this.Par = Par;
EleD.B = 0.9; EleD.B = 0.9;
} }
}
} }

View File

@@ -1,36 +1,37 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct T色
{ {
public Color ; [Serializable]
public struct T色
{
public Color ;
public Color ; public Color ;
public Color2 ; public Color2 ;
public Color2 ; public Color2 ;
public void SetDefault() public void SetDefault()
{ {
= Color.OldLace; = Color.OldLace;
= Color.OldLace; = Color.OldLace;
SetColor2(); SetColor2();
} }
public void SetRandom() public void SetRandom()
{ {
Col.GetRandomClothesColor(out ); Col.GetRandomClothesColor(out );
= ; = ;
SetColor2(); SetColor2();
} }
public void SetColor2() public void SetColor2()
{ {
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
} }
}
} }

View File

@@ -1,39 +1,40 @@
using System; using System;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct
{ {
public T_ドレス情報 T; [Serializable]
public struct
{
public T_ドレス情報 T;
public M_ドレス情報 M; public M_ドレス情報 M;
public ; public ;
public bool IsShow public bool IsShow
{ {
get get
{ {
if (!T.IsShow) if (!T.IsShow)
{ {
return M.IsShow; return M.IsShow;
} }
return true; return true;
} }
} }
public void SetDefault() public void SetDefault()
{ {
T.SetDefault(); T.SetDefault();
M.SetDefault(); M.SetDefault();
.SetDefault(); .SetDefault();
} }
public static GetDefault() public static GetDefault()
{ {
result = default(); result = default();
result.SetDefault(); result.SetDefault();
return result; return result;
} }
}
} }

View File

@@ -1,50 +1,51 @@
using System; using System;
using System.Drawing; using System.Drawing;
namespace SlaveMatrix; namespace SlaveMatrix
[Serializable]
public struct
{ {
public Color ; [Serializable]
public struct
{
public Color ;
public Color ; public Color ;
public Color ; public Color ;
public Color ; public Color ;
public Color2 ; public Color2 ;
public Color2 ; public Color2 ;
public Color2 ; public Color2 ;
public Color2 ; public Color2 ;
public void SetDefault() public void SetDefault()
{ {
Col.Add(ref Col.DarkGreen, 0, 0, -50, out ); Col.Add(ref Col.DarkGreen, 0, 0, -50, out );
= Color.Gold; = Color.Gold;
= Color.Gold; = Color.Gold;
= Col.Black; = Col.Black;
SetColor2(); SetColor2();
} }
public void SetRandom() public void SetRandom()
{ {
Col.GetRandomClothesColor(out ); Col.GetRandomClothesColor(out );
Col.GetRandomClothesColor(out ); Col.GetRandomClothesColor(out );
= ; = ;
Col.GetRandomClothesColor(out ); Col.GetRandomClothesColor(out );
SetColor2(); SetColor2();
} }
public void SetColor2() public void SetColor2()
{ {
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
Col.GetGrad(ref , out ); Col.GetGrad(ref , out );
} }
}
} }

View File

@@ -1,49 +1,50 @@
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix; namespace SlaveMatrix
public class
{ {
public _ドレス ; public class
{
public _ドレス ;
public _ドレス ; public _ドレス ;
private Par[] ; private Par[] ;
private Par[] ; private Par[] ;
private Par[] ; private Par[] ;
private Vector2D[] m; private Vector2D[] m;
private Vector2D[] m; private Vector2D[] m;
private Vector2D[] m; private Vector2D[] m;
public (_ドレス , _ドレス ) public (_ドレス , _ドレス )
{ {
this. = ; this. = ;
this. = ; this. = ;
= new Par[5] { .X0Y0_左_服, .X0Y0_左_バスト, .X0Y0_右_服, .X0Y0_右_バスト, .X0Y0_服 }; = new Par[5] { .X0Y0_左_服, .X0Y0_左_バスト, .X0Y0_右_服, .X0Y0_右_バスト, .X0Y0_服 };
= new Par[2] { .X0Y0_左_縁, .X0Y0_縁_縁左 }; = new Par[2] { .X0Y0_左_縁, .X0Y0_縁_縁左 };
= new Par[2] { .X0Y0_右_縁, .X0Y0_縁_縁右 }; = new Par[2] { .X0Y0_右_縁, .X0Y0_縁_縁右 };
} }
public void () public void ()
{ {
.GetMiY_MaY(out m); .GetMiY_MaY(out m);
.GetMiY_MaY(out m); .GetMiY_MaY(out m);
.GetMiY_MaY(out m); .GetMiY_MaY(out m);
.(m, m, m); .(m, m, m);
.(m, m, m); .(m, m, m);
} }
public bool Contains(Ele e) public bool Contains(Ele e)
{ {
if ( != e) if ( != e)
{ {
return == e; return == e;
} }
return true; return true;
} }
}
} }

Some files were not shown because too many files have changed in this diff Show More