コード例 #1
0
ファイル: VirtualDomain.cs プロジェクト: jamClark/Stellarmap
        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
ファイル: ImageBox.cs プロジェクト: jamClark/Stellarmap
 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
ファイル: VirtualDomain.cs プロジェクト: jamClark/Stellarmap
        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
ファイル: VirtualDomain.cs プロジェクト: jamClark/Stellarmap
        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
ファイル: ImageBox.cs プロジェクト: jamClark/Stellarmap
 public void AddToConnections(ConnectionNode node)
 {
     Connected.Add(node);
 }