Merge pull request #106 from progtime-net/AnimationMakerAdvanced

Animation maker advanced
This commit is contained in:
SergoDobro 2024-09-07 01:09:13 +03:00 committed by GitHub
commit 04d09f8f4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 1384 additions and 22 deletions

View file

@ -0,0 +1,36 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.1.303",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-mac"
]
}
}
}

View file

@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RollForward>Major</RollForward>
<PublishReadyToRun>false</PublishReadyToRun>
<TieredCompilation>false</TieredCompilation>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="Icon.ico" />
<None Remove="Icon.bmp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Icon.ico" />
<EmbeddedResource Include="Icon.bmp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
<PackageReference Include="NativeFileDialogSharp" Version="0.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MonogameLibrary\MonogameLibrary.csproj" />
<ProjectReference Include="..\ZoFo\ZoFo.csproj" />
</ItemGroup>
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
<Message Text="Restoring dotnet tools" Importance="High" />
<Exec Command="dotnet tool restore" />
</Target>
</Project>

View file

@ -0,0 +1,271 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#
#begin Fonts/CarltineRegular-K7z5l.ttf
/copy:Fonts/CarltineRegular-K7z5l.ttf
#begin Fonts/Debrosee-ALPnL.ttf
/copy:Fonts/Debrosee-ALPnL.ttf
#begin Fonts/Font.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Fonts/Font.spritefont
#begin Fonts/Font2.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Fonts/Font2.spritefont
#begin Fonts/Font3.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Fonts/Font3.spritefont
#begin Fonts/Font4.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Fonts/Font4.spritefont
#begin Fonts/MouldyCheeseRegular-WyMWG.ttf
/copy:Fonts/MouldyCheeseRegular-WyMWG.ttf
#begin Fonts/Troubleside-lgjxX.ttf
/copy:Fonts/Troubleside-lgjxX.ttf
#begin GUI/back.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/back.png
#begin GUI/background/base.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/base.png
#begin GUI/background/endGame.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/endGame.png
#begin GUI/background/join.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/join.png
#begin GUI/background/mainMenu.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/mainMenu.png
#begin GUI/background/options.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/options.png
#begin GUI/background/selectMode.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/selectMode.png
#begin GUI/background/waiting.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/background/waiting.png
#begin GUI/Button.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/Button.png
#begin GUI/Button2.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/Button2.png
#begin GUI/ButtonI.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/ButtonI.png
#begin GUI/checkboxs_off-on.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/checkboxs_off-on.png
#begin GUI/checkboxs_off.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/checkboxs_off.png
#begin GUI/checkboxs_on.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/checkboxs_on.png
#begin GUI/MenuBackground.jpg
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/MenuBackground.jpg
#begin GUI/mouse.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/mouse.png
#begin GUI/Switch_backgrownd.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/Switch_backgrownd.png
#begin GUI/switch.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/switch.png

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>Debrosee-ALPnL.ttf</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>100</Size>
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>CarltineRegular-K7z5l.ttf</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>15</Size>
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>MouldyCheeseRegular-WyMWG.ttf</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>50</Size>
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>Troubleside-lgjxX.ttf</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>50</Size>
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>32</Start>
<End>127</End>
</CharacterRegion>
<CharacterRegion>
<Start>&#1040;</Start>
<End>&#1112;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,82 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using AnimatorFileCreatorAdvanced.Core.GUI;
namespace AnimatorFileCreatorAdvanced.Core
{
public class AppManager : Game
{
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
public Point CurentScreenResolution = new Point(1000, 600);
AbstractGUI GUI;
public static AppManager Instance { get; private set; }
public AppManager()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
SetResolution(CurentScreenResolution.X, CurentScreenResolution.Y);
Instance = this;
GUI = new CreatingAnimationGUI();
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
GUI.Initialize();
GUI.LoadContent();
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
GUI.Update(gameTime);
// TODO: Add your update logic here
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.DarkSlateBlue);
// TODO: Add your drawing code here
GUI.Draw(_spriteBatch);
base.Draw(gameTime);
}
public void SetResolution(int x, int y)
{
_graphics.PreferredBackBufferWidth = x;
_graphics.PreferredBackBufferHeight = y;
}
public void FulscrreenSwitch()
{
_graphics.IsFullScreen = !_graphics.IsFullScreen;
}
}
}

