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); }
public void UpdateCardUpgradeDegrade(bool isUpgrade, CardBase previewCard) { if (CurrentEditBuildButton == null) { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerPreviewUpgrade_PleaseCreateDeck"), 0f, 1f); return; } int currentCardID = previewCard.CardInfo.CardID; int changeCardID = isUpgrade ? previewCard.CardInfo.UpgradeInfo.UpgradeCardID : previewCard.CardInfo.UpgradeInfo.DegradeCardID; CardInfo_Base changeCardInfo = global::AllCards.GetCard(changeCardID); if (previewCard.CardInfo.BaseInfo.LimitNum == 0) { return; } if (CurrentEditBuildButton.BuildInfo.M_BuildCards.GetCardLimitDict()[currentCardID] > 0) { if ((CurrentGamePlaySettings.DefaultMaxCoin - CurrentEditBuildButton.BuildInfo.BuildConsumeCoin) + (previewCard.CardInfo.BaseInfo.Coin - changeCardInfo.BaseInfo.Coin) < 0) { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_SelectBuildManagerPreviewUpgrade_NotEnoughBudget"), 0f, 1f); return; } } CardBase changeCard = AllCards[changeCardID]; if (changeCard.CardInfo.BaseInfo.LimitNum == 0) { AllCardContainers[changeCardID].gameObject.SetActive(true); AllShownCards.Add(changeCardID, changeCard); } previewCard.ChangeCardSelectLimit(previewCard.CardInfo.BaseInfo.LimitNum - 1); changeCard.ChangeCardSelectLimit(changeCard.CardInfo.BaseInfo.LimitNum + 1); CurrentEditBuildButton.BuildInfo.M_BuildCards.CardSelectInfos[previewCard.CardInfo.CardID].CardSelectUpperLimit--; CurrentEditBuildButton.BuildInfo.M_BuildCards.CardSelectInfos[changeCardID].CardSelectUpperLimit++; if (GetSelectedCardCount(previewCard.CardInfo.CardID) > 0) { UnSelectCard(previewCard, SelectCardMethods.UpgradeDegrade); SelectCard(changeCard, SelectCardMethods.UpgradeDegrade); RefreshCoinLifeEnergy(); } AudioManager.Instance.SoundPlay("sfx/OnMoneyChange"); AudioManager.Instance.SoundPlay("sfx/ShowCardDetail"); HideNoLimitCards(); }
public void SetCardLimit(SortedDictionary <int, int> cardLimits) { foreach (KeyValuePair <int, int> kv in cardLimits) { int CardID = kv.Key; int CardLimitCount = kv.Value; if (AllCards.ContainsKey(CardID)) { CardBase cb = AllCards[CardID]; cb.ChangeCardSelectLimit(CardLimitCount); if (!AllShownCards.ContainsKey(CardID)) { if (CardLimitCount > 0) { AllShownCards.Add(CardID, cb); AllCardContainers[CardID].gameObject.SetActive(true); } else { AllCardContainers[CardID].gameObject.SetActive(false); } } else { if (CardLimitCount == 0) { AllCardContainers[CardID].gameObject.SetActive(false); AllShownCards.Remove(CardID); } } } } HideHigherLevelNumCardsForStoryMode(); }
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; } }