void renameAnimation_ButtonClicked(object sender, EventArgs e) { var animation = (AnimatedTextSurface)animations.SelectedItem; RenamePopup popup = new RenamePopup(animation.Name); popup.Closed += (o, e2) => { if (popup.DialogResult) { entity.Animations.Remove(animation.Name); animation.Name = popup.NewName; entity.Animations[animation.Name] = animation; animations.IsDirty = true; } }; popup.Show(true); popup.Center(); }
private void cloneSelectedAnimation_ButtonClicked(object sender, EventArgs e) { RenamePopup popup = new RenamePopup("clone"); popup.Closed += (o, e2) => { if (popup.DialogResult) { var animation = (AnimatedTextSurface)animations.SelectedItem; var newAnimation = new AnimatedTextSurface(popup.NewName, animation.Width, animation.Height, Settings.Config.ScreenFont); foreach (var frame in animation.Frames) { var newFrame = newAnimation.CreateFrame(); frame.Copy(newFrame); } newAnimation.CurrentFrameIndex = 0; entity.Animations[newAnimation.Name] = newAnimation; RebuildListBox(); } }; popup.Show(true); popup.Center(); }
void addNewAnimation_ButtonClicked(object sender, EventArgs e) { RenamePopup popup = new RenamePopup("", "Animation Name"); popup.Closed += (o, e2) => { if (popup.DialogResult) { string newName = popup.NewName.Trim(); var keys = entity.Animations.Keys.Select(k => k.ToLower()).ToList(); if (keys.Contains(newName.ToLower())) { Window.Message("Name must be unique", "Close"); } else if (string.IsNullOrEmpty(newName)) { Window.Message("Name cannot be blank", "Close"); } else { var previouslySelected = (AnimatedTextSurface)animations.SelectedItem; var animation = new AnimatedTextSurface(newName, previouslySelected.Width, previouslySelected.Height, Settings.Config.ScreenFont); animation.CreateFrame(); animation.AnimationDuration = 1; entity.Animations[animation.Name] = animation; RebuildListBox(); animations.SelectedItem = animation; } } }; popup.Show(true); popup.Center(); }
void RenameZone_ButtonClicked(object sender, EventArgs e) { var entity = (ResizableObject)GameObjectList.SelectedItem; RenamePopup popup = new RenamePopup(entity.Name); popup.Closed += (o, e2) => { if (popup.DialogResult) entity.Name = popup.NewName; GameObjectList.IsDirty = true; }; popup.Show(true); popup.Center(); }
void renameLayer_ButtonClicked(object sender, EventArgs e) { var layer = (LayeredTextSurface.Layer)layers.SelectedItem; var meta = (LayerMetadata)layer.Metadata; RenamePopup popup = new RenamePopup(meta.Name); popup.Closed += (o, e2) => { if (popup.DialogResult) meta.Name = popup.NewName; layers.IsDirty = true; }; popup.Show(true); popup.Center(); }
void RenameEntity_ButtonClicked(object sender, EventArgs e) { var entity = (ResizableObject)GameObjectList.SelectedItem; RenamePopup popup = new RenamePopup(entity.Name); popup.Closed += (o, e2) => { if (popup.DialogResult) { var editor = (Editors.SceneEditor)EditorConsoleManager.ActiveEditor; editor.RenameGameObject(entity, popup.NewName); } GameObjectList.IsDirty = true; }; popup.Show(true); popup.Center(); }