View file

@ -0,0 +1,57 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MonogameLibrary.UI.Base;
namespace AnimatorFileCreatorAdvanced.Core.GUI
{
public abstract class AbstractGUI
{
protected UIManager Manager = new();
protected List<DrawableUIElement> Elements = new();
private List<DrawableUIElement> ActiveElements;
protected DrawableUIElement SelectedElement;
private bool isStartedPrint = false;
private bool isPressed = false;
private Texture2D mouse;
private MouseState mouseState;
public AbstractGUI()
{
}
protected abstract void CreateUI();
private GraphicsDevice graphicsDevice;
public virtual void Initialize()
{
Manager.Initialize(AppManager.Instance.GraphicsDevice);
CreateUI();
}
public virtual void LoadContent()
{
Manager.LoadContent(AppManager.Instance.Content, "Fonts/Font");
mouse = AppManager.Instance.Content.Load<Texture2D>("GUI/mouse");
}
public virtual void Update(GameTime gameTime)
{
Manager.Update(gameTime);
mouseState = Mouse.GetState();
}
public virtual void Draw(SpriteBatch spriteBatch)
{
Manager.Draw(spriteBatch);
spriteBatch.Begin();
spriteBatch.Draw(mouse, new Rectangle(mouseState.Position.X, mouseState.Position.Y, 20, 40), Color.White);
spriteBatch.End();
}
}
}

View file

