コード例 #1
0
ファイル: DialogManager.cs プロジェクト: shff/gk3tools
        public static void Step()
        {
            // continue the Mom
            if (_lastMom != null)
            {
                _lastMom.Step();
            }

            // if the last played yak is finished then see if there are more yaks to play
            if (_lastYak != null && _lastYak.Value.IsFinished)
            {
                if (_numLinesToPlay > _linesPlayed)
                {
                    // load the new yak
                    _lastLicensePlate = incrementLicensePlate(_lastLicensePlate, 1);

                    YakResource yak = SceneManager.SceneContentManager.Load <YakResource>("E" + _lastLicensePlate);
                    _lastYak = new LinkedListNode <YakResource>(yak);
                    _yaks.AddLast(_lastYak);

                    // play the yak
                    //yak.Play();
                    Animator.Add(yak, false);

                    _linesPlayed++;
                }
            }

            // remove any finished yaks
            for (LinkedListNode <YakResource> yakNode = _yaks.First; yakNode != null;)
            {
                if (yakNode.Value.IsPlaying == false)
                {
                    if (_lastYak == yakNode)
                    {
                        _lastYak = null;

                        if (_numLinesToPlay == _linesPlayed)
                        {
                            _numLinesToPlay = 0;
                            _linesPlayed    = 0;
                        }
                    }

                    LinkedListNode <YakResource> next = yakNode.Next;
                    _yaks.Remove(yakNode);
                    yakNode = next;
                }
                else
                {
                    yakNode = yakNode.Next;
                }
            }

            // if the Mom is finished then get rid of it
            if (_lastMom != null && _lastMom.IsFinished)
            {
                _lastMom = null;
            }
        }
コード例 #2
0
ファイル: DialogManager.cs プロジェクト: shff/gk3tools
        public static WaitHandle PlayDialogue(string licensePlate, int numLines, bool plateHasLanguageCode, bool wait)
        {
            if (plateHasLanguageCode == false)
            {
                licensePlate = "E" + licensePlate;
            }

            YakResource yak = SceneManager.SceneContentManager.Load <YakResource>(string.Format("{0}.YAK", licensePlate));

            _lastYak = new LinkedListNode <YakResource>(yak);
            _yaks.AddLast(yak);
            _lastLicensePlate = licensePlate.Substring(1); // remove the language code
            _numLinesToPlay   = numLines;
            _linesPlayed      = 1;

            //yak.Play();
            Animator.Add(yak, false);

            if (wait)
            {
                return(_waitHandle);
            }

            return(null);
        }
コード例 #3
0
        internal static WaitHandle Add(YakResource yak, bool wait)
        {
            yak.ReferenceCount++;

            add(_yaks, yak);

            if (wait)
            {
                return(yak.PlayAndWait());
            }

            yak.Play();
            return(null);
        }
コード例 #4
0
ファイル: YakResource.cs プロジェクト: shff/gk3tools
        public Resource.Resource Load(string name, Resource.ResourceManager content)
        {
            if (name.IndexOf('.') < 0)
            {
                name += ".YAK";
            }

            System.IO.Stream stream = FileSystem.Open(name);

            YakResource resource = new YakResource(name, stream, content);

            stream.Close();

            return(resource);
        }