started cleaning up the scene graph
This commit is contained in:
@@ -121,11 +121,11 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Par item in pars.EnumAllPar())
|
||||
{
|
||||
if (item.HitColor != Color.Transparent)
|
||||
if (item.GetHitColor() != Color.Transparent)
|
||||
{
|
||||
Med.RemUniqueColor(item.HitColor);
|
||||
Med.RemUniqueColor(item.GetHitColor());
|
||||
}
|
||||
item.HitColor = Med.GetUniqueColor();
|
||||
item.SetHitColor(Med.GetUniqueColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Par item in pars.EnumAllPar())
|
||||
{
|
||||
BaseColors.Add(item.BrushColor);
|
||||
BaseColors.Add(item.GetBrushColor());
|
||||
OverColors.Add(BaseColors.Last().FuncHSV(delegate(Hsv hsv)
|
||||
{
|
||||
hsv.Hue += 30;
|
||||
@@ -40,17 +40,17 @@ namespace _2DGAMELIB
|
||||
hsv.Val += 100;
|
||||
return hsv;
|
||||
}));
|
||||
TextColors.Add(item.IsParT() ? item.ToParT().TextColor : Color.Empty);
|
||||
TextColors.Add(item.IsParT() ? item.ToParT().GetTextColor() : Color.Empty);
|
||||
}
|
||||
Over = delegate
|
||||
{
|
||||
int num4 = 0;
|
||||
foreach (Par item2 in pars.EnumAllPar())
|
||||
{
|
||||
item2.BrushColor = OverColors[num4];
|
||||
item2.SetBrushColor(OverColors[num4]);
|
||||
if (item2.IsParT())
|
||||
{
|
||||
item2.ToParT().TextColor = TextColors[num4].Reverse();
|
||||
item2.ToParT().SetTextColor(TextColors[num4].Reverse());
|
||||
}
|
||||
num4++;
|
||||
}
|
||||
@@ -60,10 +60,10 @@ namespace _2DGAMELIB
|
||||
int num3 = 0;
|
||||
foreach (Par item3 in pars.EnumAllPar())
|
||||
{
|
||||
item3.BrushColor = PushColors[num3];
|
||||
item3.SetBrushColor(PushColors[num3]);
|
||||
if (item3.IsParT())
|
||||
{
|
||||
item3.ToParT().TextColor = TextColors[num3].Reverse();
|
||||
item3.ToParT().SetTextColor(TextColors[num3].Reverse());
|
||||
}
|
||||
num3++;
|
||||
}
|
||||
@@ -73,10 +73,10 @@ namespace _2DGAMELIB
|
||||
int num2 = 0;
|
||||
foreach (Par item4 in pars.EnumAllPar())
|
||||
{
|
||||
item4.BrushColor = OverColors[num2];
|
||||
item4.SetBrushColor(OverColors[num2]);
|
||||
if (item4.IsParT())
|
||||
{
|
||||
item4.ToParT().TextColor = TextColors[num2].Reverse();
|
||||
item4.ToParT().SetTextColor(TextColors[num2].Reverse());
|
||||
}
|
||||
num2++;
|
||||
}
|
||||
@@ -86,10 +86,10 @@ namespace _2DGAMELIB
|
||||
int num = 0;
|
||||
foreach (Par item5 in pars.EnumAllPar())
|
||||
{
|
||||
item5.BrushColor = BaseColors[num];
|
||||
item5.SetBrushColor(BaseColors[num]);
|
||||
if (item5.IsParT())
|
||||
{
|
||||
item5.ToParT().TextColor = TextColors[num];
|
||||
item5.ToParT().SetTextColor(TextColors[num]);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
|
||||
@@ -27,139 +27,31 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public double PositionSize
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.PositionSize = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetAngleBase(double value)
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SetAngleBase(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D PositionVector
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.PositionVector = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSizeBase(double value)
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SetSizeBase(value);
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.AngleBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSizeYCont(double value)
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SetSizeYCont(value);
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.AngleCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SizeBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SizeCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SizeXBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SizeXCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SizeYBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.SizeYCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Dra
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.Dra = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
item.Hit = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Par> EnumAllPar()
|
||||
public IEnumerable<Par> EnumAllPar()
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
@@ -201,26 +93,6 @@ namespace _2DGAMELIB
|
||||
parss.Add(Pars);
|
||||
}
|
||||
|
||||
public List<string> GetHitTags(ref Color HitColor)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
list.AddRange(item.GetHitTags(ref HitColor));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Par> GetHitPars(ref Color HitColor)
|
||||
{
|
||||
List<Par> list = new List<Par>();
|
||||
foreach (Pars item in parss)
|
||||
{
|
||||
list.AddRange(item.GetHitPars(ref HitColor));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool IsHit(ref Color HitColor)
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
|
||||
@@ -21,53 +21,49 @@ namespace _2DGAMELIB
|
||||
|
||||
public Dictionary<Pars, Par> pr;
|
||||
|
||||
public int CountX => difs.Count;
|
||||
public int GetCountX()
|
||||
{
|
||||
return difs.Count;
|
||||
}
|
||||
|
||||
public int CountY
|
||||
{
|
||||
get
|
||||
{
|
||||
if (difs.Count > 0)
|
||||
{
|
||||
return difs[IndexX].Count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public int GetCountY()
|
||||
{
|
||||
if (difs.Count > 0)
|
||||
{
|
||||
return difs[GetIndexX()].Count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int IndexX
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!(ValueX >= 1.0))
|
||||
{
|
||||
return (int)((double)CountX * ValueX);
|
||||
}
|
||||
return CountX - 1;
|
||||
}
|
||||
set
|
||||
{
|
||||
ValueX = (double)value / (double)CountX;
|
||||
}
|
||||
}
|
||||
public int GetIndexX()
|
||||
{
|
||||
if (!(ValueX >= 1.0))
|
||||
{
|
||||
return (int)((double)GetCountX() * ValueX);
|
||||
}
|
||||
return GetCountX() - 1;
|
||||
}
|
||||
|
||||
public int IndexY
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!(ValueY >= 1.0))
|
||||
{
|
||||
return (int)((double)CountY * ValueY);
|
||||
}
|
||||
return CountY - 1;
|
||||
}
|
||||
set
|
||||
{
|
||||
ValueY = (double)value / (double)CountY;
|
||||
}
|
||||
}
|
||||
public void SetIndexX(int value)
|
||||
{
|
||||
ValueX = (double)value / (double)GetCountX();
|
||||
}
|
||||
|
||||
public Dif this[int Index]
|
||||
public int GetIndexY()
|
||||
{
|
||||
if (!(ValueY >= 1.0))
|
||||
{
|
||||
return (int)((double)GetCountY() * ValueY);
|
||||
}
|
||||
return GetCountY() - 1;
|
||||
}
|
||||
|
||||
public void SetIndexY(int value)
|
||||
{
|
||||
ValueY = (double)value / (double)GetCountY();
|
||||
}
|
||||
|
||||
public Dif this[int Index]
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -79,155 +75,46 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public Pars Current => difs[IndexX][IndexY];
|
||||
public Pars GetCurrent()
|
||||
{
|
||||
return difs[GetIndexX()][GetIndexY()];
|
||||
}
|
||||
|
||||
public double PositionSize
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.PositionSize = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetAngleBase(double value)
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SetAngleBase(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D PositionVector
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.PositionVector = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSizeBase(double value)
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SetSizeBase(value);
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.AngleBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSizeYCont(double value)
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SetSizeYCont(value);
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.AngleCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Par GetCurJoinRoot()
|
||||
{
|
||||
Pars current = GetCurrent();
|
||||
if (pr.ContainsKey(current))
|
||||
{
|
||||
return pr[current];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public double SizeBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SizeBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SizeCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SizeXBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SizeXCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SizeYBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.SizeYCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Dra
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.Dra = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
dif.Hit = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public Par CurJoinRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
Pars current = Current;
|
||||
if (pr.ContainsKey(current))
|
||||
{
|
||||
return pr[current];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
[JsonIgnore]
|
||||
public IEnumerable<Par> EnumJoinRoot => pr.Values;
|
||||
public IEnumerable<Par> EnumAllPar()
|
||||
{
|
||||
@@ -287,11 +174,11 @@ namespace _2DGAMELIB
|
||||
|
||||
public void Draw(RenderArea Are)
|
||||
{
|
||||
Are.Draw(Current);
|
||||
Are.Draw(GetCurrent());
|
||||
}
|
||||
public void Draw(AreM AreM)
|
||||
{
|
||||
AreM.Draw(Current);
|
||||
AreM.Draw(GetCurrent());
|
||||
}
|
||||
|
||||
private Par GetJoinRoot(Pars ps)
|
||||
@@ -304,13 +191,13 @@ namespace _2DGAMELIB
|
||||
Par[] array2 = array;
|
||||
foreach (Par p0 in array2)
|
||||
{
|
||||
Vector2D p = p0.Position;
|
||||
if (array.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance))))
|
||||
Vector2D p = p0.GetPosition();
|
||||
if (array.All((Par p1) => p0 == p1 || p1.GetJP().All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance))))
|
||||
{
|
||||
return p0;
|
||||
}
|
||||
}
|
||||
Par par = array.FirstOrDefault((Par e) => e.JP.Count > 0);
|
||||
Par par = array.FirstOrDefault((Par e) => e.GetJP().Count > 0);
|
||||
if (par != null)
|
||||
{
|
||||
return par;
|
||||
@@ -335,12 +222,12 @@ namespace _2DGAMELIB
|
||||
|
||||
public void JoinP()
|
||||
{
|
||||
pj[Current].JoinP();
|
||||
pj[GetCurrent()].JoinP();
|
||||
}
|
||||
|
||||
public void JoinPA()
|
||||
{
|
||||
pj[Current].JoinPA();
|
||||
pj[GetCurrent()].JoinPA();
|
||||
}
|
||||
|
||||
public void JoinPAall()
|
||||
@@ -351,17 +238,9 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public void JoinPA(Pars ps)
|
||||
{
|
||||
if (pj.ContainsKey(ps))
|
||||
{
|
||||
pj[ps].JoinPA();
|
||||
}
|
||||
}
|
||||
|
||||
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.GetHitColor() == HitColor);
|
||||
}
|
||||
|
||||
public bool IsHit(ref Color HitColor)
|
||||
|
||||
@@ -81,29 +81,29 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2D TL1 => frame1.OP[0].ps[0];
|
||||
private Vector2D TL1 => frame1.GetOP()[0].ps[0];
|
||||
|
||||
private Vector2D TR1 => frame1.OP[0].ps[1];
|
||||
private Vector2D TR1 => frame1.GetOP()[0].ps[1];
|
||||
|
||||
private Vector2D BR1 => frame1.OP[0].ps[2];
|
||||
private Vector2D BR1 => frame1.GetOP()[0].ps[2];
|
||||
|
||||
private Vector2D BL1 => frame1.OP[0].ps[3];
|
||||
private Vector2D BL1 => frame1.GetOP()[0].ps[3];
|
||||
|
||||
private Vector2D TL2 => frame2.OP[0].ps[0];
|
||||
private Vector2D TL2 => frame2.GetOP()[0].ps[0];
|
||||
|
||||
private Vector2D TR2 => frame2.OP[0].ps[1];
|
||||
private Vector2D TR2 => frame2.GetOP()[0].ps[1];
|
||||
|
||||
private Vector2D BR2 => frame2.OP[0].ps[2];
|
||||
private Vector2D BR2 => frame2.GetOP()[0].ps[2];
|
||||
|
||||
private Vector2D BL2 => frame2.OP[0].ps[3];
|
||||
private Vector2D BL2 => frame2.GetOP()[0].ps[3];
|
||||
|
||||
private Vector2D TLG => gauge.OP[0].ps[0];
|
||||
private Vector2D TLG => gauge.GetOP()[0].ps[0];
|
||||
|
||||
private Vector2D TRG => gauge.OP[0].ps[1];
|
||||
private Vector2D TRG => gauge.GetOP()[0].ps[1];
|
||||
|
||||
private Vector2D BRG => gauge.OP[0].ps[2];
|
||||
private Vector2D BRG => gauge.GetOP()[0].ps[2];
|
||||
|
||||
private Vector2D BLG => gauge.OP[0].ps[3];
|
||||
private Vector2D BLG => gauge.GetOP()[0].ps[3];
|
||||
|
||||
private void SetLimit()
|
||||
{
|
||||
@@ -133,15 +133,15 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (Open == Open.Top || Open == Open.Bot)
|
||||
{
|
||||
gauge.SizeYCont = val;
|
||||
gauge.SetSizeYCont(val);
|
||||
}
|
||||
else if (Open == Open.Lef || Open == Open.Rig)
|
||||
{
|
||||
gauge.SizeXCont = val;
|
||||
gauge.SetSizeXCont(val);
|
||||
}
|
||||
if (knob != null)
|
||||
{
|
||||
knob.PositionBase = GetKnobPosition();
|
||||
knob.SetPositionBase(GetKnobPosition());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace _2DGAMELIB
|
||||
return (TR1 + BR1) * 0.5;
|
||||
}
|
||||
}
|
||||
return frame1.OP.GetCenter();
|
||||
return frame1.GetOP().GetCenter();
|
||||
}
|
||||
|
||||
private Vector2D GetBasePoint2()
|
||||
@@ -180,7 +180,7 @@ namespace _2DGAMELIB
|
||||
return (TL2 + BL2) * 0.5;
|
||||
}
|
||||
}
|
||||
return frame2.OP.GetCenter();
|
||||
return frame2.GetOP().GetCenter();
|
||||
}
|
||||
|
||||
private Vector2D GetBasePoint()
|
||||
@@ -199,7 +199,7 @@ namespace _2DGAMELIB
|
||||
return (TRG + BRG) * 0.5;
|
||||
}
|
||||
}
|
||||
return frame1.BasePoint;
|
||||
return frame1.GetBasePoint();
|
||||
}
|
||||
|
||||
private double GetWidthMag()
|
||||
@@ -286,71 +286,82 @@ namespace _2DGAMELIB
|
||||
base_ = new Par
|
||||
{
|
||||
Tag = Name + "_ベース",
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width,
|
||||
SizeYBase = Height,
|
||||
Closed = true,
|
||||
Pen = null,
|
||||
BrushColor = BackColor
|
||||
};
|
||||
base_.BasePointBase = base_.OP.GetCenter();
|
||||
|
||||
base_.SetInitializeOP(new Out[1] { Shas.GetSquare() });
|
||||
base_.SetPositionBase(Position);
|
||||
base_.SetSizeBase(Size);
|
||||
base_.SetSizeXBase(Width);
|
||||
base_.SetSizeYBase(Height);
|
||||
base_.SetClosed(true);
|
||||
base_.SetPen(null);
|
||||
base_.SetBrushColor(BackColor);
|
||||
|
||||
|
||||
base_.SetBasePointBase(base_.GetOP().GetCenter());
|
||||
pars.Add(base_.Tag, base_);
|
||||
frame1 = new Par
|
||||
{
|
||||
Tag = Name + "_フレーム1",
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width * GetWidthMag(),
|
||||
SizeYBase = Height * GetHeightMag(),
|
||||
Closed = true,
|
||||
Brush = null
|
||||
};
|
||||
frame1.BasePointBase = GetBasePoint1();
|
||||
|
||||
frame1.SetInitializeOP(new Out[1] { Shas.GetSquare() });
|
||||
frame1.SetPositionBase(Position);
|
||||
frame1.SetSizeBase(Size);
|
||||
frame1.SetSizeXBase(Width * GetWidthMag());
|
||||
frame1.SetSizeYBase(Height * GetHeightMag());
|
||||
frame1.SetClosed(true);
|
||||
frame1.SetBrush(null);
|
||||
|
||||
|
||||
|
||||
frame1.SetBasePointBase(GetBasePoint1());
|
||||
pars.Add(frame1.Tag, frame1);
|
||||
if (Range == Range.MinusPlus)
|
||||
{
|
||||
frame2 = new Par
|
||||
{
|
||||
Tag = Name + "_フレーム2",
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width * GetWidthMag(),
|
||||
SizeYBase = Height * GetHeightMag(),
|
||||
Closed = true,
|
||||
Brush = null
|
||||
};
|
||||
frame2.BasePointBase = GetBasePoint2();
|
||||
|
||||
frame2.SetInitializeOP(new Out[1] { Shas.GetSquare() });
|
||||
frame2.SetPositionBase(Position);
|
||||
frame2.SetSizeBase(Size);
|
||||
frame2.SetSizeXBase(Width * GetWidthMag());
|
||||
frame2.SetSizeYBase(Height * GetHeightMag());
|
||||
frame2.SetClosed(true);
|
||||
frame2.SetBrush(null);
|
||||
frame2.SetBasePointBase(GetBasePoint2());
|
||||
pars.Add(frame2.Tag, frame2);
|
||||
}
|
||||
gauge = new Par
|
||||
{
|
||||
Tag = Name + "_ゲージ",
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = GetGaugePosition(),
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width * GetWidthMag() * GetGaugeWidthMag(Margin),
|
||||
SizeYBase = Height * GetHeightMag() * GetGaugeHeightMag(Margin),
|
||||
Closed = true
|
||||
};
|
||||
gauge.BasePointBase = GetBasePoint();
|
||||
gauge.SetInitializeOP(new Out[1] { Shas.GetSquare() });
|
||||
gauge.SetPositionBase(GetGaugePosition());
|
||||
gauge.SetSizeBase(Size);
|
||||
gauge.SetSizeXBase(Width * GetWidthMag() * GetGaugeWidthMag(Margin));
|
||||
gauge.SetSizeYBase(Height * GetHeightMag() * GetGaugeHeightMag(Margin));
|
||||
gauge.SetClosed(true);
|
||||
|
||||
|
||||
gauge.SetBasePointBase(GetBasePoint());
|
||||
pars.Add(gauge.Tag, gauge);
|
||||
if (knob)
|
||||
{
|
||||
this.knob = new Par
|
||||
{
|
||||
Tag = Name + "_ノブ",
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
SizeBase = Size,
|
||||
SizeXBase = GetKnobWidthMag(Width),
|
||||
SizeYBase = GetKnobHeightMag(Height),
|
||||
Closed = true,
|
||||
BrushColor = Color.FromArgb(128, Color.White)
|
||||
};
|
||||
this.knob.BasePointBase = this.knob.OP.GetCenter();
|
||||
|
||||
this.knob.SetInitializeOP(new Out[1] { Shas.GetSquare() });
|
||||
this.knob.SetSizeBase(Size);
|
||||
this.knob.SetSizeXBase(GetKnobWidthMag(Width));
|
||||
this.knob.SetSizeYBase(GetKnobHeightMag(Height));
|
||||
this.knob.SetClosed(true);
|
||||
this.knob.SetBrushColor(Color.FromArgb(128, Color.White));
|
||||
this.knob.SetBasePointBase(this.knob.GetOP().GetCenter());
|
||||
pars.Add(this.knob.Tag, this.knob);
|
||||
}
|
||||
}
|
||||
@@ -474,10 +485,10 @@ namespace _2DGAMELIB
|
||||
{
|
||||
return Open switch
|
||||
{
|
||||
Open.Top => (0.0 - gauge.SizeY) * gauge.Size,
|
||||
Open.Bot => gauge.SizeY * gauge.Size,
|
||||
Open.Rig => gauge.SizeX * gauge.Size,
|
||||
Open.Lef => (0.0 - gauge.SizeX) * gauge.Size,
|
||||
Open.Top => (0.0 - gauge.GetSizeY()) * gauge.GetSize(),
|
||||
Open.Bot => gauge.GetSizeY() * gauge.GetSize(),
|
||||
Open.Rig => gauge.GetSizeX() * gauge.GetSize(),
|
||||
Open.Lef => (0.0 - gauge.GetSizeX()) * gauge.GetSize(),
|
||||
_ => 0.0,
|
||||
};
|
||||
}
|
||||
@@ -507,7 +518,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public bool Down(ref Color HitColor, ref Vector2D CursorPosition)
|
||||
{
|
||||
if (knob != null && knob.HitColor == HitColor)
|
||||
if (knob != null && knob.GetHitColor() == HitColor)
|
||||
{
|
||||
Grip = true;
|
||||
op = CursorPosition;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace _2DGAMELIB
|
||||
int num = 0;
|
||||
List<int> list = new List<int>();
|
||||
List<Par> list2 = EnumPar.ToList();
|
||||
foreach (Joi item in JoinRoot.JP)
|
||||
foreach (Joi item in JoinRoot.GetJP())
|
||||
{
|
||||
Vector2D v = JoinRoot.ToGlobal(item.Joint);
|
||||
int num2 = 0;
|
||||
@@ -23,7 +23,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (JoinRoot != item2)
|
||||
{
|
||||
if (v.DistanceSquared(item2.Position) <= IdentityDistance)
|
||||
if (v.DistanceSquared(item2.GetPosition()) <= IdentityDistance)
|
||||
{
|
||||
joints.Joins.Add(new Joint(JoinRoot, num, item2));
|
||||
if (!list.Contains(num2))
|
||||
@@ -59,7 +59,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
Par par = js.Joins[i].Par1;
|
||||
int num3 = 0;
|
||||
foreach (Joi item in par.JP)
|
||||
foreach (Joi item in par.GetJP())
|
||||
{
|
||||
Vector2D v = par.ToGlobal(item.Joint);
|
||||
int num4 = 0;
|
||||
@@ -68,7 +68,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (par != item2)
|
||||
{
|
||||
if (v.DistanceSquared(item2.Position) <= IdentityDistance)
|
||||
if (v.DistanceSquared(item2.GetPosition()) <= IdentityDistance)
|
||||
{
|
||||
js.Joins.Add(new Joint(par, num3, item2));
|
||||
if (!del.Contains(num4))
|
||||
@@ -108,12 +108,12 @@ namespace _2DGAMELIB
|
||||
if (JoinRoot != item2)
|
||||
{
|
||||
int num2 = 0;
|
||||
foreach (Joi item3 in item.JP)
|
||||
foreach (Joi item3 in item.GetJP())
|
||||
{
|
||||
Vector2D v = item.ToGlobal(item3.Joint);
|
||||
foreach (Par item4 in item2.EnumJoinRoot)
|
||||
{
|
||||
if (v.DistanceSquared(item4.Position) <= IdentityDistance)
|
||||
if (v.DistanceSquared(item4.GetPosition()) <= IdentityDistance)
|
||||
{
|
||||
jointsD.Joins.Add(new JointD(JoinRoot, item, num2, item2));
|
||||
if (!list.Contains(num))
|
||||
@@ -160,12 +160,12 @@ namespace _2DGAMELIB
|
||||
if (difs != item2)
|
||||
{
|
||||
int num4 = 0;
|
||||
foreach (Joi item3 in item.JP)
|
||||
foreach (Joi item3 in item.GetJP())
|
||||
{
|
||||
Vector2D v = item.ToGlobal(item3.Joint);
|
||||
foreach (Par item4 in item2.EnumJoinRoot)
|
||||
{
|
||||
if (v.DistanceSquared(item4.Position) <= IdentityDistance)
|
||||
if (v.DistanceSquared(item4.GetPosition()) <= IdentityDistance)
|
||||
{
|
||||
jsd.Joins.Add(new JointD(difs, item, num4, item2));
|
||||
if (!del.Contains(num3))
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace _2DGAMELIB
|
||||
|
||||
public void JoinP()
|
||||
{
|
||||
Difs0.Current.GetPar(Path0).SetJointP(Index, Difs1.CurJoinRoot);
|
||||
Difs0.GetCurrent().GetPar(Path0).SetJointP(Index, Difs1.GetCurJoinRoot());
|
||||
Difs1.JoinPA();
|
||||
}
|
||||
|
||||
public void JoinPA()
|
||||
{
|
||||
Difs0.Current.GetPar(Path0).SetJointPA(Index, Difs1.CurJoinRoot);
|
||||
Difs0.GetCurrent().GetPar(Path0).SetJointPA(Index, Difs1.GetCurJoinRoot());
|
||||
Difs1.JoinPA();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,62 +57,61 @@ namespace _2DGAMELIB
|
||||
|
||||
parT = new ParT
|
||||
{
|
||||
InitializeOP = array,
|
||||
BasePointBase = array[0].ps[0],
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
Closed = true,
|
||||
|
||||
|
||||
Tag = Name,
|
||||
BrushColor = BackColor,
|
||||
PenColor = FramColor,
|
||||
Font = Font,
|
||||
FontSize = TextSize,
|
||||
TextColor = TextColor,
|
||||
Text = "A"
|
||||
};
|
||||
|
||||
parT.SetFont(Font);
|
||||
parT.SetFontSize(TextSize);
|
||||
parT.SetTextColor(TextColor);
|
||||
parT.SetInitializeOP(array);
|
||||
parT.SetBasePointBase(array[0].ps[0]);
|
||||
parT.SetPositionBase(Position);
|
||||
parT.SetSizeBase(Size);
|
||||
parT.SetClosed(true);
|
||||
parT.SetBrushColor(BackColor);
|
||||
parT.SetPenColor(FramColor);
|
||||
|
||||
if (ShadColor != Color.Empty)
|
||||
{
|
||||
parT.ShadBrush = new SolidBrush(ShadColor);
|
||||
parT.SetShadBrush(new SolidBrush(ShadColor));
|
||||
}
|
||||
|
||||
|
||||
SetRect();
|
||||
Min = parT.RectSize.Y;
|
||||
Min = parT.GetRectSize().Y;
|
||||
SetText(Text);
|
||||
}
|
||||
|
||||
public void SetHitColor(ModeEventDispatcher Med)
|
||||
{
|
||||
if (parT.HitColor != Color.Transparent)
|
||||
if (parT.GetHitColor() != Color.Transparent)
|
||||
{
|
||||
Med.RemUniqueColor(parT.HitColor);
|
||||
Med.RemUniqueColor(parT.GetHitColor());
|
||||
}
|
||||
parT.HitColor = Med.GetUniqueColor();
|
||||
parT.SetHitColor(Med.GetUniqueColor());
|
||||
}
|
||||
|
||||
private void SetRect()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(parT.Text))
|
||||
{
|
||||
parT.RectSize = new Vector2D(Width, 10.0);
|
||||
parT.SetRectSize(new Vector2D(Width, 10.0));
|
||||
Vector2D_2 stringRect = parT.GetStringRect(Are.DisplayUnitScale, Are.DisplayGraphics);
|
||||
double x = ((stringRect.v2.X > Min) ? stringRect.v2.X : Min) + 0.07;
|
||||
parT.RectSize = new Vector2D(x, stringRect.v2.Y);
|
||||
parT.SetRectSize(new Vector2D(x, stringRect.v2.Y));
|
||||
}
|
||||
else
|
||||
{
|
||||
double x2 = Min + 0.07;
|
||||
parT.RectSize = new Vector2D(x2, Min);
|
||||
parT.SetRectSize(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);
|
||||
parT.GetOP()[0].ps[0] = new Vector2D(0.0, 0.0);
|
||||
parT.GetOP()[0].ps[1] = new Vector2D(parT.GetRectSize().X, 0.0);
|
||||
parT.GetOP()[0].ps[2] = new Vector2D(parT.GetRectSize().X, parT.GetRectSize().Y);
|
||||
parT.GetOP()[0].ps[3] = new Vector2D(0.0, parT.GetRectSize().Y);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -57,5 +57,6 @@ namespace _2DGAMELIB
|
||||
this.M43 = M43;
|
||||
this.M44 = M44;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Par p in ps)
|
||||
{
|
||||
p.HitColor = GetUniqueColor();
|
||||
p.SetHitColor(GetUniqueColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Par p in ps)
|
||||
{
|
||||
HitColors.Remove(p.HitColor);
|
||||
HitColors.Remove(p.GetHitColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace _2DGAMELIB
|
||||
[Serializable]
|
||||
public class Obj
|
||||
{
|
||||
public string Tag = "";
|
||||
|
||||
public OrderedDictionary<string, Difs> Difss = new OrderedDictionary<string, Difs>();
|
||||
|
||||
private Difs r;
|
||||
@@ -19,8 +17,6 @@ namespace _2DGAMELIB
|
||||
|
||||
public IEnumerable<string> Keys => Difss.Keys;
|
||||
|
||||
public IEnumerable<Difs> Values => Difss.Values;
|
||||
|
||||
public Difs this[string Name]
|
||||
{
|
||||
get
|
||||
@@ -33,58 +29,13 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public Difs this[int Index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Difss[Index];
|
||||
}
|
||||
set
|
||||
{
|
||||
Difss[Index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double PositionSize
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.PositionSize = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D PositionVector
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.PositionVector = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.AngleBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.AngleCont = value;
|
||||
value2.SetAngleBase(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,84 +46,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.SizeBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.SizeCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.SizeXBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.SizeXCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.SizeYBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.SizeYCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Dra
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.Dra = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Difs value2 in Difss.Values)
|
||||
{
|
||||
value2.Hit = value;
|
||||
value2.SetSizeBase(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,8 +101,8 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (difs.EnumJoinRoot.All(delegate(Par p0)
|
||||
{
|
||||
p = p0.Position;
|
||||
return pa.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance)));
|
||||
p = p0.GetPosition();
|
||||
return pa.All((Par p1) => p0 == p1 || p1.GetJP().All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance)));
|
||||
}))
|
||||
{
|
||||
return difs;
|
||||
|
||||
@@ -9,10 +9,6 @@ namespace _2DGAMELIB
|
||||
{
|
||||
public static class Oth
|
||||
{
|
||||
private static double s1;
|
||||
|
||||
private static double s0;
|
||||
|
||||
public static Color Reverse(this Color c)
|
||||
{
|
||||
return Color.FromArgb(c.A, 255 - c.R, 255 - c.G, 255 - c.B);
|
||||
@@ -50,7 +46,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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 * 1.01.Reciprocal()).ToPointF(), (MM[1] * Unit * 1.01).ToPointF(), Color1, Color2)
|
||||
{
|
||||
GammaCorrection = true
|
||||
};
|
||||
@@ -58,7 +54,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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 * 1.01.Reciprocal()).ToPointF(), (MM[1] * Unit * 1.01).ToPointF(), Color1, Color2)
|
||||
{
|
||||
GammaCorrection = true
|
||||
};
|
||||
@@ -66,7 +62,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private static void GetMinMaxX(Par Par, ref double MinX, ref double MaxX)
|
||||
{
|
||||
foreach (Out item in Par.OP)
|
||||
foreach (Out item in Par.GetOP())
|
||||
{
|
||||
foreach (Vector2D p in item.ps)
|
||||
{
|
||||
@@ -85,7 +81,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private static void GetMinMaxY(Par Par, ref double MinY, ref double MaxY)
|
||||
{
|
||||
foreach (Out item in Par.OP)
|
||||
foreach (Out item in Par.GetOP())
|
||||
{
|
||||
foreach (Vector2D p in item.ps)
|
||||
{
|
||||
@@ -112,7 +108,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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.GetOP().First().ps.First());
|
||||
MM = new Vector2D[2];
|
||||
MM[0].X = vector2D.X;
|
||||
MM[1].X = vector2D.X;
|
||||
@@ -121,7 +117,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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.GetOP().First().ps.First());
|
||||
MM = new Vector2D[2];
|
||||
MM[0].X = vector2D.X;
|
||||
MM[1].X = vector2D.X;
|
||||
@@ -130,7 +126,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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.GetOP().First().ps.First());
|
||||
MM = new Vector2D[2];
|
||||
MM[0].Y = vector2D.Y;
|
||||
MM[1].Y = vector2D.Y;
|
||||
@@ -140,7 +136,7 @@ namespace _2DGAMELIB
|
||||
public static void GetMiY_MaY(this Par[] Pars, out Vector2D[] MM)
|
||||
{
|
||||
Par par = Pars.First();
|
||||
Vector2D vector2D = par.ToGlobal(par.OP.First().ps.First());
|
||||
Vector2D vector2D = par.ToGlobal(par.GetOP().First().ps.First());
|
||||
MM = new Vector2D[2];
|
||||
MM[0].Y = vector2D.Y;
|
||||
MM[1].Y = vector2D.Y;
|
||||
@@ -149,7 +145,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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.GetOP().First().ps.First());
|
||||
MM = new Vector2D[2];
|
||||
MM[0].Y = vector2D.Y;
|
||||
MM[1].Y = vector2D.Y;
|
||||
@@ -186,7 +182,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public static Encoding GetEncoding(this byte[] Bytes)
|
||||
{
|
||||
byte[] array = null;
|
||||
byte[] array;
|
||||
if (Bytes.Length > 4000)
|
||||
{
|
||||
array = new byte[4000];
|
||||
@@ -339,8 +335,6 @@ namespace _2DGAMELIB
|
||||
|
||||
static Oth()
|
||||
{
|
||||
s1 = 1.01;
|
||||
s0 = s1.Reciprocal();
|
||||
}
|
||||
|
||||
public static void SaveExMod<T>(this T Obj, string Path)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,19 +9,15 @@ namespace _2DGAMELIB
|
||||
[Serializable]
|
||||
public class ParT : Par
|
||||
{
|
||||
[NonSerialized, JsonIgnore]
|
||||
private Font font = new Font("", 1f);
|
||||
|
||||
private double fontSize = 1.0;
|
||||
|
||||
private bool EditF = true;
|
||||
[NonSerialized, JsonIgnore]
|
||||
private Font font = new Font("", 1f);
|
||||
|
||||
[NonSerialized, JsonIgnore]
|
||||
private Brush brusht = new SolidBrush(Color.Black);
|
||||
|
||||
//unused
|
||||
private const double Shift = 1.0;
|
||||
|
||||
[NonSerialized, JsonIgnore]
|
||||
private Brush brushs;
|
||||
|
||||
@@ -32,127 +28,89 @@ namespace _2DGAMELIB
|
||||
|
||||
private Vector2D rectSize = Dat.Vec2DOne;
|
||||
|
||||
|
||||
public string Text = "";
|
||||
|
||||
private RectangleF rect;
|
||||
|
||||
private double us;
|
||||
|
||||
private double usx;
|
||||
|
||||
private double usy;
|
||||
|
||||
private Vector2D bp;
|
||||
|
||||
private Vector2D p;
|
||||
|
||||
private Vector2D v;
|
||||
|
||||
private double a0;
|
||||
|
||||
private double a1;
|
||||
|
||||
private double M11;
|
||||
|
||||
private double M12;
|
||||
|
||||
private float af;
|
||||
|
||||
private float xf;
|
||||
|
||||
private float yf;
|
||||
|
||||
private bool EditT = true;
|
||||
|
||||
private bool EditTS = true;
|
||||
private bool EditF = true;
|
||||
|
||||
private CharacterRange[] crr = new CharacterRange[1];
|
||||
|
||||
public Font Font
|
||||
{
|
||||
get { return font; }
|
||||
set
|
||||
{
|
||||
if (font != value && font != null)
|
||||
{
|
||||
font.Dispose();
|
||||
}
|
||||
font = value;
|
||||
EditF = true;
|
||||
}
|
||||
}
|
||||
|
||||
public double FontSize
|
||||
{
|
||||
get { return fontSize; }
|
||||
set
|
||||
{
|
||||
fontSize = value;
|
||||
EditF = true;
|
||||
}
|
||||
}
|
||||
public void SetFont(Font value)
|
||||
{
|
||||
if (font != value && font != null)
|
||||
{
|
||||
font.Dispose();
|
||||
}
|
||||
font = value;
|
||||
EditF = true;
|
||||
}
|
||||
|
||||
public Brush TextBrush
|
||||
{
|
||||
get { return brusht; }
|
||||
set
|
||||
{
|
||||
if (brusht != value && brusht != null)
|
||||
{
|
||||
brusht.Dispose();
|
||||
}
|
||||
brusht = value;
|
||||
}
|
||||
}
|
||||
public double GetFontSize()
|
||||
{ return fontSize; }
|
||||
|
||||
public Color TextColor
|
||||
{
|
||||
get { return ((SolidBrush)brusht).Color; }
|
||||
set { ((SolidBrush)brusht).Color = value; }
|
||||
}
|
||||
public void SetFontSize(double value)
|
||||
{
|
||||
fontSize = value;
|
||||
EditF = true;
|
||||
}
|
||||
|
||||
public Brush ShadBrush
|
||||
{
|
||||
get { return brushs; }
|
||||
set
|
||||
{
|
||||
if (brushs != value && brushs != null)
|
||||
brushs.Dispose();
|
||||
public void SetTextBrush(Brush value)
|
||||
{
|
||||
if (brusht != value && brusht != null)
|
||||
{
|
||||
brusht.Dispose();
|
||||
}
|
||||
brusht = value;
|
||||
}
|
||||
|
||||
brushs = value;
|
||||
}
|
||||
}
|
||||
public Color GetTextColor()
|
||||
{ return ((SolidBrush)brusht).Color; }
|
||||
|
||||
public Color ShadColor
|
||||
{
|
||||
get { return ((SolidBrush)brushs).Color; }
|
||||
set { ((SolidBrush)brushs).Color = value; }
|
||||
}
|
||||
public void SetTextColor(Color value)
|
||||
{ ((SolidBrush)brusht).Color = value; }
|
||||
|
||||
public StringFormat StringFormat
|
||||
{
|
||||
get { return stringformat; }
|
||||
set
|
||||
{
|
||||
if (stringformat != value && stringformat != null)
|
||||
{
|
||||
stringformat.Dispose();
|
||||
}
|
||||
stringformat = value;
|
||||
}
|
||||
}
|
||||
public void SetShadBrush(Brush value)
|
||||
{
|
||||
if (brushs != value && brushs != null)
|
||||
brushs.Dispose();
|
||||
|
||||
public Vector2D RectSize
|
||||
{
|
||||
get { return rectSize; }
|
||||
set
|
||||
{
|
||||
rectSize = value;
|
||||
EditT = true;
|
||||
}
|
||||
}
|
||||
brushs = value;
|
||||
}
|
||||
|
||||
public new void SetDefault()
|
||||
public Color GetShadColor()
|
||||
{ return ((SolidBrush)brushs).Color; }
|
||||
|
||||
public void SetShadColor(Color value)
|
||||
{ ((SolidBrush)brushs).Color = value; }
|
||||
|
||||
public StringFormat GetStringFormat()
|
||||
{ return stringformat; }
|
||||
|
||||
public void SetStringFormat(StringFormat value)
|
||||
{
|
||||
if (stringformat != value && stringformat != null)
|
||||
{
|
||||
stringformat.Dispose();
|
||||
}
|
||||
stringformat = value;
|
||||
}
|
||||
|
||||
public Vector2D GetRectSize()
|
||||
{ return rectSize; }
|
||||
|
||||
public void SetRectSize(Vector2D value)
|
||||
{
|
||||
rectSize = value;
|
||||
}
|
||||
|
||||
public new void SetDefault()
|
||||
{
|
||||
base.SetDefault();
|
||||
|
||||
@@ -174,7 +132,6 @@ namespace _2DGAMELIB
|
||||
stringformat = new StringFormat();
|
||||
|
||||
EditF = true;
|
||||
EditT = true;
|
||||
EditTS = true;
|
||||
}
|
||||
|
||||
@@ -194,16 +151,16 @@ namespace _2DGAMELIB
|
||||
fontSize = ParT.fontSize;
|
||||
|
||||
if (ParT.font != null)
|
||||
Font = ParT.font.Copy();
|
||||
SetFont(ParT.font.Copy());
|
||||
|
||||
if (ParT.brusht != null)
|
||||
TextBrush = ParT.brusht.Copy();
|
||||
SetTextBrush(ParT.brusht.Copy());
|
||||
|
||||
if (ParT.brushs != null)
|
||||
ShadBrush = ParT.brushs.Copy();
|
||||
SetShadBrush(ParT.brushs.Copy());
|
||||
|
||||
if (ParT.stringformat != null)
|
||||
StringFormat = ParT.stringformat.Copy();
|
||||
SetStringFormat(ParT.stringformat.Copy());
|
||||
|
||||
positionT = ParT.positionT;
|
||||
rectSize = ParT.rectSize;
|
||||
@@ -212,11 +169,14 @@ namespace _2DGAMELIB
|
||||
|
||||
public new void Draw(double Unit, Graphics Graphics)
|
||||
{
|
||||
if (Edit)
|
||||
EditT = true;
|
||||
Calculation(Unit);
|
||||
|
||||
if (EditS || EditPS)
|
||||
EditTS = true;
|
||||
if (EditF || EditTS)
|
||||
{
|
||||
RebuildFont((float)(Unit * base.GetSize() * fontSize));
|
||||
EditF = false;
|
||||
EditTS = false;
|
||||
}
|
||||
|
||||
base.Draw(Unit, Graphics);
|
||||
DrawString(Unit, Graphics);
|
||||
@@ -224,30 +184,25 @@ namespace _2DGAMELIB
|
||||
|
||||
private void Calculation(double Unit)
|
||||
{
|
||||
us = Unit * base.Size;
|
||||
usx = us * base.SizeX;
|
||||
usy = us * base.SizeY;
|
||||
double us = Unit * base.GetSize();
|
||||
double usx = us * base.GetSizeX();
|
||||
double usy = us * base.GetSizeY();
|
||||
|
||||
bp = base.BasePoint;
|
||||
bp = base.GetBasePoint();
|
||||
bp.X *= usx;
|
||||
bp.Y *= usy;
|
||||
|
||||
a0 = base.Angle;
|
||||
a1 = System.Math.PI * a0 / 180.0;
|
||||
M11 = System.Math.Cos(a1);
|
||||
M12 = System.Math.Sin(a1);
|
||||
double a1 = System.Math.PI * base.GetAngle() / 180.0;
|
||||
double M11 = System.Math.Cos(a1);
|
||||
double M12 = System.Math.Sin(a1);
|
||||
|
||||
Vector2D v;
|
||||
v.X = bp.X * M11 + bp.Y * (0.0 - M12);
|
||||
v.Y = bp.X * M12 + bp.Y * M11;
|
||||
|
||||
p = base.Position;
|
||||
Vector2D p = base.GetPosition();
|
||||
bp.X = p.X * Unit - v.X;
|
||||
bp.Y = p.Y * Unit - v.Y;
|
||||
|
||||
rect.X = (float)(positionT.X * us);
|
||||
rect.Y = (float)(positionT.Y * us);
|
||||
rect.Width = (float)(rectSize.X * us);
|
||||
rect.Height = (float)(rectSize.Y * us);
|
||||
}
|
||||
|
||||
private void RebuildFont(double scaledSize)
|
||||
@@ -273,60 +228,47 @@ namespace _2DGAMELIB
|
||||
|
||||
private void DrawString(double Unit, Graphics Graphics)
|
||||
{
|
||||
if (EditT)
|
||||
{
|
||||
Calculation(Unit);
|
||||
EditT = false;
|
||||
}
|
||||
|
||||
if (EditF || EditTS)
|
||||
{
|
||||
RebuildFont((float)(us * fontSize));
|
||||
EditF = false;
|
||||
EditTS = false;
|
||||
}
|
||||
|
||||
af = (float)a0;
|
||||
xf = (float)base.SizeX;
|
||||
yf = (float)base.SizeY;
|
||||
|
||||
RectangleF rect = default(RectangleF);
|
||||
rect.X = (float)(positionT.X * Unit * base.GetSize());
|
||||
rect.Y = (float)(positionT.Y * Unit * base.GetSize());
|
||||
rect.Width = (float)(rectSize.X * Unit * base.GetSize());
|
||||
rect.Height = (float)(rectSize.Y * Unit * base.GetSize());
|
||||
|
||||
if (brushs != null)
|
||||
{
|
||||
GraphicsState state = Graphics.Save();
|
||||
|
||||
Graphics.TranslateTransform((float)(bp.X + Shift), (float)(bp.Y + Shift));
|
||||
Graphics.RotateTransform(af);
|
||||
Graphics.ScaleTransform(xf, yf);
|
||||
Graphics.TranslateTransform((float)(bp.X + 1.0), (float)(bp.Y + 1.0));
|
||||
Graphics.RotateTransform((float)base.GetAngle());
|
||||
Graphics.ScaleTransform((float)base.GetSizeX(), (float)base.GetSizeY());
|
||||
Graphics.DrawString(Text, font, brushs, rect, stringformat);
|
||||
|
||||
Graphics.Restore(state);
|
||||
}
|
||||
|
||||
{
|
||||
GraphicsState state = Graphics.Save();
|
||||
|
||||
Graphics.TranslateTransform((float)bp.X, (float)bp.Y);
|
||||
Graphics.RotateTransform(af);
|
||||
Graphics.ScaleTransform(xf, yf);
|
||||
Graphics.RotateTransform((float)base.GetAngle());
|
||||
Graphics.ScaleTransform((float)base.GetSizeX(), (float)base.GetSizeY());
|
||||
Graphics.DrawString(Text, font, brusht, rect, stringformat);
|
||||
|
||||
Graphics.Restore(state);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D_2 GetStringRect(double Unit, Graphics Graphics)
|
||||
{
|
||||
double num = Unit * base.Size;
|
||||
double num = Unit * base.GetSize();
|
||||
|
||||
if (EditF || EditS || EditPS || EditTS)
|
||||
if (EditF || EditTS)
|
||||
{
|
||||
RebuildFont((float)(num * fontSize));
|
||||
EditF = false;
|
||||
EditTS = false;
|
||||
}
|
||||
|
||||
crr[0] = new CharacterRange(0, Text.Length);
|
||||
CharacterRange[] crr = new CharacterRange[]{
|
||||
new CharacterRange(0, Text.Length)
|
||||
};
|
||||
|
||||
stringformat.SetMeasurableCharacterRanges(crr);
|
||||
|
||||
RectangleF layoutRect = new RectangleF(
|
||||
@@ -376,8 +318,9 @@ namespace _2DGAMELIB
|
||||
@out.ps.Add(stringRectPoints[2].AddXY(x, num) + vector2D);
|
||||
@out.ps.Add(stringRectPoints[3].AddY(num) + vector2D);
|
||||
|
||||
base.OP.Add(@out);
|
||||
base.GetOP().Add(@out);
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
@@ -16,227 +16,54 @@ namespace _2DGAMELIB
|
||||
|
||||
public Pars Parent => parent;
|
||||
|
||||
public IEnumerable<string> Keys => pars.Keys;
|
||||
|
||||
public IEnumerable<object> Values => pars.Values;
|
||||
|
||||
public double PositionSize
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).PositionSize = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).PositionSize = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetAngleBase(double value)
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SetAngleBase(value);
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SetAngleBase(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D PositionVector
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).PositionVector = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).PositionVector = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSizeBase(double value)
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SetSizeBase(value);
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SetSizeBase(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).AngleBase = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).AngleBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSizeYCont(double value)
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SetSizeYCont(value);
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SetSizeYCont(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double AngleCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).AngleCont = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).AngleCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SizeBase = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SizeBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SizeCont = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SizeCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SizeXBase = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SizeXBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeXCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SizeXCont = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SizeXCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYBase
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SizeYBase = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SizeYBase = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double SizeYCont
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).SizeYCont = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).SizeYCont = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Dra
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).Dra = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).Dra = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
{
|
||||
((Pars)value2).Hit = value;
|
||||
}
|
||||
else if (value2 is Par)
|
||||
{
|
||||
((Par)value2).Hit = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object this[string Name]
|
||||
public object this[string Name]
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -248,18 +75,6 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public object this[int Index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return pars[Index];
|
||||
}
|
||||
set
|
||||
{
|
||||
pars[Index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParent(Pars Parent)
|
||||
{
|
||||
parent = Parent;
|
||||
@@ -353,12 +168,6 @@ namespace _2DGAMELIB
|
||||
{
|
||||
}
|
||||
|
||||
public Pars(Par Par)
|
||||
{
|
||||
Tag = Par.Tag;
|
||||
Add(Par.Tag, Par);
|
||||
}
|
||||
|
||||
public Pars(ParT ParT)
|
||||
{
|
||||
Tag = ParT.Tag;
|
||||
@@ -448,42 +257,6 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> GetHitTags(ref Color HitColor)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
Par par;
|
||||
if (value is Pars)
|
||||
{
|
||||
list.AddRange(((Pars)value).GetHitTags(ref HitColor));
|
||||
}
|
||||
else if (value is Par && (par = (Par)value).HitColor == HitColor)
|
||||
{
|
||||
list.Add(par.Tag);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Par> GetHitPars(ref Color HitColor)
|
||||
{
|
||||
List<Par> list = new List<Par>();
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
Par item;
|
||||
if (value is Pars)
|
||||
{
|
||||
list.AddRange(((Pars)value).GetHitPars(ref HitColor));
|
||||
}
|
||||
else if (value is Par && (item = (Par)value).HitColor == HitColor)
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool IsHit(ref Color HitColor)
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
@@ -492,7 +265,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (value is Par && ((Par)value).HitColor == HitColor)
|
||||
if (value is Par && ((Par)value).GetHitColor() == HitColor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -564,91 +337,4 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class pars
|
||||
{
|
||||
public static Pars ToPars(this object obj)
|
||||
{
|
||||
return (Pars)obj;
|
||||
}
|
||||
|
||||
public static ParT ToParT(this object obj)
|
||||
{
|
||||
return (ParT)obj;
|
||||
}
|
||||
|
||||
public static Par ToPar(this object obj)
|
||||
{
|
||||
return (Par)obj;
|
||||
}
|
||||
|
||||
public static Pen Copy(this Pen Pen)
|
||||
{
|
||||
return new Pen(Pen.Color, Pen.Width)
|
||||
{
|
||||
EndCap = Pen.EndCap,
|
||||
StartCap = Pen.StartCap
|
||||
};
|
||||
}
|
||||
|
||||
public static Brush Copy(this Brush Brush)
|
||||
{
|
||||
if (Brush is SolidBrush)
|
||||
{
|
||||
return new SolidBrush(((SolidBrush)Brush).Color);
|
||||
}
|
||||
if (Brush is LinearGradientBrush)
|
||||
{
|
||||
LinearGradientBrush linearGradientBrush = (LinearGradientBrush)Brush;
|
||||
LinearGradientBrush linearGradientBrush2 = new LinearGradientBrush(linearGradientBrush.Rectangle, Color.Black, Color.White, 0f);
|
||||
linearGradientBrush2.Blend = linearGradientBrush.Blend;
|
||||
linearGradientBrush2.GammaCorrection = linearGradientBrush.GammaCorrection;
|
||||
linearGradientBrush2.InterpolationColors = linearGradientBrush.InterpolationColors;
|
||||
linearGradientBrush2.LinearColors = new Color[linearGradientBrush.LinearColors.Length];
|
||||
linearGradientBrush.LinearColors.CopyTo(linearGradientBrush2.LinearColors, 0);
|
||||
linearGradientBrush2.Transform = linearGradientBrush.Transform;
|
||||
linearGradientBrush2.WrapMode = linearGradientBrush.WrapMode;
|
||||
return linearGradientBrush2;
|
||||
}
|
||||
if (Brush is PathGradientBrush)
|
||||
{
|
||||
PathGradientBrush pathGradientBrush = (PathGradientBrush)Brush;
|
||||
PathGradientBrush pathGradientBrush2 = new PathGradientBrush(new GraphicsPath());
|
||||
pathGradientBrush2.Blend = pathGradientBrush.Blend;
|
||||
pathGradientBrush2.CenterColor = pathGradientBrush.CenterColor;
|
||||
pathGradientBrush2.CenterPoint = pathGradientBrush.CenterPoint;
|
||||
pathGradientBrush2.FocusScales = pathGradientBrush.FocusScales;
|
||||
pathGradientBrush2.InterpolationColors = pathGradientBrush.InterpolationColors;
|
||||
pathGradientBrush2.SurroundColors = new Color[pathGradientBrush.SurroundColors.Length];
|
||||
pathGradientBrush.SurroundColors.CopyTo(pathGradientBrush2.SurroundColors, 0);
|
||||
pathGradientBrush2.Transform = pathGradientBrush.Transform;
|
||||
pathGradientBrush2.WrapMode = pathGradientBrush.WrapMode;
|
||||
return pathGradientBrush2;
|
||||
}
|
||||
if (Brush is TextureBrush)
|
||||
{
|
||||
TextureBrush textureBrush = (TextureBrush)Brush;
|
||||
return new TextureBrush(textureBrush.Image)
|
||||
{
|
||||
Transform = textureBrush.Transform,
|
||||
WrapMode = textureBrush.WrapMode
|
||||
};
|
||||
}
|
||||
if (Brush is HatchBrush)
|
||||
{
|
||||
HatchBrush hatchBrush = (HatchBrush)Brush;
|
||||
return new HatchBrush(hatchBrush.HatchStyle, hatchBrush.ForegroundColor, hatchBrush.BackgroundColor);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Font Copy(this Font Font)
|
||||
{
|
||||
return new Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit, Font.GdiCharSet, Font.GdiVerticalFont);
|
||||
}
|
||||
|
||||
public static StringFormat Copy(this StringFormat StringFormat)
|
||||
{
|
||||
return new StringFormat(StringFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Par item in but.Pars.EnumAllPar())
|
||||
{
|
||||
item.BrushColor = but.OverColors[i];
|
||||
item.SetBrushColor(but.OverColors[i]);
|
||||
i++;
|
||||
}
|
||||
return;
|
||||
@@ -84,7 +84,7 @@ namespace _2DGAMELIB
|
||||
j = 0;
|
||||
foreach (Par item2 in but.Pars.EnumAllPar())
|
||||
{
|
||||
item2.BrushColor = but.OverColors[j];
|
||||
item2.SetBrushColor(but.OverColors[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (Par item in but.Pars.EnumAllPar())
|
||||
{
|
||||
item.BrushColor = but.BaseColors[i];
|
||||
item.SetBrushColor(but.BaseColors[i]);
|
||||
i++;
|
||||
}
|
||||
return;
|
||||
@@ -155,7 +155,7 @@ namespace _2DGAMELIB
|
||||
j = 0;
|
||||
foreach (Par item2 in but.Pars.EnumAllPar())
|
||||
{
|
||||
item2.BrushColor = but.BaseColors[j];
|
||||
item2.SetBrushColor(but.BaseColors[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,10 +59,10 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (feed != null)
|
||||
{
|
||||
a0 = feed.BrushColor.A;
|
||||
a1 = feed.PenColor.A;
|
||||
feed.BrushColor = Color.FromArgb(0, feed.BrushColor);
|
||||
feed.PenColor = Color.FromArgb(0, feed.PenColor);
|
||||
a0 = feed.GetBrushColor().A;
|
||||
a1 = feed.GetPenColor().A;
|
||||
feed.SetBrushColor(Color.FromArgb(0, feed.GetBrushColor()));
|
||||
feed.SetPenColor(Color.FromArgb(0, feed.GetPenColor()));
|
||||
}
|
||||
text = new string(' ', Space) + value;
|
||||
Max = text.Length;
|
||||
@@ -85,10 +85,10 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (feed != null)
|
||||
{
|
||||
a0 = feed.BrushColor.A;
|
||||
a1 = feed.PenColor.A;
|
||||
feed.BrushColor = Color.FromArgb(0, feed.BrushColor);
|
||||
feed.PenColor = Color.FromArgb(0, feed.PenColor);
|
||||
a0 = feed.GetBrushColor().A;
|
||||
a1 = feed.GetPenColor().A;
|
||||
feed.SetBrushColor(Color.FromArgb(0, feed.GetBrushColor()));
|
||||
feed.SetPenColor(Color.FromArgb(0, feed.GetPenColor()));
|
||||
}
|
||||
text = new string(' ', Space) + value;
|
||||
Max = text.Length;
|
||||
@@ -113,14 +113,14 @@ namespace _2DGAMELIB
|
||||
{
|
||||
get
|
||||
{
|
||||
return parT.PositionBase;
|
||||
return parT.GetPositionBase();
|
||||
}
|
||||
set
|
||||
{
|
||||
parT.PositionBase = value;
|
||||
parT.SetPositionBase(value);
|
||||
if (feed != null)
|
||||
{
|
||||
feed.PositionBase = parT.ToGlobal(parT.OP[0].ps[2] * 0.95);
|
||||
feed.SetPositionBase(parT.ToGlobal(parT.GetOP()[0].ps[2] * 0.95));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,22 +209,23 @@ namespace _2DGAMELIB
|
||||
parT = new ParT
|
||||
{
|
||||
Tag = Name,
|
||||
InitializeOP = array,
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
Closed = true,
|
||||
BrushColor = BackColor,
|
||||
Font = Font,
|
||||
FontSize = TextSize,
|
||||
TextColor = TextColor,
|
||||
RectSize = new Vector2D(Width, Height),
|
||||
Text = Text
|
||||
};
|
||||
ParT.OP.ScalingX(ParT.BasePointBase, Width);
|
||||
ParT.OP.ScalingY(ParT.BasePointBase, Height);
|
||||
|
||||
parT.SetFont(Font);
|
||||
parT.SetFontSize(TextSize);
|
||||
parT.SetTextColor(TextColor);
|
||||
parT.SetRectSize(new Vector2D(Width, Height));
|
||||
parT.SetInitializeOP(array);
|
||||
parT.SetPositionBase(Position);
|
||||
parT.SetSizeBase(Size);
|
||||
parT.SetClosed(true);
|
||||
parT.SetBrushColor(BackColor);
|
||||
ParT.GetOP().ScalingX(ParT.GetBasePointBase(), Width);
|
||||
ParT.GetOP().ScalingY(ParT.GetBasePointBase(), Height);
|
||||
if (ShadColor != Color.Empty)
|
||||
{
|
||||
parT.ShadBrush = new SolidBrush(ShadColor);
|
||||
parT.SetShadBrush(new SolidBrush(ShadColor));
|
||||
}
|
||||
pars.Add(parT.Tag, parT);
|
||||
}
|
||||
@@ -235,27 +236,28 @@ namespace _2DGAMELIB
|
||||
feed = new Par
|
||||
{
|
||||
Tag = Name + "_Feed",
|
||||
InitializeOP = array,
|
||||
BasePointBase = array.GetCenter(),
|
||||
PositionBase = parT.ToGlobal(parT.OP[0].ps[2] * 0.96),
|
||||
SizeBase = Size * 0.07,
|
||||
SizeYBase = 0.9,
|
||||
Closed = true,
|
||||
PenColor = Color.FromArgb(0, Color.Black),
|
||||
BrushColor = Color.FromArgb(0, FeedColor),
|
||||
Hit = false
|
||||
};
|
||||
feed.OP.ReverseY(feed.BasePointBase);
|
||||
feed.SetInitializeOP(array);
|
||||
feed.SetBasePointBase(array.GetCenter());
|
||||
feed.SetPositionBase(parT.ToGlobal(parT.GetOP()[0].ps[2] * 0.96));
|
||||
feed.SetSizeBase(Size * 0.07);
|
||||
feed.SetSizeYBase(0.9);
|
||||
feed.SetClosed(true);
|
||||
feed.SetPenColor(Color.FromArgb(0, Color.Black));
|
||||
feed.SetBrushColor(Color.FromArgb(0, FeedColor));
|
||||
|
||||
feed.GetOP().ReverseY(feed.GetBasePointBase());
|
||||
pars.Add(feed.Tag, feed);
|
||||
}
|
||||
|
||||
public void SetHitColor(ModeEventDispatcher Med)
|
||||
{
|
||||
if (parT.HitColor != Color.Transparent)
|
||||
if (parT.GetHitColor() != Color.Transparent)
|
||||
{
|
||||
Med.RemUniqueColor(parT.HitColor);
|
||||
Med.RemUniqueColor(parT.GetHitColor());
|
||||
}
|
||||
parT.HitColor = Med.GetUniqueColor();
|
||||
parT.SetHitColor(Med.GetUniqueColor());
|
||||
}
|
||||
|
||||
public void Progression(FPS FPS)
|
||||
@@ -273,8 +275,8 @@ namespace _2DGAMELIB
|
||||
f1 = true;
|
||||
if (feed != null)
|
||||
{
|
||||
feed.BrushColor = Color.FromArgb(a0, feed.BrushColor);
|
||||
feed.PenColor = Color.FromArgb(a1, feed.PenColor);
|
||||
feed.SetBrushColor(Color.FromArgb(a0, feed.GetBrushColor()));
|
||||
feed.SetPenColor(Color.FromArgb(a1, feed.GetPenColor()));
|
||||
}
|
||||
if (Done != null)
|
||||
{
|
||||
@@ -285,14 +287,14 @@ namespace _2DGAMELIB
|
||||
else if (feed != null && feed.Dra)
|
||||
{
|
||||
mv.GetValue(FPS);
|
||||
feed.BrushColor = Color.FromArgb((int)mv.Value, feed.BrushColor);
|
||||
feed.PenColor = Color.FromArgb(feed.BrushColor.A, feed.PenColor);
|
||||
feed.SetBrushColor(Color.FromArgb((int)mv.Value, feed.GetBrushColor()));
|
||||
feed.SetPenColor(Color.FromArgb(feed.GetBrushColor().A, feed.GetPenColor()));
|
||||
}
|
||||
}
|
||||
|
||||
public bool Down(ref Color HitColor)
|
||||
{
|
||||
if (parT.HitColor == HitColor)
|
||||
if (parT.GetHitColor() == HitColor)
|
||||
{
|
||||
f2 = true;
|
||||
if (!f1 && Speed == speed)
|
||||
@@ -306,14 +308,14 @@ namespace _2DGAMELIB
|
||||
|
||||
public bool Up(ref Color HitColor)
|
||||
{
|
||||
if (f1 && f2 && parT.HitColor == HitColor && Speed == speed)
|
||||
if (f1 && f2 && parT.GetHitColor() == HitColor && Speed == speed)
|
||||
{
|
||||
f1 = false;
|
||||
f2 = false;
|
||||
if (feed != null)
|
||||
{
|
||||
feed.BrushColor = Color.FromArgb(0, feed.BrushColor);
|
||||
feed.PenColor = Color.FromArgb(feed.BrushColor.A, feed.PenColor);
|
||||
feed.SetBrushColor(Color.FromArgb(0, feed.GetBrushColor()));
|
||||
feed.SetPenColor(Color.FromArgb(feed.GetBrushColor().A, feed.GetPenColor()));
|
||||
mv.ResetValue();
|
||||
}
|
||||
Action(this);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
@@ -208,5 +209,95 @@ namespace _2DGAMELIB
|
||||
Vec.Add(ref result, ref BasePoint, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Pars ToPars(this object obj)
|
||||
{
|
||||
return (Pars)obj;
|
||||
}
|
||||
|
||||
public static ParT ToParT(this object obj)
|
||||
{
|
||||
return (ParT)obj;
|
||||
}
|
||||
|
||||
public static Par ToPar(this object obj)
|
||||
{
|
||||
return (Par)obj;
|
||||
}
|
||||
|
||||
public static Pen Copy(this Pen Pen)
|
||||
{
|
||||
return new Pen(Pen.Color, Pen.Width)
|
||||
{
|
||||
EndCap = Pen.EndCap,
|
||||
StartCap = Pen.StartCap
|
||||
};
|
||||
}
|
||||
|
||||
public static Brush Copy(this Brush Brush)
|
||||
{
|
||||
if (Brush is SolidBrush)
|
||||
{
|
||||
return new SolidBrush(((SolidBrush)Brush).Color);
|
||||
}
|
||||
if (Brush is LinearGradientBrush)
|
||||
{
|
||||
LinearGradientBrush linearGradientBrush = (LinearGradientBrush)Brush;
|
||||
LinearGradientBrush linearGradientBrush2 = new LinearGradientBrush(linearGradientBrush.Rectangle, Color.Black, Color.White, 0f);
|
||||
linearGradientBrush2.Blend = linearGradientBrush.Blend;
|
||||
linearGradientBrush2.GammaCorrection = linearGradientBrush.GammaCorrection;
|
||||
linearGradientBrush2.InterpolationColors = linearGradientBrush.InterpolationColors;
|
||||
linearGradientBrush2.LinearColors = new Color[linearGradientBrush.LinearColors.Length];
|
||||
linearGradientBrush.LinearColors.CopyTo(linearGradientBrush2.LinearColors, 0);
|
||||
linearGradientBrush2.Transform = linearGradientBrush.Transform;
|
||||
linearGradientBrush2.WrapMode = linearGradientBrush.WrapMode;
|
||||
return linearGradientBrush2;
|
||||
}
|
||||
if (Brush is PathGradientBrush)
|
||||
{
|
||||
PathGradientBrush pathGradientBrush = (PathGradientBrush)Brush;
|
||||
PathGradientBrush pathGradientBrush2 = new PathGradientBrush(new GraphicsPath());
|
||||
pathGradientBrush2.Blend = pathGradientBrush.Blend;
|
||||
pathGradientBrush2.CenterColor = pathGradientBrush.CenterColor;
|
||||
pathGradientBrush2.CenterPoint = pathGradientBrush.CenterPoint;
|
||||
pathGradientBrush2.FocusScales = pathGradientBrush.FocusScales;
|
||||
pathGradientBrush2.InterpolationColors = pathGradientBrush.InterpolationColors;
|
||||
pathGradientBrush2.SurroundColors = new Color[pathGradientBrush.SurroundColors.Length];
|
||||
pathGradientBrush.SurroundColors.CopyTo(pathGradientBrush2.SurroundColors, 0);
|
||||
pathGradientBrush2.Transform = pathGradientBrush.Transform;
|
||||
pathGradientBrush2.WrapMode = pathGradientBrush.WrapMode;
|
||||
return pathGradientBrush2;
|
||||
}
|
||||
if (Brush is TextureBrush)
|
||||
{
|
||||
TextureBrush textureBrush = (TextureBrush)Brush;
|
||||
return new TextureBrush(textureBrush.Image)
|
||||
{
|
||||
Transform = textureBrush.Transform,
|
||||
WrapMode = textureBrush.WrapMode
|
||||
};
|
||||
}
|
||||
if (Brush is HatchBrush)
|
||||
{
|
||||
HatchBrush hatchBrush = (HatchBrush)Brush;
|
||||
return new HatchBrush(hatchBrush.HatchStyle, hatchBrush.ForegroundColor, hatchBrush.BackgroundColor);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Font Copy(this Font Font)
|
||||
{
|
||||
return new Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit, Font.GdiCharSet, Font.GdiVerticalFont);
|
||||
}
|
||||
|
||||
public static StringFormat Copy(this StringFormat StringFormat)
|
||||
{
|
||||
return new StringFormat(StringFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user