/// <summary> /// Transforms dynamic table 'Target_{NETWORKID}_{SIMULATIONID}' data into a TargetReportModel /// </summary> /// <param name="model">SimulationModel</param> /// <param name="yearsIdValues">Hashtable</param> /// <param name="totalYears">int[]</param> /// <param name="db">BridgeCareContext</param> /// <returns></returns> private TargetReportModel GetTargetInformation(SimulationModel model, Hashtable yearsIdValues, int[] totalYears, BridgeCareContext db) { var targetData = db.Targets.AsNoTracking().Where(t => t.SIMULATIONID == model.SimulationId); var listRows = new List <string>(); var idTargets = new Hashtable(); foreach (var targetEntity in targetData) { var targetParameters = new TargetParameters(targetEntity); var rowKey = $"{targetParameters.Attribute}|{targetParameters.Name}|{targetParameters.Criteria}"; if (listRows.Contains(rowKey)) { targetParameters.Row = listRows.IndexOf(rowKey); } else { listRows.Add(rowKey); targetParameters.Row = listRows.Count - 1; } idTargets.Add(targetParameters.Id, targetParameters); } return(targetCells.GetData(yearsIdValues, totalYears, idTargets)); }
public void Should_be_possible_to_encapsulate_target_info() { var mockCryptoProvider = CreateMockCryptoProvider(EMPTY_DOMAIN); var targetParameters = new TargetParameters( FAKE_ADDRESS, FAKE_USERNAME, FAKE_PASSWORD, "", FakeCertificate, mockCryptoProvider); Assert.AreEqual("10.1.1.1", targetParameters.Address, UNEXPECTED_TARGET_ADDRESS_FOUND); Assert.IsFalse(String.IsNullOrWhiteSpace(targetParameters.EncryptedCredentials), "The encrypted credentials cannot be null."); mockCryptoProvider .AssertWasCalled( crypto => crypto.EncryptCredential(FakeCertificate, EMPTY_DOMAIN, FAKE_USERNAME, FAKE_PASSWORD, "")); }
//public CameraTarget[] Targets; //private CameraTarget lastTarget; //private int targetIndex; private void Awake() { // GETTING THE CAMERA REFERENCE: cameraTest = FindObjectOfType <CameraBehaviour>(); // SETTING THE DEFAULT PARAMETERS FOR STATIC AND DYNAMIC TARGETS AND FOR THE STEADYCAM TargetParameters.SetDefaultSteadyCamParameters(0.03f, 0.05f, 2f, 0.03f, 0.06f, 3f, 1f); TargetParameters.SetDefaultStaticPositionParameters(CameraExecutionMode.SmoothLerp, 0.5f, 0.5f, 25f, SteadyCamBehaviour.Ignore, SteadyCamBehaviour.Ignore); TargetParameters.SetDefaultStaticRotationParameters(CameraExecutionMode.SmoothLerp, 0.5f, 0.5f, 5f, SteadyCamBehaviour.Ignore, SteadyCamBehaviour.Ignore); TargetParameters.SetDefaultDynamicPositionParameters(CameraExecutionMode.NormalLerp, 1f, 0.05f, Vector3.zero); TargetParameters.SetDefaultDynamicRotationParameters(CameraExecutionMode.NormalLerp, DynamicRotationBehaviour.LookAs, 1f, 0.05f); //CameraEventSystem.CameraTargetPositionReachedEvent += CheckTarget; // SETTING CUSTOM METHOD FOR CAMERA MOVEMENT: cameraTest.SetCustomMethod(SmootherLerpPositioning); }
private void FillData(Hashtable yearsIDValues, Hashtable idTargets, DataTable targetTable, Dictionary <string, bool> attributeOrder) { int increment = 2; foreach (var key in yearsIDValues.Keys) { Hashtable yearHashValue = new Hashtable(); yearHashValue = (Hashtable)yearsIDValues[key]; var yearValues = yearHashValue.Keys.Cast <int>().OrderBy(_ => _); TargetParameters target = (TargetParameters)idTargets[key]; DataRow newDataRow = targetTable.NewRow(); newDataRow["Attribute"] = target.Attribute; newDataRow["Group"] = target.Name; int column = 2; foreach (int year in yearValues) { double targetMetValue = (double)yearHashValue[year]; newDataRow[column] = targetMetValue + "/" + target.TargetMean; if (attributeOrder.ContainsKey(target.Attribute) && !attributeOrder[target.Attribute]) { if (targetMetValue < target.TargetMean) { var cell = (row : increment, column : column); address.Cells.Add(cell); } } else { if (targetMetValue > target.TargetMean) { var cell = (row : increment, column : column); address.Cells.Add(cell); } } column++; } targetTable.Rows.Add(newDataRow); increment++; } }
private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (TreatTargetAs == TargetType.Static) //STATIC TARGET { TargetParameters.StaticTargetRotationParameters rotParams = TargetParameters.GetDefaultStaticRotationParameters(); rotParams.Duration = 8f; cameraTest.SetStaticCameraTarget(Target, rotParams); TargetParameters.StaticTargetPositionParameters posParams = TargetParameters.GetDefaultStaticPositionParameters(); posParams.CameraExecutionMode = CameraExecutionMode.CustomLerp; posParams.StartSCParameters.SinIntensityChangeTimer = 2f; posParams.StartSCParameters.CosIntensityChangeTimer = 2f; posParams.StartSCParameters.MinCosIntensity = 0.1f; posParams.StartSCParameters.MaxCosIntensity = 0.12f; posParams.StartSCParameters.MinSinIntensity = 0.1f; posParams.StartSCParameters.MaxSinIntensity = 0.11f; posParams.SteadyCamOnStart = SteadyCamBehaviour.TurnOnAndOverride; posParams.SteadyCamOnEnd = SteadyCamBehaviour.TurnOnAndOverride; cameraTest.SetStaticCameraTarget(Target, posParams); } else //DYNAMIC TARGET { TargetParameters.DynamicTargetPositionParameters dynamicPosParams = TargetParameters.GetDefaultDynamicPositionParameters(); dynamicPosParams.LerpSpeed = 2f; cameraTest.SetDynamicCameraTarget(Target.transform.GetChild(0).GetComponent <CameraTarget>(), dynamicPosParams); TargetParameters.DynamicTargetRotationParameters dynamicRotParams = TargetParameters.GetDefaultDynamicRotationParameters(); dynamicRotParams.DynamicRotationBehaviour = DynamicRotationBehaviour.LookAt; dynamicRotParams.LerpSpeed = 5f; cameraTest.SetDynamicCameraTarget(Target, dynamicRotParams); } } //else if (Input.GetKey(KeyCode.LeftControl)) //{ // NextTarget(); //} }
private void Awake() { Camera = transform.GetChild(0); if (Camera == null) { Debug.LogError("Error: the transform with the Camera component must be a child of " + gameObject.name); } CameraEventSystem.SetCameraStaticTargetPositionEvent += SetCameraStaticTargetPosition; CameraEventSystem.SetCameraStaticTargetRotationEvent += SetCameraStaticTargetRotation; CameraEventSystem.CameraTargetPositionReachedEvent += CameraTargetPositionReached; CameraEventSystem.CameraTargetRotationReachedEvent += CameraTargetRotationReached; CameraEventSystem.SetCameraDynamicTargetPositionEvent += SetCameraDynamicTargetPosition; CameraEventSystem.SetCameraDynamicTargetRotationEvent += SetCameraDynamicTargetRotation; CameraEventSystem.CameraSteadyCamActivationEvent += ActivateSteadyCam; steadyCamParameters = TargetParameters.GetDefaultSteadyCamParameters(); }
/// <summary> /// On scene load, change the parameters /// </summary> /// <param name="scene"></param> /// <param name="mode"></param> private void OnSceneLoad(Scene scene, LoadSceneMode mode) { Dictionary <string, TargetParameters> dict = new Dictionary <string, TargetParameters>(); dict["Start Menu"] = new TargetParameters { minimize = 0.01f, minX = -2, maxX = 2, minY = -2, maxY = 2 }; TargetParameters p; if (dict.TryGetValue(scene.name, out p)) { minimize = p.minimize; minX = p.minX; maxX = p.maxX; minY = p.minY; maxY = p.maxY; } }