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 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 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); }