public static void MakeTie(Robot robA, Robot robB, int length, int last, int port) { if (robA.Exists == false) { return; } var distance = (robA.Position - robB.Position).Magnitude(); if (distance <= length * 1.5 && ThreadSafeRandom.Local.Next(2, 92) >= robB.Slime) { DeleteTie(robA, robB); if (robA.Ties.Count < MaxTies && robB.Ties.Count < MaxTies) { var tieK = new Tie { OtherBot = robB, NaturalLength = distance, Last = last, Port = port, BackTie = false, b = 0.02, k = 0.01, Type = TieType.DampedSpring }; var tieJ = new Tie { OtherBot = robA, NaturalLength = distance, Last = last, Port = robB.Ties.Count, BackTie = true, b = 0.02, k = 0.01, Type = TieType.DampedSpring }; tieK.ReverseTie = tieJ; tieJ.ReverseTie = tieK; robA.Ties.Add(tieK); robB.Ties.Add(tieJ); robA.Memory[466] = robA.Ties.Count; robB.Memory[466] = robB.Ties.Count; robA.Memory[MemoryAddresses.TIEPRES] = tieK.Mem; robB.Memory[MemoryAddresses.TIEPRES] = tieJ.Mem; robA.ReadTRefVars(tieK); } } if (robB.Slime > 0) { robB.Slime -= Math.Min(20, robB.Slime); } robA.Energy -= SimOpt.SimOpts.Costs.TieFormationCost * SimOpt.SimOpts.Costs.CostMultiplier / (robA.Ties.Count + 1); //Tie cost to form tie }
public static void Main() { // Opens the server and sets its settings Console.Title = "Blackthorn Server"; Logo(); Console.WriteLine("[Initialize Server Startup]"); // Checks if all directories exist, if they do not exist then create them Directories.Create(); Console.WriteLine("Directories created."); // Clears and loads all required data Read.Required(); Clean.Required(); // Creates network devices Network.Start(); Console.WriteLine("Network started."); // Calculates how long it took to initialize the server Console.WriteLine("\r\n" + "Server started. Type 'Help' to see the commands." + "\r\n"); // Starts the ties Thread Comandos_Laço = new Thread(Tie.Commands); Comandos_Laço.Start(); Tie.Principal(); }
public void Decoratot() { // 可參考PaymentController SetPayDataStatusToPayment var person = new Person("小菜"); Console.WriteLine($"第一種裝扮"); var pqx = new Sneakers(); var kk = new Trousers(); var dtx = new TShirts(); pqx.Decorate(person); kk.Decorate(pqx); dtx.Decorate(kk); dtx.Show(); Console.WriteLine($"第二種裝扮"); var px = new LeatherShoes(); var ld = new Tie(); var xz = new BusinessSuit(); px.Decorate(person); ld.Decorate(px); xz.Decorate(ld); xz.Show(); }
public override string ToString() { if (IsEmpty) { return("Empty"); } StringBuilder s = new StringBuilder(); s.Append('['); if (Min != null) { s.Append(Min.ToString()); } s.Append(", "); if (Tie != null) { s.Append(Tie.ToString()); } s.Append(", "); if (Max != null) { s.Append(Max.ToString()); } s.Append(']'); return(s.ToString()); }
/// <summary> /// Updates the light and ambient variables which can then be used to update the shader. /// </summary> public void UpdateVars() { switch (type) { case RenderedObjectType.Terrain: TerrainModel terrain = (TerrainModel)modelObject.model; light = ShaderIDTable.ALLOCATED_LIGHTS; renderDistance = float.MaxValue; break; case RenderedObjectType.Moby: Moby mob = (Moby)modelObject; light = Math.Max(0, Math.Min(ShaderIDTable.ALLOCATED_LIGHTS, mob.light)); ambient = mob.color; renderDistance = mob.drawDistance; break; case RenderedObjectType.Tie: Tie tie = (Tie)modelObject; light = Math.Max(0, Math.Min(ShaderIDTable.ALLOCATED_LIGHTS, tie.light)); renderDistance = float.MaxValue; break; case RenderedObjectType.Shrub: Shrub shrub = (Shrub)modelObject; light = Math.Max(0, Math.Min(ShaderIDTable.ALLOCATED_LIGHTS, shrub.light)); ambient = shrub.color; renderDistance = shrub.drawDistance; break; } }
static void Main(string[] args) { Person xc = new Person("小菜"); Console.WriteLine("\n第一种装扮:"); // 实例化具体服饰 Finery dtx = new TShirts(); Finery kk = new BigTrouser(); Finery pqx = new Sneakers(); dtx.Show(); kk.Show(); pqx.Show(); xc.Show(); Console.WriteLine("\n第二种装扮:"); Finery xz = new Suit(); Finery ld = new Tie(); Finery px = new LeatherShoes(); xz.Show(); ld.Show(); px.Show(); xc.Show(); Console.Read(); }
private async Task CreateTie(EventArgs arg) { if (string.IsNullOrEmpty(Name)) { await ShowDialog("Aviso", "O nome do laço não pode ficar em branco!"); } else if (string.IsNullOrEmpty(Description)) { await ShowDialog("Aviso", "A descrição do laço não pode ficar em branco!"); } else if (Image == null) { await ShowDialog("Aviso", "A imagem do laço não pode ficar em branco!"); } else { using (var context = new TiesContext()) { var tie = new Tie { Name = Name, Description = Description, Image = Image }; await context.Ties.AddAsync(tie); await context.SaveChangesAsync(); } await ShowDialog("Sucesso", "O laço foi cadastrado com sucesso!"); await Navigation.PopAsync(); } }
public override void SetUp() { base.SetUp(); tie = new Tie(A.Date, A.Date.AddDays(7), A.Team.Build(), A.Team.Build()); fixtures = tie.CreateFixtures(A.CupSeason.Build()); }
void InitHelpers() { _baseRefs = new BaseRefs(ModuleDefinition); _helper = new ModuleHelper(ModuleDefinition, _baseRefs); _anchor = new Anchor(ModuleDefinition, _helper, _baseRefs); _attribute = new AnchorAttribute(ModuleDefinition, _helper, _baseRefs); _tie = new Tie(ModuleDefinition, _helper, _baseRefs); }
public static Tie CreateTie(string type) { ObjectFactory factory = new ObjectFactory(); Tie tie = factory.createTie(); tie.setType(StartStop.fromValue(type)); return(tie); }
/// <summary> /// Initializes a new instance of the <see cref="ValueNote"/> class. /// </summary> /// <param name="pitchList"> /// The pitch list. /// </param> /// <param name="duration"> /// The duration. /// </param> /// <param name="triplet"> /// The triplet. /// </param> /// <param name="tie"> /// The tie. /// </param> /// <param name="priority"> /// The priority. /// </param> public ValueNote(List<Pitch> pitchList, Duration duration, bool triplet, Tie tie, int priority = -1) : this((Pitch)null, duration, triplet, tie, priority) { if (pitchList.Count > 0) { Pitch.AddRange(pitchList); Tie = tie; } }
public override void SetUp() { base.SetUp(); tie = new Tie(A.Date, A.Date.AddDays(7), A.Team.Build(), A.Team.Build()); var fixtures = tie.CreateFixtures(A.CupSeason.Build()); tie.AddResult(A.MatchResult.ForFixture(fixtures[0]).WithScore(1, 2).Build()); tie.AddResult(A.MatchResult.ForFixture(fixtures[1]).WithScore(0, 1).Build()); }
public void IsTie_ShouldReturnTrueForTie() { //Arrange ICellCollection cellCollection = new CellCollection(new ICell[] { new SelectedCell(null) }); Tie subject = new Tie(cellCollection); //Act Bool actual = subject.IsTie(); //Assert ((bool)actual).Should().BeTrue(); }
public void IsTie_ShouldReturnFalseForNoneTie() { //Arrange ICellCollection cellCollection = new CellCollection(new ICell[] { new UnselectedCell(new Glyph('.')) }); Tie subject = new Tie(cellCollection); //Act Bool actual = subject.IsTie(); //Assert ((bool)actual).Should().BeFalse(); }
protected List <Tie> GetTies(List <Model> tieModels, int tiePointer, int tieCount) { List <Tie> ties = new List <Tie>(tieCount); //Read the whole texture header block, and add textures based on the count byte[] tieBlock = ReadBlock(fileStream, tiePointer, tieCount * 0x70); for (int i = 0; i < tieCount; i++) { Tie tie = new Tie(tieBlock, i, tieModels, fileStream); ties.Add(tie); } return(ties); }
static void Main(string[] args) { Person xc = new Person("小菜"); Console.WriteLine("\n第一种装扮:"); Sneakers pqx = new Sneakers(); BigTrouser kk = new BigTrouser(); TShirts dtx = new TShirts(); // 一层层嵌套、后进先出 pqx.Decorate(xc); kk.Decorate(pqx); dtx.Decorate(kk); dtx.Show(); // 大T恤 垮裤 破球鞋 装扮的小菜 Console.WriteLine("\n第二种装扮:"); LeatherShoes px = new LeatherShoes(); Tie ld = new Tie(); Suit xz = new Suit(); // 一层层嵌套、后进先出 px.Decorate(xc); ld.Decorate(px); xz.Decorate(ld); xz.Show(); Console.WriteLine("\n第三种装扮:"); Sneakers pqx2 = new Sneakers(); LeatherShoes px2 = new LeatherShoes(); BigTrouser kk2 = new BigTrouser(); Tie ld2 = new Tie(); // 一层层嵌套、后进先出 pqx2.Decorate(xc); px2.Decorate(pqx); kk2.Decorate(px2); ld2.Decorate(kk2); ld2.Show(); // 领带 垮裤 皮鞋 破球鞋 装扮的小菜 Console.Read(); }
public static void Regang(Robot rob, Tie tie) { rob.IsMultibot = true; rob.Memory[MemoryAddresses.multi] = 1; tie.b = 0.1; tie.k = 0.05; tie.Type = TieType.AntiRope; var angl = Physics.Angle(rob.Position.X, rob.Position.Y, tie.OtherBot.Position.X, tie.OtherBot.Position.Y); var dist = (rob.Position - tie.OtherBot.Position).Magnitude(); if (tie.BackTie == false) { tie.Angle = Physics.NormaliseAngle(angl) - Physics.NormaliseAngle(rob.Aim); // only fix the angle of the bot that created the tie tie.FixedAngle = true; } tie.NaturalLength = dist; }
public void Run() { Person person = new Person("骚货在"); TShirts tshirts = new TShirts(); BigTrouser trouser = new BigTrouser(); LeatherShoes shoes = new LeatherShoes(); Suit suit = new Suit(); Sneakers sneaker = new Sneakers(); Tie tie = new Tie(); tshirts.Decorate(person); trouser.Decorate(tshirts); shoes.Decorate(trouser); suit.Decorate(shoes); sneaker.Decorate(suit); tie.Decorate(sneaker); tie.Show(); }
static void Main(string[] args) { Person xc = new Person("小菜"); Console.WriteLine(Environment.NewLine + "第一种装扮:"); Sneakers pqx = new Sneakers(); BigTrouser kk = new BigTrouser(); TShirts dtx = new TShirts(); pqx.Decorate(xc); kk.Decorate(pqx); dtx.Decorate(kk); dtx.Show(); Console.WriteLine(Environment.NewLine + "第二种装扮:"); LeatherShoes px = new LeatherShoes(); Tie ld = new Tie(); Suit xz = new Suit(); px.Decorate(xc); ld.Decorate(px); xz.Decorate(ld); xz.Show(); Console.WriteLine(Environment.NewLine + "第三种装扮:"); Sneakers pqx2 = new Sneakers(); LeatherShoes px2 = new LeatherShoes(); BigTrouser kk2 = new BigTrouser(); Tie ld2 = new Tie(); pqx2.Decorate(xc); px2.Decorate(pqx2); kk2.Decorate(px2); ld2.Decorate(kk2); ld2.Show(); Console.ReadKey(true); }
public static void Main() { // Verifica se todos os Directories existem, se não existirem então criá-los Directories.Create(); // Carrega todos os Data Read.Data(); // Inicializa todos os Devices Graphics.LerTextures(); Audio.Som.Read(); Network.Start(); // Abre a Window Window.Objects.Text = Lists.Options.Jogo_Name; Window.Objects.Visible = true; Jogo.OpenMenu(); // Inicia a aplicação Tie.Principal(); }
/// <summary> /// Initializes a new instance of the <see cref="ValueNote"/> class. /// </summary> /// <param name="pitch"> /// The pitch. /// </param> /// <param name="duration"> /// The duration. /// </param> /// <param name="triplet"> /// The triplet. /// </param> /// <param name="tie"> /// The tie. /// </param> /// <param name="priority"> /// The priority. /// </param> public ValueNote(Pitch pitch, Duration duration, bool triplet, Tie tie, int priority = -1) { Pitch = new List<Pitch>(0); // если не пауза то записываем высоту и наличие лиги if (pitch != null) { Pitch.Add((Pitch)pitch.Clone()); Tie = tie; } else { // если нота - пауза, то не может быть лиги на паузу Tie = Tie.None; } Duration = (Duration)duration.Clone(); Triplet = triplet; // приоритет если указан Priority = priority; }
private Measure MidiToMeasure(MidiFile midiMeasure, int measureOrder, int ticksPerEvent, int sizeOfMeasure) { var notesAndRests = midiMeasure.GetTrackChunks().Last().GetNotes().GetNotesAndRests(RestSeparationPolicy.NoSeparation).ToList(); var measureTotalTicks = ticksPerEvent * sizeOfMeasure; var ticks = 0; var events = new List <Event>(); ILengthedObject previous = null; while (ticks < measureTotalTicks) { Event measureEvent = null; var notesEndRestsOfTime = notesAndRests.PlayingAtTime(ticks); if (notesEndRestsOfTime.Any()) { var lengthed = notesEndRestsOfTime.First(); if (lengthed is Melanchall.DryWetMidi.Smf.Interaction.Rest || !lengthed.Equal(previous)) { measureEvent = LengthedToEvent(lengthed, events.Count); previous = lengthed; } else { measureEvent = new Tie((int)RestOrTie.Tie, events.Count); } } else { measureEvent = new Genetic.Rest((int)RestOrTie.Rest, events.Count); } events.Add(measureEvent); ticks += ticksPerEvent; } return(new Measure(events, measureOrder)); }
public TiePreviewView(Tie tie) { InitializeComponent(); Tie = tie; }
static void Main(string[] args) { Console.WriteLine("Hello World!"); PersonOne personOne = new PersonOne() { Name = "小黑" }; personOne.Show(); Console.WriteLine(); SuitPersonOne suitPersonOne = new SuitPersonOne() { Name = "小黑" }; suitPersonOne.Show(); Console.WriteLine(); TShirtPersonOne shirtPersonOne = new TShirtPersonOne() { Name = "小黑" }; shirtPersonOne.Show(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("=============================="); // 首先要有打扮的人 AbstractPerson xiaoXin = new Person() { Name = "小新" }; // 然后准备要穿的衣服 Finery personWithSuit = new Suit(); // 西装 Finery personWithTie = new Tie(); // 领带 Finery personWithTrousers = new Trousers(); // 长裤 Finery personWithLeather = new Leather(); // 皮鞋 // 最后按顺序把衣服穿上 // 先穿裤子 personWithTrousers.SetPerson(xiaoXin); // 再让穿裤子的小新穿西装 personWithSuit.SetPerson(personWithTrousers); // 最后把鞋子领带都穿上 personWithTie.SetPerson(personWithSuit); personWithLeather.SetPerson(personWithTie); // 照下镜子 personWithLeather.Show(); Console.WriteLine(); Console.WriteLine("=============================="); AbstractPerson xiaoHei = new Person() { Name = "小黑" }; Finery personWithTShirt = new TShirt(); // 大t恤 Finery personWithSneaker = new Sneaker(); // 网鞋 personWithTShirt.SetPerson(xiaoHei); personWithSneaker.SetPerson(personWithTShirt); personWithSneaker.Show(); Console.ReadKey(); }
private string ProcessTieElement(Tie aElement) { throw new NotImplementedException(); }
if winner is null Writeline(Tie) WriteLine
/// <summary>Validates FlightGroup.Goals for TIE</summary> /// <remarks>Converts 75% to 100%, 25% to 50%</remarks> /// <param name="label">Identifier used in error message</param> /// <param name="goals">The Goal object to check</param> /// <exception cref="ArgumentException">Invalid Goal.Amount detected</exception> static void tieGoalsCheck(string label, Tie.FlightGroup.FGGoals goals) { for(int i=0; i<8; i += 2) { if (i == 4) continue; // Secret goal, not converted if (goals[i] > 24) throw triggerException(0, label + " Goal " + i, Xwa.Strings.Trigger[goals[i]]); if (goals[i+1] > 6) throw triggerException(0, label + " Goal " + i, Xwa.Strings.Amount[goals[i+1]]); else if (goals[i+1] == 1) goals[i+1] = 0; // 75 to 100 else if (goals[i+1] > 1) goals[i+1] -= 2; // 25 to 50, slide everything after } }
//Read the note public static NoteProperties ReadNote(int notenumber, ScorePartwise.Part.Measure measure) { if (getnoteindex(notenumber, measure) != -1) { Note note = (Note)measure.getNoteOrBackupOrForward().get(getnoteindex(notenumber, measure)); NoteProperties noteprop = new NoteProperties(); noteprop.chord = note.getChord() == new Empty() ? true : false; if (note.getRest() != null) { //MessageBox.Show("Rest Read!"); noteprop.rest = true; try { noteprop.NoteType = note.getType().getValue(); } catch (System.Exception) { noteprop.NoteType = ""; } } else if (note.getPitch() is Pitch) { noteprop.NoteType = note.getType().getValue(); // get the notetype only if it is not a rest noteprop.PitchStep = note.getPitch().getStep().value(); noteprop.Pitchoctave = note.getPitch().getOctave(); if (note.getPitch().getAlter() != null) { noteprop.PitchAlter = note.getPitch().getAlter().floatValue(); } } noteprop.duration = note.getDuration().intValue(); if (note.getTie().size() != 0) { Tie tie = (Tie)note.getTie().get(0); noteprop.TieType = tie.getType().toString(); } noteprop.dot = note.getDot().size() == 0? false:true; noteprop.AccidentalType = note.getAccidental() == null? "":note.getAccidental().getValue().value(); if (note.getTimeModification() != null) { noteprop.TimeModactualnotes = note.getTimeModification().getActualNotes().intValue().ToString(); noteprop.TimeModnormalnotes = note.getTimeModification().getNormalNotes().intValue().ToString(); noteprop.TimeModnormaltype = note.getTimeModification().getNormalType() == null ? "" : note.getTimeModification().getNormalType(); } ///////////////////////////////////COMPLETE ME Beam beam; for (int i = 0; i < note.getBeam().size(); i++) { beam = (Beam)note.getBeam().get(i); noteprop.beamvalue.Add(beam.getValue().value()); noteprop.beamnumber.Add(beam.getNumber()); } if (note.getNotations().size() != 0) { Notations notations = (Notations)note.getNotations().get(0); for (int i = 0; i < notations.getTiedOrSlurOrTuplet().size(); i++) { if (notations.getTiedOrSlurOrTuplet().get(i) is Tied) { Tied tied = (Tied)notations.getTiedOrSlurOrTuplet().get(i); //if(tied.getNumber().intValue()==1) noteprop.TiedType = tied.getType().value(); } if (notations.getTiedOrSlurOrTuplet().get(i) is Slur) { Slur slur = (Slur)notations.getTiedOrSlurOrTuplet().get(i); if (slur.getNumber() == 1) { noteprop.SlurType = slur.getType().value(); } } if (notations.getTiedOrSlurOrTuplet().get(i) is Tuplet) { Tuplet tuplet = (Tuplet)notations.getTiedOrSlurOrTuplet().get(i); noteprop.TupletType = tuplet.getType().value(); //noteprop.TupletNumber = tuplet.getNumber().intValue(); } if (notations.getTiedOrSlurOrTuplet().get(i) is Dynamics) { Dynamics dynamics = (Dynamics)notations.getTiedOrSlurOrTuplet().get(i); javax.xml.bind.JAXBElement x = (javax.xml.bind.JAXBElement)dynamics.getPOrPpOrPpp().get(0); noteprop.dynamic = x.getName().ToString(); } } } if (note.getLyric().size() != 0) { Lyric lyric = (Lyric)note.getLyric().get(0); for (int i = 0; i < lyric.getElisionAndSyllabicAndText().size(); i++) { if (lyric.getElisionAndSyllabicAndText().get(i) is Syllabic) { Syllabic syllabic = (Syllabic)lyric.getElisionAndSyllabicAndText().get(i); noteprop.LyricSyllabic = syllabic.value(); } if (lyric.getElisionAndSyllabicAndText().get(i) is TextElementData) { TextElementData text = (TextElementData)lyric.getElisionAndSyllabicAndText().get(i); noteprop.LyricText = text.getValue(); } } noteprop.LyricEndline = lyric.getEndLine() == null?false:true; } return(noteprop); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="ValueNote"/> class. /// </summary> /// <param name="midiNumbers"> /// The midi numbers. /// </param> /// <param name="duration"> /// The duration. /// </param> /// <param name="triplet"> /// The triplet. /// </param> /// <param name="tie"> /// The tie. /// </param> /// <param name="priority"> /// The priority. /// </param> public ValueNote(List<int> midiNumbers, Duration duration, bool triplet, Tie tie, int priority = -1) { Pitch = new List<Pitch>(); foreach (var midinumber in midiNumbers) { Pitch.Add(new Pitch(midinumber)); } Tie = tie; Duration = (Duration)duration.Clone(); Triplet = triplet; Priority = priority; }