Ejemplo n.º 1
0
        public void Play(ScenarioPlayer player, IScenarioNode parent)
        {
            if (isFirst)
            {
                isFirst = false;
                player.StartNewText(Say.ToTextType(parent.GetAttribute("class").Value), parent.GetAttribute("name").Value);
            }

            while (true)
            {
                if (nextPlayTime > player.Now)
                {
                    return;
                }

                nowLength++;

                if (text.Length < nowLength)
                {
                    isPlayed = true;
                    return;
                }

                player.AddText(text.Substring(nowLength - 1, 1));

                nextPlayTime = player.Now + delay;
            }
        }
Ejemplo n.º 2
0
        public void Play(ScenarioPlayer player, IScenarioNode parent)
        {
            if (startPlayTime < 0.0f)
            {
                player.StartNewText(Say.ToTextType(parent.GetAttribute("class").Value), parent.GetAttribute("name").Value);

                startPlayTime = player.Now;

                player.AddText(text);
            }

            float deltaTime = player.Now - startPlayTime;

            if (delay <= 0.0f)
            {
                player.SetOpacity(1.0f);
            }
            else
            {
                player.SetOpacity((deltaTime) / delay);
            }

            if (deltaTime >= delay)
            {
                //  再生完了
                isPlayed = true;
                return;
            }
        }