Esempio n. 1
0
    private void UnSelectCard(CardBase card, SelectCardMethods selectCardMethod)
    {
        if (IsReadOnly)
        {
            if (Client.Instance.IsPlaying())
            {
                NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_CannotEditWhenPlaying"), 0, 0.1f);
            }
            else if (Client.Instance.IsMatching())
            {
                NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_Notice_LoginMenu_ClientNeedUpdate"), 0, 0.1f);
            }

            return;
        }

        if (CurrentEditBuildButton == null)
        {
            NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerPreviewUpgrade_PleaseCreateDeck"), 0f, 1f);
            return;
        }

        bool isHero = card.CardInfo.BaseInfo.CardType == CardTypes.Mech && !card.CardInfo.MechInfo.IsSoldier;
        Dictionary <int, SelectCard> selectCards = isHero ? SelectedHeroes : SelectedCards;

        int count = --selectCards[card.CardInfo.CardID].Count;

        card.SetBlockCountValue(count);
        if (selectCards[card.CardInfo.CardID].Count == 0)
        {
            selectCards[card.CardInfo.CardID].PoolRecycle();
            selectCards.Remove(card.CardInfo.CardID);
            card.BeDimColor();
            card.ShowCardBloom(false);
        }

        if (isHero)
        {
            HeroCardCount--;
        }
        else
        {
            SelectCardCount--;
        }

        if (selectCardMethod != SelectCardMethods.SwitchBuildButton)
        {
            CurrentEditBuildButton.RemoveCard(card.CardInfo.CardID);
            RefreshCoinLifeEnergy();
            if (selectCardMethod == SelectCardMethods.CardClick)
            {
                AudioManager.Instance.SoundPlay("sfx/UnSelectCard");
            }
        }
    }
Esempio n. 2
0
    public void UnSelectAllCard(SelectCardMethods selectCardMethod)
    {
        if (IsReadOnly)
        {
            return;
        }

        foreach (KeyValuePair <int, CardBase> kv in AllCards)
        {
            kv.Value.BeDimColor();
            kv.Value.ShowCardBloom(false);
            kv.Value.SetBlockCountValue(0);
            if (SelectedCards.ContainsKey(kv.Key))
            {
                SelectedCards[kv.Key].PoolRecycle();
                SelectedCards.Remove(kv.Key);
            }

            if (SelectedHeroes.ContainsKey(kv.Key))
            {
                SelectedHeroes[kv.Key].PoolRecycle();
                SelectedHeroes.Remove(kv.Key);
            }
        }

        if (selectCardMethod == SelectCardMethods.ButtonClick && selectCardMethod != SelectCardMethods.DeleteBuild)
        {
            if (CurrentEditBuildButton != null)
            {
                CurrentEditBuildButton.BuildInfo.M_BuildCards.ClearAllCardCounts();
                CurrentEditBuildButton.RefreshCardCountText();
                CurrentEditBuildButton.BuildInfo.Life   = CurrentGamePlaySettings.DefaultLife;
                CurrentEditBuildButton.BuildInfo.Energy = CurrentGamePlaySettings.DefaultEnergy;
                RefreshCoinLifeEnergy();
                AudioManager.Instance.SoundPlay("sfx/UnSelectCard");
            }
        }

        SelectCardCount = 0;
        HeroCardCount   = 0;
    }
Esempio n. 3
0
    private bool SelectCard(CardBase card, SelectCardMethods selectCardMethod, int leftCoin_SelectAll = 0)
    {
        if (IsReadOnly)
        {
            if (Client.Instance.IsPlaying())
            {
                NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_CannotEditWhenPlaying"), 0, 0.1f);
            }
            else if (Client.Instance.IsMatching())
            {
                NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_CannotEditWhenPlaying"), 0, 0.1f);
            }
            return(false);
        }

        if (CurrentEditBuildButton == null)
        {
            OnCreateNewBuildButtonClick();
            NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_DeckCreatedPleaseSelectCards"), 0f, 1f);
            return(false);
        }

        if (selectCardMethod != SelectCardMethods.SwitchBuildButton)
        {
            int leftCoin = (selectCardMethod == SelectCardMethods.ButtonClick) ? leftCoin_SelectAll : (CurrentGamePlaySettings.DefaultMaxCoin - CurrentEditBuildButton.BuildInfo.BuildConsumeCoin);
            if (leftCoin < card.CardInfo.BaseInfo.Coin)
            {
                if ((selectCardMethod & SelectCardMethods.SingleSelect) == selectCardMethod)
                {
                    NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_BudgetLimited"), 0f, 1f);
                }

                return(false);
            }
        }

        bool isHero = card.CardInfo.BaseInfo.CardType == CardTypes.Mech && !card.CardInfo.MechInfo.IsSoldier;
        Dictionary <int, SelectCard> selectCards = isHero ? SelectedHeroes : SelectedCards;

        if (isHero && isSelectedHeroFull)
        {
            if ((selectCardMethod & SelectCardMethods.SingleSelect) == selectCardMethod)
            {
                NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_HeroesNumberUpperLimit"), 0, 1f);
            }

            return(false);
        }

        if ((selectCardMethod & SelectCardMethods.SingleSelect) == selectCardMethod)
        {
            card.SetBannerType(CardNoticeComponent.BannerTypes.None);
        }

        StoryManager.Instance.JustGetNewCards.Remove(card.CardInfo.CardID);
        if (selectCards.ContainsKey(card.CardInfo.CardID))
        {
            SelectCard sc = selectCards[card.CardInfo.CardID];
            if (sc.Count >= card.CardInfo.BaseInfo.LimitNum)
            {
                if ((selectCardMethod & SelectCardMethods.SingleSelect) == selectCardMethod)
                {
                    NoticeManager.Instance.ShowInfoPanelCenter(string.Format(LanguageManager.Instance.GetText("Notice_SelectBuildManagerSelect_OnlyTakeSeveralCards"), card.CardInfo.BaseInfo.LimitNum), 0, 0.7f);
                }

                return(false);
            }

            int count = ++sc.Count;
            card.SetBlockCountValue(count);
        }
        else
        {
            SelectCard newSC = GenerateNewSelectCard(card);
            selectCards.Add(card.CardInfo.CardID, newSC);
            if ((selectCardMethod & SelectCardMethods.SingleSelect) == selectCardMethod)
            {
                SortSelectCards();
            }
            card.SetBlockCountValue(1);
            card.BeBrightColor();
            card.ShowCardBloom(true);
        }

        if (isHero)
        {
            HeroCardCount++;
        }
        else
        {
            SelectCardCount++;
        }

        if (selectCardMethod != SelectCardMethods.SwitchBuildButton)
        {
            CurrentEditBuildButton.AddCard(card.CardInfo.CardID);
            if (selectCardMethod == SelectCardMethods.CardClick)
            {
                AudioManager.Instance.SoundPlay("sfx/SelectCard");
            }

            if ((selectCardMethod & SelectCardMethods.SingleSelect) == selectCardMethod)
            {
                RefreshCoinLifeEnergy();
            }
        }

        return(true);
    }