本文整理汇总了C#中Plan.GetPlannedLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Plan.GetPlannedLevel方法的具体用法?C# Plan.GetPlannedLevel怎么用?C# Plan.GetPlannedLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plan
的用法示例。
在下文中一共展示了Plan.GetPlannedLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnablePlanTo
/// <summary>
/// Checks whether the given skill level can be planned. Used to enable or disable the "Plan To N" and "Remove" menu options.
/// </summary>
/// <param name="plan"></param>
/// <param name="skill"></param>
/// <param name="level">A integer between 0 (remove all entries for this skill) and 5.</param>
/// <param name="operation"></param>
/// <returns></returns>
public static bool EnablePlanTo(Plan plan, Skill skill, int level)
{
// The entry actually wants to remove the item
if (level == 0)
{
return plan.IsPlanned(skill);
}
// The entry is already known
else if (skill.Level >= level)
{
return false;
}
// The entry is already planned at this very level
else if (plan.GetPlannedLevel(skill) == level)
{
return false;
}
// Ok
return true;
}
示例2: UpdatesRegularPlanToMenu
/// <summary>
/// Updates a regular "Plan to X" menu : text, tag, enable/disable.
/// </summary>
/// <param name="menu"></param>
/// <param name="plan"></param>
/// <param name="skill"></param>
/// <param name="level"></param>
public static bool UpdatesRegularPlanToMenu(ToolStripItem menu, Plan plan, Skill skill, int level)
{
if (level == 0)
{
menu.Text = "Remove";
}
else
{
menu.Text = "Level " + level.ToString();
}
menu.Enabled = EnablePlanTo(plan, skill, level);
if (menu.Enabled)
{
var operation = plan.TryPlanTo(skill, level);
menu.Tag = operation;
if (RequiresWindow(operation))
menu.Text += "...";
}
var menuItem = menu as ToolStripMenuItem;
if (menuItem != null)
{
menuItem.Checked = (plan.GetPlannedLevel(skill) == level);
}
return menu.Enabled;
}