예제 #1
0
        public void ConnectNodeToAvatar(string ownerRoom, string targetRoom, string nodeDirection)
        {
            ImageBox target = null;
            ImageBox owner  = null;

            if (ownerRoom == null || ownerRoom == "" || targetRoom == "" || nodeDirection == null || nodeDirection == "")
            {
                return;
            }

            if (targetRoom == null)
            {
                target = null;
            }
            else
            {
                if (AvatarMap.ContainsKey(targetRoom))
                {
                    target = AvatarMap[targetRoom];
                }
            }
            if (AvatarMap.ContainsKey(ownerRoom))
            {
                owner = AvatarMap[ownerRoom];
            }


            //hack alert! we are setting this up for static item based exits/enters
            if (!Globals.NodeProperties.NodeLocations.ContainsKey(nodeDirection))
            {
                nodeDirection = "other";
            }

            if (targetRoom != null && targetRoom.Length > 0 && target == null && owner != null)
            {
                //failed connection

                ConnectionNode node = owner.GetNode(nodeDirection);
                if (node != null)
                {
                    node.FailedConnection = true;
                    node.SetTarget(target);
                }
            }
            else
            {
                //connect / disconnect
                if (owner != null)
                {
                    ConnectionNode node = owner.GetNode(nodeDirection);
                    if (node != null)
                    {
                        node.FailedConnection = false;
                        node.SetTarget(target);
                    }
                    return;
                }
            }
            return;
        }
예제 #2
0
 public void RemoveFromConnections(ConnectionNode node)
 {
     if (Connected.Contains(node) && !SuppressDisconnect)
     {
         Connected.Remove(node);
     }
 }
예제 #3
0
        private bool NodeHover(MouseMoveArgs mma)
        {
            refHoveredNode = refVirtualDomain.OnHoverNode(mma.Current.X, mma.Current.Y);

            if (refHoveredNode != null)
            {
                return(true);
            }
            return(false);
        }
예제 #4
0
        public ConnectionNode OnHoverNode(int xPos, int yPos)
        {
            Point p = new Point(xPos + ViewPort.ViewX, yPos + ViewPort.ViewY);

            foreach (ImageBox image in RoomAvatars)
            {
                ConnectionNode node = image.PointInAnyNode(p);
                if (node != null)
                {
                    return(node);
                }
            }

            return(null);
        }
예제 #5
0
        public void SetNodeExitDoor(string ownerRoom, string nodeDirection, bool exitFlag)
        {
            if (ownerRoom == null || ownerRoom == "" || nodeDirection == null || nodeDirection == "")
            {
                return;
            }

            foreach (ImageBox image in RoomAvatars)
            {
                if (image.RoomName == ownerRoom)
                {
                    nodeDirection = nodeDirection.Replace("\"", "");
                    ConnectionNode node = image.GetNode(nodeDirection);
                    if (node != null)
                    {
                        node.HasDoor = exitFlag;
                    }
                }
            }
        }
예제 #6
0
 public void AddToConnections(ConnectionNode node)
 {
     Connected.Add(node);
 }