public Chart(Bars bars, SignalData signal, DataReception data) { InitializeComponent(); this.data = data; this.bars = bars; label1.Text = String.Empty; label2.Text = String.Empty; label3.Text = String.Empty; label4.Text = String.Empty; timeLastData = bars.LastGet; this.signal = signal; CreateChart(); LoadCandleFromFile(bars); PaintData(signal); textBox1.Text = signal.Level.ToString(); stepPrice = bars.StepPrice; CalculatePesent(); ChartResize(); this.Text = String.Format($"{bars.Name}_{bars.TimeFrame} - {signal.SignalType} || Люфт - {signal.CancelSignal}"); textBox2.Text = "1"; textBox3.Text = GetOneLotPrice(bars.Name).ToString(); }
void SpawnPortal(SignalData portalSpawnData) { Vector3 position = portalSpawnData.get <Vector3>("SpawnPosition"); Vector3 direction = portalSpawnData.get <Vector3>("SpawnDirection"); PortalColorData portalColor = portalSpawnData.get <PortalColorData>("PortalColors"); int arenaId = portalSpawnData.get <int>("ArenaId"); Debug.Log(arenaId); var spawnPosition = new Vector3(position.x, 1.4f, position.z) + direction * 0.01f; Quaternion portalRotation = Quaternion.LookRotation(direction); GameObject portalObject = Instantiate(portalPrefab, spawnPosition, portalRotation); GameObject correspondingPortal = null; if (PortalMap.ContainsKey(portalColor)) { if (PortalMap[portalColor].ContainsKey(arenaId)) { Destroy(PortalMap[portalColor][arenaId]); PortalMap[portalColor].Remove(arenaId); } correspondingPortal = getCorrespondingPortal(arenaId, portalColor); } else { PortalMap.Add(portalColor, new Dictionary <int, GameObject>()); } if (correspondingPortal != null) { correspondingPortal.GetComponent <Portal>().changeCorrespondingPortal(portalObject); } portalObject.GetComponent <Portal>().initialize(portalColor, correspondingPortal, arenaId); PortalMap[portalColor].Add(arenaId, portalObject); }
private void helper_Paint_Bar(Graphics g, SignalData sd, int secIndex, int i, int k, Brush brush) { int num = (this.startY + ((k * this.boxHeight) / 12)) - 12; g.DrawString(sd.CHAN_Arr_ID[i].ToString("00"), fn, brush, 0f, (float)num); g.DrawString(sd.CHAN_Arr_CNO[i].ToString("00.0"), fn, brush, cnoHorzStartPoint, (float)num); g.DrawString(sd.CHAN_Arr_State[i].ToString("X"), fn, brush, stateHorzStartPoint + 5f, (float)num); g.DrawString(sd.CHAN_Arr_Elev[i].ToString("00.0"), fn, brush, elevStartPoint, (float)num); g.DrawString(sd.CHAN_Arr_Azimuth[i].ToString("000.0"), fn, brush, azimStartPoint, (float)num); int num2 = (signalRegHorzStartPoint + ((secIndex * this.boxWidth) / 5)) + 5; int num3 = this.boxHeight / 12; int y = this.startY + ((k * this.boxHeight) / 12); int x = num2; for (int j = 0; j < 10; j++) { int num7 = sd.CHAN_MEAS_CNO[i][j]; int num8 = y - ((num3 * num7) / cno_MAX); Point point = new Point(x, y); Point point2 = new Point(x, num8); Pen pen = new Pen(brush); g.DrawLine(pen, point, point2); x += this.boxWidth / 50; } }
/// <summary>Updates the safety system plugin for this train</summary> internal void UpdateSafetySystem() { if (Plugin != null) { SignalData[] data = new SignalData[16]; int count = 0; int start = CurrentSectionIndex >= 0 ? CurrentSectionIndex : 0; for (int i = start; i < TrainManagerBase.CurrentRoute.Sections.Length; i++) { SignalData signal = TrainManagerBase.CurrentRoute.Sections[i].GetPluginSignal(this); if (data.Length == count) { Array.Resize(ref data, data.Length << 1); } data[count] = signal; count++; if (signal.Aspect == 0 | count == 16) { break; } } Array.Resize(ref data, count); Plugin.UpdateSignals(data); Plugin.LastSection = CurrentSectionIndex; Plugin.UpdatePlugin(); } }
void ShootPortal() { if (Input.GetButtonDown(PlayerInput.FirePortal)) { float timeSinceLastLaunch = Time.time - LastPortalLaunchTime; if (timeSinceLastLaunch > PortalShootInterval && !CurrentPortalColors.PrimaryColor.Equals(Color.clear)) { if (FrontPointHitResult) { if (FrontPointHit.transform.gameObject.layer == LayerMask.NameToLayer("Portal")) { return; } SignalData portalSpawnData = new SignalData(); portalSpawnData.set("SpawnPosition", FrontPointHit.point); portalSpawnData.set("SpawnDirection", FrontPointHit.normal); portalSpawnData.set("ArenaId", ArenaId); portalSpawnData.set("PortalColors", CurrentPortalColors); PortalSpawnSignal.fire(portalSpawnData); LastPortalLaunchTime = Time.time; ChangeCurrentPortalColor(new PortalColorData(Color.clear, Color.clear)); } } } }
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 0) { itemSign = new SignalItem(); int temp = 0; foreach (DataGridViewCell cell in this.dataGridView1.Rows[e.RowIndex].Cells) { itemSign.dataGridView1.Rows[0].Cells[temp++].Value = cell.Value; } itemSign.Show(); } if (e.ColumnIndex == 1) { if (this.dataGridView1.Rows.Count > 1) { string[] temp = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString().Split(); Bars bars = (Bars)data.listBars.FirstOrDefault(x => x.Name == temp[0] && x.TimeFrame == Int32.Parse(temp[1])); if (bars.listSignal != null && bars.listSignal.Count > 0) { SignalData signal = bars.listSignal.Last(); if (bars != null) { Chart window = new Chart(bars, signal, data); window.Show(); } } } } }
//private void DrawLineStopAndTakeProfit(List<double> listLevel) //{ // chartForCandle.Series.FindByName("SeriesCandleLineLevel").Points.AddXY(0, signal.Level); // for (int i = 0; i < listLevel.Count; i++) // { // chartForCandle.Series.FindByName("SeriesCandleLineLevel").Points.AddXY(0, listLevel[i]); // chartForCandle.Series.FindByName("SeriesCandleLineLevel").Points.AddXY(CandleArray.Count - 1, listLevel[i]); // chartForCandle.Series.FindByName("SeriesCandleLineLevel").Points.AddXY(0, listLevel[i]); // } //} private void DrawLine(SignalData signal) { int candleBsy; int candleBpy1; int candleBpy2; if (!hourTimeFrame) { candleBsy = CandleArray.ToList().IndexOf(CandleArray.First(x => x.time == signal.DateBsy)); candleBpy1 = CandleArray.ToList().IndexOf(CandleArray.First(x => x.time == signal.DateBpy1)); candleBpy2 = CandleArray.ToList().IndexOf(CandleArray.First(x => x.time == signal.DateBpy2)); } else { candleBsy = CandleArray.ToList().IndexOf(CandleArray.First(x => x.time.Date == signal.DateBsy.Date)); candleBpy1 = CandleArray.ToList().IndexOf(CandleArray.First(x => x.time.Date == signal.DateBpy1.Date)); candleBpy2 = CandleArray.ToList().IndexOf(CandleArray.First(x => x.time.Date == signal.DateBpy2.Date)); } chartForCandle.Series.FindByName("SeriesCandleLine").Points.AddXY(candleBpy2, CandleArray[candleBpy2].high); chartForCandle.Series.FindByName("SeriesCandleLine").Points.AddXY(candleBpy2, CandleArray[candleBpy2].high + CandleArray[candleBpy2].high / 100); chartForCandle.Series.FindByName("SeriesCandleLine").Points.AddXY(candleBpy1, CandleArray[candleBpy1].high); chartForCandle.Series.FindByName("SeriesCandleLine").Points.AddXY(candleBpy2, CandleArray[candleBpy2].high + CandleArray[candleBpy2].high / 100); chartForCandle.Series.FindByName("SeriesCandleLine").Points.AddXY(candleBsy, CandleArray[candleBsy].high); chartForCandle.Series.FindByName("SeriesCandleLine").Points.AddXY(candleBpy2, CandleArray[candleBpy2].high + CandleArray[candleBpy2].high / 100); chartForCandle.Series.FindByName("SeriesCandleLineLevel").Points.AddXY(0, signal.Level); chartForCandle.Series.FindByName("SeriesCandleLineLevel").Points.AddXY(CandleArray.Count - 1, signal.Level); }
// update plugin sections /// <summary>Updates the plugin to inform about sections.</summary> /// <param name="train">The train.</param> internal static void UpdatePluginSections(TrainManager.Train train) { if (train.Plugin != null) { SignalData[] data = new SignalData[16]; int count = 0; int start = train.CurrentSectionIndex >= 0 ? train.CurrentSectionIndex : 0; for (int i = start; i < CurrentRoute.Sections.Length; i++) { SignalData signal = CurrentRoute.Sections[i].GetPluginSignal(train); if (data.Length == count) { Array.Resize <SignalData>(ref data, data.Length << 1); } data[count] = signal; count++; if (signal.Aspect == 0 | count == 16) { break; } } Array.Resize <SignalData>(ref data, count); train.Plugin.UpdateSignals(data); } }
public void fire(SignalData data) { foreach (Action <SignalData> listener in Listeners) { listener(data); } }
public void DestroyBullet() { SignalData data = new SignalData(); data.set("Bullet", this); BulletDestroySignal.fire(data); Destroy(this.gameObject); }
private async Task <ICharacteristicManager> CreateCharacteristicManager() { FileParserResult fileParserResult = await _fileParserManager.ParseFileAsync(_fileName); SignalData signalData = SignalDataMapper.Map(fileParserResult); return(_characteristicManagerFactory.Create(signalData)); }
public SignalInfo(SignalData signalData, CharacteristicsResult characteristics) { Throw.IfNull(signalData, nameof(signalData)); Throw.IfNull(characteristics, nameof(characteristics)); this.SignalData = signalData; this.Characteristics = characteristics; }
public CharacteristicManager(ICharacteristicBuilder characteristicBuilder, SignalData signalData) { Throw.IfNull(signalData, nameof(signalData)); Throw.IfNull(signalData, nameof(characteristicBuilder)); _signalData = signalData; _characteristicBuilder = characteristicBuilder; }
public void TestSynchronizedBlockWithReentrancy1() { this.Test(() => { SignalData signal = new SignalData(); signal.ReentrantLock(); }, Configuration.Create().WithTestingIterations(100)); }
public async void SendPeerChangedEvent() { var peerChangedMessage = new SignalData(); peerChangedMessage.type = "peer_changed"; peerChangedMessage.peers = infoList.Values.ToList(); await SendMessageToAllAsync(JsonConvert.SerializeObject(peerChangedMessage)); }
public void OnAfterDeserialize() { signalList = new Dictionary <string, SignalData>(); for (int i = 0; i < signals.Length; i++) { SignalData data = signals[i]; signalList.Add(data.signalID, data); } }
public void Find1478Tests(string input, int expected) { var lengths = new[] { 2, 3, 4, 7, }; var(_, output) = SignalData.Parse(input, default); var actual = output.Select(s => s.Length).Count(lengths.Contains); Assert.Equal(expected, actual); }
public void TestMonitorWithReentrancy1() { this.Test(() => { SignalData signal = new SignalData(); signal.ReentrantLock(); }, this.GetConfiguration().WithTestingIterations(100)); }
void onPortalFluidUse(SignalData fluidUSedData) { var arenaId = fluidUSedData.get <int>("arenaId"); var position = fluidUSedData.get <Vector3>("location"); var currentFluidColor = ArenaPointColorMap[arenaId][position]; ArenaPointColorMap[arenaId].Remove(position); StartCoroutine(RespawnConsumedFluid(arenaId, position, currentFluidColor)); }
public void Compute() { if (FirstOperationTab.SignalData.IsNotEmpty() && SecondOperationTab.SignalData.IsNotEmpty()) { if (SelectedOperation == "5) Splot" || SelectedOperation == "6) Korelacja (bezpośrednia)" || SelectedOperation == "7) Korelacja (przez Splot)") { List <double> XSamples = new List <double>(); int FirstTabSamplesCounter = FirstOperationTab.SignalData.ConversionSamplesX.Count; int SecondTabSamplesCounter = SecondOperationTab.SignalData.ConversionSamplesX.Count; for (int i = 0; i < FirstTabSamplesCounter + SecondTabSamplesCounter - 1; i++) { XSamples.Add(i); } SignalData signalData = new SignalData(0) { ConversionSamplesX = XSamples, ConversionSamplesY = SelectedOperation.SignalOperation(FirstOperationTab.SignalData.ConversionSamplesY, SecondOperationTab.SignalData.ConversionSamplesY) }; SelectedTab.SignalData = signalData; SelectedTab.IsScattered = true; SelectedTab.DrawCharts(); } else { string message = ""; if (SecondOperationTab.SignalData.IsInvalid(FirstOperationTab.SignalData, message)) { MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } SignalData signalData = new SignalData(FirstOperationTab.SignalData.StartTime, FirstOperationTab.SignalData.Sampling, FirstOperationTab.SignalData.ConversionSampling) { ConversionSamplesX = FirstOperationTab.SignalData.ConversionSamplesX, ConversionSamplesY = SelectedOperation.SignalOperation(FirstOperationTab.SignalData.ConversionSamplesY, SecondOperationTab.SignalData.ConversionSamplesY) }; SelectedTab.SignalData = signalData; SelectedTab.IsScattered = true; SelectedTab.CalculateSignalInfo(signalData.StartTime, signalData.StartTime + (signalData.ConversionSamplesY.Count / signalData.ConversionSampling)); SelectedTab.DrawCharts(); } } }
private List <double> GetLewelForPaint(SignalData signal, List <double> allLevel) { List <double> temp = new List <double>(); temp.Add(signal.Level); temp.Add(signal.SignalType[0] == 'S'?allLevel[1]:allLevel[2]); temp.Add(signal.SignalType[0] == 'S' ? allLevel[3] : allLevel[0]); temp.Add(signal.CancelSignal); return(temp); }
/// <summary> /// Indicates whether this instance and a specified object are equal. /// </summary> /// <param name="obj">The object to compare with the current instance.</param> /// <returns> /// true if the object and this instance are of the same type and represent the same value, /// otherwise false. /// </returns> public override bool Equals(object obj) { SignalData s = obj as SignalData; if (s == null) { return(false); } return((Emission == s.Emission) && (Source == s.Source) && (Func == s.Func)); }
void OnTriggerStay(Collider other) { var currentLane = other.GetComponentInParent <MapTrafficLane>(); if (currentLane) { if (currentLane.stopLine?.isStopSign == false) { GameObject egoGO = transform.parent.gameObject; var signals = currentLane.stopLine.signals; foreach (var signal in signals) { Vector3 relPos = egoGO.transform.InverseTransformPoint(signal.gameObject.transform.position); relPos.Set(relPos.z, -relPos.x, relPos.y); var forwardDistance = relPos.x; if (forwardDistance > 0 && forwardDistance < MaxDistance) { Quaternion relRot = Quaternion.Inverse(egoGO.transform.rotation) * signal.gameObject.transform.rotation; relRot.Set(-relRot.z, relRot.x, -relRot.y, relRot.w); Vector3 size = signal.CurrentSignalLight.Bounds.size; size.Set(size.z, size.x, size.y); string id = signal.id; if (string.IsNullOrEmpty(id)) { id = "signal_" + signal.SeqId.ToString(); } if (!DetectedStates.Contains(signal.CurrentState)) { DetectedStates.Add(signal.CurrentState); } if (!DetectedSignals.ContainsKey(signal)) { var signalData = new SignalData() { SeqId = signal.SeqId, Id = id, Label = signal.CurrentState, Score = 1.0f, Position = relPos, Rotation = relRot, Scale = size, }; DetectedSignals.Add(signal, signalData); } } } } } }
public void FilterSignal() { if (SignalTab.SignalData.IsNotEmpty() && FilterTab.SignalData.IsNotEmpty()) { List <double> XSamples = new List <double>(); List <double> YSamples = new List <double>(); if (SignalTab.SignalData.QuantizationSamplesY.Count != 0 && FilterTab.SignalData.QuantizationSamplesY.Count != 0) { YSamples = Operations.ConvoluteSignals(SignalTab.SignalData.QuantizationSamplesY, FilterTab.SignalData.QuantizationSamplesY) .Skip((FilterTab.SignalData.QuantizationSamplesY.Count - 1) / 2) .Take(SignalTab.SignalData.QuantizationSamplesY.Count).ToList(); } else if (SignalTab.SignalData.QuantizationSamplesY.Count != 0 && FilterTab.SignalData.QuantizationSamplesY.Count == 0) { YSamples = Operations.ConvoluteSignals(SignalTab.SignalData.QuantizationSamplesY, FilterTab.SignalData.SamplesY) .Skip((FilterTab.SignalData.SamplesY.Count - 1) / 2) .Take(SignalTab.SignalData.QuantizationSamplesY.Count).ToList(); } else if (SignalTab.SignalData.QuantizationSamplesY.Count == 0 && FilterTab.SignalData.QuantizationSamplesY.Count != 0) { YSamples = Operations.ConvoluteSignals(SignalTab.SignalData.SamplesY, FilterTab.SignalData.QuantizationSamplesY) .Skip((FilterTab.SignalData.QuantizationSamplesY.Count - 1) / 2) .Take(SignalTab.SignalData.SamplesY.Count).ToList(); } else { YSamples = Operations.ConvoluteSignals(SignalTab.SignalData.SamplesY, FilterTab.SignalData.SamplesY) .Skip((FilterTab.SignalData.SamplesY.Count - 1) / 2) .Take(SignalTab.SignalData.SamplesY.Count).ToList(); } for (int i = 0; i < YSamples.Count; i++) { XSamples.Add(i); } SignalData signalData = new SignalData(0) { ConversionSamplesX = XSamples, ConversionSamplesY = YSamples }; SelectedTab.SignalData = signalData; SelectedTab.IsScattered = true; SelectedTab.DrawCharts(); } }
public void Test2(string input, int expected) { var(samples, output) = SignalData.Parse(input, default); IReadOnlyDictionary <string, int> dictionary = samples.ReverseArray().ToDictionary(kvp => kvp.Key, kvp => kvp.Value); var chars = output.Select(s => dictionary[s].ToString()[0]); var @string = string.Concat(chars); var actual = int.Parse(@string); Assert.Equal(expected, actual); }
public void TestSimpleSynchronizedBlock() { this.Test(async() => { SignalData signal = new SignalData(); var t1 = Task.Run(signal.Wait); var t2 = Task.Run(signal.Signal); await Task.WhenAll(t1, t2); }, Configuration.Create().WithTestingIterations(100)); }
public void TestSynchronizedBlockWithReentrancy3() { this.Test(async() => { SignalData signal = new SignalData(); Task t1 = Task.Run(signal.ReentrantWait); Task t2 = Task.Run(signal.Signal); await Task.WhenAll(t1, t2); }, Configuration.Create().WithTestingIterations(100)); }
public void TestMonitorWithReentrancy3() { this.Test(async() => { SignalData signal = new SignalData(); Task t1 = Task.Run(signal.ReentrantWait); Task t2 = Task.Run(signal.Signal); await Task.WhenAll(t1, t2); }, this.GetConfiguration().WithTestingIterations(100)); }
IEnumerator killSwitch() { yield return(new WaitForSeconds(TimeoutInterval)); Destroy(this.gameObject); SignalData data = new SignalData(); data.set("ArenaId", ArenaId); data.set("PortalColors", PortalColors); PortalTimeoutSignal.fire(data); }
public void TestSimpleMonitor() { this.Test(async() => { SignalData signal = new SignalData(); var t1 = Task.Run(signal.Wait); var t2 = Task.Run(signal.Signal); await Task.WhenAll(t1, t2); }, this.GetConfiguration().WithTestingIterations(100)); }