コード例 #1
0
        private void UpdateLineGridToTexture(Texture2D texture)
        {
            float rowWidth    = 0;
            float columnWidth = 0;

            if (SelectedState.Self.SelectedTileMapInformation != null)
            {
                TileMapInformation tmi = SelectedState.Self.SelectedTileMapInformation;
                rowWidth    = tmi.TileHeight;
                columnWidth = tmi.TileWidth;
            }

            if (texture != null && rowWidth != 0 && columnWidth != 0 && PropertyGridManager.Self.UnitType == UnitType.SpriteSheet)
            {
                mLineGrid.Visible     = true;
                mLineGrid.ColumnWidth = columnWidth;
                mLineGrid.RowWidth    = rowWidth;

                mLineGrid.ColumnCount = (int)(texture.Width / columnWidth);
                mLineGrid.RowCount    = (int)(texture.Height / rowWidth);
                // This puts it in front of everything - maybe eventually we want to use layers?
                mLineGrid.Z = 1;
            }

            else
            {
                mLineGrid.Visible = false;
            }
        }
コード例 #2
0
        public void SetTileY(AnimationFrameSave frame, int valueAsInt)
        {
            if (frame == null)
            {
                throw new ArgumentNullException(nameof(frame));
            }
            TileMapInformation information = TileMapInformation;

            if (information != null && mTexture != null)
            {
                int pixelPosition = valueAsInt * information.TileHeight;
                frame.TopCoordinate    = pixelPosition / (float)mTexture.Height;
                frame.BottomCoordinate = frame.TopCoordinate + (information.TileHeight / (float)mTexture.Height);
            }
        }
コード例 #3
0
        public void SetTileX(AnimationFrameSave frame, int valueAsInt)
        {
            if (frame == null)
            {
                throw new ArgumentNullException(nameof(frame));
            }
            TileMapInformation information = TileMapInformation;

            if (information != null && mTexture != null)
            {
                int pixelPosition = valueAsInt * information.TileWidth;
                frame.LeftCoordinate  = pixelPosition / (float)mTexture.Width;
                frame.RightCoordinate = frame.LeftCoordinate + (information.TileWidth / (float)mTexture.Width);
            }
        }
コード例 #4
0
        public void UpdateTileMapInformationListAndDisplay()
        {
            string             fileName    = SelectedState.Self.SelectedTextureName;
            TileMapInformation tileMapInfo = ProjectManager.Self.TileMapInformationList.GetTileMapInformation(fileName);

            if (tileMapInfo == null && !string.IsNullOrEmpty(fileName))
            {
                tileMapInfo      = new TileMapInformation();
                tileMapInfo.Name = fileName;
                ProjectManager.Self.TileMapInformationList.TileMapInfos.Add(tileMapInfo);
            }
            if (SelectedState.Self.SelectedFrame == null || ApplicationState.Self.UnitType != AnimationEditorForms.UnitType.SpriteSheet)
            {
                this.mTileMapInfoWindow.Visible = false;
            }
            else
            {
                this.mTileMapInfoWindow.Visible            = true;
                this.mTileMapInfoWindow.TileMapInformation = tileMapInfo;
            }
        }