Exemple #1
0
    // ================================================================ //

    // 매 프레임 실행 입모양 데이터 작성 모드용.
    private void    update_recording_mode()
    {
        CloudControl.MOUTH_TYPE mouth_type = CloudControl.MOUTH_TYPE.CLOSE;

        if (Input.GetMouseButton(0))
        {
            mouth_type = CloudControl.MOUTH_TYPE.HALF;
        }
        if (Input.GetMouseButton(1))
        {
            mouth_type = CloudControl.MOUTH_TYPE.FULL;
        }

        if (mouth_type != this.mouth_type)
        {
            this.mouth_type = mouth_type;

            KuchiPakuData data = new KuchiPakuData();

            data.time       = this.sound_control.getBgmPlayingTime();
            data.mouth_type = this.mouth_type;

            this.kuchi_paku_datas.Add(data);

            this.kuchi_paku_record += data.time.ToString();
            this.kuchi_paku_record += "\t";
            this.kuchi_paku_record += data.mouth_type.ToString().ToLower();
            this.kuchi_paku_record += "\n";
        }
    }
Exemple #2
0
    // 레벨 데이터를 텍스트 파일에서 읽어온다.
    public void             loadKuchiPakuData(TextAsset kuchi_paku_text)
    {
        // 텍스트 전체를 한 문자열로.
        string all_texts = kuchi_paku_text.text;

        // 개행 코드로 구분함으로써,.
        // 텍스트 전체를 한 줄단위 배열로 만든다. .
        string[] lines = all_texts.Split('\n');

        int line_number = -1;

        foreach (var line in lines)
        {
            line_number++;

            if (line == "")
            {
                continue;
            }

            // 공백으로 구분하여 단어의 배열로 만든다.
            string[] words = line.Split();

            int           n = 0;
            KuchiPakuData kuchi_paku_data = new KuchiPakuData();

            kuchi_paku_data.line_number = line_number;

            foreach (var word in words)
            {
                // "#" 이후는 주석이므로 그 이후는 건너뛴다.
                if (word.StartsWith("#"))
                {
                    break;
                }
                if (word == "")
                {
                    continue;
                }

                switch (n)
                {
                case 0:         kuchi_paku_data.time = float.Parse(word);                 break;

                case 1:         kuchi_paku_data.mouth_type = this.toMouthType(word);    break;
                }

                n++;
            }

            if (n >= 2)
            {
                this.kuchi_paku_datas.Add(kuchi_paku_data);
            }
            else
            {
                if (n == 0)
                {
                    // 단어가 없다 = 행 전체가 주석이었다.
                }
                else
                {
                    // 파라미터가 부족하다.
                    Debug.LogError("[KuchiPakuData] Out of parameter.\n");
                }
            }
        }

        if (this.kuchi_paku_datas.Count == 0)
        {
            // 데이터가 하나도 없을 때.

            Debug.LogError("[KuchiPakuData] Has no data.\n");

            // 기본 데이터를 하나 추가해 둔다.
            this.kuchi_paku_datas.Add(new KuchiPakuData());
        }
    }
Exemple #3
0
    // 입모양 데이터 작성 씬용 GUI
    private void    on_gui_recording()
    {
        if (this.is_recording_mode)
        {
            GUI.TextField(new Rect(10, 10, 400, 400), this.kuchi_paku_record);
        }
        else
        {
            // BGM 재생 시각을 얻는다.
            float time = this.sound_control.getBgmPlayingTime();

            do
            {
                int index = this.get_kuchi_paku_data_index(time);

                if (index < 0)
                {
                    break;
                }

                string line_text = "";

                int st, ed;
                int line_count = 12;

                if (this.kuchi_paku_datas.Count < line_count)
                {
                    st = 0;
                    ed = line_count - 1;
                }
                else
                {
                    if (index < line_count - 1)
                    {
                        st = 0;
                        ed = line_count - 1;
                    }
                    else
                    {
                        ed = index + 1;

                        if (ed >= this.kuchi_paku_datas.Count)
                        {
                            ed = this.kuchi_paku_datas.Count - 1;
                        }

                        st = ed - (line_count - 1);
                    }
                }

                for (int i = st; i <= ed; i++)
                {
                    KuchiPakuData data = this.kuchi_paku_datas[i];

                    if (i == index)
                    {
                        line_text += ">\t";
                    }
                    else
                    {
                        line_text += "\t";
                    }
                    line_text += (data.line_number + 1).ToString("d3") + "\t\t"
                                 + data.time.ToString("0.00") + "\t\t"
                                 + data.mouth_type.ToString().ToLower() + "\n";
                }

                GUI.TextField(new Rect(10, 10, 400, 200), line_text);
            } while(false);
        }
    }