@ -0,0 +1,545 @@
using Microsoft.Xna.Framework;
using MonogameLibrary.UI.Elements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NativeFileDialogSharp;
using Microsoft.Xna.Framework.Graphics;
using System.Runtime.CompilerServices;
using System.ComponentModel;
using System.IO;
using ZoFo.GameCore.Graphics;
using Newtonsoft.Json;
namespace AnimatorFileCreatorAdvanced.Core.GUI
{
internal class CreatingAnimationGUI : AbstractGUI
{
protected override void CreateUI()
{
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
Label FileNameLabel = new Label(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0, 0.2f, 0, 0.1f),
text = "TEXT",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
Label AnimationPath = new Label(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0f, 0.2f, 0.1f, 0.1f),
text = "AnimationFileFolder/Path",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
Label AnimationTexturePath = new Label(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0.2f, 0.2f, 0.1f, 0.1f),
text = "AnimationTextureFolder/Path",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
Button openFileButton = new Button(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0.4f, 0.2f, 0, 0.1f),
text = "Open File",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
openFileButton.LeftButtonPressed += () =>
{
DialogResult result = Dialog.FileOpen();
if (result.Path is null) return;
var temp = result.Path.Split('\\');
string textureName = temp[temp.Length - 2] + "/" + temp[temp.Length - 1];
textureName = textureName.Split('.')[0];
FileNameLabel.text = textureName;
AppLogic.LoadFile(result.Path);
SetAnimationSample();
};
Elements.Add(openFileButton);
Button AutoBuildButton = new Button(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0.6f, 0.1f, 0, 0.1f),
text = "AutoBuild",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
Button RunButton = new Button(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0.7f, 0.1f, 0, 0.1f),
text = "Run",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
RunButton.LeftButtonPressed += () =>
{
BuildAnimation();
};
Button SaveBtn = new Button(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0.8f, 0.1f, 0, 0.1f),
text = "Save",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
Button AddToMGCB = new Button(Manager)
{
rectangle = GetRelativeRectangle_SettingSizes(0.9f, 0.1f, 0, 0.1f),
text = "Add To MGCB",
scale = 0.1f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font",
textureName = "GUI/Button"
};
AddToMGCB.LeftButtonPressed += () =>
{
/*
add this to mgcb
#begin Textures/Animations/explosion_1.animation
/copy:Textures/Animations/explosion_1.animation
#begin GUI/checkboxs_off.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:GUI/checkboxs_off.png
*/
};
SaveBtn.LeftButtonPressed += () =>
{
Save();
};
#region LowerPanel
InputIsCycle = CreateInputAndCheckBoxPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.3f, 0.1f), 0.2f, "Зациклено?:", "");
TicksPerFrame = CreateInputAndTextPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.4f, 0.1f), 0.2f, "Тиков на кадр:", "5");
InputIdName = CreateInputAndTextPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.5f, 0.1f), 0.8f, "ID:", "run");
InputWidth = CreateInputAndTextPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.6f, 0.1f), 0.2f, "Колонн:", "1");
InputHeight = CreateInputAndTextPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.7f, 0.1f), 0.2f, "Рядов:", "1");
InputFramesCount = CreateInputAndTextPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.8f, 0.1f), 0.2f, "Кадров:", "1");
animationRow = CreateInputAndTextPair(GetRelativeRectangle_SettingSizes(0.0f, 0.3f, 0.9f, 0.1f), 0.2f, "Ряд анимации:", "1");
#endregion
}
TextBox InputWidth;
TextBox InputHeight;
TextBox InputFramesCount;
TextBox animationRow;
TextBox InputIdName;
TextBox TicksPerFrame;
CheckBox InputIsCycle;
/// <summary>
/// ratio = inputWidth/totalWidth
/// </summary>
/// <param name="area"></param>
/// <param name="ratio"></param>
/// <param name="textString"></param>
/// <param name="textBoxString"></param>
/// <returns></returns>
public TextBox CreateInputAndTextPair(Rectangle area, float ratio, string textString, string textBoxString)
{
int arWidth = area.Width;
area.Width = arWidth - (int)(arWidth * ratio) + (int)(arWidth * (ratio / 2));
Label lb = new Label(Manager)
{
rectangle = area,
text = textString,
scale = 0.2f,
fontColor = Color.Black,
mainColor = Color.Black,
fontName = "Fonts\\Font4",
textureName = "GUI/Button",
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left
};
area.X += (int)(arWidth * (1 - ratio));
area.Width = arWidth - (int)(arWidth * (1 - ratio));
TextBox tb = new TextBox(Manager)
{
rectangle = area,
text = textBoxString,
scale = 0.4f,
fontColor = Color.Black,
mainColor = Color.Gray,
fontName = "Fonts\\Font4",
textureName = "GUI/Button",
textAligment = MonogameLibrary.UI.Enums.TextAligment.Center
};
return tb;
}
public CheckBox CreateInputAndCheckBoxPair(Rectangle area, float ratio, string textString, string textBoxString)
{
int arWidth = area.Width;
area.Width = arWidth - (int)(arWidth * ratio) + (int)(arWidth * (ratio / 2));
Label lb = new Label(Manager)
{
rectangle = area,
text = textString,
scale = 0.2f,
fontColor = Color.Black,
mainColor = Color.Black,
fontName = "Fonts\\Font4",
textureName = "GUI/Button",
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left
};
area.X += (int)(arWidth * (1 - ratio));
area.Width = arWidth - (int)(arWidth * (1 - ratio));
CheckBox tb = new CheckBox(Manager)
{
rectangle = area,
text = textBoxString,
scale = 0.4f,
fontColor = Color.Black,
mainColor = Color.Gray,
fontName = "Fonts\\Font4",
textureName = "GUI/Button",
textAligment = MonogameLibrary.UI.Enums.TextAligment.Center
};
return tb;
}
Texture2D BlackTexture;
Texture2D LoadedSample;
Rectangle SampleRectangle;
Rectangle ExampleAnimation;
Rectangle AnimationSampleRectangle;
Rectangle AnimationExampleSampleRectangle;
public override void LoadContent()
{
BlackTexture = new Texture2D(AppManager.Instance.GraphicsDevice, 1, 1);
BlackTexture.SetData(new Color[] { Color.Black });
SampleRectangle = GetRelativeRectangle_SettingSizes(0.3f, 0.4f, 0.1f, 0.9f);
ExampleAnimation = GetRelativeRectangle_SettingSizes(0.7f, 0.3f, 0.1f, 0.9f);
base.LoadContent();
}
public override void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Begin(samplerState: SamplerState.PointClamp);
spriteBatch.Draw(BlackTexture, SampleRectangle, Color.White);
spriteBatch.Draw(BlackTexture, ExampleAnimation, Color.White);
if (LoadedSample != null)
{
spriteBatch.Draw(LoadedSample, AnimationSampleRectangle, Color.White);
spriteBatch.Draw(LoadedSample, AnimationExampleSampleRectangle, AppLogic.animationRectangle, Color.White);
}
spriteBatch.End();
base.Draw(spriteBatch);
}
float margin_left = 0.01f;
float margin_right = 0.01f;
float margin_top = 0.01f;
float margin_bottom = 0.01f;
public Rectangle GetRelativeRectangle_SettingSizes(float marginPercentFromLeft, float relativeXSize, float marginPercentFromTop, float relativeYSize, Rectangle? area = null)
=> GetRelativeRectangle(marginPercentFromLeft, 1 - marginPercentFromLeft - relativeXSize, marginPercentFromTop, 1 - marginPercentFromTop - relativeYSize, area);
public Rectangle GetRelativeRectangle(float marginPercentFromLeft, float marginPercentFromRight, float marginPercentFromTop, float marginPercentFromBottom, Rectangle? area = null)
{
int width;
int height;
if (area is null)
{
width = AppManager.Instance.CurentScreenResolution.X;
height = AppManager.Instance.CurentScreenResolution.Y;
}
else
{
width = area.Value.Width;
height = area.Value.Height;
}
float left = width * (marginPercentFromLeft + margin_left);
float right = width * (1 - marginPercentFromRight - margin_right);
float top = height * (marginPercentFromTop + margin_top);
float bottom = height * (1 - marginPercentFromBottom - margin_bottom);
return new Rectangle((int)left, (int)top, (int)(right - left), (int)(bottom - top));
}
public void SetAnimationSample()
{
Texture2D texture = AppLogic.fileTexture;
if (texture is null)
{
return;
}
LoadedSample = texture;
if (texture.Width / (float)texture.Height > SampleRectangle.Width / (float)SampleRectangle.Height)
{
//not full height
AnimationSampleRectangle = new Rectangle(SampleRectangle.X,
SampleRectangle.Y + (SampleRectangle.Height -
(int)(SampleRectangle.Width * (texture.Height / (float)texture.Width))
) / 2,
SampleRectangle.Width,
(int)(SampleRectangle.Width * (texture.Height / (float)texture.Width))
);
}
else
{
//TODO
AnimationSampleRectangle = new Rectangle(SampleRectangle.X
+ (SampleRectangle.Width -
(int)(SampleRectangle.Height * (texture.Width / (float)texture.Height))
) / 2
,
SampleRectangle.Y,
(int)(SampleRectangle.Height * (texture.Width / (float)texture.Height)),
SampleRectangle.Height
);
}
}
public void BuildAnimation()
{
Point point = new Point(13, 1);
if (!int.TryParse(InputWidth.text, out point.X))
point.X = 1;
if (point.X < 1)
point.X = 1;
if (!int.TryParse(InputHeight.text, out point.Y))
point.Y = 1;
if (point.Y < 1)
point.Y = 1;
AppLogic.BuildBaseRectangle(point.X, point.Y);
AppLogic.SetRow(int.Parse(animationRow.text));
AppLogic.SetFrmesCount(int.Parse(InputFramesCount.text));
AppLogic.SetAnimationId(InputIdName.text);
AppLogic.SetIsCycle(InputIsCycle.GetChecked);
AppLogic.SetTicksPerAllFrames(int.Parse(TicksPerFrame.text));
if (AppLogic.animationRectangle.Width / (float)AppLogic.animationRectangle.Height > ExampleAnimation.Width / (float)ExampleAnimation.Height)
{
//not full height
AnimationExampleSampleRectangle = new Rectangle(ExampleAnimation.X,
ExampleAnimation.Y + (ExampleAnimation.Height -
(int)(ExampleAnimation.Width * (AppLogic.animationRectangle.Height / (float)AppLogic.animationRectangle.Width))
) / 2,
ExampleAnimation.Width,
(int)(ExampleAnimation.Width * (AppLogic.animationRectangle.Height / (float)AppLogic.animationRectangle.Width))
);
}
else
{
//TODO
AnimationExampleSampleRectangle = new Rectangle(ExampleAnimation.X
+ (ExampleAnimation.Width -
(int)(ExampleAnimation.Height * (AppLogic.animationRectangle.Width / (float)AppLogic.animationRectangle.Height))
) / 2
,
ExampleAnimation.Y,
(int)(ExampleAnimation.Height * (AppLogic.animationRectangle.Width / (float)AppLogic.animationRectangle.Height)),
ExampleAnimation.Height
);
}
}
public override void Update(GameTime gameTime)
{
AppLogic.Update();
base.Update(gameTime);
}
public void Save()
{
AppLogic.SaveCurrentAnimation("");
}
}
static class AppLogic
{
public static Texture2D fileTexture;
public static Rectangle textureTotalRectangle;
public static Rectangle animationRectangle;
public static Point animjationStep;
public static int rows;
public static int columns;
public static bool buildDone = false;
public static string textureFilePath;
public static string textureEndName;
public static void LoadFile(string filePath)
{
fileTexture = Texture2D.FromFile(AppManager.Instance.GraphicsDevice, filePath);
textureTotalRectangle = new Rectangle(0, 0, fileTexture.Width, fileTexture.Height);
buildDone = false;
textureFilePath = filePath;
var temp = filePath.Split('\\');
textureEndName = /*temp[temp.Length - 2] + "/" +*/ temp[temp.Length - 1];
textureEndName = textureEndName.Split('.')[0];
}
public static void BuildBaseRectangle(int _columns, int _rows)
{
rows = _rows;
columns = _columns;
animationRectangle = new Rectangle(0, 0, textureTotalRectangle.Width / columns, textureTotalRectangle.Height / rows);
animjationStep = new Point(animationRectangle.Width, 0);
buildDone = true;
}
/// <summary>
/// rows from 0
/// </summary>
/// <param name="row"></param>
public static void SetRow(int row)
{
animationRectangle.Y = animationRectangle.Height * row;
}
public static int ticksPassed = 0;
public static void Update()
{
if (!buildDone) return;
ticksPassed++;
if (ticksPassed > 3)
{
ticksPassed = 0;
SetNextFrame();
}
}
static int curframe = 0;
static int curtick = 0;
private static void SetNextFrame()
{
curtick++;
if (curtick < frameTimes.First().Item2) return;
curtick = 0;
curframe++;
if (curframe >= frameCount)
{
curframe = 0;
}
//animationRectangle.Y += animjationStep.Y;
//if (animationRectangle.Right > textureTotalRectangle.Width) // ended row
//{
// animationRectangle.X = 0;
//}
//animationRectangle.Y = curframe * animjationStep.Y;
animationRectangle.X = curframe * animjationStep.X;
}
public static void SetFrmesCount(int _frameCount) => frameCount = _frameCount;
public static int frameCount;
public static void SetIsCycle(bool _isCycle) => isCycle = _isCycle;
public static bool isCycle;
public static void SetAnimationId(string _id) => id = _id;
public static string id;
public static List<Tuple<int, int>> frameTimes = new List<Tuple<int, int>>() { new Tuple<int, int>(0, 5) };
public static void SetTicksPerAllFrames(int ticks) => frameTimes = new List<Tuple<int, int>>() { new Tuple<int, int>(0, ticks) };
public static void SaveCurrentAnimation(string saveString)
{
DialogResult result = Dialog.FolderPicker();
if (result.Path is null)
{
return;
}
var temp = result.Path.Split("Animations")[1].Remove(0, 1);
//string textureName = temp[temp.Length - 2] + "/" + temp[temp.Length - 1];
//textureName = textureName.Split('.')[0];
//choose save folder (it will save for further animations)
id = id.ToLower();
AnimationContainer container = new AnimationContainer();
if (!Directory.Exists("../../../../ZoFo/Content/Textures/AnimationTextures/" + temp))
Directory.CreateDirectory("../../../../ZoFo/Content/Textures/AnimationTextures/" + temp);
if (!File.Exists("../../../../ZoFo/Content/Textures/AnimationTextures/" + temp + "/" + textureEndName + ".png"))
File.Copy(textureFilePath, "../../../../ZoFo/Content/Textures/AnimationTextures/" + temp + "/" + textureEndName + ".png");
container.Offset = new Vector2(0, animationRectangle.Y);
container.FramesCount = frameCount;
container.FrameTime = frameTimes;
animationRectangle.X = 0;
container.StartSpriteRectangle = animationRectangle;
container.TextureFrameInterval = 0;
container.IsCycle = isCycle;
container.Id = id;
container.TextureName = "Textures/AnimationTextures/" + temp + "/" + textureEndName;
string json = JsonConvert.SerializeObject(container);
StreamWriter writer = new StreamWriter(result.Path + "/" + id + ".animation");//"../../../../ZoFo/Content/Textures/Animations/" + id + ".animation");
writer.WriteLine(json);
writer.Close();
}
public static string selectOnlyPathFromContent(string path)
{
return path.Split("Content")[1];
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

View file

@ -0,0 +1,3 @@

using var game = new AnimatorFileCreatorAdvanced.Core.AppManager();
game.Run();

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="AnimatorFileCreatorAdvanced"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. -->
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>

View file

@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZoFo", "ZoFo\ZoFo.csproj",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonogameLibrary", "MonogameLibrary\MonogameLibrary.csproj", "{40880E68-4B3A-417B-A39B-95DE46AA2E7E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationsFileCreator", "AnimationsFileCreator\AnimationsFileCreator.csproj", "{7B143D5C-5198-4ADE-9291-ECC924B78633}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnimationsFileCreator", "AnimationsFileCreator\AnimationsFileCreator.csproj", "{7B143D5C-5198-4ADE-9291-ECC924B78633}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimatorFileCreatorAdvanced", "AnimatorFileCreatorAdvanced\AnimatorFileCreatorAdvanced.csproj", "{AAEC2150-3BBF-4B59-A22F-47B30CA6B34B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -27,6 +29,10 @@ Global
{7B143D5C-5198-4ADE-9291-ECC924B78633}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B143D5C-5198-4ADE-9291-ECC924B78633}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B143D5C-5198-4ADE-9291-ECC924B78633}.Release|Any CPU.Build.0 = Release|Any CPU
{AAEC2150-3BBF-4B59-A22F-47B30CA6B34B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAEC2150-3BBF-4B59-A22F-47B30CA6B34B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAEC2150-3BBF-4B59-A22F-47B30CA6B34B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAEC2150-3BBF-4B59-A22F-47B30CA6B34B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -251,6 +251,12 @@
#begin Textures/Animations/player_top_mining.animation
/copy:Textures/Animations/player_top_mining.animation
#begin Textures/Animations/Player/player_idle.animation
/copy:Textures/Animations/Player/player_idle.animation
#begin Textures/Animations/Player/player_running.animation
/copy:Textures/Animations/Player/player_running.animation
#begin Textures/Animations/running_top.animation
/copy:Textures/Animations/running_top.animation
@ -368,6 +374,42 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_running.png
#begin Textures/AnimationTextures/Player/Idle.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Idle.png
#begin Textures/AnimationTextures/Player/Recharge.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Recharge.png
#begin Textures/AnimationTextures/Player/Run.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Run.png
#begin Textures/AnimationTextures/unicorn.png
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -0,0 +1 @@
{"id":"player_idle","textureName":"Textures/AnimationTextures/Player/Idle","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":7,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"player_running","textureName":"Textures/AnimationTextures/Player/Run","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":0,"framesCount":8,"isCycle":true,"offset":"0, 0"}

View file

@ -14,7 +14,7 @@ public class AssetManager
{
Animations = [ "player_look_down", "player_run_up", "player_run_down", "player_run_right",
"player_run_left", "player_run_right_up", "player_run_left_up", "player_run_right_down",
"player_run_left_down" ],
IdleAnimation = "player_look_down"
"player_run_left_down","player_running","player_idle" ],
IdleAnimation = "player_idle"
};
}

