예제 #1
0
 private void cb_object_box_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cb_object_box.SelectedIndex != -1)
     {
         baseGameObject       = editor_handle.gameObject_list[cb_object_box.SelectedIndex];
         txt_tile_width.Text  = (baseGameObject.object_img != null) ? baseGameObject.object_img.Width.ToString( ) : "0";
         txt_tile_height.Text = (baseGameObject.object_img != null) ? baseGameObject.object_img.Height.ToString() : "0";
     }
 }
예제 #2
0
        private void loadObjectProperties(Editor.GameObject handle)
        {
            txt_name.Text = handle.object_name;
            lb_scripts.Items.Clear();
            txt_image.Text = "";

            if (handle.object_img != null)
            {
                foreach (string path in Directory.GetFiles(editor_handle.project_default_dir + "\\Game-Resouces"))
                {
                    if (Path.GetExtension(path) == ".png" || Path.GetExtension(path) == "png")
                    {
                        Bitmap hnd     = new Bitmap(Image.FromFile(path));
                        Bitmap obj_img = new Bitmap(handle.object_img);

                        if (hnd.Width == obj_img.Width && hnd.Height == obj_img.Height)
                        {
                            for (int y = 0; y < hnd.Height; y++)
                            {
                                for (int x = 0; x < hnd.Width; x++)
                                {
                                    if (hnd.GetPixel(x, y) != obj_img.GetPixel(x, y))
                                    {
                                        goto image_not_matched;
                                    }
                                }
                            }

                            txt_image.Text = path;
                        }
                    }
                    image_not_matched :;
                }
            }


            txt_text.Text         = handle.object_text;
            txt_tag.Text          = handle.object_tag.ToString( );
            cb_static.Checked     = handle.isStatic;
            cb_rigid_body.Checked = handle.object_rigid;
            cb_physics.Checked    = handle.object_physics;
            cb_collider.Checked   = handle.object_collider;

            foreach (string path in handle.scripts)
            {
                lb_scripts.Items.Add(path);
            }

            sel_name = txt_name.Text;
        }