コード例 #1
0
        public void OpenProject(string path)
        {
            Stream projectStream;

            if ((projectStream = File.OpenRead(path)) != null)
            {
                project.ProjectPath = $"{path}";
                projectStream.Dispose();
            }

            TimeLine.timeLine.ClearKeyframes();

            foreach (Animation animation in project.GetProjectInfo().animations)
            {
                Dictionary <string, Spritebox> spriteBoxes = new Dictionary <string, Spritebox>();

                foreach (KeyValuePair <string, SpriteboxJson> pair in animation.spriteBoxes)
                {
                    SpriteboxJson spritebox = pair.Value;

                    spriteBoxes.Add(pair.Key, Spritebox.FromJsonElement(spritebox));
                }

                TimeLine.timeLine.AddKeyframe(new Keyframe(animation.timelineX, 0, spriteBoxes, TimeLine.timeLine));
            }

            TimeLine.timeLine.TimeLineEnd = project.GetProjectInfo().TimelineEnd;
        }
コード例 #2
0
        // Create new keyframe button
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            int keyFramePos = (int)Math.Floor(TimeLineInfo.timelineMs / 16);

            Dictionary <string, Spritebox> sprBoxes = new Dictionary <string, Spritebox>();

            foreach (KeyValuePair <string, Spritebox> pair in MainWindowViewModel.MonogameWindow.GetPreviewObject().GetSpriteBoxes())
            {
                SpriteboxJson jsonSpr   = Spritebox.ToJsonElement(pair.Value);
                Spritebox     spriteBox = Spritebox.FromJsonElement(jsonSpr);
                string        newKey    = pair.Key.Substring(0, pair.Key.Length);
                sprBoxes.Add(newKey, spriteBox);
            }
            List <Keyframe> toRemove = new List <Keyframe>();

            foreach (Keyframe frame in _KeyFrames)
            {
                if (frame.PositionX == keyFramePos)
                {
                    toRemove.Add(frame);
                }
            }

            foreach (Keyframe frame in toRemove)
            {
                RemoveKeyframe(frame);
            }

            Keyframe newFrame = new Keyframe(keyFramePos, 0, sprBoxes, this);

            AddKeyframe(newFrame);
        }
コード例 #3
0
 public void AddSpriteBox(string key, Spritebox spriteBox)
 {
     if (!_SpriteBoxes.ContainsKey(key))
     {
         _SpriteBoxes.Add(key, spriteBox);
     }
 }
コード例 #4
0
        /// <summary>
        /// Displays current animation in preview window.
        /// </summary>
        public void DisplayAtScrubber()
        {
            int closestKeyframeTo       = -1;
            int closestKeyframeDistance = -1;

            MainWindowViewModel.MonogameWindow.setSprBoxSelected("enginereserved_null");

            if (_KeyFrames.Count > 0)
            {
                for (int i = 0; i < _KeyFrames.Count; i++)
                {
                    int      scrubberPos  = (int)Math.Floor(TimeLineInfo.timelineMs / 16);
                    Keyframe currentFrame = _KeyFrames.ElementAt(i);

                    bool isValid = true;

                    if (currentFrame.PositionX > scrubberPos)
                    {
                        isValid = false;
                    }

                    if (isValid)
                    {
                        if (closestKeyframeDistance == -1)
                        {
                            closestKeyframeDistance = Math.Abs(scrubberPos - _KeyFrames.ElementAt(i).PositionX);
                            closestKeyframeTo       = i;
                        }
                        else
                        {
                            if (Math.Abs(scrubberPos - _KeyFrames.ElementAt(i).PositionX) < closestKeyframeDistance)
                            {
                                closestKeyframeDistance = Math.Abs(scrubberPos - _KeyFrames.ElementAt(i).PositionX);
                                closestKeyframeTo       = i;
                            }
                        }
                    }
                }
            }

            if (closestKeyframeTo >= 0 && _KeyFrames.Count > 0)
            {
                Keyframe originalKeyframe = _KeyFrames.ElementAt(closestKeyframeTo);

                Dictionary <string, Spritebox> sprBoxes = new Dictionary <string, Spritebox>();

                foreach (KeyValuePair <string, Spritebox> pair in originalKeyframe.GetSpriteBoxes())
                {
                    SpriteboxJson jsonSpr   = Spritebox.ToJsonElement(pair.Value);
                    Spritebox     spriteBox = Spritebox.FromJsonElement(jsonSpr);
                    string        newKey    = pair.Key.Substring(0, pair.Key.Length);
                    sprBoxes.Add(newKey, spriteBox);
                }

                MainWindowViewModel.MonogameWindow.GetPreviewObject().SetSpriteBoxes(sprBoxes);
            }

            MainWindow.mainWindow.Properties.UpdateSpriteTree();
        }
