Renamed Pars to PartGroup
This commit is contained in:
@@ -40,12 +40,12 @@ namespace _2DGAMELIB
|
||||
hitGraphics.PixelOffsetMode = PixelOffsetMode.None;
|
||||
}
|
||||
|
||||
public new void Draw(Pars Pars)
|
||||
public new void Draw(PartGroup PartGroup)
|
||||
{
|
||||
Pars.Draw(unitS, displayGraphics);
|
||||
PartGroup.Draw(unitS, displayGraphics);
|
||||
if (hitGraphics != null)
|
||||
{
|
||||
Pars.DrawH(hitUnitScale, hitGraphics);
|
||||
PartGroup.DrawH(hitUnitScale, hitGraphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private Color hc = Color.Transparent;
|
||||
|
||||
protected Pars pars;
|
||||
protected PartGroup partGroup;
|
||||
|
||||
protected Action<But> Over = delegate
|
||||
{
|
||||
@@ -48,23 +48,23 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public Pars Pars => pars;
|
||||
public PartGroup PartGroup => partGroup;
|
||||
|
||||
public But(ShapePartT ShapePartT, Action<But> Action)
|
||||
{
|
||||
pars = new Pars(ShapePartT);
|
||||
partGroup = new PartGroup(ShapePartT);
|
||||
this.Action = Action;
|
||||
}
|
||||
|
||||
public bool Move(ref Color HitColor)
|
||||
{
|
||||
if (Dra && !f2 && pars.IsHit(ref HitColor))
|
||||
if (Dra && !f2 && partGroup.IsHit(ref HitColor))
|
||||
{
|
||||
f2 = true;
|
||||
Over(this);
|
||||
return true;
|
||||
}
|
||||
if (Dra && f2 && !pars.IsHit(ref HitColor))
|
||||
if (Dra && f2 && !partGroup.IsHit(ref HitColor))
|
||||
{
|
||||
f1 = false;
|
||||
f2 = false;
|
||||
@@ -88,7 +88,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public bool Down(ref Color HitColor)
|
||||
{
|
||||
if (Dra && !f1 && pars.IsHit(ref HitColor))
|
||||
if (Dra && !f1 && partGroup.IsHit(ref HitColor))
|
||||
{
|
||||
f1 = true;
|
||||
Push(this);
|
||||
@@ -99,7 +99,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public bool Up(ref Color HitColor)
|
||||
{
|
||||
if (Dra && f1 && pars.IsHit(ref HitColor))
|
||||
if (Dra && f1 && partGroup.IsHit(ref HitColor))
|
||||
{
|
||||
f1 = false;
|
||||
Release(this);
|
||||
@@ -113,13 +113,13 @@ namespace _2DGAMELIB
|
||||
{
|
||||
if (dra)
|
||||
{
|
||||
Are.Draw(pars);
|
||||
Are.Draw(partGroup);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHitColor(ModeEventDispatcher Med)
|
||||
{
|
||||
foreach (ShapePart item in pars.EnumAllPar())
|
||||
foreach (ShapePart item in partGroup.EnumAllPar())
|
||||
{
|
||||
if (item.HitColor != Color.Transparent)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
pars.Dispose();
|
||||
partGroup.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private void Setting()
|
||||
{
|
||||
foreach (ShapePart item in pars.EnumAllPar())
|
||||
foreach (ShapePart item in partGroup.EnumAllPar())
|
||||
{
|
||||
BaseColors.Add(item.BrushColor);
|
||||
OverColors.Add(BaseColors.Last().FuncHSV(delegate(Hsv hsv)
|
||||
@@ -45,7 +45,7 @@ namespace _2DGAMELIB
|
||||
Over = delegate
|
||||
{
|
||||
int num4 = 0;
|
||||
foreach (ShapePart item2 in pars.EnumAllPar())
|
||||
foreach (ShapePart item2 in partGroup.EnumAllPar())
|
||||
{
|
||||
item2.BrushColor = OverColors[num4];
|
||||
if (item2.IsParT())
|
||||
@@ -58,7 +58,7 @@ namespace _2DGAMELIB
|
||||
Push = delegate
|
||||
{
|
||||
int num3 = 0;
|
||||
foreach (ShapePart item3 in pars.EnumAllPar())
|
||||
foreach (ShapePart item3 in partGroup.EnumAllPar())
|
||||
{
|
||||
item3.BrushColor = PushColors[num3];
|
||||
if (item3.IsParT())
|
||||
@@ -71,7 +71,7 @@ namespace _2DGAMELIB
|
||||
Release = delegate
|
||||
{
|
||||
int num2 = 0;
|
||||
foreach (ShapePart item4 in pars.EnumAllPar())
|
||||
foreach (ShapePart item4 in partGroup.EnumAllPar())
|
||||
{
|
||||
item4.BrushColor = OverColors[num2];
|
||||
if (item4.IsParT())
|
||||
@@ -84,7 +84,7 @@ namespace _2DGAMELIB
|
||||
Out = delegate
|
||||
{
|
||||
int num = 0;
|
||||
foreach (ShapePart item5 in pars.EnumAllPar())
|
||||
foreach (ShapePart item5 in partGroup.EnumAllPar())
|
||||
{
|
||||
item5.BrushColor = BaseColors[num];
|
||||
if (item5.IsParT())
|
||||
|
||||
@@ -9,13 +9,13 @@ namespace _2DGAMELIB
|
||||
{
|
||||
public string Tag = "";
|
||||
|
||||
private List<Pars> parss = new List<Pars>();
|
||||
private List<PartGroup> parss = new List<PartGroup>();
|
||||
|
||||
public List<Pars> Parss => parss;
|
||||
public List<PartGroup> Parss => parss;
|
||||
|
||||
public int Count => parss.Count;
|
||||
|
||||
public Pars this[int Index]
|
||||
public PartGroup this[int Index]
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.PositionSize = value;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.PositionVector = value;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.AngleBase = value;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.AngleCont = value;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SizeBase = value;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SizeCont = value;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SizeXBase = value;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SizeXCont = value;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SizeYBase = value;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SizeYCont = value;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.Dra = value;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.Hit = value;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public IEnumerable<ShapePart> EnumAllPar()
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
foreach (ShapePart item2 in item.EnumAllPar())
|
||||
{
|
||||
@@ -172,7 +172,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void SetDefault()
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.SetDefault();
|
||||
}
|
||||
@@ -190,21 +190,21 @@ namespace _2DGAMELIB
|
||||
private void Copy(Dif Dif)
|
||||
{
|
||||
Tag = Dif.Tag;
|
||||
foreach (Pars item in Dif.parss)
|
||||
foreach (PartGroup item in Dif.parss)
|
||||
{
|
||||
parss.Add(new Pars(item));
|
||||
parss.Add(new PartGroup(item));
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Pars Pars)
|
||||
public void Add(PartGroup PartGroup)
|
||||
{
|
||||
parss.Add(Pars);
|
||||
parss.Add(PartGroup);
|
||||
}
|
||||
|
||||
public List<string> GetHitTags(ref Color HitColor)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
list.AddRange(item.GetHitTags(ref HitColor));
|
||||
}
|
||||
@@ -214,7 +214,7 @@ namespace _2DGAMELIB
|
||||
public List<ShapePart> GetHitPars(ref Color HitColor)
|
||||
{
|
||||
List<ShapePart> list = new List<ShapePart>();
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
list.AddRange(item.GetHitPars(ref HitColor));
|
||||
}
|
||||
@@ -223,7 +223,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public bool IsHit(ref Color HitColor)
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
if (item.IsHit(ref HitColor))
|
||||
{
|
||||
@@ -235,7 +235,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void ReverseX()
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.ReverseX();
|
||||
}
|
||||
@@ -243,7 +243,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void ReverseY()
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.ReverseY();
|
||||
}
|
||||
@@ -251,7 +251,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (Pars item in parss)
|
||||
foreach (PartGroup item in parss)
|
||||
{
|
||||
item.Dispose();
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace _2DGAMELIB
|
||||
|
||||
private List<Dif> difs = new List<Dif>();
|
||||
|
||||
public Dictionary<Pars, Joints> pj;
|
||||
public Dictionary<PartGroup, Joints> pj;
|
||||
|
||||
public Dictionary<Pars, ShapePart> pr;
|
||||
public Dictionary<PartGroup, ShapePart> pr;
|
||||
|
||||
public int CountX => difs.Count;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public Pars Current => difs[IndexX][IndexY];
|
||||
public PartGroup Current => difs[IndexX][IndexY];
|
||||
|
||||
public double PositionSize
|
||||
{
|
||||
@@ -218,7 +218,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
get
|
||||
{
|
||||
Pars current = Current;
|
||||
PartGroup current = Current;
|
||||
if (pr.ContainsKey(current))
|
||||
{
|
||||
return pr[current];
|
||||
@@ -240,11 +240,11 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Pars> EnumAllPars()
|
||||
public IEnumerable<PartGroup> EnumAllPars()
|
||||
{
|
||||
foreach (Dif dif in difs)
|
||||
{
|
||||
foreach (Pars item in dif.Parss)
|
||||
foreach (PartGroup item in dif.Parss)
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ namespace _2DGAMELIB
|
||||
AreM.Draw(Current);
|
||||
}
|
||||
|
||||
private ShapePart GetJoinRoot(Pars ps)
|
||||
private ShapePart GetJoinRoot(PartGroup ps)
|
||||
{
|
||||
ShapePart[] array = ps.EnumAllPar().ToArray();
|
||||
if (array.Length <= 1)
|
||||
@@ -320,9 +320,9 @@ namespace _2DGAMELIB
|
||||
|
||||
public void SetJoints()
|
||||
{
|
||||
pj = new Dictionary<Pars, Joints>();
|
||||
pr = new Dictionary<Pars, ShapePart>();
|
||||
foreach (Pars item in EnumAllPars())
|
||||
pj = new Dictionary<PartGroup, Joints>();
|
||||
pr = new Dictionary<PartGroup, ShapePart>();
|
||||
foreach (PartGroup item in EnumAllPars())
|
||||
{
|
||||
ShapePart joinRoot = GetJoinRoot(item);
|
||||
if (joinRoot != null)
|
||||
@@ -351,7 +351,7 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public void JoinPA(Pars ps)
|
||||
public void JoinPA(PartGroup ps)
|
||||
{
|
||||
if (pj.ContainsKey(ps))
|
||||
{
|
||||
@@ -361,7 +361,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public ShapePart GetHitPar_(Color HitColor)
|
||||
{
|
||||
return difs.FirstOrDefault((Dif d) => d.IsHit(ref HitColor)).Parss.FirstOrDefault((Pars ps) => ps.IsHit(ref HitColor)).EnumAllPar().FirstOrDefault((ShapePart e) => e.HitColor == HitColor);
|
||||
return difs.FirstOrDefault((Dif d) => d.IsHit(ref HitColor)).Parss.FirstOrDefault((PartGroup ps) => ps.IsHit(ref HitColor)).EnumAllPar().FirstOrDefault((ShapePart e) => e.HitColor == HitColor);
|
||||
}
|
||||
|
||||
public bool IsHit(ref Color HitColor)
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public class Gau
|
||||
{
|
||||
private Pars pars;
|
||||
private PartGroup _partGroup;
|
||||
|
||||
private ShapePart base_;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private Color MinusColor2;
|
||||
|
||||
public Pars Pars => pars;
|
||||
public PartGroup PartGroup => _partGroup;
|
||||
|
||||
public ShapePart Base => base_;
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private void ParSetting(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, ref Color BackColor, bool knob)
|
||||
{
|
||||
pars = new Pars();
|
||||
_partGroup = new PartGroup();
|
||||
base_ = new ShapePart
|
||||
{
|
||||
Tag = Name + "_ベース",
|
||||
@@ -296,7 +296,7 @@ namespace _2DGAMELIB
|
||||
BrushColor = BackColor
|
||||
};
|
||||
base_.BasePointBase = base_.OP.GetCenter();
|
||||
pars.Add(base_.Tag, base_);
|
||||
_partGroup.Add(base_.Tag, base_);
|
||||
frame1 = new ShapePart
|
||||
{
|
||||
Tag = Name + "_フレーム1",
|
||||
@@ -309,7 +309,7 @@ namespace _2DGAMELIB
|
||||
Brush = null
|
||||
};
|
||||
frame1.BasePointBase = GetBasePoint1();
|
||||
pars.Add(frame1.Tag, frame1);
|
||||
_partGroup.Add(frame1.Tag, frame1);
|
||||
if (Range == Range.MinusPlus)
|
||||
{
|
||||
frame2 = new ShapePart
|
||||
@@ -324,7 +324,7 @@ namespace _2DGAMELIB
|
||||
Brush = null
|
||||
};
|
||||
frame2.BasePointBase = GetBasePoint2();
|
||||
pars.Add(frame2.Tag, frame2);
|
||||
_partGroup.Add(frame2.Tag, frame2);
|
||||
}
|
||||
gauge = new ShapePart
|
||||
{
|
||||
@@ -337,7 +337,7 @@ namespace _2DGAMELIB
|
||||
Closed = true
|
||||
};
|
||||
gauge.BasePointBase = GetBasePoint();
|
||||
pars.Add(gauge.Tag, gauge);
|
||||
_partGroup.Add(gauge.Tag, gauge);
|
||||
if (knob)
|
||||
{
|
||||
this.knob = new ShapePart
|
||||
@@ -351,7 +351,7 @@ namespace _2DGAMELIB
|
||||
BrushColor = Color.FromArgb(128, Color.White)
|
||||
};
|
||||
this.knob.BasePointBase = this.knob.OP.GetCenter();
|
||||
pars.Add(this.knob.Tag, this.knob);
|
||||
_partGroup.Add(this.knob.Tag, this.knob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
pars.Dispose();
|
||||
_partGroup.Dispose();
|
||||
PlusBrush.Dispose();
|
||||
if (MinusBrush != null)
|
||||
{
|
||||
|
||||
@@ -6,15 +6,15 @@ using System.Drawing.Drawing2D;
|
||||
namespace _2DGAMELIB
|
||||
{
|
||||
[Serializable]
|
||||
public class Pars
|
||||
public class PartGroup
|
||||
{
|
||||
private Pars parent;
|
||||
private PartGroup parent;
|
||||
|
||||
public string Tag = "";
|
||||
|
||||
public OrderedDictionary<string, object> pars = new OrderedDictionary<string, object>();
|
||||
|
||||
public Pars Parent => parent;
|
||||
public PartGroup Parent => parent;
|
||||
|
||||
public IEnumerable<string> Keys => pars.Keys;
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).PositionSize = value;
|
||||
((PartGroup)value2).PositionSize = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -44,9 +44,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).PositionVector = value;
|
||||
((PartGroup)value2).PositionVector = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -62,9 +62,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).AngleBase = value;
|
||||
((PartGroup)value2).AngleBase = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -80,9 +80,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).AngleCont = value;
|
||||
((PartGroup)value2).AngleCont = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -98,9 +98,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).SizeBase = value;
|
||||
((PartGroup)value2).SizeBase = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -116,9 +116,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).SizeCont = value;
|
||||
((PartGroup)value2).SizeCont = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -134,9 +134,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).SizeXBase = value;
|
||||
((PartGroup)value2).SizeXBase = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -152,9 +152,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).SizeXCont = value;
|
||||
((PartGroup)value2).SizeXCont = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -170,9 +170,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).SizeYBase = value;
|
||||
((PartGroup)value2).SizeYBase = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -188,9 +188,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).SizeYCont = value;
|
||||
((PartGroup)value2).SizeYCont = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -206,9 +206,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).Dra = value;
|
||||
((PartGroup)value2).Dra = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -224,9 +224,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value2 in pars.Values)
|
||||
{
|
||||
if (value2 is Pars)
|
||||
if (value2 is PartGroup)
|
||||
{
|
||||
((Pars)value2).Hit = value;
|
||||
((PartGroup)value2).Hit = value;
|
||||
}
|
||||
else if (value2 is ShapePart)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParent(Pars Parent)
|
||||
public void SetParent(PartGroup Parent)
|
||||
{
|
||||
parent = Parent;
|
||||
}
|
||||
@@ -282,24 +282,24 @@ namespace _2DGAMELIB
|
||||
pars.Add(Name, ShapePartT);
|
||||
}
|
||||
|
||||
public void Add(string Name, Pars Pars)
|
||||
public void Add(string Name, PartGroup PartGroup)
|
||||
{
|
||||
Pars.SetParent(this);
|
||||
pars.Add(Name, Pars);
|
||||
PartGroup.SetParent(this);
|
||||
pars.Add(Name, PartGroup);
|
||||
}
|
||||
|
||||
public void Add(Pars Pars)
|
||||
public void Add(PartGroup PartGroup)
|
||||
{
|
||||
Pars.SetParent(this);
|
||||
pars.Add(Pars.Tag, Pars);
|
||||
PartGroup.SetParent(this);
|
||||
pars.Add(PartGroup.Tag, PartGroup);
|
||||
}
|
||||
|
||||
public void Remove(string Name)
|
||||
{
|
||||
object obj = pars[Name];
|
||||
if (obj is Pars)
|
||||
if (obj is PartGroup)
|
||||
{
|
||||
((Pars)obj).SetParent(null);
|
||||
((PartGroup)obj).SetParent(null);
|
||||
}
|
||||
else if (obj is ShapePartT)
|
||||
{
|
||||
@@ -316,9 +316,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
foreach (ShapePart item in ((Pars)value).EnumAllPar())
|
||||
foreach (ShapePart item in ((PartGroup)value).EnumAllPar())
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
@@ -334,9 +334,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
((Pars)value).SetDefault();
|
||||
((PartGroup)value).SetDefault();
|
||||
}
|
||||
else if (value is ShapePartT)
|
||||
{
|
||||
@@ -349,36 +349,36 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public Pars()
|
||||
public PartGroup()
|
||||
{
|
||||
}
|
||||
|
||||
public Pars(ShapePart ShapePart)
|
||||
public PartGroup(ShapePart ShapePart)
|
||||
{
|
||||
Tag = ShapePart.Tag;
|
||||
Add(ShapePart.Tag, ShapePart);
|
||||
}
|
||||
|
||||
public Pars(ShapePartT ShapePartT)
|
||||
public PartGroup(ShapePartT ShapePartT)
|
||||
{
|
||||
Tag = ShapePartT.Tag;
|
||||
Add(ShapePartT.Tag, ShapePartT);
|
||||
}
|
||||
|
||||
public Pars(Pars Pars)
|
||||
public PartGroup(PartGroup PartGroup)
|
||||
{
|
||||
Copy(Pars);
|
||||
Copy(PartGroup);
|
||||
}
|
||||
|
||||
private void Copy(Pars Pars)
|
||||
private void Copy(PartGroup PartGroup)
|
||||
{
|
||||
Tag = Pars.Tag;
|
||||
foreach (string key in Pars.pars.Keys)
|
||||
Tag = PartGroup.Tag;
|
||||
foreach (string key in PartGroup.pars.Keys)
|
||||
{
|
||||
object obj = Pars.pars[key];
|
||||
if (obj is Pars)
|
||||
object obj = PartGroup.pars[key];
|
||||
if (obj is PartGroup)
|
||||
{
|
||||
Add(key, ((Pars)obj).Clone());
|
||||
Add(key, ((PartGroup)obj).Clone());
|
||||
}
|
||||
else if (obj is ShapePartT)
|
||||
{
|
||||
@@ -391,16 +391,16 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
private Pars Clone()
|
||||
private PartGroup Clone()
|
||||
{
|
||||
Pars pars2 = new Pars();
|
||||
PartGroup pars2 = new PartGroup();
|
||||
pars2.Tag = Tag;
|
||||
foreach (string key in pars.Keys)
|
||||
{
|
||||
object obj = pars[key];
|
||||
if (obj is Pars)
|
||||
if (obj is PartGroup)
|
||||
{
|
||||
pars2.Add(key, ((Pars)obj).Clone());
|
||||
pars2.Add(key, ((PartGroup)obj).Clone());
|
||||
}
|
||||
else if (obj is ShapePartT)
|
||||
{
|
||||
@@ -418,9 +418,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
((Pars)value).Draw(Unit, Graphics);
|
||||
((PartGroup)value).Draw(Unit, Graphics);
|
||||
}
|
||||
else if (value is ShapePartT)
|
||||
{
|
||||
@@ -437,9 +437,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
((Pars)value).DrawH(Unit, Graphics);
|
||||
((PartGroup)value).DrawH(Unit, Graphics);
|
||||
}
|
||||
else if (value is ShapePart)
|
||||
{
|
||||
@@ -454,9 +454,9 @@ namespace _2DGAMELIB
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
ShapePart shapePart;
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
list.AddRange(((Pars)value).GetHitTags(ref HitColor));
|
||||
list.AddRange(((PartGroup)value).GetHitTags(ref HitColor));
|
||||
}
|
||||
else if (value is ShapePart && (shapePart = (ShapePart)value).HitColor == HitColor)
|
||||
{
|
||||
@@ -472,9 +472,9 @@ namespace _2DGAMELIB
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
ShapePart item;
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
list.AddRange(((Pars)value).GetHitPars(ref HitColor));
|
||||
list.AddRange(((PartGroup)value).GetHitPars(ref HitColor));
|
||||
}
|
||||
else if (value is ShapePart && (item = (ShapePart)value).HitColor == HitColor)
|
||||
{
|
||||
@@ -488,7 +488,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars && ((Pars)value).IsHit(ref HitColor))
|
||||
if (value is PartGroup && ((PartGroup)value).IsHit(ref HitColor))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -508,9 +508,9 @@ namespace _2DGAMELIB
|
||||
private ShapePart GetPar(int l, List<int> Path)
|
||||
{
|
||||
object obj = pars[Path[l]];
|
||||
if (obj is Pars)
|
||||
if (obj is PartGroup)
|
||||
{
|
||||
return ((Pars)obj).GetPar(l + 1, Path);
|
||||
return ((PartGroup)obj).GetPar(l + 1, Path);
|
||||
}
|
||||
return (ShapePart)obj;
|
||||
}
|
||||
@@ -519,9 +519,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
((Pars)value).ReverseX();
|
||||
((PartGroup)value).ReverseX();
|
||||
}
|
||||
else if (value is ShapePart)
|
||||
{
|
||||
@@ -534,9 +534,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
((Pars)value).ReverseY();
|
||||
((PartGroup)value).ReverseY();
|
||||
}
|
||||
else if (value is ShapePart)
|
||||
{
|
||||
@@ -549,9 +549,9 @@ namespace _2DGAMELIB
|
||||
{
|
||||
foreach (object value in pars.Values)
|
||||
{
|
||||
if (value is Pars)
|
||||
if (value is PartGroup)
|
||||
{
|
||||
((Pars)value).Dispose();
|
||||
((PartGroup)value).Dispose();
|
||||
}
|
||||
else if (value is ShapePartT)
|
||||
{
|
||||
@@ -564,11 +564,11 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class pars
|
||||
public static class PartGroupUtils
|
||||
{
|
||||
public static Pars ToPars(this object obj)
|
||||
public static PartGroup ToPars(this object obj)
|
||||
{
|
||||
return (Pars)obj;
|
||||
return (PartGroup)obj;
|
||||
}
|
||||
|
||||
public static ShapePartT ToParT(this object obj)
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace _2DGAMELIB
|
||||
{
|
||||
@@ -32,7 +33,68 @@ namespace _2DGAMELIB
|
||||
if (_typeOnlyMap.TryGetValue(typeName, out var type))
|
||||
return type;
|
||||
|
||||
var fullName = typeName;
|
||||
if (!string.IsNullOrEmpty(assemblyName))
|
||||
fullName += ", " + assemblyName;
|
||||
|
||||
var result = Type.GetType(fullName, throwOnError: false);
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
// Generic types like List<Pars> embed type args in the name.
|
||||
// Remap any old type names within the type arg list.
|
||||
if (typeName.Contains("[["))
|
||||
{
|
||||
var mangled = RemapTypeArgs(typeName);
|
||||
if (mangled != typeName)
|
||||
{
|
||||
fullName = mangled;
|
||||
if (!string.IsNullOrEmpty(assemblyName))
|
||||
fullName += ", " + assemblyName;
|
||||
result = Type.GetType(fullName, throwOnError: false);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string RemapTypeArgs(string typeName)
|
||||
{
|
||||
var sb = new StringBuilder(typeName.Length);
|
||||
int i = 0;
|
||||
while (i < typeName.Length)
|
||||
{
|
||||
int start = typeName.IndexOf('[', i);
|
||||
if (start < 0 || start + 1 >= typeName.Length || typeName[start + 1] != '[')
|
||||
{
|
||||
sb.Append(typeName, i, typeName.Length - i);
|
||||
break;
|
||||
}
|
||||
|
||||
sb.Append(typeName, i, start - i);
|
||||
|
||||
int end = typeName.IndexOf("]]", start);
|
||||
if (end < 0)
|
||||
{
|
||||
sb.Append(typeName, start, typeName.Length - start);
|
||||
break;
|
||||
}
|
||||
|
||||
var argFull = typeName.Substring(start + 2, end - start - 2);
|
||||
var comma = argFull.IndexOf(',');
|
||||
var argTypeName = comma >= 0 ? argFull.Substring(0, comma).Trim() : argFull.Trim();
|
||||
|
||||
if (_typeOnlyMap.TryGetValue(argTypeName, out var mapped))
|
||||
argFull = mapped.FullName + (comma >= 0 ? argFull.Substring(comma) : "");
|
||||
|
||||
sb.Append("[[").Append(argFull).Append("]]");
|
||||
|
||||
i = end + 2;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,12 +110,12 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(Pars Pars)
|
||||
public void Draw(PartGroup PartGroup)
|
||||
{
|
||||
Pars.Draw(displayUnitScale, displayGraphics);
|
||||
PartGroup.Draw(displayUnitScale, displayGraphics);
|
||||
if (hitGraphics != null)
|
||||
{
|
||||
Pars.DrawH(hitUnitScale, hitGraphics);
|
||||
PartGroup.DrawH(hitUnitScale, hitGraphics);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace _2DGAMELIB
|
||||
|
||||
private static readonly RemappedTypeBinder Binder = new RemappedTypeBinder()
|
||||
.Add("_2DGAMELIB.Par", typeof(ShapePart))
|
||||
.Add("_2DGAMELIB.ParT", typeof(ShapePartT));
|
||||
.Add("_2DGAMELIB.ParT", typeof(ShapePartT))
|
||||
.Add("_2DGAMELIB.Pars", typeof(PartGroup));
|
||||
|
||||
private static BinaryFormatter NewFormatter()
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace _2DGAMELIB
|
||||
public static int NOutline;
|
||||
public static int NHitFill;
|
||||
|
||||
private Pars parent;
|
||||
private PartGroup parent;
|
||||
|
||||
public string Tag = "";
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private bool EditH = true;
|
||||
|
||||
public Pars Parent => parent;
|
||||
public PartGroup Parent => parent;
|
||||
|
||||
public List<Out> OP
|
||||
{
|
||||
@@ -546,7 +546,7 @@ namespace _2DGAMELIB
|
||||
HitBrush.Color = value;
|
||||
}
|
||||
}
|
||||
public void SetParent(Pars Parent)
|
||||
public void SetParent(PartGroup Parent)
|
||||
{
|
||||
parent = Parent;
|
||||
}
|
||||
@@ -965,8 +965,8 @@ namespace _2DGAMELIB
|
||||
public List<int> GetPath()
|
||||
{
|
||||
List<int> list = new List<int> { parent.IndexOf(this) };
|
||||
Pars pars2 = parent;
|
||||
for (Pars pars3 = pars2.Parent; pars3 != null; pars3 = pars2.Parent)
|
||||
PartGroup pars2 = parent;
|
||||
for (PartGroup pars3 = pars2.Parent; pars3 != null; pars3 = pars2.Parent)
|
||||
{
|
||||
list.Insert(0, pars3.IndexOf(pars2));
|
||||
pars2 = pars3;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace _2DGAMELIB
|
||||
}
|
||||
i = 0;
|
||||
{
|
||||
foreach (ShapePart item in but.Pars.EnumAllPar())
|
||||
foreach (ShapePart item in but.PartGroup.EnumAllPar())
|
||||
{
|
||||
item.BrushColor = but.OverColors[i];
|
||||
i++;
|
||||
@@ -82,7 +82,7 @@ namespace _2DGAMELIB
|
||||
});
|
||||
}
|
||||
j = 0;
|
||||
foreach (ShapePart item2 in but.Pars.EnumAllPar())
|
||||
foreach (ShapePart item2 in but.PartGroup.EnumAllPar())
|
||||
{
|
||||
item2.BrushColor = but.OverColors[j];
|
||||
j++;
|
||||
@@ -120,7 +120,7 @@ namespace _2DGAMELIB
|
||||
}
|
||||
i = 0;
|
||||
{
|
||||
foreach (ShapePart item in but.Pars.EnumAllPar())
|
||||
foreach (ShapePart item in but.PartGroup.EnumAllPar())
|
||||
{
|
||||
item.BrushColor = but.BaseColors[i];
|
||||
i++;
|
||||
@@ -153,7 +153,7 @@ namespace _2DGAMELIB
|
||||
});
|
||||
}
|
||||
j = 0;
|
||||
foreach (ShapePart item2 in but.Pars.EnumAllPar())
|
||||
foreach (ShapePart item2 in but.PartGroup.EnumAllPar())
|
||||
{
|
||||
item2.BrushColor = but.BaseColors[j];
|
||||
j++;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
public class Tex
|
||||
{
|
||||
private Pars pars;
|
||||
private PartGroup _partGroup;
|
||||
|
||||
private ShapePartT _shapePartT;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private bool FastText;
|
||||
|
||||
public Pars Pars => pars;
|
||||
public PartGroup PartGroup => _partGroup;
|
||||
|
||||
public ShapePartT ShapePartT => _shapePartT;
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private void SetParT(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor)
|
||||
{
|
||||
pars = new Pars();
|
||||
_partGroup = new PartGroup();
|
||||
Out[] array = new Out[1] { Shas.GetSquare() };
|
||||
array.OutlineFalse();
|
||||
_shapePartT = new ShapePartT
|
||||
@@ -226,7 +226,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
_shapePartT.ShadBrush = new SolidBrush(ShadColor);
|
||||
}
|
||||
pars.Add(_shapePartT.Tag, _shapePartT);
|
||||
_partGroup.Add(_shapePartT.Tag, _shapePartT);
|
||||
}
|
||||
|
||||
private void SetFeed(string Name, double Size, ref Color FeedColor)
|
||||
@@ -246,7 +246,7 @@ namespace _2DGAMELIB
|
||||
Hit = false
|
||||
};
|
||||
feed.OP.ReverseY(feed.BasePointBase);
|
||||
pars.Add(feed.Tag, feed);
|
||||
_partGroup.Add(feed.Tag, feed);
|
||||
}
|
||||
|
||||
public void SetHitColor(ModeEventDispatcher Med)
|
||||
@@ -326,7 +326,7 @@ namespace _2DGAMELIB
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
pars.Dispose();
|
||||
_partGroup.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user