tu
This commit is contained in:
commit
fc969da956
16 changed files with 268 additions and 24 deletions
|
@ -13,3 +13,22 @@
|
|||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin Font/Font.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font/Font.spritefont
|
||||
|
||||
#begin Texture/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:Texture/GUI/MenuBackground.jpg
|
||||
|
||||
|
|
BIN
ZoFo/Content/Font/Debrosee-ALPnL.ttf
Normal file
BIN
ZoFo/Content/Font/Debrosee-ALPnL.ttf
Normal file
Binary file not shown.
60
ZoFo/Content/Font/Font.spritefont
Normal file
60
ZoFo/Content/Font/Font.spritefont
Normal 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>12</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> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
BIN
ZoFo/Content/Texture/GUI/MenuBackground.jpg
Normal file
BIN
ZoFo/Content/Texture/GUI/MenuBackground.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 592 KiB |
|
@ -4,6 +4,10 @@ using System.Text.Json;
|
|||
using ZoFo.GameCore.GameManagers.NetworkManager;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
|
||||
namespace ZoFo.GameCore
|
||||
{
|
||||
public class Client
|
||||
|
@ -18,7 +22,7 @@ namespace ZoFo.GameCore
|
|||
public void OnDataSend(string data)
|
||||
{
|
||||
List<IUpdateData> updateDatas = JsonSerializer.Deserialize<List<IUpdateData>>(data);
|
||||
// Тут будет switch
|
||||
// <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> switch
|
||||
}
|
||||
|
||||
public void GameEndedUnexpectedly(){ }
|
||||
|
@ -26,5 +30,13 @@ namespace ZoFo.GameCore
|
|||
public void JoinRoom(){ }
|
||||
|
||||
public void JoinYourself(){ }
|
||||
|
||||
internal void Update(GameTime gameTime)
|
||||
{
|
||||
}
|
||||
|
||||
internal void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics;
|
|||
using Microsoft.Xna.Framework.Input;
|
||||
using MonogameLibrary.UI.Base;
|
||||
using MonogameLibrary.UI.Elements;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
|
||||
namespace ZoFo.GameCore.GUI;
|
||||
|
||||
|
@ -29,13 +30,13 @@ public abstract class AbstractGUI
|
|||
private GraphicsDevice graphicsDevice;
|
||||
public virtual void Initialize()
|
||||
{
|
||||
// Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||
CreateUI();
|
||||
}
|
||||
|
||||
public virtual void LoadContent()
|
||||
{
|
||||
|
||||
Manager.LoadContent(AppManager.Instance.Content, "Font");
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime gameTime)
|
||||
|
@ -47,4 +48,9 @@ public abstract class AbstractGUI
|
|||
{
|
||||
Manager.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
public virtual void ResolutioChenges()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
6
ZoFo/GameCore/GUI/DebugHUD.cs
Normal file
6
ZoFo/GameCore/GUI/DebugHUD.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace ZoFo.GameCore.GUI;
|
||||
|
||||
public class DebugHUD
|
||||
{
|
||||
|
||||
}
|
|
@ -9,15 +9,21 @@ using Microsoft.Xna.Framework.Graphics;
|
|||
using Microsoft.Xna.Framework.Input;
|
||||
using MonogameLibrary.UI.Base;
|
||||
using MonogameLibrary.UI.Elements;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
|
||||
namespace ZoFo.GameCore.GUI;
|
||||
|
||||
public class MainMenuGUI : AbstractGUI
|
||||
{
|
||||
DrawableUIElement menuBackground;
|
||||
protected override void CreateUI()
|
||||
{
|
||||
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
|
||||
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), textureName = "Texture\\GUI\\MenuBackground" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
|
|
|
@ -8,6 +8,7 @@ using DangerousD.GameCore.Graphics;
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using ZoFo.GameCore.GameManagers.ItemManager;
|
||||
using ZoFo.GameCore.GUI;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
|
||||
|
@ -23,13 +24,15 @@ namespace ZoFo.GameCore.GameManagers
|
|||
public static AppManager Instance { get; private set; }
|
||||
public GameState gamestate;
|
||||
public AbstractGUI currentGUI;
|
||||
//public Client client;
|
||||
//public Server server;
|
||||
public Point CurentScreenResolution = new Point(1920, 1080);
|
||||
public Client client;
|
||||
public Server server;
|
||||
|
||||
|
||||
#region Managers
|
||||
|
||||
public InputManager InputManager;
|
||||
public ItemManager.ItemManager ItemManager;
|
||||
|
||||
public AnimationBuilder animationBuilder{get;set; }
|
||||
|
||||
|
@ -44,13 +47,13 @@ namespace ZoFo.GameCore.GameManagers
|
|||
Instance = this;
|
||||
InputManager = new InputManager();
|
||||
|
||||
|
||||
|
||||
currentGUI = new MainMenuGUI();
|
||||
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
currentGUI.Initialize();
|
||||
|
||||
|
||||
|
||||
|
@ -73,17 +76,17 @@ namespace ZoFo.GameCore.GameManagers
|
|||
Exit();
|
||||
|
||||
InputManager.Update();
|
||||
//currentGUI.Update();
|
||||
currentGUI.Update(gameTime);
|
||||
switch (gamestate)
|
||||
{
|
||||
case GameState.NotPlaying:
|
||||
break;
|
||||
case GameState.HostPlaying:
|
||||
//server.Update(GameTime gameTime);
|
||||
//client.Update(GameTime gameTime);
|
||||
server.Update(gameTime);
|
||||
client.Update(gameTime);
|
||||
break;
|
||||
case GameState.ClientPlaying:
|
||||
//server.Update(GameTime gameTime);
|
||||
server.Update(gameTime);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -97,12 +100,12 @@ namespace ZoFo.GameCore.GameManagers
|
|||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||
|
||||
|
||||
//currentGUI.Draw(_spriteBatch);
|
||||
currentGUI.Draw(_spriteBatch);
|
||||
switch (gamestate)
|
||||
{
|
||||
case GameState.ClientPlaying:
|
||||
case GameState.HostPlaying:
|
||||
//client.Draw(_spriteBatch);
|
||||
client.Draw(_spriteBatch);
|
||||
break;
|
||||
case GameState.NotPlaying:
|
||||
default:
|
||||
|
@ -118,8 +121,6 @@ namespace ZoFo.GameCore.GameManagers
|
|||
public void SetGUI(AbstractGUI gui)
|
||||
{
|
||||
currentGUI = gui;
|
||||
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void GameEnded(Dictionary<string, int> lootIGot)
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||
{
|
||||
public class CollisionComponent
|
||||
{
|
||||
//остановлен ли перс
|
||||
bool doesStop;
|
||||
Rectangle stopRectangle;
|
||||
|
||||
// triggers for rectangle
|
||||
bool isTrigger;
|
||||
Rectangle triggerRectangle;
|
||||
|
||||
//delegate
|
||||
public delegate void EventHandler(object sender, EventArgs e);
|
||||
|
||||
|
||||
//events
|
||||
public event EventHandler<CollisionComponent> OnTriggerEnter;
|
||||
public event EventHandler<CollisionComponent> OnTriggerZone;
|
||||
public event EventHandler<CollisionComponent> OnTriggerExit;
|
||||
|
||||
// methods-event
|
||||
public void TriggerEnter(object component, ///<Player player>,
|
||||
EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
public void TriggerZone(object component,///<Player player>,
|
||||
EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
public void TriggerExit(object component,///<Player player>,
|
||||
EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||
{
|
||||
public class CollisionManager
|
||||
{
|
||||
public List<CollisionComponent> CollisionComponent;
|
||||
public List<CollisionComponent> TriggerComponent;
|
||||
|
||||
public void UpdatePositions()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void GetObjectInArea(Rectangle area)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Register(Rectangle rectangle)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -15,10 +15,23 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
|
|||
Texture2D itemTexture;
|
||||
bool isCraftable;
|
||||
Dictionary<string, int> resourcesNeededToCraft;
|
||||
public ItemInfo (string tag)
|
||||
{
|
||||
this.tag = tag;
|
||||
}
|
||||
public ItemInfo(string tag,string textureName,bool isCraftable, Dictionary<string, int> resourcesNeededToCraft)
|
||||
{
|
||||
this.tag = tag;
|
||||
this.textureName = textureName;
|
||||
|
||||
this.isCraftable = isCraftable;
|
||||
this.resourcesNeededToCraft = resourcesNeededToCraft;
|
||||
}
|
||||
//методы
|
||||
private void LoadTexture()
|
||||
public void LoadTexture()
|
||||
{
|
||||
//я что-то хз как это
|
||||
itemTexture=AppManager.Instance.Content.Load<Texture2D>(textureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace ZoFo.GameCore.GameManagers.ItemManager
|
||||
{
|
||||
class ItemManager
|
||||
public class ItemManager
|
||||
{
|
||||
//поля
|
||||
Dictionary<string, ItemInfo> tagItemPairs;
|
||||
|
@ -15,9 +15,18 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
|
|||
{
|
||||
return tagItemPairs.GetValueOrDefault(tag);
|
||||
}
|
||||
void LoadItemTexture()
|
||||
void LoadItemTextures()
|
||||
{
|
||||
|
||||
foreach (var item in tagItemPairs)
|
||||
{
|
||||
item.Value.LoadTexture();
|
||||
}
|
||||
}
|
||||
void Initialize()
|
||||
{
|
||||
tagItemPairs.Add("wood", new ItemInfo("wood","wood",false,null));
|
||||
tagItemPairs.Add("rock", new ItemInfo("rock", "rock", false, null));
|
||||
tagItemPairs.Add("steel", new ItemInfo("steel", "steel", false, null));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
24
ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs
Normal file
24
ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.ItemManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс хранит информацю о количестве ресурсов у игрока
|
||||
/// </summary>
|
||||
internal class PlayerData
|
||||
{
|
||||
Dictionary<string, int> items;
|
||||
/// <summary>
|
||||
/// Принимает тэг и крафтит этот объект
|
||||
/// </summary>
|
||||
/// <param name="itemTag"></param>
|
||||
public void CraftItem(string itemTag)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -36,6 +37,8 @@ namespace ZoFo.GameCore
|
|||
networkManager.AddData(gameEnded);
|
||||
}
|
||||
|
||||
|
||||
internal void Update(GameTime gameTime)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\MonogameLibrary\MonogameLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Content\Texture\GUI\" />
|
||||
</ItemGroup>
|
||||
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
|
||||
<Message Text="Restoring dotnet tools" Importance="High" />
|
||||
<Exec Command="dotnet tool restore" />
|
||||
|
|
Loading…
Add table
Reference in a new issue