예제 #1
0
 public bool Click(out TargetObject target)
 {
     target = null;
     for (int i = 0; i < targetObjectManager.targets.Count; i++)
     {
         float pos = targetObjectManager.targets[i].GetPos();
         if (pos >= areaLowerLimit)
         {
             if (pos < areaUpperLimit)
             {
                 target = targetObjectManager.targets[i];
                 if (target.id == id && target.GetIsClicked() != true)
                 {
                     target.SetIsClicked(true);
                     ClickEffect obj = objectPool.GetItem(clickEffect, null).GetComponent <ClickEffect>();
                     obj.transform.localPosition = Vector3.zero;
                     obj.Play(target.transform);
                     return(true);
                 }
             }
             else
             {
                 return(false);
             }
         }
     }
     return(false);
 }
예제 #2
0
    public void LoadList(List <Card> myCards, bool shuffle = true, ClickEffect clickEffect = ClickEffect.nothing, Zones zone = Zones.master, bool forSale = false, bool free = true, int cap = -99)
    {
        List <Card> copyOfmyCards = new List <Card>();
        int         i             = 0;

        copyOfmyCards.AddRange(myCards);
        if (shuffle)
        {
            ShuffleList.Shuffle <Card>(copyOfmyCards);
        }
        print(clickEffect);
        foreach (Card card in copyOfmyCards)
        {
            if (clickEffect == ClickEffect.upgrade && card.CanUpgrade == false)
            {
                continue;
            }
            GameObject         newCard    = Instantiate(ListItemPrefab) as GameObject;
            ListItemController controller = newCard.GetComponentInChildren <ListItemController>();
            controller.myCard = card;

            controller.icon.sprite = card.mySprite;

            controller.clickEffect = clickEffect;
            controller.zone        = zone;
            controller.free        = free;

            if (forSale)
            {
                controller.UiText.text = "Cost: " + card.FactoryCost;
            }
            newCard.transform.SetParent(ControlPanel.transform, false);
            newCard.transform.localScale = Vector3.one;
            i++;
            if (i >= cap && cap > 0)
            {
                break;
            }
        }
    }
예제 #3
0
 public static void SetClickEffect(Button button, ClickEffect value)
 {
     button.SetValue(ClickEffectProperty, value);
 }
예제 #4
0
 public static void SetClickEffect(RepeatButton repeatButton, ClickEffect value)
 {
     repeatButton.SetValue(ClickEffectProperty, value);
 }