removed some dead code and fixed a few bugs i introduced
This commit is contained in:
lewd-alt
2025-08-03 13:09:54 -07:00
parent 300f10dbd7
commit 8fb31d38bb
46 changed files with 160 additions and 73842 deletions

View File

@@ -101,7 +101,7 @@ namespace _2DGAMELIB
gh.SmoothingMode = SmoothingMode.None; gh.SmoothingMode = SmoothingMode.None;
gh.PixelOffsetMode = PixelOffsetMode.HighSpeed; gh.PixelOffsetMode = PixelOffsetMode.HighSpeed;
gh.InterpolationMode = InterpolationMode.NearestNeighbor; gh.InterpolationMode = InterpolationMode.NearestNeighbor;
gh.CompositingMode = CompositingMode.SourceCopy; gh.CompositingMode = CompositingMode.SourceOver;
} }
public Vector2D GetPosition() public Vector2D GetPosition()

View File

@@ -57,29 +57,6 @@ namespace _2DGAMELIB
Pars.DrawH(hitUnit, gh); Pars.DrawH(hitUnit, gh);
} }
} }
public new void Draw(Graphics GD)
{
im = GD.InterpolationMode;
GD.InterpolationMode = InterpolationMode.NearestNeighbor;
p = GetPosition();
GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
GD.InterpolationMode = im;
}
public new void Draw(Graphics GD, double Opacity)
{
im = GD.InterpolationMode;
GD.InterpolationMode = InterpolationMode.NearestNeighbor;
cm.Matrix33 = (float)Opacity;
ia.SetColorMatrix(cm);
p = GetPosition();
r.X = (int)(p.X * unit);
r.Y = (int)(p.Y * unit);
r.Width = WH.Width;
r.Height = WH.Height;
GD.DrawImage(Dis, r, 0, 0, Dis.Width, Dis.Height, GraphicsUnit.Pixel, ia);
GD.InterpolationMode = im;
}
} }
} }

View File

@@ -153,15 +153,5 @@ namespace _2DGAMELIB
{ {
pars.Dispose(); pars.Dispose();
} }
public bool IsBut1()
{
return this is But1;
}
public But1 ToBut1()
{
return (But1)this;
}
} }
} }

View File

@@ -15,24 +15,12 @@ namespace _2DGAMELIB
public List<Color> TextColors = new List<Color>(); public List<Color> TextColors = new List<Color>();
public But1(Par Par, Action<But> Action)
: base(Par, Action)
{
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)
: base(Pars, Action)
{
Setting();
}
private void Setting() private void Setting()
{ {
foreach (Par item in pars.EnumAllPar()) foreach (Par item in pars.EnumAllPar())

View File

@@ -65,14 +65,6 @@ namespace _2DGAMELIB
} }
} }
public void Draw(AreM AreM)
{
foreach (But value in buts.Values)
{
value.Draw(AreM);
}
}
public void Dispose() public void Dispose()
{ {
foreach (But value in buts.Values) foreach (But value in buts.Values)
@@ -80,10 +72,5 @@ namespace _2DGAMELIB
value.Dispose(); value.Dispose();
} }
} }
public bool IsHit(Color hc)
{
return EnumBut.Any((But e) => e.Pars.Values.First().ToPar().HitColor == hc);
}
} }
} }

View File

@@ -201,21 +201,6 @@ namespace _2DGAMELIB
parss.Add(Pars); parss.Add(Pars);
} }
public void Insert(int Index, Pars Pars)
{
parss.Insert(Index, Pars);
}
public void Remove(Pars Pars)
{
parss.Remove(Pars);
}
public void RemoveAt(int Index)
{
parss.RemoveAt(Index);
}
public void Draws(Are Are) public void Draws(Are Are)
{ {
foreach (Pars item in parss) foreach (Pars item in parss)

View File

@@ -286,46 +286,16 @@ namespace _2DGAMELIB
difs.Add(Dif); difs.Add(Dif);
} }
public void Insert(int Index, Dif Dif)
{
difs.Insert(Index, Dif);
}
public void Remove(Dif Dif)
{
difs.Remove(Dif);
}
public void RemoveAt(int 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)
{
foreach (Dif dif in difs)
{
dif.Draws(Are);
}
}
public void Draw(AreM AreM) public void Draw(AreM AreM)
{ {
AreM.Draw(Current); AreM.Draw(Current);
} }
public void Draws(AreM AreM)
{
foreach (Dif dif in difs)
{
dif.Draws(AreM);
}
}
private Par GetJoinRoot(Pars ps) private Par GetJoinRoot(Pars ps)
{ {
Par[] array = ps.EnumAllPar().ToArray(); Par[] array = ps.EnumAllPar().ToArray();
@@ -375,14 +345,6 @@ namespace _2DGAMELIB
pj[Current].JoinPA(); pj[Current].JoinPA();
} }
public void JoinPall()
{
foreach (Joints value in pj.Values)
{
value.JoinP();
}
}
public void JoinPAall() public void JoinPAall()
{ {
foreach (Joints value in pj.Values) foreach (Joints value in pj.Values)
@@ -391,14 +353,6 @@ namespace _2DGAMELIB
} }
} }
public void JoinP(Pars ps)
{
if (pj.ContainsKey(ps))
{
pj[ps].JoinP();
}
}
public void JoinPA(Pars ps) public void JoinPA(Pars ps)
{ {
if (pj.ContainsKey(ps)) if (pj.ContainsKey(ps))

View File

@@ -10,8 +10,6 @@ namespace _2DGAMELIB
private long last_frame; private long last_frame;
public double Value; public double Value;
private int count;
private double ticks_per_frame; private double ticks_per_frame;
public FPS(double FPS) public FPS(double FPS)
{ {

View File

@@ -357,41 +357,6 @@ namespace _2DGAMELIB
} }
} }
public void SetHitColor(Med Med)
{
if (base_.HitColor != Color.Transparent)
{
Med.RemUniqueColor(base_.HitColor);
}
base_.HitColor = Med.GetUniqueColor();
if (frame1.HitColor != Color.Transparent)
{
Med.RemUniqueColor(frame1.HitColor);
}
frame1.HitColor = Med.GetUniqueColor();
if (Range == Range.MinusPlus)
{
if (frame2.HitColor != Color.Transparent)
{
Med.RemUniqueColor(frame2.HitColor);
}
frame2.HitColor = Med.GetUniqueColor();
}
if (gauge.HitColor != Color.Transparent)
{
Med.RemUniqueColor(gauge.HitColor);
}
gauge.HitColor = Med.GetUniqueColor();
if (knob != null)
{
if (knob.HitColor != Color.Transparent)
{
Med.RemUniqueColor(knob.HitColor);
}
knob.HitColor = Med.GetUniqueColor();
}
}
private void SetBrush(double Unit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2) private void SetBrush(double Unit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2)
{ {
this.Unit = Unit; this.Unit = Unit;
@@ -532,38 +497,6 @@ namespace _2DGAMELIB
return 0.0; return 0.0;
} }
public Gau(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, ref Color PlusColor, ref Color MinusColor, ref Color BackColor, bool Knob)
{
this.Open = Open;
this.Range = Range;
PlusBrush = new SolidBrush(PlusColor);
MinusBrush = new SolidBrush(MinusColor);
ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
Max = GetMax();
Value = 0.0;
}
public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, Color PlusColor, Color MinusColor, Color BackColor, bool Knob)
{
this.Open = Open;
this.Range = Range;
PlusBrush = new SolidBrush(PlusColor);
MinusBrush = new SolidBrush(MinusColor);
ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
Max = GetMax();
Value = 0.0;
}
public Gau(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2, ref Color BackColor, bool Knob)
{
this.Open = Open;
this.Range = Range;
ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
SetBrush(DisUnit, ref PlusColor1, ref PlusColor2, ref MinusColor1, ref MinusColor2);
Max = GetMax();
Value = 0.0;
}
public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, Color PlusColor1, Color PlusColor2, Color MinusColor1, Color MinusColor2, Color BackColor, bool Knob) public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, Color PlusColor1, Color PlusColor2, Color MinusColor1, Color MinusColor2, Color BackColor, bool Knob)
{ {
this.Open = Open; this.Open = Open;

View File

@@ -83,16 +83,6 @@ namespace _2DGAMELIB
} }
} }
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);
}
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);
}
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);
@@ -105,30 +95,6 @@ namespace _2DGAMELIB
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)
{
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)
{
ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
}
public static Hsv ToHSV(int r, int g, int b)
{
Hsv result = default(Hsv);
ToHSV(r, g, b, out result.H, out result.S, out result.V);
return result;
}
public static Hsv ToHSV(this Color col)
{
Hsv result = default(Hsv);
ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
return result;
}
public static Hsv ToHSV(ref Color col) public static Hsv ToHSV(ref Color col)
{ {
Hsv result = default(Hsv); Hsv result = default(Hsv);
@@ -136,18 +102,6 @@ namespace _2DGAMELIB
return result; return result;
} }
public static Color ToRGB(this Hsv hsv)
{
ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
return Color.FromArgb(r, g, b);
}
public static Color ToRGB(ref Hsv hsv)
{
ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var 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)
@@ -229,23 +183,11 @@ namespace _2DGAMELIB
} }
} }
public Hsv(Color Color)
{
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)
{
H = Hue;
S = Sat;
V = Val;
}
private void HueLimit() private void HueLimit()
{ {
H %= 360; H %= 360;

View File

@@ -10,10 +10,6 @@ namespace _2DGAMELIB
{ {
public Vector2D Joint = Dat.Vec2DZero; public Vector2D Joint = Dat.Vec2DZero;
public Joi()
{
}
public Joi(Joi Joi) public Joi(Joi Joi)
{ {
Joint = Joi.Joint; Joint = Joi.Joint;
@@ -24,9 +20,5 @@ namespace _2DGAMELIB
this.Joint = Joint; this.Joint = Joint;
} }
public Joi(ref Vector2D Joint)
{
this.Joint = Joint;
}
} }
} }

View File

