void FillNotesKeyboardControlsBurstMode(LaneInfo laneInfo) { int keysPressed = 0; int laneCount = laneInfo.laneCount; bool isTyping = Services.IsTyping; if (isTyping) { return; } for (int i = 0; i < laneCount + 1; ++i) { int index = i; bool isOpenInput = index >= laneCount; if (isOpenInput && keysPressed > 0) // Prevents open notes while holding other keys { continue; } int inputOnKeyboard = index + 1; if (Input.GetKey(NumToStringLUT[inputOnKeyboard]) && !inputBlock[index]) { ++keysPressed; int notePos = index; if (isOpenInput) { notePos = allPlaceableNotes.IndexOf(openNote); } LeftyFlipReflectionCheck(ref notePos, laneCount); allPlaceableNotes[notePos].ExplicitUpdate(); int pos = SongObjectHelper.FindObjectPosition(allPlaceableNotes[notePos].note, editor.currentChart.notes); if (currentPlacementMode == KeysPlacementMode.None) { currentPlacementMode = pos == SongObjectHelper.NOTFOUND ? KeysPlacementMode.Adding : KeysPlacementMode.Deleting; } if (currentPlacementMode == KeysPlacementMode.Adding && pos == SongObjectHelper.NOTFOUND) { Debug.Log("Adding note"); currentlyAddingNotes.Add(allPlaceableNotes[notePos].note.Clone()); } else if (Input.GetKeyDown(NumToStringLUT[inputOnKeyboard]) && currentPlacementMode == KeysPlacementMode.Deleting) { Debug.Log("Removed " + editor.currentChart.notes[pos].rawNote + " note at position " + editor.currentChart.notes[pos].tick + " using keyboard controls"); currentlyAddingNotes.Add(editor.currentChart.notes[pos]); inputBlock[index] = true; } } else if (!Input.GetKey(NumToStringLUT[(index + 1)])) { inputBlock[index] = false; } } }
int[] LookupPaletteMapForGameMode(Chart.GameMode gameMode, LaneInfo laneInfo) { int[] paletteMap = null; int laneCount = laneInfo.laneCount; switch (gameMode) { case (Chart.GameMode.Guitar): paletteMap = guitarModeLaneColorIndicies; break; case (Chart.GameMode.Drums): paletteMap = laneCount == 4 ? drumModeLaneColorIndicies4LaneOverride : drumModeLaneColorIndicies; break; case (Chart.GameMode.GHLGuitar): paletteMap = ghlGuitarModeLaneColorIndicies; break; default: throw new System.Exception("Unhandled gamemode"); } return(paletteMap); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new RoadInfo() { LaneWidth = LaneWidth, MaxLanes = MaxLanes, CarSpawningDistancePercent = CarSpawningDistance, MidRadius = MidRadius, StraightPieceLength = StraightPieceLength, SegmentCount = SegmentCount }); DynamicBuffer <LaneInfoElement> dynamicBuffer = dstManager.AddBuffer <LaneInfoElement>(entity); for (int i = 0; i < MaxLanes; ++i) { LaneInfo info = new LaneInfo { Pivot = LaneWidth * ((MaxLanes - 1) / 2f - i), Radius = MidRadius - LaneWidth * (MaxLanes - 1) / 2f + i * LaneWidth }; info.CurvedPieceLength = info.Radius * math.PI / 2f; dynamicBuffer.Add(new LaneInfoElement { Value = info }); } }
public override void OnLaneLocked(Sim sim, LaneInfo info) { DoorSettings settings = GoHere.Settings.GetDoorSettings(this.OwnerDoor.ObjectId); bool allowed = true; if (settings != null) { if (settings.mIsOneWayDoor && (info.mLaneSlots[0] != Door.RoutingSlots.Door1_Rear && info.mLaneSlots[0] != Door.RoutingSlots.Door0_Rear)) { allowed = false; } allowed = allowed && settings.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId); } if (!allowed) { if (sim.SimRoutingComponent != null && sim.SimRoutingComponent.IsRouting) { sim.SimRoutingComponent.GetCurrentRoute().DoRouteFail = false; } return; } if ((info.mLaneSlots[0] == Door.RoutingSlots.Door0_Rear || info.mLaneSlots[0] == Door.RoutingSlots.Door1_Rear) && settings.mDoorCost > 0 && !settings.WasSimRecentlyLetThrough(sim.SimDescription.SimDescriptionId)) { settings.AddRecentSim(sim.SimDescription.SimDescriptionId); GoHere.Settings.AddOrUpdateDoorSettings(this.OwnerDoor.ObjectId, settings, false); settings.HandleCost(sim); } base.OnLaneLocked(sim, info); }
/******************************** Keyboard Alts ********************************************/ public static bool GetPadPressedInputKeyboard(Note.DrumPad drumFret, LaneInfo laneInfo) { switch (drumFret) { case (Note.DrumPad.Red): return(Input.GetKeyDown(KeyCode.Alpha1)); case (Note.DrumPad.Yellow): return(Input.GetKeyDown(KeyCode.Alpha2)); case (Note.DrumPad.Blue): return(Input.GetKeyDown(KeyCode.Alpha3)); case (Note.DrumPad.Orange): return(Input.GetKeyDown(KeyCode.Alpha4)); case (Note.DrumPad.Green): return(Input.GetKeyDown(KeyCode.Alpha5)); case (Note.DrumPad.Kick): return(Input.GetKeyDown(KeyCode.Alpha0)); default: Debug.LogError("Unhandled note type for drum input: " + drumFret); break; } return(false); }
public static int GetNoteArrayPos(Note note, LaneInfo laneInfo) // Note that this isn't actually an arry position but basically an identifier for which colour to show from the custom resources. This used to be an array position before the refactor { int arrayPos = note.rawNote; if (note.ShouldBeCulledFromLanes(laneInfo)) // Should have been culled, but we want to display it anyway, clamp it to the last lane { arrayPos = Mathf.Min(note.rawNote, laneInfo.laneCount - 1); // Clamp to the edge of the lanes } if (Globals.ghLiveMode) { arrayPos = 0; if (note.ghliveGuitarFret >= Note.GHLiveGuitarFret.White1 && note.ghliveGuitarFret <= Note.GHLiveGuitarFret.White3) { arrayPos = 1; } else if (note.IsOpenNote()) { arrayPos = 2; } } else if (Globals.drumMode && note.drumPad != Note.DrumPad.Kick) { arrayPos += 1; if (arrayPos > (laneInfo.laneCount - 1)) { arrayPos = 0; } } return(arrayPos); }
static bool GetPadPressedInput(Note.DrumPad drumFret, LaneInfo laneInfo, Dictionary <Note.DrumPad, MSChartEditorInputActions> inputsToCheck, Dictionary <int, Dictionary <Note.DrumPad, MSChartEditorInputActions?> > laneCountOverridesDict) { if (laneCountOverridesDict != null) { Dictionary <Note.DrumPad, MSChartEditorInputActions?> inputOverrideDict; MSChartEditorInputActions?overrideInput; if (laneCountOverridesDict.TryGetValue(laneInfo.laneCount, out inputOverrideDict) && inputOverrideDict.TryGetValue(drumFret, out overrideInput)) { bool inputFound = false; if (overrideInput != null) { inputFound = MSChartEditorInput.GetInputDown((MSChartEditorInputActions)overrideInput); } return(inputFound); } } MSChartEditorInputActions input; if (inputsToCheck.TryGetValue(drumFret, out input)) { return(MSChartEditorInput.GetInputDown(input)); } return(false); }
// Update is called once per frame void Update() { if (Globals.applicationMode == Globals.ApplicationMode.Playing && !GameSettings.bot) { ChartEditor editor = ChartEditor.Instance; 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(); } } } }
void KeyboardControlsBurstMode(LaneInfo laneInfo) { int keysPressed = 0; int laneCount = laneInfo.laneCount; bool isTyping = Services.IsTyping; if (isTyping) { return; } for (int i = 0; i < laneCount + 1; ++i) { int index = i; if (index + 1 >= laneCount && keysPressed > 0) // Prevents open notes while holding other keys { continue; } int inputOnKeyboard = index + 1; if (Input.GetKey(inputOnKeyboard.ToString()) && !inputBlock[index]) { ++keysPressed; int notePos = index; if (Input.GetKey(GetOpenNoteInputKey(laneCount))) { notePos = allPlaceableNotes.IndexOf(openNote); } LeftyFlipReflectionCheck(ref notePos, laneCount); allPlaceableNotes[notePos].ExplicitUpdate(); int pos = SongObjectHelper.FindObjectPosition(allPlaceableNotes[notePos].note, editor.currentChart.notes); if (pos == SongObjectHelper.NOTFOUND) { Debug.Log("Not found"); keysBurstAddHistory.AddRange(PlaceNote.AddObjectToCurrentChart((Note)allPlaceableNotes[notePos].note.Clone(), editor)); } else if (Input.GetKeyDown(inputOnKeyboard.ToString())) { editor.actionHistory.Insert(new ActionHistory.Delete(editor.currentChart.notes[pos])); Debug.Log("Removed " + editor.currentChart.notes[pos].rawNote + " note at position " + editor.currentChart.notes[pos].tick + " using keyboard controls"); editor.currentChart.notes[pos].Delete(); inputBlock[index] = true; } } else if (!Input.GetKey((index + 1).ToString())) { inputBlock[index] = false; } } if (keysPressed == 0) { BurstRecordingInsertCheck(keysBurstAddHistory); } }
// Update is called once per frame void Update() { ChartEditor editor = ChartEditor.Instance; if (editor.currentState == ChartEditor.State.Playing && !GameSettings.bot) { Chart.GameMode gameMode = editor.currentChart.gameMode; LaneInfo laneInfo = editor.laneInfo; if (gameMode == Chart.GameMode.Drums) { foreach (Note.DrumPad drumPad in EnumX <Note.DrumPad> .Values) { if (bannedDrumPadInputs.ContainsKey(drumPad)) { continue; } if (DrumsInput.GetPadPressedInput(drumPad, laneInfo)) { animations[(int)drumPad].Press(); } else { animations[(int)drumPad].Release(); } } } else { foreach (Note.GuitarFret fret in EnumX <Note.GuitarFret> .Values) { if (bannedFretInputs.ContainsKey(fret)) { continue; } if (GuitarInput.GetFretInput(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 LaneInfo Clone() { var other = new LaneInfo { ConnectLane = ConnectLane, _junctions = new List <Junction>(_junctions) }; return(other); }
public string GetDrumString(LaneInfo laneInfo) { if (laneInfo.laneCount < 5 && drumPad == DrumPad.Orange) { return(DrumPad.Green.ToString()); } else { return(drumPad.ToString()); } }
public static int GetMaskCappedLanes(this Note note, LaneInfo laneInfo) { int mask = 0; foreach (Note chordNote in note.chord) { mask |= 1 << chordNote.GetRawNoteLaneCapped(laneInfo); } return(mask); }
public void UnionWith(LaneInfo aOther) { foreach (Junction other in aOther.junctions) { if (!junctions.Contains(other)) { junctions.Add(other); } } junctions.TrimExcess(); }
public static int GetRawNoteLaneCapped(this Note note, LaneInfo laneInfo) { int noteIndex = note.rawNote; if (!note.IsOpenNote()) { noteIndex = Mathf.Min(note.rawNote, laneInfo.laneCount - 1); } return(noteIndex); }
void UpdateMouseBurstMode() { LaneInfo laneInfo = editor.laneInfo; KeysDraggedSustainRecordingCheck(); if (Input.GetMouseButtonUp(0)) { ResetNoteAdding(); } MouseControlsBurstMode(laneInfo); }
public void UnionWith(LaneInfo other) { foreach (Junction otherJunction in other._junctions) { if (!_junctions.Contains(otherJunction)) { _junctions.Add(otherJunction); } } _junctions.TrimExcess(); }
void UpdateKeysSustainMode() { LaneInfo laneInfo = editor.laneInfo; UpdateSnappedPos(); bool wantCommandPop = currentlyAddingNotes.Count > 0; int currentNoteCount = currentlyAddingNotes.Count; bool refreshActions = false; FillNotesKeyboardControlsSustainMode(laneInfo); bool extendedSustainsEnabled = GameSettings.extendedSustainsEnabled; // Update sustain lengths of notes that are already in for (int i = 0; i < heldNotes.Length; ++i) { if (heldNotes[i] != null) // Check if already inserted and no longer being held { foreach (Note chordNote in heldNotes[i].chord) { if (chordNote.tick + chordNote.length < objectSnappedChartPos || (objectSnappedChartPos < chordNote.tick + chordNote.length && chordNote.length > 0)) { chordNote.SetSustainByPos(objectSnappedChartPos, editor.currentSong, extendedSustainsEnabled); Debug.Assert(chordNote.tick + chordNote.length == objectSnappedChartPos, "Sustain was set to an incorrect length"); refreshActions = true; } } } } refreshActions |= currentlyAddingNotes.Count != currentNoteCount; if (currentlyAddingNotes.Count > 0 && refreshActions) { if (wantCommandPop) { editor.commandStack.Pop(); } if (currentPlacementMode == KeysPlacementMode.Adding) { editor.commandStack.Push(new SongEditAdd(currentlyAddingNotes)); } else if (currentPlacementMode == KeysPlacementMode.Deleting) { editor.commandStack.Push(new SongEditDelete(currentlyAddingNotes)); } } if (!HasKeysInput(laneInfo)) { ResetNoteAdding(); } }
public static int GetPadPressedInputMask(this GamepadInput gamepad, LaneInfo laneInfo) { int inputMask = 0; foreach (Note.DrumPad pad in System.Enum.GetValues(typeof(Note.DrumPad))) { if (gamepad.GetPadPressedInput(pad, laneInfo)) { inputMask |= 1 << (int)pad; } } return(inputMask); }
public static int GetPadPressedInputMaskKeyboard(LaneInfo laneInfo) { int inputMask = 0; foreach (Note.DrumPad pad in System.Enum.GetValues(typeof(Note.DrumPad))) { if (GetPadPressedInputKeyboard(pad, laneInfo)) { inputMask |= 1 << (int)pad; } } return(inputMask); }
public static int GetPadPressedInputMask(LaneInfo laneInfo) { int inputMask = 0; foreach (Note.DrumPad pad in EnumX <Note.DrumPad> .Values) { if (GetPadPressedInput(pad, laneInfo)) { inputMask |= 1 << (int)pad; } } return(inputMask); }
// Update is called once per frame protected override void Update() { LaneInfo laneInfo = editor.laneInfo; if (!GameSettings.keysModeEnabled) { BurstRecordingInsertCheck(keysBurstAddHistory); KeysDraggedSustainRecordingCheck(); MouseControlsBurstMode(laneInfo); } else { BurstRecordingInsertCheck(mouseBurstAddHistory); UpdateSnappedPos(); KeysControlsInit(); if (KeysNotePlacementModePanelController.currentPlacementMode == KeysNotePlacementModePanelController.PlacementMode.Sustain) { BurstRecordingInsertCheck(keysBurstAddHistory); for (int i = 0; i < heldNotes.Length; ++i) { if (heldNotes[i] != null) { if (heldNotes[i].song != null) { foreach (Note chordNote in heldNotes[i].chord) { chordNote.SetSustainByPos(objectSnappedChartPos); } } else { // Controls sustain recording KeySustainActionHistoryInsert(i); } } } KeyboardControlsSustainMode(laneInfo); } else { KeysDraggedSustainRecordingCheck(); KeyboardControlsBurstMode(laneInfo); } } }
bool HasKeysInput(LaneInfo laneInfo) { int laneCount = laneInfo.laneCount; for (int i = 0; i < laneCount + 1; ++i) // Start at 1 to ignore the multinote { // Need to make sure the note is at it's correct tick position if (Input.GetKey(NumToStringLUT[(i + 1)])) { return(true); } } return(false); }
public void Update(float time, HitWindow <DrumsNoteHitKnowledge> hitWindow, GamepadInput drumsInput) { uint noteStreak = stats.noteStreak; int missCount = UpdateWindowExit(time, hitWindow); LaneInfo laneInfo = ChartEditor.Instance.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 override void _Ready() { Instance = this; laneInfoList = new Dictionary <Enums.LaneTypes, LaneDetails>() { { Enums.LaneTypes.RoadStraight, new LaneDetails ( GD.Load <Texture>("res://assets/combat/lanes/road-straight.png"), GD.Load <Curve2D>("res://src/combat/lanes/curves/RoadStraight.tres") ) }, { Enums.LaneTypes.RoadEmpty, new LaneDetails ( GD.Load <Texture>("res://assets/combat/lanes/road-empty.png"), new Curve2D() ) } }; }
public static bool GetPadPressedInput(Note.DrumPad drumFret, LaneInfo laneInfo) { Dictionary <Note.DrumPad, MSChartEditorInputActions?> inputOverrideDict; MSChartEditorInputActions?overrideInput; if (laneCountGamepadOverridesDict.TryGetValue(laneInfo.laneCount, out inputOverrideDict) && inputOverrideDict.TryGetValue(drumFret, out overrideInput)) { bool inputFound = false; if (overrideInput != null) { inputFound = MSChartEditorInput.GetInputDown((MSChartEditorInputActions)overrideInput); } return(inputFound); } switch (drumFret) { case Note.DrumPad.Red: return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadRed)); case Note.DrumPad.Yellow: return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadYellow)); case Note.DrumPad.Blue: return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadBlue)); case Note.DrumPad.Orange: return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadOrange)); case Note.DrumPad.Green: return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadGreen)); case Note.DrumPad.Kick: return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadKick)); default: Debug.LogError("Unhandled note type for drum input: " + drumFret); break; } return(false); }
public static string GetDrumString(this Note note, LaneInfo laneInfo) { string str = null; if (laneInfo.laneCount < 5 && note.drumPad == Note.DrumPad.Orange) { str = Note.DrumPad.Green.ToString(); } else { str = note.drumPad.ToString(); } if (note.ShouldBeCulledFromLanes(laneInfo)) { str += " (Lane " + (note.rawNote + 1) + ")"; } return(str); }
// Use this for initialization void Start() { saveLoadRef = SaveLoad.saveLoad; saveRef = saveLoadRef.savedData; startPosZ = transform.position.z; gmRef = GameManager.gameManager; playerRef = gmRef.playerRef; cointoSpawn = Random.Range(coinToSpawnMin, coinToSpawnMax); coinSpawnTimer = Random.Range(coinToSpawnMin, coinToSpawnMax); forwardSpeed = GameObject.FindObjectOfType <PlayerHandler>().forwardSpeed + 0.2f; currentBlock = new LaneInfo[laneQuantity]; previousBlock = new LaneInfo[laneQuantity]; lanes = laneQuantity - 1; laneAngle = (float)360 / laneQuantity; int pathcount = 0; paths = new Paths[10]; firstSpawnPos = transform.position; lastSpawnPos = transform.position; for (int i = 1; i < 10; i++) { paths[i].pathNumber = i; pathcount++; paths[i].laneIn = i; } for (int i = 0; i < laneQuantity; i++) { currentBlock[i].hasPath = false; previousBlock[i].hasPath = false; } gmRef.CheckForCoinSpawn(); //BuildStart(); }
void UpdateDrumPadPresses() { ChartEditor editor = ChartEditor.Instance; LaneInfo laneInfo = editor.laneInfo; foreach (Note.DrumPad drumPad in EnumX <Note.DrumPad> .Values) { if (bannedDrumPadInputs.ContainsKey(drumPad)) { continue; } bool lanePressed = false; switch (Globals.gameSettings.drumsModeOptions) { case GameSettings.DrumModeOptions.ProDrums: { lanePressed = DrumsInput.GetTomPressedInput(drumPad, laneInfo) || DrumsInput.GetCymbalPressedInput(drumPad, laneInfo); break; } default: { lanePressed = DrumsInput.GetPadPressedInput(drumPad, laneInfo); break; } } if (lanePressed) { animations[(int)drumPad].Press(); } else { animations[(int)drumPad].Release(); } } }
void UpdateKeysBurstMode() { LaneInfo laneInfo = editor.laneInfo; UpdateSnappedPos(); KeysDraggedSustainRecordingCheck(); bool wantCommandPop = currentlyAddingNotes.Count > 0; int currentNoteCount = currentlyAddingNotes.Count; bool refreshActions = false; FillNotesKeyboardControlsBurstMode(laneInfo); refreshActions |= currentlyAddingNotes.Count != currentNoteCount; if (currentlyAddingNotes.Count > 0 && refreshActions) { if (wantCommandPop) { editor.commandStack.Pop(); } if (currentPlacementMode == KeysPlacementMode.Adding) { editor.commandStack.Push(new SongEditAdd(currentlyAddingNotes)); } else if (currentPlacementMode == KeysPlacementMode.Deleting) { editor.commandStack.Push(new SongEditDelete(currentlyAddingNotes)); } } if (!HasKeysInput(laneInfo)) { ResetNoteAdding(); } }
public override bool GetLaneInfo(Sim s, out LaneInfo lane) { lane = new PortalComponent.LaneInfo(0x0, new Slot[] { mPortal.GetRoutingSlots()[0], mPortal.GetRoutingSlots()[0] }, PortalComponent.LaneInfoFlags.None); return true; }
public LaneInfo Clone() { var other = new LaneInfo { connectLane = connectLane, junctions = new List<Junction>(junctions) }; return other; }