View file

@ -48,11 +48,11 @@ public class Player : LivingEntity
{
lootData = new LootData();
lootData.loots = new Dictionary<string, int>();
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 30, 30);
collisionComponent.stopRectangle = new Rectangle(10, 15, 10, 15);
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 60, 60);
collisionComponent.stopRectangle = new Rectangle(25, 45, 10, 15);
speed = 7;
StartAnimation("player_look_down");
StartAnimation("player_idle");
}
@ -80,24 +80,18 @@ public class Player : LivingEntity
if (idName != "player_run_down")
StartAnimation("player_run_down");
break;
case ScopeState.Right:
case ScopeState.Left:
if (idName != "player_run_right")
StartAnimation("player_run_right");
break;
case ScopeState.TopRight:
case ScopeState.TopLeft:
if (idName != "player_run_right_up")
StartAnimation("player_run_right_up");
break;
case ScopeState.DownRight:
case ScopeState.DownLeft:
if (idName != "player_run_right_down")
StartAnimation("player_run_right_down");
case ScopeState.TopRight:
case ScopeState.TopLeft:
case ScopeState.Right:
case ScopeState.Left:
if (idName != "player_running")
StartAnimation("player_running");
break;
case ScopeState.Idle:
if (idName != "player_look_down")
StartAnimation("player_look_down");
if (idName != "player_idle")
StartAnimation("player_idle");
break;
}
if (AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation) != ScopeState.Idle)

