Esempio n. 1
0
        private void ClickSizeOption(UIMouseEvent evt, UIElement listeningElement)
        {
            GroupOptionButton <WorldSizeId> groupOptionButton = (GroupOptionButton <WorldSizeId>)listeningElement;

            _optionSize = groupOptionButton.OptionValue;
            GroupOptionButton <WorldSizeId>[] sizeButtons = _sizeButtons;
            for (int i = 0; i < sizeButtons.Length; i++)
            {
                sizeButtons[i].SetCurrentOption(groupOptionButton.OptionValue);
            }
            UpdatePreviewPlate();
        }
Esempio n. 2
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;
 }
Esempio n. 3
0
        private void ProcessSeed(out string processedSeed)
        {
            processedSeed = _optionSeed;
            if (processedSeed.ToLower() == "not the bees" || processedSeed.ToLower() == "not the bees!")
            {
                WorldGen.notTheBees = true;
            }
            else
            {
                WorldGen.notTheBees = false;
            }
            if (processedSeed.ToLower() == "for the worthy")
            {
                WorldGen.getGoodWorldGen = true;
            }
            else
            {
                WorldGen.getGoodWorldGen = false;
            }
            string[] array = _optionSeed.Split('.');
            if (array.Length != 4)
            {
                return;
            }
            if (int.TryParse(array[0], out var result))
            {
                switch (result)
                {
                case 1:
                    _optionSize = WorldSizeId.Small;
                    break;

                case 2:
                    _optionSize = WorldSizeId.Medium;
                    break;

                case 3:
                    _optionSize = WorldSizeId.Large;
                    break;
                }
            }
            if (int.TryParse(array[1], out result))
            {
                switch (result)
                {
                case 1:
                    _optionDifficulty = WorldDifficultyId.Normal;
                    break;

                case 2:
                    _optionDifficulty = WorldDifficultyId.Expert;
                    break;

                case 3:
                    _optionDifficulty = WorldDifficultyId.Master;
                    break;

                case 4:
                    _optionDifficulty = WorldDifficultyId.Creative;
                    break;
                }
            }
            if (int.TryParse(array[2], out result))
            {
                switch (result)
                {
                case 1:
                    _optionEvil = WorldEvilId.Corruption;
                    break;

                case 2:
                    _optionEvil = WorldEvilId.Crimson;
                    break;
                }
            }
            processedSeed = array[3];
        }