Пример #1
0
        protected virtual AssetEntry CreateEntry(BIGBank bank)
        {
            FormNewBIGEntry form = new FormNewBIGEntry(bank);

            AssetEntry entry = null;

            if (form.ShowDialog() == DialogResult.OK)
            {
                entry = new AssetEntry(
                    form.SymbolName,
                    bank.GetNewID(),
                    form.Template.Type,
                    bank);

                entry.SubHeader = form.Template.SubHeader;
                entry.Data      = form.Template.Data;
            }

            form.Dispose();
            form = null;

            return(entry);
        }
Пример #2
0
        protected override AssetEntry CreateEntry(BIGBank bank)
        {
            FormOpenTexture form = new FormOpenTexture();

            AssetEntry entry = null;

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                GfxTexture texture;

                try
                {
                    texture = new GfxTexture(form.FileName, form.Format);
                }
                catch (Exception ex)
                {
                    FormMain.Instance.ErrorMessage(ex.Message);
                    return(null);
                }

                string name = Path.GetFileNameWithoutExtension(form.FileName);

                name.Replace(' ', '_');
                name.Replace('-', '_');
                name.Replace('.', '_');
                name = name.ToUpper();

                FormTextBox textForm = new FormTextBox();

                textForm.Text            = "New Texture";
                textForm.labelInput.Text = "Texture Symbol Name:";

                while (true)
                {
                    textForm.textBoxInput.Text = name;

                    if (textForm.ShowDialog() == DialogResult.OK)
                    {
                        if (bank.FindEntryBySymbolName(
                                textForm.textBoxInput.Text) != null)
                        {
                            FormMain.Instance.ErrorMessage(
                                "Symbol already exists. Try again.");
                        }
                        else
                        {
                            name = textForm.textBoxInput.Text;
                            break;
                        }
                    }
                }

                textForm.Dispose();

                entry = new AssetEntry(
                    name,
                    bank.GetNewID(),
                    0,
                    bank);

                texture.ApplyToEntry(entry);
            }

            form.Dispose();

            return(entry);
        }