Esempio n. 1
0
    public Race GetRace(string raceName)
    {
        Race result = races.TryGetValue(raceName);

        if (result != null)
        {
            return(result);
        }
        else
        {
            Debug.Log("Race " + raceName + " not found.");
            return(null);
        }
    }
Esempio n. 2
0
    public ItemData GetItem(string itemName)
    {
        ItemAssetData result = items.TryGetValue(itemName);

        if (result != null)
        {
            return(result.GenerateItem());
        }
        else
        {
            Debug.Log("Item " + itemName + " not found.");
            return(null);
        }
    }
Esempio n. 3
0
        private static IList <ExplicitMod> GetExplicitMods(IList <ComboBox> mods,
                                                           MappedList <string, StaticMod> listSettingsMods)
        {
            List <ExplicitMod> listMods = new List <ExplicitMod>();

            for (int i = 0; i < mods.Count; i++)
            {
                string modName = (string)mods[i].SelectedItem;
                if (!string.IsNullOrEmpty(modName))
                {
                    StaticMod settingsMod;
                    if (listSettingsMods.TryGetValue(modName, out settingsMod))
                    {
                        listMods.Add(new ExplicitMod(i, settingsMod));
                    }
                }
            }
            return(listMods.ToArray());
        }
Esempio n. 4
0
 private static IList<ExplicitMod> GetExplicitMods(IList<ComboBox> mods,
     MappedList<string, StaticMod> listSettingsMods)
 {
     List<ExplicitMod> listMods = new List<ExplicitMod>();
     for (int i = 0; i < mods.Count; i++)
     {
         string modName = (string) mods[i].SelectedItem;
         if (!string.IsNullOrEmpty(modName))
         {
             StaticMod settingsMod;
             if (listSettingsMods.TryGetValue(modName, out settingsMod))
                 listMods.Add(new ExplicitMod(i, settingsMod));
         }
     }
     return listMods.ToArray();
 }
Esempio n. 5
0
    //deprecated
    public EnemyData GetEnemy(EnemyID enemyId)
    {
        EnemyAssetData result = enemies.TryGetValue(enemyId.Name);

        return(result != null?result.GenerateBasic() : null);
    }
Esempio n. 6
0
 //deprecated
 public Perk GetPerk(PerkID perkId)
 {
     return(perks.TryGetValue(perkId.Name));
 }
Esempio n. 7
0
 //deprecated
 public SkillData GetSkill(SkillID skillId)
 {
     return(skillId.UsesString() ? skills.TryGetValue(skillId.Name).Data : null);
 }
Esempio n. 8
0
        /// <summary>
        /// Builds a list of <see cref="ExplicitMod"/> objects from the implicit modifications
        /// on the document.
        /// </summary>
        /// <param name="mods">Implicit modifications on the document</param>
        /// <param name="listSettingsMods">All modifications available in the settings</param>
        /// <returns>List of <see cref="ExplicitMod"/> objects for the implicit modifications</returns>
        private ExplicitMod[] GetImplicitMods(IList<StaticMod> mods, MappedList<string, StaticMod> listSettingsMods)
        {
            List<ExplicitMod> listImplicitMods = new List<ExplicitMod>();

            if (!Peptide.IsCustomIon)
            {
                string seq = Peptide.Sequence;
                for (int i = 0; i < seq.Length; i++)
                {
                    char aa = seq[i];
                    foreach (StaticMod mod in mods)
                    {
                        // Skip explicit mods, since only considering implicit
                        if (mod.IsExplicit || !mod.IsMod(aa, i, seq.Length))
                            continue;
                        // Always use the modification from the settings to ensure expected
                        // equality comparisons.
                        StaticMod modAdd;
                        if (listSettingsMods.TryGetValue(mod.Name, out modAdd))
                            listImplicitMods.Add(new ExplicitMod(i, modAdd));
                    }
                }
            }

            return listImplicitMods.ToArray();
        }