Exemplo n.º 1
0
        public int?GetLinesWithStaff(string staffName, string spellName)
        {
            if (string.IsNullOrEmpty(staffName))
            {
                var metadata = SpellMetadataManager.Instance.GetSpell(spellName);
                if (metadata == null)
                {
                    return(null);
                }

                return(metadata.NumberOfLines);
            }

            staffName = staffName.Trim();
            spellName = spellName.Trim();
            ComputedSpellLines spellLines = null;

            if (!computedLines.TryGetValue(staffName, out spellLines))
            {
                return(null);
            }

            if (!SpellMetadataManager.Instance.ContainsSpell(spellName))
            {
                return(null);
            }

            return(spellLines.GetLines(spellName));
        }
Exemplo n.º 2
0
        ComputedSpellLines CalculateLines(StaffMetadata staff)
        {
            var staffSpellLines = new ComputedSpellLines();

            foreach (var spell in SpellMetadataManager.Instance.Spells)
            {
                var lines = CalculateLinesForSpell(staff, spell);
                staffSpellLines.SetLines(spell.Name, lines);
            }

            return(staffSpellLines);
        }
Exemplo n.º 3
0
        public void RecalculateSpell(StaffMetadata staff, SpellMetadata spell)
        {
            ComputedSpellLines allLines = null;
            var lines = CalculateLinesForSpell(staff, spell);

            if (!computedLines.TryGetValue(staff.Name, out allLines))
            {
                allLines = CalculateLines(staff);
                computedLines[staff.Name] = allLines;
            }

            allLines.SetLines(spell.Name, lines);
        }
Exemplo n.º 4
0
        public bool RenameStaff(string originalName, string newName)
        {
            StaffMetadata      staff = null;
            ComputedSpellLines lines = null;

            var wasStaffFound = staves.TryRemove(originalName, out staff);
            var wasLinesFound = computedLines.TryRemove(originalName, out lines);

            if (wasLinesFound)
            {
                computedLines[newName] = lines;
            }

            if (wasStaffFound)
            {
                OnStaffRemoved(staff);
                staves[newName] = staff;
                OnStaffAdded(staff);
            }

            return(wasStaffFound);
        }
Exemplo n.º 5
0
        ComputedSpellLines CalculateLines(StaffMetadata staff)
        {
            var staffSpellLines = new ComputedSpellLines();

              foreach (var spell in SpellMetadataManager.Instance.Spells)
              {
            var lines = CalculateLinesForSpell(staff, spell);
            staffSpellLines.SetLines(spell.Name, lines);
              }

              return staffSpellLines;
        }