Exemplo n.º 1
0
 public void AddFrame(SpriteFrame frameSrc)
 {
     _frames.Add(frameSrc);
 }
Exemplo n.º 2
0
 void SelectFrame(int index)
 {
     if(_frameset != null && index >= 0 && index < _frameset.FramesCount())
     {
         _frame = _frameset.Frames[index];
         _frameIndex = index;
     }
 }
Exemplo n.º 3
0
        void GUIDrawAnimList()
        {
            EditorGUILayout.BeginVertical();

            //Animations list
            _guivarAnimListScroll = EditorGUILayout.BeginScrollView(_guivarAnimListScroll, _guistyleAnimListView);

            GUILayout.Label("Animations");

            //if there are framesets
            if(_framesetsNames.Count > 0)
            {
                int i = GUILayout.SelectionGrid
                (
                    _framesetIndex,
                    _framesetsNames.ToArray(),
                    1
                );

                if( i != _framesetIndex)
                {
                    _framesetIndex = i;
                    _frameIndex = 0;

                    _frameset = _sprite.Framesets[_framesetIndex];
                    _frame = _sprite.Framesets[_framesetIndex].Frames[_frameIndex];
                    //if(_framesetIndex >= 0 && _framesetIndex < _sprite.FramesetsCount())
                    //{
                    //	_frameIndex = 0;
                    //}
                }
                /*
                if(_framesetIndex < 0)
                {
                    _framesetIndex = 0;
                }

                _framesetIndex = GUILayout.SelectionGrid
                (
                    _framesetIndex,
                    _framesetsNames.ToArray(),
                    1
                );

                if(_framesetIndex >= 0 && _framesetIndex < _sprite.FramesetsCount())
                {
                    _frameset = _sprite.Framesets[_framesetIndex];

                    _frameIndex = -1;
                    if(_frameset.FramesCount() > 0)
                    {
                        _frameIndex = 0;
                        _frame = _frameset.Frames[_frameIndex];
                    }
                }
                */
            }
            else
            {
                if(GUILayout.Button("New Frameset", GuiHeight(64)))
                {
                    AddNewFrameset();
                }
            }

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();
        }
Exemplo n.º 4
0
        void OpenSpriteToEdit(string fileName)
        {
            if(File.Exists(fileName))
            {
                _sprite = null;
                _frameset = null;
                _frame = null;
                _spriteSrc = "";

                _sprite = new Sprite();
                _sprite.FromXml(fileName);
                _guivarActiveTabIndex = 0;
                //_sprResourcesList = null;
                _guivarFilmScroll = Vector2.zero;
                _framesetsNames = _sprite.GetFramesetsNames();
                _framesetIndex = -1;
                _frameIndex = -1;
                _texture = _sprite.Texture;
                //_guivarFilmScrollView = new Dictionary<string, Vector2>();

                /*
                foreach(SpriteFrameset fSet in _sprite.GetFramesets())
                {
                    _guivarFilmScrollView.Add(fSet.Name, Vector2.zero);
                }
                */

                SelectFrameset(0);
                SelectFrame(0);

                _spriteSrc = fileName;
            }
            /*
            _guivarFilmFoldout = new Dictionary<string, bool>();

            foreach(SpriteFrameset fSet in _sprite.GetFramesets())
            {
                _guivarFilmFoldout.Add(fSet.Name, false);
            }
            */
        }