예제 #1
0
        public PaintToolsUI(CheatSheet mod)
        {
            categories.Clear();
            this.view          = new PaintToolsView();
            this.mod           = mod;
            this.CanMove       = true;
            base.Width         = this.view.Width + this.spacing * 2f;
            base.Height        = 35f + this.view.Height + this.spacing * 2f;
            this.view.Position = new Vector2(this.spacing, 55f);
            this.AddChild(this.view);

            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);

            var snaptexture = mod.GetTexture("UI/Snap");

            btnSnap = new UIImageListButton(
                (new ImageList(mod.GetTexture("UI/Snap"), 28, 28)).listTexture,
                new List <object>()
            {
                SnapType.TopLeft, SnapType.TopCenter, SnapType.TopRight,
                SnapType.LeftCenter, SnapType.Center, SnapType.RightCenter,
                SnapType.BottomLeft, SnapType.BottomCenter, SnapType.BottomRight,
            },
                new List <string>()
            {
                CSText("SnapTopLeft"), CSText("SnapTopCenter"), CSText("SnapTopRight"),
                CSText("SnapLeftCenter"), CSText("SnapCenter"), CSText("SnapRightCenter"),
                CSText("SnapBottomLeft"), CSText("SnapBottomCenter"), CSText("SnapBottomRight"),
            },
                4);
            btnSnap.onLeftClick  += (a, b) => btnSnap.NextIamge();
            btnSnap.onRightClick += (a, b) => btnSnap.PrevIamge();
            btnSnap.Position      = new Vector2(this.spacing, this.spacing);
            this.AddChild(btnSnap);

            var position = btnSnap.Position;

            uIImage              = new UIImage(Main.itemTexture[ItemID.TrashCan]);
            position             = position.Offset(btnSnap.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => view.RemoveSelectedItem();
            uIImage.Tooltip      = CSText("DeleteSelection");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueI]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.Import(this.view);
            uIImage.Tooltip      = CSText("ImportData");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueE]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.Export(this.view);
            uIImage.Tooltip      = CSText("ExportData");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueW]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.OnlineImport(this.view);
            uIImage.Tooltip      = "Load Online Schematics Database";
            this.AddChild(uIImage);

            infoPanel                 = new UIView();
            position                  = position.Offset(uIImage.Width + this.spacing, 0);
            infoPanel.Position        = position;
            infoPanel.Y               = 6;
            infoPanel.Width           = 210;
            infoPanel.Height          = 44;
            infoPanel.ForegroundColor = Color.Thistle;
            AddChild(infoPanel);

            infoMessage          = new UILabel("Message Here");
            infoMessage.Scale    = 0.35f;
            infoMessage.Position = new Vector2(30, 10);
            infoPanel.AddChild(infoMessage);

            upVoteButton              = new UIImage(CheatSheet.instance.GetTexture("UI/VoteUp"));
            upVoteButton.Position     = new Vector2(0, 0);
            upVoteButton.onLeftClick += (a, b) => Vote(true);
            upVoteButton.Tooltip      = "Vote Up";
            infoPanel.AddChild(upVoteButton);

            downVoteButton              = new UIImage(CheatSheet.instance.GetTexture("UI/VoteDown"));
            downVoteButton.Position     = new Vector2(0, 24);
            downVoteButton.onLeftClick += (a, b) => Vote(false);
            downVoteButton.Tooltip      = "Vote Down";
            infoPanel.AddChild(downVoteButton);

            infoPanel.Visible = false;

            submitPanel          = new UIView();
            submitPanel.Position = position;
            submitPanel.Y        = 6;
            submitPanel.Width    = 210;
            submitPanel.Height   = 44;
            AddChild(submitPanel);

            submitLabel          = new UILabel("Submit Name:");
            submitLabel.Scale    = 0.35f;
            submitLabel.Position = new Vector2(0, 0);
            submitPanel.AddChild(submitLabel);

            submitInput          = new UITextbox();
            submitInput.Position = new Vector2(0, 20);
            submitInput.Width    = 200;
            submitPanel.AddChild(submitInput);

            submitButton              = new UIImage(Terraria.Graphics.TextureManager.Load("Images/UI/ButtonCloudActive"));
            submitButton.Position     = new Vector2(178, -2);
            submitButton.onLeftClick += (a, b) => Submit();
            submitButton.Tooltip      = "Submit to Schematics Browser";
            submitPanel.AddChild(submitButton);

            submitPanel.Visible = false;
        }
예제 #2
0
        public PaintToolsUI(Mod mod)
        {
            categories.Clear();
            this.view          = new PaintToolsView();
            this.mod           = mod;
            this.CanMove       = true;
            base.Width         = this.view.Width + this.spacing * 2f;
            base.Height        = 35f + this.view.Height + this.spacing * 2f;
            this.view.Position = new Vector2(this.spacing, 55f);
            this.AddChild(this.view);

            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);

            var snaptexture = mod.GetTexture("UI/Snap");

            btnSnap = new UIImageListButton(
                (new ImageList(mod.GetTexture("UI/Snap"), 28, 28)).listTexture,
                new List <object>()
            {
                SnapType.TopLeft, SnapType.TopCenter, SnapType.TopRight,
                SnapType.LeftCenter, SnapType.Center, SnapType.RightCenter,
                SnapType.BottomLeft, SnapType.BottomCenter, SnapType.BottomRight,
            },
                new List <string>()
            {
                CSText("SnapTopLeft"), CSText("SnapTopCenter"), CSText("SnapTopRight"),
                CSText("SnapLeftCenter"), CSText("SnapCenter"), CSText("SnapRightCenter"),
                CSText("SnapBottomLeft"), CSText("SnapBottomCenter"), CSText("SnapBottomRight"),
            },
                4);
            btnSnap.onLeftClick  += (a, b) => btnSnap.NextIamge();
            btnSnap.onRightClick += (a, b) => btnSnap.PrevIamge();
            btnSnap.Position      = new Vector2(this.spacing, this.spacing);
            this.AddChild(btnSnap);

            var position = btnSnap.Position;

            uIImage              = new UIImage(Main.itemTexture[ItemID.TrashCan]);
            position             = position.Offset(btnSnap.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => view.RemoveSelectedItem();
            uIImage.Tooltip      = CSText("DeleteSelection");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueI]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.Import(this.view);
            uIImage.Tooltip      = CSText("ImportData");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueE]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.Export(this.view);
            uIImage.Tooltip      = CSText("ExportData");
            this.AddChild(uIImage);
        }