Пример #1
0
 public void SetSelected(bool isSelected)
 {
     IsSelected             = isSelected;
     BorderSelected.enabled = isSelected;
     card?.ShowCardBloom(isSelected);
     if (isSelected)
     {
         card?.BeBrightColor();
     }
     else
     {
         card?.BeDimColor();
     }
 }
Пример #2
0
    public void HandCardEnlarge(CardBase focusCard)
    {
        if (ClientPlayer == null)
        {
            return;
        }
        if (ClientPlayer.WhichPlayer == Players.Enemy)
        {
            return;
        }
        if (IsBeginDrag && DragManager.Instance.CurrentDrag.gameObject != focusCard.gameObject)
        {
            return;
        }

        focusCard.transform.DOPause();

        //Replace the card by a BoxCollider
        ColliderReplace colliderReplace = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ColliderReplace].AllocateGameObject <ColliderReplace>(transform);

        colliderReplace.Initiate(focusCard);
        //Enlarge the card and put it in upright position
        focusCard.transform.localScale = Vector3.one * PULL_OUT_CARD_SIZE;
        focusCard.transform.rotation   = DefaultCardPivot.rotation;
        focusCard.transform.position   = new Vector3(focusCard.transform.position.x, focusCard.transform.position.y, focusCard.transform.position.z + PULL_OUT_CARD_OFFSET);
        //Disable the card's BoxCollider
        focusCard.BoxCollider.enabled = false;
        focusCard.CardOrder           = 200;
        focusCard.BeBrightColor();
        isEnlarge = true;
    }
Пример #3
0
    private void SelectCardOnMouseEnter(SelectCard selectCard)
    {
        if (UIManager.Instance.IsPeekUIForm <CardPreviewPanel>())
        {
            return;
        }
        SelectCardPreviewRawImage.enabled = true;
        if (selectCard.transform.position.y > CurrentPreviewCardMaxPivot.position.y)
        {
            currentPreviewCardContainer.position = new Vector3(selectCard.transform.position.x, CurrentPreviewCardMaxPivot.position.y, selectCard.transform.position.z);
        }
        else if (selectCard.transform.position.y < CurrentPreviewCardMinPivot.position.y)
        {
            currentPreviewCardContainer.position = new Vector3(selectCard.transform.position.x, CurrentPreviewCardMinPivot.position.y, selectCard.transform.position.z);
        }
        else
        {
            currentPreviewCardContainer.position = new Vector3(selectCard.transform.position.x, selectCard.transform.position.y, selectCard.transform.position.z);
        }

        currentPreviewCard = CardBase.InstantiateCardByCardInfo(selectCard.CardInfo.Clone(), currentPreviewCardContainer, CardBase.CardShowMode.SelectedCardPreview);
        currentPreviewCard.transform.localPosition = new Vector3(-180f, 0, 0);
        currentPreviewCard.transform.Translate(0, 0, -1, Space.World);
        currentPreviewCard.transform.localScale = Vector3.one * 20;
        currentPreviewCard.transform.rotation   = Quaternion.Euler(0, 180, 0);
        currentPreviewCard.BeBrightColor();
        currentPreviewCard.ShowCardBloom(true);
        currentPreviewCard.ChangeCardSelectLimit(0);

        UIManager.Instance.ShowUIForms <AffixPanel>().ShowAffixTips(new List <CardInfo_Base> {
            selectCard.CardInfo
        }, null);
    }
