Exemplo n.º 1
0
    public void PlayTraj()
    {
        PlayButton.SetActive(false);
        PauseButton.SetActive(true);
        FrameSlider.GetComponent <SliderGestureControl>().SetSpan(0, framenum - 1);
        SpeedSlider.GetComponent <SliderGestureControl>().SetSpan(0, 100);
        SpeedSlider.GetComponent <SliderGestureControl>().SetSliderValue(25);
        //Time.timeScale = 1;
        //GameObject.Find("PlayButton").AddComponent<PlayButton2>();

        // gets the total number of frames from Load
        //framenum = Manager.GetComponent<Load>().framenum;


        StartCoroutine("Traj");
    }
Exemplo n.º 2
0
    IEnumerator Traj()
    {
        while (true)
        {
            //MoleculeCollection.transform.rotation = new Quaternion(0, 0, 0, 0);
            //Manager.GetComponent<DestroyPrimitive>().DestroyObjects();
            i = Convert.ToInt32(FrameSlider.GetComponent <SliderGestureControl>().SliderValue);

            if (Manager.GetComponent <Load>().dynamicBonds)
            {
                // TODO: Have bonds form/break depending on distance if dynamic bonds is turned on
            }

            // move the spheres for bns model so they are where they should be for current frame
            transform.parent.GetComponent <BallAndStick>().MoveSpheres(i);
            // update the text below the play button to display the current frame
            //txt.GetComponent<ChangeText>().currentFrame = i;
            //txt.GetComponent<ChangeText>().ChangeIt();

            speed = 100f / ((SpeedSlider.GetComponent <SliderGestureControl>().SliderValue + 1) * framenum); // TODO: get this from another class which is for a slider or smth later

            // Wait for a small amount of time before proceeding
            yield return(new WaitForSeconds(speed));

            // reset slider to 0 if it reaches the max value so it loops
            if (i == FrameSlider.GetComponent <SliderGestureControl>().MaxSliderValue)
            {
                FrameSlider.GetComponent <SliderGestureControl>().SetSliderValue(0);

                // move the spheres to where the should be for frame 0
                transform.parent.GetComponent <BallAndStick>().MoveSpheres(i);
                // make currentframe display 0
                //txt.GetComponent<ChangeText>().currentFrame = i;
                //txt.GetComponent<ChangeText>().ChangeIt();

                //wait for a small amount of time before proceeding
                yield return(new WaitForSeconds(speed));
            }

            // increment the slider value to go to the next frame
            FrameSlider.GetComponent <SliderGestureControl>().SetSliderValue((Convert.ToInt32(FrameSlider.GetComponent <SliderGestureControl>().SliderValue) + 1));
        }
    }
        /// <summary>
        /// </summary>
        /// <returns><c>true</c>, if pressed was oned, <c>false</c> otherwise.</returns>
        /// <param name="action">Action.</param>
        protected void OnKeyAction(BaseAction action)
        {
            if (action == null)
            {
                return;
            }

            if (action is KeyAction keyAction)
            {
                if ((keyAction?.Press ?? false) == false)
                {
                    return;
                }

                switch (keyAction.KaraokeKeyAction)
                {
                case KaraokeKeyAction.FirstLyric:
                    FirstLyricButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.PreviousLyric:
                    PreviousLyricButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.NextLyric:
                    NextLyricButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.PlayAndPause:
                    PlayPauseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.IncreaseSpeed:
                    SpeedSlider.IncreaseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.DecreaseSpeed:
                    SpeedSlider.DecreaseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.ResetSpeed:
                    SpeedSlider.ResetToDefauleValue();
                    break;


                case KaraokeKeyAction.IncreaseTone:
                    ToneSlider.IncreaseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.DecreaseTone:
                    ToneSlider.DecreaseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.ResetTone:
                    ToneSlider.ResetToDefauleValue();
                    break;


                case KaraokeKeyAction.IncreaseLyricAppearTime:
                    LyricOffectSlider.IncreaseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.DecreaseLyricAppearTime:
                    LyricOffectSlider.DecreaseButton.Action?.Invoke();
                    break;

                case KaraokeKeyAction.ResetLyricAppearTime:
                    LyricOffectSlider.ResetToDefauleValue();
                    break;

                case KaraokeKeyAction.OpenPanel:
                    ToggleVisibility();
                    break;
                }
            }
            else if (action is TapAction tapAction)
            {
            }
            else if (action is ScrollAction scrollAction)
            {
            }
        }
Exemplo n.º 4
0
 private void Awake()
 {
     instance = this;
 }