Пример #1
0
    IEnumerator Co_UseCard(int handCardInstanceId, CardInfo_Base cardInfo)
    {
        CardBase cardBase = GetCardByCardInstanceId(handCardInstanceId);

        if (ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
        {
            if (cardBase)
            {
                cardBase.OnPlayOut();
                cards.Remove(cardBase);

                cardBase.transform.DOPause();

                if (currentShowCard)
                {
                    lastShowCard = currentShowCard;
                    lastShowCard.transform.DOPause();

                    lastShowCard.transform.DOMove(USE_CARD_SHOW_POSITION, USE_CARD_SHOW_FLY_DURATION).SetEase(Ease.Linear);
                    lastShowCard.transform.DORotate(new Vector3(0, 180, 0), USE_CARD_SHOW_FLY_DURATION).SetEase(Ease.Linear);
                    lastShowCard.transform.DOScale(Vector3.one * USE_CARD_SHOW_SIZE, USE_CARD_SHOW_FLY_DURATION).SetEase(Ease.Linear);
                }

                if (cardInfo.CardID == 4)
                {
                    int a = 0;
                }
                currentShowCard = CardBase.InstantiateCardByCardInfo(cardInfo, transform, CardBase.CardShowMode.ShowCard, ClientPlayer);
                currentShowCard.transform.position   = cardBase.transform.position;
                currentShowCard.transform.rotation   = cardBase.transform.rotation;
                currentShowCard.transform.localScale = cardBase.transform.localScale;

                cardBase.PoolRecycle();

                currentShowCard.DragComponent.enabled = false;
                currentShowCard.Usable = false;
                currentShowCard.ChangeCardBloomColor(ClientUtils.HTMLColorToColor("#FFFFFF"), 1);
                currentShowCard.ShowCardBloom(true);
                currentShowCard.BeBrightColor();
                currentShowCard.CardOrder = 200;

                currentShowCard.transform.DOMove(USE_CARD_SHOW_POSITION_OVERLAY, USE_CARD_SHOW_FLY_DURATION).SetEase(Ease.Linear);
                currentShowCard.transform.DORotate(new Vector3(-90, 180, 0), USE_CARD_SHOW_FLY_DURATION).SetEase(Ease.Linear);
                currentShowCard.transform.DOScale(Vector3.one * USE_CARD_SHOW_SIZE, USE_CARD_SHOW_FLY_DURATION).SetEase(Ease.Linear);

                AudioManager.Instance.SoundPlay("sfx/OnShowUseCard", 0.5f);

                RefreshCardsPlace();
                yield return(new WaitForSeconds(USE_CARD_SHOW_FLY_DURATION));

                if (lastShowCard)
                {
                    lastShowCard.PoolRecycle();
                    lastShowCard = null;
                }

                yield return(new WaitForSeconds(USE_CARD_SHOW_DURATION * BattleEffectsManager.AnimationSpeed - USE_CARD_SHOW_FLY_DURATION));

                currentShowCard.PoolRecycle();
                currentShowCard = null;
            }
        }

        yield return(null);

        BattleEffectsManager.Instance.Effect_Main.EffectEnd();
    }
Пример #2
0
    private void RefreshPreviewCard(bool refreshAffixPanel = true, UpgradeDegradeOperation operation = UpgradeDegradeOperation.None)
    {
        if (PreviewCard)
        {
            PreviewCard.ShowCardBloom(true);
            PreviewCard.PoolRecycle();
            PreviewCard = null;
        }

        if (PreviewCardDegrade)
        {
        }

        if (PreviewCard_Src.CardInfo.BaseInfo.LimitNum == 0 && operation != UpgradeDegradeOperation.None)
        {
            if (operation == UpgradeDegradeOperation.Degrade)
            {
                PreviewCard_Src = UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().AllCards[PreviewCard_Src.CardInfo.UpgradeInfo.DegradeCardID];
            }
            else if (operation == UpgradeDegradeOperation.Upgrade)
            {
                PreviewCard_Src = UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().AllCards[PreviewCard_Src.CardInfo.UpgradeInfo.UpgradeCardID];
            }
        }

        PreviewCard = CardBase.InstantiateCardByCardInfo(PreviewCard_Src.CardInfo, PreviewContent, CardBase.CardShowMode.CardUpgradePreview);

        if (UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().CurrentEditBuildButton)
        {
            PreviewCard.ChangeCardSelectLimit(UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().CurrentEditBuildButton.BuildInfo.M_BuildCards.CardSelectInfos[PreviewCard.CardInfo.CardID].CardSelectUpperLimit, true);
        }

        PreviewCard.SetBlockCountValue(UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().GetSelectedCardCount(PreviewCard.CardInfo.CardID), true);
        PreviewCard.transform.localScale    = Vector3.one * 18;
        PreviewCard.transform.localPosition = new Vector3(0, 50, 0);
        PreviewCard.ShowCardBloom(true);
        PreviewCard.ChangeCardBloomColor(ClientUtils.HTMLColorToColor("#FFDD8C"), 2);
        PreviewCard.BeBrightColor();
        PreviewCard.BoxCollider.enabled = false;
        PreviewCard.ShowAllSlotBlooms(true);

        bool hasUpgradeCard = false;
        bool hasDegradeCard = false;

        if (SelectBuildManager.Instance.CurrentGameMode == SelectBuildManager.GameMode.Single)
        {
            int u_id = PreviewCard_Src.CardInfo.UpgradeInfo.UpgradeCardID;
            int d_id = PreviewCard_Src.CardInfo.UpgradeInfo.DegradeCardID;
            hasUpgradeCard = u_id != -1 && StoryManager.Instance.GetStory().CardUnlockInfos[u_id];
            hasDegradeCard = d_id != -1 && StoryManager.Instance.GetStory().CardUnlockInfos[d_id];
        }
        else if (SelectBuildManager.Instance.CurrentGameMode == SelectBuildManager.GameMode.Online)
        {
            hasUpgradeCard = PreviewCard_Src.CardInfo.UpgradeInfo.UpgradeCardID != -1;
            hasDegradeCard = PreviewCard_Src.CardInfo.UpgradeInfo.DegradeCardID != -1;
        }

        if (hasUpgradeCard)
        {
            if (!PreviewCardUpgrade)
            {
                PreviewCardUpgrade = CardBase.InstantiateCardByCardInfo(AllCards.GetCard(PreviewCard_Src.CardInfo.UpgradeInfo.UpgradeCardID), PreviewContent, CardBase.CardShowMode.CardUpgradePreview);
            }
            else
            {
                PreviewCardUpgrade.Initiate(AllCards.GetCard(PreviewCard_Src.CardInfo.UpgradeInfo.UpgradeCardID), CardBase.CardShowMode.CardUpgradePreview);
            }

            PreviewCardUpgrade.ChangeCardSelectLimit(UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().CurrentEditBuildButton.BuildInfo.M_BuildCards.CardSelectInfos[PreviewCardUpgrade.CardInfo.CardID].CardSelectUpperLimit, true);
            PreviewCardUpgrade.SetBlockCountValue(UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().GetSelectedCardCount(PreviewCardUpgrade.CardInfo.CardID), true);
            PreviewCardUpgrade.transform.localScale = Vector3.one * 15;
            if (PreviewCardUpgrade.CardInfo.BaseInfo.CardType == CardTypes.Mech)
            {
                PreviewCardUpgrade.transform.localPosition = new Vector3(mechCardPreviewDistance, 50, 0);
                UpgradeArrow.transform.position            = UpgradeArrowPivot_mechCards.position;
            }
            else
            {
                PreviewCardUpgrade.transform.localPosition = new Vector3(normalCardPreviewDistance, 50, 0);
                UpgradeArrow.transform.position            = UpgradeArrowPivot_normal.position;
            }

            UpgradeArrow.enabled = true;

            PreviewCardUpgrade.ShowCardBloom(true);
            PreviewCardUpgrade.ChangeCardBloomColor(ClientUtils.HTMLColorToColor("#FD5400"), 2);
            PreviewCardUpgrade.BeBrightColor();
            PreviewCardUpgrade.BoxCollider.enabled = false;
            PreviewCardUpgrade.ShowAllSlotBlooms(true);
            PreviewCardUpgrade.RefreshCardTextLanguage();
        }
        else
        {
            if (PreviewCardUpgrade)
            {
                PreviewCardUpgrade.ShowCardBloom(true);
                PreviewCardUpgrade.PoolRecycle();
                PreviewCardUpgrade = null;
            }

            UpgradeArrow.enabled = false;
        }

        if (hasDegradeCard)
        {
            if (!PreviewCardDegrade)
            {
                PreviewCardDegrade = CardBase.InstantiateCardByCardInfo(AllCards.GetCard(PreviewCard_Src.CardInfo.UpgradeInfo.DegradeCardID), PreviewContent, CardBase.CardShowMode.CardUpgradePreview);
            }
            else
            {
                PreviewCardDegrade.Initiate(AllCards.GetCard(PreviewCard_Src.CardInfo.UpgradeInfo.DegradeCardID), CardBase.CardShowMode.CardUpgradePreview);
            }

            PreviewCardDegrade.ChangeCardSelectLimit(UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().CurrentEditBuildButton.BuildInfo.M_BuildCards.CardSelectInfos[PreviewCardDegrade.CardInfo.CardID].CardSelectUpperLimit, true);
            PreviewCardDegrade.SetBlockCountValue(UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().GetSelectedCardCount(PreviewCardDegrade.CardInfo.CardID), true);
            PreviewCardDegrade.transform.localScale = Vector3.one * 15;
            if (PreviewCardDegrade.CardInfo.BaseInfo.CardType == CardTypes.Mech)
            {
                PreviewCardDegrade.transform.localPosition = new Vector3(-mechCardPreviewDistance, 50, 0);
                DegradeArrow.transform.position            = DegradeArrowPivot_mechCards.position;
            }
            else
            {
                PreviewCardDegrade.transform.localPosition = new Vector3(-normalCardPreviewDistance, 50, 0);
                DegradeArrow.transform.position            = DegradeArrowPivot_normal.position;
            }

            PreviewCardDegrade.ShowCardBloom(true);
            PreviewCardDegrade.ChangeCardBloomColor(ClientUtils.HTMLColorToColor("#0CE9FF"), 2);
            PreviewCardDegrade.BeBrightColor();
            PreviewCardDegrade.BoxCollider.enabled = false;
            PreviewCardDegrade.ShowAllSlotBlooms(true);
            PreviewCardDegrade.RefreshCoinPosition();

            DegradeArrow.enabled = true;
        }
        else
        {
            if (PreviewCardDegrade)
            {
                PreviewCardDegrade.ShowCardBloom(true);
                PreviewCardDegrade.PoolRecycle();
                PreviewCardDegrade = null;
            }

            DegradeArrow.enabled = false;
        }

        if (refreshAffixPanel)
        {
            List <CardInfo_Base> cardInfos = new List <CardInfo_Base>();
            cardInfos.Add(PreviewCard.CardInfo);
            if (PreviewCardDegrade)
            {
                cardInfos.Add(PreviewCardDegrade.CardInfo);
            }
            if (PreviewCardUpgrade)
            {
                cardInfos.Add(PreviewCardUpgrade.CardInfo);
            }
            UIManager.Instance.ShowUIForms <AffixPanel>().ShowAffixTips(cardInfos, null);
        }

        //如果显示Tips占据屏幕空间的话,右移预览卡牌窗口
        if (UIManager.Instance.GetBaseUIForm <AffixPanel>().IsShow&& PreviewCardDegrade != null)
        {
            AllContainer.position = PreviewCardPanelRightPivot.position;
        }
        else
        {
            AllContainer.position = PreviewCardPanelCenterPivot.position;
        }
    }