예제 #1
0
    //Move textbox offscreen and bring back with new text
    public static void ChangeText(string message, bool maintext = true)
    {
        var stateinfo = Singleton.animator.GetCurrentAnimatorStateInfo(0);

        if (maintext)
        {
            Singleton.MainText = message;
        }

        if (stateinfo.IsName("OffScreen"))
        {
            ShowNewText(message);
        }
        else
        {
            HideTextBox();
            Singleton.StopAllCoroutines();
            Singleton.StartCoroutine(Singleton.WaitForTextToLeaveScreen(message));
        }
    }
예제 #2
0
 public void ExecuteAnimation(int textLineNum)
 {
     for (int i = 0; i < charactor.Length; i++)//再生中のほかのキャラクターのAnimationをスキップ
     {
         charactor[i].GetComponent <Charactor>().SkipAnim();
     }
     for (int i = actionCount; i < eventLine.Length; i++)
     {
         if (eventLine[i] == textLineNum)
         {
             if (eventName[actionCount] == "")
             {
                 actionCount++;
                 continue;
             }
             else if (eventName[actionCount] == "InvokeAnim")
             {//時間指定でAnimation命令
                 StartCoroutine(InvokeExecuteAnimation(arrayNum[actionCount], textLineNum));
                 TextController.TextControl = false;
                 eventName[actionCount]     = "";
                 break;
             }
             else if (eventName[actionCount] == "Sound")
             {//音声再生
                 audioSource.clip = audioClip[arrayNum[actionCount]];
                 audioSource.Play();
             }
             else if (eventName[actionCount] == "CgView")
             {//CG表示
                 stillView.sprite = stillPictures[arrayNum[actionCount]];
                 Debug.Log(stillView.sprite.name.Length - 1);
                 string removeString = stillView.sprite.name.Remove(stillView.sprite.name.Length - 1, 1);//差分の枚数が9枚までしか作れないクソ仕様
                 if (!PlayerPrefs.HasKey(removeString))
                 {
                     PlayerPrefs.SetInt(removeString, 1);
                 }
                 StartCoroutine("FadeIn");
             }
             else if (eventName[actionCount] == "CgDel")
             {//CG非表示
                 StartCoroutine("FadeOut");
             }
             else if (eventName[actionCount] == "CgMove")
             {
                 StartCoroutine(StillAnimFade(arrayNum[actionCount].ToString()));
             }
             else if (eventName[actionCount] == "CgChange")
             {
                 string removeString = stillView.sprite.name.Remove(stillView.sprite.name.Length - 1, 1);
                 Debug.Log(removeString);
                 PlayerPrefs.SetInt(removeString, PlayerPrefs.GetInt(removeString, PlayerPrefs.GetInt(removeString, 0)) + 1);
                 StartCoroutine(StillChange(arrayNum[actionCount]));
             }
             else if (eventName[actionCount] == "TextBoxFade")
             {//Textbox表示切り替え
                 textBoxController.StartCoroutine("TextBoxFade", arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "SetBackImage")
             {//背景変更
                 backImageManeger.SetBackGroundImage(arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "SetFadeColor")
             {//背景のFadeColorを変更:0は黒,1は白
                 backImageManeger.SetFadeColor(arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "BackFadeView")
             {//背景Fadeしながら表示
                 backImageManeger.FadeView(arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "BackFadeOut")
             {//背景Fadeしながら非表示
                 backImageManeger.FadeOut(arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "FadeView")
             {//背景Fadeしながら表示,TextBoxも
                 backImageManeger.FadeView(arrayNum[actionCount]);
                 textBoxController.StartCoroutine("TextBoxFade", arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "FadeOut")
             {//背景Fadeしながら非表示,TextBoxも
                 backImageManeger.FadeOut(arrayNum[actionCount]);
                 textBoxController.StartCoroutine("TextBoxFade", arrayNum[actionCount]);
             }
             else if (eventName[actionCount] == "SwitchPos")//綴りミスるな
             {
                 charactor[arrayNum[actionCount]].GetComponent <Charactor>().SwichPos(nextOrder[nextOrderNum]);
                 nextOrderNum++;
             }
             else if (eventName[actionCount] == "ChangeSprite")
             {
                 charactor[arrayNum[actionCount]].GetComponent <Charactor>().StartCoroutine("ChangeSpriteCor", nextOrder[nextOrderNum]);
                 SortCharactorLayer();
                 nextOrderNum++;
             }
             else if (eventName[actionCount] == "End")
             {
                 textBoxController.StartCoroutine("TextBoxFade", arrayNum[actionCount]);
                 backImageManeger.FadeOut(arrayNum[actionCount]);
                 Invoke("LoadScene", arrayNum[actionCount] * 0.1f);
             }
             else
             {                                              //Charactorアニメーション再生
                 if (eventName[actionCount] == "ChangePos") //Charactorの位置チェンジ
                 {
                     charactor[arrayNum[actionCount]].GetComponent <Charactor>().StartCoroutine("ChangePosCor", nextOrder[nextOrderNum]);
                     nextOrderNum++;
                 }
                 else
                 {
                     charactor[arrayNum[actionCount]].GetComponent <Charactor>().Invoke(eventName[actionCount], 0);
                     SortCharactorLayer();
                 }
             }
             actionCount++;//次のアクションへ
         }
     }
 }