Пример #1
0
 private void Boss()
 {
     AudioStatus = false;
     CorePlayMusicPlayer.Instance.PauseMusic();
     m_EiderStatus = EiderStatus.Boss;
     m_EditerBoss.Open();
 }
Пример #2
0
 private void Select()
 {
     if (AudioStatus)
     {
         AudioStatus = false;
         CorePlayMusicPlayer.Instance.PauseMusic();
     }
     m_EiderStatus = EiderStatus.Select;
 }
Пример #3
0
    private void Start()
    {
        m_Editing       = false;
        m_ChangeHitNode = false;
        m_SelectStatus  = false;
        m_EiderStatus   = EiderStatus.Nomal;
        ClearHitNodeNow();
        m_AudioTimeLast = 0f;
        m_StartToEnd    = transform.Find("StartToEnd");

        m_Cibiao      = transform.Find("Cibiao").Find("Cibiao1").Find("Cibiao1");
        m_CibiaoY     = m_Cibiao.GetComponent <RectTransform>().localPosition.y;
        m_CibiaoSizeX = m_Cibiao.GetComponent <RectTransform>().sizeDelta.x;

        m_EditerBoss = transform.Find("EditerBoss").GetComponent <EditBossNode>();
        m_EditerBoss.Init();
        m_EditerBoss.Close();

        AudioStatus      = false;
        m_ChangeSentence = false;
        m_StartToEnd.gameObject.SetActive(false);
        transform.Find("Select").GetComponent <Button>().onClick.AddListener(Select);
        transform.Find("Circle").GetComponent <Button>().onClick.AddListener(Circle);
        transform.Find("Enter").GetComponent <Button>().onClick.AddListener(Enter);
        transform.Find("Back").GetComponent <Button>().onClick.AddListener(Back);
        transform.Find("KeyList").GetComponent <Button>().onClick.AddListener(KeyList);
        transform.Find("Sentence").GetComponent <Button>().onClick.AddListener(Sentence);
        transform.Find("PlayAudio").Find("Play").GetComponent <Button>().onClick.AddListener(Play);
        transform.Find("PlayAudio").Find("Pause").GetComponent <Button>().onClick.AddListener(Pause);
        transform.Find("PlayAudio").Find("Stop").GetComponent <Button>().onClick.AddListener(Stop);
        transform.Find("Boss").GetComponent <Button>().onClick.AddListener(Boss);

        m_EditWordContent = transform.Find("HitContentEditNode").GetComponent <HitContentEditNode>();
        m_EditWordContent.Init();
        m_EditWordContent.Close();
    }
