private void Righthand_item_Click(object sender, RoutedEventArgs e) { Item_form item_Form = new Item_form("右手物品信息", sender as Control); ElementHost.EnableModelessKeyboardInterop(GetWindow(item_Form)); item_Form.Show(); }
private void Click_to_spawn_Click(object sender, RoutedEventArgs e) { int d_head = (dHead.IsChecked == true) ? 16 : 0; int d_chest = (dChest.IsChecked == true) ? 8 : 0; int d_legs = (dLegs.IsChecked == true) ? 4 : 0; int d_boots = (dBoots.IsChecked == true) ? 2 : 0; int d_hand = (dHand.IsChecked == true) ? 1 : 0; int d_sum = d_head + d_chest + d_legs + d_boots + d_hand; int r_head = (rHead.IsChecked == true) ? 4096 : 0; int r_chest = (rChest.IsChecked == true) ? 2048 : 0; int r_legs = (rLegs.IsChecked == true) ? 1024 : 0; int r_boots = (rBoots.IsChecked == true) ? 512 : 0; int r_hand = (rHand.IsChecked == true) ? 256 : 0; int r_sum = r_head + r_chest + r_legs + r_boots + r_hand; int p_head = (pHead.IsChecked == true) ? 1048576 : 0; int p_chest = (pChest.IsChecked == true) ? 524288 : 0; int p_legs = (pLegs.IsChecked == true) ? 262144 : 0; int p_boots = (pBoots.IsChecked == true) ? 131072 : 0; int p_hand = (pHand.IsChecked == true) ? 65536 : 0; int p_sum = p_hand + p_chest + p_legs + p_boots; int body_part_sum = d_sum + r_sum + p_sum + p_head; string result; string boots_item = (FeetItem.Tag != null) ? FeetItem.Tag.ToString().Trim() : "{}"; string legs_item = (LegItem.Tag != null) ? LegItem.Tag.ToString().Trim() : "{}"; string chest_item = (ChestItem.Tag != null) ? ChestItem.Tag.ToString().Trim() : "{}"; string head_item = (HeadItem.Tag != null) ? HeadItem.Tag.ToString().Trim() : "{}"; string armorItems = "ArmorItems:[" + boots_item + "," + legs_item + "," + chest_item + "," + head_item + "],"; if (Regex.Replace(armorItems.Replace("ArmorItems:", ""), "[\\p{S}\\p{C}\\p{P}]", "").Trim() == "") { armorItems = ""; } string mainHandItem = (LeftHandItem.Tag != null) ? LeftHandItem.Tag.ToString().Trim() : "{}"; string offHandItem = (RightHandItem.Tag != null) ? RightHandItem.Tag.ToString().Trim() : "{}"; string handItems = "HandItems:[" + mainHandItem + "," + offHandItem + "]"; if (Regex.Replace(handItems.Replace("HandItems:", ""), "[\\p{S}\\p{C}\\p{P}]", "").Trim() == "") { handItems = ""; } string equipmentItems = ((armorItems.Trim() != "") ? armorItems : "") + ((handItems.Trim() != "") ? handItems : ""); //合并NBT信息 string NBTInfo = ""; foreach (UIElement a_nbt in nbt_area.Children) { if (a_nbt is CheckBox) { CheckBox this_obj = a_nbt as CheckBox; if (this_obj.IsChecked.Value && !this_obj.Content.ToString().Contains("Pose")) { NBTInfo += this_obj.Content + ":" + this_obj.IsChecked.ToString().ToLower() + ","; } } } result = "/summon armor_stand ~ ~ ~ {" + NBTInfo + ((pose_page.IsEnabled == true) ? ("Pose:{Head:[" + head_x.Value.ToString() + "f, " + head_y.Value.ToString() + "f, " + head_z.Value.ToString() + "f],Body:[" + body_x.Value.ToString() + "f, " + body_y.Value.ToString() + "f, " + body_z.Value.ToString() + "f],LeftArm:[" + lhand_x.Value.ToString() + "f, " + lhand_y.Value.ToString() + "f, " + lhand_z.Value.ToString() + "f],RightArm:[" + rhand_z.Value.ToString() + "f, " + rhand_y.Value.ToString() + "f, " + rhand_z.Value.ToString() + "f],LeftLeg:[" + lleg_x.Value.ToString() + "f, " + lleg_y.Value.ToString() + "f, " + lleg_z.Value.ToString() + "f],RightLeg:[" + rleg_z.Value.ToString() + "f, " + rleg_y.Value.ToString() + "f, " + rleg_z.Value.ToString() + "f]},") : "") + ((body_part_sum == 0) ? "" : ("DisabledSlots:" + body_part_sum.ToString() + ",")) + equipmentItems; Item_form as_info = new Item_form(result.TrimEnd(',') + "}", sender as Control); as_info.Show(); }