コード例 #5
0
        public void UpdateSpriteTree()
        {
            if (TimeLine.timeLine.GetKeyframes().Count <= 0)
            {
                return;
            }

            SpriteTreeCanvas.Children.Clear();

            int keyFrameIndex = 0;

            for (int i = 0; i < TimeLine.timeLine.GetKeyframes().Count; i++)
            {
                if (i == MainWindowViewModel.GetNearestKeyframe())
                {
                    keyFrameIndex = i;
                }
            }

            Keyframe keyFrame = TimeLine.timeLine.GetKeyframes()[keyFrameIndex];

            int count = 0;

            foreach (KeyValuePair <string, Spritebox> pair in keyFrame.GetSpriteBoxes())
            {
                WordCheckStrip checkStrip = new WordCheckStrip();
                checkStrip.MainTextName.Text = pair.Key;

                SpriteTreeCanvas.Children.Add(checkStrip);
                Canvas.SetTop(checkStrip, count * 20);
                checkStrip.Width  = SpritePropertiesCanvas.Width;
                checkStrip.Height = 20;
                checkStrip.MainCheckbox.IsChecked = pair.Value.Visible();

                checkStrip.MainCheckbox.Click += (sender, e) =>
                {
                    Spritebox sprBox = null;
                    keyFrame.GetSpriteBoxes().TryGetValue(pair.Key, out sprBox);

                    if (sprBox != null)
                    {
                        sprBox.SetVisible((bool)checkStrip.MainCheckbox.IsChecked);

                        TimeLine.timeLine.DisplayAtScrubber();
                    }
                };

                count++;
            }
        }
コード例 #6
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            // Open project
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "PestControl Engine Animation Project (*.animproj)|*.animproj|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                Stream projectStream;

                if ((projectStream = openFileDialog.OpenFile()) != null)
                {
                    MainWindow.project.ProjectPath = $"{openFileDialog.FileName}";
                    projectStream.Dispose();
                }

                Close();

                TimeLine.timeLine.GetKeyframes().Clear();

                foreach (Animation animation in MainWindow.project.GetProjectInfo().animations)
                {
                    Dictionary <string, Spritebox> spriteBoxes = new Dictionary <string, Spritebox>();

                    foreach (KeyValuePair <string, SpriteboxJson> pair in animation.spriteBoxes)
                    {
                        SpriteboxJson spritebox = pair.Value;

                        spriteBoxes.Add(pair.Key, Spritebox.FromJsonElement(spritebox));
                    }

                    TimeLine.timeLine.AddKeyframe(new Keyframe(animation.timelineX, 0, spriteBoxes, TimeLine.timeLine));
                }

                TimeLine.timeLine.TimeLineEnd = MainWindow.project.GetProjectInfo().TimelineEnd;

                // If content path was invalid, show error dialog
                if (!Directory.Exists(MainWindow.project.GetProjectInfo().ContentPath))
                {
                    MessageBox.Show("Content Path is invalid or corrupt. No textures will be loaded.", "Content Path missing or corrupt");
                }
            }
        }
コード例 #7
0
        public void SaveProject(string path, MainWindow window)
        {
            if (window == null)
            {
                return;
            }

            TimeLine TimeLine = window.MainTimeline;

            ProjectInfoJson projectInfo = GetProjectInfo();

            projectInfo.animations.Clear();

            foreach (Keyframe keyFrame in TimeLine.GetKeyframes())
            {
                Dictionary <string, SpriteboxJson> spriteBoxes = new Dictionary <string, SpriteboxJson>();

                foreach (KeyValuePair <string, Spritebox> spr in keyFrame.GetSpriteBoxes())
                {
                    spriteBoxes.Add(spr.Key, Spritebox.ToJsonElement(spr.Value));
                }

                Animation animation = new Animation
                {
                    timelineX   = keyFrame.PositionX,
                    spriteBoxes = spriteBoxes
                };

                projectInfo.animations.Add(animation);
            }

            projectInfo.TimelineEnd           = TimeLine.TimeLineEnd;
            projectInfo.ProjectSaveIncrement += 1;

            SaveJSON(projectInfo, path);
        }
