コード例 #1
0
        private void tsmiFileNewSPK_Click(object sender, EventArgs e)
        {
            frmSpritePackBrowser frm = new frmSpritePackBrowser("New SPK");

            frm.MdiParent = this;

            WindowManager.spkWindows.Add(frm);

            frm.Show();
        }
コード例 #2
0
        private void OpenSpritePackage(string filename)
        {
            string ext = Path.GetExtension(filename);

            if (ext == ".spk" || ext == ".ispk" || ext == ".sspk" || ext == ".aspk")
            {
                tsStatusLabel.Text = "Loading " + filename + ". Please wait...";
                this.Refresh();

                if (ext == ".spk")
                {
                    CSpritePack spk = CSpritePackHelper.LoadFromFile(filename);

                    if (spk.Initialized)
                    {
                        frmSpritePackBrowser spkbrowser = new frmSpritePackBrowser(spk, filename);

                        WindowManager.spkWindows.Add(spkbrowser);

                        spkbrowser.MdiParent = this;
                        spkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                if (ext == ".ispk")
                {
                    CIndexSpritePack ispk = CIndexSpritePackHelper.LoadFromFile(filename);

                    if (ispk.Initialized)
                    {
                        frmIndexSpritePackBrowser ispkbrowser = new frmIndexSpritePackBrowser(ispk, filename);

                        WindowManager.ispkWindows.Add(ispkbrowser);

                        ispkbrowser.MdiParent = this;
                        ispkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                if (ext == ".sspk")
                {
                    CShadowSpritePack sspk = CShadowSpritePackHelper.LoadFromFile(filename);

                    if (sspk.Initialized)
                    {
                        frmShadowSpritePackBrowser sspkbrowser = new frmShadowSpritePackBrowser(sspk, filename);

                        WindowManager.sspkWindows.Add(sspkbrowser);

                        sspkbrowser.MdiParent = this;
                        sspkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                if (ext == ".aspk")
                {
                    CAlphaSpritePack aspk = CAlphaSpritePackHelper.LoadFromFile(filename);

                    if (aspk.Initialized)
                    {
                        frmAlphaSpritePackBrowser aspkbrowser = new frmAlphaSpritePackBrowser(aspk, filename);

                        WindowManager.aspkWindows.Add(aspkbrowser);

                        aspkbrowser.MdiParent = this;
                        aspkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                tsStatusLabel.Text = "";
            }
        }