@@ -33,10 +33,6 @@ namespace _2DGAMELIB
public int Index; public int Index;
public JointS()
{
}
public JointS(Difs Difs, Par Par, int Index) public JointS(Difs Difs, Par Par, int Index)
{ {
this.Difs = Difs; this.Difs = Difs;

View File

@@ -8,14 +8,6 @@ namespace _2DGAMELIB
{ {
public List<JointD> Joins = new List<JointD>(); public List<JointD> Joins = new List<JointD>();
public void JoinP()
{
foreach (JointD join in Joins)
{
join.JoinP();
}
}
public void JoinPA() public void JoinPA()
{ {
foreach (JointD join in Joins) foreach (JointD join in Joins)
@@ -24,20 +16,5 @@ namespace _2DGAMELIB
} }
} }
public void JoinPall()
{
foreach (JointD join in Joins)
{
join.JoinPall();
}
}
public void JoinPAall()
{
foreach (JointD join in Joins)
{
join.JoinPAall();
}
}
} }
} }

View File

@@ -88,13 +88,6 @@ namespace _2DGAMELIB
SetText(Text); SetText(Text);
} }
private void Lab_Resize(object sender, EventArgs e)
{
//TODO fix?
//Med.BaseControl.Controls.Remove(tb);
//SetText(tb.Text);
}
public void SetHitColor(Med Med) public void SetHitColor(Med Med)
{ {
if (parT.HitColor != Color.Transparent) if (parT.HitColor != Color.Transparent)
@@ -124,24 +117,6 @@ namespace _2DGAMELIB
parT.OP[0].ps[3] = new Vector2D(0.0, 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) public bool Double(ref Color HitColor)
{ {
//TODO fix? //TODO fix?

View File

@@ -24,35 +24,6 @@ namespace _2DGAMELIB
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)
{
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)
{
using IEnumerator<Lab> enumerator = labs.Values.GetEnumerator();
while (enumerator.MoveNext() && !enumerator.Current.Double(ref HitColor))
{
}
}
public void Click(ref Color HitColor)
{
foreach (Lab value in labs.Values)
{
value.Click(ref HitColor);
}
}
public void SetHitColor(Med Med)
{
foreach (Lab value in labs.Values)
{
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)
@@ -61,14 +32,6 @@ namespace _2DGAMELIB
} }
} }
public void Draw(AreM AreM)
{
foreach (Lab value in labs.Values)
{
AreM.Draw(value.ParT);
}
}
public void Dispose() public void Dispose()
{ {
foreach (Lab value in labs.Values) foreach (Lab value in labs.Values)

View File

@@ -26,45 +26,6 @@ namespace _2DGAMELIB
return result; return result;
} }
public static void RotationZ(this double angle, out MatrixD result)
{
result.M11 = System.Math.Cos(angle);
result.M12 = System.Math.Sin(angle);
result.M13 = 0.0;
result.M14 = 0.0;
result.M21 = 0.0 - result.M12;
result.M22 = result.M11;
result.M23 = 0.0;
result.M24 = 0.0;
result.M31 = 0.0;
result.M32 = 0.0;
result.M33 = 1.0;
result.M34 = 0.0;
result.M41 = 0.0;
result.M42 = 0.0;
result.M43 = 0.0;
result.M44 = 1.0;
}
public static Vector2D TransformCoordinate(this Vector2D coord, MatrixD transform)
{
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);
}
public static Vector2D TransformCoordinate(ref Vector2D coord, ref MatrixD transform)
{
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);
}
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);
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;
}
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);
@@ -72,56 +33,6 @@ namespace _2DGAMELIB
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)
{
int num = coords.Length;
Vector2D[] array = new Vector2D[num];
for (int i = 0; i < num; i++)
{
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].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
}
return array;
}
public static Vector2D[] TransformCoordinate(this Vector2D[] coords, ref MatrixD transform)
{
int num = coords.Length;
Vector2D[] array = new Vector2D[num];
for (int i = 0; i < num; i++)
{
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].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
}
return array;
}
public static void TransformCoordinate(this Vector2D[] coords, MatrixD transform, out Vector2D[] results)
{
int num = coords.Length;
results = new Vector2D[num];
for (int i = 0; i < num; i++)
{
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].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)
{
int num = coords.Length;
results = new Vector2D[num];
for (int i = 0; i < num; i++)
{
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].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);
@@ -137,19 +48,5 @@ namespace _2DGAMELIB
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)
{
Vec.Subtract(ref coord, ref BasePoint, out coord);
TransformCoordinate(ref coord, ref transform, 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)
{
Vec.Subtract(ref coord, ref BasePoint, out var r);
TransformCoordinate(ref r, ref transform, out result);
Vec.Add(ref result, ref BasePoint, out result);
}
} }
} }

View File

