public CSComponentCopy(CSComponentCopy c) { component = c.component; position = c.position; this.Color = c.Color; this.isVisible = c.isVisible; this.localIndex = c.localIndex; this.parent = c.parent; this.size = c.size; this.Texture = c.Texture; }
public void ResetSelection() { for (int i = 0; i < rootTiles.Count; i++) { if (rootTiles[i] is CSComponentCopy && (rootTiles[i] as CSComponentCopy).Text == "Cursor") { selectedComponent = rootTiles[i] as CSComponentCopy; return; } } }
public void AddComponent(CSFolder parent, CSComponent component) { var copy = new CSComponentCopy(component); copy.parent = parent; if (parent == null) { copy.Position = new Vector2(4, 4 + rootTiles.Count * 40); copy.localIndex = rootTiles.Count; copy.isVisible = true; rootTiles.Add(copy); } else { copy.Position = new Vector2(6 + parent.position.X + 40, 4 + parent.Tiles.Count * 40); copy.localIndex = parent.Tiles.Count; copy.isVisible = false; parent.Tiles.Add(copy); } copy.Color = Color.White; allTiles.Add(copy); }
public override void Initialize() { IO.Log.Write(" CS initializing..."); MicroWorld.Graphics.GUI.ClickabilityOverlay.RegisterExtension(Components.ClickableComponents.Instance); ClickabilityOverlay.RegisterExtension(this); ShouldBeScaled = false; Layer = 500; MicroWorld.Components.Cursor cs = new MicroWorld.Components.Cursor(); RegisterComponent(cs); cursor = components[0]; cursor.drawCount = false; MicroWorld.Components.RotatableConnector rc = new MicroWorld.Components.RotatableConnector(); RegisterComponent(rc); MicroWorld.Components.Joint j = new MicroWorld.Components.Joint(); RegisterComponent(j); MicroWorld.Components.Joint._TypeID = j.typeID; MicroWorld.Components.Wire w = new MicroWorld.Components.Wire(); RegisterComponent(w); Components.Wire.TypeID = Components.ComponentsManager.TypeIDs[typeof(Components.Wire)]; MicroWorld.Components.Core cr = new MicroWorld.Components.Core(); RegisterComponent(cr); MicroWorld.Components.PulseCore cr2 = new MicroWorld.Components.PulseCore(); RegisterComponent(cr2); //MicroWorld.Components.PipeJoint pj = new MicroWorld.Components.PipeJoint(); //RegisterComponent(pj); //MicroWorld.Components.Pipe p = new MicroWorld.Components.Pipe(); //RegisterComponent(p); for (int i = 0; i < MicroWorld.Components.ComponentsManager.RegisteredComponents.Count; i++) { Type t = MicroWorld.Components.ComponentsManager.RegisteredComponents[i]; MicroWorld.Components.Component comp = (MicroWorld.Components.Component)Activator.CreateInstance(t); if (comp.Graphics.ShouldDisplayInCS()) { RegisterComponent(comp); } else { Components.ComponentsManager.TypeIDs.Add(comp.GetType(), (short)Components.ComponentsManager.TypeIDs.Count); } try { var a = comp.GetType().GetMethod("StaticInit"); if (a != null) { a.Invoke(null, null); } } catch { }; } GenerateStructure(); selectedComponent = rootTiles[0] as CSComponentCopy; GlobalEvents.onComponentRemovedByPlayer += new GlobalEvents.ComponentEventHandler(GlobalEvents_onComponentRemovedByPlayer); }