public bool Connect(Room room) { if (Neighbors.Contains(room)) { return(true); } if (Neighbors.Count < Info.MaxConnections && room.Neighbors.Count < room.Info.MaxConnections) { var intersection = Bounds.Intersect(room.Bounds); if (intersection == null || (intersection.Width == 0 && intersection.Height >= 2) || (intersection.Height == 0 && intersection.Width >= 2)) { var connectionPoint = GetConnectionPoint(room); if (connectionPoint == null) { return(false); } ConnectionPoints.Add(room, connectionPoint.Value); room.ConnectionPoints.Add(this, connectionPoint.Value); Neighbors.Add(room); room.Neighbors.Add(this); return(true); } } return(false); }
protected void Page_Load(object sender, EventArgs e) { Page.Form.DefaultFocus = RadioButtonListHosts.ClientID; Input.getHostData(IsPostBack, ViewState, out userid, out address, out user, out binding, out hostNameIdentifier, out configName, out version, out platform, out hoster, false); if (IsPostBack) { connections = (ConnectionPoints)ViewState["connections"]; } else { try { traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user); connections = configProxy.getConnectionPoints(hostNameIdentifier, configName, new List<int>(new int[] { ConfigUtility.HOST_TYPE_CONNECTED_SERVICE, ConfigUtility.HOST_TYPE_GENERIC_CONNECTED_SERVICE }), false, traversePath, user); ViewState["connections"] = connections; } catch (Exception ee) { connections = null; eMessage = "<span style=\"color:Maroon;font-size:13px;font-weight:normal;font-family:Verdana;\">Error getting Connection Points from remote host @ " + address + "<br/>Exception is: " + ee.ToString() + "</span>"; } if (connections.ConnectedServices != null) { for (int i = 0; i < connections.ConnectedServices.Count; i++) { RadioButtonListHosts.Items.Add(new ListItem(connections.ConnectedServices[i].ServiceFriendlyName, connections.ConnectedServices[i].ServiceFriendlyName)); } if (connections.ConnectedServices.Count == 0) { Add.Enabled = false; } else { RadioButtonListHosts.SelectedIndex = 0; ConnectedServices thisCs = connections.ConnectedServices.Find(delegate(ConnectedServices csExist) { return csExist.ServiceFriendlyName.Equals(RadioButtonListHosts.SelectedValue); }); ServiceHostAddress.Text = thisCs.DefaultAddress; } } } if (connections.ConnectedServices == null || connections.ConnectedServices.Count == 0) { Add.Enabled = false; ServiceHostAddress.Enabled = false; if (eMessage == null) Message.Text = "<span style=\"color:#cccccc;font-size:1.0em;font-weight:normal;\">This service does not have any Connected Services defined in it's configuration database.<br/> Use the Services tab to define valid services this service can connect to.</span>"; else { Message.Text = eMessage; } } TopNode.PostBackUrl = ConfigSettings.PAGE_NODES; ServiceVersion.Text = version; ServicePlatform.Text = platform; ServiceHoster.Text = hoster; TopNodeName.Text = hostNameIdentifier; ReturnLabel.Text = "<a class=\"Return\" href=\"" + ConfigSettings.PAGE_CONNECTIONS + "?name=" + hostNameIdentifier + "&cfgSvc=" + configName + "&version=" + version + "&platform=" + platform + "&hoster=" + hoster + "\">Return to Connections Page</a>"; GetImageButton.runtimePoweredBy(platform, RuntimePlatform); }
public MessageBaseNode(IProductElementViewModel innerViewModel) : base(innerViewModel) { ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Left)); ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Right)); this.IsResizable = false; this.Bounds = new Rect(0, 0, 320, 52); }
private void getData() { string eMessage = null; ClientService.Text = hostNameIdentifier; if (IsPostBack) { thisConnection = (ConnectionPoints)ViewState["connection"]; oldConnection = (ConnectionPoints)ViewState["oldConnection"]; traversePath = (List<TraverseNode>)ViewState["traversePath"]; connectionID = (int)ViewState["connectionID"]; } else { connectionID = Convert.ToInt32(Request["connectionID"]); try { traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user); if (client != "true") thisConnection = configProxy.getConnectionPoint(hostNameIdentifier, configName, connectionID, false, traversePath, user); else { List<HostListenEndPointInstance> clients = configProxy.getActiveClients(hostNameIdentifier, configName, false, traversePath, user); thisConnection = new ConnectionPoints(hostNameIdentifier, configName); thisConnection.MyConnectionPoints = clients; thisConnection.MyConnectionPoints.RemoveAll(delegate(HostListenEndPointInstance epExist) { return epExist.InstanceID != connectionID; }); } } catch (Exception e) { eMessage = "Error getting Connection Points from remote host @ " + address + "<br/>Exception is: " + e.ToString(); try { EventLog EventLog1 = new EventLog("Application"); EventLog1.Source = ConfigSettings.EVENT_LOG; EventLog1.WriteEntry(eMessage, EventLogEntryType.Error); } catch { } } ViewState["oldConnection"] = thisConnection; ViewState["connection"] = thisConnection; ViewState["traversePath"] = traversePath; ViewState["connectionID"] = connectionID; } if (thisConnection == null) ReturnLabel.Text = eMessage; else { ServiceHost.Text = thisConnection.MyConnectionPoints[0].HostNameIdentifier; AddressLabel.Text = thisConnection.MyConnectionPoints[0].RemoteAddress; ReturnLabel.Text = "<br/><a class=\"Return\" href=\"" + ConfigSettings.PAGE_CONNECTIONS + "?name=" + hostNameIdentifier + "&cfgSvc=" + configName + "\">Return to Connection Page</a><br/><br/>"; } }
/// <summary> /// Default constructor. /// </summary> public TableElement() { Style.OutlineProperties.Rounding = rounding; Style.FillProperties.Color = backgroundColor; PinPoint.PositionType = ElementPointPositionType.TopLeft; ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.TopRight)); ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.TopCenter)); ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.TopLeft)); ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.BottomCenter)); ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.BottomLeft)); ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.BottomRight)); //ConnectionPoints.Add(new ConnectionPoint(ConnectionPointType.InputOutput, ElementPointPositionType.Custom)); }
private void OnClickInPoint(ConnectionPoints inPoint) { selectedInPoint = inPoint; if (selectedOutPoint != null) { if (selectedOutPoint.node != selectedInPoint.node) { CreateConnection(); ClearConnectionSelection(); } else { ClearConnectionSelection(); } } }
private void OnClickOutPoint(ConnectionPoints outPoint) { selectedOutPoint = outPoint; Debug.Log("On click outpoint"); if (selectedInPoint != null) { if (selectedOutPoint.node != selectedInPoint.node) { CreateConnection(); ClearConnectionSelection(); } else { ClearConnectionSelection(); } } }
public void Rotate90(bool clockwise) { float angle = clockwise ? 90 : -90; this.transform.Rotate(Vector3.forward, angle); int overflowBits = 0; // Some magical shit if (clockwise) { overflowBits = (int)((ConnectionPoints.Up & ConnectionPoints) | (ConnectionPoints.UpRight & ConnectionPoints)); ConnectionPoints = (ConnectionPoints)(((int)ConnectionPoints) >> 2); ConnectionPoints = (ConnectionPoints)((int)ConnectionPoints | (overflowBits << 6)); } else { overflowBits = (int)((ConnectionPoints.Left & ConnectionPoints) | (ConnectionPoints.UpLeft & ConnectionPoints)); ConnectionPoints = (ConnectionPoints)(((int)ConnectionPoints) << 2); ConnectionPoints = (ConnectionPoints)((int)ConnectionPoints | (overflowBits >> 6)); } }
public void Rotate45(bool clockwise) { float angle = clockwise ? 45 : -45; this.transform.Rotate(Vector3.forward, angle); int overflowBits = 0; // Some magical shit if (clockwise) { overflowBits = (int)((ConnectionPoints.Up & ConnectionPoints)); ConnectionPoints = (ConnectionPoints)(((int)ConnectionPoints) >> 1); ConnectionPoints = (ConnectionPoints)((int)ConnectionPoints | (overflowBits << 7)); } else { overflowBits = (int)(ConnectionPoints.UpLeft & ConnectionPoints); ConnectionPoints = (ConnectionPoints)(((int)ConnectionPoints) << 1); ConnectionPoints = (ConnectionPoints)((int)ConnectionPoints | (overflowBits >> 7)); } }
public override void Decorate(Level level) { Vector2Int moneyLocation; if (ConnectionPoints.Count > 0) { var painter = new RoomPainter(level, this); var connection = ConnectionPoints.First().Value; if (connection.x == Bounds.Left) { level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 1, 0), Painter.Bones); level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 2, 0), Painter.Skull); painter.PlaceCobwebs(Bounds.Left + 2, Bounds.Bottom + 2, true); moneyLocation = new Vector2Int(Bounds.Left + 2, Bounds.Bottom + 1); } else if (connection.x == Bounds.Right) { level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 1, 0), Painter.Bones); level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 2, 0), Painter.Skull); painter.PlaceCobwebs(Bounds.Left + 1, Bounds.Bottom + 2, false); moneyLocation = new Vector2Int(Bounds.Left + 1, Bounds.Bottom + 1); } else if (connection.y == Bounds.Bottom) { level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 1, 0), Painter.Bones); level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 1, 0), Painter.Skull); painter.PlaceCobwebs(Bounds.Left + 2, Bounds.Bottom + 2, true); moneyLocation = new Vector2Int(Bounds.Left + 1, Bounds.Bottom + 2); } else { level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 2, 0), Painter.Bones); level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 2, 0), Painter.Skull); painter.PlaceCobwebs(Bounds.Left + 1, Bounds.Bottom + 1, false); moneyLocation = new Vector2Int(Bounds.Left + 2, Bounds.Bottom + 1); } BattleGrid.instance.SpawnMoneyOnTile(moneyLocation, 10); } }
public override void Unpack(BinaryReader reader) { Id = reader.ReadUInt32(); Bitfield = reader.ReadUInt32(); AllowFreeHeading = (Bitfield & 4) != 0; HasPhysicsBSP = (Bitfield & 8) != 0; // Get all the GraphicsObjects in this SetupModel. These are all the 01-types. uint numParts = reader.ReadUInt32(); for (int i = 0; i < numParts; i++) { Parts.Add(reader.ReadUInt32()); } if ((Bitfield & 1) != 0) { for (int i = 0; i < numParts; i++) { ParentIndex.Add(reader.ReadUInt32()); } } if ((Bitfield & 2) != 0) { for (int i = 0; i < numParts; i++) { DefaultScale.Add(reader.ReadVector3()); } } HoldingLocations.Unpack(reader); ConnectionPoints.Unpack(reader); int placementsCount = reader.ReadInt32(); for (int i = 0; i < placementsCount; i++) { int key = reader.ReadInt32(); // there is a frame for each Part var placementType = new PlacementType(); placementType.Unpack(reader, (uint)Parts.Count); PlacementFrames.Add(key, placementType); } CylSpheres.Unpack(reader); Spheres.Unpack(reader); Height = reader.ReadSingle(); Radius = reader.ReadSingle(); StepDownHeight = reader.ReadSingle(); StepUpHeight = reader.ReadSingle(); SortingSphere.Unpack(reader); SelectionSphere.Unpack(reader); Lights.Unpack(reader); DefaultAnimation = reader.ReadUInt32(); DefaultScript = reader.ReadUInt32(); DefaultMotionTable = reader.ReadUInt32(); DefaultSoundTable = reader.ReadUInt32(); DefaultScriptTable = reader.ReadUInt32(); }
public ChildNode(IProductElementViewModel innerViewModel) : base(innerViewModel) { ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Left)); ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Right)); }
/// <summary> /// Correct the end points of a compartment connection to correspond to the entries of the compartmetn shapes. /// </summary> /// <param name="linkShape">the BinaryLinkShape</param> public void CorrectBinaryLinkShapeEndPoints(BinaryLinkShape linkShape) { CONNECTION connection = (CONNECTION)linkShape.ModelElement; if (connection == null) { return; } // source CompartmentShape fromShape = linkShape.FromShape as CompartmentShape; RectangleD fromRec = linkShape.FromShape.AbsoluteBoundingBox; PointD leftFrom; PointD rightFrom; if (fromShape != null) { // vertical offset on source Double fromOffset = GetVerticalOffset <SOURCE_COMPARTMENT_ENTRY>(fromShape, connection, GetBuilderInstance().IsEntryConnectionSource); leftFrom = new PointD(fromRec.Left, fromRec.Top + fromOffset); rightFrom = new PointD(fromRec.Right, fromRec.Top + fromOffset); } else { leftFrom = rightFrom = fromRec.Center; } // taget CompartmentShape toShape = linkShape.ToShape as CompartmentShape; RectangleD toRec = linkShape.ToShape.AbsoluteBoundingBox; PointD leftTarget; PointD rightTarget; if (toShape != null) { // vertical offset on source Double toOffset = GetVerticalOffset <TARGET_COMPARTMENT_ENTRY>(toShape, connection, GetBuilderInstance().IsEntryConnectionTarget); leftTarget = new PointD(toRec.Left, toRec.Top + toOffset); rightTarget = new PointD(toRec.Right, toRec.Top + toOffset); } else { leftTarget = rightTarget = toRec.Center; } // determinate the connection points ConnectionPoints points = GetConnectionPoints(leftFrom, rightFrom, leftTarget, rightTarget); // set point for source if (fromShape != null) { linkShape.FromEndPoint = points.Source; linkShape.FixedFrom = VGFixedCode.Caller; } // set point for taget if (toShape != null) { linkShape.ToEndPoint = points.Target; linkShape.FixedTo = VGFixedCode.Caller; } }
private void ClearConnectionSelection() { selectedInPoint = null; selectedOutPoint = null; }
private void getData() { List<int> connectionPointTypes = new List<int>(); connectionPointTypes.Add(ConfigUtility.HOST_TYPE_CONNECTED_SERVICE); connectionPointTypes.Add(ConfigUtility.HOST_TYPE_GENERIC_CONNECTED_SERVICE); string eMessage = null; try { traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user); compositeServiceData = configProxy.getServiceConfiguration(hostNameIdentifier, configName, ConfigUtility.CONFIG_LEVEL_BASIC, false, traversePath, user); connectedServices = compositeServiceData[0].ConnectedServices; if (Request["version"] == "drilldown") { version = compositeServiceData[0].ServiceVersion; platform = compositeServiceData[0].RunTimePlatform; hoster = compositeServiceData[0].ServiceHoster; ViewState["name"] = hostNameIdentifier; ViewState["configname"] = configName; ViewState["version"] = version; ViewState["platform"] = platform; ViewState["hoster"] = hoster; } connectedConfigServices = compositeServiceData[0].ConnectedConfigServices; if (viewType == ConfigUtility.HOST_TYPE_CONNECTED_CLIENT_CONFIG) { connectionsClients = configProxy.getActiveClients(hostNameIdentifier, configName, true, traversePath, user); connections = new ConnectionPoints(hostNameIdentifier, configName); connections.MyConnectionPoints = connectionsClients; } else connections = configProxy.getConnectionPoints(hostNameIdentifier, configName, connectionPointTypes, true, traversePath, user); } catch (Exception e) { connections = null; eMessage = "Error getting Connection Points from remote host @ " + address + "<br/>Exception is: " + e.ToString(); try { EventLog EventLog1 = new EventLog("Application"); EventLog1.Source = ConfigSettings.EVENT_LOG; EventLog1.WriteEntry(eMessage, EventLogEntryType.Error); } catch { } } if (connections == null || connections.MyConnectionPoints == null) { Message.Text = "<span style=\"font-size:15px;color:Maroon\">Cannot retrieve connection points for " + hostNameIdentifier + " becuase this service Host is not online, you do not have administrative privledges for this connected service, or there is a startup configuration issue." + eMessage + "</span>"; AddConnection.Enabled = false; } else { if (connections.MyConnectionPoints.Count == 0) { if (viewType == ConfigUtility.HOST_TYPE_CONNECTED_SERVICE) Message2.Text = "<span style=\"font-size:15px\">This service currently has no defined connection points to other services.</span>"; else Message2.Text = "<span style=\"font-size:15px\">This service currently has no clients to its Primary Service(s).</span>"; } else Message2.Visible = false; Message.Visible = false; } if (connections != null && connections.MyConnectionPoints != null) { for (int i = 0; i < connections.MyConnectionPoints.Count; i++) { if (connections.MyConnectionPoints[i].Status.Equals(ConfigSettings.MESSAGE_ONLINE) || connections.MyConnectionPoints[i].Status.Equals(ConfigSettings.MESSAGE_UNKNOWN)) { try { onlineList.Add(connections.MyConnectionPoints[i].HostNameIdentifier, connections.MyConnectionPoints[i].RemoteAddress); } catch { } } } ConnectionRepeater.DataSource = connections.MyConnectionPoints; TopNodeName.Text = connections.HostNameIdentifier; if (compositeServiceData != null && compositeServiceData.Count > 0 && compositeServiceData[0] != null) { ServiceVersion.Text = compositeServiceData[0].ServiceVersion; ServiceHoster.Text = "" + compositeServiceData[0].ServiceHoster; hoster = ServiceHoster.Text; ViewState["hoster"] = hoster; ServicePlatform.Text = "" + compositeServiceData[0].RunTimePlatform; } } }
protected void Delete_Click(object sender, EventArgs e) { string actiontext = ""; action = ConfigUtility.DELETE_CONNECTION; oldConnection = (ConnectionPoints)ViewState["oldConnection"]; string userid = HttpContext.Current.User.Identity.Name; if (userid == null) Response.Redirect(FormsAuthentication.LoginUrl,true); actiontext = "deleted"; Delete.Enabled = false; int success = ConfigUtility.CLUSTER_UPDATE_FULL_SUCCESS; string eMessage = null; try { traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user); success = configProxy.receiveConnectionPoint(hostNameIdentifier, configName, oldConnection.MyConnectionPoints[0], thisConnection.MyConnectionPoints[0], true, null, action, traversePath, user); } catch (Exception ee) { try { EventLog EventLog1 = new EventLog("Application"); EventLog1.Source = ConfigSettings.EVENT_LOG; eMessage = "<br/>receiveConnectionPoint exception from remote service.<br/>Exception is: " + ee.ToString(); EventLog1.WriteEntry(eMessage, EventLogEntryType.Error); } catch { } } if (success == ConfigUtility.CLUSTER_UPDATE_FULL_SUCCESS) { Message.Text = "<br/><span style=\"color:PaleGreen \">The connection point was sucessfully " + actiontext + ".</span>"; AddressLabel.Text = thisConnection.MyConnectionPoints[0].RemoteAddress; ViewState["connection"] = thisConnection; ViewState["oldConnection"] = thisConnection; } else { string message = null; switch (success) { case ConfigUtility.CLUSTER_UPDATE_FAIL_PERSISTED: { message = ConfigSettings.EXCEPTION_MESSAGE_FAIL_PERSISTED; break; } case ConfigUtility.CLUSTER_UPDATE_FAIL_VALIDATION: { message = ConfigSettings.EXCEPTION_MESSAGE_FAIL_VALIDATION; break; } case ConfigUtility.CLUSTER_UPDATE_FAIL_AUTHENTICATION: { message = ConfigSettings.EXCEPTION_MESSAGE_FAIL_AUTHORIZATION; break; } case ConfigUtility.CLUSTER_UPDATE_FAIL_REMOTE: { message = ConfigSettings.EXCEPTION_MESSAGE_FAIL_REMOTE_UPDATE; break; } default: { message = ConfigSettings.EXCEPTION_MESSAGE_FAIL_REMOTE_PEER + success.ToString(); break; } } Message.Text = "<br/><span style=\"color:Maroon\">" + message + "</span>"; thisConnection = oldConnection; } }
public BaseElement(int elementID, ConnectionPoints connections) { ElementID = elementID; Connections = connections; }