示例#1
0
        public ItemViewer()
        {
            try
            {
                Classifications           = new EditorClassifications();
                Classifications.Filenames = new string[] { "obj.dat" };
                FileExtensions            = "";
                StaticFileExtensions      = "";
                ConfigureForm             = new Configure();

                Window window = new Window();
                this.Controls = new Control[window.Controls.Count];
                for (int i = 0; i < window.Controls.Count; i++)
                {
                    this.Controls[i] = window.Controls[i];
                }
                name_label     = (Label)window.Controls.Find("lblName", true)[0];
                pic_item_small = (PictureBox)window.Controls.Find("pItemSmall", true)[0];
                pic_item_large = (PictureBox)window.Controls.Find("pItemLarge", true)[0];
                properties     = (PropertyGrid)window.Controls.Find("prop_item", true)[0];
                model_viewer   = (ModelViewer)window.Controls.Find("modelViewer", true)[0];
                model_viewer.Controls[1].MouseUp      += model_viewer_MouseUp;
                model_viewer.software_control.MouseUp += model_viewer_MouseUp;
                properties.PropertyValueChanged       += properties_PropertyValueChanged;

                name_label.Text = "Select an item";

                ItemToolbox toolbox = new ItemToolbox();
                ToolControls = new Control[toolbox.Controls.Count];
                for (int i = 0; i < ToolControls.Length; i++)
                {
                    ToolControls[i] = toolbox.Controls[i];
                }
                NumericUpDown n_item   = (NumericUpDown)toolbox.Controls.Find("nItem", true)[0];
                NumericUpDown n_amount = (NumericUpDown)toolbox.Controls.Find("nAmount", true)[0];
                lock_sprite = (CheckBox)toolbox.Controls.Find("chkModelSprite", true)[0];

                n_item.ValueChanged   += delegate(object sender, EventArgs e) { SelectItem((int)n_item.Value, (int)n_amount.Value, true); };
                n_amount.ValueChanged += delegate(object sender, EventArgs e) { SelectItem((int)n_item.Value, (int)n_amount.Value); };

                checkerboard = new Bitmap(32, 32);
                Graphics g = Graphics.FromImage(checkerboard);
                g.Clear(Color.White);
                g.FillRectangle(Brushes.LightGray, 0, 0, 16, 16);
                g.FillRectangle(Brushes.LightGray, 16, 16, 16, 16);

                pic_item_small.BackgroundImage = checkerboard;
                pic_item_large.BackgroundImage = checkerboard;
                last_item   = 0;
                last_amount = 1;

                initialized = false;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "\n\n" + e.StackTrace);
            }
        }
示例#2
0
        public ItemViewer()
        {
            try
            {
                Classifications = new EditorClassifications();
                Classifications.Filenames = new string[] { "obj.dat" };
                FileExtensions = "";
                StaticFileExtensions = "";
                ConfigureForm = new Configure();

                Window window = new Window();
                this.Controls = new Control[window.Controls.Count];
                for (int i = 0; i < window.Controls.Count; i++)
                    this.Controls[i] = window.Controls[i];
                name_label = (Label)window.Controls.Find("lblName", true)[0];
                pic_item_small = (PictureBox)window.Controls.Find("pItemSmall", true)[0];
                pic_item_large = (PictureBox)window.Controls.Find("pItemLarge", true)[0];
                properties = (PropertyGrid)window.Controls.Find("prop_item", true)[0];
                model_viewer = (ModelViewer)window.Controls.Find("modelViewer", true)[0];
                model_viewer.Controls[1].MouseUp += model_viewer_MouseUp;
                model_viewer.software_control.MouseUp += model_viewer_MouseUp;
                properties.PropertyValueChanged += properties_PropertyValueChanged;

                name_label.Text = "Select an item";

                ItemToolbox toolbox = new ItemToolbox();
                ToolControls = new Control[toolbox.Controls.Count];
                for (int i = 0; i < ToolControls.Length; i++)
                    ToolControls[i] = toolbox.Controls[i];
                NumericUpDown n_item = (NumericUpDown)toolbox.Controls.Find("nItem", true)[0];
                NumericUpDown n_amount = (NumericUpDown)toolbox.Controls.Find("nAmount", true)[0];
                lock_sprite = (CheckBox)toolbox.Controls.Find("chkModelSprite", true)[0];

                n_item.ValueChanged += delegate(object sender, EventArgs e) { SelectItem((int)n_item.Value, (int)n_amount.Value, true); };
                n_amount.ValueChanged += delegate(object sender, EventArgs e) { SelectItem((int)n_item.Value, (int)n_amount.Value); };

                checkerboard = new Bitmap(32, 32);
                Graphics g = Graphics.FromImage(checkerboard);
                g.Clear(Color.White);
                g.FillRectangle(Brushes.LightGray, 0, 0, 16, 16);
                g.FillRectangle(Brushes.LightGray, 16, 16, 16, 16);

                pic_item_small.BackgroundImage = checkerboard;
                pic_item_large.BackgroundImage = checkerboard;
                last_item = 0;
                last_amount = 1;

                initialized = false;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "\n\n" + e.StackTrace);
            }
        }