Exemple #4
0
    // レベルデーターをテキストファイルからよむ.
    public void loadKuchiPakuData(TextAsset kuchi_paku_text)
    {
        // テキスト全体をひとつの文字列に.
        string		all_texts = kuchi_paku_text.text;

        // 改行コードで区切ることで、
        // テキスト全体を一行単位の配列にする.
        string[]	lines = all_texts.Split('\n');

        int			line_number = -1;

        foreach(var line in lines) {

            line_number++;

            if(line == "") {

                continue;
            }

            // 空白で区切って、単語の配列にする.
            string[]	words = line.Split();

            int				n = 0;
            KuchiPakuData	kuchi_paku_data = new KuchiPakuData();

            kuchi_paku_data.line_number = line_number;

            foreach(var word in words) {

                // "#" 以降はコメントなのでそれ以降はスキップ.
                if(word.StartsWith("#")) {

                    break;
                }
                if(word == "") {

                    continue;
                }

                switch(n) {

                    case 0:		kuchi_paku_data.time       = float.Parse(word);			break;
                    case 1:		kuchi_paku_data.mouth_type = this.toMouthType(word);	break;
                }

                n++;
            }

            if(n >= 2) {

                this.kuchi_paku_datas.Add(kuchi_paku_data);

            } else {

                if(n == 0) {

                    // 単語がなかった=行全体がコメントだった.

                } else {

                    // パラメーターが足りない.
                    Debug.LogError("[KuchiPakuData] Out of parameter.\n");
                }
            }
        }

        if(this.kuchi_paku_datas.Count == 0) {

            // データーがいっこもなかったとき.

            Debug.LogError("[KuchiPakuData] Has no data.\n");

            // デフォルトのデーターをいっこ追加しておく.
            this.kuchi_paku_datas.Add(new KuchiPakuData());
        }
    }
Exemple #5
0
    // ================================================================ //
    // 毎フレームの実行 口ぱくデーター作成モード用.
    private void update_recording_mode()
    {
        CloudControl.MOUTH_TYPE	mouth_type = CloudControl.MOUTH_TYPE.CLOSE;

        if(Input.GetMouseButton(0)) {

            mouth_type = CloudControl.MOUTH_TYPE.HALF;
        }
        if(Input.GetMouseButton(1)) {

            mouth_type = CloudControl.MOUTH_TYPE.FULL;
        }

        if(mouth_type != this.mouth_type) {

            this.mouth_type = mouth_type;

            KuchiPakuData	data = new KuchiPakuData();

            data.time       = this.sound_control.getBgmPlayingTime();
            data.mouth_type = this.mouth_type;

            this.kuchi_paku_datas.Add(data);

            this.kuchi_paku_record += data.time.ToString();
            this.kuchi_paku_record += "\t";
            this.kuchi_paku_record += data.mouth_type.ToString().ToLower();
            this.kuchi_paku_record += "\n";
        }
    }
Exemple #6
0
    // 레벨 데이터를 텍스트 파일에서 읽어온다.
    public void loadKuchiPakuData(TextAsset kuchi_paku_text)
    {
        // 텍스트 전체를 한 문자열로.
        string		all_texts = kuchi_paku_text.text;

        // 개행 코드로 구분함으로써,.
        // 텍스트 전체를 한 줄단위 배열로 만든다. .
        string[]	lines = all_texts.Split('\n');

        int			line_number = -1;

        foreach(var line in lines) {

            line_number++;

            if(line == "") {

                continue;
            }

            // 공백으로 구분하여 단어의 배열로 만든다.
            string[]	words = line.Split();

            int				n = 0;
            KuchiPakuData	kuchi_paku_data = new KuchiPakuData();

            kuchi_paku_data.line_number = line_number;

            foreach(var word in words) {

                // "#" 이후는 주석이므로 그 이후는 건너뛴다.
                if(word.StartsWith("#")) {

                    break;
                }
                if(word == "") {

                    continue;
                }

                switch(n) {

                    case 0:		kuchi_paku_data.time       = float.Parse(word);			break;
                    case 1:		kuchi_paku_data.mouth_type = this.toMouthType(word);	break;
                }

                n++;
            }

            if(n >= 2) {

                this.kuchi_paku_datas.Add(kuchi_paku_data);

            } else {

                if(n == 0) {

                    // 단어가 없다 = 행 전체가 주석이었다.

                } else {

                    // 파라미터가 부족하다.
                    Debug.LogError("[KuchiPakuData] Out of parameter.\n");
                }
            }
        }

        if(this.kuchi_paku_datas.Count == 0) {

            // 데이터가 하나도 없을 때.

            Debug.LogError("[KuchiPakuData] Has no data.\n");

            // 기본 데이터를 하나 추가해 둔다.
            this.kuchi_paku_datas.Add(new KuchiPakuData());
        }
    }