Beispiel #1
0
        public LoadingWorldState(IGameState parent = null)
        {
            GuiStackContainer progressBarContainer;

            AddChild(progressBarContainer = new GuiStackContainer()
            {
                //Width  = 300,
                //Height = 35,
                //Margin = new Thickness(12),

                Anchor            = Alignment.MiddleCenter,
                Background        = Color.Transparent,
                BackgroundOverlay = Color.Transparent,
                Orientation       = Orientation.Vertical
            });

            if (parent == null)
            {
                Background = new GuiTexture2D
                {
                    TextureResource = GuiTextures.OptionsBackground,
                    RepeatMode      = TextureRepeatMode.Tile,
                    Scale           = new Vector2(2f, 2f),
                };

                BackgroundOverlay = new Color(Color.Black, 0.65f);
            }
            else
            {
                ParentState           = parent;
                HeaderTitle.IsVisible = false;
            }

            progressBarContainer.AddChild(_textDisplay = new GuiTextElement()
            {
                Text      = Text,
                TextColor = TextColor.White,

                Anchor    = Alignment.TopCenter,
                HasShadow = false,
                Scale     = 1.5f
            });

            GuiElement element;

            progressBarContainer.AddChild(element = new GuiElement()
            {
                Width  = 300,
                Height = 35,
                Margin = new Thickness(12),
            });

            element.AddChild(_percentageDisplay = new GuiTextElement()
            {
                Text      = Text,
                TextColor = TextColor.White,

                Anchor    = Alignment.TopRight,
                HasShadow = false
            });

            element.AddChild(_progressBar = new GuiProgressBar()
            {
                Width  = 300,
                Height = 9,

                Anchor = Alignment.MiddleCenter,
            });

            progressBarContainer.AddChild(
                _subTextDisplay = new GuiTextElement()
            {
                Text = Text, TextColor = TextColor.White, Anchor = Alignment.BottomLeft, HasShadow = false
            });

            HeaderTitle.TranslationKey = "menu.loadingLevel";

            UpdateProgress(LoadingState.ConnectingToServer, 10);
        }