public Dialog_SelectPart(PartCustomisePack pcp, ChassisType ct) { if (pcp == null) { Log.Error("PartCustomisePack was null"); } this.pcp = pcp; availableParts = (from t in DefDatabase <DroidChassisPartDef> .AllDefs where (t.ChassisType == ct || t.ChassisType == ChassisType.Any) && t.ChassisPoint == pcp.ChassisPoint select t).ToList(); var list = (from t in availableParts where t.BasePart == true select t).ToList(); if (list.Count > 0) { basePart = list.First(); availableParts.Remove(basePart); } if (pcp.Part is DroidChassisPartDef) { var p = pcp.Part as DroidChassisPartDef; selPart = p; } absorbInputAroundWindow = true; forcePause = true; }
// unique db key = Id public Car(DateTime uploadDate, int price, string brand, string model, bool used, YearMonth dateOfPurchase, Engine engine, FuelType fuelType, ChassisType chassisType, string color, GearboxType gearboxType, int totalKilometersDriven, DriveWheels driveWheels, List <string> defects, SteeringWheelPosition steeringWheelPosition, NumberOfDoors numberOfDoors, int numberOfCylinders, int numberOfGears, int seats, YearMonth nextVehicleInspection, string wheelSize, int weight, EuroStandard euroStandard, string originalPurchaseCountry, string vin, List <string> additionalProperties, List <string> images, string comment) { Price = price; UploadDate = uploadDate; Brand = brand; Model = model; Used = used; DateOfPurchase = dateOfPurchase; Engine = engine; FuelType = fuelType; ChassisType = chassisType; Color = color; GearboxType = gearboxType; TotalKilometersDriven = totalKilometersDriven; DriveWheels = driveWheels; Defects = defects; SteeringWheelPosition = steeringWheelPosition; NumberOfDoors = numberOfDoors; NumberOfCylinders = numberOfCylinders; NumberOfGears = numberOfGears; Seats = seats; NextVehicleInspection = nextVehicleInspection; WheelSize = wheelSize; Weight = weight; EuroStandard = euroStandard; OriginalPurchaseCountry = originalPurchaseCountry; Vin = vin; AdditionalProperties = additionalProperties; Images = images; Comment = comment; }
/// <summary> /// This is the function that is to be overridden by child Chassis classes. This is to make sure that the modules array /// is always set (and the user can change the size of the Chassis inside the SetChassisData). /// </summary> protected virtual void SetChassisData() { item.name = "Chassis Base"; item.width = 20; item.height = 20; item.toolTip = "A standard issue Chassis without room for any modules"; item.value = Item.buyPrice(0, 0, 0, 0); item.rare = -1; this.chassisType = ChassisType.None; }
public void SetChassis(ChassisType type) { chassisType = type; switch (chassisType) { case ChassisType.Wheels: chassisSpriteRenderer.sprite = wheelsSprite; break; case ChassisType.Caterpillar: chassisSpriteRenderer.sprite = caterpillarSprite; break; case ChassisType.Jet: chassisSpriteRenderer.sprite = jetSprite; break; } }
internal void InitializeFromStruct(Ship ship, ChassisType type) { Name = ship.Name; transform.position = new Vector3(ship.PosX, ship.PosY, ship.PosZ); transform.rotation = Quaternion.Euler(ship.RotX, ship.RotY, ship.RotZ); _mob = GetComponent <MobileObjectController>(); _mob.Acceleration = type.Acceleration; _mob.Deceleration = type.Deceleration; _mob.MaxSpeed = type.MaxSpeed; _mob.SetStartSpeed(ship.CurrentSpeed); InitialiseProjections(); InitialisePower(); SetTurn(0f); SetSpeed(0.5f); Faction = ship.Faction == "Friendly" ? Faction.Friendly : Faction.Enemy; }
public static void DrawSlot(PartCustomisePack slot, Rect rect, ChassisType ct, BlueprintHandlerState state) { try { GUI.BeginGroup(rect); Rect slotRect = new Rect(rect.width / 2 - SlotRectSize.x / 2, 0f, SlotRectSize.x, SlotRectSize.y); if (Mouse.IsOver(slotRect)) { Widgets.DrawHighlightSelected(slotRect); TooltipHandler.TipRegion(slotRect, slot.Part.GetTooltip()); } else { Widgets.DrawHighlight(slotRect); } Widgets.DrawBox(slotRect); Rect imageRect = new Rect(slotRect.center.x - IconRectSize.x / 2, slotRect.center.y - IconRectSize.y / 2, IconRectSize.x, IconRectSize.y); Widgets.DrawTextureFitted(imageRect, DefaultSlotIcon, 1f);//TODO:: show slot icon Rect labelRect = new Rect(0f, SlotRectSize.y, rect.width, SlotLabelHeight); Text.Anchor = TextAnchor.MiddleCenter; if (slot.Part.color != null) { GUI.color = slot.Part.color.GetColor(); } Widgets.Label(labelRect, slot.Part.LabelCap); GUI.color = Color.white; if (state == BlueprintHandlerState.New || state == BlueprintHandlerState.Edit) { if (Widgets.ButtonInvisible(slotRect)) { Dialog_SelectPart sp = new Dialog_SelectPart(slot, ct); Find.WindowStack.Add(sp); } } } finally { Text.Anchor = TextAnchor.UpperLeft; GUI.EndGroup(); } }
private static string GetChassisString(ChassisType type) { if (type == ChassisType.Small) { return("SmallChassis".Translate()); } else if (type == ChassisType.Medium) { return("MediumChassis".Translate()); } else if (type == ChassisType.Large) { return("LargeChassis".Translate()); } else { Log.Error("Should not get here"); } return("error"); }
private static BaseChassis CreateNewChassis(ChassisType type) { switch (type) { case ChassisType.Boat: return(new BoatChassis()); case ChassisType.Cursor: return(new CursorChassis()); case ChassisType.Cycle: return(new CycleChassis()); case ChassisType.Rover: return(new RoverChassis()); case ChassisType.DynamicProp: return(new DynamicPropChassis()); case ChassisType.FloatInAir: return(new FloatInAirChassis()); case ChassisType.Hover: return(new HoverChassis()); case ChassisType.HoverSwim: return(new HoverSwimChassis()); case ChassisType.Missile: return(new MissileChassis()); case ChassisType.Puck: return(new PuckChassis()); case ChassisType.Saucer: return(new SaucerChassis()); case ChassisType.SitAndSpin: return(new SitAndSpinChassis()); case ChassisType.StaticProp: return(new StaticPropChassis()); case ChassisType.Swim: return(new SwimChassis()); case ChassisType.Pipe: return(new PipeChassis()); } Debug.Assert(false, "No chassis provided!"); return(new StaticPropChassis()); }
public static DroidGraphicDef GetPreviousHead(ChassisType type) { int index = HeadIndex[type] - 1; try { List <DroidGraphicDef> list = Heads[type]; if (index < 0) { index = list.Count - 1; } return(list[index]); } catch (Exception ex) { Log.Error($"Error retrieving droid head graphic for ChassisType: {type}\n{ex.Message}\nReturning Default"); index = 0; return(GetFirstHead(type)); } finally { HeadIndex[type] = index; } }
public static DroidGraphicDef GetNextBody(ChassisType type) { int index = BodyIndex[type] + 1; try { List <DroidGraphicDef> list = Bodies[type]; if (index > list.Count - 1) { index = 0; } return(list[index]); } catch (Exception ex) { Log.Error($"Error retrieving droid body graphic for ChassisType: {type}\n{ex.Message}\nReturning Default"); index = 0; return(GetFirstBody(type)); } finally { BodyIndex[type] = index; } }
public static TruckVechicle BuildTruck(int wheels, ChassisType chassisType, bool trailer, int doors, EngineType engine, BodyType body) { BaseVechileBuilder builder = new TruckBuilder(new ConsoleApplicationLogger()); return (TruckVechicle)builder.Build(); }
public static CarVechicle BuildCar(int wheels, ChassisType chassisType, int doors, EngineType engine, int windows, BodyType body) { BaseVechileBuilder builder = new CarBuilder(new ConsoleApplicationLogger()); return (CarVechicle)builder.Build(); }
public void AddComConstruct(ChassisType chassis, EngineType engine, ControlType control, WeaponType weapon) { }
public static DroidGraphicDef GetFirstBody(ChassisType type) { return(Bodies[type].First()); }
public static DroidGraphicDef GetFirstHead(ChassisType type) { return(Heads[type].First()); }
private List <CarPart> ConvertLinesToCarParts(List <string> lines) { var carParts = new List <CarPart>(); foreach (var line in lines) { var quantity = line.Split(' ')[0]; var type = line.Split(' ')[1]; var part = line.Split(' ')[2]; int nr; bool isChassis = false; bool isEngine = false; bool isPaint = false; bool isWheel = false; var isInt = int.TryParse(quantity, out nr); if (!isInt) { throw new Exception($"Invalid car part {line}"); } if (part.Contains(Wheel.ToString())) { WheelType wheelType = WheelType.SUMMER; isWheel = Enum.TryParse <WheelType>(type.ToUpper(), out wheelType); if (isWheel) { carParts.Add(new Wheel() { WheelType = wheelType }); } continue; } if (part.Contains(Engine.ToString())) { EngineType engineType = EngineType.DIESEL; isEngine = Enum.TryParse <EngineType>(type.ToUpper(), out engineType); if (isEngine) { carParts.Add(new Engine() { EngineType = engineType }); } continue; } if (part.Contains(Chassis.ToString())) { ChassisType chassisType = ChassisType.TITANIUM; isChassis = Enum.TryParse <ChassisType>(type.ToUpper(), out chassisType); if (isChassis) { carParts.Add(new Chassis() { ChassisType = chassisType }); } continue; } if (part.Contains(Paint.ToString())) { PaintType paintType = PaintType.BLACK; isPaint = Enum.TryParse <PaintType>(type.ToUpper(), out paintType); if (isPaint) { carParts.Add(new Paint() { PaintType = paintType }); } continue; } if (!isChassis && !isEngine && !isPaint && !isWheel) { throw new Exception($"Invalid car part {line}"); } } return(carParts); }