Пример #4
0
    public override void Initialize(ShopItem shopItem)
    {
        base.Initialize(shopItem);
        ShopItem_Card si_card = (ShopItem_Card)shopItem;

        M_CardBase = CardBase.InstantiateCardByCardInfo(AllCards.GetCard(si_card.GenerateCardID), CardContainer, CardBase.CardShowMode.CardReward);
        M_CardBase.transform.localPosition = CardRotateSample.localPosition;
        M_CardBase.transform.localRotation = CardRotateSample.localRotation;
        M_CardBase.transform.localScale    = CardRotateSample.localScale;
        M_CardBase.CardOrder = 1;
        M_CardBase.BeBrightColor();
        M_CardBase.ShowCardBloom(false);
    }
    public void ShowCardDetail(CardInfo_Base CardInfo, ShowPlaces showPlace = ShowPlaces.RightCenter) //鼠标悬停放大查看原卡牌信息
    {
        detailCard = CardBase.InstantiateCardByCardInfo(CardInfo, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
        detailCard.transform.localScale = Vector3.one * DETAIL_SINGLE_CARD_SIZE;
        Vector3 targetPos;

        switch (showPlace)
        {
        case ShowPlaces.RightCenter:
        {
            targetPos = new Vector3(-3.5f, 7f, 0);
            break;
        }

        case ShowPlaces.LeftLower:
        {
            targetPos = new Vector3(-5.5f, 7f, -3.3f);
            break;
        }

        case ShowPlaces.RightUpper:
        {
            targetPos = new Vector3(7.5f, 7f, 3.3f);
            break;
        }

        default:
        {
            targetPos = new Vector3(-3.5f, 7f, 0);
            break;
        }
        }

        detailCard.transform.rotation  = Quaternion.Euler(DETAIL_ROTATION.x, DETAIL_ROTATION.y, DETAIL_ROTATION.z);
        detailCard.transform.position  = targetPos;
        detailCard.BoxCollider.enabled = false;
        detailCard.BeBrightColor();
        detailCard.CardOrder = 200;
        detailCard.ShowCardBloom(true);
        List <CardInfo_Base> cardInfos = new List <CardInfo_Base>();

        if (detailCard != null)
        {
            cardInfos.Add(detailCard.CardInfo);
        }
        UIManager.Instance.ShowUIForms <AffixPanel>().ShowAffixTips(cardInfos, null);
    }
Пример #6
0
    public void HandCardShrink(CardBase lostFocusCard)
    {
        if (ClientPlayer == null)
        {
            return;
        }
        if (ClientPlayer.WhichPlayer == Players.Enemy)
        {
            return;
        }
        if (IsBeginDrag)
        {
            return;
        }

        lostFocusCard.transform.DOPause();

        lostFocusCard.transform.localScale = Vector3.one * HAND_CARD_SIZE;
        if (lostFocusCard.MyColliderReplace)
        {
            lostFocusCard.transform.position = lostFocusCard.MyColliderReplace.transform.position;
            lostFocusCard.transform.rotation = lostFocusCard.MyColliderReplace.transform.rotation;
        }

        if (lostFocusCard.Usable)
        {
            lostFocusCard.BeBrightColor();
        }
        else
        {
            lostFocusCard.BeDimColor();
        }

        lostFocusCard.ResetColliderAndReplace();
        currentFocusCardTickerBegin = false;
        UIManager.Instance.CloseUIForm <AffixPanel>();
        isEnlarge = false;
    }
Пример #7
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();
    }
