示例#1
0
        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 void SetData(DevelopmentTopicInfo 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 = "";
            }
        }