コード例 #1
0
        public void Init()
        {
            panel = new UIPanel();

            lv = new LayoutWrapperUIElement(panel, 10, 10, 10, 10, 10, new LayoutVertical());
            lv.children.Add(costPanel);

            {
                var topLabel = new UIText("Buff");
                topLabel.TextColor = new Color(137, 233, 9);
                lv.children.Add(new LayoutElementWrapperUIElement(topLabel));

                var ll = new Layout(0, 0, 0, 0, 10, new LayoutHorizontal());

                buffIcon = new UIImage(ModContent.GetTexture("LansToggleableBuffs/ui/unowned"));
                ll.children.Add(new LayoutElementWrapperUIElement(buffIcon));

                buffName = new UIText("TestName");
                ll.children.Add(new LayoutElementWrapperUIElement(buffName));

                lv.children.Add(ll);

                buffEffect = new UIText("Reduces the chance of consuming any ammunition by 20%. ");
                lv.children.Add(new LayoutElementWrapperUIElement(buffEffect));
            }

            lv.Recalculate();
        }
コード例 #2
0
        public void create()
        {
            created = true;
            TooltipPanel.Instance = new TooltipPanel();
            TooltipPanel.Instance.Init();


            // if you set this to true, it will show up in game
            //visible = false;

            buttonPlayTexture1 = ModContent.GetTexture("LansToggleableBuffs/ui/checkbox");
            buttonPlayTexture2 = ModContent.GetTexture("LansToggleableBuffs/ui/checkboxunchecked");

            panel = new UIScrollPanel();             //initialize the panel
            // ignore these extra 0s
            this.Append(panel);

            panelwrapper = new LayoutWrapperUIElement(panel, 0, 0, 0, 0, 10, new LayoutVertical());

            updateSize();

            Main.OnResolutionChanged += delegate(Vector2 newSize)
            {
                updateSize();
            };
        }