/// <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); }
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); } }
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); }
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); }
public bool RemoveModule(out ShipModule oldModule) { oldModule = module; module = null; return(true); }
public void Replace(ShipModelSlotBase other) { module = other.module; }