void Update() { float time = ChartEditor.GetInstance().currentVisibleTime; ChartEditor editor = ChartEditor.GetInstance(); Chart.GameMode gameMode = editor.currentChart.gameMode; // Enter window for (int i = physicsWindow.Count - 1; i >= 0; --i) { NoteController note = physicsWindow[i]; if (gameMode == Chart.GameMode.Guitar) { if (guitarHitWindow.DetectEnter(note.note, time)) { physicsWindow.Remove(note); } } else if (gameMode == Chart.GameMode.Drums) { if (drumsHitWindow.DetectEnter(note.note, time)) { physicsWindow.Remove(note); } } } }
// Use this for initialization protected override void Start() { editor = ChartEditor.GetInstance(); EventsManager.onChartReloadEventList.Add(GameplayEnabledCheck); base.Start(); }
void Start() { editor = ChartEditor.GetInstance(); buttonImage = GetComponent <Image>(); EventsManager.onApplicationModeChangedEventList.Add(UpdatePlayPauseSprite); UpdatePlayPauseSprite(Globals.applicationMode); }
void Start() { editor = ChartEditor.GetInstance(); eventImage = eventSelect.GetComponent <Image>(); localEventSprite = eventImage.sprite; EventsManager.onViewModeSwitchEventList.Add(OnViewModeSwitch); }
void OnLanesUpdated() { int newLaneCount; if (standardGamemodeToLaneCountMap.TryGetValue(ChartEditor.GetInstance().currentGameMode, out newLaneCount)) { laneCount = newLaneCount; } }
// Use this for initialization void Start() { noteInspector.gameObject.SetActive(false); sectionInspector.gameObject.SetActive(false); bpmInspector.gameObject.SetActive(false); tsInspector.gameObject.SetActive(false); eventInspector.gameObject.SetActive(false); editor = ChartEditor.GetInstance(); }
public void UpdateStrikerColors(int laneCount) { Chart.GameMode gameMode = ChartEditor.GetInstance().currentGameMode; Color[] colours = laneInfo.laneColours; for (int i = 0; i < colours.Length; ++i) { fretRenders[i * 2].color = colours[i]; fretRenders[i * 2 + 1].color = colours[i]; } }
public static float GetXPos(float chartPos, Note note) { if (!note.IsOpenNote()) { bool leftyFlip = GameSettings.notePlacementMode == GameSettings.NotePlacementMode.LeftyFlip; return(chartPos + ChartEditor.GetInstance().laneInfo.GetLanePosition(note.rawNote, leftyFlip)); } else { return(chartPos); } }
// Use this for initialization protected override void Start() { editor = ChartEditor.GetInstance(); initLocalPos = transform.localPosition; #if BASS_AUDIO clapBytes = clap.GetWavBytes(); sample = Bass.BASS_SampleLoad(clapBytes, 0, clapBytes.Length, 15, BASSFlag.BASS_DEFAULT); #else clapSource = gameObject.AddComponent <AudioSource>(); #endif base.Start(); }
void OnDisable() { if (currentEventToCustomise != originalEvent) { ActionHistory.Modify actionHistory = currentChartEvent != null ? new ActionHistory.Modify(originalEvent as ChartEvent, currentChartEvent) : new ActionHistory.Modify(originalEvent as Event, currentEvent); ChartEditor.GetInstance().actionHistory.Insert(actionHistory); } currentEventToCustomise = null; originalEvent = null; eventStr = string.Empty; }
public static void AddObjectToCurrentSong(BPM bpm, ChartEditor editor, bool update = true) { BPM bpmToAdd = new BPM(bpm); editor.currentSong.Add(bpmToAdd, update); //editor.CreateBPMObject(bpmToAdd); editor.currentSelectedObject = bpmToAdd; if (bpmToAdd.anchor != null) { bpmToAdd.anchor = bpmToAdd.song.LiveTickToTime(bpmToAdd.tick, bpmToAdd.song.resolution); } ChartEditor.GetInstance().songObjectPoolManager.SetAllPoolsDirty(); }
public void LoadCurrentInstumentAndDifficulty() { if (!editor) { editor = ChartEditor.GetInstance(); } editor.LoadChart(editor.currentSong.GetChart(currentInstrument, currentDifficulty)); editor.currentSelectedObject = null; EventsManager.FireChartReloadedEvent(); if (desiredLaneCount > 0) { editor.laneInfo.laneCount = desiredLaneCount; } }
// Update is called once per frame void Update () { if (Globals.applicationMode == Globals.ApplicationMode.Playing && !GameSettings.bot) { ChartEditor editor = ChartEditor.GetInstance(); GamepadInput input = editor.inputManager.mainGamepad; Chart.GameMode gameMode = editor.currentChart.gameMode; LaneInfo laneInfo = editor.laneInfo; if (gameMode == Chart.GameMode.Drums) { foreach (Note.DrumPad drumPad in System.Enum.GetValues(typeof(Note.DrumPad))) { if (bannedDrumPadInputs.ContainsKey(drumPad)) continue; if (input.GetPadInputControllerOrKeyboard(drumPad, laneInfo)) animations[(int)drumPad].Press(); else animations[(int)drumPad].Release(); } } else { foreach (Note.GuitarFret fret in System.Enum.GetValues(typeof(Note.GuitarFret))) { if (bannedFretInputs.ContainsKey(fret)) continue; if (input.GetFretInputControllerOrKeyboard(fret)) animations[(int)fret].Press(); else animations[(int)fret].Release(); } } } else { for (int i = 0; i < animations.Length; ++i) { if (!animations[i].running) animations[i].Release(); } } }
public void Update(float time, HitWindow <DrumsNoteHitKnowledge> hitWindow, GamepadInput drumsInput) { uint noteStreak = stats.noteStreak; int missCount = UpdateWindowExit(time, hitWindow); LaneInfo laneInfo = ChartEditor.GetInstance().laneInfo; for (int i = 0; i < missCount; ++i) { if (noteStreak > 0) { Debug.Log("Missed due to note falling out of window"); } MissNote(time, DrumsNoteHitAndMissDetect.MissSubType.NoteMiss, null); } hitAndMissNoteDetect.Update(time, hitWindow, drumsInput, stats.noteStreak, laneInfo); }
public double GetTime() { while (secondTimer >= 1) { if (Globals.applicationMode == Globals.ApplicationMode.Playing) { int audioStream = ChartEditor.GetInstance().currentSong.bassAudioStreams[0]; long bytePos = Un4seen.Bass.Bass.BASS_ChannelGetPosition(audioStream); double elapsedtime = Un4seen.Bass.Bass.BASS_ChannelBytes2Seconds(audioStream, bytePos); audioPosition = elapsedtime;// BassAudioManager.instance.GetPosition() / songSpeed; if (audioPosition > 0 && audioPosition != lastAudioPosition) { desyncAmount = (float)(audioPosition - (songTime)); isAdjusting = desyncAmount > desyncLenience || desyncAmount < -desyncLenience; } else { isAdjusting = false; } lastAudioPosition = audioPosition; } secondTimer -= 1; } if (isAdjusting) { songTime += desyncAmount * Time.deltaTime; } songTime += Time.deltaTime * GameSettings.gameSpeed; secondTimer += Time.deltaTime; return(songTime + songOffset); }
// Update is called once per frame void Update() { if (transform.localScale.y > 0) { if (Globals.applicationMode == Globals.ApplicationMode.Playing && transform.localScale.y > 0 && canWhammy) { pointsController.UpdateLineRendererPoints(); ShiftAnimationKeys(lineCurve, keyShiftSpeed * Time.deltaTime * (GameSettings.hyperspeed / GameSettings.gameSpeed) / transform.localScale.y); float whammyVal = (lerpedWhammyVal(ChartEditor.GetInstance().inputManager.mainGamepad) + 1) * widthMultiplier; lineCurve.AddKey(new Keyframe(0, whammyVal + 1)); } else if (previousApplicationMode != Globals.applicationMode) { OnEnable(); } lineRenderer.widthCurve = lineCurve; } }
public void AddSongObjects() { List <ActionHistory.Action> record = new List <ActionHistory.Action>(); List <ActionHistory.Action> deleteRecord = new List <ActionHistory.Action>(); // Need to remember to undo/redo. This current will only work once object pools are implemented. // Check to see what the current offset is to decide how to record // Will also need to check for overwrites // All relative to the original notes bool moved = false; for (int i = 0; i < movingSongObjects.Count; ++i) { ActionHistory.Action overwriteRecord; if (movingSongObjects[i] != originalSongObjects[i]) { moved = true; deleteRecord.Add(new ActionHistory.Delete(originalSongObjects[i])); } switch ((SongObject.ID)movingSongObjects[i].classID) { case (SongObject.ID.Note): record.AddRange(PlaceNote.AddObjectToCurrentChart((Note)movingSongObjects[i], editor, false, false)); // Capping break; case (SongObject.ID.Starpower): record.AddRange(PlaceStarpower.AddObjectToCurrentChart((Starpower)movingSongObjects[i], editor, false, false)); // Capping break; case (SongObject.ID.ChartEvent): overwriteRecord = PlaceSongObject.OverwriteActionHistory((ChartEvent)movingSongObjects[i], editor.currentChart.events); if (record != null) { record.Add(overwriteRecord); } editor.currentChart.Add((ChartEvent)movingSongObjects[i], false); break; case (SongObject.ID.BPM): overwriteRecord = PlaceSongObject.OverwriteActionHistory((BPM)movingSongObjects[i], editor.currentSong.bpms); if (record != null) { record.Add(overwriteRecord); } BPM bpm = (BPM)movingSongObjects[i]; editor.currentSong.Add(bpm, false); if (bpm.anchor != null) { bpm.anchor = bpm.song.LiveTickToTime(bpm.tick, bpm.song.resolution); } ChartEditor.GetInstance().songObjectPoolManager.SetAllPoolsDirty(); break; case (SongObject.ID.TimeSignature): overwriteRecord = PlaceSongObject.OverwriteActionHistory((TimeSignature)movingSongObjects[i], editor.currentSong.timeSignatures); if (record != null) { record.Add(overwriteRecord); } editor.currentSong.Add((TimeSignature)movingSongObjects[i], false); break; case (SongObject.ID.Section): overwriteRecord = PlaceSongObject.OverwriteActionHistory((Section)movingSongObjects[i], editor.currentSong.sections); if (record != null) { record.Add(overwriteRecord); } editor.currentSong.Add((Section)movingSongObjects[i], false); break; case (SongObject.ID.Event): overwriteRecord = PlaceSongObject.OverwriteActionHistory((Event)movingSongObjects[i], editor.currentSong.events); if (record != null) { record.Add(overwriteRecord); } editor.currentSong.Add((Event)movingSongObjects[i], false); break; default: break; } } editor.currentSelectedObjects = movingSongObjects.ToArray(); if (moved) { editor.actionHistory.Insert(deleteRecord.ToArray()); // In case user removes a bpm from an anchor area editor.actionHistory.Insert(bpmAnchorRecord.ToArray()); editor.currentSong.UpdateCache(); editor.currentChart.UpdateCache(); editor.actionHistory.Insert(record.ToArray()); editor.actionHistory.Insert(editor.FixUpBPMAnchors().ToArray()); // In case user moves a bpm into an anchor area } editor.currentSong.UpdateCache(); editor.currentChart.UpdateCache(); Reset(); }
// Use this for initialization void Start() { editor = ChartEditor.GetInstance(); }
public override void Delete(bool update = true) { ChartEditor.GetInstance().songObjectPoolManager.SetAllPoolsDirty(); base.Delete(update); }
bool AdjustForAnchors(uint newBpmValue) { ChartEditor.GetInstance().songObjectPoolManager.SetAllPoolsDirty(); int pos = SongObjectHelper.FindObjectPosition(currentBPM, currentBPM.song.bpms); if (pos != SongObjectHelper.NOTFOUND) { BPM anchor = null; BPM bpmToAdjust = null; int anchorPos = 0; // Get the next anchor for (int i = pos + 1; i < currentBPM.song.bpms.Count; ++i) { if (currentBPM.song.bpms[i].anchor != null) { anchor = currentBPM.song.bpms[i]; anchorPos = i; // Get the bpm before that anchor bpmToAdjust = currentBPM.song.bpms[i - 1]; break; } } if (anchor == null || bpmToAdjust == currentBPM) { if (currentBPM.value != newBpmValue) { ChartEditor.isDirty = true; } currentBPM.value = newBpmValue; return(true); } // Calculate the minimum the bpm can adjust to const float MIN_DT = 0.01f; float bpmTime = (float)anchor.anchor - MIN_DT; float resolution = currentBPM.song.resolution; // Calculate the time of the 2nd bpm pretending that the adjustable one is super close to the anchor for (int i = anchorPos - 1; i > pos + 1; --i) { // Calculate up until 2 bpms before the anchor // Re-hash of the actual time calculation equation in Song.cs bpmTime -= (float)TickFunctions.DisToTime(currentBPM.song.bpms[i - 1].tick, currentBPM.song.bpms[i].tick, resolution, currentBPM.song.bpms[i - 1].value / 1000.0f); } float timeBetweenFirstAndSecond = bpmTime - currentBPM.time; // What bpm will result in this exact time difference? uint minVal = (uint)(Mathf.Ceil((float)TickFunctions.DisToBpm(currentBPM.song.bpms[pos].tick, currentBPM.song.bpms[pos + 1].tick, timeBetweenFirstAndSecond, currentBPM.song.resolution)) * 1000); if (newBpmValue < minVal) { newBpmValue = minVal; } if (anchorAdjustment == null) { anchorAdjustment = bpmToAdjust; anchorAdjustmentOriginalValue = new BPM(bpmToAdjust); } BPM anchorBPM = anchor; uint oldValue = currentBPM.value; currentBPM.value = newBpmValue; double deltaTime = (double)anchorBPM.anchor - editor.currentSong.LiveTickToTime(bpmToAdjust.tick, editor.currentSong.resolution); uint newValue = (uint)Mathf.Round((float)(TickFunctions.DisToBpm(bpmToAdjust.tick, anchorBPM.tick, deltaTime, editor.currentSong.resolution) * 1000.0d)); currentBPM.value = oldValue; if (deltaTime > 0 && newValue > 0) { if (newValue != 0) { bpmToAdjust.value = newValue; } currentBPM.value = newBpmValue; ChartEditor.isDirty = true; } } else { if (currentBPM.value != newBpmValue) { ChartEditor.isDirty = true; } currentBPM.value = newBpmValue; } return(true); }
void RecoveryDetect(float time, HitWindow <GuitarNoteHitKnowledge> hitWindow, int fretInputMask, bool strummed, uint noteStreak) { var noteKnowledgeList = hitWindow.noteKnowledgeQueue; // Search to see if user is hitting a note ahead List <GuitarNoteHitKnowledge> validatedNotes = new List <GuitarNoteHitKnowledge>(); foreach (GuitarNoteHitKnowledge noteKnowledge in noteKnowledgeList) { // Collect all notes the user is possibly hitting if ( GameplayInputFunctions.ValidateFrets(noteKnowledge.note, fretInputMask, noteStreak) && GameplayInputFunctions.ValidateStrum(noteKnowledge.note, canTap, strummed, noteStreak) ) { validatedNotes.Add(noteKnowledge); } } if (validatedNotes.Count > 0) { // Recovery algorithm // Select the note closest to the strikeline float aimYPos = ChartEditor.GetInstance().visibleStrikeline.transform.position.y + 0.25f; // Added offset from the note controller GuitarNoteHitKnowledge selectedNote = validatedNotes[0]; float dis = -1; foreach (GuitarNoteHitKnowledge validatedNote in validatedNotes) { if (!selectedNote.note.controller) { return; } NoteController noteController = selectedNote.note.controller; float distance = Mathf.Abs(aimYPos - noteController.transform.position.y); if (distance < dis || dis < 0) { selectedNote = validatedNote; dis = distance; } } int index = noteKnowledgeList.IndexOf(selectedNote); GuitarNoteHitKnowledge note = noteKnowledgeList[index]; // Recovery missed notes if (index > 0) { Debug.Log("Missed notes when performing recovery. Notes skipped = " + index); } for (int missedCounter = 0; missedCounter < index; ++missedCounter) { MissNote(time, MissSubType.NoteMiss, noteKnowledgeList[missedCounter]); } HitNote(time, note); // We fill out our own knowledge note.fretValidationTime = time; note.strumValidationTime = time; if (strummed) { ++note.strumCounter; } } else if (strummed) { MissNote(time, MissSubType.Overstrum); Debug.Log("Missed due to strumming when there were no notes to strum during recovery"); } }
protected virtual void Start() { ChartEditor.GetInstance().globals.services.RegisterUpdateableService(this); }
protected void Awake() { editor = ChartEditor.GetInstance(); }
// Update is called once per frame public override void UpdateVisuals() { if (!meshFilter) { Awake(); } base.UpdateVisuals(); Note note = nCon.note; if (note != null) { // Visuals // Update mesh if (note.IsOpenNote())// fret_type == Note.Fret_Type.OPEN) { meshFilter.sharedMesh = resources.openModel.sharedMesh; } else if (specialType == Note.SpecialType.StarPower) { meshFilter.sharedMesh = resources.spModel.sharedMesh; } else { meshFilter.sharedMesh = resources.standardModel.sharedMesh; } Material[] materials; ChartEditor editor = ChartEditor.GetInstance(); Chart.GameMode gameMode = editor.currentGameMode; Note.NoteType visualNoteType = noteType; if (gameMode == Chart.GameMode.Drums) { visualNoteType = Note.NoteType.Strum; } // Determine materials if (note.IsOpenNote()) { materials = resources.openRenderer.sharedMaterials; int colourIndex = 0; if (specialType == Note.SpecialType.StarPower) { if (visualNoteType == Note.NoteType.Hopo) { colourIndex = 3; } else { colourIndex = 2; } } else { if (visualNoteType == Note.NoteType.Hopo) { colourIndex = 1; } else { colourIndex = isTool ? 4 : 0; } } materials[2] = resources.openMaterials[colourIndex]; } else { LaneInfo laneInfo = editor.laneInfo; Material colorMat; if (isTool) { if (visualNoteType == Note.NoteType.Tap) { colorMat = resources.GetToolTapMaterial(gameMode, laneInfo, note.rawNote); } else { colorMat = resources.GetToolStrumMaterial(gameMode, laneInfo, note.rawNote); } } else { if (visualNoteType == Note.NoteType.Tap) { colorMat = resources.GetTapMaterial(gameMode, laneInfo, note.rawNote); } else { colorMat = resources.GetStrumMaterial(gameMode, laneInfo, note.rawNote); } } materials = GetMaterials(colorMat, visualNoteType); } noteRenderer.sharedMaterials = materials; } }
private void Start() { ChartEditor.GetInstance().globals.services.RegisterUpdateableService(this); }
// Use this for initialization protected override void Start() { base.Start(); editor = ChartEditor.GetInstance(); EventsManager.onSaveEventList.Add(StartFade); }