Esempio n. 1
0
        private void MakeInfoMenu(UIElement parentContainer)
        {
            UIElement uIElement = new UIElement
            {
                Width  = StyleDimension.FromPixelsAndPercent(0f, 1f),
                Height = StyleDimension.FromPixelsAndPercent(0f, 1f),
                HAlign = 0.5f,
                VAlign = 0f
            };

            uIElement.SetPadding(10f);
            uIElement.PaddingBottom = 0f;
            uIElement.PaddingTop    = 0f;
            parentContainer.Append(uIElement);
            float num    = 0f;
            float num2   = 44f;
            float num3   = 88f + num2;
            float pixels = num2;
            GroupOptionButton <bool> groupOptionButton = new GroupOptionButton <bool>(option: true, null, Language.GetText("UI.WorldCreationRandomizeNameDescription"), Color.White, "Images/UI/WorldCreation/IconRandomName")
            {
                Width  = StyleDimension.FromPixelsAndPercent(40f, 0f),
                Height = new StyleDimension(40f, 0f),
                HAlign = 0f,
                Top    = StyleDimension.FromPixelsAndPercent(num, 0f),
                ShowHighlightWhenSelected = false
            };

            groupOptionButton.OnMouseDown += ClickRandomizeName;
            groupOptionButton.OnMouseOver += ShowOptionDescription;
            groupOptionButton.OnMouseOut  += ClearOptionDescription;
            groupOptionButton.SetSnapPoint("RandomizeName", 0);
            uIElement.Append(groupOptionButton);
            UICharacterNameButton uICharacterNameButton = new UICharacterNameButton(Language.GetText("UI.WorldCreationName"), Language.GetText("UI.WorldCreationNameEmpty"), Language.GetText("UI.WorldDescriptionName"))
            {
                Width  = StyleDimension.FromPixelsAndPercent(0f - num3, 1f),
                HAlign = 0f,
                Left   = new StyleDimension(pixels, 0f),
                Top    = StyleDimension.FromPixelsAndPercent(num, 0f)
            };

            uICharacterNameButton.OnMouseDown += Click_SetName;
            uICharacterNameButton.OnMouseOver += ShowOptionDescription;
            uICharacterNameButton.OnMouseOut  += ClearOptionDescription;
            uICharacterNameButton.SetSnapPoint("Name", 0);
            uIElement.Append(uICharacterNameButton);
            _namePlate = uICharacterNameButton;
            num       += uICharacterNameButton.GetDimensions().Height + 4f;
            GroupOptionButton <bool> groupOptionButton2 = new GroupOptionButton <bool>(option: true, null, Language.GetText("UI.WorldCreationRandomizeSeedDescription"), Color.White, "Images/UI/WorldCreation/IconRandomSeed")
            {
                Width  = StyleDimension.FromPixelsAndPercent(40f, 0f),
                Height = new StyleDimension(40f, 0f),
                HAlign = 0f,
                Top    = StyleDimension.FromPixelsAndPercent(num, 0f),
                ShowHighlightWhenSelected = false
            };

            groupOptionButton2.OnMouseDown += ClickRandomizeSeed;
            groupOptionButton2.OnMouseOver += ShowOptionDescription;
            groupOptionButton2.OnMouseOut  += ClearOptionDescription;
            groupOptionButton2.SetSnapPoint("RandomizeSeed", 0);
            uIElement.Append(groupOptionButton2);
            UICharacterNameButton uICharacterNameButton2 = new UICharacterNameButton(Language.GetText("UI.WorldCreationSeed"), Language.GetText("UI.WorldCreationSeedEmpty"), Language.GetText("UI.WorldDescriptionSeed"))
            {
                Width  = StyleDimension.FromPixelsAndPercent(0f - num3, 1f),
                HAlign = 0f,
                Left   = new StyleDimension(pixels, 0f),
                Top    = StyleDimension.FromPixelsAndPercent(num, 0f),
                DistanceFromTitleToOption = 29f
            };

            uICharacterNameButton2.OnMouseDown += Click_SetSeed;
            uICharacterNameButton2.OnMouseOver += ShowOptionDescription;
            uICharacterNameButton2.OnMouseOut  += ClearOptionDescription;
            uICharacterNameButton2.SetSnapPoint("Seed", 0);
            uIElement.Append(uICharacterNameButton2);
            _seedPlate = uICharacterNameButton2;
            UIWorldCreationPreview uIWorldCreationPreview = new UIWorldCreationPreview
            {
                Width  = StyleDimension.FromPixels(84f),
                Height = StyleDimension.FromPixels(84f),
                HAlign = 1f,
                VAlign = 0f
            };

            uIElement.Append(uIWorldCreationPreview);
            _previewPlate = uIWorldCreationPreview;
            num          += uICharacterNameButton2.GetDimensions().Height + 10f;
            AddHorizontalSeparator(uIElement, num + 2f);
            float usableWidthPercent = 1f;

            AddWorldSizeOptions(uIElement, num, ClickSizeOption, "size", usableWidthPercent);
            num += 48f;
            AddHorizontalSeparator(uIElement, num);
            AddWorldDifficultyOptions(uIElement, num, ClickDifficultyOption, "difficulty", usableWidthPercent);
            num += 48f;
            AddHorizontalSeparator(uIElement, num);
            AddWorldEvilOptions(uIElement, num, ClickEvilOption, "evil", usableWidthPercent);
            num += 48f;
            AddHorizontalSeparator(uIElement, num);
            AddDescriptionPanel(uIElement, num, "desc");
            SetDefaultOptions();
        }
