Esempio n. 1
0
        /// <summary>
        /// Constructor for event model from save data
        /// </summary>
        /// <param name="usedEvents">String of used events</param>
        /// <param name="catalogue">String for Event catalogue </param>
        /// <param name="curEvent">String of current event</param>
        public EventModel(String usedEvents, String catalogue, String curEvent)
        {
            if (curEvent != "")
            {
                currentEvent = new Event(curEvent);
            }
            else
            {
                currentEvent = null;
            }
            this.usedEvents = new HashSet <int>();
            eventCatalogue  = new EventCatalogue(catalogue);

            String[] usedElems = usedEvents.Split(':');
            for (int i = 1; i < usedElems.Length; i++)
            {
                int id;
                if (int.TryParse(usedElems[i], out id))
                {
                    this.usedEvents.Add(id);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Test if string is a valid catalogue
 /// </summary>
 /// <param name="toTest">The string to check</param>
 /// <returns>If it is valid</returns>
 public static bool IsValidCatalogue(String toTest)
 {
     return(EventCatalogue.IsValidEventCatalogue(toTest));
 }
Esempio n. 3
0
 /// <summary>
 /// Constructor for event model for new game
 /// </summary>
 /// <param name="catalogue">Event catalogue string</param>
 public EventModel(String catalogue)
 {
     currentEvent   = null;
     usedEvents     = new HashSet <int>();
     eventCatalogue = new EventCatalogue(catalogue);
 }