Beispiel #1
0
        public void SetDefaults()
        {
            version = 1;
            type = "basic";

            sequenceQueue = new List<Sequence>();

            XmlDocument doc = new XmlDocument();
            doc.LoadXml( "<location id=\"defaultLocation\" lat=\"0\" lon=\"0\">Default Location</location>" );
            currentLocation = new Location( doc.DocumentElement, this );

            currentTemperature = 24f;
            currentTemperatureUnits = TemperatureUnits.CELSIUS;

            currentWeather = WeatherConditions.CLEAR;

            currentDate = DateTime.Now;
        }
Beispiel #2
0
 /**
  * Given a location, makes it the current location.
  *
  * @param location		The location to make current.
  */
 public void SetLocation( Location location )
 {
     int index = Array.IndexOf( locations, location );
     if ( index != -1 ) {
         currentLocation = location;
     }
 }
Beispiel #3
0
        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;
                }

            }
        }