コード例 #8
0
        public static void ReadAnimationFile(string filePath, ProjectManager projectManager, TimeLine timeLine)
        {
            FileInfo file = new FileInfo(filePath);

            // Null checking
            if (file == null)
            {
                return;
            }

            if (projectManager == null)
            {
                return;
            }

            if (timeLine == null)
            {
                return;
            }

            BinaryReader binaryReader = new BinaryReader(File.Open(filePath, FileMode.Open));

            // Check if header is correct(basically check if this is even a valid PCAF file.)
            string headerString = binaryReader.ReadString();

            if (headerString == headerName)
            {
                // Clear keyframes in timeline
                timeLine.ClearKeyframes();

                // Ok cool so this file is a PCAF file.
                // Load version number incase this is ever useful(and because we kinda have to push the reader forward for it to read correctly)
                int versionNumber = binaryReader.ReadInt32();

                // Load Project Info
                binaryReader.ReadBoolean();
                binaryReader.ReadInt32();
                binaryReader.ReadString();
                binaryReader.ReadInt32();

                int keyframeCount = binaryReader.ReadInt32();

                for (int i = 0; i < keyframeCount; i++)
                {
                    // Read timeline x coordinate
                    int timelineX = binaryReader.ReadInt32();

                    int spriteboxCount = binaryReader.ReadInt32();

                    Keyframe keyframe = new Keyframe(timelineX, 0, new Dictionary <string, monogame.objects.Spritebox>(), timeLine);

                    for (int j = 0; j < spriteboxCount; j++)
                    {
                        // Get name
                        string name = binaryReader.ReadString();

                        // General properties
                        double posX         = binaryReader.ReadDouble();
                        double posY         = binaryReader.ReadDouble();
                        int    width        = binaryReader.ReadInt32();
                        int    height       = binaryReader.ReadInt32();
                        string textureKey   = binaryReader.ReadString();
                        float  rotation     = binaryReader.ReadSingle();
                        int    sourceX      = binaryReader.ReadInt32();
                        int    sourceY      = binaryReader.ReadInt32();
                        int    sourceWidth  = binaryReader.ReadInt32();
                        int    sourceHeight = binaryReader.ReadInt32();
                        float  layer        = binaryReader.ReadSingle();
                        bool   visible      = binaryReader.ReadBoolean();

                        SpriteboxJson spriteBox = new SpriteboxJson();
                        spriteBox.posX         = posX;
                        spriteBox.posY         = posY;
                        spriteBox.width        = width;
                        spriteBox.height       = height;
                        spriteBox.textureKey   = textureKey;
                        spriteBox.rotation     = rotation;
                        spriteBox.sourceX      = sourceX;
                        spriteBox.sourceY      = sourceY;
                        spriteBox.sourceWidth  = sourceWidth;
                        spriteBox.sourceHeight = sourceHeight;
                        spriteBox.layer        = layer;
                        spriteBox.visible      = visible;

                        keyframe.AddSpriteBox(name, Spritebox.FromJsonElement(spriteBox));
                    }

                    timeLine.AddKeyframe(keyframe);
                }

                MainWindowViewModel.MonogameWindow.setSprBoxSelected("enginereserved_null");
                timeLine.DisplayAtScrubber();
            }

            binaryReader.Dispose();
        }
