Esempio n. 1
0
        private void textBoxH_TextChanged(object sender, EventArgs e)
        {
            JonbinBox currbox = (JonbinBox)boxList.Items[boxList.SelectedIndex];
            float     newH;

            if (float.TryParse(textBoxH.Text, out newH))
            {
                currbox.height = newH;
                oi.renderBoxes();
                spriteBox.Image = oi.boxbitmap;
            }
        }
Esempio n. 2
0
        private void boxList_SelectedIndexChanged(object sender, EventArgs e)
        {
            JonbinBox currbox = (JonbinBox)boxList.Items[boxList.SelectedIndex];

            textBoxX.TextChanged -= textBoxX_TextChanged;
            textBoxY.TextChanged -= textBoxY_TextChanged;
            textBoxW.TextChanged -= textBoxW_TextChanged;
            textBoxH.TextChanged -= textBoxH_TextChanged;
            textBoxX.Text         = currbox.x.ToString();
            textBoxY.Text         = currbox.y.ToString();
            textBoxW.Text         = currbox.width.ToString();
            textBoxH.Text         = currbox.height.ToString();
            textBoxX.TextChanged += textBoxX_TextChanged;
            textBoxY.TextChanged += textBoxY_TextChanged;
            textBoxW.TextChanged += textBoxW_TextChanged;
            textBoxH.TextChanged += textBoxH_TextChanged;
        }
        private void parseJONB(string colpacpath, int coloffset)
        {
            BinaryReader jonbr = new BinaryReader(new FileStream(colpacpath, FileMode.Open));

            jonbr.BaseStream.Seek((long)coloffset, SeekOrigin.Begin);
            if (is_gg)
            {
                jonbr.BaseStream.Seek(0x38, SeekOrigin.Current);
            }
            if (!jonbr.ReadChars(4).SequenceEqual(JONBIN_HEADER.ToCharArray()))
            {
                Console.WriteLine("NOT A JONBIN FILE");
                return;
            }
            Console.WriteLine("Image Names: ");
            short imcount = jonbr.ReadInt16();

            for (var i = 0; i < imcount; i++)
            {
                var strbytes = jonbr.ReadBytes(0x20).TakeWhile(b => (b != 0)).ToArray();
                Console.WriteLine(Encoding.UTF8.GetString(strbytes, 0, strbytes.Length));
            }
            jonbr.BaseStream.Seek(3, SeekOrigin.Current);
            var chunkcount = jonbr.ReadUInt32();

            hurtboxcount = (uint)jonbr.ReadInt16();
            hitboxcount  = (uint)jonbr.ReadInt16();
            chunks       = new List <JonbinChunk>();
            hurtboxes    = new List <JonbinBox>();
            hitboxes     = new List <JonbinBox>();
            jonbr.BaseStream.Seek(41 * 2, SeekOrigin.Current);
            for (var c = 0; c < chunkcount; c++)
            {
                var chunk = new JonbinChunk();
                chunk.SrcX       = jonbr.ReadSingle();
                chunk.SrcY       = jonbr.ReadSingle();
                chunk.SrcWidth   = jonbr.ReadSingle();
                chunk.SrcHeight  = jonbr.ReadSingle();
                chunk.DestX      = jonbr.ReadSingle();
                chunk.DestY      = jonbr.ReadSingle();
                chunk.DestWidth  = jonbr.ReadSingle();
                chunk.DestHeight = jonbr.ReadSingle();
                jonbr.BaseStream.Seek(0x20, SeekOrigin.Current);
                chunk.Layer = jonbr.ReadInt32();
                jonbr.BaseStream.Seek(0xC, SeekOrigin.Current);
                chunks.Add(chunk);
            }
            for (var h = 0; h < hurtboxcount; h++)
            {
                var hurt = new JonbinBox();
                hurt.id    = jonbr.ReadInt32();
                hurt.x     = jonbr.ReadSingle();
                hurt.y     = jonbr.ReadSingle();
                hurt.width = jonbr.ReadSingle();
                if (is_uni)
                {
                    hurt.width *= -1;
                }
                if (hurt.width < 0 && !is_uni)
                {
                    hurt.width *= -1;
                    is_uni      = true;
                }
                hurt.height = jonbr.ReadSingle();
                hurtboxes.Add(hurt);
            }
            for (var h = 0; h < hitboxcount; h++)
            {
                var hit = new JonbinBox();
                hit.id    = jonbr.ReadInt32();
                hit.x     = jonbr.ReadSingle();
                hit.y     = jonbr.ReadSingle();
                hit.width = jonbr.ReadSingle();
                if (is_uni)
                {
                    hit.width *= -1;
                }
                if (hit.width < 0 && !is_uni)
                {
                    hit.width *= -1;
                    is_uni     = true;
                }
                hit.height = jonbr.ReadSingle();
                hitboxes.Add(hit);
            }
            jonbr.Close();
        }