@@ -200,35 +200,6 @@ namespace _2DGAMELIB
} }
} }
public static MatrixD Identity
{
get
{
MatrixD result = default(MatrixD);
result.M11 = 1.0;
result.M22 = 1.0;
result.M33 = 1.0;
result.M44 = 1.0;
return result;
}
}
public bool IsIdentity
{
get
{
if (M11 != 1.0 || M22 != 1.0 || M33 != 1.0 || M44 != 1.0)
{
return false;
}
if (M12 != 0.0 || M13 != 0.0 || M14 != 0.0 || M21 != 0.0 || M23 != 0.0 || M24 != 0.0 || M31 != 0.0 || M32 != 0.0 || M34 != 0.0 || M41 != 0.0 || M42 != 0.0 || M43 != 0.0)
{
return false;
}
return true;
}
}
public MatrixD(double M11, double M12, double M13, double M14, double M21, double M22, double M23, double M24, double M31, double M32, double M33, double M34, double M41, double M42, double M43, double M44) public MatrixD(double M11, double M12, double M13, double M14, double M21, double M22, double M23, double M24, double M31, double M32, double M33, double M34, double M41, double M42, double M43, double M44)
{ {
this.M11 = M11; this.M11 = M11;
@@ -260,329 +231,5 @@ namespace _2DGAMELIB
throw new ArgumentOutOfRangeException("col", "Rows and columns for matrices run from 0 to 3, inclusive."); throw new ArgumentOutOfRangeException("col", "Rows and columns for matrices run from 0 to 3, inclusive.");
} }
} }
public Vector4D GetRow(int row)
{
return new Vector4D(this[row, 0], this[row, 1], this[row, 2], this[row, 3]);
}
public void SetRow(int row, Vector4D value)
{
this[row, 0] = value.X;
this[row, 1] = value.Y;
this[row, 2] = value.Z;
this[row, 3] = value.W;
}
public void SetRow(int row, ref Vector4D value)
{
this[row, 0] = value.X;
this[row, 1] = value.Y;
this[row, 2] = value.Z;
this[row, 3] = value.W;
}
public Vector4D GetCol(int column)
{
return new Vector4D(this[0, column], this[1, column], this[2, column], this[3, column]);
}
public void SetCol(int column, Vector4D value)
{
this[0, column] = value.X;
this[1, column] = value.Y;
this[2, column] = value.Z;
this[3, column] = value.W;
}
public void SetCol(int column, ref Vector4D value)
{
this[0, column] = value.X;
this[1, column] = value.Y;
this[2, column] = value.Z;
this[3, column] = value.W;
}
public double[] ToArray()
{
return new double[16]
{
M11, M12, M13, M14, M21, M22, M23, M24, M31, M32,
M33, M34, M41, M42, M43, M44
};
}
public void Invert()
{
MatrixD matDIdentity = Dat.MatDIdentity;
for (int i = 0; i < 4; i++)
{
double num = 1.0 / this[i, i];
for (int j = 0; j < 4; j++)
{
this[i, j] *= num;
matDIdentity[i, j] *= num;
}
for (int j = 0; j < 4; j++)
{
if (i != j)
{
num = this[j, i];
for (int k = 0; k < 4; k++)
{
this[j, k] -= this[i, k] * num;
matDIdentity[j, k] -= matDIdentity[i, k] * num;
}
}
}
}
this = matDIdentity;
}
public double Determinant()
{
double num = M33 * M44 - M34 * M43;
double num2 = M32 * M44 - M34 * M42;
double num3 = M32 * M43 - M33 * M42;
double num4 = M31 * M44 - M34 * M41;
double num5 = M31 * M43 - M33 * M41;
double num6 = M31 * M42 - M32 * M41;
return M11 * (M22 * num - M23 * num2 + M24 * num3) - M12 * (M21 * num - M23 * num4 + M24 * num5) + M13 * (M21 * num2 - M22 * num4 + M24 * num6) - M14 * (M21 * num3 - M22 * num5 + M23 * num6);
}
public static MatrixD operator +(MatrixD left, MatrixD right)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 + right.M11;
result.M12 = left.M12 + right.M12;
result.M13 = left.M13 + right.M13;
result.M14 = left.M14 + right.M14;
result.M21 = left.M21 + right.M21;
result.M22 = left.M22 + right.M22;
result.M23 = left.M23 + right.M23;
result.M24 = left.M24 + right.M24;
result.M31 = left.M31 + right.M31;
result.M32 = left.M32 + right.M32;
result.M33 = left.M33 + right.M33;
result.M34 = left.M34 + right.M34;
result.M41 = left.M41 + right.M41;
result.M42 = left.M42 + right.M42;
result.M43 = left.M43 + right.M43;
result.M44 = left.M44 + right.M44;
return result;
}
public static MatrixD operator -(MatrixD left, MatrixD right)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 - right.M11;
result.M12 = left.M12 - right.M12;
result.M13 = left.M13 - right.M13;
result.M14 = left.M14 - right.M14;
result.M21 = left.M21 - right.M21;
result.M22 = left.M22 - right.M22;
result.M23 = left.M23 - right.M23;
result.M24 = left.M24 - right.M24;
result.M31 = left.M31 - right.M31;
result.M32 = left.M32 - right.M32;
result.M33 = left.M33 - right.M33;
result.M34 = left.M34 - right.M34;
result.M41 = left.M41 - right.M41;
result.M42 = left.M42 - right.M42;
result.M43 = left.M43 - right.M43;
result.M44 = left.M44 - right.M44;
return result;
}
public static MatrixD operator -(MatrixD matrix)
{
MatrixD result = default(MatrixD);
result.M11 = 0.0 - matrix.M11;
result.M12 = 0.0 - matrix.M12;
result.M13 = 0.0 - matrix.M13;
result.M14 = 0.0 - matrix.M14;
result.M21 = 0.0 - matrix.M21;
result.M22 = 0.0 - matrix.M22;
result.M23 = 0.0 - matrix.M23;
result.M24 = 0.0 - matrix.M24;
result.M31 = 0.0 - matrix.M31;
result.M32 = 0.0 - matrix.M32;
result.M33 = 0.0 - matrix.M33;
result.M34 = 0.0 - matrix.M34;
result.M41 = 0.0 - matrix.M41;
result.M42 = 0.0 - matrix.M42;
result.M43 = 0.0 - matrix.M43;
result.M44 = 0.0 - matrix.M44;
return result;
}
public static MatrixD operator *(MatrixD left, MatrixD right)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 * right.M11 + left.M12 * right.M21 + left.M13 * right.M31 + left.M14 * right.M41;
result.M12 = left.M11 * right.M12 + left.M12 * right.M22 + left.M13 * right.M32 + left.M14 * right.M42;
result.M13 = left.M11 * right.M13 + left.M12 * right.M23 + left.M13 * right.M33 + left.M14 * right.M43;
result.M14 = left.M11 * right.M14 + left.M12 * right.M24 + left.M13 * right.M34 + left.M14 * right.M44;
result.M21 = left.M21 * right.M11 + left.M22 * right.M21 + left.M23 * right.M31 + left.M24 * right.M41;
result.M22 = left.M21 * right.M12 + left.M22 * right.M22 + left.M23 * right.M32 + left.M24 * right.M42;
result.M23 = left.M21 * right.M13 + left.M22 * right.M23 + left.M23 * right.M33 + left.M24 * right.M43;
result.M24 = left.M21 * right.M14 + left.M22 * right.M24 + left.M23 * right.M34 + left.M24 * right.M44;
result.M31 = left.M31 * right.M11 + left.M32 * right.M21 + left.M33 * right.M31 + left.M34 * right.M41;
result.M32 = left.M31 * right.M12 + left.M32 * right.M22 + left.M33 * right.M32 + left.M34 * right.M42;
result.M33 = left.M31 * right.M13 + left.M32 * right.M23 + left.M33 * right.M33 + left.M34 * right.M43;
result.M34 = left.M31 * right.M14 + left.M32 * right.M24 + left.M33 * right.M34 + left.M34 * right.M44;
result.M41 = left.M41 * right.M11 + left.M42 * right.M21 + left.M43 * right.M31 + left.M44 * right.M41;
result.M42 = left.M41 * right.M12 + left.M42 * right.M22 + left.M43 * right.M32 + left.M44 * right.M42;
result.M43 = left.M41 * right.M13 + left.M42 * right.M23 + left.M43 * right.M33 + left.M44 * right.M43;
result.M44 = left.M41 * right.M14 + left.M42 * right.M24 + left.M43 * right.M34 + left.M44 * right.M44;
return result;
}
public static MatrixD operator *(MatrixD left, double right)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 * right;
result.M12 = left.M12 * right;
result.M13 = left.M13 * right;
result.M14 = left.M14 * right;
result.M21 = left.M21 * right;
result.M22 = left.M22 * right;
result.M23 = left.M23 * right;
result.M24 = left.M24 * right;
result.M31 = left.M31 * right;
result.M32 = left.M32 * right;
result.M33 = left.M33 * right;
result.M34 = left.M34 * right;
result.M41 = left.M41 * right;
result.M42 = left.M42 * right;
result.M43 = left.M43 * right;
result.M44 = left.M44 * right;
return result;
}
public static MatrixD operator *(double right, MatrixD left)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 * right;
result.M12 = left.M12 * right;
result.M13 = left.M13 * right;
result.M14 = left.M14 * right;
result.M21 = left.M21 * right;
result.M22 = left.M22 * right;
result.M23 = left.M23 * right;
result.M24 = left.M24 * right;
result.M31 = left.M31 * right;
result.M32 = left.M32 * right;
result.M33 = left.M33 * right;
result.M34 = left.M34 * right;
result.M41 = left.M41 * right;
result.M42 = left.M42 * right;
result.M43 = left.M43 * right;
result.M44 = left.M44 * right;
return result;
}
public static MatrixD operator /(MatrixD left, MatrixD right)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 / right.M11;
result.M12 = left.M12 / right.M12;
result.M13 = left.M13 / right.M13;
result.M14 = left.M14 / right.M14;
result.M21 = left.M21 / right.M21;
result.M22 = left.M22 / right.M22;
result.M23 = left.M23 / right.M23;
result.M24 = left.M24 / right.M24;
result.M31 = left.M31 / right.M31;
result.M32 = left.M32 / right.M32;
result.M33 = left.M33 / right.M33;
result.M34 = left.M34 / right.M34;
result.M41 = left.M41 / right.M41;
result.M42 = left.M42 / right.M42;
result.M43 = left.M43 / right.M43;
result.M44 = left.M44 / right.M44;
return result;
}
public static MatrixD operator /(MatrixD left, double right)
{
MatrixD result = default(MatrixD);
result.M11 = left.M11 / right;
result.M12 = left.M12 / right;
result.M13 = left.M13 / right;
result.M14 = left.M14 / right;
result.M21 = left.M21 / right;
result.M22 = left.M22 / right;
result.M23 = left.M23 / right;
result.M24 = left.M24 / right;
result.M31 = left.M31 / right;
result.M32 = left.M32 / right;
result.M33 = left.M33 / right;
result.M34 = left.M34 / right;
result.M41 = left.M41 / right;
result.M42 = left.M42 / right;
result.M43 = left.M43 / right;
result.M44 = left.M44 / right;
return result;
}
public static bool operator ==(MatrixD left, MatrixD right)
{
if (left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 && left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 && left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 && left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43)
{
return left.M44 == right.M44;
}
return false;
}
public static bool operator !=(MatrixD left, MatrixD right)
{
if (left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 && left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 && left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 && left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43)
{
return left.M44 != right.M44;
}
return true;
}
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "[M11:{0} M12:{1} M13:{2} M14:{3}] [M21:{4} M22:{5} M23:{6} M24:{7}] [M31:{8} M32:{9} M33:{10} M34:{11}] [M41:{12} M42:{13} M43:{14} M44:{15}]", M11.ToString(CultureInfo.CurrentCulture), M12.ToString(CultureInfo.CurrentCulture), M13.ToString(CultureInfo.CurrentCulture), M14.ToString(CultureInfo.CurrentCulture), M21.ToString(CultureInfo.CurrentCulture), M22.ToString(CultureInfo.CurrentCulture), M23.ToString(CultureInfo.CurrentCulture), M24.ToString(CultureInfo.CurrentCulture), M31.ToString(CultureInfo.CurrentCulture), M32.ToString(CultureInfo.CurrentCulture), M33.ToString(CultureInfo.CurrentCulture), M34.ToString(CultureInfo.CurrentCulture), M41.ToString(CultureInfo.CurrentCulture), M42.ToString(CultureInfo.CurrentCulture), M43.ToString(CultureInfo.CurrentCulture), M44.ToString(CultureInfo.CurrentCulture));
}
public override int GetHashCode()
{
return M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode() + M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode() + M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode() + M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode();
}
public override bool Equals(object value)
{
if (value == null)
{
return false;
}
if (value.GetType() != GetType())
{
return false;
}
return Equals((MatrixD)value);
}
public bool Equals(MatrixD value)
{
if (M11 == value.M11 && M12 == value.M12 && M13 == value.M13 && M14 == value.M14 && M21 == value.M21 && M22 == value.M22 && M23 == value.M23 && M24 == value.M24 && M31 == value.M31 && M32 == value.M32 && M33 == value.M33 && M34 == value.M34 && M41 == value.M41 && M42 == value.M42 && M43 == value.M43)
{
return M44 == value.M44;
}
return false;
}
public bool Equals(ref MatrixD value)
{
if (M11 == value.M11 && M12 == value.M12 && M13 == value.M13 && M14 == value.M14 && M21 == value.M21 && M22 == value.M22 && M23 == value.M23 && M24 == value.M24 && M31 == value.M31 && M32 == value.M32 && M33 == value.M33 && M34 == value.M34 && M41 == value.M41 && M42 == value.M42 && M43 == value.M43)
{
return M44 == value.M44;
}
return false;
}
} }
} }

View File

@@ -330,6 +330,8 @@ namespace _2DGAMELIB
{ {
Modes[mode].Draw(FPSF); Modes[mode].Draw(FPSF);
} }
GD.DrawImage(BH, new Point(0, 0));
baseControl.SetBitmap(BD); baseControl.SetBitmap(BD);
}; };

View File

