Exemple #1
0
 public static void HideDropHints(DragDropType type)
 {
     if (dropTargets.ContainsKey(type))
     {
         foreach (DropTarget target in dropTargets[type])
         {
             target.outline.enabled = false;
         }
     }
 }
Exemple #2
0
 public UIElementDragAndDropEditPage(ActUIElement Action, PlatformInfoBase mPlatform)
 {
     mAction = Action;
     InitializeComponent();
     DragDropType.Init(mAction.GetOrCreateInputParam(ActUIElement.Fields.DragDropType), mPlatform.GetPlatformDragDropTypeList(), false, new SelectionChangedEventHandler(DragDropType_SelectionChanged));
     TargetElement.BindControl(mAction, ActUIElement.Fields.TargetLocateBy, mPlatform.GetPlatformUIElementsType());
     TargetLocateByComboBox.BindControl(mAction, ActUIElement.Fields.TargetLocateBy, mPlatform.GetPlatformUIElementLocatorsList());
     TargetLocatorValue.Init(mAction.GetOrCreateInputParam(ActUIElement.Fields.TargetLocateValue), true, false, UCValueExpression.eBrowserType.Folder);
     SourceDragXY.Init(mAction.GetOrCreateInputParam(ActUIElement.Fields.SourceDragXY), true, false);
     TargetDropXY.Init(mAction.GetOrCreateInputParam(ActUIElement.Fields.TargetDropXY), true, false);
 }
Exemple #3
0
    private IEnumerator AnimateChooseCard(Card[] cards, StringBuilder output)
    {
        DragDropType     dragType    = dropTarget.type;
        List <Transform> cardHolders = new List <Transform>();

        foreach (Card card in cards)
        {
            GameObject cardHolder = Instantiate(cardHolderPrefab, cardGrid.transform);
            GameObject cardObject = Instantiate(cardPrefab, cardHolder.transform);

            cardObject.GetComponent <DragSource>().type          = dragType;
            cardObject.GetComponent <CardUI>().cardData          = card;
            cardObject.GetComponent <HoverCardOverlay>().enabled = false;

            cardHolders.Add(cardHolder.transform);
        }

        background.interactable   = true;
        background.blocksRaycasts = true;
        yield return(UIManager.instance.LerpTime(
                         Mathf.Lerp,
                         0f, 1f, fadeDuration,
                         alpha => background.alpha = alpha
                         ));

        UnityAction <DragSource> dropListener = null;
        bool dropped = false;

        dropListener = dragSource =>
        {
            output.Clear();
            output.Append(dragSource.GetComponent <CardUI>().card.ID);
            dropped = true;
            Destroy(dragSource.gameObject);
            dropTarget.onDrop.RemoveListener(dropListener);
        };
        dropTarget.onDrop.AddListener(dropListener);

        yield return(new WaitUntil(() => dropped));

        yield return(UIManager.instance.LerpTime(
                         Mathf.Lerp,
                         1f, 0f, fadeDuration,
                         alpha => background.alpha = alpha
                         ));

        foreach (Transform cardHolder in cardHolders)
        {
            Destroy(cardHolder.gameObject);
        }
        background.interactable   = false;
        background.blocksRaycasts = false;
    }
Exemple #4
0
    public static void ShowDropHints(DragDropType type)
    {
        if (dropTargets.ContainsKey(type))
        {
            foreach (DropTarget target in dropTargets[type])
            {
                if (!target.enabled)
                {
                    continue;
                }

                target.outline.enabled     = true;
                target.outline.effectColor = target.hintColor;
            }
        }
    }