public UICreativeItemsInfiniteFilteringOptions(EntryFilterer <Item, IItemEntryFilter> filterer, string snapPointsName) { _filterer = filterer; int num = 40; int count = _filterer.AvailableFilters.Count; int num2 = num * count; Height = new StyleDimension(num, 0f); Width = new StyleDimension(num2, 0f); Top = new StyleDimension(4f, 0f); SetPadding(0f); Asset <Texture2D> val = Main.Assets.Request <Texture2D>("Images/UI/Creative/Infinite_Tabs_B", (AssetRequestMode)1); for (int i = 0; i < _filterer.AvailableFilters.Count; i++) { IItemEntryFilter itemEntryFilter = _filterer.AvailableFilters[i]; val.Frame(2, 4).OffsetSize(-2, -2); UIImageFramed uIImageFramed = new UIImageFramed(val, val.Frame(2, 4).OffsetSize(-2, -2)); uIImageFramed.Left.Set(num * i, 0f); uIImageFramed.OnClick += singleFilterButtonClick; uIImageFramed.OnMouseOver += button_OnMouseOver; uIImageFramed.SetPadding(0f); uIImageFramed.SetSnapPoint(snapPointsName, i); AddOnHover(itemEntryFilter, uIImageFramed, i); UIElement image = itemEntryFilter.GetImage(); image.IgnoresMouseInteraction = true; image.Left = new StyleDimension(6f, 0f); image.HAlign = 0f; uIImageFramed.Append(image); _filtersByButtons[uIImageFramed] = itemEntryFilter; _iconsByButtons[uIImageFramed] = image; Append(uIImageFramed); UpdateVisuals(uIImageFramed, i); } }
public UIAchievementListItem(Achievement achievement) { this.BackgroundColor = new Color(26, 40, 89) * 0.8f; this.BorderColor = new Color(13, 20, 44) * 0.8f; this._achievement = achievement; this.Height.Set(82f, 0.0f); this.Width.Set(0.0f, 1f); this.PaddingTop = 8f; this.PaddingLeft = 9f; int iconIndex = Main.Achievements.GetIconIndex(achievement.Name); this._iconIndex = iconIndex; this._iconFrameUnlocked = new Rectangle(iconIndex % 8 * 66, iconIndex / 8 * 66, 64, 64); this._iconFrameLocked = this._iconFrameUnlocked; this._iconFrameLocked.X += 528; this._iconFrame = this._iconFrameLocked; this.UpdateIconFrame(); this._achievementIcon = new UIImageFramed(TextureManager.Load("Images/UI/Achievements"), this._iconFrame); this.Append((UIElement) this._achievementIcon); this._achievementIconBorders = new UIImage(TextureManager.Load("Images/UI/Achievement_Borders")); this._achievementIconBorders.Left.Set(-4f, 0.0f); this._achievementIconBorders.Top.Set(-4f, 0.0f); this.Append((UIElement) this._achievementIconBorders); this._innerPanelTopTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelTop"); this._innerPanelBottomTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelBottom"); this._categoryTexture = TextureManager.Load("Images/UI/Achievement_Categories"); }
public UIAchievementListItem(Achievement achievement, bool largeForOtherLanguages) { this._large = largeForOtherLanguages; this.BackgroundColor = new Color(26, 40, 89) * 0.8f; this.BorderColor = new Color(13, 20, 44) * 0.8f; float num = (float)(16 + this._large.ToInt() * 20); float pixels1 = (float)(this._large.ToInt() * 6); float pixels2 = (float)(this._large.ToInt() * 12); this._achievement = achievement; this.Height.Set(66f + num, 0.0f); this.Width.Set(0.0f, 1f); this.PaddingTop = 8f; this.PaddingLeft = 9f; int iconIndex = Main.Achievements.GetIconIndex(achievement.Name); this._iconIndex = iconIndex; this._iconFrameUnlocked = new Rectangle(iconIndex % 8 * 66, iconIndex / 8 * 66, 64, 64); this._iconFrameLocked = this._iconFrameUnlocked; this._iconFrameLocked.X += 528; this._iconFrame = this._iconFrameLocked; this.UpdateIconFrame(); this._achievementIcon = new UIImageFramed(TextureManager.Load("Images/UI/Achievements"), this._iconFrame); this._achievementIcon.Left.Set(pixels1, 0.0f); this._achievementIcon.Top.Set(pixels2, 0.0f); this.Append((UIElement)this._achievementIcon); this._achievementIconBorders = new UIImage(TextureManager.Load("Images/UI/Achievement_Borders")); this._achievementIconBorders.Left.Set(pixels1 - 4f, 0.0f); this._achievementIconBorders.Top.Set(pixels2 - 4f, 0.0f); this.Append((UIElement)this._achievementIconBorders); this._innerPanelTopTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelTop"); this._innerPanelBottomTexture = !this._large ? TextureManager.Load("Images/UI/Achievement_InnerPanelBottom") : TextureManager.Load("Images/UI/Achievement_InnerPanelBottom_Large"); this._categoryTexture = TextureManager.Load("Images/UI/Achievement_Categories"); }
public UIAchievementListItem(Achievement achievement) { this.BackgroundColor = new Color(26, 40, 89) * 0.8f; this.BorderColor = new Color(13, 20, 44) * 0.8f; this._achievement = achievement; this.Height.Set(82f, 0f); this.Width.Set(0f, 1f); this.PaddingTop = 8f; this.PaddingLeft = 9f; int iconIndex = Main.Achievements.GetIconIndex(achievement.Name); this._iconIndex = iconIndex; this._iconFrameUnlocked = new Rectangle(iconIndex % 8 * 66, iconIndex / 8 * 66, 64, 64); this._iconFrameLocked = this._iconFrameUnlocked; this._iconFrameLocked.X = this._iconFrameLocked.X + 528; this._iconFrame = this._iconFrameLocked; this.UpdateIconFrame(); this._achievementIcon = new UIImageFramed(TextureManager.Load("Images/UI/Achievements"), this._iconFrame); base.Append(this._achievementIcon); this._achievementIconBorders = new UIImage(TextureManager.Load("Images/UI/Achievement_Borders")); this._achievementIconBorders.Left.Set(-4f, 0f); this._achievementIconBorders.Top.Set(-4f, 0f); base.Append(this._achievementIconBorders); this._innerPanelTopTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelTop"); this._innerPanelBottomTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelBottom"); this._categoryTexture = TextureManager.Load("Images/UI/Achievement_Categories"); }
public UIAchievementListItem(Achievement achievement) { BackgroundColor = new Color(26, 40, 89) * 0.8f; BorderColor = new Color(13, 20, 44) * 0.8f; _achievement = achievement; Height.Set(82f, 0f); Width.Set(0f, 1f); PaddingTop = 8f; PaddingLeft = 9f; int num = _iconIndex = Main.Achievements.GetIconIndex(achievement.Name); _iconFrameUnlocked = new Rectangle(num % 8 * 66, num / 8 * 66, 64, 64); _iconFrameLocked = _iconFrameUnlocked; _iconFrameLocked.X += 528; _iconFrame = _iconFrameLocked; UpdateIconFrame(); _achievementIcon = new UIImageFramed(TextureManager.Load("Images/UI/Achievements"), _iconFrame); Append(_achievementIcon); _achievementIconBorders = new UIImage(TextureManager.Load("Images/UI/Achievement_Borders")); _achievementIconBorders.Left.Set(-4f, 0f); _achievementIconBorders.Top.Set(-4f, 0f); Append(_achievementIconBorders); _innerPanelTopTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelTop"); _innerPanelBottomTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelBottom"); _categoryTexture = TextureManager.Load("Images/UI/Achievement_Categories"); }
private void UpdateVisuals(UIImageFramed button, int indexOfFilter) { bool flag = _filterer.IsFilterActive(indexOfFilter); bool isMouseHovering = button.IsMouseHovering; int frameX = flag.ToInt(); int frameY = flag.ToInt() * 2 + isMouseHovering.ToInt(); button.SetFrame(2, 4, frameX, frameY, -2, -2); IColorable colorable = _iconsByButtons[button] as IColorable; if (colorable != null) { colorable.Color = (flag ? Color.White : (Color.White * 0.5f)); } }
private void UpdateVisuals(UIImageFramed button, int indexOfFilter) { bool flag = this._filterer.IsFilterActive(indexOfFilter); bool isMouseHovering = button.IsMouseHovering; int frameX = flag.ToInt(); int frameY = flag.ToInt() * 2 + isMouseHovering.ToInt(); button.SetFrame(2, 4, frameX, frameY, -2, -2); if (!(this._iconsByButtons[button] is IColorable iconsByButton)) { return; } Color color = flag ? Color.White : Color.White * 0.5f; iconsByButton.Color = color; }
public UIAchievementListItem(Achievement achievement, bool largeForOtherLanguages) { this._large = largeForOtherLanguages; this.BackgroundColor = Color.op_Multiply(new Color(26, 40, 89), 0.8f); this.BorderColor = Color.op_Multiply(new Color(13, 20, 44), 0.8f); float num1 = (float)(16 + this._large.ToInt() * 20); float pixels1 = (float)(this._large.ToInt() * 6); float pixels2 = (float)(this._large.ToInt() * 12); this._achievement = achievement; this.Height.Set(66f + num1, 0.0f); this.Width.Set(0.0f, 1f); this.PaddingTop = 8f; this.PaddingLeft = 9f; int iconIndex = Main.Achievements.GetIconIndex(achievement.Name); this._iconIndex = iconIndex; this._iconFrameUnlocked = new Rectangle(iconIndex % 8 * 66, iconIndex / 8 * 66, 64, 64); this._iconFrameLocked = this._iconFrameUnlocked; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rectangle& local = @this._iconFrameLocked; // ISSUE: explicit reference operation int num2 = (^ local).X + 528; // ISSUE: explicit reference operation (^ local).X = (__Null)num2; this._iconFrame = this._iconFrameLocked; this.UpdateIconFrame(); this._achievementIcon = new UIImageFramed(TextureManager.Load("Images/UI/Achievements"), this._iconFrame); this._achievementIcon.Left.Set(pixels1, 0.0f); this._achievementIcon.Top.Set(pixels2, 0.0f); this.Append((UIElement)this._achievementIcon); this._achievementIconBorders = new UIImage(TextureManager.Load("Images/UI/Achievement_Borders")); this._achievementIconBorders.Left.Set(pixels1 - 4f, 0.0f); this._achievementIconBorders.Top.Set(pixels2 - 4f, 0.0f); this.Append((UIElement)this._achievementIconBorders); this._innerPanelTopTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelTop"); this._innerPanelBottomTexture = !this._large ? TextureManager.Load("Images/UI/Achievement_InnerPanelBottom") : TextureManager.Load("Images/UI/Achievement_InnerPanelBottom_Large"); this._categoryTexture = TextureManager.Load("Images/UI/Achievement_Categories"); }
public UIAchievementListItem(Achievement achievement, bool largeForOtherLanguages) { _large = largeForOtherLanguages; BackgroundColor = new Color(26, 40, 89) * 0.8f; BorderColor = new Color(13, 20, 44) * 0.8f; float num = 16 + _large.ToInt() * 20; float num2 = _large.ToInt() * 6; float num3 = _large.ToInt() * 12; _achievement = achievement; Height.Set(66f + num, 0f); Width.Set(0f, 1f); PaddingTop = 8f; PaddingLeft = 9f; int num4 = _iconIndex = Main.Achievements.GetIconIndex(achievement.Name); _iconFrameUnlocked = new Rectangle(num4 % 8 * 66, num4 / 8 * 66, 64, 64); _iconFrameLocked = _iconFrameUnlocked; _iconFrameLocked.X += 528; _iconFrame = _iconFrameLocked; UpdateIconFrame(); _achievementIcon = new UIImageFramed(Main.Assets.Request <Texture2D>("Images/UI/Achievements", (AssetRequestMode)1), _iconFrame); _achievementIcon.Left.Set(num2, 0f); _achievementIcon.Top.Set(num3, 0f); Append(_achievementIcon); _achievementIconBorders = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Achievement_Borders", (AssetRequestMode)1)); _achievementIconBorders.Left.Set(-4f + num2, 0f); _achievementIconBorders.Top.Set(-4f + num3, 0f); Append(_achievementIconBorders); _innerPanelTopTexture = Main.Assets.Request <Texture2D>("Images/UI/Achievement_InnerPanelTop", (AssetRequestMode)1); if (_large) { _innerPanelBottomTexture = Main.Assets.Request <Texture2D>("Images/UI/Achievement_InnerPanelBottom_Large", (AssetRequestMode)1); } else { _innerPanelBottomTexture = Main.Assets.Request <Texture2D>("Images/UI/Achievement_InnerPanelBottom", (AssetRequestMode)1); } _categoryTexture = Main.Assets.Request <Texture2D>("Images/UI/Achievement_Categories", (AssetRequestMode)1); }
public UICreativeItemsInfiniteFilteringOptions( EntryFilterer <Item, IItemEntryFilter> filterer, string snapPointsName) { this._filterer = filterer; int num1 = 40; int count = this._filterer.AvailableFilters.Count; int num2 = num1 * count; this.Height = new StyleDimension((float)num1, 0.0f); this.Width = new StyleDimension((float)num2, 0.0f); this.Top = new StyleDimension(4f, 0.0f); this.SetPadding(0.0f); Asset <Texture2D> asset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Creative/Infinite_Tabs_B", (AssetRequestMode)1); for (int index = 0; index < this._filterer.AvailableFilters.Count; ++index) { IItemEntryFilter availableFilter = this._filterer.AvailableFilters[index]; asset.Frame(2, 4, 0, 0, 0, 0).OffsetSize(-2, -2); UIImageFramed button = new UIImageFramed(asset, asset.Frame(2, 4, 0, 0, 0, 0).OffsetSize(-2, -2)); button.Left.Set((float)(num1 * index), 0.0f); button.OnClick += new UIElement.MouseEvent(this.singleFilterButtonClick); button.OnMouseOver += new UIElement.MouseEvent(this.button_OnMouseOver); button.SetPadding(0.0f); button.SetSnapPoint(snapPointsName, index, new Vector2?(), new Vector2?()); this.AddOnHover(availableFilter, (UIElement)button, index); UIElement image = availableFilter.GetImage(); image.IgnoresMouseInteraction = true; image.Left = new StyleDimension(6f, 0.0f); image.HAlign = 0.0f; button.Append(image); this._filtersByButtons[button] = availableFilter; this._iconsByButtons[button] = image; this.Append((UIElement)button); this.UpdateVisuals(button, index); } }
private void singleFilterButtonClick(UIMouseEvent evt, UIElement listeningElement) { UIImageFramed uIImageFramed = evt.Target as UIImageFramed; if (uIImageFramed == null || !_filtersByButtons.TryGetValue(uIImageFramed, out IItemEntryFilter value)) { return; } int num = _filterer.AvailableFilters.IndexOf(value); if (num != -1) { if (!_filterer.ActiveFilters.Contains(value)) { _filterer.ActiveFilters.Clear(); } _filterer.ToggleFilter(num); UpdateVisuals(uIImageFramed, num); if (this.OnClickingOption != null) { this.OnClickingOption(); } } }
public void UpdateAvailability() { GetDisplaySettings(out int widthPerButton, out int heightPerButton, out int widthWithSpacing, out int heightWithSpacing, out int perRow, out float offsetLeft, out float offsetTop, out int _); _container.RemoveAllChildren(); _filterButtons.Clear(); _areFiltersAvailable.Clear(); int num = -1; int num2 = -1; for (int i = 0; i < _filterer.AvailableFilters.Count; i++) { int num3 = i / perRow; int num4 = i % perRow; IBestiaryEntryFilter bestiaryEntryFilter = _filterer.AvailableFilters[i]; List <BestiaryEntry> entries = _filterAvailabilityTests[i]; if (GetIsFilterAvailableForEntries(bestiaryEntryFilter, entries)) { GroupOptionButton <int> groupOptionButton = new GroupOptionButton <int>(i, null, null, Color.White, null) { Width = new StyleDimension(widthPerButton, 0f), Height = new StyleDimension(heightPerButton, 0f), HAlign = 0f, VAlign = 0f, Top = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0f), Left = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0f) }; groupOptionButton.OnClick += ClickOption; groupOptionButton.SetSnapPoint("Filters", i); groupOptionButton.ShowHighlightWhenSelected = false; AddOnHover(bestiaryEntryFilter, groupOptionButton); _container.Append(groupOptionButton); UIElement image = bestiaryEntryFilter.GetImage(); if (image != null) { image.Left = new StyleDimension(num, 0f); image.Top = new StyleDimension(num2, 0f); groupOptionButton.Append(image); } _filterButtons.Add(groupOptionButton); } else { _filterer.ActiveFilters.Remove(bestiaryEntryFilter); GroupOptionButton <int> groupOptionButton2 = new GroupOptionButton <int>(-2, null, null, Color.White, null) { Width = new StyleDimension(widthPerButton, 0f), Height = new StyleDimension(heightPerButton, 0f), HAlign = 0f, VAlign = 0f, Top = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0f), Left = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0f), FadeFromBlack = 0.5f }; groupOptionButton2.ShowHighlightWhenSelected = false; groupOptionButton2.SetPadding(0f); groupOptionButton2.SetSnapPoint("Filters", i); Asset <Texture2D> obj = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Tags_Shadow", (AssetRequestMode)1); UIImageFramed uIImageFramed = new UIImageFramed(obj, obj.Frame(16, 5, 0, 4)) { HAlign = 0.5f, VAlign = 0.5f, Color = Color.White * 0.2f }; uIImageFramed.Left = new StyleDimension(num, 0f); uIImageFramed.Top = new StyleDimension(num2, 0f); groupOptionButton2.Append(uIImageFramed); _filterButtons.Add(groupOptionButton2); _container.Append(groupOptionButton2); } } UpdateButtonSelections(); }
private void BuildSacrificeMenuContents(UIElement totalContainer) { UIPanel uIPanel = CreateBasicPanel(); uIPanel.VAlign = 0.5f; uIPanel.Height = new StyleDimension(170f, 0f); uIPanel.Width = new StyleDimension(170f, 0f); uIPanel.Top = default(StyleDimension); totalContainer.Append(uIPanel); uIPanel.OnUpdate += Hover_OnUpdate; uIPanel.OnMouseOver += Hover_OnMouseOver; uIPanel.OnMouseOut += Hover_OnMouseOut; AddCogsForSacrificeMenu(uIPanel); _pistonParticleAsset = Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Spark", (AssetRequestMode)1); float pixels = 0f; UIImage uIImage = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Slots", (AssetRequestMode)1)) { HAlign = 0.5f, VAlign = 0.5f, Top = new StyleDimension(-20f, 0f), Left = new StyleDimension(pixels, 0f) }; uIPanel.Append(uIImage); Asset <Texture2D> obj = Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_FramedPistons", (AssetRequestMode)1); UIImageFramed uIImageFramed = new UIImageFramed(obj, obj.Frame(1, 9)) { HAlign = 0.5f, VAlign = 0.5f, Top = new StyleDimension(-20f, 0f), Left = new StyleDimension(pixels, 0f), IgnoresMouseInteraction = true }; uIPanel.Append(uIImageFramed); _sacrificePistons = uIImageFramed; UIParticleLayer uIParticleLayer = _pistonParticleSystem = new UIParticleLayer { Width = new StyleDimension(0f, 1f), Height = new StyleDimension(0f, 1f), AnchorPositionOffsetByPercents = Vector2.One / 2f, AnchorPositionOffsetByPixels = Vector2.Zero }; uIImageFramed.Append(_pistonParticleSystem); UIElement uIElement = Main.CreativeMenu.ProvideItemSlotElement(0); uIElement.HAlign = 0.5f; uIElement.VAlign = 0.5f; uIElement.Top = new StyleDimension(-15f, 0f); uIElement.Left = new StyleDimension(pixels, 0f); uIElement.SetSnapPoint("CreativeSacrificeSlot", 0); uIImage.Append(uIElement); UIText uIText = new UIText("(0/50)", 0.8f) { Top = new StyleDimension(10f, 0f), Left = new StyleDimension(pixels, 0f), HAlign = 0.5f, VAlign = 0.5f, IgnoresMouseInteraction = true }; uIText.OnUpdate += descriptionText_OnUpdate; uIPanel.Append(uIText); UIPanel uIPanel2 = new UIPanel { Top = new StyleDimension(0f, 0f), Left = new StyleDimension(pixels, 0f), HAlign = 0.5f, VAlign = 1f, Width = new StyleDimension(124f, 0f), Height = new StyleDimension(30f, 0f) }; UIText element = new UIText(Language.GetText("CreativePowers.ConfirmInfiniteItemSacrifice"), 0.8f) { IgnoresMouseInteraction = true, HAlign = 0.5f, VAlign = 0.5f }; uIPanel2.Append(element); uIPanel2.SetSnapPoint("CreativeSacrificeConfirm", 0); uIPanel2.OnClick += sacrificeButton_OnClick; uIPanel2.OnMouseOver += FadedMouseOver; uIPanel2.OnMouseOut += FadedMouseOut; uIPanel2.OnUpdate += research_OnUpdate; uIPanel.Append(uIPanel2); uIPanel.OnUpdate += sacrificeWindow_OnUpdate; }
private void BuildSacrificeMenuContents(UIElement totalContainer) { UIPanel basicPanel = UICreativeInfiniteItemsDisplay.CreateBasicPanel(); basicPanel.VAlign = 0.5f; basicPanel.Height = new StyleDimension(170f, 0.0f); basicPanel.Width = new StyleDimension(170f, 0.0f); basicPanel.Top = new StyleDimension(); totalContainer.Append((UIElement)basicPanel); basicPanel.OnUpdate += new UIElement.ElementEvent(this.Hover_OnUpdate); basicPanel.OnMouseOver += new UIElement.MouseEvent(this.Hover_OnMouseOver); basicPanel.OnMouseOut += new UIElement.MouseEvent(this.Hover_OnMouseOut); this.AddCogsForSacrificeMenu((UIElement)basicPanel); this._pistonParticleAsset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Spark", (AssetRequestMode)1); float pixels = 0.0f; UIImage uiImage1 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Slots", (AssetRequestMode)1)); uiImage1.HAlign = 0.5f; uiImage1.VAlign = 0.5f; uiImage1.Top = new StyleDimension(-20f, 0.0f); uiImage1.Left = new StyleDimension(pixels, 0.0f); UIImage uiImage2 = uiImage1; basicPanel.Append((UIElement)uiImage2); Asset <M0> asset = Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_FramedPistons", (AssetRequestMode)1); UIImageFramed uiImageFramed1 = new UIImageFramed((Asset <Texture2D>)asset, ((Asset <Texture2D>)asset).Frame(1, 9, 0, 0, 0, 0)); uiImageFramed1.HAlign = 0.5f; uiImageFramed1.VAlign = 0.5f; uiImageFramed1.Top = new StyleDimension(-20f, 0.0f); uiImageFramed1.Left = new StyleDimension(pixels, 0.0f); uiImageFramed1.IgnoresMouseInteraction = true; UIImageFramed uiImageFramed2 = uiImageFramed1; basicPanel.Append((UIElement)uiImageFramed2); this._sacrificePistons = uiImageFramed2; UIParticleLayer uiParticleLayer = new UIParticleLayer(); uiParticleLayer.Width = new StyleDimension(0.0f, 1f); uiParticleLayer.Height = new StyleDimension(0.0f, 1f); uiParticleLayer.AnchorPositionOffsetByPercents = Vector2.One / 2f; uiParticleLayer.AnchorPositionOffsetByPixels = Vector2.Zero; this._pistonParticleSystem = uiParticleLayer; uiImageFramed2.Append((UIElement)this._pistonParticleSystem); UIElement element = Main.CreativeMenu.ProvideItemSlotElement(0); element.HAlign = 0.5f; element.VAlign = 0.5f; element.Top = new StyleDimension(-15f, 0.0f); element.Left = new StyleDimension(pixels, 0.0f); element.SetSnapPoint("CreativeSacrificeSlot", 0, new Vector2?(), new Vector2?()); uiImage2.Append(element); UIText uiText1 = new UIText("(0/50)", 0.8f, false); uiText1.Top = new StyleDimension(10f, 0.0f); uiText1.Left = new StyleDimension(pixels, 0.0f); uiText1.HAlign = 0.5f; uiText1.VAlign = 0.5f; uiText1.IgnoresMouseInteraction = true; UIText uiText2 = uiText1; uiText2.OnUpdate += new UIElement.ElementEvent(this.descriptionText_OnUpdate); basicPanel.Append((UIElement)uiText2); UIPanel uiPanel1 = new UIPanel(); uiPanel1.Top = new StyleDimension(0.0f, 0.0f); uiPanel1.Left = new StyleDimension(pixels, 0.0f); uiPanel1.HAlign = 0.5f; uiPanel1.VAlign = 1f; uiPanel1.Width = new StyleDimension(124f, 0.0f); uiPanel1.Height = new StyleDimension(30f, 0.0f); UIPanel uiPanel2 = uiPanel1; UIText uiText3 = new UIText(Language.GetText("CreativePowers.ConfirmInfiniteItemSacrifice"), 0.8f, false); uiText3.IgnoresMouseInteraction = true; uiText3.HAlign = 0.5f; uiText3.VAlign = 0.5f; UIText uiText4 = uiText3; uiPanel2.Append((UIElement)uiText4); uiPanel2.SetSnapPoint("CreativeSacrificeConfirm", 0, new Vector2?(), new Vector2?()); uiPanel2.OnClick += new UIElement.MouseEvent(this.sacrificeButton_OnClick); uiPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiPanel2.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiPanel2.OnUpdate += new UIElement.ElementEvent(this.research_OnUpdate); basicPanel.Append((UIElement)uiPanel2); basicPanel.OnUpdate += new UIElement.ElementEvent(this.sacrificeWindow_OnUpdate); }
public void UpdateAvailability() { int widthPerButton; int heightPerButton; int widthWithSpacing; int heightWithSpacing; int perRow; float offsetLeft; float offsetTop; this.GetDisplaySettings(out widthPerButton, out heightPerButton, out widthWithSpacing, out heightWithSpacing, out perRow, out offsetLeft, out offsetTop, out int _); this._container.RemoveAllChildren(); this._filterButtons.Clear(); this._areFiltersAvailable.Clear(); int num1 = -1; int num2 = -1; for (int index = 0; index < this._filterer.AvailableFilters.Count; ++index) { int num3 = index / perRow; int num4 = index % perRow; IBestiaryEntryFilter availableFilter = this._filterer.AvailableFilters[index]; List <BestiaryEntry> availabilityTest = this._filterAvailabilityTests[index]; if (this.GetIsFilterAvailableForEntries(availableFilter, availabilityTest)) { GroupOptionButton <int> groupOptionButton1 = new GroupOptionButton <int>(index, (LocalizedText)null, (LocalizedText)null, Color.White, (string)null, 1f, 0.5f, 10f); groupOptionButton1.Width = new StyleDimension((float)widthPerButton, 0.0f); groupOptionButton1.Height = new StyleDimension((float)heightPerButton, 0.0f); groupOptionButton1.HAlign = 0.0f; groupOptionButton1.VAlign = 0.0f; groupOptionButton1.Top = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0.0f); groupOptionButton1.Left = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0.0f); GroupOptionButton <int> groupOptionButton2 = groupOptionButton1; groupOptionButton2.OnClick += new UIElement.MouseEvent(this.ClickOption); groupOptionButton2.SetSnapPoint("Filters", index, new Vector2?(), new Vector2?()); groupOptionButton2.ShowHighlightWhenSelected = false; this.AddOnHover(availableFilter, (UIElement)groupOptionButton2); this._container.Append((UIElement)groupOptionButton2); UIElement image = availableFilter.GetImage(); if (image != null) { image.Left = new StyleDimension((float)num1, 0.0f); image.Top = new StyleDimension((float)num2, 0.0f); groupOptionButton2.Append(image); } this._filterButtons.Add(groupOptionButton2); } else { this._filterer.ActiveFilters.Remove(availableFilter); GroupOptionButton <int> groupOptionButton1 = new GroupOptionButton <int>(-2, (LocalizedText)null, (LocalizedText)null, Color.White, (string)null, 1f, 0.5f, 10f); groupOptionButton1.Width = new StyleDimension((float)widthPerButton, 0.0f); groupOptionButton1.Height = new StyleDimension((float)heightPerButton, 0.0f); groupOptionButton1.HAlign = 0.0f; groupOptionButton1.VAlign = 0.0f; groupOptionButton1.Top = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0.0f); groupOptionButton1.Left = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0.0f); groupOptionButton1.FadeFromBlack = 0.5f; GroupOptionButton <int> groupOptionButton2 = groupOptionButton1; groupOptionButton2.ShowHighlightWhenSelected = false; groupOptionButton2.SetPadding(0.0f); groupOptionButton2.SetSnapPoint("Filters", index, new Vector2?(), new Vector2?()); Asset <M0> asset = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Tags_Shadow", (AssetRequestMode)1); UIImageFramed uiImageFramed1 = new UIImageFramed((Asset <Texture2D>)asset, ((Asset <Texture2D>)asset).Frame(16, 5, 0, 4, 0, 0)); uiImageFramed1.HAlign = 0.5f; uiImageFramed1.VAlign = 0.5f; uiImageFramed1.Color = Color.White * 0.2f; UIImageFramed uiImageFramed2 = uiImageFramed1; uiImageFramed2.Left = new StyleDimension((float)num1, 0.0f); uiImageFramed2.Top = new StyleDimension((float)num2, 0.0f); groupOptionButton2.Append((UIElement)uiImageFramed2); this._filterButtons.Add(groupOptionButton2); this._container.Append((UIElement)groupOptionButton2); } } this.UpdateButtonSelections(); }