Exemplo n.º 1
0
    //クリック・スペースキーが押され、次のシーンに続くときの処理
    bool Operation_next()
    {
        if (Input.GetKeyDown(KeyCode.Space) || (Input.GetMouseButtonDown(0) && !Scripter_ClickChecker.button_over))
        {
            if (state == NOVEL_STATUS.ANIMATION || state == NOVEL_STATUS.DELAY)
            {
                return(true);
            }
            state = NOVEL_STATUS.NEXT;
            int max = now.text.Length;
            log_text  += now.text;
            save_data += now.text;

            for (int i = (now as Text_scription).counter; i < max; i++)
            {
                if (now.text[i] == '\\' && now.text[i + 1] == 't' && now.text[i + 2] == 'a' && now.text[i + 3] == 'g')
                {
                    string cut       = now.text.Substring(i + 4);
                    int    main_text = Int32.Parse(cut.Substring(0, 1));
                    cut = cut.Substring(1, cut.Length - 1);
                    string[] temp = cut.Split('\\');
                    text.text += temp[0];
                    i         += temp[0].Length + 8;
                }
                else
                {
                    character_count++;
                    text.text += now.text[i];
                }
            }
            return(true);
        }
        return(false);
    }
Exemplo n.º 2
0
    // Update is called once per frame
    public bool Updating()
    {
        if (screenshot_coroutine)
        {
            return(true);
        }
        //バックログ処理
        //Operation_BackLog();

        //SCREEN_STATUS分岐(バックログか、ノベルエンジンメインか、セーブ・ロードか。)
        switch (screen)
        {
        case SCREEN_STATUS.BACK_LOG:

            break;

        case SCREEN_STATUS.MAIN:
            //次の行へ
            if (state == NOVEL_STATUS.NEXT)
            {
                ResetFrontAlpha();

                if (character_voice.isPlaying && isvoicestop)
                {
                    character_voice.Stop();
                }
                Debug.Log("Scripter Update Call");

                state = Next_Command();
                if (state == NOVEL_STATUS.FINISH)
                {
                    FrontScreen.left.name   = "left";
                    FrontScreen.right.name  = "right";
                    FrontScreen.center.name = "center";
                    BackScreen.left.name    = "left";
                    BackScreen.center.name  = "center";
                    BackScreen.right.name   = "right";
                    scriptions.Clear();
                    reading_pos = 0;
                    FrontScreen.background.sprite = skeltonsprite;
                    FrontScreen.center.sprite     = FrontScreen.right.sprite = FrontScreen.left.sprite = skeltonsprite;
                    BackScreen.center.sprite      = BackScreen.right.sprite = BackScreen.left.sprite = skeltonsprite;

                    BackScreen.background.sprite = skeltonsprite;
                    mainui.SetActive(false);
                    screenshot_coroutine = false;
                    return(false);
                }
            }
            //文章表示中
            else if (state == NOVEL_STATUS.WRITING)
            {
                float time = (now as Text_scription).timer;
                //文章表示時は強制的にtexton
                ShowUI();
                //強制的に0(Sync)を表示(NScripter準拠)BackScreenをFrontScreenにコピー
                FrontScreen.Copy(BackScreen);

                time += Time.deltaTime * 1000;
                if (time > wait_time)
                {
                    int count = 0;
                    count = (now as Text_scription).counter;
                    if (now.text.Length > count)
                    {
                        if (now.text[count] == '\\' && now.text[count + 1] == 't' && now.text[count + 2] == 'a' && now.text[count + 3] == 'g')
                        {
                            string cut       = now.text.Substring(count + 4);
                            int    main_text = Int32.Parse(cut.Substring(0, 1));
                            cut = cut.Substring(1, cut.Length - 1);
                            string[] temp = cut.Split('\\');
                            text.text += temp[0];
                            count     += temp[0].Length + 8;
                        }
                        else
                        {
                            character_count++;
                            text.text += now.text[count];
                        }
                        (now as Text_scription).counter = count + 1;
                        (now as Text_scription).timer   = 0f;
                        time = 0f;
                    }
                    else
                    {
                        state = NOVEL_STATUS.WAITING;
                    }
                }
                if (check_key)
                {
                    Operation_next();
                }
                (now as Text_scription).timer = time;
            }
            //クリック待ち
            else if (state == NOVEL_STATUS.WAITING)
            {
                if (!character_voice.isPlaying)
                {
                    PageChangeAnim.gameObject.SetActive(true);
                }

                if (check_key)
                {
                    if (Operation_next())
                    {
                        PageChangeAnim.gameObject.SetActive(false);
                        PageWaitAnim.gameObject.SetActive(false);
                    }
                }
            }
            //遅延
            else if (state == NOVEL_STATUS.DELAY)
            {
                if ((Operation_next() && skipflag) || delaynowtime >= delaytime)
                {
                    state = NOVEL_STATUS.NEXT;
                }
                delaynowtime += (int)(Time.deltaTime * 1000);
            }
            else if (state == NOVEL_STATUS.UIHIDE)
            {
                //今は非表示にするだけ。
                HideUI();
                state = NOVEL_STATUS.NEXT;
            }
            else if (state == NOVEL_STATUS.UISHOW)
            {
                //今は表示するだけ。
                ShowUI();
                state = NOVEL_STATUS.NEXT;
            }
            //アニメーション
            else if (state == NOVEL_STATUS.ANIMATION)
            {
                //クリックされた
                if (Operation_next())
                {
                    FrontScreen.Copy(BackScreen);

                    state = NOVEL_STATUS.NEXT;
                }
                else
                {
                    bool check = false;
                    switch (registered_animation)
                    {
                    case ANIMATION_TYPE.ANIMATION_NO_TIME:
                        break;

                    case ANIMATION_TYPE.ANIMATION_SYNCHRO:
                        Debug.Log("Error;");
                        break;

                    case ANIMATION_TYPE.FADE_IN:
                        check = true;
                        FrontScreen.gobj.GetComponent <CanvasGroup>().alpha -= 1000 * Time.deltaTime / anim_timer;
                        //registered_object[i].color -= new Color(0, 0, 0, 1000 * Time.deltaTime / anim_timer);
                        if (FrontScreen.gobj.GetComponent <CanvasGroup>().alpha <= 0f)
                        {
                            registered_animation = ANIMATION_TYPE.ANIMATION_NO_TIME;
                        }
                        break;

                    case ANIMATION_TYPE.MASKRULE:
                        check = true;
                        fadeui.GetComponent <FadeUI>().Range += 1000 * Time.deltaTime / anim_timer;
                        if (fadeui.GetComponent <FadeUI>().Range >= 1)
                        {
                            //prebackground.enabled = false;
                            fadeui.GetComponent <FadeUI>().Range = 1;
                            registered_animation = ANIMATION_TYPE.ANIMATION_NO_TIME;
                        }
                        break;
                    }
                    if (!check)
                    {
                        FrontScreen.Copy(BackScreen);

                        ResetFrontAlpha();

                        BackScreen.gobj.SetActive(false);
                        state = NOVEL_STATUS.NEXT;
                    }
                }
            }
            else if (state == NOVEL_STATUS.PRE_ANIMATION)
            {
                //BackScreenをSetActive
                BackScreen.gobj.SetActive(true);
                switch (registered_animation)
                {
                //フェードイン
                case ANIMATION_TYPE.FADE_IN:
                    FrontScreen.gobj.GetComponent <CanvasGroup>().alpha = 1;
                    state = NOVEL_STATUS.ANIMATION;
                    break;

                //瞬間表示
                case ANIMATION_TYPE.ANIMATION_NO_TIME:
                    //BackScreenをFrontScreenにコピー
                    FrontScreen.Copy(BackScreen);
                    BackScreen.gobj.SetActive(false);
                    state = NOVEL_STATUS.NEXT;

                    anim_timer = 0;
                    break;

                case ANIMATION_TYPE.MASKRULE:
                    state = NOVEL_STATUS.ANIMATION;
                    //フェードマスク用ルール画像の設定
                    Texture animation_mask_texture = Resources.Load <Texture>(string.Format("Fade/{0}", animrulenum));
                    fadeui.GetComponent <FadeUI>().UpdateMaskTexture(animation_mask_texture);
                    fadeui.GetComponent <FadeUI>().Range = 0;
                    fade_method = 0;
                    break;
                }
            }
            break;

        case SCREEN_STATUS.FADE_OUT:
            Debug.Log("Error");
            break;
        }
        return(true);
    }
