Exemplo n.º 1
0
Arquivo: View.cs Projeto: stee01/ags
        public ViewLoop AddNewLoop()
        {
            ViewLoop newLoop = new ViewLoop();

            newLoop.ID = _loops.Count;
            _loops.Add(newLoop);
            return(newLoop);
        }
Exemplo n.º 2
0
 public void Clone(ViewLoop target, bool flipped)
 {
     target.Frames.Clear();
     target.RunNextLoop = RunNextLoop;
     foreach (ViewFrame frame in _frames)
     {
         target.Frames.Add(frame.Clone(flipped));
     }
 }
Exemplo n.º 3
0
        public ViewLoop Clone(bool flipped)
        {
            ViewLoop clone = new ViewLoop
            {
                _frames      = new List <ViewFrame>(),
                _runNextLoop = RunNextLoop
            };

            foreach (ViewFrame frame in _frames)
            {
                clone.Frames.Add(frame.Clone(flipped));
            }

            return(clone);
        }
Exemplo n.º 4
0
        public ViewLoopEditor(ViewLoop loopToEdit, GUIController guiController)
        {
            InitializeComponent();
            _selectedFrame = -1;
            _loop = loopToEdit;
            lblLoopTitle.Text = "Loop " + _loop.ID + " (" + _loop.DirectionDescription + ")";
            chkRunNextLoop.DataBindings.Add("Checked", _loop, "RunNextLoop", false, DataSourceUpdateMode.OnPropertyChanged);
            _isLastLoop = false;
            _loopDisplayY = chkRunNextLoop.Top + chkRunNextLoop.Height + 2;

            FRAME_DISPLAY_SIZE = guiController.AdjustSizeFrom96DpiToSystemDpi(FRAME_DISPLAY_SIZE_96DPI);
            btnNewFrame.Width = FRAME_DISPLAY_SIZE;
            btnNewFrame.Height = FRAME_DISPLAY_SIZE;
            btnNewFrame.Top = _loopDisplayY;

            _framelessWidth = Math.Max(chkRunNextLoop.Width + 10, Screen.PrimaryScreen.Bounds.Width);
            UpdateControlWidth();
        }
Exemplo n.º 5
0
 public ViewLoop AddNewLoop()
 {
     ViewLoop newLoop = new ViewLoop();
     newLoop.ID = _loops.Count;
     _loops.Add(newLoop);
     return newLoop;
 }
Exemplo n.º 6
0
        private static Sprite ReadOldStyleViewFrame(BinaryReader reader, ViewLoop loop, ViewFrame frame, Color[] palette)
        {
            int colDepth = reader.ReadInt32();
            if (colDepth == 200)
            {
                loop.RunNextLoop = true;
                loop.Frames.Remove(frame);
                return null;
            }
            int spriteFlags = reader.ReadByte();
            int width = reader.ReadInt32();
            int height = reader.ReadInt32();
            byte[] spriteData = reader.ReadBytes(width * height * ((colDepth + 1) / 8));

            Sprite newSprite = ImportSpriteFromRawData(colDepth, width, height, (spriteFlags & SPRITE_FLAG_ALPHA_CHANNEL) != 0, spriteData, palette);
            if ((spriteFlags & SPRITE_FLAG_HI_RES) != 0)
            {
                newSprite.Resolution = SpriteImportResolution.HighRes;
            }
            return newSprite;
        }
Exemplo n.º 7
0
 public void DrawViewLoop(IntPtr hdc, ViewLoop loop, int x, int y, int sizeInPixels, int selectedFrame)
 {
     lock (_spriteSetLock)
     {
         _native.DrawViewLoop((int)hdc, loop, x, y, sizeInPixels, selectedFrame);
     }
 }
Exemplo n.º 8
0
 private void copyLoop()
 {
     _copiedLoop = _loop.Clone();            
 }