@@ -34,48 +34,6 @@ namespace _2DGAMELIB
Initialize(s); Initialize(s);
} }
public MyRandom()
: this(4357u)
{
}
public void Initialize(uint[] key)
{
uint num = (uint)key.Length;
uint[] array = new uint[4];
Initialize(1u);
array[0] = x;
array[1] = y;
array[2] = z;
array[3] = w;
uint s = w;
uint num2;
for (num2 = 0u; num2 < num; num2++)
{
array[num2 & 3] ^= (s = InitMtSub(s, key[num2] + num2));
}
uint num3 = 0u;
while (num3 < 3)
{
array[num2 & 3] ^= (s = InitMtSub(s, num3));
num3++;
num2++;
}
x = array[0];
y = array[1];
z = array[2];
w = array[3];
if (x == 0 && y == 0 && z == 0 && w == 0)
{
x = 1u;
}
}
public MyRandom(uint[] key)
{
Initialize(key);
}
public override int Next() public override int Next()
{ {
uint num = x ^ (x << 11); uint num = x ^ (x << 11);

View File

@@ -189,14 +189,6 @@ namespace _2DGAMELIB
} }
} }
public void SetDefault()
{
foreach (Difs value in Difss.Values)
{
value.SetDefault();
}
}
public Obj SetDefaultR() public Obj SetDefaultR()
{ {
foreach (Difs value in Difss.Values) foreach (Difs value in Difss.Values)
@@ -210,39 +202,7 @@ namespace _2DGAMELIB
{ {
} }
public Obj(Obj Obj)
{
Copy(Obj);
}
private void Copy(Obj Obj)
{
Tag = Obj.Tag;
foreach (string key in Obj.Difss.Keys)
{
Difss.Add(key, new Difs(Obj.Difss[key]));
}
}
public void Add(string Name, Difs Difs)
{
Difss.Add(Name, Difs);
}
public void Add(Difs Difs)
{
Difss.Add(Difs.Tag, Difs);
}
public void Insert(int Index, string Name, Difs Difs)
{
Difss.Insert(Index, Name, Difs);
}
public void Remove(string Name)
{
Difss.Remove(Name);
}
public void Draw(Are Are) public void Draw(Are Are)
{ {
@@ -252,29 +212,6 @@ namespace _2DGAMELIB
} }
} }
public void Draws(Are Are)
{
foreach (Difs value in Difss.Values)
{
value.Draws(Are);
}
}
public void Draw(AreM AreM)
{
foreach (Difs value in Difss.Values)
{
value.Draw(AreM);
}
}
public void Draws(AreM AreM)
{
foreach (Difs value in Difss.Values)
{
value.Draws(AreM);
}
}
private Difs GetJoinRootDifs() private Difs GetJoinRootDifs()
{ {
@@ -315,29 +252,6 @@ namespace _2DGAMELIB
} }
} }
public void SetJoints(string Name)
{
Difs[] array = Difss.Values.ToArray();
Difs[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
array2[i].SetJoints();
}
r = Difss[Name];
if (r != null)
{
jsd = r.GetJointsD(array);
}
}
public void JoinP()
{
if (r != null)
{
r.JoinPA();
jsd.JoinP();
}
}
public void JoinPA() public void JoinPA()
{ {
@@ -348,259 +262,6 @@ namespace _2DGAMELIB
} }
} }
public void JoinPall()
{
if (r != null)
{
r.JoinPA();
jsd.JoinPall();
}
}
public void JoinPAall()
{
if (r != null)
{
r.JoinPA();
jsd.JoinPAall();
}
}
public HashSet<string> GetHitDifsTagsCur(ref Color HitColor)
{
HashSet<string> hashSet = new HashSet<string>();
foreach (Difs value in Values)
{
if (value.Current.IsHit(ref HitColor))
{
hashSet.Add(value.Tag);
}
}
return hashSet;
}
public List<Difs> GetHitDifssCur(ref Color HitColor)
{
List<Difs> list = new List<Difs>();
foreach (Difs value in Values)
{
if (value.Current.IsHit(ref HitColor))
{
list.Add(value);
}
}
return list;
}
public HashSet<string> GetHitParTagsCur(ref Color HitColor)
{
HashSet<string> hashSet = new HashSet<string>();
foreach (Difs value in Values)
{
foreach (string hitTag in value.Current.GetHitTags(ref HitColor))
{
hashSet.Add(hitTag);
}
}
return hashSet;
}
public List<Par> GetHitParsCur(ref Color HitColor)
{
List<Par> list = new List<Par>();
foreach (Difs value in Values)
{
list.AddRange(value.Current.GetHitPars(ref HitColor));
}
return list;
}
public bool IsHitCur(ref Color HitColor)
{
foreach (Difs value in Values)
{
if (value.IsHit(ref HitColor))
{
return true;
}
}
return false;
}
public HashSet<string> GetHitDifsTags(ref Color HitColor)
{
HashSet<string> hashSet = new HashSet<string>();
foreach (Difs value in Values)
{
if (value.IsHit(ref HitColor))
{
hashSet.Add(value.Tag);
}
}
return hashSet;
}
public List<Difs> GetHitDifss(ref Color HitColor)
{
List<Difs> list = new List<Difs>();
foreach (Difs value in Values)
{
if (value.IsHit(ref HitColor))
{
list.Add(value);
}
}
return list;
}
public HashSet<string> GetHitParTags(ref Color HitColor)
{
HashSet<string> hashSet = new HashSet<string>();
foreach (Difs value in Values)
{
foreach (string hitTag in value.GetHitTags(ref HitColor))
{
hashSet.Add(hitTag);
}
}
return hashSet;
}
public List<Par> GetHitPars(ref Color HitColor)
{
List<Par> list = new List<Par>();
foreach (Difs value in Values)
{
list.AddRange(value.GetHitPars(ref HitColor));
}
return list;
}
public bool IsHit(ref Color HitColor)
{
foreach (Difs value in Values)
{
if (value.IsHit(ref HitColor))
{
return true;
}
}
return false;
}
public void Symmetrization(string[] Names)
{
Difs[] array = Difss.Values.ToArray();
Difs[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
array2[i].SetJoints();
}
JointsD jointsD = GetJoinRootDifs().GetJointsD(array);
foreach (string name in Names)
{
symmetrization(name, array, jointsD);
}
}
public void Symmetrization(string Name, string[] Names)
{
Difs[] array = Difss.Values.ToArray();
Difs[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
array2[i].SetJoints();
}
JointsD jointsD = Difss[Name].GetJointsD(array);
foreach (string name in Names)
{
symmetrization(name, array, jointsD);
}
}
private void symmetrization(string Name, Difs[] da, JointsD jsdb)
{
Difs difs = Difss[Name];
JointsD jointsD = difs.GetJointsD(da);
Difs difs2 = new Difs(difs);
difs2.SetJoints();
difs2.ReverseX();
TagReplace(difs2);
SetPos(difs2, GetSymPos(difs, jsdb) - difs2.CurJoinRoot.Position);
foreach (Pars item in difs2.EnumAllPars())
{
difs2.JoinP(item);
}
Difss.Add(difs2.Tag, difs2);
string key = null;
foreach (JointD join in jointsD.Joins)
{
difs2 = new Difs(join.Difs1);
difs2.SetJoints();
difs2.ReverseX();
TagReplace(difs2);
if (join.Difs0.Tag.Contains("左"))
{
key = join.Difs0.Tag.Replace("左", "右");
}
else if (join.Difs0.Tag.Contains("右"))
{
key = join.Difs0.Tag.Replace("右", "左");
}
Par par = Difss[key].Current.GetPar(join.Path0);
SetPos(difs2, par.ToGlobal(par.JP[join.Index].Joint) - difs2.CurJoinRoot.Position);
foreach (Pars item2 in difs2.EnumAllPars())
{
difs2.JoinP(item2);
}
Difss.Add(difs2.Tag, difs2);
}
}
private void TagReplace(Difs ds)
{
if (ds.Tag.Contains("左"))
{
ds.Tag = ds.Tag.Replace("左", "右");
}
else if (ds.Tag.Contains("右"))
{
ds.Tag = ds.Tag.Replace("右", "左");
}
}
private Vector2D GetSymPos(Difs r, JointsD jsdb)
{
JointD jointD = null;
foreach (JointD join in jsdb.Joins)
{
if (join.Difs1 == r)
{
jointD = join;
break;
}
}
Vector2D position = r.CurJoinRoot.Position;
Par par = jointD.Difs0.Current.GetPar(jointD.Path0);
Joi joi = par.JP[jointD.Index];
foreach (Joi item in par.JP)
{
Vector2D result = par.ToGlobal(item.Joint);
if (item != joi && System.Math.Abs(result.Y - position.Y) < 1E-06)
{
return result;
}
}
return Dat.Vec2DZero;
}
private void SetPos(Difs ds, Vector2D v)
{
foreach (Par item in ds.EnumAllPar())
{
item.PositionBase += v;
}
}
public void Dispose() public void Dispose()
{ {

View File

@@ -56,22 +56,11 @@ namespace _2DGAMELIB
values = new Dictionary<T1, T2>(); values = new Dictionary<T1, T2>();
} }
public OrderedDictionary(int capacity)
{
keys = new List<T1>(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)
{
return keys.IndexOf(Key);
}
public int IndexOf(T2 Value) public int IndexOf(T2 Value)
{ {
int num = 0; int num = 0;
@@ -86,30 +75,11 @@ namespace _2DGAMELIB
return -1; return -1;
} }
public int IndexOf(ref T2 Value)
{
int num = 0;
foreach (T2 value in Values)
{
if (value.Equals(Value))
{
return num;
}
num++;
}
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)
{
return keys.LastIndexOf(Key);
}
public int LastIndexOf(T2 Value) public int LastIndexOf(T2 Value)
{ {
int num = keys.Count - 1; int num = keys.Count - 1;
@@ -124,84 +94,22 @@ namespace _2DGAMELIB
return -1; return -1;
} }
public int LastIndexOf(ref T2 Value)
{
int num = keys.Count - 1;
foreach (T2 item in Values.Reverse())
{
if (item.Equals(Value))
{
return num;
}
num--;
}
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)
{
keys.Add(Key);
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)
{
keys.Insert(Index, Key);
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)
{
keys.Remove(Key);
values.Remove(Key);
}
public void Reverse()
{
keys.Reverse();
}
public void Reverse(int Index, int Count)
{
keys.Reverse(Index, Count);
}
public bool ContainsKey(T1 Key)
{
return values.ContainsKey(Key);
}
public bool ContainsKey(ref T1 Key)
{
return values.ContainsKey(Key);
}
public bool ContainsValue(T2 Value)
{
return values.ContainsValue(Value);
}
public bool ContainsValue(ref T2 Value)
{
return values.ContainsValue(Value);
}
} }
} }

View File

