Example #1
0
        //new ImportModForm ImportForm;
        public ModImportOptions() : base(Midi.FileType.Mod)
        {
            //ImportForm = (ImportModForm)base.ImportForm; //Cast base import form to ModImportForm to access InsTrack property
            string ext = NotePath?.Split('.').Last().ToUpper();
            bool   xmPlayMixdownSupported = XmPlayFormats.Contains(ext);

            MixdownType = xmPlayMixdownSupported && Form1.TpartyIntegrationForm.ModuleMixdown ? Midi.MixdownType.Tparty : Midi.MixdownType.Internal;
            //InsTrack = ImportForm.InsTrack;
            MixdownAppPath = TpartyIntegrationForm.XmPlayPath;
            MixdownAppArgs = "\"%notefilepath\" -boost";
        }
Example #2
0
    // Returns a cancellation request to the Update Finger function
    public bool UpdateFingerState()
    {
        // Tap -> Hold
        if (fingerState == FingerState.TAP || fingerState == FingerState.TRANSITION || fingerState == FingerState.RESET)
        {
            fingerState = FingerState.HOLD;
            return(true);
        }

        // Check Hold -> Transition
#if UNITY_EDITOR
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
#elif UNITY_ANDROID
        Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(FingerID).position);
#endif
        RaycastHit hit;

        NotePath np = null;

        if (Physics.Raycast(ray, out hit, 100f, player.layermask))
        {
            if (hit.collider.tag == "NotePath")
            {
                np         = hit.collider.gameObject.GetComponent <NotePath>();
                notePathID = np.NotePathID;
                // Debug.Log("Android Debug: Currently Holding on Note Path: " + hitObjects[i].collider.gameObject.GetComponent<NotePath>() + ", previous Note Path was :);
            }
        }

        if (np = null)
        {
            return(true);
        }

        if (previousNotePathID != notePathID)
        {
            fingerState = FingerState.TRANSITION;
            return(false);
        }

        return(false);
    }
Example #3
0
    private void FingerTap()
    {
        Ray ray = Camera.main.ScreenPointToRay(this.initialPosition);

        Debug.Log("Init Position: " + initialPosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100f, player.layermask))
        {
            // If we hit a Notepath...
            if (hit.collider.tag == "NotePath")
            {
                NotePath hitPath = hit.collider.gameObject.GetComponent <NotePath>();
                notePathID         = hitPath.NotePathID;
                previousNotePathID = notePathID;
                NoteType noteType = hitPath.CheckIfValidHit();

                if (noteType != NoteType.NULL)
                {
                    ActiveNote = hitPath.ActiveNotes[0];
                }

                hitPath.Tapped();

                player.hitNotePathWithFinger = true;
            }

            // Edit this code to match what we want for new drag notes.
            else if (hit.collider.tag == "Hitbar")
            {
                // To be replaced with setting finger position to the hitbar.
                // slider = player.Slider.GetComponent<Slider>();
                // slider.SetSliderRelativeToFinger(FingerID, hit.point);
                fingerState = FingerState.SLIDE;
            }
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        // Detect a touch from the screen.
        if (Input.GetButtonDown("Touch"))
        {
            //GameObject note = GameObject.Find("Note");
            //note.GetComponent<Note>().ChangeMaterial();

            // Add one to the touches list.
            fingersTouching += 1;

            // Player clicks...
            // Determine which Notepath was hit.
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            RaycastHit[] hitObjects = Physics.RaycastAll(ray, 1000f, layermask);
            NotePath hitPath;
            Debug.Log("Number of objects hit: " + hitObjects.Length);
            for (int i = 0; i < hitObjects.Length; i++)
            {
                // If we hit a Notepath...
                if (hitObjects[i].collider.tag == "NotePath")
                {
                    hitPath = hitObjects[i].collider.gameObject.GetComponent<NotePath>();
                    Debug.Log("Hit Object: " + hitPath.name);
                    flickDragEnabled = hitPath.CheckIfValidHit();
                    if (flickDragEnabled)
                    {
                        Debug.Log("Time to drag!");
                        endFlickPath = NotePath.NotePaths[hitPath.ActiveNotes[0].pathEnd];
                        activeNoteFlick = (NoteFlick)hitPath.ActiveNotes[0];
                    }
                    break;
                }

                // Drag the sliderbar
                else if (hitObjects[i].collider.tag == "SliderBar")
                {
                    Debug.Log("We have hit the sliderbar");
                    // First, center the slider to the mouse position, and set the offset
                    Slider.transform.position = new Vector3(hitObjects[i].point.x, Slider.transform.position.y, Slider.transform.position.z);
                    offset = Slider.transform.position - hitObjects[i].point;
                    distanceFromRayOrigin = (ray.origin - hitObjects[i].point).magnitude;
                    sliderDragEnabled = true;
                    // Here we will cache the touch ID and send it to the Sliderbar
                }
            }
        }

        // Remove that finger from the amount of total fingers touching
        if (Input.GetButtonUp("Touch"))
        {
            fingersTouching -= 1;
            sliderDragEnabled = false;
            flickDragEnabled = false;
        }

        // If we are dragging an the slider
        else if (sliderDragEnabled)
        {
            // This will be replaced with finger location via finger ID
            // TODO: See if there is an easier way to do this 1-Dimmentional Movement
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            Vector3 oldPosition = Slider.transform.position;
            Vector3 newXPosition = ray.GetPoint(distanceFromRayOrigin) + offset;
            Slider.transform.position = new Vector3(newXPosition.x, oldPosition.y, oldPosition.z);
        }

        // If the player is currently flicking
        if (flickDragEnabled)
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit[] hitObjects = Physics.RaycastAll(ray, 1000f, layermask);
            Debug.Log("We have hit: " + hitObjects.Length);
            for (int i = 0; i < hitObjects.Length; i++)
            {
                if (hitObjects[i].collider.tag == "NotePath")
                {
                    Debug.Log("Currently dragging along path: " + hitObjects[i].collider.gameObject.GetComponent<NotePath>().NotePathID);
                    if (hitObjects[i].collider.gameObject.GetComponent<NotePath>().NotePathID == endFlickPath.NotePathID && activeNoteFlick != null)
                    {
                        activeNoteFlick.CalculateError();
                        activeNoteFlick = null;
                    }
                }
            }

            /* Code that should work, but for some reason, doesn't
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, mask))
            {
                Debug.Log(hit.collider.name);
                Debug.Log("We are currently dragging along path " + hit.collider.gameObject.GetComponent<NotePath>().NotePathID);
            } */
        }
    }