예제 #1
0
        private void addmsg_Click(object sender, EventArgs e)
        {
            Button btn = new Button();

            btn.Visible = true;
            totalMSGs++;
            totalMSGsall++;
            btn.Text   = "Message #" + totalMSGsall;
            btn.Parent = mesgpanel;
            btn.Height = 23;
            btn.Width  = 200;
            btn.Top    = ((4 + 23) * (totalMSGs - 1)) - mesgpanel.VerticalScroll.Value;
            btn.Left   = 4;
            btnsmsg.Add(new MessageSettings("Message #" + totalMSGsall));
            btns.Add(btn);
            btn.Click += (object sender2, EventArgs e2) => {
                totalMSGs = 0;
                foreach (Button thebtn in btns)
                {
                    totalMSGs++;
                    Controls.Remove(thebtn);
                    thebtn.Visible = false;
                    thebtn.Top     = ((4 + 23) * (totalMSGs - 1)) - mesgpanel.VerticalScroll.Value;
                }
                totalMSGs = 0;
                foreach (Button thebtn in btns2)
                {
                    totalMSGs++;
                    Controls.Remove(thebtn);
                    thebtn.Visible = false;
                    thebtn.Top     = ((4 + 23) * (totalMSGs - 1)) - mesgpanel.VerticalScroll.Value;
                }
                msgbox.Visible     = true;
                msgbox.Text        = btn.Text;
                msgexitbtn.Visible = true;
                msgPanel2.Visible  = true;
                addmsgPage.Visible = true;
                refmsgPage.Visible = true;
                addmsgPage.Text    = "Add Page to:" + btn.Text;
                FieldInfo        f1   = typeof(Control).GetField("EventClick", BindingFlags.Static | BindingFlags.NonPublic);
                object           obj  = f1.GetValue(msgexitbtn);
                PropertyInfo     pi   = msgexitbtn.GetType().GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance);
                EventHandlerList list = (EventHandlerList)pi.GetValue(msgexitbtn, null);
                list.RemoveHandler(obj, list[obj]);
                msgexitbtn.Click += (object sender3, EventArgs e3) => {
                    if (MessageSettings.findMessageSettings(btnsmsg, btn.Text).changeName(btnsmsg, msgbox.Text))
                    {
                        btn.Text = msgbox.Text;
                    }
                    msgbox.Text        = "";
                    msgbox.Visible     = false;
                    msgexitbtn.Visible = false;
                    msgPanel2.Visible  = false;
                    addmsgPage.Visible = false;
                    refmsgPage.Visible = false;
                    refmesg_Click(sender3, e3);
                };
            };
            Button btn2 = new Button();

            btn2.Visible = true;
            btn2.Text    = "X";
            btn2.Parent  = mesgpanel;
            btn2.Height  = 23;
            btn2.Width   = 23;
            btn2.Top     = btn.Top;
            btn2.Left    = 4 + btn.Width;
            btns2.Add(btn2);
            btn2.Click += (object sender2, EventArgs e2) => {
                Button thebtn1 = btn;
                Button thebtn2 = btn2;
                thebtn1.Visible = false;
                thebtn2.Visible = false;
                btnsmsg.Remove(MessageSettings.findMessageSettings(btnsmsg, btn.Text));
                btns.Remove(thebtn1);
                Controls.Remove(thebtn1);
                btns2.Remove(thebtn2);
                Controls.Remove(thebtn2);
                refmesg_Click(sender2, e2);
            };
        }