Exemplo n.º 9
0
 private ViewLoopEditor AddNewLoopPane(ViewLoop loop)
 {
     ViewLoopEditor loopPane = new ViewLoopEditor(loop, _guiController);
     loopPane.Left = 10;
     loopPane.Top = 10 + _loopPanes.Count * loopPane.Height + editorPanel.AutoScrollPosition.Y;
     loopPane.SelectedFrameChanged += new ViewLoopEditor.SelectedFrameChangedHandler(loopPane_SelectedFrameChanged);
     loopPane.NewFrameAdded += new ViewLoopEditor.NewFrameAddedHandler(loopPane_NewFrameAdded);
     if (loop.ID == _editingView.Loops.Count - 1)
     {
         loopPane.IsLastLoop = true;
     }
     loopPane.Enter += new EventHandler(loopPane_GotFocus);
     //loopPane.GotFocus += new EventHandler(loopPane_GotFocus);
     //loopPane.Leave += new EventHandler(loopPane_GotFocus);
     editorPanel.Controls.Add(loopPane);
     _loopPanes.Add(loopPane);
     return loopPane;
 }
Exemplo n.º 10
0
        private void loopPane_SelectedFrameChanged(ViewLoop loop, int newSelectedFrame)
        {
            if (newSelectedFrame >= 0)
            {
                _guiController.SetPropertyGridObjectList(ConstructPropertyObjectList(loop));
                _guiController.SetPropertyGridObject(loop.Frames[newSelectedFrame]);
            }
            else
            {
                _guiController.SetPropertyGridObjectList(null);
                _guiController.SetPropertyGridObject(_editingView);
            }

            // deselect all other loops
            foreach (ViewLoopEditor pane in _loopPanes)
            {
                if (pane.Loop != loop)
                {
                    pane.SelectedFrame = -1;
                }
            }

            // the view's Flipped setting might have changed, ensure
            // the preview is updated
            viewPreview.ViewUpdated();
        }
Exemplo n.º 11
0
 private void loopPane_NewFrameAdded(ViewLoop loop, int newSelectedFrame)
 {
     if (newSelectedFrame > 0)
     {
         // Attempt to initialize the new frame to the sprite that
         // comes after the previous frame in the sprite manager
         int previousFrameImage = loop.Frames[newSelectedFrame - 1].Image;
         SpriteFolder parent = Factory.AGSEditor.CurrentGame.RootSpriteFolder.FindFolderThatContainsSprite(previousFrameImage);
         if ((parent != null) && (previousFrameImage > 0))
         {
             for (int i = 0; i < parent.Sprites.Count; i++)
             {
                 if ((parent.Sprites[i].Number == previousFrameImage) &&
                     (i < parent.Sprites.Count - 1))
                 {
                     loop.Frames[newSelectedFrame].Image = parent.Sprites[i + 1].Number;
                     break;
                 }
             }
         }
     }
 }
Exemplo n.º 12
0
 private Dictionary<string, object> ConstructPropertyObjectList(ViewLoop loop)
 {
     Dictionary<string, object> list = new Dictionary<string, object>();
     foreach (ViewFrame frame in loop.Frames)
     {
         list.Add("Loop " + loop.ID + " frame " + frame.ID + " (View frame)", frame);
     }
     return list;
 }
Exemplo n.º 13
0
 public void Clone(ViewLoop target, bool flipped)
 {
     target.Frames.Clear();
     target.RunNextLoop = RunNextLoop;
     foreach (ViewFrame frame in _frames)
     {
         target.Frames.Add(frame.Clone(flipped));
     }
 }
Exemplo n.º 14
0
        public ViewLoop Clone(bool flipped)
        {
            ViewLoop clone = new ViewLoop
            {
                _frames = new List<ViewFrame>(),
                _runNextLoop = RunNextLoop
            };

            foreach (ViewFrame frame in _frames)
            {
                clone.Frames.Add(frame.Clone(flipped));
            }

            return clone;
        }