//=============================================================ID============================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); String s = ""; for (int i = 0; i < ConnectedWires.Count; i++) { s += ConnectedWires[i].ID + ";"; } if (s.Length > 0) { s = s.Substring(0, s.Length - 1); } Compound.Add("ConnectedWires", s); Compound.Add("CanGround", CanBeGround); Compound.Add("CanPower", CanProvidePower); Compound.Add("IsGround", isGround); Compound.Add("IsPower", isProvidingPower); Compound.Add("SendingVoltage", SendingVoltage); Compound.Add("SendingCurrent", SendingCurrent); /* * s = ""; * for (int i = 0; i < ContainingComponents.Count; i++) * { * s += ContainingComponents[i].ID.ToString() + ";"; * } * if (s.Length > 0) * s = s.Substring(0, s.Length - 1); * Compound.Add("ContainingComponents", s);//*/ }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w = Compound.GetInt("W"); (Logics as Logics.PulseFormerLogics).cycle = Compound.GetBool("Cycle"); double td = Compound.GetDouble("MaxRes"); if (Double.IsNaN(td)) { td = MaxResistance; } MaxResistance = (float)td; String s = Compound.GetString("Pulses"); var a = s.Split(';'); float[] t = new float[a.Length]; for (int i = 0; i < a.Length; i++) { try { t[i] = (float)Convert.ToDouble(a[i]); } catch { t[i] = 0; } } (Logics as Logics.PulseFormerLogics).pulses = t; }
//==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("C1", ConnectedComponent1.ID); Compound.Add("C2", ConnectedComponent2.ID); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); for (int i = 0; i < Joints.Length; i++) { j[i] = Compound.GetInt("J" + i.ToString()); } w1 = Compound.GetInt("W1"); w2 = Compound.GetInt("W2"); w3 = Compound.GetInt("W3"); w4 = Compound.GetInt("W4"); var l = Logics as Logics.TeslaCoilLogics; l.Range = (float)Compound.GetDouble("Range"); l.Capacitance = (float)Compound.GetDouble("Capacitance"); l.DischargeVoltage = (float)Compound.GetDouble("DischargeVoltage"); l.CurCharge = (float)Compound.GetDouble("Charge"); if (l.CurCharge < 0) { l.CurCharge = 0; } }
public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("OrigPos", Settings.GameState == Settings.GameStates.Stopped ? new Vector2(-1, -1) : origPos.Value); for (int i = 0; i < PushedPositions.Count; i++) { if (PushedPositions[i] is Vector2) { Compound.Add("Component" + i.ToString(), (Vector2)PushedPositions[i]); } if (PushedPositions[i] is List <Vector2> ) { Compound.Add("Component" + i.ToString(), "list"); List <Vector2> t = (List <Vector2>)PushedPositions[i]; for (int j = 0; j < t.Count; j++) { Compound.Add("Component" + i.ToString() + j.ToString(), (Vector2)t[j]); } } } for (int i = 0; i < components.Count; i++) { Compound.Add("Contains" + i.ToString(), components[i].ID); } }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); c1 = Compound.GetInt("C1"); c2 = Compound.GetInt("C2"); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); for (int i = 0; i < Joints.Length; i++) { j[i] = Compound.GetInt("J" + i.ToString()); } for (int i = 0; i < Wires.Length; i++) { w[i] = Compound.GetInt("W" + i.ToString()); } connectedLeft = Compound.GetBool("Left"); connectedUp = Compound.GetBool("Up"); connectedRight = Compound.GetBool("Right"); connectedDown = Compound.GetBool("Down"); leftUp = Compound.GetBool("LeftUp"); leftRight = Compound.GetBool("LeftRight"); leftDown = Compound.GetBool("LeftDown"); upRight = Compound.GetBool("UpRight"); upDown = Compound.GetBool("UpDown"); rightDown = Compound.GetBool("RightDown"); left = (PortState)Compound.GetInt("PortLeft"); up = (PortState)Compound.GetInt("PortUp"); right = (PortState)Compound.GetInt("PortRight"); down = (PortState)Compound.GetInt("PortDown"); }
//==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); for (int i = 0; i < Joints.Length; i++) { Compound.Add("J" + i.ToString(), Joints[i].ID); } for (int i = 0; i < Wires.Length; i++) { Compound.Add("W" + i.ToString(), Wires[i].ID); } Compound.Add("Left", connectedLeft); Compound.Add("Up", connectedUp); Compound.Add("Right", connectedRight); Compound.Add("Down", connectedDown); Compound.Add("LeftUp", leftUp); Compound.Add("LeftRight", leftRight); Compound.Add("LeftDown", leftDown); Compound.Add("UpRight", upRight); Compound.Add("UpDown", upDown); Compound.Add("RightDown", RightDown); Compound.Add("PortLeft", left.GetHashCode()); Compound.Add("PortUp", up.GetHashCode()); Compound.Add("PortRight", right.GetHashCode()); Compound.Add("PortDown", down.GetHashCode()); }
//================================================================IO=========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J1", J1.ID); Compound.Add("J2", J2.ID); Compound.Add("Resistance", Resistance); Compound.Add("IsConnected", IsConnected); Compound.Add("Direction", direction.GetHashCode()); Compound.Add("SendingVoltage", sendingVoltage); Compound.Add("SendingCurrent", sendingCurrent); Compound.Add("CanSendVoltage", CanSendVoltageOrCurrent); if (Graphics.Visible) { String d = ""; var g = Graphics as Graphics.WireGraphics; for (int i = 0; i < g.DrawPath.Count; i++) { d += g.DrawPath[i].X.ToString() + ";" + g.DrawPath[i].Y.ToString() + ";"; } d = d.Substring(0, d.Length - 1); Compound.Add("DrawPath", d); } }
//============================================================LOGICS======================================================== //==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("W", W.ID); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w = Compound.GetInt("W"); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w = Compound.GetInt("W"); (Logics as Logics.PulseCoreLogics).RequiredActivity = Compound.GetInt("RequiredLength"); }
//==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("W", W.ID); Compound.Add("RequiredLength", (Logics as Logics.PulseCoreLogics).RequiredActivity); }
public static void SaveAll() { for (int i = 0; i < Components.Count; i++) { IO.ComponentData d = new IO.ComponentData(); Components[i].SaveAll(d); IO.SaveEngine.SaveNode(d); } }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w = Compound.GetInt("W"); MaxResistance = Compound.GetDouble("MaxRes"); }
/// <summary> /// Called when a scheme is being loaded /// </summary> /// <param name="Compound">Use this to read data</param> public virtual void LoadAll(IO.ComponentData Compound) { ID = Compound.GetInt("ID"); Graphics.Position = Compound.GetVector2("Position"); Graphics.Size = Compound.GetVector2("Size"); Graphics.Visible = Compound.GetBool("Visible"); rotation = (Rotation)Compound.GetInt("Rotation"); isRemovable = Compound.GetBool("Removable"); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w = Compound.GetInt("W"); res = (float)Compound.GetDouble("Resistance"); }
/// <summary> /// Called when a scheme is being saved /// </summary> /// <param name="Compound">Use this to save data</param> public virtual void SaveAll(IO.ComponentData Compound) { Compound.SetType(GetType()); Compound.Add("ID", ID); Compound.Add("Position", Graphics.Position); Compound.Add("Size", Graphics.Size); Compound.Add("Visible", Graphics.Visible); Compound.Add("Rotation", rotation.GetHashCode()); Compound.Add("Removable", isRemovable); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); fieldRadius = (float)Compound.GetDouble("Field"); pole = (MagnetPole)Compound.GetInt("Pole"); con = Compound.GetInt("Connector"); com = Compound.GetInt("ConComp"); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w = Compound.GetInt("W"); (Logics as Logics.PowerACLogics).voltage = Compound.GetDouble("Voltage"); (Logics as Logics.PowerACLogics).period = (float)Compound.GetDouble("Period"); }
//==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("J2", Joints[2].ID); Compound.Add("W1", W1.ID); Compound.Add("W2", W2.ID); Compound.Add("Connection", connection.GetHashCode()); }
//==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("W", W.ID); Compound.Add("Min", (Logics as Logics.VoltageGraphLogics).min); Compound.Add("Max", (Logics as Logics.VoltageGraphLogics).max); Compound.Add("Frequency", (Logics as Logics.VoltageGraphLogics).frequency); }
//============================================================LOGICS======================================================== //==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("W", W.ID); Compound.Add("Voltage", (Logics as Logics.PowerACLogics).voltage); Compound.Add("Period", (Logics as Logics.PowerACLogics).period); }
//============================================================LOGICS======================================================== //==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("J2", Joints[2].ID); Compound.Add("J3", Joints[3].ID); Compound.Add("W1", W1.ID); Compound.Add("W2", W2.ID); Compound.Add("Delay", (Logics as Logics.DelayerLogics).Delay); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); w1 = Compound.GetInt("W"); (Logics as Logics.VoltageGraphLogics).min = Compound.GetInt("Min"); (Logics as Logics.VoltageGraphLogics).max = Compound.GetInt("Max"); (Logics as Logics.VoltageGraphLogics).frequency = Compound.GetInt("Frequency"); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); j2 = Compound.GetInt("J2"); w1 = Compound.GetInt("W1"); w2 = Compound.GetInt("W2"); connection = (Connection)Compound.GetInt("Connection"); }
//============================================================LOGICS======================================================== //==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("J2", Joints[2].ID); Compound.Add("J3", Joints[3].ID); Compound.Add("Current", MaxCurrent); Compound.Add("Potential", MaxVoltage); Compound.Add("Force", MaxMagnetForce); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); j2 = Compound.GetInt("J2"); j3 = Compound.GetInt("J3"); w1 = Compound.GetInt("W1"); w2 = Compound.GetInt("W2"); (Logics as Logics.DelayerLogics).Delay = Compound.GetInt("Delay"); }
public override void LoadAll(IO.ComponentData Compound) { base.LoadAll(Compound); j0 = Compound.GetInt("J0"); j1 = Compound.GetInt("J1"); j2 = Compound.GetInt("J2"); j3 = Compound.GetInt("J3"); j4 = Compound.GetInt("J4"); j5 = Compound.GetInt("J5"); w1 = Compound.GetInt("W1"); w2 = Compound.GetInt("W2"); w3 = Compound.GetInt("W3"); }
//============================================================LOGICS======================================================== //==============================================================IO========================================================== public override void SaveAll(IO.ComponentData Compound) { base.SaveAll(Compound); Compound.Add("J0", Joints[0].ID); Compound.Add("J1", Joints[1].ID); Compound.Add("J2", Joints[2].ID); Compound.Add("J3", Joints[3].ID); Compound.Add("J4", Joints[4].ID); Compound.Add("J5", Joints[5].ID); Compound.Add("W1", W1.ID); Compound.Add("W2", W2.ID); Compound.Add("W3", W3.ID); }