//TODO: 下記コピペになってる /// <summary> /// 音符の絶対座標を取得する /// </summary> /// <param name="note"></param> /// <returns></returns> private float GetAbsoluteX(GameNote note) { //Boardは左に動いているので、現在のBoardの座標X+音符の相対座標X var boardX = (Const.JudgeLineX - _timeManager.Distance); return(boardX + note.X); }
public HoldNoteView(GameNote note, NoteViewRef VRef) : base(note, VRef) { lineHeight = Mathf.CeilToInt(Note.Info.Duration) * LINE_HEIGHT_FACTOR + LINE_BASIC_HEIGHT - LINE_OFFSET; lineHeight = Mathf.Clamp(lineHeight, 1, MAX_LINE_HEIGH); //set position Vector3 linePos = VRef.lineRenderer.transform.localPosition; Vector3 lineRot = VRef.lineRenderer.transform.rotation.eulerAngles; //if note on the top part of screen if (note.Info.pos.y > NoR2252Application.CurrentSheet.screenSize.y / 2f) { linePos.y = -Mathf.Abs(linePos.y); lineRot.z = 180f; } //if note on the bottom part of screen else { linePos.y = Mathf.Abs(linePos.y); lineRot.z = 0f; } //set the position VRef.bgLineRenderer.transform.localPosition = linePos; VRef.bgLineRenderer.transform.rotation = Quaternion.Euler(lineRot); VRef.lineRenderer.transform.localPosition = linePos; VRef.lineRenderer.transform.rotation = Quaternion.Euler(lineRot); }
private void SetNoteImage(GameObject noteObj, GameNote note) { //setimage var imageComponent = noteObj.GetComponent <UnityEngine.UI.Image>(); switch (note.NoteType) { case ScoreNoteType.quarter: if (note.HasDot) { imageComponent.sprite = note.IsRest ? _spriteManager.Quarter_Rest_Dot : _spriteManager.Quarter_Dot; break; } imageComponent.sprite = note.IsRest ? _spriteManager.Quarter_Rest : _spriteManager.Quarter; break; case ScoreNoteType.eighth: if (note.HasDot) { imageComponent.sprite = note.IsRest ? _spriteManager.Eighth_Rest_Dot : _spriteManager.Eighth_Dot; break; } imageComponent.sprite = note.IsRest ? _spriteManager.Eighth_Rest : _spriteManager.Eighth; break; case ScoreNoteType.sixteenth: if (note.HasDot) { imageComponent.sprite = note.IsRest ? _spriteManager.Sixteen_Rest_Dot : _spriteManager.Sixteen_Dot; break; } imageComponent.sprite = note.IsRest ? _spriteManager.Sixteen_Rest : _spriteManager.Sixteen; break; } }
public NoteView(GameNote note) { Note = note; Collider = note.gameObject.GetComponent <CircleCollider2D>(); Collider.enabled = true; Collider.radius *= GameOptions.Instance.HitboxMultiplier / SimpleVisualOptions.Instance.SizeMultiplier; }
public NoteView(GameNote note, NoteViewRef VRef) { this.Note = note; initScale = new Vector3(NoR2252Application.Size, NoR2252Application.Size, 1f); this.VRef = VRef; this.VRef.animator.runtimeAnimatorController = this.VRef.animController; }
private GameObject Find(GameNote note) { //TODO: 重そう var obj = transform.Find(note.Tick.ToString()); return(obj?.gameObject); }
private float _visibleLeftX = -Const.BoardWidthHalf - 100; //TODO:猶予 public JudgeResult Judge(GameNote note) { //判定エリアの中心からズレを取得する var diff = (GetAbsoluteX(note) - _judgeLineX); var diffAbs = Math.Abs(diff); Console.WriteLine($"diff:{diff}"); var type = JudgeResultType.Ignore; if (diffAbs < 50) { type = JudgeResultType.Success; } else if (diffAbs < 100) { type = JudgeResultType.Good; } else if (diffAbs < 150) { type = JudgeResultType.Miss; } return(new JudgeResult(type, diff)); }
public void Enqueue(GameNote note) { //TODO:note.Tickが重複するのはありえない var tail = _tail; _notes[tail] = note; _tail += 1; }
public SimpleNoteView(GameNote note) : base(note) { Game = note.Game; Ring = Note.transform.Find("NoteRing").GetComponent <SpriteRenderer>(); Fill = Note.transform.Find("NoteFill").GetComponent <SpriteRenderer>(); Ring.enabled = false; Fill.enabled = false; }
private void Update() { if (Mod.HideNotes.IsEnabled()) { Destroy(gameObject); return; } if (game is StoryboardGame) { spriteRenderer.enabled = OutroRatio < 1; } else { if (OutroRatio >= 1) { Destroy(gameObject); } } if (gameNote == null && game.GameNotes.ContainsKey(FromNote.id)) { gameNote = game.GameNotes[FromNote.id]; } if (gameNote != null) { var fill = ((SimpleNoteView)gameNote.View).Fill; spriteRenderer.color = spriteRenderer.color.WithAlpha(fill.enabled ? fill.color.a : 0); } var time = game.Time; IntroRatio = (FromNote.nextdraglinestoptime - time) / (FromNote.nextdraglinestoptime - FromNote.nextdraglinestarttime); OutroRatio = (time - FromNote.start_time) / (ToNote.start_time - FromNote.start_time); if (IntroRatio > 0 && IntroRatio < 1) { spriteRenderer.material.SetFloat("_End", 1.0f - IntroRatio); } else if (IntroRatio <= 0) { spriteRenderer.material.SetFloat("_End", 1.0f); } else { spriteRenderer.material.SetFloat("_End", 0.0f); } if (OutroRatio > 0 && OutroRatio < 1) { spriteRenderer.material.SetFloat("_Start", OutroRatio); } }
public void OnNoteClear(GameNote note) { foreach (var trigger in Triggers) { if (trigger.Type == TriggerType.NoteClear && trigger.Notes.Contains(note.Note.id)) { trigger.Triggerer = note; OnTrigger(trigger); } } }
public void UpdateColor_ApproachesColorCommand_IsGreen() { GameNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameNote { HitTime = 1000 })); AddStep("Apply Green ApproachesColorCommand", () => Story.AddCommand(new ApproachesColorCommand { StartValue = Color4.Green, EndValue = Color4.Green })); AddAssert("Approach is green", () => note.Approach.Colour == Color4.Green); }
public void UpdateColor_NotesAlphaCommand_IsHalf() { GameNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameNote { HitTime = Story.Notes.ShowTime - 100 })); AddStep("Apply half NotesAlphaCommand", () => Story.AddCommand(new NotesAlphaCommand { StartValue = 0.5f, EndValue = 0.5f })); AddAssert("Note is half alpha", () => Precision.AlmostEquals(note.Alpha, 0.5f)); }
public void UpdateColor_NotesOutlineColorCommand_IsGreen() { GameNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameNote { HitTime = Story.Notes.ShowTime - 100 })); AddStep("Apply green NotesOutlineColorCommand", () => Story.AddCommand(new NotesOutlineColorCommand { StartValue = Color4.Green, EndValue = Color4.Green })); AddAssert("Note outline is green", () => note.OutlineColor == Color4.Green); }
public void UpdateColor_NotesOutlineThicknessCommand_IsTwoHundredths() { GameNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameNote { HitTime = Story.Notes.ShowTime - 100 })); AddStep("Apply 0.02 NotesOutlineThicknessCommand", () => Story.AddCommand(new NotesOutlineThicknessCommand { StartValue = 0.02f, EndValue = 0.02f })); AddAssert("Note outline is 0.02 thick", () => Precision.AlmostEquals(note.OutlineThickness, 0.02f)); }
public void OnPress_WithinMissThreshold_RegistersHit() { GameNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameNote { HitTime = Notes.MissThreshold + 50 })); AddStep("Seek between pre-threshold and HitTime", () => Stopwatch.Seek(note.HitTime - Notes.MissThreshold / 2)); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); AddStep("Hold key", () => InputManager.PressKey(Key.Z)); AddStep("Release key", () => InputManager.ReleaseKey(Key.Z)); AddStep("Seek after post-threshold", () => Stopwatch.Seek(Notes.MissThreshold * 2 + 60)); AddAssert("Note was hit", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == Notes.MissThreshold / 2); }
public HttpResponseMessage PutGameNote(int id, int ParentID, string ObjectType, int SortOrder) //new sort order { GameNote Note = db.GameNotes.Where(le => le.ID == id).Single(); int newRank = SortOrder; int? oldRank = Note.SortOrder; if (newRank > oldRank) { newRank++; } switch (ObjectType) { case "GameNote": List <GameNote> lgameGameNotes = new List <GameNote>(); lgameGameNotes.AddRange(db.GameNotes.Where(le => le.GameID == ParentID && le.SortOrder < newRank && le.ID != id).OrderBy(ob => ob.SortOrder).ToList()); lgameGameNotes.Add(db.GameNotes.Where(le => le.ID == id).Single()); foreach (GameNote l in db.GameNotes.Where(le => le.GameID == ParentID).OrderBy(ob => ob.SortOrder)) { if (lgameGameNotes.Where(le => le.ID == l.ID).Count() == 0) { lgameGameNotes.Add(l); } } for (int i = 0; i < lgameGameNotes.Count; i++) { lgameGameNotes[i].SortOrder = i + 1; } lgameGameNotes.ForEach(ln => ln.LastUpdated = DateTime.Now); break; } try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public void OnPress_HoldNoteOnTopOfNote_HitsHoldNote() { var holdNoteHitTime = 0; var holdNoteEndTime = 10; GameNote note = null; AddStep("Add notes", () => { Story.AddNote(new GameHoldNote { HitTime = holdNoteHitTime, EndTime = holdNoteEndTime }); Story.AddNote(note = new GameNote { HitTime = 100 }); }); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); PressAndRelease(holdNoteHitTime, holdNoteEndTime - holdNoteHitTime); AddStep("Seek after last note is deleted", () => Stopwatch.Seek(note.HitTime + Notes.MissThreshold)); AddAssert("Hits only hold note", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == Notes.MissThreshold); }
// DELETE api/Note/5 public HttpResponseMessage DeleteGameNote(int id) { GameNote note = db.GameNotes.Where(nw => nw.ID == id).FirstOrDefault(); if (note == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } db.GameNotes.DeleteObject(note); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, note)); }
public void OnPress_HoldNoteThenNote_HitsNote() { GameNote note = null; var holdNoteHitTime = 0; var holdNoteEndTime = 90; AddStep("Add notes", () => { Story.AddNote(new GameHoldNote { HitTime = holdNoteHitTime, EndTime = holdNoteEndTime }); Story.AddNote(note = new GameNote { HitTime = 100, Coordinates = new Vector2(1, 0) }); }); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); AddStep("Seek to note HitTime", () => Stopwatch.Seek(note.HitTime)); AddStep("Hold key", () => InputManager.PressKey(Key.Z)); AddStep("Release key", () => InputManager.ReleaseKey(Key.Z)); AddStep("Seek after hold note is deleted", () => Stopwatch.Seek(holdNoteEndTime + Story.Notes.FadeOutTime)); AddAssert("Hits the later note", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == holdNoteEndTime - holdNoteHitTime + Notes.MissThreshold); }
public void OnPress_NoteThenHoldNote_HitsHoldNote() { GameNote note = null; var holdNoteHitTime = 10; var holdNoteEndTime = 100; AddStep("Add notes", () => { Story.AddNote(note = new GameNote { HitTime = 0 }); Story.AddNote(new GameHoldNote { HitTime = holdNoteHitTime, EndTime = holdNoteEndTime, Coordinates = new Vector2(1, 0), EndCoordinates = new Vector2(1, 0) }); }); AddStep("Move mouse to hold note", () => MoveMouseTo(Story.Notes.Children.First())); PressAndRelease(holdNoteHitTime, holdNoteEndTime - holdNoteHitTime); AddStep("Seek after note is deleted", () => Stopwatch.Seek(note.HitTime + Notes.MissThreshold)); AddAssert("Hits the later hold note", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == Notes.MissThreshold); }
//keep check if notePool is availabe //if true set a sheetNote to gameNote void SetNoteToObjectPool( ) { if (notePool.IsAvailable && queueNotes.Count != 0) { GameNote note = notePool.GetPooledObject <SheetNote> (queueNotes.Dequeue( )) as GameNote; //參考解析度為1920*1080 Vector3 toViewPort = note.Info.pos; toViewPort.x = toViewPort.x / NoR2252Application.CurrentSheet.screenSize.x; toViewPort.y = toViewPort.y / NoR2252Application.CurrentSheet.screenSize.y; toViewPort.z = 0f; Vector3 tmp = camera.ViewportToWorldPoint(toViewPort); // #region SafeArea // tmp.x = tmp.x * NoR2252Data.Instance.SafeArea.x; // tmp.y = tmp.y * NoR2252Data.Instance.SafeArea.y; // #endregion tmp.z = 0f; note.transform.position = tmp; //if current note is slideNote save next id and its position to slidePos if (note.Info.type == (int)ENoteType.SLIDE_HEAD || note.Info.type == (int)ENoteType.SLIDE_CHILD) { if (note.Info.nextId != 0) { slidePos.Add(note.Info.nextId, tmp); slideEndTime.Add(note.Info.nextId, note.Info.endTime); } } //處理最大基數的問題 NoR2252Application.TotalCombo += 1; NoR2252Application.TotalScore += NoR2252Data.Instance.Points [(int)ENoteGrade.PERFECT]; if (note.Info.type == (int)ENoteType.HOLD) { NoR2252Application.TotalCombo += 1; NoR2252Application.TotalScore += NoR2252Data.Instance.Points [(int)ENoteGrade.PERFECT]; } } }
public void OnClear(GameNote note) { Play.OnClear(note, note.CalculateGrading(), note.TimeUntilEnd, note.GreatGradeWeight); }
public HttpResponseMessage PutNote(int id, int ParentID, string ObjectType, int SortOrder) //new sort order { int newRank = SortOrder; int?oldRank; switch (ObjectType) { case "GroupNote": Note Note = db.Notes.Where(le => le.ID == id).Single(); oldRank = Note.SortOrder; if (newRank > oldRank) { newRank++; } List <Note> lnotes = new List <Note>(); lnotes.AddRange(db.Notes.Where(le => le.GroupID == ParentID && le.SortOrder < newRank && le.ID != id).OrderBy(ob => ob.SortOrder).ToList()); lnotes.Add(db.Notes.Where(le => le.ID == id).Single()); foreach (Note l in db.Notes.Where(le => le.GroupID == ParentID).OrderBy(ob => ob.SortOrder)) { if (lnotes.Where(le => le.ID == l.ID).Count() == 0) { lnotes.Add(l); } } for (int i = 0; i < lnotes.Count; i++) { lnotes[i].SortOrder = i + 1; } lnotes.ForEach(ln => ln.LastUpdated = DateTime.Now); Utilities.Write_Admin_Log(db, Utilities.App_Label.FoxTick, typeof(Note), Utilities.Action_Flag.CHANGE, Note.ID.ToString(), Note.Note1, "Updated Note \"" + Note.Note1 + "\"", true); break; case "GameNote": GameNote gameNote = db.GameNotes.Where(le => le.ID == id).Single(); oldRank = gameNote.SortOrder; if (newRank > oldRank) { newRank++; } List <GameNote> lgamenotes = new List <GameNote>(); lgamenotes.AddRange(db.GameNotes.Where(le => le.GameID == ParentID && le.SortOrder < newRank && le.ID != id).OrderBy(ob => ob.SortOrder).ToList()); lgamenotes.Add(db.GameNotes.Where(le => le.ID == id).Single()); foreach (GameNote l in db.GameNotes.Where(le => le.GameID == ParentID).OrderBy(ob => ob.SortOrder)) { if (lgamenotes.Where(le => le.ID == l.ID).Count() == 0) { lgamenotes.Add(l); } } for (int i = 0; i < lgamenotes.Count; i++) { lgamenotes[i].SortOrder = i + 1; } lgamenotes.ForEach(ln => ln.LastUpdated = DateTime.Now); Utilities.Write_Admin_Log(db, Utilities.App_Label.FoxTick, typeof(Note), Utilities.Action_Flag.CHANGE, gameNote.ID.ToString(), gameNote.Note, "Added Note \"" + gameNote.Note + "\"", true); break; } try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public FlickNoteView(GameNote note, NoteViewRef Ref) : base(note, Ref) { }
public TapNoteView(GameNote note, NoteViewRef VRef) : base(note, VRef) { }
public void OnClear(GameNote note, NoteGrade grade, float timeUntilEnd, double greatGradeWeight) { if (grade == NoteGrade.Undetermined) { return; } if (NoteRankings[note.Note.id] != NoteGrade.Undetermined) { return; } if (!IsRanked) { if (grade != NoteGrade.Perfect && grade != NoteGrade.Great) { isMillionMasterPossible = false; } } else { if (grade != NoteGrade.Perfect) { isMillionMasterPossible = false; } } NoteCleared++; NoteRankings[note.Note.id] = grade; if (grade != NoteGrade.Perfect && grade != NoteGrade.Miss) { if (timeUntilEnd > 0) { Early++; } else { Late++; } } timeOffs.Add(timeUntilEnd); // Combo if (grade == NoteGrade.Bad || grade == NoteGrade.Miss) { Combo = 0; } else { Combo++; if (MaxCombo < Combo) { MaxCombo = Combo; } } if (IsRanked) { switch (grade) { case NoteGrade.Perfect: ComboMultiplier += 0.002D * magicNumber; break; case NoteGrade.Great: ComboMultiplier += 0.0005D * magicNumber; break; case NoteGrade.Good: ComboMultiplier -= -0.005D * magicNumber; break; case NoteGrade.Bad: ComboMultiplier -= 0.025D * magicNumber; break; case NoteGrade.Miss: ComboMultiplier -= 0.05D * magicNumber; break; } if (ComboMultiplier > 1) { ComboMultiplier = 1; } if (ComboMultiplier < 0) { ComboMultiplier = 0; } } // Score if (!IsRanked) { Score += 900000f / NoteCount * grade.ScoreWeight(ranked: false) + 100000f / (NoteCount * (double)(NoteCount + 1) / 2f) * Combo; } else { var maxNoteScore = 1000000.0 / NoteCount; double noteScore; if (grade == NoteGrade.Great) { noteScore = maxNoteScore * (NoteGrade.Great.ScoreWeight(ranked: true) + (NoteGrade.Perfect.ScoreWeight(ranked: true) - NoteGrade.Great.ScoreWeight(ranked: true)) * greatGradeWeight); } else { noteScore = maxNoteScore * grade.ScoreWeight(ranked: true); } noteScore *= ComboMultiplier; Score += noteScore; } if (Score > 999500) { if (NoteCleared == NoteCount && isMillionMasterPossible) { Score = 1000000; } } if (Score > 1000000) { Score = 1000000; } // TP if (!IsRanked || grade != NoteGrade.Great) { currentTp += 100f * grade.TpWeight(); } else { currentTp += 100f * (NoteGrade.Great.TpWeight() + (NoteGrade.Perfect.TpWeight() - NoteGrade.Great.TpWeight()) * greatGradeWeight); } Tp = currentTp / NoteCleared; // HP if (Mods.Contains(Mod.Hard) || Mods.Contains(Mod.ExHard)) { var mods = Mods.Contains(Mod.ExHard) ? ExHardHpMods : HardHpMods; var mod = mods.Select[note.Note.type] .Select[IsRanked ? RankedGradingIndices[grade] : UnrankedGradingIndices[grade]]; switch (mod.Type) { case HpModType.Absolute: Hp += mod.Value; break; case HpModType.Percentage: Hp += mod.Value / 100f * MaxHp; break; case HpModType.DivideByNoteCount: Hp += (mod.Value / NoteCount) / 100f * MaxHp; break; } if (Hp > MaxHp) { Hp = MaxHp; } if (Hp < 0) { Game.Instance.Fail(); } } if ( (Mods.Contains(Mod.AP) && grade != NoteGrade.Perfect) || (Mods.Contains(Mod.FC) && (grade == NoteGrade.Bad || grade == NoteGrade.Miss)) ) { Game.Instance.Fail(); } }
public NoteQueue(int max) { _max = max; _notes = new GameNote[max]; }
public SlideHeadNoteView(GameNote note, NoteViewRef VRef) : base(note, VRef) { }
public void Initialize(GameNote gameNote) { transform.localPosition = start; this.NoteTime = gameNote.NoteTime; this.gameNote = gameNote; }