Пример #8
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;
        }
    }
    public void ShowCardDetail(ModuleBase moduleBase) //鼠标悬停放大查看原卡牌信息
    {
        CardInfo_Base CardInfo = moduleBase.CardInfo;

        switch (CardInfo.BaseInfo.CardType)
        {
        case CardTypes.Mech:
            detailCard = (CardMech)CardBase.InstantiateCardByCardInfo(CardInfo, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
            detailCard.transform.localScale  = Vector3.one * DETAIL_MECH_CARD_SIZE;
            detailCard.transform.position    = DetailMechCardPivot.position;
            detailCard.BoxCollider.enabled   = false;
            detailCard.DragComponent.enabled = false;
            detailCard.BeBrightColor();
            detailCard.CardOrder = 200;

            CardMech cardMech = (CardMech)detailCard;
            //cardMech.ShowAllSlotHover();

            if (((ModuleMech)moduleBase).MechEquipSystemComponent.M_Weapon)
            {
                if (!cardMech.Weapon)
                {
                    cardMech.Weapon = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ModuleWeaponDetail].AllocateGameObject <ModuleWeapon>(cardMech.transform);
                }

                CardInfo_Base cw = ((ModuleMech)moduleBase).MechEquipSystemComponent.M_Weapon.CardInfo;

                cardMech.Weapon.M_ModuleMech = (ModuleMech)moduleBase;
                cardMech.Weapon.Initiate(((ModuleMech)moduleBase).MechEquipSystemComponent.M_Weapon.GetCurrentCardInfo(), moduleBase.ClientPlayer);
                cardMech.Weapon.DragComponent.enabled       = false;
                cardMech.Weapon.MouseHoverComponent.enabled = false;
                cardMech.Weapon.SetPreview();

                detailCard_Weapon = (CardEquip)CardBase.InstantiateCardByCardInfo(cw, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
                detailCard_Weapon.transform.rotation   = Quaternion.Euler(DETAIL_ROTATION.x, DETAIL_ROTATION.y, DETAIL_ROTATION.z);
                detailCard_Weapon.transform.localScale = Vector3.one * DETAIL_EQUIPMENT_CARD_SIZE;
                detailCard_Weapon.transform.position   = DetailMechWeaponCardPivot.position;
                detailCard_Weapon.BoxCollider.enabled  = false;
                detailCard_Weapon.BeBrightColor();
                detailCard_Weapon.ShowCardBloom(true);
                detailCard_Weapon.CardOrder = 200;
            }

            if (((ModuleMech)moduleBase).MechEquipSystemComponent.M_Shield)
            {
                if (!cardMech.Shield)
                {
                    cardMech.Shield = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ModuleShieldDetail].AllocateGameObject <ModuleShield>(cardMech.transform);
                }

                CardInfo_Base cw = ((ModuleMech)moduleBase).MechEquipSystemComponent.M_Shield.CardInfo;
                cardMech.Shield.M_ModuleMech = (ModuleMech)moduleBase;
                cardMech.Shield.Initiate(((ModuleMech)moduleBase).MechEquipSystemComponent.M_Shield.GetCurrentCardInfo(), moduleBase.ClientPlayer);
                cardMech.Shield.DragComponent.enabled       = false;
                cardMech.Shield.MouseHoverComponent.enabled = false;
                cardMech.Shield.SetPreview();

                detailCard_Shield = (CardEquip)CardBase.InstantiateCardByCardInfo(cw, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
                detailCard_Shield.transform.rotation   = Quaternion.Euler(DETAIL_ROTATION.x, DETAIL_ROTATION.y, DETAIL_ROTATION.z);
                detailCard_Shield.transform.localScale = Vector3.one * DETAIL_EQUIPMENT_CARD_SIZE;
                detailCard_Shield.transform.position   = DetailMechShieldCardPivot.position;
                detailCard_Shield.BoxCollider.enabled  = false;
                detailCard_Shield.BeBrightColor();
                detailCard_Shield.ShowCardBloom(true);
                detailCard_Shield.CardOrder = 200;
            }

            if (((ModuleMech)moduleBase).MechEquipSystemComponent.M_Pack)
            {
                if (!cardMech.Pack)
                {
                    cardMech.Pack = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ModulePackDetail].AllocateGameObject <ModulePack>(cardMech.transform);
                }

                CardInfo_Base cw = ((ModuleMech)moduleBase).MechEquipSystemComponent.M_Pack.CardInfo;
                cardMech.Pack.M_ModuleMech = (ModuleMech)moduleBase;
                cardMech.Pack.Initiate(((ModuleMech)moduleBase).MechEquipSystemComponent.M_Pack.GetCurrentCardInfo(), moduleBase.ClientPlayer);
                cardMech.Pack.DragComponent.enabled       = false;
                cardMech.Pack.MouseHoverComponent.enabled = false;
                cardMech.Pack.SetPreview();

                detailCard_Pack = (CardEquip)CardBase.InstantiateCardByCardInfo(cw, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
                detailCard_Pack.transform.rotation   = Quaternion.Euler(DETAIL_ROTATION.x, DETAIL_ROTATION.y, DETAIL_ROTATION.z);
                detailCard_Pack.transform.localScale = Vector3.one * DETAIL_EQUIPMENT_CARD_SIZE;
                detailCard_Pack.transform.position   = DetailMechPackCardPivot.position;
                detailCard_Pack.BoxCollider.enabled  = false;
                detailCard_Pack.BeBrightColor();
                detailCard_Pack.ShowCardBloom(true);
                detailCard_Pack.CardOrder = 200;
            }

            if (((ModuleMech)moduleBase).MechEquipSystemComponent.M_MA)
            {
                if (!cardMech.MA)
                {
                    cardMech.MA = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ModuleMADetail].AllocateGameObject <ModuleMA>(cardMech.transform);
                }

                CardInfo_Base cw = ((ModuleMech)moduleBase).MechEquipSystemComponent.M_MA.CardInfo;
                cardMech.MA.M_ModuleMech = (ModuleMech)moduleBase;
                cardMech.MA.Initiate(((ModuleMech)moduleBase).MechEquipSystemComponent.M_MA.GetCurrentCardInfo(), moduleBase.ClientPlayer);
                cardMech.MA.DragComponent.enabled       = false;
                cardMech.MA.MouseHoverComponent.enabled = false;
                cardMech.MA.SetPreview();

                detailCard_MA = (CardEquip)CardBase.InstantiateCardByCardInfo(cw, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
                detailCard_MA.transform.rotation   = Quaternion.Euler(DETAIL_ROTATION.x, DETAIL_ROTATION.y, DETAIL_ROTATION.z);
                detailCard_MA.transform.localScale = Vector3.one * DETAIL_EQUIPMENT_CARD_SIZE;
                detailCard_MA.transform.position   = DetailMechMACardPivot.position;
                detailCard_MA.BoxCollider.enabled  = false;
                detailCard_MA.BeBrightColor();
                detailCard_MA.ShowCardBloom(true);
                detailCard_MA.CardOrder = 200;
            }

            cardMech.SetEquipInPlace();

            break;

        case CardTypes.Equip:
            detailCard = (CardEquip)CardBase.InstantiateCardByCardInfo(CardInfo, BattleManager.Instance.ShowCardDetailInBattleManager.transform, CardBase.CardShowMode.CardPreviewBattle, RoundManager.Instance.SelfClientPlayer);
            detailCard.transform.localScale = Vector3.one * DETAIL_SINGLE_CARD_SIZE;
            detailCard.transform.position   = DetailOtherCardPivot.position;
            detailCard.BoxCollider.enabled  = false;
            detailCard.BeBrightColor();
            detailCard.CardOrder = 200;
            break;
        }

        detailCard.transform.rotation = Quaternion.Euler(DETAIL_ROTATION.x, DETAIL_ROTATION.y, DETAIL_ROTATION.z);
        detailCard.ShowCardBloom(true);
        if (detailCard is CardMech mechCard)
        {
            mechCard.ShowEquipCardBloom();
        }

        List <CardInfo_Base> cardInfos = new List <CardInfo_Base>();

        if (detailCard != null)
        {
            cardInfos.Add(detailCard.CardInfo);
        }
        if (detailCard_Weapon != null)
        {
            cardInfos.Add(detailCard_Weapon.CardInfo);
        }
        if (detailCard_Shield != null)
        {
            cardInfos.Add(detailCard_Shield.CardInfo);
        }
        if (detailCard_Pack != null)
        {
            cardInfos.Add(detailCard_Pack.CardInfo);
        }
        if (detailCard_MA != null)
        {
            cardInfos.Add(detailCard_MA.CardInfo);
        }
        UIManager.Instance.ShowUIForms <AffixPanel>().ShowAffixTips(cardInfos, moduleBase is ModuleMech ? new List <ModuleMech> {
            (ModuleMech)moduleBase
        } : null);
    }
Пример #10
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);
    }