예제 #1
0
        /// <summary>
        /// Updates the form controls to reflect the status of the Plan specified by the Plan property.
        /// </summary>
        private void UpdatePlanStatus()
        {
            if (m_loadoutFormat == LoadoutFormat.None)
            {
                return;
            }

            // Compute the skills to add
            m_skillsToAdd.Clear();
            CharacterScratchpad scratchpad = new CharacterScratchpad(m_character);

            // Compute the training time for the prerequisites
            foreach (Item obj in m_objects)
            {
                scratchpad.Train(obj.Prerequisites.Where(x => m_character.Skills[x.Skill.ID].Level < x.Level));
            }
            m_skillsToAdd.AddRange(scratchpad.TrainedSkills);

            // All skills already trained ?
            if (m_skillsToAdd.Count == 0)
            {
                AddToPlanButton.Enabled = false;
                PlanedLabel.Visible     = true;
                PlanedLabel.Text        = @"All skills already trained.";
                TrainTimeLabel.Visible  = false;
            }
            // Are skills already planned ?
            else if (m_plan.AreSkillsPlanned(m_skillsToAdd))
            {
                AddToPlanButton.Enabled = false;
                PlanedLabel.Visible     = true;
                PlanedLabel.Text        = @"All skills already trained or planned.";
                TrainTimeLabel.Visible  = false;
            }
            // There is at least one untrained or non-planned skill
            else
            {
                AddToPlanButton.Enabled = true;
                PlanedLabel.Text        = String.Empty;
                PlanedLabel.Visible     = false;
                TrainTimeLabel.Visible  = true;

                // Compute training time
                TimeSpan trainingTime = m_character.GetTrainingTimeToMultipleSkills(m_skillsToAdd);
                TrainTimeLabel.Text = trainingTime.ToDescriptiveText(
                    DescriptiveTextOptions.IncludeCommas | DescriptiveTextOptions.SpaceText);
            }
        }
예제 #2
0
        /// <summary>
        /// Updates the form controls to reflect the status of the Plan specified by the Plan property.
        /// </summary>
        private void UpdatePlanStatus()
        {
            // Compute the skills to add
            m_skillsToAdd.Clear();
            var scratchpad = new CharacterScratchpad(m_character);

            foreach (var obj in m_objects)
            {
                scratchpad.Train(obj.Prerequisites);
            }
            m_skillsToAdd.AddRange(scratchpad.TrainedSkills);

            // All skills already known ?
            if (m_skillsToAdd.Count == 0)
            {
                AddToPlanButton.Enabled = false;
                PlanedLabel.Visible     = true;
                PlanedLabel.Text        = "All skills already known.";
                TrainTimeLabel.Visible  = false;
            }
            // Are skills already planned ?
            else if (m_plan.AreSkillsPlanned(m_skillsToAdd))
            {
                AddToPlanButton.Enabled = false;
                PlanedLabel.Visible     = true;
                PlanedLabel.Text        = "All skills already known or planned.";
                TrainTimeLabel.Visible  = false;
            }
            // There is at least one unknown and non-planned skill
            else
            {
                AddToPlanButton.Enabled = true;
                PlanedLabel.Text        = "";
                PlanedLabel.Visible     = false;
                TrainTimeLabel.Visible  = true;

                // Compute training time
                TimeSpan trainingTime = m_character.GetTrainingTimeToMultipleSkills(m_skillsToAdd);
                TrainTimeLabel.Text = Skill.TimeSpanToDescriptiveText(trainingTime, DescriptiveTextOptions.IncludeCommas | DescriptiveTextOptions.SpaceText);
            }
        }