public void DeleteBuild(string username, int buildID, bool isSingle = false) { if (BuildInfoDict.ContainsKey(buildID)) { BuildInfoDict.Remove(buildID); } if (!isSingle) { if (PlayerBuilds.ContainsKey(username)) { if (PlayerBuilds[username].Contains(buildID)) { PlayerBuilds[username].Remove(buildID); } } } else { if (PlayerStoryStates.ContainsKey(username)) { PlayerStoryStates[username].PlayerBuildInfos.Remove(buildID); } } }
public void AddOrModifyBuild(string username, BuildInfo buildInfo, bool isSingle = false) { if (!BuildInfoDict.ContainsKey(buildInfo.BuildID)) { BuildInfoDict.Add(buildInfo.BuildID, buildInfo); } else { BuildInfoDict[buildInfo.BuildID] = buildInfo; } if (!isSingle) { if (!PlayerBuilds.ContainsKey(username)) { PlayerBuilds.Add(username, new List <int>()); } if (!PlayerBuilds[username].Contains(buildInfo.BuildID)) { PlayerBuilds[username].Add(buildInfo.BuildID); } } else { if (PlayerStoryStates.ContainsKey(username)) { Story story = PlayerStoryStates[username]; if (!story.PlayerBuildInfos.ContainsKey(buildInfo.BuildID)) { story.PlayerBuildInfos.Add(buildInfo.BuildID, buildInfo); } else { story.PlayerBuildInfos[buildInfo.BuildID] = buildInfo; } } } }