Пример #4
0
    void Update()
    {
        CanvasScaler canvas = GameObject.Find("Canvas").GetComponent <CanvasScaler>();

        if (m_EiderStatus == EiderStatus.Nomal && m_Editing == false)
        {
            #region 普通点
            if (AudioStatus == false)
            {
                CorePlayMusicPlayer.Instance.PauseMusic();
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                AudioStatus = !AudioStatus;
                if (AudioStatus)
                {
                    CorePlayMusicPlayer.Instance.PlaySong(m_AudioFileName);
                }
                else
                {
                    CorePlayMusicPlayer.Instance.PauseMusic();
                }
            }
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Back();
            }

            if (Input.GetKeyUp(KeyCode.V) && m_CopyList.Count > 0)
            {
                PasteList();
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if (AudioStatus)
                {
                    AudioStatus = false;
                    CorePlayMusicPlayer.Instance.PauseMusic();
                }
                CorePlayMusicPlayer.Instance.MoveSongTime(-60f / EiderToolPage.Instance.SongObject.SongInfos.BPM / 16);
            }
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                if (AudioStatus)
                {
                    AudioStatus = false;
                    CorePlayMusicPlayer.Instance.PauseMusic();
                }
                CorePlayMusicPlayer.Instance.MoveSongTime(60f / EiderToolPage.Instance.SongObject.SongInfos.BPM / 16);
            }

            float a = Input.mouseScrollDelta.y;
            if (a != 0)
            {
                if (AudioStatus)
                {
                    AudioStatus = false;
                    CorePlayMusicPlayer.Instance.PauseMusic();
                }
                CorePlayMusicPlayer.Instance.MoveSongTime(a * 60f / EiderToolPage.Instance.SongObject.SongInfos.BPM / 16);
            }

            if (Input.GetMouseButtonDown(0))
            {
                m_SelectStatus = true;
                ClickResult click = GetClick();
                if (click.ClickStatus != ClickResult.ClickType.ClickNothing)
                {
                    if (AudioStatus)
                    {
                        AudioStatus = false;
                        CorePlayMusicPlayer.Instance.PauseMusic();
                    }
                }
                else
                {
                    m_SelectStatus = false;
                }

                if (click.ClickStatus == ClickResult.ClickType.ClickHitPosition)
                {
                    m_HitNodeNow[click.ClickNo].ChangeStatus = HitNode.ChangeType.ChangePosition;
                    m_HitNodeNow[click.ClickNo].transform.SetAsLastSibling();
                }
                else if (click.ClickStatus == ClickResult.ClickType.ClickHitTime)
                {
                    m_HitNodeNow[click.ClickNo].ChangeStatus = HitNode.ChangeType.ChangeTime;
                    m_HitNodeNow[click.ClickNo].transform.SetAsLastSibling();
                }
            }

            if (Input.GetMouseButtonDown(1))
            {
                m_SelectStatus = true;
                ClickResult click = GetClick();
                if (click.ClickStatus != ClickResult.ClickType.ClickNothing)
                {
                    if (AudioStatus)
                    {
                        AudioStatus = false;
                        CorePlayMusicPlayer.Instance.PauseMusic();
                    }
                    m_ChangeHitNode = true;
                    EiderToolPage.Instance.SongObject.HitInfos = DeleteHitNode(click.ClickNo, EiderToolPage.Instance.SongObject.HitInfos);
                    Destroy(m_HitNodeNow[click.ClickNo].gameObject);
                    for (int i = click.ClickNo; i < EiderToolPage.Instance.SongObject.HitInfos.Count + 1; i++)
                    {
                        if (m_HitNodeNow.ContainsKey(i + 1))
                        {
                            m_HitNodeNow[i] = m_HitNodeNow[i + 1];
                        }
                        else
                        {
                            m_HitNodeNow.Remove(i);
                            break;
                        }
                    }
                    m_ChangeHitNode = false;
                }
                else
                {
                    m_SelectStatus = false;
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                m_SelectStatus = false;
            }

            if (Input.GetMouseButtonUp(1))
            {
                m_SelectStatus = false;
            }

            float  audioTimeNow = CorePlayMusicPlayer.Instance.GetBgmTime();
            int    audioTime    = (int)(audioTimeNow * 1000);
            int    ms           = audioTime % 1000;
            int    s            = (audioTime / 1000) % 60;
            int    m            = (audioTime / 1000) / 60;
            string timeNow      = m + ":" + s + "." + ms;
            transform.Find("PlayAudio").Find("NowTime").Find("Text").GetComponent <Text>().text = timeNow;
            m_HitTimeStart = (int)(audioTimeNow * 1000 - 6000);
            m_HitTimeEnd   = (int)(audioTimeNow * 1000 + 6000);
            MoveCibiao(audioTimeNow - m_AudioTimeLast);
            m_AudioTimeLast = audioTimeNow;
            if (m_ChangeHitNode == false)
            {
                HitNodeStatus();
            }
            if (AudioStatus && m_ChangeSentence)
            {
                ResetSentence();
            }
            #endregion
        }
        else if (m_EiderStatus == EiderStatus.Select && m_Editing == false)
        {
            if (Input.GetMouseButtonDown(0))
            {
                m_selectStart = Input.mousePosition;
                m_selectEnd   = m_selectStart;
                Down          = true;
            }
            else if (Input.GetMouseButton(0))
            {
                m_selectEnd             = Input.mousePosition;
                m_SelectResult.position = (m_selectStart + m_selectEnd) / 2f;
                m_SelectResult.GetComponent <RectTransform>().sizeDelta = new Vector2(Mathf.Abs(m_selectStart.x - m_selectEnd.x) / Screen.width * canvas.referenceResolution.x, Mathf.Abs(m_selectStart.y - m_selectEnd.y) / Screen.height * canvas.referenceResolution.y);
            }
            else if (Input.GetMouseButtonUp(0) && Down)
            {
                m_selectEnd             = Input.mousePosition;
                m_SelectResult.position = (m_selectStart + m_selectEnd) / 2f;
                m_SelectPosition        = m_SelectResult.position;
                m_SelectResult.GetComponent <RectTransform>().sizeDelta = new Vector2(Mathf.Abs(m_selectStart.x - m_selectEnd.x) / Screen.width * canvas.referenceResolution.x, Mathf.Abs(m_selectStart.y - m_selectEnd.y) / Screen.height * canvas.referenceResolution.y);
                GetSelectList();
                if (m_SelectList.Count == 0)
                {
                    m_EiderStatus = EiderStatus.Nomal;
                }
                else
                {
                    m_EiderStatus = EiderStatus.Batch;
                }
                Down = false;
            }
        }
        else if (m_EiderStatus == EiderStatus.Batch && m_Editing == false)
        {
            if (Input.GetMouseButtonDown(1))
            {
                List <int> tempHitTime = new List <int>(m_SelectList.Keys);
                for (int i = 0; i < tempHitTime.Count; i++)
                {
                    EiderToolPage.Instance.SongObject.HitInfos = DeleteHitNode(tempHitTime[0], EiderToolPage.Instance.SongObject.HitInfos);
                    Destroy(m_HitNodeNow[tempHitTime[0]].gameObject);
                    for (int j = tempHitTime[0]; j < EiderToolPage.Instance.SongObject.HitInfos.Count + 1; j++)
                    {
                        if (m_HitNodeNow.ContainsKey(j + 1))
                        {
                            m_HitNodeNow[j] = m_HitNodeNow[j + 1];
                        }
                        else
                        {
                            m_HitNodeNow.Remove(j);
                            break;
                        }
                    }
                }
                m_SelectList.Clear();
                m_SelectTimePosition.Clear();
                m_SelectResult.localPosition = Vector3.zero;
                m_SelectResult.GetComponent <RectTransform>().sizeDelta = Vector2.zero;
                m_EiderStatus = EiderStatus.Nomal;
            }
            else if (Input.GetMouseButtonDown(0))
            {
                Down        = true;
                m_DragStart = Input.mousePosition;
                m_DragEnd   = m_DragStart;
            }
            else if (Input.GetMouseButton(0))
            {
                m_DragEnd = Input.mousePosition;
                BatchDrag();
            }
            else if (Input.GetMouseButtonUp(0))
            {
                m_DragEnd = Input.mousePosition;
                BatchDrag();
                Down = false;
                m_SelectResult.localPosition = Vector3.zero;
                m_SelectResult.GetComponent <RectTransform>().sizeDelta = Vector2.zero;
                m_SelectList.Clear();
                m_SelectTimePosition.Clear();
                m_EiderStatus = EiderStatus.Nomal;
            }
            else if (Input.GetKeyUp(KeyCode.C))
            {
                GetCopyList();
                m_SelectResult.localPosition = Vector3.zero;
                m_SelectResult.GetComponent <RectTransform>().sizeDelta = Vector2.zero;
                m_SelectList.Clear();
                m_SelectTimePosition.Clear();
                m_EiderStatus = EiderStatus.Nomal;
            }
        }
    }