예제 #2
0
 public Form1()
 {
     InitializeComponent();
     CharEdit.Visible   = false;
     ChatEdit.Visible   = false;
     label1credits.Text = "Made By VirtualBrightPlayz\n Thanks to u/CaptainStar and u/KurvaZelena\n on reddit for the face, beard, and hair pictures!\n Post can be found here:\n https://www.reddit.com/r/unturned/comments/6e6n1f/npcs_face_hair_and_beard_ids/ \nThanks to http://steamcommunity.com/id/knifedera on steam for the guide of ids";
     //messages
     msgexitbtn.Visible   = false;
     msgexitbtn.Parent    = mesgpanel;
     msgexitbtn.Text      = "Back";
     msgexitbtn.Left      = 4;
     msgexitbtn.Top       = 4 + 20;
     msgexitbtn.Width     = 75;
     msgexitbtn.Height    = 23;
     msgbox.Visible       = false;
     msgbox.Parent        = mesgpanel;
     msgbox.Top           = 4;
     msgbox.Left          = 4;
     msgbox.Width         = 334;
     msgbox.Height        = 20;
     msgPanel2.Visible    = false;
     msgPanel2.Parent     = mesgpanel;
     msgPanel2.Top        = 4 + 23 + 20;
     msgPanel2.Left       = 4 + 75;
     msgPanel2.AutoScroll = true;
     //#To lazy to do math
     msgPanel2.Width    = 334 - 75;
     msgPanel2.Height   = 300;
     addmsgPage.Visible = false;
     addmsgPage.Parent  = mesgpanel;
     addmsgPage.Click  += (object sender, EventArgs e) => {
         string name = "";
         foreach (string str in addmsgPage.Text.Split(new char[] { ':' }))
         {
             if (addmsgPage.Text.Split(new char[] { ':' })[0] != str)
             {
                 name += str;
             }
         }
         Button btn = new Button();
         btn.Visible = true;
         MessageSettings.findMessageSettings(btnsmsg, name).totalPages++;
         btn.Text   = "Page #" + MessageSettings.findMessageSettings(btnsmsg, name).totalPages;
         btn.Parent = msgPanel2;
         btn.Height = 23;
         btn.Width  = 100;
         btn.Top    = ((4 + 23) * (MessageSettings.findMessageSettings(btnsmsg, name).findTotalPages())) - msgPanel2.VerticalScroll.Value;
         btn.Left   = 4;
         btn.Click += (object sender2, EventArgs e2) => {
             int totalPGS = 0;
             foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages)
             {
                 totalPGS++;
                 //Controls.Remove(thebtn);
                 thebtn.Visible = false;
                 thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
             }
             totalPGS = 0;
             foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages2)
             {
                 totalPGS++;
                 //Controls.Remove(thebtn);
                 thebtn.Visible = false;
                 thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
             }
             msgbox.Text        = btn.Text;
             msgPanel2.Visible  = false;
             addmsgPage.Visible = false;
             FieldInfo        f1   = typeof(Control).GetField("EventClick", BindingFlags.Static | BindingFlags.NonPublic);
             object           obj  = f1.GetValue(msgexitbtn);
             PropertyInfo     pi   = msgexitbtn.GetType().GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance);
             EventHandlerList list = (EventHandlerList)pi.GetValue(msgexitbtn, null);
             list.RemoveHandler(obj, list[obj]);
             msgexitbtn.Click += (object sender3, EventArgs e3) => {
                 //msgbox.Text = name;
                 msgPanel2.Visible  = true;
                 addmsgPage.Visible = true;
                 //refmesg_Click(sender3, e3);
                 btn.Text = msgbox.Text;
                 foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages)
                 {
                     totalPGS++;
                     //Controls.Remove(thebtn);
                     thebtn.Visible = false;
                     thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
                 }
                 totalPGS = 0;
                 foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages2)
                 {
                     totalPGS++;
                     //Controls.Remove(thebtn);
                     thebtn.Visible = false;
                     thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
                 }
                 msgexitbtn.Click += (object sender4, EventArgs e4) => {
                     msgbox.Text        = "";
                     msgbox.Visible     = false;
                     msgexitbtn.Visible = false;
                     msgPanel2.Visible  = false;
                     addmsgPage.Visible = false;
                     refmsgPage.Visible = false;
                     //refmesg_Click(sender3, e3);
                 };
             };
         };
         Button btn2 = new Button();
         btn2.Visible = true;
         btn2.Text    = "X";
         btn2.Parent  = msgPanel2;
         btn2.Height  = 23;
         btn2.Width   = 23;
         btn2.Top     = btn.Top;
         btn2.Left    = 4 + btn.Width;
         MessageSettings.findMessageSettings(btnsmsg, name).addPage(btn, btn2);
         btn2.Click += (object sender2, EventArgs e2) => {
             Button thebtn1 = btn;
             Button thebtn2 = btn2;
             thebtn1.Visible = false;
             thebtn2.Visible = false;
             MessageSettings.findMessageSettings(btnsmsg, name).removePage(btn, btn2);
             Controls.Remove(thebtn1);
             Controls.Remove(thebtn2);
             int totalPGS = 0;
             foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages)
             {
                 totalPGS++;
                 //Controls.Remove(thebtn);
                 thebtn.Visible = true;
                 thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
             }
             totalPGS = 0;
             foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages2)
             {
                 totalPGS++;
                 //Controls.Remove(thebtn);
                 thebtn.Visible = true;
                 thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
             }
         };
     };
     addmsgPage.Text    = "Add Page";
     addmsgPage.Top     = 4 + 23 + 20;
     addmsgPage.Left    = 4;
     addmsgPage.Width   = 75;
     addmsgPage.Height  = 40;
     refmsgPage.Visible = false;
     refmsgPage.Parent  = mesgpanel;
     refmsgPage.Click  += (object sender, EventArgs e) => {
         string name = "";
         foreach (string str in addmsgPage.Text.Split(new char[] { ':' }))
         {
             if (addmsgPage.Text.Split(new char[] { ':' })[0] != str)
             {
                 name += str;
             }
         }
         int totalPGS = 0;
         foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages)
         {
             totalPGS++;
             //Controls.Remove(thebtn);
             thebtn.Visible = true;
             thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
         }
         totalPGS = 0;
         foreach (Button thebtn in MessageSettings.findMessageSettings(btnsmsg, name).messages2)
         {
             totalPGS++;
             //Controls.Remove(thebtn);
             thebtn.Visible = true;
             thebtn.Top     = ((4 + 23) * (totalPGS - 1)) - msgPanel2.VerticalScroll.Value;
         }
     };
     refmsgPage.Text   = "Refresh Pages";
     refmsgPage.Top    = 4 + 23 + 20 + 40;
     refmsgPage.Left   = 4;
     refmsgPage.Width  = 75;
     refmsgPage.Height = 40;
     //responses
     respexitbtn.Visible = false;
     respexitbtn.Parent  = resppanel;
     respexitbtn.Text    = "Back";
     respexitbtn.Left    = 4;
     respexitbtn.Top     = 4 + 20;
     respexitbtn.Width   = 75;
     respexitbtn.Height  = 23;
     respbox.Visible     = false;
     respbox.Parent      = resppanel;
     respbox.Top         = 4;
     respbox.Left        = 4;
     respbox.Width       = 334;
     respbox.Height      = 20;
     respPanel2.Visible  = false;
     respPanel2.Parent   = resppanel;
     respPanel2.Top      = 4 + 23 + 20;
     respPanel2.Left     = 4;
     respPanel2.Width    = 334;
     respPanel2.Height   = 300;
 }