Beispiel #1
0
 /// <summary>
 /// set module
 /// </summary>
 /// <param name="module"></param>
 /// <param name="prevModule"></param>
 /// <returns></returns>
 public bool SetModule(ShipModule module, out ShipModule prevModule)
 {
     prevModule = null;
     if (module != null)
     {
         var slot = Slot(module.SlotType);
         if (slot != null)
         {
             bool result = slot.SetModule(module, out prevModule);
             sets.UpdateSets(this.slots);
             return(result);
         }
     }
     return(false);
 }
Beispiel #2
0
 public bool RemoveModule(ShipModelSlotType type, out ShipModule prevModule)
 {
     prevModule = null;
     if (Slot(type) != null)
     {
         Slot(type).RemoveModule(out prevModule);
     }
     sets.UpdateSets(this.slots);
     if (prevModule != null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
 public bool SetModule(ShipModule module, out ShipModule prevModule)
 {
     prevModule = null;
     if (module != null)
     {
         if (module.SlotType == Type)
         {
             if (RemoveModule(out prevModule))
             {
                 this.module = module;
                 this.module.Bind();
                 if (prevModule != null)
                 {
                     prevModule.Bind();
                 }
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #4
0
        public int HoldCountWhenInstalledThatModule(ShipModule newModule)
        {
            ModuleSettingData moduleSetting;

            resource.ModuleSettings.TeyGetWorkshopData(newModule.Workshop, out moduleSetting);

            ShipModel  testModel  = new ShipModel(Resource());
            ShipModule prevModule = null;

            foreach (var slot in this.Slots)
            {
                if (slot.HasModule && slot.Type != newModule.SlotType)
                {
                    testModel.SetModule(slot.Module, out prevModule);
                }
            }
            testModel.SetModule(newModule, out prevModule);
            testModel.Update();
            int totalHoldCount = testModel.cargo;

            return(totalHoldCount);
        }
Beispiel #5
0
 public bool RemoveModule(out ShipModule oldModule)
 {
     oldModule = module;
     module    = null;
     return(true);
 }
Beispiel #6
0
 public void Replace(ShipModelSlotBase other)
 {
     module = other.module;
 }