Inheritance: UIElement, IDisposable
        public SASScreen(ScreenManager Manager, SpriteBatch SBatch)
            : base(Manager, "SAS", SBatch,
            new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight),
            GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselection.uis")
        {
            BackgroundImg = (UIImage)m_Walker.Elements["\"BackgroundImage\""];

            AdultAvatar Avatar = new AdultAvatar(Manager.Device);
            Avatar.ChangeOutfit(FileManager.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium);
            Avatar.SetHead(FileManager.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), Vitaboy.SkinType.Medium);
            AddAvatar(Avatar, 1);

            VitaboyScreen VScreen = new VitaboyScreen(Manager, new Vector2(0, 0),
                new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight));
            VScreen.AddSim(m_Avatars[0]);

            Manager.AddScreen(VScreen);

            TabBackgroundImg1 = m_Walker.Elements["\"TabBackgroundImage1\""].Image;
            TabBackgroundImg2 = m_Walker.Elements["\"TabBackgroundImage2\""].Image;
            TabBackgroundImg3 = m_Walker.Elements["\"TabBackgroundImage3\""].Image;

            DescriptionTabBackgroundImg1 = m_Walker.Elements["\"DescriptionTabBackgroundImage1\""].Image;
            DescriptionTabBackgroundImg1.Visible = m_Avatars.Count >= 1 ? true : false;
            DescriptionTabBackgroundImg2 = m_Walker.Elements["\"DescriptionTabBackgroundImage2\""].Image;
            DescriptionTabBackgroundImg2.Visible = m_Avatars.Count >= 2 ? true : false;
            DescriptionTabBackgroundImg3 = m_Walker.Elements["\"DescriptionTabBackgroundImage3\""].Image;
            DescriptionTabBackgroundImg3.Visible = m_Avatars.Count == 3 ? true : false;

            DescriptionTabImage1 = m_Walker.Elements["\"DescriptionTabImage1\""].Image;
            DescriptionTabImage1.Visible = m_Avatars.Count >= 1 ? true : false;
            DescriptionTabImage2 = m_Walker.Elements["\"DescriptionTabImage2\""].Image;
            DescriptionTabImage2.Visible = m_Avatars.Count >= 2 ? true : false;
            DescriptionTabImage3 = m_Walker.Elements["\"DescriptionTabImage3\""].Image;
            DescriptionTabImage3.Visible = m_Avatars.Count == 3 ? true : false;

            EnterTabImage1 = m_Walker.Elements["\"EnterTabImage1\""].Image;
            EnterTabImage1.Visible = false;
            EnterTabImage2 = m_Walker.Elements["\"EnterTabImage2\""].Image;
            EnterTabImage2.Visible = false;
            EnterTabImage3 = m_Walker.Elements["\"EnterTabImage3\""].Image;
            EnterTabImage3.Visible = false;

            EnterTabBackgroundImage1 = m_Walker.Elements["\"EnterTabBackgroundImage1\""].Image;
            EnterTabBackgroundImage1.Visible = false;
            EnterTabBackgroundImage2 = m_Walker.Elements["\"EnterTabBackgroundImage2\""].Image;
            EnterTabBackgroundImage2.Visible = false;
            EnterTabBackgroundImage3 = m_Walker.Elements["\"EnterTabBackgroundImage3\""].Image;
            EnterTabBackgroundImage3.Visible = false;

            //DefaultHouseImg = (UIImage)m_Elements["\"DefaultHouseImage\""].Image; //Not used??

            CreditsBackgroundImg = m_Walker.Controls["\"CreditsButtonBackgroundImage\""].Image;
            //CityThumbnailBusyImg = m_Controls["\"CityThumbnailBusyImage\""].Image; //Not used??

            CityButtonTemplateImage = (UIImage)m_Walker.Elements["\"CityButtonTemplateImage\""];

            m_ExitButton = (UIButton)m_Walker.Elements["\"ExitButton\""];

            m_EnterTabBtn1 = (UIButton)m_Walker.Elements["\"EnterTabButton1\""];
            m_EnterTabBtn1.OnButtonClicked += EnterTabBtn1_OnButtonClicked;
            m_EnterTabBtn1.Enabled = m_Avatars.Count >= 1 ? true : false;
            m_EnterTabBtn2 = (UIButton)m_Walker.Elements["\"EnterTabButton2\""];
            m_EnterTabBtn2.OnButtonClicked += EnterTabBtn2_OnButtonClicked;
            m_EnterTabBtn2.Enabled = m_Avatars.Count >= 2 ? true : false;
            m_EnterTabBtn3 = (UIButton)m_Walker.Elements["\"EnterTabButton3\""];
            m_EnterTabBtn3.OnButtonClicked += EnterTabBtn3_OnButtonClicked;
            m_EnterTabBtn3.Enabled = m_Avatars.Count == 3 ? true : false;

            m_DescriptionTabBtn1 = (UIButton)m_Walker.Elements["\"DescriptionTabButton1\""];
            m_DescriptionTabBtn1.OnButtonClicked += DescriptionTabBtn1_OnButtonClicked;
            m_DescriptionTabBtn1.Enabled = m_Avatars.Count >= 1 ? true : false;
            m_DescriptionTabBtn2 = (UIButton)m_Walker.Elements["\"DescriptionTabButton2\""];
            m_DescriptionTabBtn2.OnButtonClicked += DescriptionTabBtn2_OnButtonClicked;
            m_DescriptionTabBtn2.Enabled = m_Avatars.Count >= 2 ? true : false;
            m_DescriptionTabBtn3 = (UIButton)m_Walker.Elements["\"DescriptionTabButton3\""];
            m_DescriptionTabBtn3.OnButtonClicked += DescriptionTabBtn3_OnButtonClicked;
            m_DescriptionTabBtn3.Enabled = m_Avatars.Count == 3 ? true : false;

            m_AvatarButton1 = (UIButton)m_Walker.Elements["\"AvatarButton1\""];
            m_AvatarButton2 = (UIButton)m_Walker.Elements["\"AvatarButton2\""];
            m_AvatarButton3 = (UIButton)m_Walker.Elements["\"AvatarButton3\""];

            m_CityButton1 = (UIButton)m_Walker.Elements["\"CityButton1\""];
            m_CityButton1.AddImage(GetImage("\"CityButtonTemplateImage\"", true));
            m_CityButton1.Visible = false;
            m_CityButton2 = (UIButton)m_Walker.Elements["\"CityButton2\""];
            m_CityButton2.AddImage(GetImage("\"CityButtonTemplateImage\"", true));
            m_CityButton2.Visible = false;
            m_CityButton3 = (UIButton)m_Walker.Elements["\"CityButton3\""];
            m_CityButton3.AddImage(GetImage("\"CityButtonTemplateImage\"", true));
            m_CityButton3.Visible = false;

            m_HouseButton1 = (UIButton)m_Walker.Elements["\"HouseButton1\""];
            m_HouseButton1.AddImage(GetImage("\"HouseButtonTemplateImage\"", true));
            m_HouseButton1.Visible = false;
            m_HouseButton2 = (UIButton)m_Walker.Elements["\"HouseButton2\""];
            m_HouseButton2.AddImage(GetImage("\"HouseButtonTemplateImage\"", true));
            m_HouseButton2.Visible = false;
            m_HouseButton3 = (UIButton)m_Walker.Elements["\"HouseButton3\""];
            m_HouseButton3.AddImage(GetImage("\"HouseButtonTemplateImage\"", true));
            m_HouseButton3.Visible = false;

            m_NewAvatarButton1 = (UIButton)m_Walker.Elements["\"NewAvatarButton1\""];
            m_NewAvatarButton1.Visible = m_Avatars.Count >= 1 ? false : true;
            m_NewAvatarButton2 = (UIButton)m_Walker.Elements["\"NewAvatarButton2\""];
            m_NewAvatarButton2.Visible = m_Avatars.Count >= 2 ? false : true;
            m_NewAvatarButton3 = (UIButton)m_Walker.Elements["\"NewAvatarButton3\""];
            m_NewAvatarButton3.Visible = m_Avatars.Count == 3 ? false : true;

            m_DeleteAvatarButton1 = (UIButton)m_Walker.Elements["\"DeleteAvatarButton1\""];
            m_DeleteAvatarButton1.Visible = m_Avatars.Count >= 1 ? true : false;
            m_DeleteAvatarButton2 = (UIButton)m_Walker.Elements["\"DeleteAvatarButton2\""];
            m_DeleteAvatarButton2.Visible = m_Avatars.Count >= 2 ? true : false;
            m_DeleteAvatarButton3 = (UIButton)m_Walker.Elements["\"DeleteAvatarButton3\""];
            m_DeleteAvatarButton3.Visible = m_Avatars.Count == 3 ? true : false;

            m_PersonDescriptionText1 = (UITextEdit)m_Walker.Elements["\"PersonDescriptionText1\""];
            m_PersonDescriptionText1.Visible = m_Avatars.Count >= 1 ? true : false;
            m_PersonDescriptionText2 = (UITextEdit)m_Walker.Elements["\"PersonDescriptionText2\""];
            m_PersonDescriptionText2.Visible = m_Avatars.Count >= 2 ? true : false;
            m_PersonDescriptionText3 = (UITextEdit)m_Walker.Elements["\"PersonDescriptionText3\""];
            m_PersonDescriptionText3.Visible = m_Avatars.Count == 3 ? true : false;

            m_PersonDescriptionScrollUpBtn1 = (UIButton)m_Walker.Elements["\"PersonDescriptionScrollUpButton1\""];
            m_PersonDescriptionScrollUpBtn1.Visible = m_PersonDescriptionText1.Visible ? true : false;
            m_PersonDescriptionScrollUpBtn2 = (UIButton)m_Walker.Elements["\"PersonDescriptionScrollUpButton2\""];
            m_PersonDescriptionScrollUpBtn2.Visible = m_PersonDescriptionText2.Visible ? true : false;
            m_PersonDescriptionScrollUpBtn3 = (UIButton)m_Walker.Elements["\"PersonDescriptionScrollUpButton3\""];
            m_PersonDescriptionScrollUpBtn3.Visible = m_PersonDescriptionText3.Visible ? true : false;

            m_PersonDescriptionScrollDownBtn1 = (UIButton)m_Walker.Elements["\"PersonDescriptionScrollDownButton1\""];
            m_PersonDescriptionScrollDownBtn1.Visible = m_PersonDescriptionText1.Visible ? true : false;
            m_PersonDescriptionScrollDownBtn2 = (UIButton)m_Walker.Elements["\"PersonDescriptionScrollDownButton2\""];
            m_PersonDescriptionScrollDownBtn2.Visible = m_PersonDescriptionText2.Visible ? true : false;
            m_PersonDescriptionScrollDownBtn3 = (UIButton)m_Walker.Elements["\"PersonDescriptionScrollDownButton3\""];
            m_PersonDescriptionScrollDownBtn3.Visible = m_PersonDescriptionText3.Visible ? true : false;

            m_CityNameText1 = (UILabel)m_Walker.Elements["\"CityNameText1\""];
            m_CityNameText1.Visible = false;
            m_CityNameText2 = (UILabel)m_Walker.Elements["\"CityNameText2\""];
            m_CityNameText2.Visible = false;
            m_CityNameText3 = (UILabel)m_Walker.Elements["\"CityNameText3\""];
            m_CityNameText3.Visible = false;

            //TODO: Assign captions to these if a sim has a house...
            m_HouseNameText1 = (UILabel)m_Walker.Elements["\"HouseNameText1\""];
            m_HouseNameText2 = (UILabel)m_Walker.Elements["\"HouseNameText2\""];
            m_HouseNameText3 = (UILabel)m_Walker.Elements["\"HouseNameText3\""];

            m_CreditsButton = (UIButton)m_Walker.Elements["\"CreditsButton\""];
        }
        /// <summary>
        /// Walks a generated AST (Abstract Syntax Tree) and creates the elements of this UIScreen.
        /// </summary>
        /// <param name="State">A ParserState instance.</param>
        /// <param name="node">The root node of the AST.</param>
        private void WalkTree(UIParser.ParserState State, AstNode node)
        {
            NodeType NType = (NodeType)Enum.Parse(typeof(NodeType), node.ToString(), true);

            switch (NType)
            {
                case NodeType.DefineImage: //Defines an image and loads a texture for it.
                    DefineImageNode ImgNode = (DefineImageNode)UINode.GetNode(node);
                    UIImage Img = new UIImage(ImgNode, m_Screen);
                    Elements.Add(ImgNode.Name, Img);
                    break;
                case NodeType.DefineString: //Defines a string with a name.
                    DefineStringNode StrNode = (DefineStringNode)UINode.GetNode(node);
                    Strings.Add(StrNode.Name, StringManager.StrTable(State.CurrentStringTable)[StrNode.StrIndex]);
                    break;
                case NodeType.AddButton: //Defines a button.
                    AddButtonNode ButtonNode = (AddButtonNode)UINode.GetNode(node);
                    UIButton Btn = new UIButton(ButtonNode, State, m_Screen);
                    Elements.Add(ButtonNode.Name, Btn);

                    break;
                case NodeType.AddText:
                    AddTextNode TextNode = (AddTextNode)UINode.GetNode(node);
                    UILabel Lbl = new UILabel(TextNode, State, m_Screen);
                    Elements.Add(TextNode.Name, Lbl);
                    break;
                case NodeType.AddTextEdit:
                    AddTextEditNode TextEditNode = (AddTextEditNode)UINode.GetNode(node);
                    UITextEdit Txt = new UITextEdit(TextEditNode, State, m_Screen);
                    Elements.Add(TextEditNode.Name, Txt);
                    break;
                case NodeType.AddSlider:
                    AddSliderNode SliderNode = (AddSliderNode)UINode.GetNode(node);
                    UISlider Slider = new UISlider(SliderNode, State, m_Screen);
                    Elements.Add(SliderNode.Name, Slider);
                    break;
                case NodeType.SetSharedProperties: //Assigns a bunch of shared properties to declarations following the statement.
                    State.InSharedPropertiesGroup = true;
                    SetSharedPropsNode SharedPropsNode = (SetSharedPropsNode)UINode.GetNode(node);

                    if (SharedPropsNode.StringTable != null)
                        State.CurrentStringTable = (int)SharedPropsNode.StringTable;

                    if (SharedPropsNode.ControlPosition != null)
                    {
                        State.Position[0] = SharedPropsNode.ControlPosition.Numbers[0];
                        State.Position[1] = SharedPropsNode.ControlPosition.Numbers[1];
                        break;
                    }

                    if (SharedPropsNode.Color != null)
                    {
                        State.Color = new Color();
                        State.Color.R = (byte)SharedPropsNode.Color.Numbers[0];
                        State.Color.G = (byte)SharedPropsNode.Color.Numbers[1];
                        State.Color.B = (byte)SharedPropsNode.Color.Numbers[2];
                    }

                    if (SharedPropsNode.TextColor != null)
                    {
                        State.TextColor = new Color();
                        State.TextColor.R = (byte)SharedPropsNode.TextColor.Numbers[0];
                        State.TextColor.G = (byte)SharedPropsNode.TextColor.Numbers[1];
                        State.TextColor.B = (byte)SharedPropsNode.TextColor.Numbers[2];
                    }

                    if (SharedPropsNode.TextColorSelected != null)
                    {
                        State.TextColorSelected = new Color();
                        State.TextColorSelected.R = (byte)SharedPropsNode.TextColorSelected.Numbers[0];
                        State.TextColorSelected.G = (byte)SharedPropsNode.TextColorSelected.Numbers[1];
                        State.TextColorSelected.B = (byte)SharedPropsNode.TextColorSelected.Numbers[2];
                    }

                    if (SharedPropsNode.TextColorHighlighted != null)
                    {
                        State.TextColorHighlighted = new Color();
                        State.TextColorHighlighted.R = (byte)SharedPropsNode.TextColorHighlighted.Numbers[0];
                        State.TextColorHighlighted.G = (byte)SharedPropsNode.TextColorHighlighted.Numbers[1];
                        State.TextColorHighlighted.B = (byte)SharedPropsNode.TextColorHighlighted.Numbers[2];
                    }

                    if (SharedPropsNode.TextColorDisabled != null)
                    {
                        State.TextColorDisabled = new Color();
                        State.TextColorDisabled.R = (byte)SharedPropsNode.TextColorDisabled.Numbers[0];
                        State.TextColorDisabled.G = (byte)SharedPropsNode.TextColorDisabled.Numbers[1];
                        State.TextColorDisabled.B = (byte)SharedPropsNode.TextColorDisabled.Numbers[2];
                    }

                    if (SharedPropsNode.BackColor != null)
                    {
                        State.BackColor = new Color();
                        State.BackColor.R = (byte)SharedPropsNode.BackColor.Numbers[0];
                        State.BackColor.G = (byte)SharedPropsNode.BackColor.Numbers[1];
                        State.BackColor.B = (byte)SharedPropsNode.BackColor.Numbers[2];
                    }

                    if (SharedPropsNode.CursorColor != null)
                    {
                        State.CursorColor = new Color();
                        State.CursorColor.R = (byte)SharedPropsNode.CursorColor.Numbers[0];
                        State.CursorColor.G = (byte)SharedPropsNode.CursorColor.Numbers[1];
                        State.CursorColor.B = (byte)SharedPropsNode.CursorColor.Numbers[2];
                    }

                    if (SharedPropsNode.TextButton)
                        State.TextButton = true;

                    if (SharedPropsNode.Opaque != null)
                        State.IsOpaque = (SharedPropsNode.Opaque == 1) ? true : false;

                    if (SharedPropsNode.Transparent != null)
                        State.IsTransparent = (SharedPropsNode.Transparent == 1) ? true : false;

                    if (SharedPropsNode.Alignment != null)
                        State.Alignment = (int)SharedPropsNode.Alignment;

                    if (SharedPropsNode.Image != "")
                        State.Image = SharedPropsNode.Image;

                    if (SharedPropsNode.Tooltip != "")
                        State.Tooltip = SharedPropsNode.Tooltip;

                    if (SharedPropsNode.Text != "")
                        State.Caption = SharedPropsNode.Text;

                    if (SharedPropsNode.Size != null)
                        State.Size = new Vector2(SharedPropsNode.Size.Numbers[0], SharedPropsNode.Size.Numbers[1]);

                    if (SharedPropsNode.Orientation != null)
                        State.Orientation = (int)SharedPropsNode.Orientation;

                    if (SharedPropsNode.Font != null)
                        State.Font = (int)SharedPropsNode.Font;

                    if (SharedPropsNode.Opaque != null)
                        State.Opaque = (int)SharedPropsNode.Opaque;

                    break;
                case NodeType.SetControlProperties: //Sets a bunch of properties to a specified control.
                    SetControlPropsNode ControlPropsNode = (SetControlPropsNode)UINode.GetNode(node);

                    UIControl Ctrl = new UIControl(ControlPropsNode, m_Screen, State);
                    Controls.Add(ControlPropsNode.Control, Ctrl);

                    if (State.InSharedPropertiesGroup)
                    {
                        UIElement Test = new UIElement(m_Screen, null);
                        //Script implicitly created an object... :\
                        if (!Elements.TryGetValue(ControlPropsNode.Control, out Test))
                        {
                            Elements.Add(ControlPropsNode.Control, new UIElement(m_Screen, null));

                            if (Ctrl.Image != null)
                                Elements[ControlPropsNode.Control].Image = new UIImage(Ctrl.Image);

                            Elements[ControlPropsNode.Control].Position = Ctrl.Position;
                        }
                    }

                    break;
                case NodeType.End:
                    State.InSharedPropertiesGroup = false;
                    State.Image = ""; //Reset
                    State.TextButton = false; //Reset
                    State.Color = new Color();
                    State.Caption = "";
                    //TODO: Reset more?
                    break;
            }

            foreach (AstNode child in node.ChildNodes)
                WalkTree(State, child);
        }