コード例 #1
0
ファイル: ItemViewer.cs プロジェクト: LoveLeAnon/cachesuite
        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
ファイル: ObjectViewer.cs プロジェクト: LoveLeAnon/cachesuite
        public ObjectViewer()
        {
            Classifications = new EditorClassifications();
            Classifications.Filenames = new string[] { "loc.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];
            properties = (PropertyGrid)window.Controls.Find("prop_item", true)[0];
            model_viewer = (ModelViewer)window.Controls.Find("modelViewer", true)[0];
            properties.PropertyValueChanged += properties_PropertyValueChanged;

            name_label.Text = "Select an object";

            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];
            n_type = (NumericUpDown)toolbox.Controls.Find("nType", true)[0];

            n_item.ValueChanged += delegate(object sender, EventArgs e) { SelectObject((int)n_item.Value, true); };
            n_type.ValueChanged += delegate(object sender, EventArgs e)
            {
                if (last_type != (int)n_type.Value)
                {
                    last_type = (int)n_type.Value;
                    SelectObject((int)n_item.Value, true);
                }
            };

            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);

            last_object = 0;
            initialized = false;
        }