コード例 #9
0
        public void UpdateFields()
        {
            if (MainWindowViewModel.MonogameWindow == null)
            {
                return;
            }

            int rectangleHeight = 20;

            SpritePropertiesCanvas.Children.Clear();

            if (MainWindowViewModel.MonogameWindow.GetPreviewObject() != null)
            {
                int keyFrameIndex = 0;

                for (int i = 0; i < TimeLine.timeLine.GetKeyframes().Count; i++)
                {
                    if (i == MainWindowViewModel.GetNearestKeyframe())
                    {
                        keyFrameIndex = i;
                    }
                }

                Spritebox spriteBox = MainWindowViewModel.MonogameWindow.GetSelectionBox().GetBoundObject();

                Spritebox validateBox = null;
                if (TimeLine.timeLine.GetKeyframes().Count > 0)
                {
                    TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes().TryGetValue(MainWindowViewModel.MonogameWindow.GetSelectedSpriteboxKey(), out validateBox);
                }

                if (spriteBox != null && validateBox != null)
                {
                    FieldInfo[] fields = typeof(Spritebox).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);

                    int currentIndex = 0;

                    PropertyStrip propertyStripName = new PropertyStrip();

                    propertyStripName.Width = SpritePropertiesCanvas.ActualWidth;

                    propertyStripName.PropertyHeader.Text = "name";

                    // (SpritePropertiesCanvas is the canvas that we're adding these property strips to and also the thing we're changing the color of)
                    SpritePropertiesCanvas.Background = new SolidColorBrush(Color.FromRgb(53, 53, 63));
                    if (currentIndex % 2 == 0)
                    {
                        propertyStripName.StripBackground.Fill = new SolidColorBrush(Color.FromRgb(53, 53, 63));
                        SpritePropertiesCanvas.Background      = new SolidColorBrush(Color.FromRgb(47, 47, 56));
                    }

                    foreach (KeyValuePair <string, Spritebox> pair in MainWindowViewModel.MonogameWindow.GetPreviewObject().GetSpriteBoxes())
                    {
                        if (pair.Value == spriteBox)
                        {
                            propertyStripName.PropertyTextBox.Text = pair.Key;
                        }
                    }

                    propertyStripName.PropertyTextBox.TextChanged += (sender, e) =>
                    {
                        string forbiddenPrefix       = "enginereserved_";
                        int    forbiddenPrefixLength = forbiddenPrefix.Length;

                        bool nameExists = false;

                        Spritebox spriteBoxRename = MainWindowViewModel.MonogameWindow.GetSelectionBox().GetBoundObject();

                        // Check if there is a sprite box with the name in the text box.
                        foreach (KeyValuePair <string, Spritebox> pair in TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes())
                        {
                            if (pair.Key == propertyStripName.PropertyTextBox.Text && pair.Value != spriteBoxRename)
                            {
                                nameExists = true;
                            }
                        }

                        // Check if the name is valid
                        if ((propertyStripName.PropertyTextBox.Text.Length >= forbiddenPrefixLength && propertyStripName.PropertyTextBox.Text.Substring(0, forbiddenPrefixLength) == forbiddenPrefix) || (propertyStripName.PropertyTextBox.Text.Contains('"')) || nameExists)
                        {
                            // Name is invalid.
                            propertyStripName.PropertyTextBox.Background = new SolidColorBrush(Color.FromRgb(166, 49, 49));
                        }
                        else
                        {
                            // Name is valid, set the color of the text box back and change the name of the spritebox.
                            propertyStripName.PropertyTextBox.Background = Brushes.White;

                            KeyValuePair <string, Spritebox> oldPair = new KeyValuePair <string, Spritebox>();

                            foreach (KeyValuePair <string, Spritebox> pair in TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes())
                            {
                                if (pair.Key == MainWindowViewModel.MonogameWindow.getSprBoxSelected())
                                {
                                    oldPair = pair;
                                }
                            }

                            // Remove keyvalue pair so we can add it again with the new updated key.
                            if (MainWindowViewModel.MonogameWindow.GetSelectedSpriteboxKey() != "enginereserved_null")
                            {
                                TimeLine.timeLine.GetKeyframes().ElementAt(keyFrameIndex).RemoveSpriteBox(MainWindowViewModel.MonogameWindow.GetSelectedSpriteboxKey());
                            }

                            KeyValuePair <string, Spritebox> newPair = new KeyValuePair <string, Spritebox>(propertyStripName.PropertyTextBox.Text, oldPair.Value);
                            TimeLine.timeLine.GetKeyframes()[keyFrameIndex].AddSpriteBox(newPair.Key, oldPair.Value);
                            TimeLine.timeLine.DisplayAtScrubber();
                            MainWindowViewModel.MonogameWindow.setSprBoxSelected(propertyStripName.PropertyTextBox.Text);
                        }
                    };


                    SpritePropertiesCanvas.Children.Add(propertyStripName);

                    Canvas.SetLeft(propertyStripName, 0);
                    Canvas.SetTop(propertyStripName, currentIndex * rectangleHeight);


                    currentIndex++;

                    foreach (FieldInfo field in fields)
                    {
                        // Add property field for modifying this property.
                        if (field.FieldType == typeof(int) || field.FieldType == typeof(float) || field.FieldType == typeof(string))
                        {
                            PropertyStrip propertyStrip = new PropertyStrip();
                            propertyStrip.PropertyHeader.Text = field.Name;
                            propertyStrip.Width = SpritePropertiesCanvas.ActualWidth;

                            SpritePropertiesCanvas.Background = new SolidColorBrush(Color.FromRgb(53, 53, 63));
                            if (currentIndex % 2 == 0)
                            {
                                propertyStrip.StripBackground.Fill = new SolidColorBrush(Color.FromRgb(53, 53, 63));
                                SpritePropertiesCanvas.Background  = new SolidColorBrush(Color.FromRgb(47, 47, 56));
                            }

                            SpritePropertiesCanvas.Children.Add(propertyStrip);

                            Canvas.SetLeft(propertyStrip, 0);
                            Canvas.SetTop(propertyStrip, currentIndex * rectangleHeight);

                            // Set textbox text to current value
                            if (field.FieldType == typeof(int))
                            {
                                propertyStrip.PropertyTextBox.Text = ((int)field.GetValue(validateBox)).ToString(CultureInfo.CurrentCulture);
                            }

                            if (field.FieldType == typeof(float))
                            {
                                propertyStrip.PropertyTextBox.Text = ((float)field.GetValue(validateBox)).ToString(CultureInfo.CurrentCulture);
                            }

                            if (field.FieldType == typeof(string))
                            {
                                propertyStrip.PropertyTextBox.Text = (string)field.GetValue(validateBox);
                            }

                            propertyStrip.PropertyTextBox.TextChanged += (sender, e) =>
                            {
                                // INTEGER BOX
                                if (field.FieldType == typeof(int))
                                {
                                    int parseOut = 0;
                                    if (int.TryParse(propertyStrip.PropertyTextBox.Text, out parseOut))
                                    {
                                        if (field != null)
                                        {
                                            field.SetValue(validateBox, parseOut);
                                        }
                                        propertyStrip.PropertyTextBox.Background = Brushes.White;

                                        TimeLine.timeLine.DisplayAtScrubber();

                                        foreach (KeyValuePair <string, Spritebox> sprPair in TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes())
                                        {
                                            if (sprPair.Value == validateBox)
                                            {
                                                MainWindowViewModel.MonogameWindow.setSprBoxSelected(sprPair.Key);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        propertyStrip.PropertyTextBox.Background = new SolidColorBrush(Color.FromRgb(166, 49, 49));
                                    }
                                }

                                // FLOAT BOX
                                if (field.FieldType == typeof(float))
                                {
                                    float parseOut = 0;
                                    if (float.TryParse(propertyStrip.PropertyTextBox.Text, out parseOut))
                                    {
                                        if (field != null)
                                        {
                                            field.SetValue(validateBox, parseOut);
                                        }
                                        propertyStrip.PropertyTextBox.Background = Brushes.White;

                                        TimeLine.timeLine.DisplayAtScrubber();

                                        foreach (KeyValuePair <string, Spritebox> sprPair in TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes())
                                        {
                                            if (sprPair.Value == validateBox)
                                            {
                                                MainWindowViewModel.MonogameWindow.setSprBoxSelected(sprPair.Key);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        propertyStrip.PropertyTextBox.Background = new SolidColorBrush(Color.FromRgb(166, 49, 49));
                                    }
                                }

                                // STRING BOX
                                if (field.FieldType == typeof(string))
                                {
                                    if (!propertyStrip.PropertyTextBox.Text.Contains('"'))
                                    {
                                        if (field != null)
                                        {
                                            field.SetValue(validateBox, propertyStrip.PropertyTextBox.Text);
                                        }

                                        if (field.Name == "_textureKey")
                                        {
                                            // Turn yellow if the sprite key isn't loaded but it is a valid string.
                                            if (ContentManager.GetTexture(propertyStrip.PropertyTextBox.Text) == null)
                                            {
                                                propertyStrip.PropertyTextBox.Background = Brushes.Yellow;
                                            }
                                            else
                                            {
                                                propertyStrip.PropertyTextBox.Background = Brushes.White;
                                            }
                                        }


                                        TimeLine.timeLine.DisplayAtScrubber();

                                        foreach (KeyValuePair <string, Spritebox> sprPair in TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes())
                                        {
                                            if (sprPair.Value == validateBox)
                                            {
                                                MainWindowViewModel.MonogameWindow.setSprBoxSelected(sprPair.Key);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        propertyStrip.PropertyTextBox.Background = new SolidColorBrush(Color.FromRgb(166, 49, 49));
                                    }
                                }
                            };

                            currentIndex++;
                        }

                        if (field.FieldType == typeof(Microsoft.Xna.Framework.Vector2))
                        {
                            for (int i = 0; i < 2; i++)
                            {
                                // POSITION X AND Y
                                PropertyStrip propertyStripVector       = new PropertyStrip();
                                Microsoft.Xna.Framework.Vector2 vector2 = (Microsoft.Xna.Framework.Vector2)field.GetValue(validateBox);

                                propertyStripVector.Width = SpritePropertiesCanvas.ActualWidth;

                                if (i == 0)
                                {
                                    propertyStripVector.PropertyHeader.Text  = $"{field.Name}.X";
                                    propertyStripVector.PropertyTextBox.Text = vector2.X.ToString(CultureInfo.CurrentCulture);
                                }
                                else
                                {
                                    propertyStripVector.PropertyHeader.Text  = $"{field.Name}.Y";
                                    propertyStripVector.PropertyTextBox.Text = vector2.Y.ToString(CultureInfo.CurrentCulture);
                                }

                                // (SpritePropertiesCanvas is the canvas that we're adding these property strips to and also the thing we're changing the color of)
                                SpritePropertiesCanvas.Background = new SolidColorBrush(Color.FromRgb(53, 53, 63));
                                if (currentIndex % 2 == 0)
                                {
                                    propertyStripVector.StripBackground.Fill = new SolidColorBrush(Color.FromRgb(53, 53, 63));
                                    SpritePropertiesCanvas.Background        = new SolidColorBrush(Color.FromRgb(47, 47, 56));
                                }

                                SpritePropertiesCanvas.Children.Add(propertyStripVector);

                                Canvas.SetLeft(propertyStripVector, 0);
                                Canvas.SetTop(propertyStripVector, currentIndex * rectangleHeight);

                                propertyStripVector.PropertyTextBox.TextChanged += (sender, e) =>
                                {
                                    if (float.TryParse(propertyStripVector.PropertyTextBox.Text, out float outParse))
                                    {
                                        if (propertyStripVector.PropertyHeader.Text == $"{field.Name}.X")
                                        {
                                            vector2.X = outParse;
                                        }
                                        Console.WriteLine(vector2.X);
                                        if (propertyStripVector.PropertyHeader.Text == $"{field.Name}.Y")
                                        {
                                            vector2.Y = outParse;
                                        }

                                        propertyStripVector.PropertyTextBox.Background = Brushes.White;
                                    }
                                    else
                                    {
                                        propertyStripVector.PropertyTextBox.Background = new SolidColorBrush(Color.FromRgb(166, 49, 49));
                                    }

                                    field.SetValue(validateBox, vector2);

                                    TimeLine.timeLine.DisplayAtScrubber();

                                    foreach (KeyValuePair <string, Spritebox> sprPair in TimeLine.timeLine.GetKeyframes()[keyFrameIndex].GetSpriteBoxes())
                                    {
                                        if (sprPair.Value == validateBox)
                                        {
                                            MainWindowViewModel.MonogameWindow.setSprBoxSelected(sprPair.Key);
                                        }
                                    }
                                };

                                currentIndex++;
                            }
                        }
                    }
                }
            }
        }
コード例 #10
0
 public void RemovePreviewSpriteBox(Spritebox spriteBox)
 {
     previewObject.RemoveSpriteBox(spriteBox);
 }
コード例 #11
0
 public void AddPreviewSpriteBox(Spritebox spriteBox)
 {
     previewObject.GetSpriteBoxes().Add($"{previewObject.GetSpriteBoxes().Count}", spriteBox);
 }