示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            BasePortraitData removed;
            string           baseFolder;

            if (tbcMain.SelectedIndex == 0)
            {
                removed    = lstCharacters.Remove();
                baseFolder = @"Images\Portraits\" + removed?.Name;
            }
            else
            {
                removed    = lstGenerics.Remove();
                baseFolder = @"Images\GenericPortraits\" + removed?.Name;
            }
            if (removed != null) // Delete images
            {
                if (WorkingDirectory.CheckFileExist(baseFolder + @"\F" + WorkingDirectory.DefultImageFileFormat))
                {
                    DeleteFile(baseFolder + @"\F", WorkingDirectory, false, WorkingDirectory.DefultImageFileFormat);
                }
                if (WorkingDirectory.CheckFileExist(baseFolder + @"\B" + WorkingDirectory.DefultImageFileFormat))
                {
                    DeleteFile(baseFolder + @"\B", WorkingDirectory, false, WorkingDirectory.DefultImageFileFormat);
                }
                // TBA: Delete folder
            }
        }
示例#2
0
 private void frmPortraitEditor_Load(object sender, EventArgs e)
 {
     // Init palettes
     BaseSpritePalettes = Palette.GetBaseSpritePalettes(WorkingDirectory);
     // Init animation pictureboxes
     picCharactersBG.Init(dlgOpen, this);
     picCharactersFG.Init(dlgOpen, this);
     picCharactersBG.PostOnClick = picCharactersFG.PostOnClick = UpdateCharacterPreview;
     picGenericsBG.Init(dlgOpen, this);
     picGenericsFG.Init(dlgOpen, this);
     picGenericsBG.PostOnClick = picGenericsFG.PostOnClick = UpdateGenericPreview;
     // Init base
     lstCharacters.Init(this, () => new PortraitData(), CharacterDataFromUI, CharacterDataToUI, "Portraits");
     lstGenerics.Init(this, () => new GenericPortraitData(), GenericDataFromUI, GenericDataToUI, "GenericPortraits");
     pleGenericsPossibleBGPalettes.Init(null, () => new Palette(), () => new UserControls.PalettePanel(),
                                        (plt) => { plt.Init(null); }, false);
     pltCharactersBGPalette.Init(this, (p) =>
     {
         picCharactersBG.Palette = p;
         UpdateCharacterPreview();
     });
     fgpCharactersFGPalette.Init(this, BaseSpritePalettes, (p) =>
     {
         picCharactersFG.Palette = p;
         UpdateCharacterPreview();
     });
     fgpCharacterAccent.Init(this, BaseSpritePalettes);
     Dirty = false;
     this.ApplyPreferences();
     // Misc
     cmbVoiceType.SelectedIndex = 0;
     dlgOpen.Filter             = "Image files|*.gif;*.png";
     if (WorkingDirectory.CheckFileExist("GenericPortraitsGlobalData.json"))
     {
         GlobalData = WorkingDirectory.LoadFile("GenericPortraitsGlobalData", "", ".json").JsonToObject <GenericPortraitsGlobalData>();
         pleGenericsPossibleBGPalettes.Datas = GlobalData.GenericPossibleBackgroundColors;
     }
     // Set dirty
     txtGenericsTags.TextChanged       += DirtyFunc;
     nudPitch.ValueChanged             += DirtyFunc;
     cmbVoiceType.SelectedIndexChanged += DirtyFunc;
     Dirty = false;
     // Load empty
     btnNew_Click(sender, e);
 }
示例#3
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     if (tbcMain.SelectedIndex == 0)
     {
         ClassData removed = lstClasses.Remove();
         if (removed != null) // Delete images
         {
             for (int i = 0; i < removed.BattleAnimations.Count; i++)
             {
                 string fileName = @"Images\ClassBattleAnimations\" + removed.Name + @"\" + removed.BattleAnimations[i].Name;
                 if (WorkingDirectory.CheckFileExist(fileName + WorkingDirectory.DefultImageFileFormat))
                 {
                     DeleteFile(fileName, WorkingDirectory, false, WorkingDirectory.DefultImageFileFormat);
                 }
             }
             // TBA: Delete folders
         }
     }
     else
     {
         UnitData removed = lstUnits.Remove(); // There isn't much to do with it - units have no images
     }
 }