/// <summary> /// Constructs a UnitProductionJob instance. /// </summary> /// <param name="ownerBuilding">The owner building of this job.</param> /// <param name="unitProduct">The type of unit to be created by this job.</param> /// <param name="jobID">The ID of this job.</param> public UnitProductionJob(Building ownerBuilding, IUnitType unitProduct, int jobID) : base(ownerBuilding.Owner, unitProduct, jobID) { this.unitProduct = unitProduct; this.ownerBuilding = this.ConstructField <Building>("ownerBuilding"); this.ownerBuilding.Write(ownerBuilding); }
public UnitsConverter() { _unitsData = UnitsData.Deserialize(); _unitType = _unitsData.UnitTypes[0]; _unitA = _unitType.Units[0]; _unitB = _unitType.Units[1]; }
public UnitType(IUnitType copyFrom) : base(copyFrom) { Mobility = copyFrom.Mobility; MoveRange = copyFrom.MoveRange; BuiltBy = copyFrom.BuiltBy; Flags = copyFrom.Flags; }
/// <see cref="ProductionLine.IsProductEnabledImpl"/> protected override bool IsProductEnabledImpl(string productName) { IUnitType product = this.unitProducts[productName]; return(product.NecessaryAddon == null || (this.ownerBuilding.Read().CurrentAddon != null && !this.ownerBuilding.Read().CurrentAddon.Biometrics.IsUnderConstruction&& this.ownerBuilding.Read().CurrentAddon.ElementType == product.NecessaryAddon)); }
public UnitsTabViewModel(IUnitType unitType) { _unitType = unitType; _unitA = unitType.Units[0]; _unitB = unitType.Units[1]; ConvertFromA(); DisplayName = unitType.Name; }
/// <see cref="IScenarioMetadata.GetUnitType"/> public IUnitType GetUnitType(string unitTypeName) { if (this.attachedMetadata == null) { throw new InvalidOperationException("Metadata not yet attached!"); } IUnitType attachedUnitType = this.attachedMetadata.GetUnitType(unitTypeName); return(new IUnitType(this.GetElementTypeUpgradeImpl(attachedUnitType.Name))); }
public void RegisterUnitType(IUnitType unitType) { if (unitType == null) { Control.LogError("Null unit type, skipping"); } var old = types.FirstOrDefault(i => i.Name == unitType.Name); if (old != null) { Control.LogDebug(DType.UnitType, $"-- removed old one"); types.Remove(old); } types.Add(unitType); Control.Log("UnitType " + unitType.Name + " Registred"); }
//public static List<IUnitType> GetUnitType(SearchCriteria searchCriteria, int ID, int CompanyID) //{ // string strExecution = "[fwd].[uspGetParty]"; // List<IUnitType> lstUnit = new List<IUnitType>(); // using (DbQuery oDq = new DbQuery(strExecution)) // { // oDq.AddIntegerParam("@UnitTypeId", ID); // oDq.AddIntegerParam("@CompanyID", CompanyID); // oDq.AddVarcharParam("@SchUnitName", 100, searchCriteria.LineName); // oDq.AddVarcharParam("@SortExpression", 50, searchCriteria.SortExpression); // oDq.AddVarcharParam("@SortDirection", 4, searchCriteria.SortDirection); // DataTableReader reader = oDq.GetTableReader(); // while (reader.Read()) // { // IUnitType oUnit = new UnitTypeEntity(reader); // lstUnit.Add(oUnit); // } // reader.Close(); // } // return lstUnit; //} public static int AddEditUnit(IUnitType Units, int CompanyId) { string strExecution = "[fwd].[uspManageUnitType]"; int Result = 0; using (DbQuery oDq = new DbQuery(strExecution)) { oDq.AddIntegerParam("@userID", Units.CreatedBy); oDq.AddIntegerParam("@fk_CompanyID", CompanyId); oDq.AddBigIntegerParam("@UnitTypeId", Units.UnitTypeID); oDq.AddVarcharParam("@UnitName", 20, Units.UnitName); oDq.AddIntegerParam("@RESULT", Result, QueryParameterDirection.Output); //oDq.AddIntegerParam("@LeaseId", outBookingId, QueryParameterDirection.Output); oDq.RunActionQuery(); Result = Convert.ToInt32(oDq.GetParaValue("@RESULT")); //JobId = Convert.ToInt32(oDq.GetParaValue("@JobId")); } return(Result); }