Example #1
0
 private void AddWorldSizeOptions(
     UIElement container,
     float accumualtedHeight,
     UIElement.MouseEvent clickEvent,
     string tagGroup,
     float usableWidthPercent)
 {
     UIWorldCreation.WorldSizeId[] worldSizeIdArray = new UIWorldCreation.WorldSizeId[3]
     {
         UIWorldCreation.WorldSizeId.Small,
         UIWorldCreation.WorldSizeId.Medium,
         UIWorldCreation.WorldSizeId.Large
     };
     LocalizedText[] localizedTextArray1 = new LocalizedText[3]
     {
         Lang.menu[92],
         Lang.menu[93],
         Lang.menu[94]
     };
     LocalizedText[] localizedTextArray2 = new LocalizedText[3]
     {
         Language.GetText("UI.WorldDescriptionSizeSmall"),
         Language.GetText("UI.WorldDescriptionSizeMedium"),
         Language.GetText("UI.WorldDescriptionSizeLarge")
     };
     Color[] colorArray = new Color[3]
     {
         Color.Cyan,
         Color.Lerp(Color.Cyan, Color.LimeGreen, 0.5f),
         Color.LimeGreen
     };
     string[] strArray = new string[3]
     {
         "Images/UI/WorldCreation/IconSizeSmall",
         "Images/UI/WorldCreation/IconSizeMedium",
         "Images/UI/WorldCreation/IconSizeLarge"
     };
     GroupOptionButton <UIWorldCreation.WorldSizeId>[] groupOptionButtonArray = new GroupOptionButton <UIWorldCreation.WorldSizeId> [worldSizeIdArray.Length];
     for (int id = 0; id < groupOptionButtonArray.Length; ++id)
     {
         GroupOptionButton <UIWorldCreation.WorldSizeId> groupOptionButton = new GroupOptionButton <UIWorldCreation.WorldSizeId>(worldSizeIdArray[id], localizedTextArray1[id], localizedTextArray2[id], colorArray[id], strArray[id], 1f, 1f, 16f);
         groupOptionButton.Width  = StyleDimension.FromPixelsAndPercent((float)(-4 * (groupOptionButtonArray.Length - 1)), 1f / (float)groupOptionButtonArray.Length * usableWidthPercent);
         groupOptionButton.Left   = StyleDimension.FromPercent(1f - usableWidthPercent);
         groupOptionButton.HAlign = (float)id / (float)(groupOptionButtonArray.Length - 1);
         groupOptionButton.Top.Set(accumualtedHeight, 0.0f);
         groupOptionButton.OnMouseDown += clickEvent;
         groupOptionButton.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
         groupOptionButton.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
         groupOptionButton.SetSnapPoint(tagGroup, id, new Vector2?(), new Vector2?());
         container.Append((UIElement)groupOptionButton);
         groupOptionButtonArray[id] = groupOptionButton;
     }
     this._sizeButtons = groupOptionButtonArray;
 }
