private List <UIElement> CreateMainPowerStrip() { UICreativePowersMenu.MenuTree <UICreativePowersMenu.OpenMainSubCategory> mainCategory = this._mainCategory; mainCategory.Buttons.Clear(); List <UIElement> elements = new List <UIElement>(); CreativePowerUIElementRequestInfo request = new CreativePowerUIElementRequestInfo() { PreferredButtonWidth = 40, PreferredButtonHeight = 40 }; GroupOptionButton <int> categoryButton1 = CreativePowersHelper.CreateCategoryButton <int>(request, 1, 0); categoryButton1.Append((UIElement)CreativePowersHelper.GetIconImage(CreativePowersHelper.CreativePowerIconLocations.ItemDuplication)); categoryButton1.OnClick += new UIElement.MouseEvent(this.MainCategoryButtonClick); categoryButton1.OnUpdate += new UIElement.ElementEvent(this.itemsWindowButton_OnUpdate); mainCategory.Buttons.Add(1, categoryButton1); elements.Add((UIElement)categoryButton1); GroupOptionButton <int> categoryButton2 = CreativePowersHelper.CreateCategoryButton <int>(request, 2, 0); categoryButton2.Append((UIElement)CreativePowersHelper.GetIconImage(CreativePowersHelper.CreativePowerIconLocations.ItemResearch)); categoryButton2.OnClick += new UIElement.MouseEvent(this.MainCategoryButtonClick); categoryButton2.OnUpdate += new UIElement.ElementEvent(this.researchWindowButton_OnUpdate); mainCategory.Buttons.Add(2, categoryButton2); elements.Add((UIElement)categoryButton2); GroupOptionButton <int> categoryButton3 = CreativePowersHelper.CreateCategoryButton <int>(request, 3, 0); categoryButton3.Append((UIElement)CreativePowersHelper.GetIconImage(CreativePowersHelper.CreativePowerIconLocations.TimeCategory)); categoryButton3.OnClick += new UIElement.MouseEvent(this.MainCategoryButtonClick); categoryButton3.OnUpdate += new UIElement.ElementEvent(this.timeCategoryButton_OnUpdate); mainCategory.Buttons.Add(3, categoryButton3); elements.Add((UIElement)categoryButton3); GroupOptionButton <int> categoryButton4 = CreativePowersHelper.CreateCategoryButton <int>(request, 4, 0); categoryButton4.Append((UIElement)CreativePowersHelper.GetIconImage(CreativePowersHelper.CreativePowerIconLocations.WeatherCategory)); categoryButton4.OnClick += new UIElement.MouseEvent(this.MainCategoryButtonClick); categoryButton4.OnUpdate += new UIElement.ElementEvent(this.weatherCategoryButton_OnUpdate); mainCategory.Buttons.Add(4, categoryButton4); elements.Add((UIElement)categoryButton4); GroupOptionButton <int> categoryButton5 = CreativePowersHelper.CreateCategoryButton <int>(request, 6, 0); categoryButton5.Append((UIElement)CreativePowersHelper.GetIconImage(CreativePowersHelper.CreativePowerIconLocations.PersonalCategory)); categoryButton5.OnClick += new UIElement.MouseEvent(this.MainCategoryButtonClick); categoryButton5.OnUpdate += new UIElement.ElementEvent(this.personalCategoryButton_OnUpdate); mainCategory.Buttons.Add(6, categoryButton5); elements.Add((UIElement)categoryButton5); CreativePowerManager.Instance.GetPower <CreativePowers.StopBiomeSpreadPower>().ProvidePowerButtons(request, elements); GroupOptionButton <int> subcategoryButton = this.CreateSubcategoryButton <CreativePowers.DifficultySliderPower>(ref request, 1, "strip 1", 5, 0, mainCategory.Buttons, mainCategory.Sliders); subcategoryButton.OnClick += new UIElement.MouseEvent(this.MainCategoryButtonClick); elements.Add((UIElement)subcategoryButton); return(elements); }
private void RefreshElementsOrder() { this._container.RemoveAllChildren(); this._container.Append((UIElement)this._mainPowerStrip); UIElement element = (UIElement)null; UICreativePowersMenu.MenuTree <UICreativePowersMenu.OpenMainSubCategory> mainCategory = this._mainCategory; if (mainCategory.Sliders.TryGetValue(mainCategory.CurrentOption, out element)) { this._container.Append(element); } if (mainCategory.CurrentOption == 1) { this._infiniteItemsWindow.SetPageTypeToShow(UICreativeInfiniteItemsDisplay.InfiniteItemsDisplayPage.InfiniteItemsPickup); this._container.Append((UIElement)this._infiniteItemsWindow); } if (mainCategory.CurrentOption == 2) { this._infiniteItemsWindow.SetPageTypeToShow(UICreativeInfiniteItemsDisplay.InfiniteItemsDisplayPage.InfiniteItemsResearch); this._container.Append((UIElement)this._infiniteItemsWindow); } if (mainCategory.CurrentOption == 3) { this._container.Append((UIElement)this._timePowersStrip); UICreativePowersMenu.MenuTree <UICreativePowersMenu.TimeSubcategory> timeCategory = this._timeCategory; if (timeCategory.Sliders.TryGetValue(timeCategory.CurrentOption, out element)) { this._container.Append(element); } } if (mainCategory.CurrentOption == 4) { this._container.Append((UIElement)this._weatherPowersStrip); UICreativePowersMenu.MenuTree <UICreativePowersMenu.WeatherSubcategory> weatherCategory = this._weatherCategory; if (weatherCategory.Sliders.TryGetValue(weatherCategory.CurrentOption, out element)) { this._container.Append(element); } } if (mainCategory.CurrentOption != 6) { return; } this._container.Append((UIElement)this._personalPowersStrip); UICreativePowersMenu.MenuTree <UICreativePowersMenu.PersonalSubcategory> personalCategory = this._personalCategory; if (!personalCategory.Sliders.TryGetValue(personalCategory.CurrentOption, out element)) { return; } this._container.Append(element); }
private void ToggleCategory <TEnum>( UICreativePowersMenu.MenuTree <TEnum> tree, int option, TEnum defaultOption) where TEnum : struct, IConvertible { if (tree.CurrentOption == option) { option = defaultOption.ToInt32((IFormatProvider)null); } tree.CurrentOption = option; foreach (GroupOptionButton <int> groupOptionButton in tree.Buttons.Values) { groupOptionButton.SetCurrentOption(option); } }
private List <UIElement> CreatePersonalPowerStrip() { UICreativePowersMenu.MenuTree <UICreativePowersMenu.PersonalSubcategory> personalCategory = this._personalCategory; List <UIElement> elements = new List <UIElement>(); CreativePowerUIElementRequestInfo request = new CreativePowerUIElementRequestInfo() { PreferredButtonWidth = 40, PreferredButtonHeight = 40 }; CreativePowerManager.Instance.GetPower <CreativePowers.GodmodePower>().ProvidePowerButtons(request, elements); CreativePowerManager.Instance.GetPower <CreativePowers.FarPlacementRangePower>().ProvidePowerButtons(request, elements); GroupOptionButton <int> subcategoryButton = this.CreateSubcategoryButton <CreativePowers.SpawnRateSliderPerPlayerPower>(ref request, 2, "strip 2", 1, 0, personalCategory.Buttons, personalCategory.Sliders); subcategoryButton.OnClick += new UIElement.MouseEvent(this.PersonalCategoryButtonClick); elements.Add((UIElement)subcategoryButton); return(elements); }
private List <UIElement> CreateWeatherPowerStrip() { UICreativePowersMenu.MenuTree <UICreativePowersMenu.WeatherSubcategory> weatherCategory = this._weatherCategory; List <UIElement> elements = new List <UIElement>(); CreativePowerUIElementRequestInfo request = new CreativePowerUIElementRequestInfo() { PreferredButtonWidth = 40, PreferredButtonHeight = 40 }; GroupOptionButton <int> subcategoryButton1 = this.CreateSubcategoryButton <CreativePowers.ModifyWindDirectionAndStrength>(ref request, 2, "strip 2", 1, 0, weatherCategory.Buttons, weatherCategory.Sliders); subcategoryButton1.OnClick += new UIElement.MouseEvent(this.WeatherCategoryButtonClick); elements.Add((UIElement)subcategoryButton1); CreativePowerManager.Instance.GetPower <CreativePowers.FreezeWindDirectionAndStrength>().ProvidePowerButtons(request, elements); GroupOptionButton <int> subcategoryButton2 = this.CreateSubcategoryButton <CreativePowers.ModifyRainPower>(ref request, 2, "strip 2", 2, 0, weatherCategory.Buttons, weatherCategory.Sliders); subcategoryButton2.OnClick += new UIElement.MouseEvent(this.WeatherCategoryButtonClick); elements.Add((UIElement)subcategoryButton2); CreativePowerManager.Instance.GetPower <CreativePowers.FreezeRainPower>().ProvidePowerButtons(request, elements); return(elements); }
private List <UIElement> CreateTimePowerStrip() { UICreativePowersMenu.MenuTree <UICreativePowersMenu.TimeSubcategory> timeCategory = this._timeCategory; List <UIElement> elements = new List <UIElement>(); CreativePowerUIElementRequestInfo request = new CreativePowerUIElementRequestInfo() { PreferredButtonWidth = 40, PreferredButtonHeight = 40 }; CreativePowerManager.Instance.GetPower <CreativePowers.FreezeTime>().ProvidePowerButtons(request, elements); CreativePowerManager.Instance.GetPower <CreativePowers.StartDayImmediately>().ProvidePowerButtons(request, elements); CreativePowerManager.Instance.GetPower <CreativePowers.StartNoonImmediately>().ProvidePowerButtons(request, elements); CreativePowerManager.Instance.GetPower <CreativePowers.StartNightImmediately>().ProvidePowerButtons(request, elements); CreativePowerManager.Instance.GetPower <CreativePowers.StartMidnightImmediately>().ProvidePowerButtons(request, elements); GroupOptionButton <int> subcategoryButton = this.CreateSubcategoryButton <CreativePowers.ModifyTimeRate>(ref request, 2, "strip 2", 1, 0, timeCategory.Buttons, timeCategory.Sliders); subcategoryButton.OnClick += new UIElement.MouseEvent(this.TimeCategoryButtonClick); elements.Add((UIElement)subcategoryButton); return(elements); }