示例#1
0
        private void InvCheckGetBtn_Click(object sender, RoutedEventArgs e)
        {
            int           itemcount = (int)InvCheckCount.Value.Value;
            List <string> invList   = new List <string>();

            for (int i = 1; i <= itemcount; i++)
            {
                ReplaceItem ribox = new ReplaceItem();
                ribox.ShowDialog();
                string[] temp      = ribox.returnStr();
                string   tempcount = "";
                if (temp[2] != "-1")
                {
                    tempcount = ",Count:" + temp[2] + "b";
                }
                string tempdamage = "";
                if (temp[3] != "-1")
                {
                    tempcount = ",Damage:" + temp[3] + "s";
                }
                string tempnbt = "";
                if (temp[4] != string.Empty)
                {
                    tempcount = ",tag:{" + temp[4] + "}";
                }
                invList.Add("{Slot:" + temp[0] + "b,id:\"" + temp[1] + "\"" + tempcount + tempdamage + tempnbt + "}");
            }
            if (invList.Count > 0)
            {
                inv = "Inventory:[";
                for (int i = 0; i < invList.Count; i++)
                {
                    inv += invList[i] + ",";
                }
                inv += "],";
            }
        }
 private void replaceBtn_Click(object sender, RoutedEventArgs e)
 {
     this.Hide();
     ReplaceItem ribox = new ReplaceItem();
     ribox.ShowDialog();
     this.Show();
 }