Example #2
0
 private void AddWorldEvilOptions(UIElement container, float accumualtedHeight, MouseEvent clickEvent, string tagGroup, float usableWidthPercent)
 {
     WorldEvilId[] array = new WorldEvilId[3]
     {
         WorldEvilId.Random,
         WorldEvilId.Corruption,
         WorldEvilId.Crimson
     };
     LocalizedText[] array2 = new LocalizedText[3]
     {
         Lang.misc[103],
         Lang.misc[101],
         Lang.misc[102]
     };
     LocalizedText[] array3 = new LocalizedText[3]
     {
         Language.GetText("UI.WorldDescriptionEvilRandom"),
         Language.GetText("UI.WorldDescriptionEvilCorrupt"),
         Language.GetText("UI.WorldDescriptionEvilCrimson")
     };
     Color[] array4 = new Color[3]
     {
         Color.White,
         Color.MediumPurple,
         Color.IndianRed
     };
     string[] array5 = new string[3]
     {
         "Images/UI/WorldCreation/IconEvilRandom",
         "Images/UI/WorldCreation/IconEvilCorruption",
         "Images/UI/WorldCreation/IconEvilCrimson"
     };
     GroupOptionButton <WorldEvilId>[] array6 = new GroupOptionButton <WorldEvilId> [array.Length];
     for (int i = 0; i < array6.Length; i++)
     {
         GroupOptionButton <WorldEvilId> groupOptionButton = new GroupOptionButton <WorldEvilId>(array[i], array2[i], array3[i], array4[i], array5[i], 1f, 1f, 16f);
         groupOptionButton.Width  = StyleDimension.FromPixelsAndPercent(-4 * (array6.Length - 1), 1f / (float)array6.Length * usableWidthPercent);
         groupOptionButton.Left   = StyleDimension.FromPercent(1f - usableWidthPercent);
         groupOptionButton.HAlign = (float)i / (float)(array6.Length - 1);
         groupOptionButton.Top.Set(accumualtedHeight, 0f);
         groupOptionButton.OnMouseDown += clickEvent;
         groupOptionButton.OnMouseOver += ShowOptionDescription;
         groupOptionButton.OnMouseOut  += ClearOptionDescription;
         groupOptionButton.SetSnapPoint(tagGroup, i);
         container.Append(groupOptionButton);
         array6[i] = groupOptionButton;
     }
     _evilButtons = array6;
 }
Example #3
0
 private void AddWorldSizeOptions(UIElement container, float accumualtedHeight, MouseEvent clickEvent, string tagGroup, float usableWidthPercent)
 {
     WorldSizeId[] array = new WorldSizeId[3]
     {
         WorldSizeId.Small,
         WorldSizeId.Medium,
         WorldSizeId.Large
     };
     LocalizedText[] array2 = new LocalizedText[3]
     {
         Lang.menu[92],
         Lang.menu[93],
         Lang.menu[94]
     };
     LocalizedText[] array3 = new LocalizedText[3]
     {
         Language.GetText("UI.WorldDescriptionSizeSmall"),
         Language.GetText("UI.WorldDescriptionSizeMedium"),
         Language.GetText("UI.WorldDescriptionSizeLarge")
     };
     Color[] array4 = new Color[3]
     {
         Color.Cyan,
         Color.Lerp(Color.Cyan, Color.LimeGreen, 0.5f),
         Color.LimeGreen
     };
     string[] array5 = new string[3]
     {
         "Images/UI/WorldCreation/IconSizeSmall",
         "Images/UI/WorldCreation/IconSizeMedium",
         "Images/UI/WorldCreation/IconSizeLarge"
     };
     GroupOptionButton <WorldSizeId>[] array6 = new GroupOptionButton <WorldSizeId> [array.Length];
     for (int i = 0; i < array6.Length; i++)
     {
         GroupOptionButton <WorldSizeId> groupOptionButton = new GroupOptionButton <WorldSizeId>(array[i], array2[i], array3[i], array4[i], array5[i], 1f, 1f, 16f);
         groupOptionButton.Width  = StyleDimension.FromPixelsAndPercent(-4 * (array6.Length - 1), 1f / (float)array6.Length * usableWidthPercent);
         groupOptionButton.Left   = StyleDimension.FromPercent(1f - usableWidthPercent);
         groupOptionButton.HAlign = (float)i / (float)(array6.Length - 1);
         groupOptionButton.Top.Set(accumualtedHeight, 0f);
         groupOptionButton.OnMouseDown += clickEvent;
         groupOptionButton.OnMouseOver += ShowOptionDescription;
         groupOptionButton.OnMouseOut  += ClearOptionDescription;
         groupOptionButton.SetSnapPoint(tagGroup, i);
         container.Append(groupOptionButton);
         array6[i] = groupOptionButton;
     }
     _sizeButtons = array6;
 }
Example #4
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();
        }
Example #5
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();
        }