예제 #1
0
 public ShipInformationList()
 {
     Ships            = new Dictionary <int, ShipInformation>();
     StoredModules    = new ModulesInStore();
     itemlocalisation = new Dictionary <string, string>();
     currentid        = -1;
 }
예제 #2
0
        public ModulesInStore StoreModule(string item, string itemlocalised)
        {
            ModulesInStore mis = this.ShallowClone();

            mis.StoredModules.Add(new JournalLoadout.ShipModule("", "", item, "", itemlocalised));
            return(mis);
        }
예제 #3
0
        public ModulesInStore StoreModule(ModuleItem[] items, Dictionary <string, string> itemlocalisation)
        {
            ModulesInStore mis = this.ShallowClone();

            foreach (ModuleItem it in items)
            {
                string local = itemlocalisation.ContainsKey(it.Name) ? itemlocalisation[it.Name] : "";
                mis.StoredModules.Add(new JournalLoadout.ShipModule("", "", it.Name, "", local));
            }
            return(mis);
        }
예제 #4
0
        public ModulesInStore RemoveModule(string item)
        {
            int index = StoredModules.FindIndex(x => x.Item.Equals(item, StringComparison.InvariantCultureIgnoreCase));  // if we have an item of this name

            if (index != -1)
            {
                ModulesInStore mis = this.ShallowClone();
                mis.StoredModules.RemoveAt(index);
                return(mis);
            }
            else
            {
                return(this);
            }
        }
예제 #5
0
        public ModulesInStore ShallowClone()          // shallow clone.. does not clone the ship modules, just the dictionary
        {
            ModulesInStore mis = new ModulesInStore(this.StoredModules);

            return(mis);
        }