Esempio n. 1
0
    public void doSub(subtitleMeta sub)
    {
        string buildSubtitle;

        if (!sub.noFormat)
        {
            buildSubtitle = string.Format(stage_direction, Localization.GetString("charaStrings", sub.character), sub.subtitle);
        }
        else
        {
            buildSubtitle = sub.subtitle;
        }

        //Debug.Log("Subtitulo " + buildSubtitle + " con el extra " + sub.nextSubtitle);

        if (!string.IsNullOrEmpty(sub.nextSubtitle))
        {
            playVoice(sub.nextSubtitle);
        }

        sub.nextSubtitle = "";

        if (sub.delay > 0)
        {
            delayed.Add(new delay_data(sub, sub.delay));
        }
        else
        {
            if (buildSubtitle.Length > 60)
            {
                int firstspace = buildSubtitle.IndexOf(" ", 60);
                if (firstspace != -1)
                {
                    subtitleMeta midSub = sub;
                    sub.duration    = (sub.duration / 2) < 2 ? 2 : (sub.duration / 2);
                    midSub.duration = sub.duration;
                    midSub.noFormat = true;
                    midSub.subtitle = buildSubtitle.Substring(firstspace + 1);

                    if (!string.IsNullOrEmpty(midSub.subtitle))
                    {
                        delayed.Add(new delay_data(midSub, sub.duration));
                    }

                    buildSubtitle = buildSubtitle.Substring(0, firstspace);
                }
            }
            pending.Add(new time_data(buildSubtitle, sub.duration));
        }
    }
Esempio n. 2
0
    void doDelayed()
    {
        for (int i = 0; i < delayed.Count; i++)
        {
            delayed[i].time -= Time.deltaTime;
            if (delayed[i].time < 0)
            {
                subtitleMeta sub = delayed[i].sub;
                sub.delay = 0;
                doSub(sub);

                delayed.RemoveAt(i);
            }
        }
    }
Esempio n. 3
0
    public void playVoice(string id, bool Force = false)
    {
        Debug.Log("Buscando Subtitulo " + id);
        if (VoiceSubsEnabled)
        {
            if (Force)
            {
                pending.Clear();
                delayed.Clear();
                subtitle_hold[2] = 0;
                Debug.Log(" FORCE SUB ");
            }
            subtitleMeta sub = Localization.GetSubtitle(id);

            doSub(sub);
        }
    }
Esempio n. 4
0
 public delay_data(subtitleMeta _sub, float _time)
 {
     sub  = _sub;
     time = _time;
 }