コード例 #1
0
    public void ResetSentence()
    {
        int            audioTime = (int)(CorePlayMusicPlayer.Instance.GetBgmTime() * 1000);
        List <HitInfo> temp      = EiderToolPage.Instance.SongObject.HitInfos;
        int            start     = temp.Count;
        int            end       = -1;

        SentenceInfo.SentenceType type = SentenceInfo.SentenceType.ClickNode;
        for (int i = 0; i < temp.Count; i++)
        {
            if (temp[i].StartHitTime <= audioTime && temp[i].EndHitTime >= audioTime)
            {
                if (i < start)
                {
                    start = i;
                }
                if (i > end)
                {
                    end = i;
                }
                type = temp[i].Type;
            }
            else if (temp[i].StartHitTime > audioTime)
            {
                break;
            }
        }
        if (start <= end)
        {
            m_StartToEnd.Find("Start").GetComponent <InputField>().text = (start + 1).ToString();
            m_StartToEnd.Find("End").GetComponent <InputField>().text   = (end + 1).ToString();
            if (type == SentenceInfo.SentenceType.ClickNode)
            {
                m_StartToEnd.Find("Type").Find("Label").GetComponent <Text>().text = "Click";
            }
            else
            {
                m_StartToEnd.Find("Type").Find("Label").GetComponent <Text>().text = "Sound";
            }
        }
        else
        {
            m_StartToEnd.Find("Start").GetComponent <InputField>().text        = "";
            m_StartToEnd.Find("End").GetComponent <InputField>().text          = "";
            m_StartToEnd.Find("Type").Find("Label").GetComponent <Text>().text = "Click";
        }
    }
コード例 #2
0
    public void OnDeselect(BaseEventData eventData)
    {
        GetComponent <Dropdown>().OnDeselect(eventData);
        int            start = int.Parse(EiderSong.Instance.m_StartToEnd.Find("Start").Find("Text").GetComponent <Text>().text) - 1;
        int            end   = int.Parse(EiderSong.Instance.m_StartToEnd.Find("End").Find("Text").GetComponent <Text>().text) - 1;
        List <HitInfo> temp  = EiderToolPage.Instance.SongObject.HitInfos;
        string         type  = EiderSong.Instance.m_StartToEnd.Find("Type").Find("Label").GetComponent <Text>().text;

        SentenceInfo.SentenceType sentenceType = SentenceInfo.SentenceType.ClickNode;
        if (type == "Click")
        {
            sentenceType = SentenceInfo.SentenceType.ClickNode;
        }
        else
        {
            sentenceType = SentenceInfo.SentenceType.SoundNode;
        }
        for (int i = start; i <= end; i++)
        {
            temp[i].StartHitTime = temp[start].HitTime;
            temp[i].EndHitTime   = temp[end].EndHitTime;
            temp[i].Type         = sentenceType;
        }
    }
コード例 #3
0
ファイル: GetEndNum.cs プロジェクト: jxc608/SnaplingoScripts
    public void OnDeselect(BaseEventData eventData)
    {
        GetComponent <InputField>().OnDeselect(eventData);
        if (string.IsNullOrEmpty(EiderSong.Instance.m_StartToEnd.Find("Start").Find("Text").GetComponent <Text>().text) || string.IsNullOrEmpty(EiderSong.Instance.m_StartToEnd.Find("End").Find("Text").GetComponent <Text>().text))
        {
            return;
        }
        int start = int.Parse(EiderSong.Instance.m_StartToEnd.Find("Start").Find("Text").GetComponent <Text>().text) - 1;
        int end   = int.Parse(EiderSong.Instance.m_StartToEnd.Find("End").Find("Text").GetComponent <Text>().text) - 1;

        if (end < start)
        {
            return;
        }
        List <HitInfo> temp = EiderToolPage.Instance.SongObject.HitInfos;
        string         type = EiderSong.Instance.m_StartToEnd.Find("Type").Find("Label").GetComponent <Text>().text;

        SentenceInfo.SentenceType sentenceType = SentenceInfo.SentenceType.ClickNode;
        int ddd = 100;

        if (type == "Click")
        {
            sentenceType = SentenceInfo.SentenceType.ClickNode;
        }
        else
        {
            sentenceType = SentenceInfo.SentenceType.SoundNode;
            ddd          = 1000;
        }

        if (start != 0)
        {
            for (int i = start - 1; i >= 0; i--)
            {
                if (temp[i].StartHitTime == temp[start - 1].StartHitTime)
                {
                    temp[i].EndHitTime = temp[start].HitTime - ddd;
                }
                else
                {
                    break;
                }
            }
        }
        if (end != temp.Count - 1)
        {
            for (int i = end + 1; i < temp.Count; i++)
            {
                if (temp[i].EndHitTime == temp[end + 1].EndHitTime)
                {
                    temp[i].StartHitTime = temp[end + 1].HitTime;
                }
                else
                {
                    break;
                }
            }
            if (temp[end + 1].Type == SentenceInfo.SentenceType.SoundNode)
            {
                ddd = 1000;
            }
            else
            {
                ddd = 100;
            }
            temp[end].EndHitTime = temp[end + 1].HitTime - ddd;
        }
        else
        {
            temp[end].EndHitTime = temp[end].HitTime + 2000;
        }

        for (int i = start; i <= end; i++)
        {
            temp[i].StartHitTime = temp[start].HitTime;
            temp[i].EndHitTime   = temp[end].EndHitTime;
            temp[i].Type         = sentenceType;
        }
    }