Esempio n. 1
0
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap.Clear();
            if (SpriteSheetHelperDialog.ShowDialog() == DialogResult.OK && SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap.Count > 0)
            {
                foreach (KeyValuePair <Tuple <int, int>, SpriteSheetTimeline> ActiveBitmap in SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap)
                {
                    SpriteSheetTimeline NewSpawnSpriteSheetBitmap = ActiveBitmap.Value;

                    NewSpawnSpriteSheetBitmap.Position   = new Vector2(535, 170);
                    NewSpawnSpriteSheetBitmap.SpawnFrame = KeyFrame;
                    NewSpawnSpriteSheetBitmap.DeathFrame = KeyFrame + 10;
                    NewSpawnSpriteSheetBitmap.IsUsed     = true;//Disable the spawner as we spawn the SpawnSpriteSheetBitmap manually.
                    NewSpawnSpriteSheetBitmap.Add(
                        KeyFrame, new VisibleAnimationObjectKeyFrame(new Vector2(NewSpawnSpriteSheetBitmap.Position.X, NewSpawnSpriteSheetBitmap.Position.Y),
                                                                     true, -1));

                    ReturnValue.Add(NewSpawnSpriteSheetBitmap);
                }
            }

            return(ReturnValue);
        }
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap.Clear();
            if (SpriteSheetHelperDialog.ShowDialog() == DialogResult.OK && SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap.Count > 0)
            {
                int Index = 1;
                foreach (KeyValuePair <Tuple <int, int>, SpriteSheetTimeline> ActiveBitmap in SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap)
                {
                    SpriteSheetTimeline NewSpawnSpriteSheetBitmap = ActiveBitmap.Value;

                    string[] ArraySpriteSheetName = NewSpawnSpriteSheetBitmap.SpriteSheetName.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
                    NewSpawnSpriteSheetBitmap.Name = ArraySpriteSheetName[ArraySpriteSheetName.Length - 1];
                    if (SpriteSheetHelperDialog.SpriteSheetViewer.DicActiveSpriteSheetBitmap.Count > 1)
                    {
                        NewSpawnSpriteSheetBitmap.Name += " " + Index;
                    }

                    NewSpawnSpriteSheetBitmap.Position   = new Vector2(535, 170);
                    NewSpawnSpriteSheetBitmap.SpawnFrame = KeyFrame;
                    NewSpawnSpriteSheetBitmap.DeathFrame = KeyFrame + 10;
                    NewSpawnSpriteSheetBitmap.IsUsed     = true;//Disable the spawner as we spawn the SpawnSpriteSheetBitmap manually.
                    NewSpawnSpriteSheetBitmap.Add(
                        KeyFrame, new VisibleAnimationObjectKeyFrame(new Vector2(NewSpawnSpriteSheetBitmap.Position.X, NewSpawnSpriteSheetBitmap.Position.Y),
                                                                     true, -1));

                    ReturnValue.Add(NewSpawnSpriteSheetBitmap);

                    ++Index;
                }
            }

            return(ReturnValue);
        }
Esempio n. 3
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = (IWindowsFormsEditorService)
                                             provider.GetService(typeof(IWindowsFormsEditorService));

            if (svc != null)
            {
                SpriteSheetHelper NewSpawner = (SpriteSheetHelper)value;
                SpriteSheetHelper SpriteSheetHelperDialog = new SpriteSheetHelper();
                SpriteSheetHelperDialog.Replace = true;
                SpriteSheetHelperDialog.SpriteSheetViewer.Preload();
                SpriteSheetHelperDialog.SpriteSheetViewer.DicSpriteSheet = new Dictionary <string, Texture2D>();

                SpriteSheetHelperDialog.SpriteSheetViewer.SpriteSheet = NewSpawner.SpriteSheetViewer.SpriteSheet;

                foreach (KeyValuePair <string, Texture2D> ActiveSpriteSheet in NewSpawner.SpriteSheetViewer.DicSpriteSheet)
                {
                    ListViewItem NewListViewItem = new ListViewItem(ActiveSpriteSheet.Key);
                    NewListViewItem.Tag = ActiveSpriteSheet.Value;

                    SpriteSheetHelperDialog.lvSpriteSheets.Items.Add(NewListViewItem);
                    SpriteSheetHelperDialog.SpriteSheetViewer.DicSpriteSheet.Add(ActiveSpriteSheet.Key, ActiveSpriteSheet.Value);
                }

                if (SpriteSheetHelperDialog.ShowDialog() == DialogResult.OK)
                {
                    value = SpriteSheetHelperDialog;
                }
            }
            return(value);
        }