View file

@ -19,7 +19,8 @@ namespace ZoFo.GameCore.Graphics
{
try
{
if (!fileName.EndsWith(".animation")) continue;
if (!fileName.EndsWith(".animation"))
continue;
reader = new StreamReader(fileName);
string json = reader.ReadToEnd();
AnimationContainer animation = JsonConvert.DeserializeObject<AnimationContainer>(json);

View file

@ -12,10 +12,13 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="Content\sounds\Zombie\**" />
<Compile Remove="Content\Textures\Animations\PlayerAFK\**" />
<Compile Remove="GameCore\GameObjects\BaseClasses\**" />
<EmbeddedResource Remove="Content\sounds\Zombie\**" />
<EmbeddedResource Remove="Content\Textures\Animations\PlayerAFK\**" />
<EmbeddedResource Remove="GameCore\GameObjects\BaseClasses\**" />
<None Remove="Content\sounds\Zombie\**" />
<None Remove="Content\Textures\Animations\PlayerAFK\**" />
<None Remove="GameCore\GameObjects\BaseClasses\**" />
</ItemGroup>
<ItemGroup>
@ -37,7 +40,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Content\sounds\Zombie\" />
<Folder Include="Content\Textures\Animations\PlayerAFK\" />
<Folder Include="Content\Textures\GUI\" />
</ItemGroup>
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">