public void ResetStage() { ClearStage(); for (prevNoteID = 0; prevNoteID < chart.notes.Count; prevNoteID++) { if (chart.notes[prevNoteID].time > timeSlider.value) { break; } } prevNoteID--; for (returnNoteID = prevNoteID; returnNoteID >= 0; returnNoteID--) { if (chart.notes[returnNoteID].time + Parameters.noteReturnTime <= timeSlider.value) { break; } } for (prevLineID = new TGridId(0, 0, editor.tGrid); prevLineID <= new TGridId(chart.beats.Count - 1, 0, editor.tGrid); prevLineID++) { if (TGridTime(prevLineID) > timeSlider.value) { break; } } prevLineID--; PlaceNewObjects(); }
public void SetPrevLineId(TGridId id) { if (id > prevLineID) { prevLineID = id; } }
private void PlaceNewObjects() { { int cur; int prev = notes.Count > 0 ? notes[notes.Count - 1].id : returnNoteID; for (cur = prev + 1; cur < chart.notes.Count; cur++) { if (chart.notes[cur].time > timeSlider.value + Parameters.NoteFallTime(chartPlaySpeed)) { break; } } for (int i = prev + 1; i < cur; i++) { InitNoteObject(i); } } { TGridId prev = tGrids.Count > 0 ? tGrids[tGrids.Count - 1].id : prevLineID; TGridId cur = prev; cur++; for (; cur <= new TGridId(chart.beats.Count - 1, 0, editor.tGrid); cur++) { if (TGridTime(cur) > timeSlider.value + Parameters.NoteFallTime(chartPlaySpeed)) { break; } } TGridId i = prev; i++; for (; i < cur; i++) { InitTGridObject(i); } } ChangeScoreText(); }
private void InitTGridObject(TGridId id) { TGridController tGrid = tGridPool.GetObject(); tGrids.Add(tGrid); tGrid.grid.SetActive(true); tGrid.Activate(id, TGridTime(id), this); }
public static TGridId operator --(TGridId cur) { TGridId res = new TGridId(cur.id, cur.sub - 1, cur.maxSub); if (res.sub < 0) { res.id--; res.sub += res.maxSub; } return(res); }
public static TGridId operator ++(TGridId cur) { TGridId res = new TGridId(cur.id, cur.sub + 1, cur.maxSub); if (res.sub >= res.maxSub) { res.id++; res.sub -= res.maxSub; } return(res); }
private float TGridTime(TGridId id) { float curLineTime = chart.beats[id.id]; if (id.sub != 0) { float dTime = chart.beats[id.id + 1] - curLineTime; curLineTime += dTime / editor.tGrid * id.sub; } return(curLineTime); }
public void ClearStage() { while (notes.Count > 0) { notes[0].ForceReturn(); } while (tGrids.Count > 0) { tGrids[0].ForceReturn(); } prevNoteID = -1; returnNoteID = -1; prevLineID = new TGridId(0, -1, editor.tGrid); }
public void Activate(TGridId lineId, float lineTime, StageController stageController) { id = lineId; curTime = lineTime; stage = stageController; if (id.sub == 0) { grid.Color = new Color(0.5f, 0.0f, 0.0f); grid.AlphaMultiplier = 1.0f; } else { grid.Color = new Color(42 / 255.0f, 42 / 255.0f, 42 / 255.0f); grid.AlphaMultiplier = 0.75f; } Update(); }