本文整理汇总了C#中Plan.IsPlanned方法的典型用法代码示例。如果您正苦于以下问题:C# Plan.IsPlanned方法的具体用法?C# Plan.IsPlanned怎么用?C# Plan.IsPlanned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plan
的用法示例。
在下文中一共展示了Plan.IsPlanned方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: MergePlans
/// <summary>
/// Merge the selected plans.
/// </summary>
private void MergePlans()
{
// Build the merge plan
var result = new Plan(m_character);
using (result.SuspendingEvents())
{
// Merge the plans
foreach (ListViewItem item in lbPlanList.SelectedItems)
{
Plan plan = (Plan)item.Tag;
foreach (PlanEntry entry in plan)
{
// If not planned yet, we add the new entry
if (!result.IsPlanned(entry.Skill, entry.Level))
result.PlanTo(entry.Skill, entry.Level, entry.Priority, entry.Notes);
// Then we update the entry's groups
var newEntry = result.GetEntry(entry.Skill, entry.Level);
// The entry may be null if the character already knows it.
if (newEntry != null)
newEntry.PlanGroups.Add(plan.Name);
}
}
}
// Request a new name for this plan
using (NewPlanWindow npw = new NewPlanWindow())
{
DialogResult dr = npw.ShowDialog();
if (dr == DialogResult.Cancel)
return;
// Change the plan's name and add it
result.Name = npw.Result;
m_character.Plans.Add(result);
}
}
示例3: ExportAsText
/// <summary>
/// Creates a TXT format file for character exportation.
/// </summary>
/// <param name="character"></param>
/// <param name="plan"></param>
public static string ExportAsText(Character character, Plan plan)
{
string Separator = "=======================================================================";
string SubSeparator = "-----------------------------------------------------------------------";
StringBuilder builder = new StringBuilder();
builder.AppendLine("BASIC INFO");
builder.AppendLine(Separator);
builder.AppendFormat(CultureConstants.DefaultCulture, " Name: {0}{1}", character.Name, Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Gender: {0}{1}", character.Gender, Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Race: {0}{1}", character.Race, Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, "Bloodline: {0}{1}", character.Bloodline, Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Balance: {0} ISK{1}", character.Balance.ToString("#,##0.00"), Environment.NewLine);
builder.AppendLine();
builder.AppendFormat(CultureConstants.DefaultCulture, "Intelligence: {0}{1}", character.Intelligence.EffectiveValue.ToString("#0.00").PadLeft(5), Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Charisma: {0}{1}", character.Charisma.EffectiveValue.ToString("#0.00").PadLeft(5), Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Perception: {0}{1}", character.Perception.EffectiveValue.ToString("#0.00").PadLeft(5), Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Memory: {0}{1}", character.Memory.EffectiveValue.ToString("#0.00").PadLeft(5), Environment.NewLine);
builder.AppendFormat(CultureConstants.DefaultCulture, " Willpower: {0}{1}", character.Willpower.EffectiveValue.ToString("#0.00").PadLeft(5), Environment.NewLine);
builder.AppendLine();
// Implants
var implants = character.CurrentImplants.Where(x => x != Implant.None && (int)x.Slot < 5);
if (implants.Count() > 0)
{
builder.AppendLine("IMPLANTS");
builder.AppendLine(Separator);
foreach (var implant in implants)
{
builder.AppendFormat(CultureConstants.DefaultCulture, "+{0} {1} : {2}{3}", implant.Bonus, implant.Slot.ToString().PadRight(13), implant.Name, Environment.NewLine);
}
builder.AppendLine();
}
// Skill groups
builder.AppendLine("SKILLS");
builder.AppendLine(Separator);
foreach (var skillGroup in character.SkillGroups)
{
int count = skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))).Select(x => GetMergedSkill(plan, x)).Count();
int skillGroupTotalSP = skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))).Select(x=> GetMergedSkill(plan, x)).Sum(x=> x.Skillpoints);
// Skill Group
builder.AppendFormat(CultureConstants.DefaultCulture, "{0}, {1} Skill{2}, {3} Points{4}",
skillGroup.Name, count, count > 1 ? "s" : String.Empty,
skillGroupTotalSP.ToString("#,##0"), Environment.NewLine);
// Skills
foreach (var skill in skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))))
{
var mergedSkill = GetMergedSkill(plan, skill);
string skillDesc = String.Format(CultureConstants.DefaultCulture, "{0} ({1})", skill.ToString(), skill.Rank.ToString());
builder.AppendFormat(CultureConstants.DefaultCulture, ": {0} L{1} {2}/{3} Points{4}",
skillDesc.PadRight(45), mergedSkill.Level.ToString().PadRight(5), mergedSkill.Skillpoints.ToString("#,##0"),
skill.StaticData.GetPointsRequiredForLevel(5).ToString("#,##0"), Environment.NewLine);
// If the skill is in training...
if (skill.IsTraining)
{
DateTime adjustedEndTime = character.CurrentlyTrainingSkill.EndTime.ToLocalTime();
builder.AppendFormat(CultureConstants.DefaultCulture, ": (Currently training to level {0}, completes {1}){2}",
Skill.GetRomanForInt(character.CurrentlyTrainingSkill.Level), adjustedEndTime, Environment.NewLine);
}
}
builder.AppendLine(SubSeparator);
}
return builder.ToString();
}
示例4: ExportAsEVEMonXML
/// <summary>
/// Creates a XML format file for character exportation.
/// </summary>
/// <param name="character"></param>
/// <param name="plan"></param>
public static string ExportAsEVEMonXML(Character character, Plan plan)
{
var serial = character.Export();
if (plan != null)
serial.Skills = character.Skills.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))).Select(x => GetMergedSkill(plan, x)).ToList();
var doc = Util.SerializeToXmlDocument(serial.GetType(), serial);
return Util.GetXMLStringRepresentation(doc);
}
示例5: ExportAsHTML
/// <summary>
/// Creates a HTML format file for character exportation.
/// </summary>
/// <param name="character"></param>
/// <param name="plan"></param>
public static string ExportAsHTML(Character character, Plan plan)
{
// Retrieves a XML representation of this character
var serial = new OutputCharacter();
serial.Name = character.Name;
serial.Balance = character.Balance;
serial.CorporationName = character.CorporationName;
serial.CharacterID = character.CharacterID;
serial.BloodLine = character.Bloodline;
serial.Gender = character.Gender;
serial.Race = character.Race;
serial.Intelligence = character.Intelligence.EffectiveValue;
serial.Perception = character.Perception.EffectiveValue;
serial.Willpower = character.Willpower.EffectiveValue;
serial.Charisma = character.Charisma.EffectiveValue;
serial.Memory = character.Memory.EffectiveValue;
// Attributes enhancers
foreach (var implant in character.CurrentImplants.Where(x => x != Implant.None && (int)x.Slot < 5))
{
serial.AttributeEnhancers.Add(new OutputAttributeEnhancer { Attribute = implant.Slot, Bonus = implant.Bonus, Name = implant.Name });
}
// Certificates
foreach (var certClass in character.CertificateClasses)
{
var cert = certClass.HighestClaimedGrade;
if (cert == null)
continue;
serial.Certificates.Add(new OutputCertificate { Name = certClass.Name, Grade = cert.Grade.ToString() });
}
// Skills (grouped by skill groups)
foreach (var skillGroup in character.SkillGroups)
{
int count = skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))).Select(x => GetMergedSkill(plan, x)).Count();
int skillGroupTotalSP = skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))).Select(x => GetMergedSkill(plan, x)).Sum(x => x.Skillpoints);
var outGroup = new OutputSkillGroup { Name = skillGroup.Name, SkillsCount = count, TotalSP = skillGroupTotalSP };
foreach (var skill in skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))))
{
var mergedSkill = GetMergedSkill(plan, skill);
outGroup.Skills.Add(new OutputSkill
{
Name = mergedSkill.Name,
Rank = skill.Rank,
Level = mergedSkill.Level,
SkillPoints = mergedSkill.Skillpoints,
RomanLevel = Skill.GetRomanForInt(mergedSkill.Level),
MaxSkillPoints = skill.StaticData.GetPointsRequiredForLevel(5)
});
}
if (outGroup.Skills.Count != 0)
serial.SkillGroups.Add(outGroup);
}
// Serializes to XML and apply a XSLT to generate the HTML doc
var doc = Util.SerializeToXmlDocument(typeof(OutputCharacter), serial);
var xslt = Util.LoadXSLT(Properties.Resources.XmlToHtmlXslt);
var htmlDoc = Util.Transform(doc, xslt);
// Returns the string representation of the generated doc
return Util.GetXMLStringRepresentation(htmlDoc);
}
示例6: ExportAsEVEMonXML
/// <summary>
/// Creates a XML format file for character exportation.
/// </summary>
/// <param name="character"></param>
/// <param name="plan"></param>
private static string ExportAsEVEMonXML(Character character, Plan plan)
{
SerializableSettingsCharacter serial = character.Export();
if (plan != null)
{
serial.Skills.Clear();
serial.Skills.AddRange(character.Skills.Where(skill => skill.IsKnown || plan.IsPlanned(skill))
.Select(skill => GetMergedSkill(plan, skill)));
}
XmlDocument doc = (XmlDocument)Util.SerializeToXmlDocument(serial);
return doc != null ? Util.GetXmlStringRepresentation(doc) : null;
}
示例7: CompleteSerialization
/// <summary>
/// Completes the serialization.
/// </summary>
/// <param name="character">The character.</param>
/// <param name="plan">The plan.</param>
/// <param name="serial">The serial.</param>
private static void CompleteSerialization(Character character, Plan plan, OutputCharacter serial)
{
// Attributes enhancers
foreach (Implant implant in character.CurrentImplants)
{
serial.AttributeEnhancers.Add(new OutputAttributeEnhancer
{
Attribute = implant.Slot,
Description = implant.Slot.GetDescription(),
Bonus = implant.Bonus,
Name = implant.Name
});
}
// Skills (grouped by skill groups)
foreach (SkillGroup skillGroup in character.SkillGroups)
{
OutputSkillGroup outGroup = AddSkillGroup(plan, skillGroup);
foreach (Skill skill in skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))))
{
AddSkill(plan, outGroup, skill);
}
if (outGroup.Skills.Count != 0)
serial.SkillGroups.Add(outGroup);
}
}
示例8: AddSkillGroups
/// <summary>
/// Adds the skill groups.
/// </summary>
/// <param name="character">The character.</param>
/// <param name="plan">The plan.</param>
/// <param name="builder">The builder.</param>
/// <param name="skillGroup">The skill group.</param>
private static void AddSkillGroups(Character character, Plan plan, StringBuilder builder, SkillGroup skillGroup)
{
int count = skillGroup
.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x)))
.Select(x => GetMergedSkill(plan, x))
.Count();
Int64 skillGroupTotalSP = skillGroup
.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x)))
.Select(x => GetMergedSkill(plan, x))
.Sum(x => x.Skillpoints);
// Skill Group
builder.AppendLine($"{skillGroup.Name}, " +
$"{count} Skill{(count > 1 ? "s" : String.Empty)}, " +
FormattableString.Invariant($"{skillGroupTotalSP:N0} Points"));
// Skills
foreach (Skill skill in skillGroup.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x))))
{
AddSkills(character, plan, builder, skill);
}
}
示例9: AddSkillGroup
/// <summary>
/// Adds the skill group.
/// </summary>
/// <param name="plan">The plan.</param>
/// <param name="skillGroup">The skill group.</param>
/// <returns></returns>
private static OutputSkillGroup AddSkillGroup(Plan plan, SkillGroup skillGroup)
{
int count = skillGroup
.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x)))
.Select(x => GetMergedSkill(plan, x))
.Count();
Int64 skillGroupTotalSP = skillGroup
.Where(x => x.IsKnown || (plan != null && plan.IsPlanned(x)))
.Select(x => GetMergedSkill(plan, x))
.Sum(x => x.Skillpoints);
OutputSkillGroup outGroup = new OutputSkillGroup
{
Name = skillGroup.Name,
SkillsCount = count,
TotalSP = FormattableString.Invariant($"{skillGroupTotalSP:N0}")
};
return outGroup;
}