public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         //Go to next state
         if (index == states.Count - 1)
         {
             index = 0;
         }
         else
         {
             index++;
         }
         textComp.text          = states[index];
         linkAttached.nodeState = states[index];
         LinkData.LinkTypes oldType = linkAttached.type;
         if (oldType == LinkData.LinkTypes.Specialization)
         {
             linkAttached.type = LinkData.LinkTypes.Generalization;
         }
         else
         {
             linkAttached.type = LinkData.LinkTypes.Specialization;
         }
         PlayerEventHandler.ChangeGenLinkType(linkAttached, oldType.ToString());
     }
     else if (eventData.button == PointerEventData.InputButton.Right)
     {
         linkAttached.participationIsTotal = !linkAttached.participationIsTotal;
         UpdateLineSprite();
     }
 }
예제 #2
0
    //Links involving 2 nodes such as Entity-Relation or Entity-Atribute
    public int FreeLinkSlots(NodeData node1, NodeData node2, LinkData.LinkTypes type)
    {
        int porEncontrar = (type == LinkData.LinkTypes.EntityRel) ? 2 : 1;

        foreach (LinkData currLink in links)
        {
            if (currLink.linkedNodeId[0] == node1.id && currLink.linkedNodeId[1] == node2.id ||
                currLink.linkedNodeId[1] == node1.id && currLink.linkedNodeId[0] == node2.id)
            {
                if (--porEncontrar == 0)
                {
                    break;
                }
            }
        }
        return(porEncontrar);
    }