private static UIPanel CreateBasicPanel()
        {
            UIPanel uiPanel = new UIPanel();

            UICreativeInfiniteItemsDisplay.SetBasicSizesForCreativeSacrificeOrInfinitesPanel((UIElement)uiPanel);
            uiPanel.BackgroundColor *= 0.8f;
            uiPanel.BorderColor     *= 0.8f;
            return(uiPanel);
        }
        private void BuildInfinitesMenuContents(UIElement totalContainer)
        {
            UIPanel basicPanel = UICreativeInfiniteItemsDisplay.CreateBasicPanel();

            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);
            UIDynamicItemCollection dynamicItemCollection = new UIDynamicItemCollection();

            this._itemGrid = dynamicItemCollection;
            UIElement uiElement = new UIElement()
            {
                Height = new StyleDimension(24f, 0.0f),
                Width  = new StyleDimension(0.0f, 1f)
            };

            uiElement.SetPadding(0.0f);
            basicPanel.Append(uiElement);
            this.AddSearchBar(uiElement);
            this._searchBar.SetContents((string)null, true);
            UIList uiList1 = new UIList();

            uiList1.Width  = new StyleDimension(-25f, 1f);
            uiList1.Height = new StyleDimension(-28f, 1f);
            uiList1.VAlign = 1f;
            uiList1.HAlign = 0.0f;
            UIList uiList2 = uiList1;

            basicPanel.Append((UIElement)uiList2);
            float       num         = 4f;
            UIScrollbar uiScrollbar = new UIScrollbar();

            uiScrollbar.Height = new StyleDimension((float)(-28.0 - (double)num * 2.0), 1f);
            uiScrollbar.Top    = new StyleDimension(-num, 0.0f);
            uiScrollbar.VAlign = 1f;
            uiScrollbar.HAlign = 1f;
            UIScrollbar scrollbar = uiScrollbar;

            basicPanel.Append((UIElement)scrollbar);
            uiList2.SetScrollbar(scrollbar);
            uiList2.Add((UIElement)dynamicItemCollection);
            UICreativeItemsInfiniteFilteringOptions filteringOptions = new UICreativeItemsInfiniteFilteringOptions(this._filterer, "CreativeInfinitesFilter");

            filteringOptions.OnClickingOption += new Action(this.filtersHelper_OnClickingOption);
            filteringOptions.Left              = new StyleDimension(20f, 0.0f);
            totalContainer.Append((UIElement)filteringOptions);
            filteringOptions.OnUpdate    += new UIElement.ElementEvent(this.Hover_OnUpdate);
            filteringOptions.OnMouseOver += new UIElement.MouseEvent(this.Hover_OnMouseOver);
            filteringOptions.OnMouseOut  += new UIElement.MouseEvent(this.Hover_OnMouseOut);
        }
        private void sacrificeWindow_OnUpdate(UIElement affectedElement)
        {
            float  num1 = 0.05f;
            float  animationProgress = this.GetSacrificeAnimationProgress();
            double lerpValue         = (double)Utils.GetLerpValue(1f, 0.7f, animationProgress, true);
            float  num2 = 1f + (float)(lerpValue * lerpValue) * 2f;
            float  num3 = num1 * num2;
            float  num4 = 1.142857f;
            float  num5 = 1f;

            UICreativeInfiniteItemsDisplay.OffsetRotationsForCogs((float)(2.0 * (double)num3), this._sacrificeCogsSmall);
            UICreativeInfiniteItemsDisplay.OffsetRotationsForCogs(num4 * num3, this._sacrificeCogsMedium);
            UICreativeInfiniteItemsDisplay.OffsetRotationsForCogs(-num5 * num3, this._sacrificeCogsBig);
            int frameY = 0;

            if (this._sacrificeAnimationTimeLeft != 0)
            {
                float num6 = 0.1f;
                float num7 = 0.06666667f;
                frameY = (double)animationProgress < 1.0 - (double)num6 ? ((double)animationProgress < 1.0 - (double)num6 * 2.0 ? ((double)animationProgress < 1.0 - (double)num6 * 3.0 ? ((double)animationProgress < (double)num7 * 4.0 ? ((double)animationProgress < (double)num7 * 3.0 ? ((double)animationProgress < (double)num7 * 2.0 ? ((double)animationProgress < (double)num7 ? 1 : 2) : 3) : 4) : 5) : 6) : 7) : 8;
                if (this._sacrificeAnimationTimeLeft == 56)
                {
                    SoundEngine.PlaySound(63, -1, -1, 1, 1f, 0.0f);
                    Vector2 vector2 = new Vector2(0.0f, 0.1635f);
                    for (int index = 0; index < 15; ++index)
                    {
                        Vector2 initialVelocity = Main.rand.NextVector2Circular(4f, 3f);
                        if ((double)initialVelocity.Y > 0.0)
                        {
                            initialVelocity.Y = -initialVelocity.Y;
                        }
                        initialVelocity.Y -= 2f;
                        this._pistonParticleSystem.AddParticle((IParticle) new CreativeSacrificeParticle(this._pistonParticleAsset, new Rectangle?(), initialVelocity, Vector2.Zero)
                        {
                            AccelerationPerFrame = vector2,
                            ScaleOffsetPerFrame  = -0.01666667f
                        });
                    }
                }
                if (this._sacrificeAnimationTimeLeft == 40 && this._researchComplete)
                {
                    this._researchComplete = false;
                    SoundEngine.PlaySound(64, -1, -1, 1, 1f, 0.0f);
                }
            }
            this._sacrificePistons.SetFrame(1, 9, 0, frameY, 0, 0);
        }
        private void AddCogsForSacrificeMenu(UIElement sacrificesContainer)
        {
            UIElement uiElement = new UIElement();

            uiElement.IgnoresMouseInteraction = true;
            UICreativeInfiniteItemsDisplay.SetBasicSizesForCreativeSacrificeOrInfinitesPanel(uiElement);
            uiElement.VAlign = 0.5f;
            uiElement.Height = new StyleDimension(170f, 0.0f);
            uiElement.Width  = new StyleDimension(280f, 0.0f);
            uiElement.Top    = new StyleDimension();
            uiElement.SetPadding(0.0f);
            sacrificesContainer.Append(uiElement);
            Vector2 vector2 = new Vector2(-10f, -10f);

            this.AddSymetricalCogsPair(uiElement, new Vector2(22f, 1f) + vector2, "Images/UI/Creative/Research_GearC", this._sacrificeCogsSmall);
            this.AddSymetricalCogsPair(uiElement, new Vector2(1f, 28f) + vector2, "Images/UI/Creative/Research_GearB", this._sacrificeCogsMedium);
            this.AddSymetricalCogsPair(uiElement, new Vector2(5f, 5f) + vector2, "Images/UI/Creative/Research_GearA", this._sacrificeCogsBig);
        }
        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);
        }