private void HighlightInstructionSetListBox(Window callingWindow) { CollapseItem item = mInstructionSetListBox.GetFirstHighlightedItem(); if (item != null) { // Set the current InstructionSet CollapseItem topParentItem = item.TopParent; EditorData.EditorLogic.CurrentKeyframeList = topParentItem.ReferenceObject as KeyframeList; EditorData.EditorLogic.CurrentKeyframe = mInstructionSetListBox.GetFirstHighlightedItem().ReferenceObject as InstructionList; // if the object is an instruction list, execute em if (EditorData.EditorLogic.CurrentKeyframe != null && EditorData.EditorLogic.CurrentKeyframe.Count != 0) { GuiData.TimeLineWindow.CurrentValue = EditorData.EditorLogic.CurrentKeyframe[0].TimeToExecute; EditorData.EditorLogic.CurrentKeyframe.Execute(); } //GuiData.SpritePropertyGrid.UpdateDisplayedProperties(); } else { EditorData.EditorLogic.CurrentKeyframeList = null; EditorData.EditorLogic.CurrentKeyframe = null; } }
private void HighlightAnimationSequenceListBox(Window callingWindow) { object highlightedObject = mAnimationSequenceListBox.GetFirstHighlightedObject(); if (highlightedObject == null) { } else { if (highlightedObject is AnimationSequence) { EditorData.EditorLogic.CurrentAnimationSequence = highlightedObject as AnimationSequence; } else if (highlightedObject is TimedKeyframeList) { CollapseItem highlightedItem = mAnimationSequenceListBox.GetFirstHighlightedItem(); CollapseItem parentItem = highlightedItem.TopParent; EditorData.EditorLogic.CurrentAnimationSequence = parentItem.ReferenceObject as AnimationSequence; EditorData.EditorLogic.CurrentTimedKeyframeList = highlightedObject as TimedKeyframeList; } } }
public void AddDisplayRegion(DisplayRegion displayRegion, Texture2D texture) { CollapseItem item = textureListBox.GetItem(texture); if (item != null) { item.AddItem(displayRegion.Name, displayRegion); } }
private static void MouseOverEmissionSettingsGrid(Window callingWindow) { CollapseItem item = (callingWindow as CollapseListBox).GetItemAtCursor(); if (item != null) { GuiManager.ToolTipText = item.Text; } }
public void ReplaceTexture(Texture2D oldTexture, Texture2D newTexture) { CollapseItem collapseItem = textureListBox.GetItem(oldTexture); if (collapseItem != null) { collapseItem.ReferenceObject = newTexture; collapseItem.Text = newTexture.Name; } }
public List <DisplayRegion> CreateTextureReferences(CollapseItem item) { List <DisplayRegion> toReturn = new List <DisplayRegion>(); for (int i = 0; i < item.Count; i++) { toReturn.Add(item[i].ReferenceObject as DisplayRegion); } return(toReturn); }
private void removeFilesAlreadyMarkedRelative() { foreach (string s in mFilesMarkedDotDotRelative) { CollapseItem item = mListBox.GetItemByName(s); if (item != null) { mListBox.Items.Remove(item); } } }
void IconClick(CollapseItem collapseItem, ListBoxBase listBoxBase, ListBoxIcon listBoxIcon) { if (listBoxIcon.Texture == mCopyLocallyTexture) { listBoxIcon.Texture = mMakeRelativeTexture; } else { listBoxIcon.Texture = mCopyLocallyTexture; } }
public CollapseItem AddItem(string fileName) { CollapseItem newItem = mListBox.AddItem(fileName); ListBoxIcon icon = newItem.AddIcon(mCopyLocallyTexture, "ActionIcon"); icon.IconClick += new ListBoxFunction(IconClick); icon.ScaleX = icon.ScaleY = 1.1f; removeFilesAlreadyMarkedRelative(); return(newItem); }
private static void UpdateListDisplays() { mListBoxWindow.UpdateLists(); if (EditorData.EditorLogic.CurrentKeyframeList != null && EditorData.EditorLogic.CurrentKeyframe != null) { CollapseItem highlightedItem = mListBoxWindow.InstructionSetListBox.GetFirstHighlightedItem(); if (highlightedItem != null) { CollapseItem parentItem = highlightedItem.TopParent; parentItem.ReorderToMatchList(EditorData.EditorLogic.CurrentKeyframeList); } } }
private Task OnChanged(CollapseItem item) { Trace.Log($"{item.Text}: {item.IsCollapsed}"); return(Task.CompletedTask); }
public void UpdateLists() { #region Update List window visibility mInstructionSetListBox.Visible = GuiData.TimeLineWindow.InstructionMode == InstructionMode.Current; mAnimationSequenceListBox.Visible = GuiData.TimeLineWindow.InstructionMode == InstructionMode.All; #endregion #region Update the Global InstructionSets ListDisplayWindow mAnimationSequenceListBox.ListShowing = EditorData.GlobalInstructionSets; #endregion #region If there is not a CurrentInstructionSet if (EditorData.EditorLogic.CurrentInstructionSet == null) { mInstructionSetListBox.Clear(); } #endregion #region Else, there is else { #region See if there are any KeyframeLists that aren't shown in the list for (int i = 0; i < EditorData.EditorLogic.CurrentInstructionSet.Count; i++) { if (mInstructionSetListBox.ContainsObject( EditorData.EditorLogic.CurrentInstructionSet[i]) == false) { CollapseItem item = mInstructionSetListBox.AddItem( EditorData.EditorLogic.CurrentInstructionSet[i].Name, EditorData.EditorLogic.CurrentInstructionSet[i]); } else { mInstructionSetListBox.GetItem(EditorData.EditorLogic.CurrentInstructionSet[i]).Text = EditorData.EditorLogic.CurrentInstructionSet[i].Name; } } #endregion #region See if there are any Keyframes that aren't in the ListBox foreach (KeyframeList keyframeList in EditorData.EditorLogic.CurrentInstructionSet) { CollapseItem itemForKeyframe = mInstructionSetListBox.GetItem(keyframeList); for (int i = 0; i < keyframeList.Count; i++) { InstructionList list = keyframeList[i]; string listName = ""; if (list.Count != 0) { string numberString = list[0].TimeToExecute.ToString("00.000"); listName = numberString + " " + list.Name; } else { listName = list.Name; } if (itemForKeyframe.Contains(list) == false) { itemForKeyframe.InsertItem(i, listName, list); } else { itemForKeyframe.GetItem(list).Text = listName; } } } #endregion #region See if there are any KeyframeLists or Keyframes in the ListBox that aren't in the List for (int itemNumber = 0; itemNumber < mInstructionSetListBox.Items.Count; itemNumber++) { CollapseItem item = mInstructionSetListBox.Items[itemNumber]; KeyframeList keyframeList = item.ReferenceObject as KeyframeList; if (EditorData.EditorLogic.CurrentInstructionSet.Contains(keyframeList) == false) { mInstructionSetListBox.RemoveCollapseItem(item); } else { for (int i = item.Count - 1; i > -1; i--) { CollapseItem subItem = item[i]; InstructionList keyframe = subItem.ReferenceObject as InstructionList; if (keyframeList.Contains(keyframe) == false) { item.RemoveObject(keyframe); } } } } #endregion } #endregion }
private string?GetItemClassString(CollapseItem item) => CssBuilder.Default("accordion-item") .AddClass(item.Class, !string.IsNullOrEmpty(item.Class)) .Build();
private static string?GetButtonClassString(CollapseItem item) => CssBuilder.Default("accordion-button") .AddClass("collapsed", item.IsCollapsed) .AddClass($"btn-{item.TitleColor.ToDescriptionString()}", item.TitleColor != Color.None) .AddClass($"accordion-button-{item.TitleColor.ToDescriptionString()}", item.TitleColor != Color.None) .Build();
public bool SaveScene(string name, bool areAssetsRelativeToScene) { string oldRelativeDirectory = FileManager.RelativeDirectory; if (areAssetsRelativeToScene) { FileManager.RelativeDirectory = FileManager.GetDirectory(name); } // This will reduce the file size if we use a lot of SpriteGrids for (int i = 0; i < GameData.Scene.SpriteGrids.Count; i++) { GameData.Scene.SpriteGrids[i].TrimGrid(); } SpriteEditorScene ses = SpriteEditorScene.FromScene(GameData.Scene); ses.AssetsRelativeToSceneFile = areAssetsRelativeToScene; ses.Save(name); // TODO: Need to check if file saving worked properly. bool wasSceneSaved = true; if (wasSceneSaved) { #region create the SpriteEditorSceneProperties GameData.SpriteEditorSceneProperties.SetFromRuntime( GameData.Camera, GameData.BoundsCamera, GameData.EditorProperties.PixelSize, GuiData.CameraBoundsPropertyGrid.Visible ); GameData.SpriteEditorSceneProperties.WorldAxesVisible = GameData.EditorProperties.WorldAxesDisplayVisible; GameData.SpriteEditorSceneProperties.TextureDisplayRegionsList.Clear(); for (int k = 0; k < GuiData.ListWindow.TextureListBox.Count; k++) { TextureDisplayRegionsSave tdrs = new TextureDisplayRegionsSave(); CollapseItem item = GuiData.ListWindow.TextureListBox[k]; // The FileManager's relative directory has been set, so we just have to call MakeRelative and it should work fine tdrs.TextureName = FileManager.MakeRelative(((Texture2D)item.ReferenceObject).SourceFile()); tdrs.DisplayRegions = GuiData.ListWindow.CreateTextureReferences(item); GameData.SpriteEditorSceneProperties.TextureDisplayRegionsList.Add(tdrs); } GameData.SpriteEditorSceneProperties.Save(FileManager.RemoveExtension(name) + ".sep"); #endregion FlatRedBallServices.Owner.Text = "SpriteEditor - Currently editing " + name; // As mentioned in the othe area where GameData.Filename is set, I'm not // sure why we were removing the extension. I've commented out the extension // removal since it causes problems with CTRL+S // name = FileManager.RemoveExtension(name); GameData.FileName = name; if (SavedSuccess != null) { SavedSuccess(this, null); } } FileManager.RelativeDirectory = oldRelativeDirectory; if (!wasSceneSaved) { GuiManager.ShowMessageBox("Could not save " + GameData.FileName + ". Is the file readonly?", "Error Saving"); } return(wasSceneSaved); }