示例#1
0
 public void IntroEnemy(Player player, int level)
 {
     Title.Hide();
     ClearScrollView();
     HeroDescWindow.gameObject.SetActive(true);
     Counter.gameObject.SetActive(false);
     HeroDesc.SetByCard(player.hero);
     Btn确定.IsActive = true;
     TipTitle.text  = "挑战 " + level + "/4";
     clickAction    = () =>
     {
         HeroDescWindow.gameObject.SetActive(false);
         selectCardAction?.Invoke(null);
     };
     SetTip("即将面对的挑战");
 }
示例#2
0
    public void SelectHero(List <Card> heros, List <Card> lockHeros)
    {
        Title.SetSelectHero();
        Buttons.Show();
        ClearScrollView();
        StartSence.gameObject.SetActive(false);

        List <Card> allCards = new List <Card>();

        allCards.AddRange(heros);
        allCards.AddRange(lockHeros);

        Vector3 first     = First.transform.position;
        Vector3 second    = Second.transform.position;
        Vector3 dPosition = second - first;

        int i = 0;
        List <HeroSelectCommponentSetting> settings = heros.Map(card =>
        {
            HeroSelectCommponentSetting setting = GetHeroSelectCommponent();
            setting.Lock(lockHeros.Contains(card));
            setting.SetByCard(card);
            setting.Glow(false);
            setting.transform.position = first + dPosition * i++;
            return(setting);
        });

        lockHeros.Map(card =>
        {
            HeroSelectCommponentSetting setting = GetHeroSelectCommponent();
            setting.Lock(lockHeros.Contains(card));
            setting.SetByCard(card);
            setting.Glow(false);
            setting.transform.position = first + dPosition * i++;
            return(setting);
        });

        foreach (var setting in settings)
        {
            setting.EnableTap(true, () =>
            {
                if (setting == selectedHero)
                {
                    selectedHero = null;
                    OnSelectHero(null);
                    setting.Glow(false);
                }
                else
                {
                    settings.Map(st => st.Glow(false));
                    setting.Glow(true);
                    selectedHero = setting;
                    OnSelectHero(setting.Hero.setedCard);
                }
            });
        }
        selectedHero = null;
        OnSelectHero(null);
        ScrollTop = -(first + dPosition * (allCards.Count - 2)).y;
        HookAllScrollViewObjects();
    }