public void CheckToAddNote() { if (NotePath.NotePaths[notePathID].ActiveNotes.Count > 0 && activeNote == null) { if (NotePath.NotePaths[notePathID].ActiveNotes[0].type == NoteType.Drag) { AutoPlayer.instance.sBot.activeNoteDrag = NotePath.NotePaths[notePathID].ActiveNotes[0] as NoteDrag; return; } activeNote = NotePath.NotePaths[notePathID].ActiveNotes[0]; if (activeNote.type == NoteType.Regular) { noteAction = TapNote; } else if (activeNote.type == NoteType.Hold) { noteAction = HoldNote; } else if (activeNote.type == NoteType.Flick) { noteAction = FlickNote; } } }
public static SelectedNoteArea SelectedNoteArea(this NoteBase note, Point p, IReadOnlyEditorLaneEnvironment env) { var cr = note.NoteSize.Size - 2; var areaRatio = (lr : 1, cr : cr <= 0 ? 0 : cr, rr : 1); var rect = note.GetRectangle(env); // 実装微妙かも Func <SelectedNoteArea> fun = () => { var areaSum = areaRatio.lr + areaRatio.cr + areaRatio.rr; if (p.X < rect.X + rect.Width * areaRatio.lr / areaSum) { return(UI.SelectedNoteArea.Left); } if (p.X < rect.X + rect.Width * (areaRatio.lr + areaRatio.cr) / areaSum) { return(UI.SelectedNoteArea.Center); } return(UI.SelectedNoteArea.Right); }; if (rect.Contains(p)) { return(fun()); } rect.X -= (int)(env.LaneUnitWidth * MadcaEnv.LaneCount); if (rect.Contains(p)) { return(fun()); } return(UI.SelectedNoteArea.None); }
public IEnumerator FlickNote() { int endPath = activeNote.endPath; NotePath.NotePaths[notePathID].Transitioned(endPath); activeNote = null; yield return(false); }
private static NoteBase GetNoteFromPool(NoteType type) { NoteBase rtn = null; switch (type) { case (NoteType.Regular): foreach (Note n in NoteManager.instance.NoteList) { if (!n.gameObject.activeInHierarchy) { rtn = n as NoteBase; break; } } break; case (NoteType.Hold): foreach (NoteHold n in NoteManager.instance.HoldList) { if (!n.gameObject.activeInHierarchy) { rtn = n as NoteBase; break; } } break; case (NoteType.Flick): foreach (NoteFlick n in NoteManager.instance.FlickList) { if (!n.gameObject.activeInHierarchy) { rtn = n as NoteBase; break; } } break; case (NoteType.Drag): foreach (NoteDrag n in NoteManager.instance.DragList) { if (!n.gameObject.activeInHierarchy) { rtn = n as NoteBase; break; } } break; } if (rtn == null) { Debug.Log("Something went wrong"); } return(rtn); }
// Tap the note, return is so 'hold' can be used. public IEnumerator TapNote() { NotePath.NotePaths[notePathID].Tapped(); activeNote = null; yield return(new WaitForSeconds(0.08f)); NotePath.NotePaths[notePathID].Lifted(); }
public ReLocateNoteOperation(NoteBase note, Position before, Position after) { Invoke = () => { note.ReLocate(after.Lane, after.Timing); }; Undo = () => { note.ReLocate(before.Lane, before.Timing); }; }
public ReSizeNoteOperation(NoteBase note, NoteSize before, NoteSize after) { Invoke = () => { note.ReSize(after); }; Undo = () => { note.ReSize(before); }; }
public IEnumerator HoldNote() { activated = true; // activeNote.IsTapped = true; NotePath.NotePaths[notePathID].Tapped(); while (activeNote.isReadyToHit && activeNote != null) { NotePath.NotePaths[notePathID].Held(); yield return(true); } activeNote = null; activated = false; NotePath.NotePaths[notePathID].Lifted(); yield return(false); }
public void ShouldConvertFormJsonToCorrectEntityFromNoteBase() { var form = new Form { Id = Guid.NewGuid(), Subject = "This is my form", Code = "1.01", Status = FormStatus.InProgress }; NoteBase noteBase = form; string json = JsonConvert.SerializeObject(noteBase); Assert.AreEqual(json, "{\"EntityDiscriminator\":\"Form\",\"Status\":1,\"IsConform\":false,\"Type\":0,\"TemplateId\":\"00000000-0000-0000-0000-000000000000\",\"MustDisplayElementsCode\":false,\"IsSignatureAllowed\":false,\"NbNonConformities\":0," + "\"NbPointsOnForm\":0,\"Date\":\"0001-01-01T00:00:00\",\"ModificationDate\":\"0001-01-01T00:00:00\",\"Subject\":\"" + noteBase.Subject + "\",\"IsArchived\":false,\"IsUrgent\":false,\"MeetingNumSeq\":0,\"ProjectNumSeq\":0,\"Code\":\"1.01\"," + "\"IsReadOnly\":false,\"HasAttachment\":false,\"Id\":\"" + noteBase.Id + "\",\"EntityVersion\":0,\"Deleted\":false,\"EntityCreationDate\":\"0001-01-01T00:00:00\",\"EntityModificationDate\":\"0001-01-01T00:00:00\"," + "\"EntityCreationUser\":\"00000000-0000-0000-0000-000000000000\"}"); }
public void NotePut(Guid rowGuid, [FromBody] NoteBase value) { if (value == null) { throw new ArgumentNullException($"Argument value cannot be null"); } CU_B_NOTE Item = DBContext.CU_B_NOTE.SingleOrDefault(E => E.COMPANY_CODE == Settings.Value.CompanyCode && E.DIVISION_CODE == Settings.Value.DivisionCode && E.ROWGUID == rowGuid); if (Item == null) { throw new NotFoundException($"No note found with RowGuid:{rowGuid}"); } EntityMapper.UpdateEntity(value, Item); value.SaveData <CU_B_NOTE>(DBContext, Item); DBContext.SaveChanges(); }
public void ShouldConvertNoteJsonToCorrectEntityFromNoteBase() { var note = new Note { Id = Guid.NewGuid(), Subject = "This is my note", Code = "1.01", Status = new NoteProjectStatus { Code = "INPROGRESS", Color = "452147", Name = "In progress", IsTodo = true } }; NoteBase noteBase = note; string json = JsonConvert.SerializeObject(noteBase); Assert.AreEqual(json, "{\"EntityDiscriminator\":\"Note\",\"Status\":{\"IsDisabled\":false,\"Code\":\"INPROGRESS\",\"Name\":\"In progress\",\"DisplayOrder\":0,\"IsOnlyUsedByMeetingManager\":false,\"Color\":\"452147\",\"IsTodo\":true,\"IsDone\":false," + "\"DoneAction\":false,\"IsBlocked\":false,\"Id\":\"" + note.Status.Id + "\",\"EntityVersion\":0,\"Deleted\":false,\"EntityCreationDate\":\"0001-01-01T00:00:00\",\"EntityModificationDate\":\"0001-01-01T00:00:00\",\"EntityCreationUser\":\"00000000-0000-0000-0000-000000000000\"}" + ",\"ProblemLocation\":0,\"Date\":\"0001-01-01T00:00:00\",\"ModificationDate\":\"0001-01-01T00:00:00\",\"Subject\":\"" + noteBase.Subject + "\",\"IsArchived\":false,\"IsUrgent\":false,\"MeetingNumSeq\":0,\"ProjectNumSeq\":0,\"Code\":\"1.01\",\"IsReadOnly\":false,\"HasAttachment\":false," + "\"Id\":\"" + noteBase.Id + "\",\"EntityVersion\":0,\"Deleted\":false,\"EntityCreationDate\":\"0001-01-01T00:00:00\",\"EntityModificationDate\":\"0001-01-01T00:00:00\",\"EntityCreationUser\":\"00000000-0000-0000-0000-000000000000\"}"); }
public ActionResult <NoteListItem> NotePost([FromBody] NoteBase value) { if (value == null) { throw new ArgumentNullException($"Argument value cannot be null"); } CU_B_NOTE Item = EntityMapper.CreateEntity <CU_B_NOTE>(); EntityMapper.UpdateEntity(value, Item); Item.NOTE_DATE = DateTime.Today; CU_B_NOTE LastNote = DBContext.CU_B_NOTE.Where(E => E.CUSTOMER_CODE == Item.CUSTOMER_CODE && E.NOTE_DATE == Item.NOTE_DATE).OrderByDescending(E => E.NOTE_COUNTER).FirstOrDefault(); Item.NOTE_COUNTER = LastNote != null ? LastNote.NOTE_COUNTER + 1 : 1; value.SaveData <CU_B_NOTE>(DBContext, Item); DBContext.CU_B_NOTE.Add(Item); DBContext.SaveChanges(); return(NoteGet(Item.ROWGUID)); }
private void FingerTap() { Ray ray = Camera.main.ScreenPointToRay(this.initialPosition); Debug.Log("Init Position: " + initialPosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f, player.layermask)) { // If we hit a Notepath... if (hit.collider.tag == "NotePath") { NotePath hitPath = hit.collider.gameObject.GetComponent <NotePath>(); notePathID = hitPath.NotePathID; previousNotePathID = notePathID; NoteType noteType = hitPath.CheckIfValidHit(); if (noteType != NoteType.NULL) { ActiveNote = hitPath.ActiveNotes[0]; } hitPath.Tapped(); player.hitNotePathWithFinger = true; } // Edit this code to match what we want for new drag notes. else if (hit.collider.tag == "Hitbar") { // To be replaced with setting finger position to the hitbar. // slider = player.Slider.GetComponent<Slider>(); // slider.SetSliderRelativeToFinger(FingerID, hit.point); fingerState = FingerState.SLIDE; } } }
public static void FixNoteTickInfo([NotNull] NoteBase note, [NotNull] SourceScore sourceScore) { var baseConductor = sourceScore.Conductors[0]; // For a properly-designed beatmap, the extra measure count SHOULD be an integer. // Otherwise you need to move your music start to make it on a beat. var extraMeasures = (int)Math.Round(sourceScore.MusicOffset / (60 / baseConductor.Tempo) / baseConductor.SignatureDenominator); var tickDiff = NoteBase.TicksPerBeat * 60 * extraMeasures * baseConductor.SignatureDenominator; note.Measure += extraMeasures; note.Ticks += tickDiff; if (note is SourceNote n) { if (n.FollowingNotes != null && n.FollowingNotes.Length > 0) { foreach (var fn in n.FollowingNotes) { fn.Ticks += tickDiff; } } } }
public void RemoveActiveNote(NoteBase n) { // Debug.Log("Android Debug: Removing " + n.name + " from the ActiveNotes list"); ActiveNotes.Remove(n); }
public void AddActiveNote(NoteBase n) { // Debug.Log("Android Debug: Adding " + n.name + " to the ActiveNotes list"); ActiveNotes.Add(n); }
public void ResetFinger() { ActiveNote = null; fingerState = FingerState.HOLD; }
public static void DrawToLane(System.Drawing.Graphics g, IReadOnlyEditorLaneEnvironment env, NoteBase note) { // NOTE: お試し実装 using (var sb = new SolidBrush(NoteGraphicsGenerator.GetColor(note.NoteType))) using (var pen = new Pen(Color.White)) { g.Clip = new Region(env.LaneRect); var rect = note.GetRectangle(env); if (note.NoteType == NoteType.HoldRelay) { g.DrawRectangle(pen, rect); } else { g.FillRectangle(sb, rect); } DrawToLanePreviewNoteFrame(g, rect, note as PreviewNote); // 水平位置を1周分ずらしてもう一回描画 rect.X -= (int)(MadcaEnv.LaneCount * env.LaneUnitWidth); if (note.NoteType == NoteType.HoldRelay) { g.DrawRectangle(pen, rect); } else { g.FillRectangle(sb, rect); } DrawToLanePreviewNoteFrame(g, rect, note as PreviewNote); g.ResetClip(); } }
private static void DrawHoldStep(System.Drawing.Graphics g, IReadOnlyPreviewDisplayEnvironment env, NoteBase begin, NoteBase end) { using (var clipPath = new GraphicsPath()) { clipPath.AddEllipse(env.Circle); g.Clip = new Region(clipPath); } var step = 5; // 円の中央が0 var rbegin = (1 - ((begin.Timing - env.TimingOffset) / env.TimingLength).BarRatio) * env.Radius; var rend = (1 - ((end.Timing - env.TimingOffset) / env.TimingLength).BarRatio) * env.Radius; var dr = rbegin - rend; var dlleft = end.Lane.RawLane - begin.Lane.RawLane; var dlright = (end.Lane.RawLane + end.NoteSize.Size) - (begin.Lane.RawLane + begin.NoteSize.Size); var psLeft = new List <Point>(); var psRight = new List <Point>(); var curR = rbegin - step; while (true) { if (curR <= 0 || curR <= rend) { break; } if (dlleft != 0 || curR <= step) { var radLeft = MyMath.DegToRad(CalcCsDeg((float)(begin.Lane.RawLane * 6 + (rbegin - curR) / dr * dlleft * 6))); psLeft.Add(new Point((int)(env.CenterPoint.X + curR * Math.Cos(radLeft)), (int)(env.CenterPoint.Y + curR * Math.Sin(radLeft)))); } if (dlright != 0 || curR <= step) { var radRight = MyMath.DegToRad(CalcCsDeg((float)((begin.Lane.RawLane + begin.NoteSize.Size) * 6 + (rbegin - curR) / dr * dlright * 6))); psRight.Add(new Point((int)(env.CenterPoint.X + curR * Math.Cos(radRight)), (int)(env.CenterPoint.Y + curR * Math.Sin(radRight)))); } curR -= step; } var path = new GraphicsPath(); if (psLeft.Any()) { path.AddLines(psLeft.ToArray()); } if (rend > 0) { path.AddArc( (float)(env.CenterPoint.X - rend), (float)(env.CenterPoint.Y - rend), (float)(2 * rend), (float)(2 * rend), CalcCsDeg(end.Lane.NormalizedLane * 6), CalcCsDegSize(end.NoteSize.Size * 6)); } if (psRight.Any()) { path.AddLines(psRight.Reverse <Point>().ToArray()); } if (rbegin > 0) { path.AddArc( (float)(env.CenterPoint.X - rbegin), (float)(env.CenterPoint.Y - rbegin), (float)(2 * rbegin), (float)(2 * rbegin), CalcCsDeg((begin.Lane.NormalizedLane + begin.NoteSize.Size) * 6), CalcCsDegSize(-begin.NoteSize.Size * 6)); } // 色は決め打ちではなく,名前つけて一か所にまとめた方がいいかもね using (var sb = new SolidBrush(Color.FromArgb(200, 200, 175, 90))) { try { g.FillPath(sb, path); } catch (Exception) { } } path.Dispose(); g.ResetClip(); }
public void RemoveActiveNote(NoteBase n) { ActiveNotes.Remove(n); }
public static void DrawToPreview(System.Drawing.Graphics g, IReadOnlyPreviewDisplayEnvironment env, NoteBase note) { var diff = note.Timing - env.TimingOffset; float r = 1 - (float)(diff / env.TimingLength).BarRatio; if (r <= 0 || r > 1) { return; } var lane1 = note.Lane.NormalizedLane; float startDeg = CalcCsDeg(6 * lane1); float degSize = CalcCsDegSize(6 * note.NoteSize.Size); using (var p = new Pen(NoteGraphicsGenerator.GetColor(note.NoteType), 5)) { r *= env.Radius; g.DrawArc(p, env.CenterPoint.X - r, env.CenterPoint.Y - r, 2 * r, 2 * r, startDeg, degSize); } }
public void AddActiveNote(NoteBase n) { ActiveNotes.Add(n); }
protected VisualNoteBase([NotNull] VisualBeatmap beatmap, [NotNull] NoteBase baseNote) { Beatmap = beatmap; BaseNote = baseNote; Type = baseNote.Type; }
private static bool GetSelectedNote(Point p, MadcaDisplay display, NoteBook noteBook, out NoteBase note) { var env = display.EditorLaneEnvironment; note = noteBook.Notes.FindLast(x => x.GetRectangle(env).ContainsEx(p, env)); if (note == null) { foreach (var hold in noteBook.Holds.Reverse()) { note = hold.AllNotes.Find(x => x.GetRectangle(env).ContainsEx(p, env)); if (note != null) { break; } } if (note == null) { return(false); } } return(true); }
private static void SetEventToReLocateNote( MadcaDisplay display, NoteBook noteBook, IReadOnlyList <IReadOnlyScore> scores, OperationManager opManager, IReadOnlyEditorStatus status) { var box = display.PictureBox; var env = display.EditorLaneEnvironment; var holder = display.KeyTokenHolder; var key = new KeyToken(); NoteBase note = null; Position prev = null; Position mouseBegin = null; box.MouseDown += (s, e) => { if (holder.Locked || status.EditorMode != EditorMode.Edit) { return; } var area = env.GetEditorLaneRegion(e.Location); if (area == EditorLaneRegion.Lane && e.Button == MouseButtons.Left) { if (!GetSelectedNote(e.Location, display, noteBook, out note)) { return; } if (note.SelectedNoteArea(e.Location, env) != SelectedNoteArea.Center) { return; } prev = new Position(note.Lane, note.Timing); var res = PositionConverter.ConvertRealToVirtual(env, e.Location, status.BeatStride, scores, out mouseBegin); if (!res) { return; } holder.Lock(key); } }; box.MouseMove += (s, e) => { if (!holder.CanUnLock(key)) { return; } var res = PositionConverter.ConvertRealToVirtual(env, e.Location, status.BeatStride, scores, out Position position); if (!res) { return; } var lane = position.Lane.RawLane - mouseBegin.Lane.RawLane; var timing = position.Timing - mouseBegin.Timing; note.ReLocate(new LanePotision(prev.Lane.RawLane + lane), prev.Timing + timing); }; box.MouseUp += (s, e) => { if (!holder.UnLock(key)) { return; } // TODO: 条件式要検討 if (prev.Lane.RawLane != note.Lane.RawLane || prev.Timing != note.Timing) { opManager.AddOperation(new ReLocateNoteOperation(note, prev, new Position(note.Lane, note.Timing))); } note = null; }; }
private static void SetEventToReSizeNote( MadcaDisplay display, NoteBook noteBook, IReadOnlyList <IReadOnlyScore> scores, OperationManager opManager, IReadOnlyEditorStatus status) { var box = display.PictureBox; var env = display.EditorLaneEnvironment; var holder = display.KeyTokenHolder; var key = new KeyToken(); NoteBase note = null; Position prevPos = null; NoteSize prevSize = null; Position mouseBegin = null; SelectedNoteArea noteArea = SelectedNoteArea.None; box.MouseDown += (s, e) => { if (holder.Locked || status.EditorMode != EditorMode.Edit) { return; } var area = env.GetEditorLaneRegion(e.Location); if (area == EditorLaneRegion.Lane && e.Button == MouseButtons.Left) { if (!GetSelectedNote(e.Location, display, noteBook, out note)) { return; } noteArea = note.SelectedNoteArea(e.Location, env); if (!(noteArea == SelectedNoteArea.Left || noteArea == SelectedNoteArea.Right)) { return; } prevPos = new Position(note.Lane, note.Timing); prevSize = new NoteSize(note.NoteSize); var res = PositionConverter.ConvertRealToVirtual(env, e.Location, status.BeatStride, scores, out mouseBegin); if (!res) { return; } holder.Lock(key); } }; box.MouseMove += (s, e) => { if (!holder.CanUnLock(key)) { return; } var res = PositionConverter.ConvertRealToVirtual(env, e.Location, status.BeatStride, scores, out Position position); if (!res) { return; } var lane = position.Lane.RawLane - mouseBegin.Lane.RawLane; switch (noteArea) { case SelectedNoteArea.Left: { var diff = prevSize.Size - lane; if (1 <= diff && diff <= MadcaEnv.LaneCount) { note.ReLocate(new LanePotision(prevPos.Lane.RawLane + lane), note.Timing); } note.ReSize(new NoteSize(prevSize.Size - lane)); return; } case SelectedNoteArea.Right: { note.ReSize(new NoteSize(prevSize.Size + lane)); return; } default: return; } }; box.MouseUp += (s, e) => { if (!holder.UnLock(key)) { return; } var ops = new List <Operation>(); // TODO: 条件式要検討 if (prevPos.Lane.RawLane != note.Lane.RawLane || prevPos.Timing != note.Timing) { ops.Add(new ReLocateNoteOperation(note, prevPos, new Position(note.Lane, note.Timing))); } if (prevSize != note.NoteSize) { ops.Add(new ReSizeNoteOperation(note, prevSize, note.NoteSize)); } if (ops.Any()) { opManager.AddOperation(new CompositeOperation(ops.ToArray())); } note = null; }; }