@@ -13,10 +13,6 @@ namespace _2DGAMELIB
private static double s0; private static double s0;
public static double GetDiagonalLength(this double Width, double Height)
{
return System.Math.Sqrt(Width * Width + Height * Height);
}
public static Color Reverse(this Color c) public static Color Reverse(this Color c)
{ {
@@ -341,11 +337,6 @@ namespace _2DGAMELIB
return string.Join(Separator, strs); return string.Join(Separator, strs);
} }
public static string[] Split(this string str, string Separator)
{
return str.Split(new string[1] { Separator }, StringSplitOptions.None);
}
static Oth() static Oth()
{ {
s1 = 1.01; s1 = 1.01;

View File

@@ -537,28 +537,12 @@ namespace _2DGAMELIB
parent = Parent; parent = Parent;
} }
public void SetPen(Pen Pen)
{
pen = Pen;
if (pen != null)
{
pen.StartCap = LineCap.Round;
pen.EndCap = LineCap.Round;
}
EditP = true;
}
public void SetBrush(Brush Brush) public void SetBrush(Brush Brush)
{ {
brush = Brush; brush = Brush;
} }
public void EditTrue()
{
Edit = true;
EditH = true;
}
public void SetDefault() public void SetDefault()
{ {
pen = new Pen(Color.Black, 1f); pen = new Pen(Color.Black, 1f);
@@ -956,16 +940,6 @@ namespace _2DGAMELIB
return list; return list;
} }
public Pars GetRoot()
{
Pars pars2 = parent;
while (pars2.Parent != null)
{
pars2 = pars2.Parent;
}
return pars2;
}
public override string ToString() public override string ToString()
{ {
return Tag; return Tag;
@@ -987,39 +961,6 @@ namespace _2DGAMELIB
angleCont = 360.0 - angleCont; angleCont = 360.0 - angleCont;
} }
public bool IsParentTag(string Tag)
{
if (Parent != null)
{
return Parent.Tag == Tag;
}
return false;
}
public bool IsRootTag(string Tag)
{
Pars root = GetRoot();
if (root != null)
{
return root.Tag == Tag;
}
return false;
}
public bool ContainsParentTag(string Tag)
{
if (Parent != null)
{
return Parent.Tag.Contains(Tag);
}
return false;
}
public bool ContainsRootTag(string Tag)
{
return GetRoot()?.Tag.Contains(Tag) ?? false;
}
public double GetArea() public double GetArea()
{ {
Vector2D[] array = op.EnumPoints().ToArray(); Vector2D[] array = op.EnumPoints().ToArray();

View File

@@ -265,26 +265,11 @@ namespace _2DGAMELIB
parent = Parent; parent = Parent;
} }
public int IndexOf(string Name)
{
return pars.IndexOf(Name);
}
public int IndexOf(object obj) public int IndexOf(object obj)
{ {
return pars.IndexOf(obj); return pars.IndexOf(obj);
} }
public int LastIndexOf(string Name)
{
return pars.LastIndexOf(Name);
}
public int LastIndexOf(object obj)
{
return pars.LastIndexOf(obj);
}
public void Add(string Name, Par Par) public void Add(string Name, Par Par)
{ {
Par.SetParent(this); Par.SetParent(this);
@@ -303,92 +288,12 @@ namespace _2DGAMELIB
pars.Add(Name, Pars); pars.Add(Name, Pars);
} }
public void Add(string Name, object obj)
{
if (obj is Pars)
{
((Pars)obj).SetParent(this);
}
else if (obj is ParT)
{
((ParT)obj).SetParent(this);
}
else if (obj is Par)
{
((Par)obj).SetParent(this);
}
pars.Add(Name, obj);
}
public void Add(Par Par)
{
Par.SetParent(this);
pars.Add(Par.Tag, Par);
}
public void Add(ParT ParT)
{
ParT.SetParent(this);
pars.Add(ParT.Tag, ParT);
}
public void Add(Pars Pars) public void Add(Pars Pars)
{ {
Pars.SetParent(this); Pars.SetParent(this);
pars.Add(Pars.Tag, Pars); pars.Add(Pars.Tag, Pars);
} }
public void Add(object obj)
{
if (obj is Pars)
{
Add((Pars)obj);
}
else if (obj is ParT)
{
Add((ParT)obj);
}
else if (obj is Par)
{
Add((Par)obj);
}
}
public void Insert(int Index, string Name, Par Par)
{
Par.SetParent(this);
pars.Insert(Index, Name, Par);
}
public void Insert(int Index, string Name, ParT ParT)
{
ParT.SetParent(this);
pars.Insert(Index, Name, ParT);
}
public void Insert(int Index, string Name, Pars Pars)
{
Pars.SetParent(this);
pars.Insert(Index, Name, Pars);
}
public void Insert(int Index, string Name, object obj)
{
if (obj is Pars)
{
((Pars)obj).SetParent(this);
}
else if (obj is ParT)
{
((ParT)obj).SetParent(this);
}
else if (obj is Par)
{
((Par)obj).SetParent(this);
}
pars.Insert(Index, Name, obj);
}
public void Remove(string Name) public void Remove(string Name)
{ {
object obj = pars[Name]; object obj = pars[Name];
@@ -610,16 +515,6 @@ namespace _2DGAMELIB
return (Par)obj; return (Par)obj;
} }
public Pars GetRoot()
{
Pars pars2 = parent;
while (pars2.Parent != null)
{
pars2 = pars2.Parent;
}
return pars2;
}
public void ReverseX() public void ReverseX()
{ {
foreach (object value in pars.Values) foreach (object value in pars.Values)
@@ -650,93 +545,6 @@ namespace _2DGAMELIB
} }
} }
public bool IsParentTag(string Tag)
{
if (Parent != null)
{
return Parent.Tag == Tag;
}
return false;
}
public bool IsRootTag(string Tag)
{
Pars root = GetRoot();
if (root != null)
{
return root.Tag == Tag;
}
return false;
}
public bool ContainsParentTag(string Tag)
{
if (Parent != null)
{
return Parent.Tag.Contains(Tag);
}
return false;
}
public bool ContainsRootTag(string Tag)
{
return GetRoot()?.Tag.Contains(Tag) ?? false;
}
public void ScalingXY(double Scale)
{
foreach (Par item in EnumAllPar())
{
item.ScalingXY(Scale);
item.ScalingXY(Scale);
}
}
public void ScalingX(double Scale)
{
foreach (Par item in EnumAllPar())
{
item.ScalingX(Scale);
item.ScalingX(Scale);
}
}
public void ScalingY(double Scale)
{
foreach (Par item in EnumAllPar())
{
item.ScalingY(Scale);
item.ScalingY(Scale);
}
}
public void ExpansionXY(double Rate)
{
foreach (Par item in EnumAllPar())
{
item.ExpansionXY(Rate);
item.ExpansionXY(Rate);
}
}
public void ExpansionX(double Rate)
{
foreach (Par item in EnumAllPar())
{
item.ExpansionX(Rate);
item.ExpansionX(Rate);
}
}
public void ExpansionY(double Rate)
{
foreach (Par item in EnumAllPar())
{
item.ExpansionY(Rate);
item.ExpansionY(Rate);
}
}
public void Dispose() public void Dispose()
{ {
foreach (object value in pars.Values) foreach (object value in pars.Values)
@@ -758,21 +566,6 @@ namespace _2DGAMELIB
} }
public static class pars public static class pars
{ {
public static bool IsPars(this object obj)
{
return obj is Pars;
}
public static bool IsParT(this object obj)
{
return obj is ParT;
}
public static bool IsPar(this object obj)
{
return obj is Par;
}
public static Pars ToPars(this object obj) public static Pars ToPars(this object obj)
{ {
return (Pars)obj; return (Pars)obj;

View File

@@ -14,9 +14,7 @@ namespace _2DGAMELIB
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)
{ {

View File

@@ -19,8 +19,6 @@ namespace _2DGAMELIB
private int h; private int h;
private int o;
private Rectangle r; private Rectangle r;
private ColorMatrix cm = new ColorMatrix(); private ColorMatrix cm = new ColorMatrix();

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
using System.Text;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace _2DGAMELIB namespace _2DGAMELIB
@@ -70,13 +72,71 @@ namespace _2DGAMELIB
*/ */
static Ser(){} static Ser(){}
public static T JsonDeepCopy<T>(this T Object)
{
using MemoryStream memoryStream = new MemoryStream();
JsonSerializer jsonSerializer = new JsonSerializer
{
PreserveReferencesHandling = PreserveReferencesHandling.All,
TypeNameHandling = TypeNameHandling.All,
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore
};
jsonSerializer.Serialize(new StreamWriter(memoryStream, Encoding.UTF8), Object);
return (T)new JsonSerializer
{
PreserveReferencesHandling = PreserveReferencesHandling.All,
TypeNameHandling = TypeNameHandling.All,
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore
}.Deserialize(new StreamReader(memoryStream), typeof(T));
}
public static byte[] ToJsonBytes<T>(this T Object)
{
MemoryStream textWriter = new MemoryStream();
JsonSerializer jsonSerializer = new JsonSerializer
{
PreserveReferencesHandling = PreserveReferencesHandling.Objects,
TypeNameHandling = TypeNameHandling.All,
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore
};
jsonSerializer.Serialize(new StreamWriter(textWriter, Encoding.UTF8), Object);
return textWriter.ToArray();
}
public static T ToUnJsonObject<T>(this byte[] Bytes)
{
using StreamReader reader = new StreamReader(new MemoryStream(Bytes), Encoding.UTF8);
return (T)new JsonSerializer
{
PreserveReferencesHandling = PreserveReferencesHandling.All,
TypeNameHandling = TypeNameHandling.All,
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore
}.Deserialize(reader, typeof(T));
}
public static void ToJson<T>(this T Object, string Path) public static void ToJson<T>(this T Object, string Path)
{ {
using StreamWriter textWriter = File.CreateText(Path); using StreamWriter textWriter = File.CreateText(Path);
JsonSerializer jsonSerializer = new JsonSerializer(); JsonSerializer jsonSerializer = new JsonSerializer
jsonSerializer.PreserveReferencesHandling = PreserveReferencesHandling.Objects; {
jsonSerializer.TypeNameHandling = TypeNameHandling.All; PreserveReferencesHandling = PreserveReferencesHandling.All,
jsonSerializer.Formatting = Newtonsoft.Json.Formatting.Indented; TypeNameHandling = TypeNameHandling.All,
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore
};
jsonSerializer.Serialize(textWriter, Object); jsonSerializer.Serialize(textWriter, Object);
} }
@@ -85,8 +145,10 @@ namespace _2DGAMELIB
using StreamReader reader = File.OpenText(Path); using StreamReader reader = File.OpenText(Path);
return (T)new JsonSerializer return (T)new JsonSerializer
{ {
NullValueHandling = NullValueHandling.Ignore, PreserveReferencesHandling = PreserveReferencesHandling.All,
TypeNameHandling = TypeNameHandling.All TypeNameHandling = TypeNameHandling.All,
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore
}.Deserialize(reader, typeof(T)); }.Deserialize(reader, typeof(T));
} }
} }

View File

@@ -18,11 +18,6 @@ namespace _2DGAMELIB
this.OnColor = OnColor; this.OnColor = OnColor;
} }
public Swi(ref Color OnColor)
{
this.OnColor = OnColor;
}
public void OnOff(But But) public void OnOff(But But)
{ {
But1 but = (But1)But; But1 but = (But1)But;

View File

@@ -127,45 +127,6 @@ namespace _2DGAMELIB
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)
{
try
{
if (!File.Exists(ConfigPath))
{
this.Speed = Speed;
speed = Speed;
}
else
{
string[] source = ConfigPath.ReadLines();
FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1';
}
}
catch
{
this.Speed = Speed;
speed = Speed;
}
if (FastText)
{
this.Speed = 50.0;
speed = 50.0;
}
else
{
this.Speed = Speed;
speed = Speed;
}
this.Space = Space;
this.Text = Text;
this.Action = Action;
SetParT(Name, ref Position, Size, Width, Height, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor);
SetFeed(Name, Size, ref FeedColor);
mv = new MotV(0.0, 255.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
@@ -205,41 +166,6 @@ namespace _2DGAMELIB
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)
{
try
{
if (!File.Exists(ConfigPath))
{
this.Speed = Speed;
speed = Speed;
}
else
{
string[] source = ConfigPath.ReadLines();
FastText = source.First((string s) => s.StartsWith("FastText:")).Last() == '1';
}
}
catch
{
this.Speed = Speed;
speed = Speed;
}
if (FastText)
{
this.Speed = 50.0;
speed = 50.0;
}
else
{
this.Speed = Speed;
speed = Speed;
}
this.Space = Space;
this.Text = Text;
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

View File

@@ -9,8 +9,6 @@ namespace _2DGAMELIB
{ {
private Med Med; private Med Med;
private IContainer components;
private GlImage wpfImage1; private GlImage wpfImage1;
//private System.Windows.Controls.Image hostedComponent1; //private System.Windows.Controls.Image hostedComponent1;

View File

@@ -37,36 +37,12 @@ namespace _2DGAMELIB
} }
} }
public Vector2D(int value)
{
X = value;
Y = value;
}
public Vector2D(float value)
{
X = value;
Y = value;
}
public Vector2D(double value)
{
X = 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)
{
X = x;
Y = y;
}
public Vector2D(double x, double y) public Vector2D(double x, double y)
{ {
X = x; X = x;

View File

@@ -14,11 +14,5 @@ namespace _2DGAMELIB
this.v1 = v1; this.v1 = v1;
this.v2 = v2; this.v2 = v2;
} }
public Vector2D_2(ref Vector2D v1, ref Vector2D v2)
{
this.v1 = v1;
this.v2 = v2;
}
} }
} }

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,28 @@
using System; using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace _2DGAMELIB namespace _2DGAMELIB
{ {
//TODO remove these... public static class Common
{
public static Vector2D ToVector2D(this Point Point)
{
return new Vector2D(Point.X, Point.Y);
}
public static Point ToPoint(this Vector2D Vector)
{
return new Point((int)Vector.X, (int)Vector.Y);
}
public static PointF ToPointF(this Vector2D Vector)
{
return new PointF((float)Vector.X, (float)Vector.Y);
}
}
public static class Math public static class Math
{ {
public static double RoundDown(this double Value, int Digits) public static double RoundDown(this double Value, int Digits)

View File

@@ -9,10 +9,5 @@ namespace SlaveMatrix
public Ele e; public Ele e;
public Par p; public Par p;
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();
}
} }
} }

