当前位置: 首页>>代码示例>>C#>>正文


C# Skill.GetLeftTrainingTimeToLevel方法代码示例

本文整理汇总了C#中Skill.GetLeftTrainingTimeToLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Skill.GetLeftTrainingTimeToLevel方法的具体用法?C# Skill.GetLeftTrainingTimeToLevel怎么用?C# Skill.GetLeftTrainingTimeToLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skill的用法示例。


在下文中一共展示了Skill.GetLeftTrainingTimeToLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTooltip

        /// <summary>
        /// Gets the tooltip text for the given skill
        /// </summary>
        /// <param name="skill"></param>
        private static string GetTooltip(Skill skill)
        {
            Int64 sp = skill.SkillPoints;
            Int64 nextLevel = Math.Min(5, skill.Level + 1);
            Int64 nextLevelSP = skill.StaticData.GetPointsRequiredForLevel(nextLevel);
            Int64 pointsLeft = skill.GetLeftPointsRequiredToLevel(nextLevel);
            string remainingTimeText = skill.GetLeftTrainingTimeToLevel(nextLevel)
                .ToDescriptiveText(DescriptiveTextOptions.IncludeCommas | DescriptiveTextOptions.UppercaseText);

            if (sp < skill.StaticData.GetPointsRequiredForLevel(1))
            {
                // Training hasn't got past level 1 yet
                StringBuilder untrainedToolTip = new StringBuilder();
                untrainedToolTip
                    .Append($"Not yet trained to Level I ({Math.Floor(skill.PercentCompleted)}%)")
                    .AppendLine()
                    .Append($"Next level I: {pointsLeft:N0} skill points remaining")
                    .AppendLine()
                    .Append($"Training time remaining: {remainingTimeText}")
                    .AppendLine();

                AddSkillBoilerPlate(untrainedToolTip, skill);

                return untrainedToolTip.ToString();
            }

            // So, it's a left click on a skill, we display the tool tip
            // Partially trained skill ?
            if (skill.IsPartiallyTrained)
            {
                StringBuilder partiallyTrainedToolTip = new StringBuilder();
                partiallyTrainedToolTip
                    .Append($"Partially Completed ({Math.Floor(skill.PercentCompleted)}%)")
                    .AppendLine()
                    .Append($"Training to level {Skill.GetRomanFromInt(nextLevel)}: {pointsLeft:N0} skill points remaining")
                    .AppendLine()
                    .Append($"Training time remaining: {remainingTimeText}")
                    .AppendLine();

                AddSkillBoilerPlate(partiallyTrainedToolTip, skill);

                return partiallyTrainedToolTip.ToString();
            }

            // We've completed all the skill points for the current level
            if (!skill.IsPartiallyTrained)
            {
                if (skill.Level != 5)
                {
                    StringBuilder levelCompleteToolTip = new StringBuilder();
                    levelCompleteToolTip
                        .Append($"Completed Level {Skill.GetRomanFromInt(skill.Level)}: {sp:N0}/{nextLevelSP:N0}")
                        .AppendLine()
                        .Append($"Next level {Skill.GetRomanFromInt(nextLevel)}: {pointsLeft:N0} skill points required")
                        .AppendLine()
                        .Append($"Training Time: {remainingTimeText}")
                        .AppendLine();

                    AddSkillBoilerPlate(levelCompleteToolTip, skill);

                    return levelCompleteToolTip.ToString();
                }

                // Lv 5 completed
                StringBuilder lv5ToolTip = new StringBuilder();
                lv5ToolTip
                    .Append($"Level V Complete: {sp:N0}/{nextLevelSP:N0}")
                    .AppendLine()
                    .AppendLine("No further training required");

                AddSkillBoilerPlate(lv5ToolTip, skill);

                return lv5ToolTip.ToString();
            }

            // Error in calculating SkillPoints
            StringBuilder calculationErrorToolTip = new StringBuilder();
            calculationErrorToolTip
                .AppendLine("Partially Trained (Could not cacluate all skill details)")
                .Append($"Next level {nextLevel}: {pointsLeft:N0} skill points remaining")
                .AppendLine()
                .Append($"Training time remaining: {remainingTimeText}")
                .AppendLine();

            AddSkillBoilerPlate(calculationErrorToolTip, skill);

            return calculationErrorToolTip.ToString();
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:92,代码来源:CharacterSkillsList.cs


注:本文中的Skill.GetLeftTrainingTimeToLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。