private void ResetModuleState() { this.ActiveModState = ShipDesignScreen.ActiveModuleState.Normal; }
private void SetupSlots() { this.Slots.Clear(); foreach (ModuleSlotData slot in this.ActiveHull.ModuleSlotList) { SlotStruct ss = new SlotStruct(); PrimitiveQuad pq = new PrimitiveQuad(slot.Position.X + this.offset.X - 8f, slot.Position.Y + this.offset.Y - 8f, 16f, 16f); ss.pq = pq; ss.Restrictions = slot.Restrictions; ss.facing = slot.facing; ss.ModuleUID = slot.InstalledModuleUID; ss.state = slot.state; ss.slotReference = slot; ss.SlotOptions = slot.SlotOptions; this.Slots.Add(ss); } foreach (SlotStruct slot in this.Slots) { if (slot.ModuleUID == null) { continue; } this.ActiveModule = Ship_Game.ResourceManager.GetModule(slot.ModuleUID); this.ChangeModuleState(slot.state); this.InstallModuleFromLoad(slot); if (slot.module == null || slot.module.ModuleType != ShipModuleType.Hangar) { continue; } slot.module.hangarShipUID = slot.SlotOptions; } this.ActiveModule = null; this.ActiveModState = ShipDesignScreen.ActiveModuleState.Normal; }
private void ChangeModuleState(ShipDesignScreen.ActiveModuleState state) { if (this.ActiveModule == null) { return; } byte x = Ship_Game.ResourceManager.ShipModulesDict[this.ActiveModule.UID].XSIZE; byte y = Ship_Game.ResourceManager.ShipModulesDict[this.ActiveModule.UID].YSIZE; switch (state) { case ShipDesignScreen.ActiveModuleState.Normal: { this.ActiveModule.XSIZE = Ship_Game.ResourceManager.ShipModulesDict[this.ActiveModule.UID].XSIZE; this.ActiveModule.YSIZE = Ship_Game.ResourceManager.ShipModulesDict[this.ActiveModule.UID].YSIZE; this.ActiveModState = ShipDesignScreen.ActiveModuleState.Normal; return; } case ShipDesignScreen.ActiveModuleState.Left: { this.ActiveModule.XSIZE = y; this.ActiveModule.YSIZE = x; this.ActiveModState = ShipDesignScreen.ActiveModuleState.Left; this.ActiveModule.facing = 270f; return; } case ShipDesignScreen.ActiveModuleState.Right: { this.ActiveModule.XSIZE = y; this.ActiveModule.YSIZE = x; this.ActiveModState = ShipDesignScreen.ActiveModuleState.Right; this.ActiveModule.facing = 90f; return; } case ShipDesignScreen.ActiveModuleState.Rear: { this.ActiveModule.XSIZE = Ship_Game.ResourceManager.ShipModulesDict[this.ActiveModule.UID].XSIZE; this.ActiveModule.YSIZE = Ship_Game.ResourceManager.ShipModulesDict[this.ActiveModule.UID].YSIZE; this.ActiveModState = ShipDesignScreen.ActiveModuleState.Rear; this.ActiveModule.facing = 180f; return; } default: { return; } } }