View File

@@ -2915,22 +2915,6 @@ namespace SlaveMatrix
.Clear(); .Clear();
} }
public void Clear()
{
K[] array = ;
for (int i = 0; i < array.Length; i++)
{
array[i].Clear();
}
W[] array2 = ;
for (int i = 0; i < array2.Length; i++)
{
array2[i].Clear();
}
.Clear();
.Clear();
}
public void Sort(IEnumerable<Ele> ar, List<Ele> li) public void Sort(IEnumerable<Ele> ar, List<Ele> li)
{ {
foreach (Ele item in ar) foreach (Ele item in ar)
@@ -9217,235 +9201,11 @@ namespace SlaveMatrix
_人._ハートCD. = Cha.ChaD..Inverse() * Cha.ChaD.; _人._ハートCD. = Cha.ChaD..Inverse() * Cha.ChaD.;
} }
public void SetEle<T>(Action<T> a) where T : Ele
{
T ele = Elements.GetEle<T>();
if (ele == null)
{
return;
}
a(ele);
foreach (EleI ei in eis)
{
if (ei.ElesH.Contains(ele))
{
ei.Updatef = true;
break;
}
}
}
public void SetEle<T>(bool , Action<T> a) where T : Ele
{
T ele = Elements.GetEle<T>();
if (ele == null)
{
return;
}
a(ele);
foreach (EleI ei in eis)
{
if (ei.ElesH.Contains(ele))
{
ei.Updatef = true;
break;
}
}
}
public void SetEle<T>(Func<T, bool> con, Action<T> a) where T : Ele
{
T ele = Elements.GetEle(con);
if (ele == null)
{
return;
}
a(ele);
foreach (EleI ei in eis)
{
if (ei.ElesH.Contains(ele))
{
ei.Updatef = true;
break;
}
}
}
public void SetEleL<T>(Action<T> a) where T : Ele
{
T eleL = Elements.GetEleL<T>();
if (eleL == null)
{
return;
}
a(eleL);
foreach (EleI ei in eis)
{
if (ei.ElesH.Contains(eleL))
{
ei.Updatef = true;
break;
}
}
}
public void SetEleL<T>(bool , Action<T> a) where T : Ele
{
T eleL = Elements.GetEleL<T>();
if (eleL == null)
{
return;
}
a(eleL);
foreach (EleI ei in eis)
{
if (ei.ElesH.Contains(eleL))
{
ei.Updatef = true;
break;
}
}
}
public void SetEleL<T>(Func<T, bool> con, Action<T> a) where T : Ele
{
T eleL = Elements.GetEleL(con);
if (eleL == null)
{
return;
}
a(eleL);
foreach (EleI ei in eis)
{
if (ei.ElesH.Contains(eleL))
{
ei.Updatef = true;
break;
}
}
}
public void SetEles<T>(Action<T> a) where T : Ele
{
IEnumerable<T> eles;
foreach (T item in eles = Elements.GetEles<T>())
{
a(item);
}
foreach (EleI ei in eis)
{
if (eles.Any((T e) => ei.ElesH.Contains(e)))
{
ei.Updatef = true;
}
}
}
public void SetEles<T>(bool , Action<T> a) where T : Ele
{
IEnumerable<T> eles;
foreach (T item in eles = Elements.GetEles<T>())
{
a(item);
}
foreach (EleI ei in eis)
{
if (eles.Any((T e) => ei.ElesH.Contains(e)))
{
ei.Updatef = true;
}
}
}
public void SetEles<T>(Func<T, bool> con, Action<T> a) where T : Ele
{
IEnumerable<T> eles;
foreach (T item in eles = Elements.GetEles(con))
{
a(item);
}
foreach (EleI ei in eis)
{
if (eles.Any((T e) => ei.ElesH.Contains(e)))
{
ei.Updatef = true;
}
}
}
public void SetElesL<T>(Action<T> a) where T : Ele
{
IEnumerable<T> elesL;
foreach (T item in elesL = Elements.GetElesL<T>())
{
a(item);
}
foreach (EleI ei in eis)
{
if (elesL.Any((T e) => ei.ElesH.Contains(e)))
{
ei.Updatef = true;
}
}
}
public void SetElesL<T>(bool , Action<T> a) where T : Ele
{
IEnumerable<T> elesL;
foreach (T item in elesL = Elements.GetElesL<T>())
{
a(item);
}
foreach (EleI ei in eis)
{
if (elesL.Any((T e) => ei.ElesH.Contains(e)))
{
ei.Updatef = true;
}
}
}
public void SetElesL<T>(Func<T, bool> con, Action<T> a) where T : Ele
{
IEnumerable<T> elesL;
foreach (T item in elesL = Elements.GetElesL(con))
{
a(item);
}
foreach (EleI ei in eis)
{
if (elesL.Any((T e) => ei.ElesH.Contains(e)))
{
ei.Updatef = true;
}
}
}
public List<string> GetHitTags(Color hc)
{
return (from e in EnumAllEle()
select e..GetHitTags(ref hc)).Aggregate(delegate(List<string> e0, List<string> e1)
{
e0.AddRange(e1);
return e0;
});
}
public Ele GetHitEle(Color hc) public Ele GetHitEle(Color hc)
{ {
return EnumAllEle().FirstOrDefault((Ele e) => e..IsHit(ref hc)); return EnumAllEle().FirstOrDefault((Ele e) => e..IsHit(ref hc));
} }
public List<Par> GetHitPars(Color hc)
{
return (from e in EnumAllEle()
select e..GetHitPars(ref hc)).Aggregate(delegate(List<Par> e0, List<Par> e1)
{
e0.AddRange(e1);
return e0;
});
}
public bool IsHit(Color hc) public bool IsHit(Color hc)
{ {
return EnumAllEle().Any((Ele e) => e..IsHit(ref hc)); return EnumAllEle().Any((Ele e) => e..IsHit(ref hc));
@@ -9459,10 +9219,6 @@ namespace SlaveMatrix
select e.); select e.);
} }
public void Set染み位置()
{
}
public void Join() public void Join()
{ {
Ele[] array = Elements; Ele[] array = Elements;
@@ -9920,11 +9676,6 @@ namespace SlaveMatrix
return .DistanceSquared(Cha.CP) < r10; return .DistanceSquared(Cha.CP) < r10;
} }
public bool Is口部()
{
return .DistanceSquared(Cha.CP) < r35;
}
public bool Is胸部() public bool Is胸部()
{ {
return .DistanceSquared(Cha.CP) < r17; return .DistanceSquared(Cha.CP) < r17;
@@ -9948,51 +9699,6 @@ namespace SlaveMatrix
return true; return true;
} }
public void ()
{
.PA();
.PA();
.PA();
.PA();
.PA();
}
public void ()
{
.PA();
if (Is獣)
{
_獣.PA();
_獣.PA();
_獣.PA();
}
.PA();
}
public void ()
{
.PA();
if (Is獣)
{
_獣.PA();
_獣.PA();
_獣.PA();
}
.PA();
}
public void ()
{
foreach (Ele item in .EnumEle())
{
item.PA();
if (item is _蜘)
{
break;
}
}
}
public void (bool , int n, bool value) public void (bool , int n, bool value)
{ {
if () if ()

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Threading.Tasks; using System.Threading.Tasks;
using _2DGAMELIB; using _2DGAMELIB;
using SlaveMatrix.GameClasses; using SlaveMatrix.GameClasses;
@@ -33,45 +34,40 @@ namespace SlaveMatrix
protected GeneratorType ; protected GeneratorType ;
protected Func<Unit> g;
public int Count => Buf.Count; public int Count => Buf.Count;
public Generator(int Capacity, GeneratorType genType) public Generator(int Capacity, GeneratorType genType)
{ {
this.Capacity = Capacity; this.Capacity = Capacity;
this. = genType; this. = genType;
switch (genType) Refresh();
}
public Unit gen()
{
switch ()
{ {
case GeneratorType.Bird: case GeneratorType.Bird:
g = GetBird; return GetBird();
break;
case GeneratorType.Snake: case GeneratorType.Snake:
g = GetSnake; return GetSnake();
break;
case GeneratorType.Beast: case GeneratorType.Beast:
g = GetBeast; return GetBeast();
break;
case GeneratorType.Aquatic: case GeneratorType.Aquatic:
g = GetAquatic; return GetAquatic();
break;
case GeneratorType.Insect: case GeneratorType.Insect:
g = GetInsect; return GetInsect();
break;
case GeneratorType.Humanoid: case GeneratorType.Humanoid:
g = GetHumanoid; return GetHumanoid();
break;
case GeneratorType.: case GeneratorType.:
g = Get幻獣; return Get幻獣();
break;
case GeneratorType.: case GeneratorType.:
g = Get魔獣; return Get魔獣();
break;
case GeneratorType.Dragon: case GeneratorType.Dragon:
g = GetDragon; return GetDragon();
break;
} }
Refresh();
return GetHumanoid();
} }
private static Unit Generate(ChaD ChaD1, ChaD ChaD2, int , string ) private static Unit Generate(ChaD ChaD1, ChaD ChaD2, int , string )
@@ -362,7 +358,7 @@ namespace SlaveMatrix
Unit[] a = new Unit[Capacity]; Unit[] a = new Unit[Capacity];
for (int i = 0; i < Capacity; i++) for (int i = 0; i < Capacity; i++)
a[i] = g(); a[i] = gen();
/* /*
Parallel.For(0, Capacity, Sta.po3, delegate(int i) Parallel.For(0, Capacity, Sta.po3, delegate(int i)
{ {
@@ -379,7 +375,7 @@ namespace SlaveMatrix
Buf.Capacity = Capacity; Buf.Capacity = Capacity;
Unit[] a = new Unit[Capacity]; Unit[] a = new Unit[Capacity];
for (int i = 0; i < Capacity; i++) for (int i = 0; i < Capacity; i++)
a[i] = g(); a[i] = gen();
/* /*
Parallel.For(0, Capacity, Sta.po3, delegate(int i) Parallel.For(0, Capacity, Sta.po3, delegate(int i)
{ {
@@ -412,92 +408,5 @@ namespace SlaveMatrix
} }
return null; return null;
} }
public static IEnumerable<Unit> EnumAllMonster()
{
yield return Generate(SpeciesDefaults.GetHarpy(), SpeciesDefaults.GetHarpy(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getハルピュイア(), SpeciesDefaults.Getハルピュイア(), 2, GameText.);
yield return Generate(SpeciesDefaults.GetPhoenix(), SpeciesDefaults.GetPhoenix(), 4, GameText.);
yield return Generate(SpeciesDefaults.Getラミア(), SpeciesDefaults.Getラミア(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getヒュドラ(), SpeciesDefaults.Getヒュドラ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getエキドナ(), SpeciesDefaults.Getエキドナ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getウロボロス(), SpeciesDefaults.Getウロボロス(), 4, GameText.);
yield return Generate(SpeciesDefaults.Getウェアキャット(), SpeciesDefaults.Getウェアキャット(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getウェアウルフ(), SpeciesDefaults.Getウェアウルフ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getウェアフォックス(), SpeciesDefaults.Getウェアフォックス(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getミタウロス(), SpeciesDefaults.Getミタウロス(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getアフール(), SpeciesDefaults.Getアフール(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getオケンタウレ(), SpeciesDefaults.Getオケンタウレ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getヒッポケンタウレ(), SpeciesDefaults.Getヒッポケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getブケンタウレ(), SpeciesDefaults.Getブケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getカプラケンタウレ(), SpeciesDefaults.Getカプラケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getレオントケンタウレ(), SpeciesDefaults.Getレオントケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getティグリスケンタウレ(), SpeciesDefaults.Getティグリスケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getパンテーラケンタウレ(), SpeciesDefaults.Getパンテーラケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getチータケンタウレ(), SpeciesDefaults.Getチータケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getカッパ(), SpeciesDefaults.Getカッパ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getマーメイド(), SpeciesDefaults.Getマーメイド(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getオールドマーメイド(), SpeciesDefaults.Getオールドマーメイド(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getドルフィンマーメイド(), SpeciesDefaults.Getドルフィンマーメイド(), 2, GameText.);
bool b = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getイクテュオケンタウレ(b), SpeciesDefaults.Getイクテュオケンタウレ(b), 3, GameText.);
yield return Generate(SpeciesDefaults.Getデルピヌスケンタウレ(), SpeciesDefaults.Getデルピヌスケンタウレ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getシーラミア(), SpeciesDefaults.Getシーラミア(), 2, GameText.);
int num = RNG.XS.Next(3);
yield return Generate(SpeciesDefaults.Getセイレーン(num), SpeciesDefaults.Getセイレーン(num), 2, GameText.);
yield return Generate(SpeciesDefaults.Getスキュラ(), SpeciesDefaults.Getスキュラ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getカリュブディス(), SpeciesDefaults.Getカリュブディス(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getクラーケン(), SpeciesDefaults.Getクラーケン(), 3, GameText.);
b = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getオールドスキュラ(b), SpeciesDefaults.Getオールドスキュラ(b), 4, GameText.);
yield return Generate(SpeciesDefaults.Getウェアマンティス(), SpeciesDefaults.Getウェアマンティス(), 1, GameText.);
yield return Generate(SpeciesDefaults.Getウェアドラゴンフライ(), SpeciesDefaults.Getウェアドラゴンフライ(), 1, GameText.);
yield return Generate(SpeciesDefaults.Getウェアビートル(), SpeciesDefaults.Getウェアビートル(), 1, GameText.);
yield return Generate(SpeciesDefaults.Getウェアスタッグビートル(), SpeciesDefaults.Getウェアスタッグビートル(), 1, GameText.);
b = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getアラクネ(b), SpeciesDefaults.Getアラクネ(b), 2, GameText.);
yield return Generate(SpeciesDefaults.Getギルタブリル(), SpeciesDefaults.Getギルタブリル(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getギルタブルル(), SpeciesDefaults.Getギルタブルル(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getムカデジョウロウ(), SpeciesDefaults.Getムカデジョウロウ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getサンドワーム(), SpeciesDefaults.Getサンドワーム(), 2, GameText.);
b = RNG.XS.NextBool();
bool b2 = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getフェアリー(b, b2), SpeciesDefaults.Getフェアリー(b, b2), 1, GameText.);
yield return Generate(SpeciesDefaults.Getリリン(), SpeciesDefaults.Getリリン(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getエルフ(), SpeciesDefaults.Getエルフ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getドワーフ(), SpeciesDefaults.Getドワーフ(), 2, GameText.);
b = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getオーグリス(b), SpeciesDefaults.Getオーグリス(b), 2, GameText.);
yield return Generate(SpeciesDefaults.Getサイクロプス(), SpeciesDefaults.Getサイクロプス(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getデビル(), SpeciesDefaults.Getデビル(), 2, GameText.);
b = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getエンジェル(b), SpeciesDefaults.Getエンジェル(b), 2, GameText.);
yield return Generate(SpeciesDefaults.Getサキュバス(), SpeciesDefaults.Getサキュバス(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getアルラウネ(), SpeciesDefaults.Getアルラウネ(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getスライム(), SpeciesDefaults.Getスライム(), 0, GameText.);
yield return Generate(SpeciesDefaults.Getエイリアン(), SpeciesDefaults.Getエイリアン(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getカーバンクル(), SpeciesDefaults.Getカーバンクル(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getペガサス(), SpeciesDefaults.Getペガサス(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getユニコーン(), SpeciesDefaults.Getユニコーン(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getバイコーン(), SpeciesDefaults.Getバイコーン(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getアリコーン(), SpeciesDefaults.Getアリコーン(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getグリフォン(), SpeciesDefaults.Getグリフォン(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getモケロス(), SpeciesDefaults.Getモケロス(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getヒッポグリフ(), SpeciesDefaults.Getヒッポグリフ(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getキマイラ(), SpeciesDefaults.Getキマイラ(), 3, GameText.);
b = RNG.XS.NextBool();
yield return Generate(SpeciesDefaults.Getスフィンクス(b), SpeciesDefaults.Getスフィンクス(b), 3, GameText.);
yield return Generate(SpeciesDefaults.Getカトブレパス(), SpeciesDefaults.Getカトブレパス(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getバジリスク(), SpeciesDefaults.Getバジリスク(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getコカトリス(), SpeciesDefaults.Getコカトリス(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getゴルゴン(), SpeciesDefaults.Getゴルゴン(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getリザードマン(), SpeciesDefaults.Getリザードマン(), 2, GameText.);
yield return Generate(SpeciesDefaults.Getドラゴニュート(), SpeciesDefaults.Getドラゴニュート(), 3, GameText.);
yield return Generate(SpeciesDefaults.Getワーム(), SpeciesDefaults.Getワーム(), 4, GameText.);
yield return Generate(SpeciesDefaults.Getリュウ(), SpeciesDefaults.Getリュウ(), 5, GameText.);
yield return Generate(SpeciesDefaults.Getワイバーン(), SpeciesDefaults.Getワイバーン(), 4, GameText.);
yield return Generate(SpeciesDefaults.Getドラコケンタウレ(), SpeciesDefaults.Getドラコケンタウレ(), 4, GameText.);
yield return Generate(SpeciesDefaults.Getドラゴン(), SpeciesDefaults.Getドラゴン(), 5, GameText.);
}
} }
} }

View File

@@ -483,14 +483,6 @@ namespace SlaveMatrix
} }
} }
public static void SwitchMode(this Med Med, string Mode, Are Are)
{
Med.Mode = Mode;
Med.DrawStart(Are);
Med.DrawEnd(BlackBackground);
sta = true;
}
public static void SwitchMode(this Med Med, string Mode, Are Are, Action<Are, FPS> ) public static void SwitchMode(this Med Med, string Mode, Are Are, Action<Are, FPS> )
{ {
Med.Mode = Mode; Med.Mode = Mode;

View File

@@ -4218,82 +4218,6 @@ namespace SlaveMatrix
Cha.Bod..C = (0.0 - a) * RNG.XS.NextDouble(); Cha.Bod..C = (0.0 - a) * RNG.XS.NextDouble();
} }
public static void (this Cha Cha, double u1, double u2, double , double )
{
Cha.Bod..SetAngle0();
Cha.Bod..X0Y0_節0.AngleBase += + u1;
Cha.Bod..X0Y0_節1.AngleBase += + u2;
}
public static void (this Cha Cha, double u1, double u2, double , double )
{
Cha.Bod..SetAngle0();
Cha.Bod..X0Y0_節0.AngleBase += 0.0 - + (0.0 - u1);
Cha.Bod..X0Y0_節1.AngleBase += 0.0 - + (0.0 - u2);
}
public static void _基本左(this Cha Cha, double u1, double u2)
{
Cha.(u1, u2, 0.0, 0.0);
}
public static void _基本右(this Cha Cha, double u1, double u2)
{
Cha.(u1, u2, 0.0, 0.0);
}
public static void _ピーン左(this Cha Cha, double u1, double u2)
{
Cha.(u1, u2, 20.0, -25.0);
}
public static void _ピーン右(this Cha Cha, double u1, double u2)
{
Cha.(u1, u2, 20.0, -25.0);
}
public static void _萎縮左(this Cha Cha, double u1, double u2)
{
Cha.(u1, u2, -80.0, 100.0);
}
public static void _萎縮右(this Cha Cha, double u1, double u2)
{
Cha.(u1, u2, -80.0, 100.0);
}
public static void _0(this Cha c, int i, double u1, double u2)
{
switch (i)
{
case 0:
c._基本左(u1, u2);
break;
case 1:
c._ピーン左(u1, u2);
break;
case 2:
c._萎縮左(u1, u2);
break;
}
}
public static void _0(this Cha c, int i, double u1, double u2)
{
switch (i)
{
case 0:
c._基本右(u1, u2);
break;
case 1:
c._ピーン右(u1, u2);
break;
case 2:
c._萎縮右(u1, u2);
break;
}
}
public static void (this Cha Cha, double a) public static void (this Cha Cha, double a)
{ {
Cha.Bod..C = a * RNG.XS.NextDouble(); Cha.Bod..C = a * RNG.XS.NextDouble();
@@ -4904,27 +4828,6 @@ namespace SlaveMatrix
} }
} }
public static void _人_腕上げ(this Cha Cha, int n, bool , bool )
{
double u = Cha.(RNG.XS.NextSign(), 3.0, RNG.XS.NextSign(), 1.5);
double u2 = Cha.(RNG.XS.NextSign(), 3.0, RNG.XS.NextSign(), 1.5);
double u3 = Cha.(RNG.XS.NextSign(), 3.0, RNG.XS.NextSign(), 1.5);
double u4 = Cha.(RNG.XS.NextSign(), 3.0, RNG.XS.NextSign(), 1.5);
Cha.Bod. = ;
Cha._人_腕上げ右(n, u, u2, u3, u4);
Cha._人_腕上げ左(n, u, u2, u3, u4);
if ()
{
Cha._人_腕上げ右(n, u, u2, u3, u4);
Cha._人_腕上げ左(n, u, u2, u3, u4);
}
else
{
Cha._人_腕上げ左(n, u, u2, u3, u4);
Cha._人_腕上げ右(n, u, u2, u3, u4);
}
}
public static void _0(this Cha Cha, int n, bool , bool , bool , int i1, int i2) public static void _0(this Cha Cha, int n, bool , bool , bool , int i1, int i2)
{ {
Cha.Bod. = ; Cha.Bod. = ;
@@ -8627,11 +8530,6 @@ namespace SlaveMatrix
2.(); 2.();
} }
public static void _基本左(this Cha Cha, int n, int s, double u1, double u2, double u3)
{
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.0);
}
public static void _基本右(this Cha Cha, int n, int s, double u1, double u2, double u3) public static void _基本右(this Cha Cha, int n, int s, double u1, double u2, double u3)
{ {
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.0); Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.0);
@@ -8647,21 +8545,11 @@ namespace SlaveMatrix
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.25, (int i) => 35.0, (int i) => -35.0); Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.25, (int i) => 35.0, (int i) => -35.0);
} }
public static void _波左(this Cha Cha, int n, int s, double u1, double u2, double u3)
{
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.25, (int i) => System.Math.Sin(i) * 80.0);
}
public static void _波右(this Cha Cha, int n, int s, double u1, double u2, double u3) public static void _波右(this Cha Cha, int n, int s, double u1, double u2, double u3)
{ {
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.25, (int i) => System.Math.Sin(i) * 80.0); Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.25, (int i) => System.Math.Sin(i) * 80.0);
} }
public static void _ピーン左(this Cha Cha, int n, int s, double u1, double u2, double u3)
{
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.0, (int i) => 0.0, (int i) => 25.0.GetRanAngle());
}
public static void _ピーン右(this Cha Cha, int n, int s, double u1, double u2, double u3) public static void _ピーン右(this Cha Cha, int n, int s, double u1, double u2, double u3)
{ {
Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.0, (int i) => 0.0, (int i) => 25.0.GetRanAngle()); Cha.(n, s, u1, u2, u3, 20.0.GetRanAngle(), 0.0, (int i) => 0.0, (int i) => 25.0.GetRanAngle());
@@ -8682,25 +8570,6 @@ namespace SlaveMatrix
Cha._0(i2, n, RNG.XS.NextSign(), Cha.(RNG.XS.NextSign(), 1.5, RNG.XS.NextSign(), 0.25), Cha.(RNG.XS.NextSign(), 1.5, RNG.XS.NextSign(), 0.25), Cha.(RNG.XS.NextSign(), 1.5, RNG.XS.NextSign(), 0.25)); Cha._0(i2, n, RNG.XS.NextSign(), Cha.(RNG.XS.NextSign(), 1.5, RNG.XS.NextSign(), 0.25), Cha.(RNG.XS.NextSign(), 1.5, RNG.XS.NextSign(), 0.25), Cha.(RNG.XS.NextSign(), 1.5, RNG.XS.NextSign(), 0.25));
} }
public static void _0(this Cha c, int i, int n, int s, double u1, double u2, double u3)
{
switch (i)
{
case 0:
c._基本左(n, s, u1, u2, u3);
break;
case 1:
c._S字左(n, s, u1, u2, u3);
break;
case 2:
c._波左(n, s, u1, u2, u3);
break;
case 3:
c._ピーン左(n, s, u1, u2, u3);
break;
}
}
public static void _0(this Cha c, int i, int n, int s, double u1, double u2, double u3) public static void _0(this Cha c, int i, int n, int s, double u1, double u2, double u3)
{ {
switch (i) switch (i)

View File

@@ -691,30 +691,11 @@ namespace SlaveMatrix
return (T)src.FirstOrDefault((Ele e) => e is T && e. == ); return (T)src.FirstOrDefault((Ele e) => e is T && e. == );
} }
public static T GetEle<T>(this IEnumerable<Ele> src, Func<T, bool> con) where T : Ele
{
if (src == null)
{
return null;
}
return (T)src.FirstOrDefault((Ele e) => e is T && con((T)e));
}
public static IEnumerable<T> GetEles<T>(this IEnumerable<Ele> src) where T : Ele public static IEnumerable<T> GetEles<T>(this IEnumerable<Ele> src) where T : Ele
{ {
return src?.Where((Ele e) => e is T).Cast<T>(); return src?.Where((Ele e) => e is T).Cast<T>();
} }
public static IEnumerable<T> GetEles<T>(this IEnumerable<Ele> src, bool ) where T : Ele
{
return src?.Where((Ele e) => e is T && e. == ).Cast<T>();
}
public static IEnumerable<T> GetEles<T>(this IEnumerable<Ele> src, Func<T, bool> con) where T : Ele
{
return src?.Where((Ele e) => e is T && con((T)e)).Cast<T>();
}
public static void SetEle<T>(this IEnumerable<Ele> src, Action<T> a) where T : Ele public static void SetEle<T>(this IEnumerable<Ele> src, Action<T> a) where T : Ele
{ {
T ele = src.GetEle<T>(); T ele = src.GetEle<T>();
@@ -778,48 +759,6 @@ namespace SlaveMatrix
} }
} }
public static T GetEleL<T>(this IEnumerable<Ele> src) where T : Ele
{
if (src == null)
{
return null;
}
return (T)src.LastOrDefault((Ele e) => e is T);
}
public static T GetEleL<T>(this IEnumerable<Ele> src, bool ) where T : Ele
{
if (src == null)
{
return null;
}
return (T)src.LastOrDefault((Ele e) => e is T && e. == );
}
public static T GetEleL<T>(this IEnumerable<Ele> src, Func<T, bool> con) where T : Ele
{
if (src == null)
{
return null;
}
return (T)src.LastOrDefault((Ele e) => e is T && con((T)e));
}
public static IEnumerable<T> GetElesL<T>(this IEnumerable<Ele> src) where T : Ele
{
return src?.Where((Ele e) => e is T).Cast<T>();
}
public static IEnumerable<T> GetElesL<T>(this IEnumerable<Ele> src, bool ) where T : Ele
{
return src?.Where((Ele e) => e is T && e. == ).Cast<T>();
}
public static IEnumerable<T> GetElesL<T>(this IEnumerable<Ele> src, Func<T, bool> con) where T : Ele
{
return src?.Where((Ele e) => e is T && con((T)e)).Cast<T>();
}
public static void 0(this IEnumerable<Ele> es, Are Are) public static void 0(this IEnumerable<Ele> es, Are Are)
{ {
foreach (Ele e in es) foreach (Ele e in es)
@@ -878,16 +817,6 @@ namespace SlaveMatrix
return (ConnectionInfo)Enum.Parse(t, s); return (ConnectionInfo)Enum.Parse(t, s);
} }
public static object GetField(this Type Type, object Object, string Name)
{
return Type.GetField(Name, bf).GetValue(Object);
}
public static object GetProperty(this Type Type, object Object, string Name)
{
return Type.GetProperty(Name, bf).GetValue(Object, null);
}
public static Color BlendP1(this Color Cd, Color Cs) public static Color BlendP1(this Color Cd, Color Cs)
{ {
double num = (double)(int)Cd.A / 255.0; double num = (double)(int)Cd.A / 255.0;

View File

@@ -2113,10 +2113,6 @@ namespace SlaveMatrix
PlayerStamina.Leave(); PlayerStamina.Leave();
} }
public TrainingUI()
{
}
public TrainingUI(Med Med, Are Are, InfoPanel ip) public TrainingUI(Med Med, Are Are, InfoPanel ip)
{ {
TrainingUI 調UI2 = this; TrainingUI 調UI2 = this;

Binary file not shown.

File diff suppressed because it is too large Load Diff