diff --git a/AnimatorFileCreatorAdvanced/.config/dotnet-tools.json b/AnimatorFileCreatorAdvanced/.config/dotnet-tools.json new file mode 100644 index 0000000..efabe22 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/.config/dotnet-tools.json @@ -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" + ] + } + } +} \ No newline at end of file diff --git a/AnimatorFileCreatorAdvanced/AnimatorFileCreatorAdvanced.csproj b/AnimatorFileCreatorAdvanced/AnimatorFileCreatorAdvanced.csproj new file mode 100644 index 0000000..d5b6520 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/AnimatorFileCreatorAdvanced.csproj @@ -0,0 +1,33 @@ + + + WinExe + net8.0 + Major + false + false + + + app.manifest + Icon.ico + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnimatorFileCreatorAdvanced/Content/Content.mgcb b/AnimatorFileCreatorAdvanced/Content/Content.mgcb new file mode 100644 index 0000000..6a094ba --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Content/Content.mgcb @@ -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 + diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/CarltineRegular-K7z5l.ttf b/AnimatorFileCreatorAdvanced/Content/Fonts/CarltineRegular-K7z5l.ttf new file mode 100644 index 0000000..1496983 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/Fonts/CarltineRegular-K7z5l.ttf differ diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/Debrosee-ALPnL.ttf b/AnimatorFileCreatorAdvanced/Content/Fonts/Debrosee-ALPnL.ttf new file mode 100644 index 0000000..311dd61 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/Fonts/Debrosee-ALPnL.ttf differ diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/Font.spritefont b/AnimatorFileCreatorAdvanced/Content/Fonts/Font.spritefont new file mode 100644 index 0000000..754d1ee --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Content/Fonts/Font.spritefont @@ -0,0 +1,60 @@ + + + + + + + Debrosee-ALPnL.ttf + + + 100 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/Font2.spritefont b/AnimatorFileCreatorAdvanced/Content/Fonts/Font2.spritefont new file mode 100644 index 0000000..3aaf8e7 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Content/Fonts/Font2.spritefont @@ -0,0 +1,60 @@ + + + + + + + CarltineRegular-K7z5l.ttf + + + 15 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/Font3.spritefont b/AnimatorFileCreatorAdvanced/Content/Fonts/Font3.spritefont new file mode 100644 index 0000000..b82ba24 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Content/Fonts/Font3.spritefont @@ -0,0 +1,60 @@ + + + + + + + MouldyCheeseRegular-WyMWG.ttf + + + 50 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/Font4.spritefont b/AnimatorFileCreatorAdvanced/Content/Fonts/Font4.spritefont new file mode 100644 index 0000000..e56b217 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Content/Fonts/Font4.spritefont @@ -0,0 +1,64 @@ + + + + + + + Troubleside-lgjxX.ttf + + + 50 + + + 0 + + + true + + + + + + + + + + + 32 + 127 + + + А + ј + + + + diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/MouldyCheeseRegular-WyMWG.ttf b/AnimatorFileCreatorAdvanced/Content/Fonts/MouldyCheeseRegular-WyMWG.ttf new file mode 100644 index 0000000..9c36cd0 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/Fonts/MouldyCheeseRegular-WyMWG.ttf differ diff --git a/AnimatorFileCreatorAdvanced/Content/Fonts/Troubleside-lgjxX.ttf b/AnimatorFileCreatorAdvanced/Content/Fonts/Troubleside-lgjxX.ttf new file mode 100644 index 0000000..385b658 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/Fonts/Troubleside-lgjxX.ttf differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/Button.png b/AnimatorFileCreatorAdvanced/Content/GUI/Button.png new file mode 100644 index 0000000..8ea9806 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/Button.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/Button2.png b/AnimatorFileCreatorAdvanced/Content/GUI/Button2.png new file mode 100644 index 0000000..c8ccc30 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/Button2.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/ButtonI.png b/AnimatorFileCreatorAdvanced/Content/GUI/ButtonI.png new file mode 100644 index 0000000..fab43a9 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/ButtonI.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/MenuBackground.jpg b/AnimatorFileCreatorAdvanced/Content/GUI/MenuBackground.jpg new file mode 100644 index 0000000..79b0abe Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/MenuBackground.jpg differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/Switch_backgrownd.png b/AnimatorFileCreatorAdvanced/Content/GUI/Switch_backgrownd.png new file mode 100644 index 0000000..bd9e1d8 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/Switch_backgrownd.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/back.png b/AnimatorFileCreatorAdvanced/Content/GUI/back.png new file mode 100644 index 0000000..86bef42 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/back.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/base.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/base.png new file mode 100644 index 0000000..49a5fb7 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/base.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/endGame.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/endGame.png new file mode 100644 index 0000000..04c9091 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/endGame.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/join.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/join.png new file mode 100644 index 0000000..c0bb204 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/join.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/mainMenu.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/mainMenu.png new file mode 100644 index 0000000..7f7665c Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/mainMenu.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/options.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/options.png new file mode 100644 index 0000000..ef917ce Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/options.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/selectMode.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/selectMode.png new file mode 100644 index 0000000..25bc33b Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/selectMode.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/background/waiting.png b/AnimatorFileCreatorAdvanced/Content/GUI/background/waiting.png new file mode 100644 index 0000000..709fb0b Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/background/waiting.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_off-on.png b/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_off-on.png new file mode 100644 index 0000000..682b82a Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_off-on.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_off.png b/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_off.png new file mode 100644 index 0000000..f6533ba Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_off.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_on.png b/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_on.png new file mode 100644 index 0000000..693b0cc Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/checkboxs_on.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/mouse.png b/AnimatorFileCreatorAdvanced/Content/GUI/mouse.png new file mode 100644 index 0000000..23146e6 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/mouse.png differ diff --git a/AnimatorFileCreatorAdvanced/Content/GUI/switch.png b/AnimatorFileCreatorAdvanced/Content/GUI/switch.png new file mode 100644 index 0000000..a296c61 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Content/GUI/switch.png differ diff --git a/AnimatorFileCreatorAdvanced/Core/AppManager.cs b/AnimatorFileCreatorAdvanced/Core/AppManager.cs new file mode 100644 index 0000000..482bc52 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Core/AppManager.cs @@ -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.Gray); + + // 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; + } + } +} diff --git a/AnimatorFileCreatorAdvanced/Core/GUI/AbstractGUI.cs b/AnimatorFileCreatorAdvanced/Core/GUI/AbstractGUI.cs new file mode 100644 index 0000000..279d638 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Core/GUI/AbstractGUI.cs @@ -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 Elements = new(); + private List 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("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(); + } + } +} diff --git a/AnimatorFileCreatorAdvanced/Core/GUI/CreatingAnimationGUI.cs b/AnimatorFileCreatorAdvanced/Core/GUI/CreatingAnimationGUI.cs new file mode 100644 index 0000000..376c7b2 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Core/GUI/CreatingAnimationGUI.cs @@ -0,0 +1,250 @@ +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; + +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(); + 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" + }; + Button Save = 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 + + */ + }; + } + + Texture2D BlackTexture; + Texture2D LoadedSample; + Rectangle SampleRectangle; + Rectangle ExampleAnimation; + + Rectangle AnimationSampleRectangle; + public override void LoadContent() + { + BlackTexture = new Texture2D(AppManager.Instance.GraphicsDevice, 1, 1); + BlackTexture.SetData(new Color[] { Color.Black }); + SampleRectangle = GetRelativeRectangle(0.01f, 0.31f, 0.1f, 0.01f); + ExampleAnimation = GetRelativeRectangle(0.7f, 0.01f, 0.1f, 0.01f); + + base.LoadContent(); + } + public override void Draw(SpriteBatch spriteBatch) + { + spriteBatch.Begin(); + spriteBatch.Draw(BlackTexture, SampleRectangle, Color.White); + spriteBatch.Draw(BlackTexture, ExampleAnimation, Color.White); + + if (LoadedSample != null) + { + spriteBatch.Draw(LoadedSample, AnimationSampleRectangle, 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.Y + (SampleRectangle.Height - + (int)(SampleRectangle.Width * (texture.Height / (float)texture.Width)) + ) / 2, + SampleRectangle.Width, + (int)(SampleRectangle.Width * (texture.Height / (float)texture.Width)) + ); + } + } + } + static class AppLogic + { + public static Texture2D fileTexture; + public static void LoadFile(string filePath) + { + fileTexture = Texture2D.FromFile(AppManager.Instance.GraphicsDevice, filePath); + } + } +} diff --git a/AnimatorFileCreatorAdvanced/Icon.bmp b/AnimatorFileCreatorAdvanced/Icon.bmp new file mode 100644 index 0000000..2b48165 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Icon.bmp differ diff --git a/AnimatorFileCreatorAdvanced/Icon.ico b/AnimatorFileCreatorAdvanced/Icon.ico new file mode 100644 index 0000000..7d9dec1 Binary files /dev/null and b/AnimatorFileCreatorAdvanced/Icon.ico differ diff --git a/AnimatorFileCreatorAdvanced/Program.cs b/AnimatorFileCreatorAdvanced/Program.cs new file mode 100644 index 0000000..247284c --- /dev/null +++ b/AnimatorFileCreatorAdvanced/Program.cs @@ -0,0 +1,3 @@ + +using var game = new AnimatorFileCreatorAdvanced.Core.AppManager(); +game.Run(); diff --git a/AnimatorFileCreatorAdvanced/app.manifest b/AnimatorFileCreatorAdvanced/app.manifest new file mode 100644 index 0000000..1e40ba6 --- /dev/null +++ b/AnimatorFileCreatorAdvanced/app.manifest @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + permonitorv2,permonitor + + + + diff --git a/ZoFo.sln b/ZoFo.sln index 3ea9985..4310366 100644 --- a/ZoFo.sln +++ b/ZoFo.sln @@ -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