Esempio n. 2
0
        private void MakeInfoMenu(UIElement parentContainer)
        {
            UIElement uiElement = new UIElement()
            {
                Width  = StyleDimension.FromPixelsAndPercent(0.0f, 1f),
                Height = StyleDimension.FromPixelsAndPercent(0.0f, 1f),
                HAlign = 0.5f,
                VAlign = 0.0f
            };

            uiElement.SetPadding(10f);
            uiElement.PaddingBottom = 0.0f;
            uiElement.PaddingTop    = 0.0f;
            parentContainer.Append(uiElement);
            float pixels1 = 0.0f;
            float num1    = 44f;
            float num2    = (float)(88.0 + (double)num1);
            float pixels2 = num1;
            GroupOptionButton <bool> groupOptionButton1 = new GroupOptionButton <bool>(true, (LocalizedText)null, Language.GetText("UI.WorldCreationRandomizeNameDescription"), Color.White, "Images/UI/WorldCreation/IconRandomName", 1f, 0.5f, 10f);

            groupOptionButton1.Width  = StyleDimension.FromPixelsAndPercent(40f, 0.0f);
            groupOptionButton1.Height = new StyleDimension(40f, 0.0f);
            groupOptionButton1.HAlign = 0.0f;
            groupOptionButton1.Top    = StyleDimension.FromPixelsAndPercent(pixels1, 0.0f);
            groupOptionButton1.ShowHighlightWhenSelected = false;
            GroupOptionButton <bool> groupOptionButton2 = groupOptionButton1;

            groupOptionButton2.OnMouseDown += new UIElement.MouseEvent(this.ClickRandomizeName);
            groupOptionButton2.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
            groupOptionButton2.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
            groupOptionButton2.SetSnapPoint("RandomizeName", 0, new Vector2?(), new Vector2?());
            uiElement.Append((UIElement)groupOptionButton2);
            UICharacterNameButton characterNameButton1 = new UICharacterNameButton(Language.GetText("UI.WorldCreationName"), Language.GetText("UI.WorldCreationNameEmpty"), Language.GetText("UI.WorldDescriptionName"));

            characterNameButton1.Width  = StyleDimension.FromPixelsAndPercent(-num2, 1f);
            characterNameButton1.HAlign = 0.0f;
            characterNameButton1.Left   = new StyleDimension(pixels2, 0.0f);
            characterNameButton1.Top    = StyleDimension.FromPixelsAndPercent(pixels1, 0.0f);
            UICharacterNameButton characterNameButton2 = characterNameButton1;

            characterNameButton2.OnMouseDown += new UIElement.MouseEvent(this.Click_SetName);
            characterNameButton2.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
            characterNameButton2.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
            characterNameButton2.SetSnapPoint("Name", 0, new Vector2?(), new Vector2?());
            uiElement.Append((UIElement)characterNameButton2);
            this._namePlate = characterNameButton2;
            CalculatedStyle          dimensions1        = characterNameButton2.GetDimensions();
            float                    pixels3            = pixels1 + (dimensions1.Height + 4f);
            GroupOptionButton <bool> groupOptionButton3 = new GroupOptionButton <bool>(true, (LocalizedText)null, Language.GetText("UI.WorldCreationRandomizeSeedDescription"), Color.White, "Images/UI/WorldCreation/IconRandomSeed", 1f, 0.5f, 10f);

            groupOptionButton3.Width  = StyleDimension.FromPixelsAndPercent(40f, 0.0f);
            groupOptionButton3.Height = new StyleDimension(40f, 0.0f);
            groupOptionButton3.HAlign = 0.0f;
            groupOptionButton3.Top    = StyleDimension.FromPixelsAndPercent(pixels3, 0.0f);
            groupOptionButton3.ShowHighlightWhenSelected = false;
            GroupOptionButton <bool> groupOptionButton4 = groupOptionButton3;

            groupOptionButton4.OnMouseDown += new UIElement.MouseEvent(this.ClickRandomizeSeed);
            groupOptionButton4.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
            groupOptionButton4.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
            groupOptionButton4.SetSnapPoint("RandomizeSeed", 0, new Vector2?(), new Vector2?());
            uiElement.Append((UIElement)groupOptionButton4);
            UICharacterNameButton characterNameButton3 = new UICharacterNameButton(Language.GetText("UI.WorldCreationSeed"), Language.GetText("UI.WorldCreationSeedEmpty"), Language.GetText("UI.WorldDescriptionSeed"));

            characterNameButton3.Width  = StyleDimension.FromPixelsAndPercent(-num2, 1f);
            characterNameButton3.HAlign = 0.0f;
            characterNameButton3.Left   = new StyleDimension(pixels2, 0.0f);
            characterNameButton3.Top    = StyleDimension.FromPixelsAndPercent(pixels3, 0.0f);
            characterNameButton3.DistanceFromTitleToOption = 29f;
            UICharacterNameButton characterNameButton4 = characterNameButton3;

            characterNameButton4.OnMouseDown += new UIElement.MouseEvent(this.Click_SetSeed);
            characterNameButton4.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
            characterNameButton4.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
            characterNameButton4.SetSnapPoint("Seed", 0, new Vector2?(), new Vector2?());
            uiElement.Append((UIElement)characterNameButton4);
            this._seedPlate = characterNameButton4;
            UIWorldCreationPreview worldCreationPreview1 = new UIWorldCreationPreview();

            worldCreationPreview1.Width  = StyleDimension.FromPixels(84f);
            worldCreationPreview1.Height = StyleDimension.FromPixels(84f);
            worldCreationPreview1.HAlign = 1f;
            worldCreationPreview1.VAlign = 0.0f;
            UIWorldCreationPreview worldCreationPreview2 = worldCreationPreview1;

            uiElement.Append((UIElement)worldCreationPreview2);
            this._previewPlate = worldCreationPreview2;
            CalculatedStyle dimensions2        = characterNameButton4.GetDimensions();
            float           accumualtedHeight1 = pixels3 + (dimensions2.Height + 10f);

            UIWorldCreation.AddHorizontalSeparator(uiElement, accumualtedHeight1 + 2f);
            float usableWidthPercent = 1f;

            this.AddWorldSizeOptions(uiElement, accumualtedHeight1, new UIElement.MouseEvent(this.ClickSizeOption), "size", usableWidthPercent);
            float accumualtedHeight2 = accumualtedHeight1 + 48f;

            UIWorldCreation.AddHorizontalSeparator(uiElement, accumualtedHeight2);
            this.AddWorldDifficultyOptions(uiElement, accumualtedHeight2, new UIElement.MouseEvent(this.ClickDifficultyOption), "difficulty", usableWidthPercent);
            float accumualtedHeight3 = accumualtedHeight2 + 48f;

            UIWorldCreation.AddHorizontalSeparator(uiElement, accumualtedHeight3);
            this.AddWorldEvilOptions(uiElement, accumualtedHeight3, new UIElement.MouseEvent(this.ClickEvilOption), "evil", usableWidthPercent);
            float num3 = accumualtedHeight3 + 48f;

            UIWorldCreation.AddHorizontalSeparator(uiElement, num3);
            this.AddDescriptionPanel(uiElement, num3, "desc");
            this.SetDefaultOptions();
        }