Exemple #1
0
 public Hold(LanePotision lane, TimingPosition timingBegin, TimingPosition timingEnd, NoteSize size)
 {
     System.Diagnostics.Debug.Assert(timingBegin < timingEnd);
     HoldBegin = new HoldBegin(lane, timingBegin, size);
     HoldBegin.PositionChanging += (begin, beginLane, beginTiming) =>
     {
         if (stepNotes.Where(x => x.Timing <= beginTiming).Any())
         {
             return(false);
         }
         if (!(beginTiming < HoldEnd.Timing))
         {
             return(false);
         }
         return(true);
     };
     HoldEnd = new HoldEnd(lane, timingEnd, size);
     HoldEnd.PositionChanging += (end, endLane, endTiming) =>
     {
         if (stepNotes.Where(x => x.Timing >= endTiming).Any())
         {
             return(false);
         }
         if (!(HoldBegin.Timing < endTiming))
         {
             return(false);
         }
         return(true);
     };
     stepNotes = new List <HoldStepNote>();
 }
Exemple #2
0
 public JsonObject Exchange()
 {
     return(new JsonObject()
     {
         ["HoldBegin"] = HoldBegin.Exchange(),
         ["HoldEnd"] = HoldEnd.Exchange(),
         ["StepNotes"] = stepNotes.Select(s => s.Exchange()).ToList()
     });
 }
Exemple #3
0
 public void Exchange(JsonObject json)
 {
     HoldBegin.Exchange(json["HoldBegin"]);
     HoldEnd.Exchange(json["HoldEnd"]);
     foreach (var step in json["StepNotes"])
     {
         var tmp = new HoldRelay(new LanePotision(0), new TimingPosition(1, 0), new NoteSize(1));
         tmp.Exchange(step);
         Put(tmp);
     }
 }