public SortedDictionary <CardStatTypes, int> GetTypeCardCountDict(Editor_CardSelectModes mode) { SortedDictionary <CardStatTypes, int> res = new SortedDictionary <CardStatTypes, int>(); res.Add(CardStatTypes.Total, 0); res.Add(CardStatTypes.HeroMech, 0); res.Add(CardStatTypes.SoldierMech, 0); res.Add(CardStatTypes.Equip, 0); res.Add(CardStatTypes.Energy, 0); res.Add(CardStatTypes.Spell, 0); foreach (KeyValuePair <int, CardSelectInfo> kv in CardSelectInfos) { CardStatTypes type = AllCards.GetCard(kv.Key).CardStatType; if (mode == Editor_CardSelectModes.SelectCount) { res[type] += kv.Value.CardSelectCount; res[CardStatTypes.Total] += kv.Value.CardSelectCount; } else if (mode == Editor_CardSelectModes.UpperLimit) { res[type] += kv.Value.CardSelectUpperLimit; res[CardStatTypes.Total] += kv.Value.CardSelectUpperLimit; } } return(res); }
private void RefreshTypeCardCountButtons(CardStatTypes cardStatType) { foreach (LevelEditorPanel_TypeCardCount tcc in TypeCardCounts) { tcc.IsSelected = tcc.CardStatType == cardStatType; } }
public void Initialize(CardStatTypes cardStatType, int count, UnityAction onClick) { CardStatType = cardStatType; Button.onClick.RemoveAllListeners(); Button.onClick.AddListener(onClick); PicImage.sprite = SpritePresets[(int)cardStatType]; LanguageManager.Instance.RegisterTextKey(CardTypeText, "CardType_" + cardStatType); CountText.text = "x" + count; }
public SortedDictionary <int, int> GetCostDictByEnergy(Editor_CardSelectModes mode, CardStatTypes cardStatType) { SortedDictionary <int, int> res = new SortedDictionary <int, int>(); for (int i = 0; i <= 10; i++) { res.Add(i, 0); } foreach (KeyValuePair <int, CardSelectInfo> kv in CardSelectInfos) { CardInfo_Base ci = AllCards.GetCard(kv.Key); if (cardStatType == CardStatTypes.Total || ci.CardStatType == cardStatType) { if (mode == Editor_CardSelectModes.SelectCount) { if (ci.BaseInfo.Energy < 10) { res[ci.BaseInfo.Energy] += kv.Value.CardSelectCount; } else { res[10] += kv.Value.CardSelectCount; } } else if (mode == Editor_CardSelectModes.UpperLimit) { if (ci.BaseInfo.Energy < 10) { res[ci.BaseInfo.Energy] += kv.Value.CardSelectUpperLimit; } else { res[10] += kv.Value.CardSelectUpperLimit; } } } } return(res); }
private void RefreshBars(CardStatTypes cardStatType) { foreach (LevelEditorPanel_CostStatBar csb in CostStatBars_Metal) { csb.PoolRecycle(); } CostStatBars_Metal.Clear(); foreach (LevelEditorPanel_CostStatBar csb in CostStatBars_Energy) { csb.PoolRecycle(); } CostStatBars_Energy.Clear(); SortedDictionary <int, int> costDict_Metal = BuildCards.GetCostDictByMetal(M_SelectMode, cardStatType); int maxCount_Metal = 0; foreach (KeyValuePair <int, int> kv in costDict_Metal) { if (kv.Key == 0) { continue; } maxCount_Metal = Mathf.Max(maxCount_Metal, kv.Value); } foreach (KeyValuePair <int, int> kv in BuildCards.GetCostDictByMetal(M_SelectMode, cardStatType)) { if (kv.Key == 0) { continue; } LevelEditorPanel_CostStatBar csb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.LevelEditorPanel_CostStatBar].AllocateGameObject <LevelEditorPanel_CostStatBar>(CostStatBarContainer_Metal); csb.Initialize(kv.Key, kv.Value, maxCount_Metal, LevelEditorPanel_CostStatBar.ColorTypes.Metal, CostStatBarBaseLine_Metal); CostStatBars_Metal.Add(csb); } SortedDictionary <int, int> costDict_Energy = BuildCards.GetCostDictByEnergy(M_SelectMode, cardStatType); int maxCount_Energy = 0; foreach (KeyValuePair <int, int> kv in costDict_Energy) { if (kv.Key == 0) { continue; } maxCount_Energy = Mathf.Max(maxCount_Energy, kv.Value); } foreach (KeyValuePair <int, int> kv in BuildCards.GetCostDictByEnergy(M_SelectMode, cardStatType)) { if (kv.Key == 0) { continue; } LevelEditorPanel_CostStatBar csb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.LevelEditorPanel_CostStatBar].AllocateGameObject <LevelEditorPanel_CostStatBar>(CostStatBarContainer_Energy); csb.Initialize(kv.Key, kv.Value, maxCount_Energy, LevelEditorPanel_CostStatBar.ColorTypes.Energy, CostStatBarBaseLine_Energy); CostStatBars_Energy.Add(csb); } }