//Wrapper function for setting the hand types of both targets. public void SetHandType(TargetHandType newType) { gridTargetIcon.SetHandType(newType); timelineTargetIcon.SetHandType(newType); handType = newType; //Handedness changes how the note is visually displayed in the timeline float xOffset = timelineTargetIcon.transform.localPosition.x; float yOffset = 0; float zOffset = 0; switch (handType) { case TargetHandType.Left: yOffset = 0.1f; zOffset = 0.1f; break; case TargetHandType.Right: yOffset = -0.1f; zOffset = 0.2f; break; } timelineTargetIcon.transform.localPosition = new Vector3(xOffset, yOffset, zOffset); }
//Wrapper function for setting the hand types of both targets. private void OnHandTypeChanged(TargetHandType newType) { //Handedness changes how the note is visually displayed in the timeline float xOffset = timelineTargetIcon.transform.localPosition.x; float yOffset = 0; float zOffset = 0; switch (data.handType) { case TargetHandType.Left: yOffset = 0.1f; zOffset = 0.1f; break; case TargetHandType.Right: yOffset = -0.1f; zOffset = 0.2f; break; } timelineTargetIcon.transform.localPosition = new Vector3(xOffset, yOffset, zOffset); if (data.behavior == TargetBehavior.NR_Pathbuilder) { foreach (TargetData note in data.pathBuilderData.generatedNotes) { note.handType = newType; } } }
public void SelectHand(TargetHandType type) { selectedHand = type; uiToolSelect.UpdateUINoteSelected(selectedTool); handTypeSelect.UpdateUI(type); hover.UpdateUIHandColor(GetSelectedColor()); }
public void Initialize(Bookmark b, string _text, TargetHandType _handType, float _xPosMini) { mini = b; text.text = _text; handType = _handType; xPosMini = _xPosMini; originalScale = transform.localScale; }
/*public void JumpToBookmark(int i) { * if (bookmarks[i] == null) return; * timeline.JumpToPercent((float)bookmarks[i].GetComponent<Bookmark>().percentBookmark); * * }*/ /* * public void SetBookmark(int i) { * * if (bookmarks[i] != null) { * Destroy(bookmarks[i]); * bookmarks[i] = null; * } * * bookmarks[i] = Instantiate(bookmarkPrefab, new Vector3(0, 0, 0), Quaternion.identity, bookmarksParent); * * double percent = timeline.GetPercentagePlayed(); * double x = barLength * percent; * x -= barLength / 2; * * bookmarks[i].transform.localPosition = new Vector3((float)x, 0, 0); * * bookmarks[i].GetComponent<Bookmark>().SetIndex(i); * bookmarks[i].GetComponent<Bookmark>().percentBookmark = percent; * } */ public void SetBookmark(float miniXPos, float topXPos, TargetHandType newType, bool useTopXPos, bool addToAudicaFile = false) { Bookmark bookmarkMini = Instantiate(bookmarkPrefab, new Vector3(0, 0, 0), Quaternion.identity, bookmarksParent).GetComponent <Bookmark>(); Bookmark bookmarkTop = Instantiate(bookmarkPrefab, Timeline.timelineNotesStatic).GetComponent <Bookmark>(); Color background; bookmarkMini.transform.localPosition = new Vector3((float)miniXPos, 0, 0); //bookmarkTop.transform.localScale = new Vector3(0.06f, 0.006f, 0.06f); if (!useTopXPos) { if (newType == TargetHandType.Left) { bookmarkTop.transform.position = new Vector3(0, bookmarkTop.transform.position.y - 0.6f, 0); background = Color.green; } else { bookmarkTop.transform.position = new Vector3(0, bookmarkTop.transform.position.y - 0.72f, 0); background = Color.red; } } else { if (newType == TargetHandType.Left) { bookmarkTop.transform.localPosition = new Vector3(topXPos, bookmarkTop.transform.localPosition.y - 0.6f, 0); background = Color.green; } else { bookmarkTop.transform.localPosition = new Vector3(topXPos, bookmarkTop.transform.localPosition.y - 0.72f, 0); background = Color.red; } } bookmarkMini.GetComponent <SpriteRenderer>().color = background; bookmarkTop.GetComponent <SpriteRenderer>().color = background; bookmarkTop.GetComponent <SpriteRenderer>().size = new Vector2(0.07f, 0.1f); bookmarks.Add(bookmarkMini); bookmarks.Add(bookmarkTop); if (addToAudicaFile) { Timeline.audicaFile.desc.bookmarks.Add(new BookmarkData() { type = newType, xPosMini = miniXPos, xPosTop = bookmarkTop.transform.localPosition.x }); } }
public TargetData(Target target) { x = target.gridTargetIcon.transform.localPosition.x; y = target.gridTargetIcon.transform.localPosition.y; beatTime = target.gridTargetIcon.transform.localPosition.z; beatLength = target.beatLength; velocity = target.velocity; handType = target.handType; behavior = target.behavior; }
public TargetData(Cue cue, float offset) { Vector2 pos = NotePosCalc.PitchToPos(cue); x = pos.x; y = pos.y; beatTime = (cue.tick - offset) / 480f; beatLength = cue.tickLength; velocity = cue.velocity; handType = cue.handType; behavior = cue.behavior; }
public void SetHandType(TargetHandType handType) { foreach (Renderer r in gameObject.GetComponentsInChildren <Renderer>(true)) { switch (handType) { case TargetHandType.Left: r.material.SetColor("_Tint", leftColor); break; case TargetHandType.Right: r.material.SetColor("_Tint", rightColor); break; case TargetHandType.Either: r.material.SetColor("_Tint", eitherColor); break; default: r.material.SetColor("_Tint", noneColor); break; } } foreach (LineRenderer l in gameObject.GetComponentsInChildren <LineRenderer>(true)) { switch (handType) { case TargetHandType.Left: l.startColor = leftColor; l.endColor = leftColor; sustainDirection = 0.6f; break; case TargetHandType.Right: l.startColor = rightColor; l.endColor = rightColor; sustainDirection = -0.6f; break; case TargetHandType.Either: l.startColor = eitherColor; l.endColor = eitherColor; sustainDirection = 0.6f; break; default: l.startColor = noneColor; l.endColor = noneColor; sustainDirection = 0.6f; break; } } }
public void UpdateUI(TargetHandType type) { switch (type) { case TargetHandType.Left: lrText.SetText("Left"); lrText.DOColor(NRSettings.config.leftColor, (float)NRSettings.config.UIFadeDuration); break; case TargetHandType.Right: lrText.SetText("Right"); lrText.DOColor(NRSettings.config.rightColor, (float)NRSettings.config.UIFadeDuration); break; case TargetHandType.Either: lrText.SetText("Either"); lrText.DOColor(Color.gray, (float)NRSettings.config.UIFadeDuration); break; } }
public void CreateTarget(QNT_Timestamp time, TargetBehavior behavior, TargetHandType hand, Vector2?position = null) { if (!position.HasValue) { position = new Vector2(0, 0); } TargetData data = new TargetData(); data.x = position.Value.x; data.y = position.Value.y; data.handType = hand; data.behavior = behavior; data.SetTimeFromAction(time); var action = new NRActionAddNote { targetData = data }; timeline.Tools.undoRedoManager.AddAction(action); }
//Wrapper function for setting the hand types of both targets. private void OnHandTypeChanged(TargetHandType newType) { //Handedness changes how the note is visually displayed in the timeline float xOffset = timelineTargetIcon.transform.localPosition.x; float yOffset = 0; float zOffset = 0; switch (data.handType) { case TargetHandType.Left: yOffset = 0.1f; zOffset = 0.1f; break; case TargetHandType.Right: yOffset = -0.1f; zOffset = 0.2f; break; } timelineTargetIcon.transform.localPosition = new Vector3(xOffset, yOffset, zOffset); }
public void AddTarget(float x, float y, float beatTime, float beatLength = 0.25f, TargetVelocity velocity = TargetVelocity.Standard, TargetHandType handType = TargetHandType.Either, TargetBehavior behavior = TargetBehavior.Standard, bool userAdded = false) { // Add to timeline var timelineClone = Instantiate(timelineNotePrefab, timelineNotes); timelineClone.transform.localPosition = new Vector3(beatTime, 0, 0); // Add to grid var gridClone = Instantiate(gridNotePrefab, gridNotes); gridClone.GetComponentInChildren <HoldController>().length.text = "" + beatLength; gridClone.transform.localPosition = new Vector3(x, y, beatTime); gridClone.timelineTarget = timelineClone; timelineClone.timelineTarget = timelineClone; gridClone.gridTarget = gridClone; timelineClone.gridTarget = gridClone; //set velocity if (userAdded) { switch (CurrentSound) { case OptionsMenu.DropdownToVelocity.Standard: gridClone.velocity = TargetVelocity.Standard; break; case OptionsMenu.DropdownToVelocity.Snare: gridClone.velocity = TargetVelocity.Snare; break; case OptionsMenu.DropdownToVelocity.Percussion: gridClone.velocity = TargetVelocity.Percussion; break; case OptionsMenu.DropdownToVelocity.ChainStart: gridClone.velocity = TargetVelocity.ChainStart; break; case OptionsMenu.DropdownToVelocity.Chain: gridClone.velocity = TargetVelocity.Chain; break; case OptionsMenu.DropdownToVelocity.Melee: gridClone.velocity = TargetVelocity.Melee; break; default: gridClone.velocity = velocity; break; } } else { gridClone.SetVelocity(velocity); } gridClone.SetHandType(handType); gridClone.SetBehavior(behavior); if (gridClone.behavior == TargetBehavior.Hold) { gridClone.SetBeatLength(beatLength); } else { gridClone.SetBeatLength(0.25f); } notes.Add(gridClone); notesTimeline.Add(timelineClone); orderedNotes = notes.OrderBy(v => v.transform.position.z).ToList(); UpdateTrail(); UpdateChainConnectors(); }
internal void SetHandType(TargetHandType handType) { gridTarget.handType = handType; gridTarget.icon.SetHandType(handType); timelineTarget.icon.SetHandType(handType); }
public Bookmark SetBookmark(float miniXPos, float topXPos, TargetHandType newType, string text, Color myColor, BookmarkUIColor uiCol, bool useTopXPos, bool fromLoad = false) { Bookmark bookmarkMini = Instantiate(bookmarkPrefab, new Vector3(0, 0, 0), Quaternion.identity, bookmarksParent).GetComponent <Bookmark>(); Bookmark bookmarkTop = Instantiate(bookmarkPrefab, Timeline.timelineNotesStatic).GetComponent <Bookmark>(); bookmarkMini.gameObject.layer = 0; Color background = fromLoad ? myColor : BookmarkColorPicker.selectedColor; bookmarkMini.transform.localPosition = new Vector3((float)miniXPos, 0, 0); //bookmarkTop.transform.localScale = new Vector3(.05f, .03f, 1f); //bookmarkTop.transform.localScale = new Vector3(0.06f, 0.006f, 0.06f); if (!useTopXPos) { if (newType == TargetHandType.Left) { bookmarkTop.transform.position = new Vector3(0, bookmarkTop.transform.position.y - .85f, 0); //background = Color.green; } else { bookmarkTop.transform.position = new Vector3(0, bookmarkTop.transform.position.y - .85f, 0); //background = Color.red; } } else { if (newType == TargetHandType.Left) { bookmarkTop.transform.localPosition = new Vector3(topXPos, bookmarkTop.transform.localPosition.y - .85f, 0); //background = Color.green; } else { bookmarkTop.transform.localPosition = new Vector3(topXPos, bookmarkTop.transform.localPosition.y - .85f, 0); //background = Color.red; } } //bookmarkMini.GetComponent<SpriteRenderer>().color = background; //bookmarkTop.GetComponent<SpriteRenderer>().color = background; bookmarkMini.transform.localScale = new Vector3(1f, 1f, 1f); if (fromLoad) { bookmarkTop.FixScaling(); } /*bookmarkTop.GetComponent<SpriteRenderer>().size = new Vector2(0.1f, 22f); * bookmarkTop.GetComponent<BoxCollider2D>().size = new Vector2(.1f, 22f); * bookmarkTop.GetComponentInChildren<TMPro.TextMeshProUGUI>().rectTransform.localPosition = new Vector3(26, -730, 0); * bookmarkTop.GetComponentInChildren<TMPro.TextMeshProUGUI>().rectTransform.localScale = new Vector3(1.3f, .1f, 1f);*/ //bookmarkTop.transform.localScale = new Vector3(.05f, .03f, 1f); //bookmarkTop.glow.transform.localPosition = new Vector3(0f, -.35f, 0f); bookmarkTop.Initialize(bookmarkMini, text, newType, miniXPos); bookmarkTop.SetColor(background, fromLoad ? uiCol : BookmarkColorPicker.selectedUIColor); //bookmarks.Add(bookmarkMini); bookmarks.Add(bookmarkTop); return(bookmarkTop); }
private void OnHandTypeChanged(TargetHandType handType) { foreach (Renderer r in gameObject.GetComponentsInChildren <Renderer>(true)) { if (r.name == "WhiteRing") { continue; } switch (handType) { case TargetHandType.Left: r.material.SetColor("_Tint", NRSettings.config.leftColor); break; case TargetHandType.Right: r.material.SetColor("_Tint", NRSettings.config.rightColor); break; case TargetHandType.Either: r.material.SetColor("_Tint", UserPrefsManager.bothColor); break; default: r.material.SetColor("_Tint", UserPrefsManager.neitherColor); break; } } foreach (LineRenderer l in gameObject.GetComponentsInChildren <LineRenderer>(true)) { if (data.behavior == TargetBehavior.NR_Pathbuilder) { handType = data.pathBuilderData.handType; } switch (handType) { case TargetHandType.Left: l.startColor = NRSettings.config.leftColor; l.endColor = NRSettings.config.leftColor; sustainDirection = 0.6f; break; case TargetHandType.Right: l.startColor = NRSettings.config.rightColor; l.endColor = NRSettings.config.rightColor; sustainDirection = -0.6f; break; case TargetHandType.Either: l.startColor = UserPrefsManager.bothColor; l.endColor = UserPrefsManager.bothColor; sustainDirection = 0.6f; break; default: l.startColor = UserPrefsManager.neitherColor; l.endColor = UserPrefsManager.neitherColor; sustainDirection = 0.6f; break; } if (data.supportsBeatLength && l.positionCount >= 3) { l.SetPosition(1, new Vector3(0.0f, sustainDirection, 0.0f)); var pos2 = l.GetPosition(2); l.SetPosition(2, new Vector3(pos2.x, sustainDirection, pos2.z)); } } }
public void AddTarget(float x, float y, float beatTime, float beatLength = 1, TargetVelocity velocity = TargetVelocity.Standard, TargetHandType handType = TargetHandType.Either, TargetBehavior behavior = TargetBehavior.Standard) { // Add to timeline var timelineClone = Instantiate(timelineNotePrefab, timelineNotes); timelineClone.transform.localPosition = new Vector3(beatTime, 0, 0); // Add to grid var gridClone = Instantiate(gridNotePrefab, gridNotes); gridClone.transform.localPosition = new Vector3(x, y, beatTime); gridClone.timelineTarget = timelineClone; timelineClone.timelineTarget = timelineClone; gridClone.gridTarget = gridClone; timelineClone.gridTarget = gridClone; gridClone.SetHandType(handType); gridClone.SetBehavior(behavior); gridClone.SetBeatLength(beatLength); gridClone.SetVelocity(velocity); notes.Add(gridClone); UpdateTrail(); }
public static Color GetColorForHandType(TargetHandType handType) => handType switch {
public void SelectTool(EditorTool tool) { if (tool == selectedTool) { return; } uiToolSelect.UpdateUINoteSelected(tool); hover.UpdateUITool(tool); previousTool = selectedTool; selectedTool = tool; if (previousTool == EditorTool.Melee && selectedHand == TargetHandType.Either) { SelectHand(previousHand); } //Update the UI based on the tool: switch (tool) { case EditorTool.Standard: selectedBehavior = TargetBehavior.Standard; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard); SelectVelocity(UITargetVelocity.Standard); SelectSnappingMode(SnappingMode.Grid); break; case EditorTool.Hold: selectedBehavior = TargetBehavior.Hold; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard); SelectVelocity(UITargetVelocity.Standard); SelectSnappingMode(SnappingMode.Grid); break; case EditorTool.Horizontal: selectedBehavior = TargetBehavior.Horizontal; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard); SelectVelocity(UITargetVelocity.Standard); SelectSnappingMode(SnappingMode.Grid); break; case EditorTool.Vertical: selectedBehavior = TargetBehavior.Vertical; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard); SelectVelocity(UITargetVelocity.Standard); SelectSnappingMode(SnappingMode.Grid); break; case EditorTool.ChainStart: selectedBehavior = TargetBehavior.ChainStart; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.ChainStart); SelectVelocity(UITargetVelocity.ChainStart); SelectSnappingMode(SnappingMode.Grid); break; case EditorTool.ChainNode: selectedBehavior = TargetBehavior.Chain; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Chain); SelectVelocity(UITargetVelocity.Chain); SelectSnappingMode(SnappingMode.None); break; case EditorTool.Melee: selectedBehavior = TargetBehavior.Melee; previousHand = selectedHand; soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Melee); SelectVelocity(UITargetVelocity.Melee); SelectSnappingMode(SnappingMode.Melee); SelectHand(TargetHandType.Either); break; case EditorTool.DragSelect: selectedBehavior = TargetBehavior.None; Tools.dragSelect.Activate(true); Tools.chainBuilder.Activate(false); break; case EditorTool.ChainBuilder: selectedBehavior = TargetBehavior.None; Tools.dragSelect.Activate(false); Tools.chainBuilder.Activate(true); break; default: break; } if (tool != EditorTool.ChainBuilder) { Tools.chainBuilder.Activate(false); } if (tool != EditorTool.DragSelect) { Tools.dragSelect.Activate(false); } }
public void SetHandType(TargetHandType handType) { selectedHandType = handType; }