private void ReadTest <T>(T expected, Action <TagWriter, T> write, Func <TR2, T> read) { using (Stream stream = new MemoryStream()) { // arrange TR2 target; T actual; using (BinaryTagWriter writer = new BinaryTagWriter(stream)) { writer.WriteStartDocument(); writer.WriteStartTag(TagType.Compound); write(writer, expected); writer.WriteEndTag(); writer.WriteEndDocument(); } stream.Position = 0; target = new TR2(stream); target.MoveToNextElement(); // compound // act actual = read(target); // assert Assert.AreEqual(expected, actual); } }
public void Types_load_in_correct_order() { using (Stream stream = File.OpenRead(this.ComplexDataFileName)) { using (Stream decompressorStream = new GZipStream(stream, CompressionMode.Decompress)) { // arrange TR2 target; List <TagType> actual; TagType[] expected; expected = new TagType[0]; actual = new List <TagType>(); target = new TR2(decompressorStream); // act while (target.MoveToNextElement()) { Debug.WriteLine(target.Name); actual.Add(target.Type); } // assert Assert.AreEqual(expected, actual); } } }
public void ContinueWorkout() { if (WeighingSlider.value == 1) { TR.cycle = 5; } else { TR.cycle = 0; } TR.replace(); Target.SetActive(true); if (WeighingSlider.value == 2) // both arms at same time selected { TR2.cycle = 0; TR2.replace(); Target2.SetActive(true); } StopLoggingRestTime(); StartLoggingWorkoutTime(); GameControl.instance.completedSets++; ToContinue(); /* * if (continued == false) * { * ToContinue(); * } */ }
public IHttpActionResult GetActionResult() { Entities db = new Entities(); List <Countries> countries_list = db.Countries.ToList(); List <Cities> cities_list = db.Cities.ToList(); List <ski_jumpers> jumpers_list = db.ski_jumpers.ToList(); List <ski_jumping_hills> hills_list = db.ski_jumping_hills.ToList(); List <ski_jumps> jumps_list = db.ski_jumps.ToList(); var query = from jump in jumps_list join jumper in jumpers_list on jump.JumperID equals jumper.JumperID into TR1 from jumper in TR1.DefaultIfEmpty() join hill in hills_list on jump.JumpinhHillID equals hill.JumpingHillID into TR2 from hill in TR2.DefaultIfEmpty() join ci in cities_list on hill.CityID equals ci.CityID into TR3 from ci in TR3.DefaultIfEmpty() join c in countries_list on jumper.CountryID equals c.CountryID into TR4 from c in TR4.DefaultIfEmpty() join co in countries_list on hill.CountryID equals co.CountryID into TR5 from co in TR5.DefaultIfEmpty() select new JumpsResult { GetJumpersCountries = c, GetHillsCountries = co, GetCities = ci, GetJumpers = jumper, GetJumps = jump, GetHills = hill }; return(Ok(query)); }
private void Button2_Click(object sender, EventArgs e) { double RS3, RS4, RS5, TR2; try { RS3 = double.Parse(textBox3.Text); RS4 = double.Parse(textBox4.Text); RS5 = double.Parse(textBox5.Text); } catch { MessageBox.Show("INPUT ERROR"); RS3 = 0.0; RS4 = 0.0; RS5 = 0.0; } TR2 = RS3 + RS4 + RS5; MessageBox.Show(TR2.ToString()); }
public void TestName() { using (Stream stream = File.OpenRead(this.ComplexDataFileName)) { using (Stream decompressorStream = new GZipStream(stream, CompressionMode.Decompress)) { // arrange TR2 target; ComplexData actual; ComplexData expected; ComplextDataLoadState state; ComplexData.Compound1 currentCompound1; ComplexData.Compound2 currentCompound2; actual = new ComplexData(); expected = ComplexData.Default; target = new TR2(decompressorStream); state = ComplextDataLoadState.NotInitialized; currentCompound1 = null; currentCompound2 = null; // act while (target.Read()) { if (target.IsStartElement()) { Trace.WriteLine(target.Type); Trace.WriteLine(target.Name); //Trace.WriteLine(target.Value) switch (target.Name) { case "Level": state = ComplextDataLoadState.Level; break; case "longTest": if (state == ComplextDataLoadState.Level) { actual.LongValue = target.ReadLong2(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "shortTest": if (state == ComplextDataLoadState.Level) { actual.ShortValue = target.ReadShort2(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "stringTest": if (state == ComplextDataLoadState.Level) { actual.StringValue = target.ReadString2(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "floatTest": if (state == ComplextDataLoadState.Level) { actual.FloatValue = target.ReadFloat2(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "intTest": if (state == ComplextDataLoadState.Level) { actual.IntegerValue = target.ReadInt2(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "nested compound test": state = ComplextDataLoadState.Compound; break; case "ham": case "egg": if (state == ComplextDataLoadState.Compound) { currentCompound1 = new ComplexData.Compound1(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "name": if (state == ComplextDataLoadState.Compound) { state = ComplextDataLoadState.CompoundItem; currentCompound1.Name = target.ReadString2(); actual.CompoundValue.Add(currentCompound1.Name, currentCompound1); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "value": if (state == ComplextDataLoadState.CompoundItem) { currentCompound1.Value = target.ReadFloat2(); } else { throw new InvalidDataException($"Unexpected token '{target.Name}'"); } break; case "listTest (long)": state = ComplextDataLoadState.LongList; break; } } else if (target.IsEndElement()) { switch (state) { case ComplextDataLoadState.NotInitialized: break; case ComplextDataLoadState.Level: break; case ComplextDataLoadState.CompoundItem: state = ComplextDataLoadState.Compound; break; case ComplextDataLoadState.Compound: state = ComplextDataLoadState.Level; break; case ComplextDataLoadState.LongList: break; case ComplextDataLoadState.CompoundList: break; } } } // assert NbtAssert.AreEqual(expected, actual); } } }
//The "start game"-function public IEnumerator StartTheGame() { continued = false; scoreAmount = 0; //Set the score to zero ToContinue(); //Makes sure there are no point markers on the screen //GameInfoText.text = "Get into starting position..."; //StartCoroutine(B6.LockQuaternion()); //GameInfoText.text = "Ready?"; //Countdown start yield return(new WaitForSeconds(1.5f)); //GameInfoText.text = "3"; GameObject shot3 = Instantiate(number3) as GameObject; shot3.SetActive(true); SoundManager.instance.PlaySingle(GameControl.instance.threeAudio, 0.8f); yield return(new WaitForSecondsRealtime(1.5f)); //GameInfoText.text = "2"; Destroy(shot3); GameObject shot2 = Instantiate(number2) as GameObject; shot2.SetActive(true); SoundManager.instance.PlaySingle(GameControl.instance.twoAudio, 0.8f); yield return(new WaitForSecondsRealtime(1.5f)); //GameInfoText.text = "1"; Destroy(shot2); GameObject shot = Instantiate(number1) as GameObject; shot.SetActive(true); SoundManager.instance.PlaySingle(GameControl.instance.oneAudio, 0.8f); yield return(new WaitForSecondsRealtime(1.5f)); //GameInfoText.text = "Go!"; Destroy(shot); GameObject goText = Instantiate(goLabel) as GameObject; goText.SetActive(true); SoundManager.instance.PlaySingle(GameControl.instance.buzzerAudio, 0.8f); yield return(new WaitForSeconds(1f)); Destroy(goText); yield return(new WaitForSeconds(2f)); //ToContinue(); // Reset timer if countdown (new workout) GameControl.instance.totalTimeOfWorkout = 0.0f; StopLoggingRestTime(); GameControl.instance.totalTimeAtRest = 0.0f; StartLoggingWorkoutTime(); GameInfoText.text = ""; //Countdown end if (WeighingSlider.value == -1) //if left weighing is selected { TR.cycle = 0; TR.replace(); } else if (WeighingSlider.value == 1) //if right weighing is selected { TR.cycle = 5; TR.replace(); } else if (WeighingSlider.value == 2) // both arms at same time selected { // Shoot both pucks TR.cycle = 0; TR.replace(); TR2.cycle = 0; TR2.replace(); } else //if neutral weighing is selected (both arms, one at a time) { TR.replace(); } StopCoroutine(StartTheGame()); }