Exemplo n.º 3
0
    public void start_Novel(string novel_name, int pos)
    {
        //スクリーンショット取得
        StartCoroutine(LoadScreenshot());
        //フロントスクリーン・バックスクリーンのロード
        FrontScreen = new NovelScreen(frontscreen_inspector);
        BackScreen  = new NovelScreen(backscreen_inspector);
        FrontScreen.gobj.SetActive(true);
        BackScreen.gobj.SetActive(false);

        if (skeltonsprite == null)
        {
            skeltonsprite = Resources.Load <Sprite>("stand/skelton");
        }

        //ノベルスクリプトの取得
        string path = "";

        if (Debug.isDebugBuild)
        {
            path += "/debug/";
        }
        else
        {
            path += "/compiled/";
        }
        StreamReader sr = new StreamReader(Application.streamingAssetsPath + path + novel_name, System.Text.Encoding.GetEncoding("utf-8"));

        text.color          = chara_color = Color_Parser("000000");
        characterText.color = Color_Parser("000000");
        namebox.gameObject.SetActive(false);
        PageChangeAnim.gameObject.SetActive(false);
        PageWaitAnim.gameObject.SetActive(false);
        back_log_Stage.gameObject.SetActive(false);
        back_log.text = "";
        anim_timer    = 0;

        Debug.Log("Scripter Start Call");

        string            temp;
        Encryption_Config ec = Resources.Load <Encryption_Config>("Prefab/Encryption");

        while (sr.Peek() != -1)
        {
            temp = ec.DecryptionSystem(sr.ReadLine(), false);
            Scription test = JsonUtility.FromJson <Scription>(temp);
            switch (test.type)
            {
            case COMMAND_TYPE.AUDIO_BGM:
            case COMMAND_TYPE.AUDIO_VOICE:
            case COMMAND_TYPE.AUDIO_SE:
            {
                AUDIO_scription audio = JsonUtility.FromJson <AUDIO_scription>(temp);
                scriptions.Add(new AUDIO_scription(audio, Resources.Load <AudioClip>(audio.audio_name), audio.text, audio.type));
            }
            break;

            case COMMAND_TYPE.BACKGROUND:
            case COMMAND_TYPE.BACKGROUND_IMAGE:
            {
                IMAGE_scription image = JsonUtility.FromJson <IMAGE_scription>(temp);
                scriptions.Add(new IMAGE_scription(image, Resources.Load <Sprite>(image.imagename), image.text, image.type));
            }
            break;

            case COMMAND_TYPE.STAND_IMAGE:
            {
                STAND_IMAGE_scription image = JsonUtility.FromJson <STAND_IMAGE_scription>(temp);
                scriptions.Add(new STAND_IMAGE_scription(image.place, image, Resources.Load <Sprite>(image.imagename), image.text, image.type));
            }
            break;

            case COMMAND_TYPE.COLOR:
            case COMMAND_TYPE.BACKGROUND_COLOR:
                scriptions.Add(JsonUtility.FromJson <COLOR_scription>(temp));
                break;

            case COMMAND_TYPE.NORMAL_TEXT:
            case COMMAND_TYPE.NORMAL_TEXT_CONTINUE:
                scriptions.Add(JsonUtility.FromJson <Text_scription>(temp));
                break;

            case COMMAND_TYPE.WAIT_B:
            case COMMAND_TYPE.WAIT_S:
            case COMMAND_TYPE.WAIT_W:
            case COMMAND_TYPE.WAIT:
                scriptions.Add(JsonUtility.FromJson <WAIT_scription>(temp));
                break;

            case COMMAND_TYPE.STAND_IMAGE_CLEAR:
                scriptions.Add(JsonUtility.FromJson <IMAGE_clear_scription>(temp));
                break;

            case COMMAND_TYPE.AUDIO_BGM_STOP:
            case COMMAND_TYPE.AUDIO_SE_STOP:
            case COMMAND_TYPE.AUDIO_VOICE_STOP:
            case COMMAND_TYPE.TEXTOFF:
            case COMMAND_TYPE.TEXTON:
                scriptions.Add(JsonUtility.FromJson <Scription>(temp));
                break;

            case COMMAND_TYPE.SETWINDOW:
                scriptions.Add(JsonUtility.FromJson <UI_IMAGE_scription>(temp));
                break;

            case COMMAND_TYPE.RETURN:
                scriptions.Add(JsonUtility.FromJson <Scription>(temp));
                break;
            }
        }
        reading_pos = pos;
        now         = scriptions[reading_pos];
        state       = NOVEL_STATUS.NEXT;
    }