示例#1
0
文件: Score.cs 项目: eloyer/stepwise
        public void SetSequence( Sequence sequence, DateTime atDate, bool autoStart )
        {
            //Debug.Log ( "set sequence: " + sequence.id + " " + autoStart );

            int index = Array.IndexOf( sequences, sequence );
            if ( index != -1 ) {
                sequenceIndex = index;
                currentSequence = sequence;
                if ( atDate.Ticks != 0 ) {
                    currentSequence.MatchDate( atDate );
                }
                if ( autoStart ) {
                    currentSequence.NextStep();
                }
            }
        }
示例#2
0
文件: Score.cs 项目: eloyer/stepwise
        public void UpdateCurrentSequence()
        {
            Sequence sequence;

            //Debug.Log ( "next step for score" );

            // if there are sequences in the queue, get the current one
            if ( sequenceQueue.Count > 0 ) {
                sequence = sequenceQueue[ sequenceQueue.Count - 1 ];

                // if it's already completed, then
                if ( sequence.isCompleted ) {

                    // remove it from the queue
                    if ( sequenceQueue.Count > 0) {
                        sequenceQueue.RemoveAt( sequenceQueue.Count - 1 );
                    }

                    // if there's still a queue, then grab the next sequence from it
                    if ( sequenceQueue.Count > 0 ) {
                        sequence = sequenceQueue[ sequenceQueue.Count - 1 ];

                        // otherwise, grab the current non-queue sequence
                    } else {
                        sequence = sequences[ sequenceIndex ];
                    }
                }

                // grab the current non-queue sequence
            } else {
                sequence = sequences[ sequenceIndex ];
            }

            //Debug.Log( "current sequence: " + sequence.id );

            // if the sequence hasn't been exhausted, make it current
            if ( !sequence.isExhausted ) {
                currentSequence = sequence;
            }
        }
示例#3
0
文件: Score.cs 项目: eloyer/stepwise
 /**
  * Given a sequence, makes it the current sequence.
  *
  * @param sequence		The sequence to make current.
  * @param atDate		If specified, will attempt to cue up the sequence to the same date.
  * @param autoStart		If true, the sequence will automatically play its first step.
  */
 public void SetSequence( Sequence sequence, bool autoStart )
 {
     SetSequence( sequence, DateTime.Now, autoStart );
 }
示例#4
0
文件: Score.cs 项目: eloyer/stepwise
        public virtual void Reset()
        {
            int i;
            int n = sequences.Length;
            for ( i = 0; i < n; i++ ) {
                sequences[ i ].Reset();
            }

            sequenceIndex = 0;
            currentSequence = null;
            sequenceQueue.Clear();
        }
示例#5
0
文件: Score.cs 项目: eloyer/stepwise
 public void PlaySequence( Sequence sequence )
 {
     currentSequence = sequence;
     sequenceQueue.Add( sequence );
     sequence.NextStep();
 }
示例#6
0
文件: Score.cs 项目: eloyer/stepwise
        public void ParseStory( XmlElement xml )
        {
            if ( xml != null ) {

                int i, n;
                XmlNodeList elements;
                Sequence sequence;
                Character character;
                Location location;

                elements = xml.GetElementsByTagName( "sequence" );
                n = elements.Count;
                sequences = new Sequence[ n ];
                sequencesById = new Hashtable();
                for ( i = 0; i < n; i++ ) {
                    sequence = new Sequence( ( XmlElement ) elements[ i ], this );
                    sequences[ i ] = sequence;
                    if ( sequence.id == null ) {
                        sequence.id = "sequence" + i;
                    }
                    sequencesById[ sequence.id ] = sequence;
                }

                elements = xml.GetElementsByTagName( "character" );
                n = elements.Count;
                characters = new Character[ n ];
                charactersById = new Hashtable();
                for ( i = 0; i < n; i++ ) {
                    character = new Character( ( XmlElement ) elements[ i ], this );
                    characters[ i ] = character;
                    if ( character.id == null ) {
                        character.id = "character" + i;
                    }
                    charactersById[ character.id ] = character;
                }

                elements = xml.GetElementsByTagName( "location" );
                n = elements.Count;
                locations = new Location[ n ];
                locationsById = new Hashtable();
                for ( i = 0; i < n; i++ ) {
                    location = new Location( ( XmlElement ) elements[ i ], this );
                    locations[ i ] = location;
                    if ( location.id == null ) {
                        location.id = "location" + i;
                    }
                    locationsById[ location.id ] = location;
                }

            }
        }
示例#7
0
文件: Score.cs 项目: eloyer/stepwise
 public void ParseStory( string text )
 {
     if ( text != null ) {
         sequences = new Sequence[ 1 ];
         Sequence sequence = new Sequence( text, this );
         sequences[ 0 ] = sequence;
         sequencesById = new Hashtable();
         sequencesById[ sequence.id ] = sequence;
     }
 }