public static Dictionary <string, HashSet <AchievementCard> > GenerateAchievementLinks(HashSet <AchievementCard> cards) { var lookup = new Dictionary <string, HashSet <AchievementCard> >(); DebugWriter.Log("Generating Achievement Links..."); AchievementCard currentCard = null; try { foreach (AchievementCard card in cards) { currentCard = card; DebugWriter.Log($"Linking card {card.def.label} to {card.tracker.Key}"); if (lookup.TryGetValue(card.tracker.Key, out var hash)) { hash.Add(card); } else { lookup.Add(card.tracker.Key, new HashSet <AchievementCard>() { card }); } } } catch (Exception ex) { string error = $"Failed to generate Achievement Links for {currentCard?.def.label ?? "[Null Card]"}. Exception: {ex.Message}"; Log.Error(error); DebugWriter.Log(error); return(new Dictionary <string, HashSet <AchievementCard> >()); } return(lookup); }
public AchievementNotification(AchievementCard card, Action clickAction = null) { this.card = card; driftOut = true; preventCameraMotion = false; this.clickAction = clickAction; }
public void ResetAchievement(AchievementCard card) { achievementList.Remove(card); AchievementCard newCard = (AchievementCard)Activator.CreateInstance(card.def.achievementClass, new object[] { card.def, false }); achievementList.Add(newCard); achievementLookup = AchievementGenerator.GenerateAchievementLinks(achievementList); typeToKey.Clear(); tickerAchievements.Clear(); }
public void DisplayCardWindow(AchievementCard card) { unlockedCards.Push(card); }