コード例 #1
0
        public FormMultiPreview(ActObject file, List<LayerRenderOption> layers)
        {
            InitializeComponent();
            this.file = file;
            this.layers = layers;

            var start_layer = file.FindLayerByName("start");
            if (start_layer != null)
            {
                this.camera_x = start_layer.GetLayout().elements[0].x;
                this.camera_y = start_layer.GetLayout().elements[0].y - 180;
            }
            else
            {
                this.camera_x = 400;
                this.camera_y = 428;
            }

            if (this.camera_x < file.properties.marginLeft + 400)
            {
                this.camera_x = file.properties.marginLeft + 400;
            }
            if (this.camera_x > file.properties.screenWidth - file.properties.marginRight - 400)
            {
                this.camera_x = file.properties.screenWidth - file.properties.marginRight - 400;
            }
            if (this.camera_y < file.properties.marginTop + 300)
            {
                this.camera_y = file.properties.marginTop + 300;
            }
            if (this.camera_y > file.properties.screenHeight - file.properties.marginBottom - 300)
            {
                this.camera_y = file.properties.screenHeight - file.properties.marginBottom - 300;
            }
        }
コード例 #2
0
        public ListViewItemElement(Act2DMapLayoutObject.Element element, ActObject file)
        {
            this.element = element;

            this.Text = file.GetNameForResourceID(element.resourceID);
            this.ImageIndex = 0;
        }
コード例 #3
0
        public FormPreview(Act2DMapLayoutObject layout, ActObject file)
        {
            InitializeComponent();

            this.layout = layout;
            this.file = file;
        }
コード例 #4
0
        public FileNode(ActObject file, FormActFile form)
        {
            this.file = file;
            this.form = form;

            this.Text = "File";
            this.ImageIndex = 0;
            this.SelectedImageIndex = 0;
            this.ContextMenuStrip = form.ContextMenuFile;

            this.ResetChildren();

            this.ExpandThis();
        }
コード例 #5
0
 public void CalculateAABB(ActObject file)
 {
     int l = 0, r = 0, t = 0, b = 0;
     int w = 0, h = 0;
     foreach (var element in elements)
     {
         if (element.CalculateAABB(file))
         {
             if (element.aabb_x < l) l = element.aabb_x;
             if (element.aabb_y < t) t = element.aabb_y;
             if (element.aabb_x + element.aabb_w > r) r = element.aabb_x + element.aabb_w;
             if (element.aabb_y + element.aabb_h > b) b = element.aabb_y + element.aabb_h;
             if (element.aabb_w > w) w = element.aabb_w;
             if (element.aabb_h > h) h = element.aabb_h;
         }
     }
     properties.mapChipLeft = l;
     properties.mapChipRight = r;
     properties.mapChipTop = t;
     properties.mapChipBottom = b;
     properties.maxChipWidth = w * 2;
     properties.maxChipHeight = h * 2;
 }
コード例 #6
0
 public static ActObject ReadActFromFile(string filename)
 {
     try
     {
         using (FileStream f = File.Open(filename, FileMode.Open))
         {
             using (BinaryReader br = new BinaryReader(f))
             {
                 BinaryInputStream bs = new BinaryInputStream(br);
                 bs.ReadInt32(0x31544341);
                 bs.ReadInt32(1);
                 bs.ReadInt32(0);
                 ActObject act = new ActObject();
                 act.Read(bs);
                 return act;
             }
         }
     }
     catch
     {
         return null;
     }
 }
コード例 #7
0
 public void CalculateAABB(ActObject file)
 {
     var layout = GetLayout();
     if (layout != null)
     {
         layout.CalculateAABB(file);
     }
 }
コード例 #8
0
        public FormLayerRenderOptions(ActObject file)
        {
            InitializeComponent();

            this.file = file;
        }
コード例 #9
0
            public bool CalculateAABB(ActObject file)
            {
                var chip = file.mcd.FindChip(resourceID);
                if (chip == null) return false;
                var res = file.mcd.FindRes(chip.resourceID);
                if (res == null) return false;
                var bitmap = file.CreateBitmapForResource(resourceID);
                float w = bitmap.Width, h = bitmap.Height;

                double ww = w * Math.Abs(scale_x) / 2.0f;
                double hh = h * Math.Abs(scale_y) / 2.0f;

                double r = rotate / 180 * 3.1416;
                ww = Math.Abs(ww * Math.Cos(r)) + Math.Abs(hh * Math.Sin(r));
                hh = Math.Abs(hh * Math.Cos(r)) + Math.Abs(ww * Math.Sin(r));

                aabb_w = (int)Math.Round(ww * 2);
                aabb_h = (int)Math.Round(hh * 2);
                aabb_x = x + (int)Math.Round(w / 2.0 - ww);
                aabb_y = y + (int)Math.Round(h / 2.0 - hh);

                return true;
            }