示例#1
0
        public string id; //The scenes unique identifier

        #endregion Fields

        #region Constructors

        public Scene(string ID, string EnglishName, List<Event> Events, List<Actor> Actors, Background BGround)
        {
            id = ID;
            englishName = EnglishName;
            Console.WriteLine("Recieved event list! There are " + Events.Count);

            int eventCount = 0;

            events = Events;

            actors = new Dictionary<string, Actor>();

            foreach (Actor actor in Actors)
            {
                actors.Add(actor.name, actor);
            }

            background = BGround;
        }
示例#2
0
        private void extractActorsAndBackground(StreamReader file, out Background background, out List<Actor> actors)
        {
            background = null;
            actors = new List<Actor>();
            string curline;

            #region Find Background Declaration

            bool foundBackgroundDeclaration = false;

            while (!foundBackgroundDeclaration)
            {
                curline = file.ReadLine();

                if (curline.StartsWith("Background"))
                {
                    foundBackgroundDeclaration = true;
                    background = new Background(seperator.seperateWords(curline)[1]);
                }
            }

            #endregion

            #region Find Actor Declarations

            bool foundAllActors = false;
            List<string> actorNames = new List<string>();

            while (!foundAllActors)
            {
                curline = file.ReadLine();

                if (curline.StartsWith("Actor"))
                {
                    List<String> words = seperator.seperateWords(curline);

                    string actorName = words[1];
                    string actorXPos = "";
                    Vector2 curActorPos = Vector2.Zero;
                    string actorYPos = "";

                    actorXPos = words[2];
                    actorXPos = actorXPos.Substring(1, actorXPos.Length - 2);
                    actorYPos = words[3];
                    actorYPos = actorYPos.Substring(0, actorYPos.Length - 1);
                    curActorPos = new Vector2(float.Parse(actorXPos), float.Parse(actorYPos));

                    Actor newActor = new Actor(actorName, null, curActorPos);
                    actors.Add(newActor);
                }

                if (isNextLineNonActor((char)file.Peek())) //Check to see if all the actors are done with.  If so, exit loop
                    foundAllActors = true;

            }

            #endregion
        }