Ejemplo n.º 1
0
        public void add_effect(TableLayoutPanel table)
        {
            TabControl  effect_tab = table.Controls.Find("effect_tab", true)[0] as TabControl;
            effect_page ep         = new effect_page();

            effect_tab.TabPages.Add(ep.effect_tab.SelectedTab);
            effect_tab.SelectedIndex    = effect_tab.TabPages.Count - 1;
            effect_tab.SelectedTab.Text = effect_tab.TabPages.Count + "";
        }
Ejemplo n.º 2
0
        private void InitUISettings()
        {
            MaximumSize = Size;
            //创建反射所需对象
            object target_class_instance = Activator.CreateInstance(target_class);
            var    target_type           = typeof(EntityComponentsManager);

            min_box.KeyPress += Number_KeyPress;
            max_box.KeyPress += Number_KeyPress;

            set_absolute.Click   += SetDistance;
            set_horizontal.Click += SetDistance;
            set_x.Click          += SetDistance;
            set_y.Click          += SetDistance;
            set_z.Click          += SetDistance;

            set_cat_type.Click += SetButtonTag;
            set_cat_type.Click += ClickSound;
            set_nbt.Click      += SetButtonTag;
            set_nbt.Click      += ClickSound;

            gamemode_box.KeyDown += CanNotInput;

            effect_page efp = new effect_page();

            effect_tab.TabPages.Add(efp.effect_tab.SelectedTab);

            adv_page advP = new adv_page();

            adv_tab.TabPages.Add(advP.adv_tab.SelectedTab);

            stats_page statsP = new stats_page();

            stats_tab.TabPages.Add(statsP.stats_tab.SelectedTab);

            foreach (ToolStripMenuItem item in entity_property_title_menu.Items)
            {
                item.BackgroundImage       = btn_img;
                item.BackgroundImageLayout = ImageLayout.Stretch;
                item.ForeColor             = Color.White;
                item.Click += ClickSound;
                foreach (ToolStripMenuItem subitem in item.DropDownItems)
                {
                    subitem.BackgroundImage       = btn_img;
                    subitem.BackgroundImageLayout = ImageLayout.Stretch;
                    subitem.ForeColor             = Color.White;
                    foreach (ToolStripMenuItem subsubitem in subitem.DropDownItems)
                    {
                        subsubitem.BackgroundImage       = btn_img;
                        subsubitem.BackgroundImageLayout = ImageLayout.Stretch;
                        subsubitem.ForeColor             = Color.White;
                        ToolStripMenuItem parentItem       = subsubitem.OwnerItem as ToolStripMenuItem;
                        ToolStripMenuItem parentparentItem = parentItem.OwnerItem as ToolStripMenuItem;
                        int parentIndex  = parentparentItem.DropDownItems.IndexOf(parentItem);
                        int currentIndex = parentItem.DropDownItems.IndexOf(subsubitem);

                        subsubitem.Click += (a, b) =>
                        {
                            target_type.InvokeMember(component_manager[parentIndex * 3 + currentIndex].Name, BindingFlags.InvokeMethod, null, target_class_instance, new object[] { table });
                        };
                    }
                }
            }

            TreeView Root = Cbhk_form.register;

            entity_type.AutoCompleteMode   = AutoCompleteMode.Suggest;
            entity_type.AutoCompleteSource = AutoCompleteSource.CustomSource;
            foreach (TreeNode item in Root.Nodes)
            {
                if (item.Text == "minecraft:entity_type")
                {
                    foreach (TreeNode subitem in item.Nodes)
                    {
                        if (subitem.Text == "entries")
                        {
                            foreach (TreeNode subsubitem in subitem.Nodes)
                            {
                                entity_type.Items.Add(subsubitem.Text);
                                entity_type.AutoCompleteCustomSource.Add(subsubitem.Text.Replace("minecraft:", ""));
                            }
                        }
                    }
                }
            }
        }