public bool AssignJob(MeasureType typeToInstall) { _target = FindBestBuilding(typeToInstall); if (_target == null) { UIController.instance.AddNews(name, " wants to install a " + typeToInstall.ToString() + ", but there is no room left."); return(false); } if (GameController.instance.money < RainproofMeasures.GetCost(typeToInstall)) { UIController.instance.AddNews(name, " tried to buy a " + typeToInstall.ToString() + ", but there is currently not enough money."); return(false); } _measureToInstall = typeToInstall; _path = AStar.FindPath(_lastReachedWaypoint, _target); _target.GetComponent <RainproofMeasures>().PlanMeasure(_measureToInstall); Vector2 screenSize = new Vector2(Screen.width, Screen.height); Vector2 canvasLocation = Camera.main.WorldToViewportPoint(new Vector2(_target.transform.position.x * screenSize.x, _target.transform.position.y * screenSize.y)); UIController.instance.AddMoneyDecreaseFeedback(canvasLocation, RainproofMeasures.GetCost(typeToInstall)); UIController.instance.AddNews(name, " bought a " + typeToInstall.ToString() + " and is now going to install it."); CreateMeasureIcon(); ApplyEasterEgg(); return(true); }
/// <summary> /// Добавить /// </summary> /// <param name="event">событие</param> public void Add(TraceEvent @event) { TimeSpan?ts = null; if (@event != null) { if (MeasureType == MeasureType.Count) { ts = null; } else if (MeasureType == MeasureType.BeginTime) { ts = @event.BeginTime; } else if (MeasureType == MeasureType.EndTime) { ts = @event.EndTime; } else if (MeasureType == MeasureType.Duration) { ts = @event.Duration; } else if (MeasureType == MeasureType.ExcludedTime) { ts = @event.ExcludedTime; } else { throw new NotSupportedException(MeasureType.ToString()); } } _ts.Add(ts); }
void CreateMeasureIcon() { _measureToInstalPosition = _target.transform.FindChild(_measureToInstall.ToString()).transform.position; Sprite measureSprite = _target.transform.FindChild(_measureToInstall.ToString()).GetComponent <SpriteRenderer>().sprite; _measureIcon = Instantiate(measureIconPrefab); _measureIcon.transform.SetParent(transform, false); _measureIcon.GetComponent <SpriteRenderer>().sprite = measureSprite; Color currentColor = _measureIcon.GetComponent <SpriteRenderer>().color; _measureIcon.GetComponent <SpriteRenderer>().color = new Color(currentColor.r, currentColor.g, currentColor.b, 0.75f); float area = measureSprite.bounds.extents.x * measureSprite.bounds.extents.y * 4f; float percentage = area / 7f; float scale = Mathf.Lerp(1f, 0.2f, percentage); _measureIcon.transform.localScale = new Vector3(scale, scale, scale); _initialIconScale = scale; }
/// <summary> /// Saves a badge measure into the "Mesure" table of the database according to type. /// </summary> /// <param name="value"></param> /// <param name="type"></param> /// <param name="badgeId"></param> public void SaveMeasure(float value, MeasureType type, string badgeId) { command.CommandText = INSERT_MEASURE; command.Parameters.AddWithValue("$date", DateTime.Now); command.Parameters.AddWithValue("$value", value); command.Parameters.AddWithValue("$type", type.ToString()); command.Parameters.AddWithValue("$idBadge", badgeId); command.Prepare(); if (!database.State.Equals(ConnectionState.Executing)) { command.ExecuteNonQuery(); } }
public void ApplyMeasure(MeasureType type) { if (!appliedMeasures.Contains(type)) { Transform child = transform.FindChild(type.ToString()); if (child != null) { child.gameObject.SetActive(true); } appliedMeasures.Add(type); UIController.instance.UpdateRainwaterMeter(); } }
public override string ToString() { StringBuilder __sb = new StringBuilder("TDDISecurityControl("); bool __first = true; if (__isset.Id) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Id: "); __sb.Append(Id); } if (Name != null && __isset.Name) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Name: "); __sb.Append(Name); } if (Description != null && __isset.Description) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Description: "); __sb.Append(Description); } if (KeyValueMaps != null && __isset.KeyValueMaps) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("KeyValueMaps: "); __sb.Append(KeyValueMaps); } if (IntrinsicSafety != null && __isset.IntrinsicSafety) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("IntrinsicSafety: "); __sb.Append(IntrinsicSafety); } if (SafeGuard != null && __isset.SafeGuard) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("SafeGuard: "); __sb.Append(SafeGuard); } if (ApplierInformation != null && __isset.ApplierInformation) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ApplierInformation: "); __sb.Append(ApplierInformation); } if (__isset.RiskAcceptability) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("RiskAcceptability: "); __sb.Append(RiskAcceptability); } if (FurtherAction != null && __isset.FurtherAction) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("FurtherAction: "); __sb.Append(FurtherAction); } if (Source != null && __isset.Source) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Source: "); __sb.Append(Source); } if (AssuranceLevel != null && __isset.AssuranceLevel) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("AssuranceLevel: "); __sb.Append(AssuranceLevel == null ? "<null>" : AssuranceLevel.ToString()); } if (MeasureType != null && __isset.MeasureType) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("MeasureType: "); __sb.Append(MeasureType == null ? "<null>" : MeasureType.ToString()); } if (Category != null && __isset.Category) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Category: "); __sb.Append(Category); } if (__isset.Type) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Type: "); __sb.Append(Type); } if (Vulnerabilities != null && __isset.Vulnerabilities) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Vulnerabilities: "); __sb.Append(Vulnerabilities); } __sb.Append(")"); return(__sb.ToString()); }
public static bool IsTabSelected(MeasureType tab) { bool isActive = false; ReadOnlyCollection <IWebElement> mainTabs = Driver.Instance.FindElements(By.ClassName(classNameToFind: "methodOption")); IWebElement selectedTab = mainTabs.FirstOrDefault(t => t.Text.ToUpper().Contains(tab.ToString().ToUpper())); if (selectedTab != null) { isActive = selectedTab.GetAttribute(attributeName: "class").Contains(value: "active"); } return(isActive); }
public static bool IsNameTabAvailable(MeasureType tab) { ReadOnlyCollection <IWebElement> mainTabs = Driver.Instance.FindElements(By.ClassName(classNameToFind: "methodOption")); IWebElement selectedTab = mainTabs.FirstOrDefault(t => t.Text.ToUpper().Contains(tab.ToString().ToUpper())); return(selectedTab != null); }
/// <summary> /// Updates the graph with the values retrieved in the local databse according to the measure type passed at the creation of the form. /// </summary> private void UpdateGraph() { graphModel.Axes.Clear(); lineSerie.Points.Clear(); LinearAxis yAxis = new LinearAxis() { Minimum = 0, //Maximum = measureType.Equals(MeasureType.Position) ? 100 : 35, Position = AxisPosition.Left, AbsoluteMinimum = 0, AbsoluteMaximum = measureType.Equals(MeasureType.Proximity) ? 100 : 35, }; DateTimeAxis xAxis = new DateTimeAxis() { AbsoluteMinimum = DateTimeAxis.ToDouble(startPicker.Value), AbsoluteMaximum = DateTimeAxis.ToDouble(endPicker.Value), Position = AxisPosition.Bottom, StringFormat = DATE_FORMAT }; graphModel.Axes.Add(xAxis); graphModel.Axes.Add(yAxis); SQLiteDataReader reader = localDatabase.Query(REQUEST); while (reader.Read()) { string date = reader.GetString(1); DateTime time = Convert.ToDateTime(date); if (time > startPicker.Value && time < endPicker.Value && reader.GetString(3).Equals(measureType.ToString())) { lineSerie.Points.Add(new DataPoint(DateTimeAxis.ToDouble(time), reader.GetDouble(2))); } } reader.Close(); graphModel.Axes[0].MajorGridlineStyle = LineStyle.Solid; graphModel.Axes[0].MinorGridlineStyle = LineStyle.Dot; graphModel.Axes[0].MajorGridlineColor = GRID_COLOR; graphModel.Axes[0].MinorGridlineColor = GRID_COLOR; graphModel.Axes[1].MajorGridlineStyle = LineStyle.Solid; graphModel.Axes[1].MinorGridlineStyle = LineStyle.Dot; graphModel.Axes[1].MajorGridlineColor = GRID_COLOR; graphModel.Axes[1].MinorGridlineColor = GRID_COLOR; graphModel.InvalidatePlot(true); }
public override string ToString() { StringBuilder __sb = new StringBuilder("TDDIDependabilityArtifactUnion("); bool __first = true; if (DependabilityPackage != null && __isset.DependabilityPackage) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DependabilityPackage: "); __sb.Append(DependabilityPackage == null ? "<null>" : DependabilityPackage.ToString()); } if (Measure != null && __isset.Measure) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Measure: "); __sb.Append(Measure == null ? "<null>" : Measure.ToString()); } if (MeasureType != null && __isset.MeasureType) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("MeasureType: "); __sb.Append(MeasureType == null ? "<null>" : MeasureType.ToString()); } if (MaintenanceProcedure != null && __isset.MaintenanceProcedure) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("MaintenanceProcedure: "); __sb.Append(MaintenanceProcedure == null ? "<null>" : MaintenanceProcedure.ToString()); } if (DomainElement != null && __isset.DomainElement) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DomainElement: "); __sb.Append(DomainElement); } if (RequirementArtifact != null && __isset.RequirementArtifact) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("RequirementArtifact: "); __sb.Append(RequirementArtifact); } if (HARAArtifact != null && __isset.HARAArtifact) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("HARAArtifact: "); __sb.Append(HARAArtifact); } __sb.Append(")"); return(__sb.ToString()); }