public void ResearchReorderPriority(ResearchTopicInfo field, DevelopmentTopicInfo unlock, int index) { if (field == null) { throw new ArgumentNullException(nameof(field)); } if (unlock == null) { throw new ArgumentNullException(nameof(unlock)); } if (index < 0 || index >= field.Topic.Unlocks[field.NextLevel].Length) { return; } var game = this.gameInstance; var orderedPriorities = game.Orders[this.PlayerInstance(game)].ResearchPriorities; if (!orderedPriorities.ContainsKey(field.IdCode)) { orderedPriorities[field.IdCode] = field.Topic.Unlocks[field.NextLevel]; } var fieldPriorities = orderedPriorities[field.IdCode].Where(x => x != unlock.IdCode).ToList(); fieldPriorities.Insert(index, unlock.IdCode); orderedPriorities[field.IdCode] = fieldPriorities.ToArray(); }
public ResearchTopicInfo[] ResearchTopics() { var game = this.gameInstance; var player = this.PlayerInstance(game); if (game.Derivates[player].ResearchPlan == null) { game.Derivates[player].CalculateResearch(game); } var investments = game.Derivates[player].ResearchPlan.ToDictionary(x => x.Item.Topic); var finishedFields = game.States.ResearchAdvances. Of[player]. Where(x => !investments.ContainsKey(x.Topic)). ToDictionary(x => x.Topic); var infos = new ResearchTopicInfo[game.Statics.ResearchTopics.Count]; for (int i = 0; i < infos.Length; i++) { var field = game.Statics.ResearchTopics[i]; infos[i] = investments.ContainsKey(field) ? new ResearchTopicInfo(investments[field].Item, investments[field]) : new ResearchTopicInfo(finishedFields[field]); } return(infos); }
private void updateFieldDescription(Control topic) { var selection = topic as ResearchItem; this.selectedField = (ResearchTopicInfo)topic.Tag; techImage.Image = ImageCache.Get[selection.Data.ImagePath]; fieldDescription.Text = selection.Data.Description; this.updateUnlocks(); }
public FormResearch(PlayerController controller) : this() { this.Font = SettingsWinforms.Get.FormFont; this.controller = controller; this.selectedField = controller.ResearchFocus; this.topics = controller.ResearchTopics(); updateReserchList(); this.topicList.SelectedIndex = Array.IndexOf(this.topics, controller.ResearchFocus); updateFieldDescription(this.topicList.SelectedItem); var context = LocalizationManifest.Get.CurrentLanguage["FormTech"]; this.focusAction.Text = context["focusButton"].Text(); this.priorityTitle.Text = context["priorityTitle"].Text(); this.Text = context["ResearchTitle"].Text(); }
public IEnumerable <DevelopmentTopicInfo> ResearchUnlockPriorities(ResearchTopicInfo field) { var game = this.gameInstance; var player = this.PlayerInstance(game); var orderedPriorities = game.Orders[player].ResearchPriorities; var unlockIds = orderedPriorities.ContainsKey(field.IdCode) ? orderedPriorities[field.IdCode] : field.Topic.Unlocks[field.NextLevel]; var developmentTopics = game.Statics.DevelopmentTopics; return(unlockIds.Select(id => new DevelopmentTopicInfo(new DevelopmentProgress( game.Statics.DevelopmentTopics.First(x => x.IdCode == id), player ))).ToArray()); }
public void SetData(ResearchTopicInfo topicInfo) { this.Data = topicInfo; ThousandsFormatter thousandsFormat = new ThousandsFormatter(topicInfo.Cost); thumbnailImage.Image = ImageCache.Get[topicInfo.ImagePath]; nameLabel.Text = topicInfo.Name; levelLabel.Text = TopicLevelText; costLabel.Text = thousandsFormat.Format(topicInfo.InvestedPoints) + " / " + thousandsFormat.Format(topicInfo.Cost); if (topicInfo.Investment > 0) { investmentLabel.Text = "+" + thousandsFormat.Format(topicInfo.Investment); } else { investmentLabel.Text = ""; } }
public void SetData(ResearchTopicInfo topicInfo) { this.Data = topicInfo; this.RefreshData(); }