private void ClickSizeOption(UIMouseEvent evt, UIElement listeningElement) { GroupOptionButton <UIWorldCreation.WorldSizeId> groupOptionButton = (GroupOptionButton <UIWorldCreation.WorldSizeId>)listeningElement; this._optionSize = groupOptionButton.OptionValue; foreach (GroupOptionButton <UIWorldCreation.WorldSizeId> sizeButton in this._sizeButtons) { sizeButton.SetCurrentOption(groupOptionButton.OptionValue); } this.UpdatePreviewPlate(); }
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; }
private void ProcessSeed(out string processedSeed) { processedSeed = this._optionSeed; WorldGen.notTheBees = processedSeed.ToLower() == "not the bees" || processedSeed.ToLower() == "not the bees!"; WorldGen.getGoodWorldGen = processedSeed.ToLower() == "for the worthy"; string[] strArray = this._optionSeed.Split('.'); if (strArray.Length != 4) { return; } int result; if (int.TryParse(strArray[0], out result)) { switch (result) { case 1: this._optionSize = UIWorldCreation.WorldSizeId.Small; break; case 2: this._optionSize = UIWorldCreation.WorldSizeId.Medium; break; case 3: this._optionSize = UIWorldCreation.WorldSizeId.Large; break; } } if (int.TryParse(strArray[1], out result)) { switch (result) { case 1: this._optionDifficulty = UIWorldCreation.WorldDifficultyId.Normal; break; case 2: this._optionDifficulty = UIWorldCreation.WorldDifficultyId.Expert; break; case 3: this._optionDifficulty = UIWorldCreation.WorldDifficultyId.Master; break; case 4: this._optionDifficulty = UIWorldCreation.WorldDifficultyId.Creative; break; } } if (int.TryParse(strArray[2], out result)) { switch (result) { case 1: this._optionEvil = UIWorldCreation.WorldEvilId.Corruption; break; case 2: this._optionEvil = UIWorldCreation.WorldEvilId.Crimson; break; } } processedSeed = strArray[3]; }