Merge branch 'Development' into UpdateSettings
|
@ -89,9 +89,9 @@ namespace MonogameLibrary.UI.Elements
|
|||
if (hoverState == HoverState.None)
|
||||
{
|
||||
if (isSelected == IsSelected.Selected)
|
||||
_spriteBatch.Draw(texture, rectangle, new Color(220, 220, 220));
|
||||
_spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211));
|
||||
else
|
||||
_spriteBatch.Draw(texture, rectangle, new Color(245, 245, 245));
|
||||
_spriteBatch.Draw(texture, rectangle, Color.White);
|
||||
}
|
||||
else if (hoverState == HoverState.Hovering)
|
||||
_spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211));
|
||||
|
|
|
@ -83,6 +83,56 @@
|
|||
/build:sounds/Zombi stoit.wav
|
||||
|
||||
#begin Textures/GUI/checkboxs_off.png
|
||||
|
||||
#begin Textures/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:Textures/GUI/background/base.png
|
||||
|
||||
#begin Textures/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:Textures/GUI/background/join.png
|
||||
|
||||
#begin Textures/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:Textures/GUI/background/selectMode.png
|
||||
|
||||
#begin Textures/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:Textures/GUI/background/waiting.png
|
||||
|
||||
#begin Textures/GUI/checkboxs_off-on.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
|
|
BIN
ZoFo/Content/Textures/Background/TilesetFloor.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
ZoFo/Content/Textures/GUI/background/base.png
Normal file
After Width: | Height: | Size: 648 KiB |
BIN
ZoFo/Content/Textures/GUI/background/join.png
Normal file
After Width: | Height: | Size: 320 KiB |
BIN
ZoFo/Content/Textures/GUI/background/selectMode.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
ZoFo/Content/Textures/GUI/background/waiting.png
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
ZoFo/Content/Textures/GUI/feature/i (1).webp
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
ZoFo/Content/Textures/GUI/feature/i (2).webp
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
ZoFo/Content/Textures/GUI/feature/i.webp
Normal file
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
|
@ -7,12 +7,16 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameObjects;
|
||||
using ZoFo.GameCore.GameObjects.MapObjects;
|
||||
|
||||
namespace ZoFo.GameCore
|
||||
{
|
||||
public class Client
|
||||
{
|
||||
ClientNetworkManager networkManager;
|
||||
|
||||
public bool IsConnected { get { return networkManager.IsConnected; } }
|
||||
public Client()
|
||||
{
|
||||
networkManager = new ClientNetworkManager();
|
||||
|
@ -20,23 +24,32 @@ namespace ZoFo.GameCore
|
|||
}
|
||||
|
||||
public void OnDataSend(string data)
|
||||
{
|
||||
{
|
||||
List<IUpdateData> updateDatas = JsonSerializer.Deserialize<List<IUpdateData>>(data);
|
||||
// тут будет switch
|
||||
foreach (var item in updateDatas)
|
||||
{
|
||||
/* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
|
||||
{
|
||||
case "Tile":
|
||||
MapObject map = new MapObject();
|
||||
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void GameEndedUnexpectedly(){ }
|
||||
|
||||
public void JoinRoom(){ }
|
||||
|
||||
public void JoinYourself(){ }
|
||||
|
||||
public void GameEndedUnexpectedly() { }
|
||||
public void JoinRoom(string ip)
|
||||
{
|
||||
networkManager.JoinRoom(ip);
|
||||
}
|
||||
public void JoinYourself() { networkManager.JoinYourself(); }
|
||||
internal void Update(GameTime gameTime)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
internal void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
|
@ -20,15 +21,15 @@ public class MainMenuGUI : AbstractGUI
|
|||
{
|
||||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\MenuBackground" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
|
||||
|
||||
Button playButton = new Button(Manager)
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font" });
|
||||
|
||||
|
||||
Button playButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + height / 20 + height / 40, (int)(width / 5), (int)(height / 20)),
|
||||
text = "Play",
|
||||
|
@ -37,12 +38,12 @@ public class MainMenuGUI : AbstractGUI
|
|||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
playButton.LeftButtonPressed += () =>
|
||||
playButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
||||
AppManager.Instance.SetGUI(new SelectModeMenu());
|
||||
};
|
||||
Elements.Add(playButton);
|
||||
Button optionButton = new Button(Manager)
|
||||
Button optionButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 2, (int)(width / 5), (int)(height / 20)),
|
||||
text = "Options",
|
||||
|
@ -51,12 +52,12 @@ public class MainMenuGUI : AbstractGUI
|
|||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new OptionsGUI());
|
||||
};
|
||||
Elements.Add(optionButton);
|
||||
Button exitButton = new Button(Manager)
|
||||
Button exitButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 3, (int)(width / 5), (int)(height / 20)),
|
||||
text = "Exit",
|
||||
|
@ -65,15 +66,14 @@ public class MainMenuGUI : AbstractGUI
|
|||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
exitButton.LeftButtonPressed += () =>
|
||||
exitButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.Exit();
|
||||
};
|
||||
Elements.Add(exitButton);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
base.Update(gameTime);
|
||||
|
|
|
@ -9,19 +9,85 @@ 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 SelectModeMenu : AbstractGUI
|
||||
{
|
||||
private 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), mainColor = Color.White, textureName = "Textures\\GUI\\background\\selectMode" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 6, (int)(width / 4), (int)(height / 20)), text = "Select mode", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
|
||||
Button singleButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
|
||||
text = "singleplayer",
|
||||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
singleButton.LeftButtonPressed += () =>
|
||||
{
|
||||
// single
|
||||
Server server = new Server(); //Server Logic SinglePlayer
|
||||
Client client = new Client();
|
||||
server.CreateRoom(1);
|
||||
client.JoinYourself();
|
||||
AppManager.Instance.SetServer(server);
|
||||
AppManager.Instance.SetClient(client);
|
||||
AppManager.Instance.ChangeState(GameState.HostPlaying);
|
||||
|
||||
string key = client.IsConnected.ToString();
|
||||
AppManager.Instance.debugHud.Set(key,"SinglePlayer");
|
||||
// ваш код здесь
|
||||
};
|
||||
Elements.Add(singleButton);
|
||||
Button optionButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 2 + width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
|
||||
text = "multiplayer",
|
||||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
||||
// multi
|
||||
Server server = new Server(); //Server Logic MultiPlayer
|
||||
Client client = new Client();
|
||||
server.CreateRoom(5);
|
||||
client.JoinRoom("127.0.0.1"); //указать айпишник
|
||||
AppManager.Instance.SetServer(server);
|
||||
AppManager.Instance.SetClient(client);
|
||||
string key = client.IsConnected.ToString();
|
||||
AppManager.Instance.debugHud.Set(key, "MultiPlayer");
|
||||
// ваш код здесь
|
||||
};
|
||||
Elements.Add(optionButton);
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||
};
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
}
|
|
@ -9,19 +9,94 @@ 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 SelectingServerGUI : AbstractGUI
|
||||
{
|
||||
private 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), mainColor = Color.White, textureName = "Textures\\GUI\\background\\join" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
|
||||
TextBox ipBox = new TextBox(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 4 - (width / 4) / 2, height / 4, (int)(width / 4), (int)(height / 20)),
|
||||
text = "ip",
|
||||
scale = 0.2f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
ipBox.TextChanged += input => {
|
||||
if (input == "ip")
|
||||
{
|
||||
ipBox.text = ""; ipBox.fontColor = Color.White;
|
||||
}
|
||||
};
|
||||
ipBox.StopChanging += input => {
|
||||
if (input.Length == 0)
|
||||
{
|
||||
ipBox.fontColor = Color.White;
|
||||
ipBox.text = "ip";
|
||||
}
|
||||
};
|
||||
Elements.Add(ipBox);
|
||||
Button joinButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 4 + (width / 4) / 2, height / 4, (int)(width / 15), (int)(height / 20)),
|
||||
text = "Join",
|
||||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
joinButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
|
||||
// join
|
||||
|
||||
// ваш код здесь
|
||||
};
|
||||
Elements.Add(joinButton);
|
||||
Button hostButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 4 + (width / 4) / 2 + (width / 15), height / 4, (int)(width / 15), (int)(height / 20)),
|
||||
text = "Host",
|
||||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
hostButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(true));
|
||||
// host
|
||||
|
||||
// ваш код здесь
|
||||
};
|
||||
Elements.Add(hostButton);
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new SelectModeMenu());
|
||||
};
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
}
|
|
@ -9,19 +9,61 @@ 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 WaitingForPlayersGUI : AbstractGUI
|
||||
{
|
||||
private DrawableUIElement menuBackground;
|
||||
private bool isHost;
|
||||
|
||||
public WaitingForPlayersGUI(bool isHost)
|
||||
{
|
||||
this.isHost = isHost;
|
||||
}
|
||||
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), mainColor = Color.White, textureName = "Textures\\GUI\\background\\Waiting" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Waiting", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
|
||||
if (isHost)
|
||||
{
|
||||
Button startButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)),
|
||||
text = "Start",
|
||||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
};
|
||||
startButton.LeftButtonPressed += () =>
|
||||
{
|
||||
// start
|
||||
|
||||
// ваш код здесь
|
||||
};
|
||||
Elements.Add(startButton);
|
||||
}
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
||||
};
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
}
|
|
@ -20,9 +20,9 @@ namespace ZoFo.GameCore.GameManagers
|
|||
{
|
||||
private GraphicsDeviceManager _graphics;
|
||||
private SpriteBatch _spriteBatch;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static AppManager Instance { get; private set; }
|
||||
public GameState gamestate;
|
||||
public AbstractGUI currentGUI;
|
||||
|
@ -31,15 +31,15 @@ namespace ZoFo.GameCore.GameManagers
|
|||
public Client client;
|
||||
public Server server;
|
||||
|
||||
|
||||
|
||||
#region Managers
|
||||
|
||||
|
||||
public InputManager InputManager;
|
||||
public ItemManager.ItemManager ItemManager;
|
||||
public SettingsManager SettingsManager;
|
||||
public SoundManager SoundManager;
|
||||
|
||||
public AnimationBuilder animationBuilder{get;set; }
|
||||
public AnimationBuilder animationBuilder { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -47,9 +47,9 @@ namespace ZoFo.GameCore.GameManagers
|
|||
{
|
||||
_graphics = new GraphicsDeviceManager(this);
|
||||
SetResolution(CurentScreenResolution.X, CurentScreenResolution.Y);
|
||||
FulscrreenSwitch();
|
||||
|
||||
|
||||
// FulscrreenSwitch();
|
||||
|
||||
|
||||
Content.RootDirectory = "Content";
|
||||
IsMouseVisible = true;
|
||||
|
||||
|
@ -70,9 +70,7 @@ namespace ZoFo.GameCore.GameManagers
|
|||
protected override void Initialize()
|
||||
{
|
||||
currentGUI.Initialize();
|
||||
debugHud.Initialize();
|
||||
|
||||
|
||||
debugHud.Initialize();
|
||||
|
||||
|
||||
base.Initialize();
|
||||
|
@ -93,9 +91,9 @@ namespace ZoFo.GameCore.GameManagers
|
|||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
||||
Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||
Exit();
|
||||
|
||||
|
||||
debugHud.Set("key", "value");
|
||||
|
||||
|
||||
InputManager.Update();
|
||||
currentGUI.Update(gameTime);
|
||||
switch (gamestate)
|
||||
|
@ -120,15 +118,13 @@ namespace ZoFo.GameCore.GameManagers
|
|||
{
|
||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||
|
||||
|
||||
|
||||
currentGUI.Draw(_spriteBatch);
|
||||
debugHud.Draw(_spriteBatch);
|
||||
switch (gamestate)
|
||||
{
|
||||
case GameState.ClientPlaying:
|
||||
case GameState.HostPlaying:
|
||||
client.Draw(_spriteBatch);
|
||||
client.Draw(_spriteBatch);
|
||||
break;
|
||||
case GameState.NotPlaying:
|
||||
default:
|
||||
|
@ -143,7 +139,7 @@ namespace ZoFo.GameCore.GameManagers
|
|||
}
|
||||
public void SetGUI(AbstractGUI gui)
|
||||
{
|
||||
currentGUI = gui;
|
||||
currentGUI = gui;
|
||||
currentGUI.Initialize();
|
||||
currentGUI.LoadContent();
|
||||
|
||||
|
@ -165,5 +161,8 @@ namespace ZoFo.GameCore.GameManagers
|
|||
{
|
||||
_graphics.IsFullScreen = !_graphics.IsFullScreen;
|
||||
}
|
||||
|
||||
public void SetServer(Server server) { this.server = server; }
|
||||
public void SetClient(Client client) { this.client = client; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,63 +3,59 @@ using Microsoft.Xna.Framework.Input;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Formats.Tar;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers
|
||||
{
|
||||
public enum ScopeState { Up, Middle, Down }
|
||||
public enum ControlsState { Gamepad, Keyboard }
|
||||
public enum ScopeState { Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight }
|
||||
public class InputManager
|
||||
{
|
||||
public delegate void Delegat();
|
||||
public event Delegat MovEventJump;
|
||||
public event Delegat MovEventDown;
|
||||
public event Delegat ShootEvent;
|
||||
public event Delegat ShootEvent; // событие удара(когда нажат X, событие срабатывает)
|
||||
|
||||
public event Delegat OnInteract; // событие взаимодействия с collectable(например, лутом)
|
||||
//с помощью кнопки E.
|
||||
|
||||
public event Delegat TalkEvent;
|
||||
|
||||
Vector2 vectorMovementDirection;
|
||||
ScopeState scopeState; // Положение оружия. Up, Middle, Down.
|
||||
ControlsState controlsState;
|
||||
private bool _overrideControls = false;
|
||||
ScopeState currentScopeState; // Положение оружия. Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight.
|
||||
private bool _cheatsEnabled = false;
|
||||
public bool InvincibilityCheat { get; private set; } = false;
|
||||
public bool CollisionsCheat { get; private set; } = false;
|
||||
public bool InfiniteAmmoCheat { get; private set; } = false;
|
||||
|
||||
private bool isJumpDown; // Блокирует физическое нажатие прыжка и спуска
|
||||
private bool isShoot;
|
||||
private bool isInteract;
|
||||
|
||||
private KeyboardState lastKeyboardState;
|
||||
private GamePadState lastGamePadState;
|
||||
|
||||
|
||||
public Vector2 VectorMovementDirection { get => vectorMovementDirection; }
|
||||
public ScopeState ScopeState { get => scopeState; }
|
||||
public ScopeState ScopeState { get => currentScopeState; }
|
||||
public string currentControlsState;
|
||||
public ScopeState CurrentScopeState { get => currentScopeState; } // получить текущее состояние
|
||||
|
||||
public InputManager()
|
||||
{
|
||||
this.isJumpDown = false;
|
||||
this.isShoot = false;
|
||||
scopeState = ScopeState.Middle;
|
||||
controlsState = ControlsState.Keyboard;
|
||||
currentScopeState = ScopeState.Straight;
|
||||
vectorMovementDirection = new Vector2(0, 0);
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
if (_cheatsEnabled)
|
||||
{
|
||||
//AppManager.Instance.DebugHUD.Set("cheats", _cheatsEnabled.ToString());
|
||||
//AppManager.Instance.DebugHUD.Set("invincible", InvincibilityCheat.ToString());
|
||||
//AppManager.Instance.DebugHUD.Set("infinite ammo", InfiniteAmmoCheat.ToString()); //TODO
|
||||
AppManager.Instance.debugHud.Set("cheats", _cheatsEnabled.ToString());
|
||||
AppManager.Instance.debugHud.Set("invincible", InvincibilityCheat.ToString());
|
||||
AppManager.Instance.debugHud.Set("infinite ammo", InfiniteAmmoCheat.ToString()); //TODO
|
||||
}
|
||||
|
||||
#region Работа с GamePad
|
||||
if (_overrideControls ? controlsState == ControlsState.Gamepad : GamePad.GetState(0).IsConnected)
|
||||
{
|
||||
controlsState = ControlsState.Gamepad;
|
||||
|
||||
#region Обработка гейм-пада. Задает Vector2 vectorMovementDirection являющийся вектором отклонения левого стика.
|
||||
GamePadState gamePadState = GamePad.GetState(0);
|
||||
vectorMovementDirection = gamePadState.ThumbSticks.Left;
|
||||
|
@ -78,56 +74,57 @@ namespace ZoFo.GameCore.GameManagers
|
|||
}
|
||||
#endregion // Cheats
|
||||
|
||||
#region Обработка нажатия прыжка и спуска. Вызывает события MovEvent.
|
||||
if (vectorMovementDirection.Y < -0.2 && gamePadState.Buttons.A == ButtonState.Pressed && !isJumpDown)
|
||||
{
|
||||
isJumpDown = true;
|
||||
MovEventDown?.Invoke();
|
||||
Debug.WriteLine("Спуск");
|
||||
}
|
||||
else if (gamePadState.Buttons.A == ButtonState.Pressed && lastGamePadState.Buttons.A == ButtonState.Released)
|
||||
{
|
||||
MovEventJump?.Invoke();
|
||||
Debug.WriteLine("Прыжок");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Обработка положения оружия. Задает значение полю scopeState.
|
||||
if (vectorMovementDirection.Y >= 0.7)
|
||||
if (vectorMovementDirection.Y >= 0.6)
|
||||
{
|
||||
scopeState = ScopeState.Up;
|
||||
currentScopeState = ScopeState.Straight;
|
||||
}
|
||||
else if (vectorMovementDirection.Y <= -0.7 && !isJumpDown)
|
||||
else if(vectorMovementDirection.Y <= 0.6)
|
||||
{
|
||||
scopeState = ScopeState.Down;
|
||||
currentScopeState = ScopeState.Back;
|
||||
}
|
||||
else
|
||||
else if(vectorMovementDirection.X >= 0.6)
|
||||
{
|
||||
scopeState = ScopeState.Middle;
|
||||
currentScopeState = ScopeState.Right;
|
||||
}
|
||||
else if(vectorMovementDirection.X <= 0.6)
|
||||
{
|
||||
currentScopeState = ScopeState.Left;
|
||||
}
|
||||
else if(vectorMovementDirection.Y >= 0.6 && vectorMovementDirection.X >= 0.6)
|
||||
{
|
||||
currentScopeState = ScopeState.StraightRight;
|
||||
}
|
||||
else if(vectorMovementDirection.Y >= 0.6 && vectorMovementDirection.X <= 0.6)
|
||||
{
|
||||
currentScopeState = ScopeState.StraightLeft;
|
||||
}
|
||||
else if(vectorMovementDirection.Y <= 0.6 && vectorMovementDirection.X >= 0.6)
|
||||
{
|
||||
currentScopeState = ScopeState.BackRight;
|
||||
}
|
||||
else if(vectorMovementDirection.Y <= 0.6 && vectorMovementDirection.X <= 0.6)
|
||||
{
|
||||
currentScopeState = ScopeState.BackLeft;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
||||
if (gamePadState.Buttons.X == ButtonState.Pressed && !isJumpDown && !isShoot)
|
||||
if (gamePadState.Buttons.X == ButtonState.Pressed && !isShoot)
|
||||
{
|
||||
isShoot = true;
|
||||
ShootEvent?.Invoke();
|
||||
Debug.WriteLine("Выстрел");
|
||||
}
|
||||
else if (gamePadState.Buttons.X == ButtonState.Released && !isJumpDown)
|
||||
else if (gamePadState.Buttons.X == ButtonState.Released)
|
||||
{
|
||||
isShoot = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
lastGamePadState = gamePadState;
|
||||
}
|
||||
#endregion
|
||||
#region Работа с KeyBoard
|
||||
else
|
||||
{
|
||||
controlsState = ControlsState.Keyboard;
|
||||
|
||||
#region Состояние клавиатуры
|
||||
KeyboardState keyBoardState = Keyboard.GetState(); // Состояние клавиатуры
|
||||
#endregion
|
||||
|
@ -154,76 +151,73 @@ namespace ZoFo.GameCore.GameManagers
|
|||
}
|
||||
#endregion // Cheats
|
||||
|
||||
#region Обработка движения вправо-влево. Меняет у вектора vectorMovementDirection значение X на -1/0/1.
|
||||
if (keyBoardState.IsKeyDown(Keys.Left))
|
||||
#region Обработка состояния объекта. Задает значение полю scopeState.
|
||||
if (keyBoardState.IsKeyDown(Keys.Up) || keyBoardState.IsKeyDown(Keys.W))
|
||||
{
|
||||
vectorMovementDirection.X = -1;
|
||||
currentScopeState = ScopeState.Straight;
|
||||
}
|
||||
else if (keyBoardState.IsKeyDown(Keys.Right))
|
||||
else if (keyBoardState.IsKeyDown(Keys.Down) || keyBoardState.IsKeyDown(Keys.S))
|
||||
{
|
||||
vectorMovementDirection.X = 1;
|
||||
currentScopeState = ScopeState.Back;
|
||||
}
|
||||
else
|
||||
else if(keyBoardState.IsKeyDown(Keys.Left) || keyBoardState.IsKeyDown(Keys.A))
|
||||
{
|
||||
vectorMovementDirection.X = 0;
|
||||
currentScopeState = ScopeState.Left;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Обработка прыжка и спуска. Вызываются события MovEvent.
|
||||
if (keyBoardState.IsKeyDown(Keys.LeftShift) && !isJumpDown && keyBoardState.IsKeyDown(Keys.Down))
|
||||
else if(keyBoardState.IsKeyDown(Keys.Right) || keyBoardState.IsKeyDown(Keys.D))
|
||||
{
|
||||
isJumpDown = true;
|
||||
MovEventDown?.Invoke();
|
||||
Debug.WriteLine("Спуск");
|
||||
currentScopeState = ScopeState.Right;
|
||||
}
|
||||
else if (keyBoardState.IsKeyDown(Keys.LeftShift) && !isJumpDown)
|
||||
else if(keyBoardState.IsKeyDown(Keys.Right) && keyBoardState.IsKeyDown(Keys.Up) ||
|
||||
keyBoardState.IsKeyDown(Keys.D) && keyBoardState.IsKeyDown(Keys.W))
|
||||
{
|
||||
isJumpDown = true;
|
||||
MovEventJump?.Invoke();
|
||||
Debug.WriteLine("Прыжок");
|
||||
currentScopeState = ScopeState.StraightRight;
|
||||
}
|
||||
else if (keyBoardState.IsKeyUp(Keys.LeftShift))
|
||||
else if(keyBoardState.IsKeyDown(Keys.Left) && keyBoardState.IsKeyDown(Keys.Up) ||
|
||||
keyBoardState.IsKeyDown(Keys.A) && keyBoardState.IsKeyDown(Keys.W))
|
||||
{
|
||||
isJumpDown = false;
|
||||
currentScopeState = ScopeState.StraightLeft;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Обработка положения оружия. Задает значение полю scopeState.
|
||||
if (keyBoardState.IsKeyDown(Keys.Up))
|
||||
else if(keyBoardState.IsKeyDown(Keys.Right) && keyBoardState.IsKeyDown(Keys.Down) ||
|
||||
keyBoardState.IsKeyDown(Keys.D) && keyBoardState.IsKeyDown(Keys.S))
|
||||
{
|
||||
scopeState = ScopeState.Up;
|
||||
currentScopeState = ScopeState.BackRight;
|
||||
}
|
||||
else if (keyBoardState.IsKeyDown(Keys.Down) && !isJumpDown)
|
||||
else if(keyBoardState.IsKeyDown(Keys.Left) && keyBoardState.IsKeyDown(Keys.Down) ||
|
||||
keyBoardState.IsKeyDown(Keys.A) && keyBoardState.IsKeyDown(Keys.S))
|
||||
{
|
||||
scopeState = ScopeState.Down;
|
||||
}
|
||||
else
|
||||
{
|
||||
scopeState = ScopeState.Middle;
|
||||
currentScopeState = ScopeState.BackLeft;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
||||
if (keyBoardState.IsKeyDown(Keys.X) && !isJumpDown && !isShoot)
|
||||
if (keyBoardState.IsKeyDown(Keys.P) && !isShoot)
|
||||
{
|
||||
isShoot = true;
|
||||
ShootEvent?.Invoke();
|
||||
Debug.WriteLine("Выстрел");
|
||||
}
|
||||
else if (keyBoardState.IsKeyUp(Keys.X) && !isJumpDown)
|
||||
else if (keyBoardState.IsKeyUp(Keys.P))
|
||||
{
|
||||
isShoot = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
SetState(ControlsState.Keyboard);
|
||||
#region Обработка взаимодействия с collectable(например лутом). Вызывает событие OnInteract
|
||||
if (keyBoardState.IsKeyDown(Keys.E) && !isInteract)
|
||||
{
|
||||
|
||||
OnInteract?.Invoke();
|
||||
Debug.WriteLine("взаимодействие с Collectable");
|
||||
}
|
||||
else if (keyBoardState.IsKeyUp(Keys.E))
|
||||
{
|
||||
isInteract = false;
|
||||
}
|
||||
#endregion
|
||||
lastKeyboardState = keyBoardState;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
public void SetState(ControlsState controlsState)
|
||||
{
|
||||
currentControlsState = controlsState.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
|||
public int Width { get; set; }
|
||||
public int Id { get; set; }
|
||||
public bool Visibility { get; set; }
|
||||
public string Class { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,23 +8,29 @@ using System.Text;
|
|||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.GameManagers.MapManager.MapElements;
|
||||
using ZoFo.GameCore.GameObjects.MapObjects;
|
||||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||
using ZoFo.GameCore.GameObjects.MapObjects.Tiles;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.MapManager
|
||||
{
|
||||
public class MapManager
|
||||
{
|
||||
private static readonly string _path = "/{0}.tmj";
|
||||
|
||||
private static readonly string _templatePath = "TileMaps/{0}.tmj";
|
||||
private static readonly float _scale = 1.0f;
|
||||
private List<TileSet> _tileSets = new List<TileSet>();
|
||||
|
||||
/// <summary>
|
||||
/// Загрузка карты. Передаётся название файла карты. По умолчанию main.
|
||||
/// </summary>
|
||||
/// <param name="mapName"></param>
|
||||
public void LoadMap(string mapName = "main")
|
||||
{
|
||||
TileMap tileMap;
|
||||
using (StreamReader reader = new StreamReader(string.Format(_path, mapName)))
|
||||
{
|
||||
string data = reader.ReadToEnd();
|
||||
tileMap = JsonSerializer.Deserialize<TileMap>(data);
|
||||
}
|
||||
// Загрузка TileMap
|
||||
TileMap tileMap = JsonSerializer.Deserialize<TileMap>(File.ReadAllText(string.Format(_templatePath, mapName)));
|
||||
|
||||
// Загрузка TileSet-ов по TileSetInfo
|
||||
List<TileSet> tileSets = new List<TileSet>();
|
||||
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
|
||||
{
|
||||
|
@ -33,32 +39,50 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
|||
tileSets.Add(tileSet);
|
||||
}
|
||||
|
||||
foreach (var chunk in tileMap.Layers[0].Chunks)
|
||||
foreach (var layer in tileMap.Layers)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var id in chunk.Data)
|
||||
foreach (var chunk in layer.Chunks)
|
||||
{
|
||||
foreach (var tileSet in tileSets)
|
||||
for (int i = 0; i < chunk.Data.Length; i++)
|
||||
{
|
||||
if (tileSet.FirstGid - id < 0)
|
||||
foreach (var tileSet in tileSets)
|
||||
{
|
||||
int number = id - tileSet.FirstGid;
|
||||
if (tileSet.FirstGid - chunk.Data[i] < 0)
|
||||
{
|
||||
int number = chunk.Data[i] - tileSet.FirstGid;
|
||||
|
||||
int relativeColumn = number % tileSet.Columns * tileSet.TileWidth;
|
||||
int relativeRow = number / tileSet.Columns * tileSet.TileHeight;
|
||||
int relativeColumn = number % tileSet.Columns * tileSet.TileWidth;
|
||||
int relativeRow = number / tileSet.Columns * tileSet.TileHeight;
|
||||
|
||||
Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * tileSet.TileHeight,
|
||||
relativeColumn * tileSet.TileWidth + tileSet.TileWidth, relativeRow * tileSet.TileHeight + tileSet.TileHeight);
|
||||
Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * tileSet.TileHeight,
|
||||
relativeColumn * tileSet.TileWidth + tileSet.TileWidth, relativeRow * tileSet.TileHeight + tileSet.TileHeight);
|
||||
|
||||
Vector2 position = new Vector2(i % chunk.Width, i / chunk.Height);
|
||||
Vector2 position = new Vector2(i % chunk.Width, i / chunk.Height);
|
||||
|
||||
switch (layer.Class)
|
||||
{
|
||||
case "Tile":
|
||||
new MapObject(position, new Vector2(tileSet.TileWidth * _scale, tileSet.TileHeight * _scale), sourceRectangle, tileSet.Name);
|
||||
break;
|
||||
case "StopObject":
|
||||
// new StopObject(position, new Vector2(tileSet.TileWidth * _scale, tileSet.TileHeight * _scale), sourceRectangle, tileSet.Name);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Загружает и парсит TileSet по его пути.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
private TileSet LoadTileSet(string path)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(path))
|
||||
|
@ -67,6 +91,5 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
|||
return JsonSerializer.Deserialize<TileSet>(data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"activeFile": "",
|
||||
"expandedProjectPaths": [
|
||||
],
|
||||
"fileStates": {
|
||||
"TileSets/TileSet 1.tsj": {
|
||||
"scaleInDock": 1,
|
||||
"scaleInEditor": 1
|
||||
}
|
||||
},
|
||||
"openFiles": [
|
||||
],
|
||||
"project": "",
|
||||
"recentFiles": [
|
||||
"TileSets/TileSet 1.tsj"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"automappingRulesFile": "",
|
||||
"commands": [
|
||||
],
|
||||
"compatibilityVersion": 1100,
|
||||
"extensionsPath": "extensions",
|
||||
"folders": [
|
||||
"."
|
||||
],
|
||||
"properties": [
|
||||
],
|
||||
"propertyTypes": [
|
||||
]
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"Map/SizeTest": {
|
||||
"height": 4300,
|
||||
"width": 2
|
||||
},
|
||||
"activeFile": "",
|
||||
"expandedProjectPaths": [
|
||||
],
|
||||
"fileStates": {
|
||||
},
|
||||
"last.imagePath": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/Textures/Background",
|
||||
"map.fixedSize": false,
|
||||
"map.lastUsedFormat": "json",
|
||||
"map.tileHeight": 16,
|
||||
"map.tileWidth": 16,
|
||||
"openFiles": [
|
||||
],
|
||||
"project": "MapSession.tiled-project",
|
||||
"recentFiles": [
|
||||
]
|
||||
}
|
167
ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmj
Normal file
|
@ -0,0 +1,167 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":20,
|
||||
"infinite":true,
|
||||
"layers":[
|
||||
{
|
||||
"chunks":[
|
||||
{
|
||||
"data":[24, 24, 24, 28, 29, 24, 24, 24, 28, 46, 29, 24, 25, 115, 45, 46,
|
||||
24, 24, 24, 25, 23, 24, 24, 24, 50, 2, 51, 24, 50, 2, 2, 2,
|
||||
24, 24, 24, 50, 32, 29, 24, 24, 24, 24, 24, 24, 24, 24, 24, 28,
|
||||
28, 29, 24, 28, 10, 32, 29, 24, 24, 28, 46, 29, 24, 24, 24, 50,
|
||||
47, 23, 24, 50, 32, 10, 32, 46, 29, 50, 2, 51, 24, 24, 24, 24,
|
||||
1, 32, 29, 90, 25, 23, 50, 2, 32, 29, 24, 90, 28, 29, 24, 24,
|
||||
51, 50, 32, 29, 50, 51, 90, 24, 25, 45, 46, 29, 25, 23, 24, 90,
|
||||
24, 24, 50, 32, 46, 29, 24, 28, 10, 2, 2, 51, 50, 51, 24, 90,
|
||||
24, 24, 24, 50, 2, 32, 46, 10, 32, 29, 24, 90, 24, 24, 24, 90,
|
||||
29, 24, 89, 24, 24, 50, 3, 23, 50, 32, 46, 46, 46, 46, 29, 24,
|
||||
51, 24, 24, 28, 29, 24, 25, 23, 24, 25, 1, 2, 3, 111, 45, 29,
|
||||
24, 90, 24, 50, 51, 24, 25, 23, 28, 47, 23, 89, 50, 3, 115, 23,
|
||||
24, 24, 24, 24, 24, 89, 50, 32, 47, 1, 51, 24, 24, 50, 2, 51,
|
||||
28, 29, 24, 24, 24, 24, 28, 10, 2, 51, 24, 24, 24, 24, 24, 28,
|
||||
10, 32, 29, 24, 24, 24, 25, 23, 28, 29, 90, 24, 24, 90, 24, 50,
|
||||
32, 10, 51, 24, 24, 24, 50, 32, 10, 32, 29, 24, 90, 28, 29, 24],
|
||||
"height":16,
|
||||
"width":16,
|
||||
"x":-16,
|
||||
"y":-16
|
||||
},
|
||||
{
|
||||
"data":[10, 51, 24, 90, 24, 25, 23, 28, 29, 24, 24, 24, 24, 24, 24, 24,
|
||||
51, 24, 28, 29, 24, 50, 32, 10, 51, 24, 24, 24, 24, 24, 24, 24,
|
||||
29, 28, 10, 32, 46, 29, 50, 32, 29, 24, 24, 24, 24, 24, 24, 24,
|
||||
51, 25, 23, 50, 2, 32, 29, 25, 23, 24, 24, 28, 29, 24, 90, 24,
|
||||
24, 25, 23, 24, 24, 25, 23, 50, 51, 24, 24, 50, 32, 29, 24, 90,
|
||||
24, 50, 32, 29, 90, 25, 45, 29, 24, 24, 24, 24, 50, 51, 24, 89,
|
||||
24, 89, 50, 51, 24, 25, 114, 23, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 28, 29, 24, 50, 2, 51, 24, 24, 90, 28, 29, 24, 24, 28,
|
||||
24, 24, 25, 23, 89, 24, 24, 24, 28, 46, 29, 25, 23, 24, 24, 50,
|
||||
28, 46, 10, 51, 24, 28, 46, 29, 25, 111, 45, 10, 51, 28, 29, 24,
|
||||
50, 2, 51, 24, 24, 25, 115, 45, 10, 3, 1, 51, 24, 25, 23, 24,
|
||||
24, 24, 24, 24, 24, 50, 2, 2, 32, 10, 51, 24, 90, 25, 23, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 50, 51, 24, 24, 24, 25, 23, 24,
|
||||
46, 29, 24, 24, 24, 24, 24, 89, 24, 24, 24, 28, 46, 47, 23, 90,
|
||||
2, 32, 29, 24, 24, 28, 46, 46, 29, 24, 24, 25, 1, 3, 23, 89,
|
||||
24, 50, 32, 29, 24, 25, 1, 3, 23, 24, 89, 50, 32, 10, 51, 24],
|
||||
"height":16,
|
||||
"width":16,
|
||||
"x":0,
|
||||
"y":-16
|
||||
},
|
||||
{
|
||||
"data":[24, 24, 24, 24, 90, 24, 89, 24, 89, 24, 50, 51, 89, 24, 24, 24,
|
||||
24, 28, 29, 28, 29, 24, 24, 24, 24, 28, 29, 24, 24, 24, 28, 29,
|
||||
24, 25, 23, 50, 51, 24, 24, 28, 29, 50, 51, 24, 24, 24, 25, 45,
|
||||
90, 50, 51, 28, 29, 24, 24, 25, 23, 24, 24, 28, 29, 24, 50, 3,
|
||||
24, 24, 28, 10, 51, 90, 90, 50, 51, 24, 24, 50, 51, 24, 24, 50,
|
||||
24, 24, 25, 45, 29, 24, 28, 29, 24, 24, 24, 24, 24, 28, 29, 24,
|
||||
90, 24, 50, 2, 51, 28, 10, 51, 90, 24, 28, 29, 24, 25, 45, 46,
|
||||
29, 90, 24, 24, 24, 50, 51, 24, 24, 28, 10, 32, 46, 10, 3, 1,
|
||||
32, 29, 24, 90, 24, 24, 24, 24, 28, 47, 23, 50, 2, 51, 50, 51,
|
||||
25, 23, 24, 24, 28, 46, 46, 46, 47, 114, 45, 29, 24, 24, 24, 24,
|
||||
50, 32, 29, 24, 50, 3, 111, 111, 115, 111, 1, 32, 29, 24, 24, 24,
|
||||
24, 50, 51, 24, 28, 10, 2, 2, 2, 2, 32, 10, 51, 24, 24, 89,
|
||||
24, 24, 89, 90, 25, 23, 24, 24, 24, 24, 50, 32, 46, 46, 29, 89,
|
||||
24, 24, 24, 90, 25, 23, 89, 24, 28, 29, 90, 50, 2, 2, 51, 24,
|
||||
24, 24, 24, 28, 10, 51, 24, 28, 47, 45, 29, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 25, 23, 24, 90, 50, 2, 2, 32, 46, 46, 46, 46, 46],
|
||||
"height":16,
|
||||
"width":16,
|
||||
"x":16,
|
||||
"y":-16
|
||||
},
|
||||
{
|
||||
"data":[10, 32, 46, 29, 24, 24, 24, 25, 23, 50, 32, 29, 24, 50, 32, 46,
|
||||
51, 50, 2, 32, 29, 24, 24, 25, 45, 29, 25, 23, 24, 24, 25, 1,
|
||||
24, 24, 24, 25, 23, 28, 46, 10, 2, 51, 50, 51, 24, 24, 50, 51,
|
||||
90, 89, 90, 50, 51, 50, 2, 51, 24, 24, 28, 29, 90, 24, 24, 24,
|
||||
90, 28, 46, 29, 90, 24, 24, 24, 90, 24, 50, 51, 90, 24, 90, 28,
|
||||
29, 50, 2, 51, 24, 24, 24, 89, 24, 24, 24, 24, 24, 89, 24, 50,
|
||||
23, 24, 24, 28, 46, 29, 90, 90, 24, 89, 24, 28, 29, 24, 24, 24,
|
||||
32, 46, 29, 25, 115, 45, 29, 24, 90, 24, 24, 25, 23, 24, 24, 28,
|
||||
10, 2, 32, 47, 115, 1, 51, 24, 24, 24, 24, 25, 23, 24, 28, 10,
|
||||
32, 29, 50, 2, 2, 51, 24, 24, 24, 24, 24, 25, 23, 28, 10, 51,
|
||||
50, 51, 89, 24, 24, 89, 24, 28, 29, 24, 24, 50, 32, 10, 32, 46,
|
||||
24, 24, 90, 90, 28, 46, 29, 50, 51, 24, 24, 24, 25, 23, 25, 115,
|
||||
24, 90, 24, 24, 50, 2, 32, 29, 24, 24, 90, 24, 25, 45, 10, 2,
|
||||
24, 24, 24, 24, 24, 24, 50, 32, 29, 24, 24, 28, 10, 3, 23, 24,
|
||||
90, 24, 24, 24, 24, 89, 90, 50, 32, 29, 90, 50, 51, 50, 32, 46,
|
||||
46, 29, 24, 90, 24, 24, 24, 24, 50, 51, 28, 29, 24, 24, 50, 2],
|
||||
"height":16,
|
||||
"width":16,
|
||||
"x":-16,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"data":[46, 46, 10, 32, 46, 47, 23, 25, 23, 89, 24, 24, 25, 23, 90, 24,
|
||||
2, 2, 32, 47, 1, 2, 51, 25, 23, 24, 28, 29, 50, 32, 29, 24,
|
||||
24, 90, 50, 3, 23, 24, 28, 10, 51, 28, 47, 45, 29, 25, 23, 28,
|
||||
24, 24, 24, 50, 51, 28, 47, 23, 24, 50, 3, 114, 45, 10, 51, 50,
|
||||
29, 24, 24, 89, 24, 25, 114, 45, 46, 46, 10, 2, 2, 32, 29, 89,
|
||||
51, 24, 24, 24, 24, 50, 3, 111, 115, 115, 23, 24, 24, 50, 32, 29,
|
||||
24, 28, 29, 24, 24, 24, 25, 1, 2, 2, 51, 90, 24, 90, 50, 51,
|
||||
29, 50, 32, 29, 28, 29, 25, 23, 24, 24, 89, 28, 29, 24, 24, 24,
|
||||
51, 24, 50, 51, 50, 32, 10, 32, 46, 29, 24, 50, 51, 24, 90, 24,
|
||||
24, 24, 24, 24, 89, 50, 32, 10, 2, 32, 46, 29, 89, 28, 29, 24,
|
||||
29, 90, 24, 24, 24, 24, 50, 51, 28, 10, 3, 23, 28, 10, 51, 24,
|
||||
23, 89, 24, 24, 90, 24, 24, 24, 50, 32, 10, 51, 50, 51, 24, 24,
|
||||
51, 24, 24, 24, 24, 24, 24, 24, 24, 50, 32, 46, 46, 29, 28, 46,
|
||||
24, 24, 24, 90, 24, 24, 24, 24, 24, 24, 50, 3, 1, 32, 47, 115,
|
||||
46, 29, 24, 89, 24, 24, 24, 89, 24, 24, 24, 25, 45, 10, 3, 111,
|
||||
2, 51, 28, 29, 28, 29, 24, 28, 46, 46, 46, 10, 2, 51, 50, 2],
|
||||
"height":16,
|
||||
"width":16,
|
||||
"x":0,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"data":[28, 29, 28, 10, 32, 46, 29, 24, 24, 28, 10, 2, 2, 2, 2, 2,
|
||||
50, 51, 50, 51, 25, 115, 45, 46, 29, 50, 51, 24, 24, 24, 24, 24,
|
||||
29, 24, 89, 24, 50, 3, 115, 114, 23, 24, 24, 24, 24, 24, 24, 24,
|
||||
51, 90, 24, 89, 24, 50, 2, 2, 51, 24, 89, 24, 24, 28, 46, 29,
|
||||
24, 90, 24, 24, 89, 24, 90, 28, 29, 24, 24, 24, 28, 10, 2, 51,
|
||||
24, 24, 24, 24, 28, 29, 90, 50, 51, 28, 29, 24, 25, 23, 24, 24,
|
||||
28, 29, 24, 24, 50, 32, 29, 28, 29, 50, 51, 89, 50, 32, 29, 24,
|
||||
50, 51, 24, 24, 24, 50, 32, 10, 51, 24, 89, 24, 24, 25, 23, 24,
|
||||
24, 24, 24, 24, 24, 24, 50, 32, 29, 24, 24, 24, 24, 50, 51, 24,
|
||||
90, 24, 24, 24, 24, 24, 24, 25, 45, 29, 24, 24, 24, 89, 28, 29,
|
||||
24, 24, 24, 24, 28, 29, 24, 25, 1, 51, 24, 24, 24, 24, 50, 32,
|
||||
28, 29, 28, 29, 50, 32, 46, 10, 51, 28, 29, 24, 24, 24, 24, 50,
|
||||
47, 45, 10, 51, 24, 50, 2, 32, 46, 47, 23, 24, 89, 90, 24, 24,
|
||||
111, 115, 23, 24, 24, 90, 24, 50, 2, 2, 32, 29, 24, 89, 28, 46,
|
||||
1, 2, 51, 28, 46, 46, 29, 24, 28, 29, 50, 32, 29, 28, 47, 111,
|
||||
51, 24, 24, 50, 3, 114, 23, 24, 50, 32, 46, 47, 23, 25, 111, 111],
|
||||
"height":16,
|
||||
"width":16,
|
||||
"x":16,
|
||||
"y":0
|
||||
}],
|
||||
"class":"Tile",
|
||||
"height":48,
|
||||
"id":1,
|
||||
"name":"\u0421\u043b\u043e\u0439 \u0442\u0430\u0439\u043b\u043e\u0432 1",
|
||||
"opacity":1,
|
||||
"startx":-16,
|
||||
"starty":-32,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":48,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.10.2",
|
||||
"tileheight":16,
|
||||
"tilesets":[
|
||||
{
|
||||
"firstgid":1,
|
||||
"source":"..\/TileSets\/TileSet 1.tsj"
|
||||
}],
|
||||
"tilewidth":16,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":30
|
||||
}
|
116
ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmx
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" source="../TileSets/TileSet 1.tsj"/>
|
||||
<layer id="1" name="Слой тайлов 1" width="30" height="20">
|
||||
<data encoding="csv">
|
||||
<chunk x="-16" y="-16" width="16" height="16">
|
||||
24,24,24,28,29,24,24,24,28,46,29,24,25,115,45,46,
|
||||
24,24,24,25,23,24,24,24,50,2,51,24,50,2,2,2,
|
||||
24,24,24,50,32,29,24,24,24,24,24,24,24,24,24,28,
|
||||
28,29,24,28,10,32,29,24,24,28,46,29,24,24,24,50,
|
||||
47,23,24,50,32,10,32,46,29,50,2,51,24,24,24,24,
|
||||
1,32,29,90,25,23,50,2,32,29,24,90,28,29,24,24,
|
||||
51,50,32,29,50,51,90,24,25,45,46,29,25,23,24,90,
|
||||
24,24,50,32,46,29,24,28,10,2,2,51,50,51,24,90,
|
||||
24,24,24,50,2,32,46,10,32,29,24,90,24,24,24,90,
|
||||
29,24,89,24,24,50,3,23,50,32,46,46,46,46,29,24,
|
||||
51,24,24,28,29,24,25,23,24,25,1,2,3,111,45,29,
|
||||
24,90,24,50,51,24,25,23,28,47,23,89,50,3,115,23,
|
||||
24,24,24,24,24,89,50,32,47,1,51,24,24,50,2,51,
|
||||
28,29,24,24,24,24,28,10,2,51,24,24,24,24,24,28,
|
||||
10,32,29,24,24,24,25,23,28,29,90,24,24,90,24,50,
|
||||
32,10,51,24,24,24,50,32,10,32,29,24,90,28,29,24
|
||||
</chunk>
|
||||
<chunk x="0" y="-16" width="16" height="16">
|
||||
10,51,24,90,24,25,23,28,29,24,24,24,24,24,24,24,
|
||||
51,24,28,29,24,50,32,10,51,24,24,24,24,24,24,24,
|
||||
29,28,10,32,46,29,50,32,29,24,24,24,24,24,24,24,
|
||||
51,25,23,50,2,32,29,25,23,24,24,28,29,24,90,24,
|
||||
24,25,23,24,24,25,23,50,51,24,24,50,32,29,24,90,
|
||||
24,50,32,29,90,25,45,29,24,24,24,24,50,51,24,89,
|
||||
24,89,50,51,24,25,114,23,24,24,24,24,24,24,24,24,
|
||||
24,24,28,29,24,50,2,51,24,24,90,28,29,24,24,28,
|
||||
24,24,25,23,89,24,24,24,28,46,29,25,23,24,24,50,
|
||||
28,46,10,51,24,28,46,29,25,111,45,10,51,28,29,24,
|
||||
50,2,51,24,24,25,115,45,10,3,1,51,24,25,23,24,
|
||||
24,24,24,24,24,50,2,2,32,10,51,24,90,25,23,24,
|
||||
24,24,24,24,24,24,24,24,50,51,24,24,24,25,23,24,
|
||||
46,29,24,24,24,24,24,89,24,24,24,28,46,47,23,90,
|
||||
2,32,29,24,24,28,46,46,29,24,24,25,1,3,23,89,
|
||||
24,50,32,29,24,25,1,3,23,24,89,50,32,10,51,24
|
||||
</chunk>
|
||||
<chunk x="16" y="-16" width="16" height="16">
|
||||
24,24,24,24,90,24,89,24,89,24,50,51,89,24,24,24,
|
||||
24,28,29,28,29,24,24,24,24,28,29,24,24,24,28,29,
|
||||
24,25,23,50,51,24,24,28,29,50,51,24,24,24,25,45,
|
||||
90,50,51,28,29,24,24,25,23,24,24,28,29,24,50,3,
|
||||
24,24,28,10,51,90,90,50,51,24,24,50,51,24,24,50,
|
||||
24,24,25,45,29,24,28,29,24,24,24,24,24,28,29,24,
|
||||
90,24,50,2,51,28,10,51,90,24,28,29,24,25,45,46,
|
||||
29,90,24,24,24,50,51,24,24,28,10,32,46,10,3,1,
|
||||
32,29,24,90,24,24,24,24,28,47,23,50,2,51,50,51,
|
||||
25,23,24,24,28,46,46,46,47,114,45,29,24,24,24,24,
|
||||
50,32,29,24,50,3,111,111,115,111,1,32,29,24,24,24,
|
||||
24,50,51,24,28,10,2,2,2,2,32,10,51,24,24,89,
|
||||
24,24,89,90,25,23,24,24,24,24,50,32,46,46,29,89,
|
||||
24,24,24,90,25,23,89,24,28,29,90,50,2,2,51,24,
|
||||
24,24,24,28,10,51,24,28,47,45,29,24,24,24,24,24,
|
||||
24,24,24,25,23,24,90,50,2,2,32,46,46,46,46,46
|
||||
</chunk>
|
||||
<chunk x="-16" y="0" width="16" height="16">
|
||||
10,32,46,29,24,24,24,25,23,50,32,29,24,50,32,46,
|
||||
51,50,2,32,29,24,24,25,45,29,25,23,24,24,25,1,
|
||||
24,24,24,25,23,28,46,10,2,51,50,51,24,24,50,51,
|
||||
90,89,90,50,51,50,2,51,24,24,28,29,90,24,24,24,
|
||||
90,28,46,29,90,24,24,24,90,24,50,51,90,24,90,28,
|
||||
29,50,2,51,24,24,24,89,24,24,24,24,24,89,24,50,
|
||||
23,24,24,28,46,29,90,90,24,89,24,28,29,24,24,24,
|
||||
32,46,29,25,115,45,29,24,90,24,24,25,23,24,24,28,
|
||||
10,2,32,47,115,1,51,24,24,24,24,25,23,24,28,10,
|
||||
32,29,50,2,2,51,24,24,24,24,24,25,23,28,10,51,
|
||||
50,51,89,24,24,89,24,28,29,24,24,50,32,10,32,46,
|
||||
24,24,90,90,28,46,29,50,51,24,24,24,25,23,25,115,
|
||||
24,90,24,24,50,2,32,29,24,24,90,24,25,45,10,2,
|
||||
24,24,24,24,24,24,50,32,29,24,24,28,10,3,23,24,
|
||||
90,24,24,24,24,89,90,50,32,29,90,50,51,50,32,46,
|
||||
46,29,24,90,24,24,24,24,50,51,28,29,24,24,50,2
|
||||
</chunk>
|
||||
<chunk x="0" y="0" width="16" height="16">
|
||||
46,46,10,32,46,47,23,25,23,89,24,24,25,23,90,24,
|
||||
2,2,32,47,1,2,51,25,23,24,28,29,50,32,29,24,
|
||||
24,90,50,3,23,24,28,10,51,28,47,45,29,25,23,28,
|
||||
24,24,24,50,51,28,47,23,24,50,3,114,45,10,51,50,
|
||||
29,24,24,89,24,25,114,45,46,46,10,2,2,32,29,89,
|
||||
51,24,24,24,24,50,3,111,115,115,23,24,24,50,32,29,
|
||||
24,28,29,24,24,24,25,1,2,2,51,90,24,90,50,51,
|
||||
29,50,32,29,28,29,25,23,24,24,89,28,29,24,24,24,
|
||||
51,24,50,51,50,32,10,32,46,29,24,50,51,24,90,24,
|
||||
24,24,24,24,89,50,32,10,2,32,46,29,89,28,29,24,
|
||||
29,90,24,24,24,24,50,51,28,10,3,23,28,10,51,24,
|
||||
23,89,24,24,90,24,24,24,50,32,10,51,50,51,24,24,
|
||||
51,24,24,24,24,24,24,24,24,50,32,46,46,29,28,46,
|
||||
24,24,24,90,24,24,24,24,24,24,50,3,1,32,47,115,
|
||||
46,29,24,89,24,24,24,89,24,24,24,25,45,10,3,111,
|
||||
2,51,28,29,28,29,24,28,46,46,46,10,2,51,50,2
|
||||
</chunk>
|
||||
<chunk x="16" y="0" width="16" height="16">
|
||||
28,29,28,10,32,46,29,24,24,28,10,2,2,2,2,2,
|
||||
50,51,50,51,25,115,45,46,29,50,51,24,24,24,24,24,
|
||||
29,24,89,24,50,3,115,114,23,24,24,24,24,24,24,24,
|
||||
51,90,24,89,24,50,2,2,51,24,89,24,24,28,46,29,
|
||||
24,90,24,24,89,24,90,28,29,24,24,24,28,10,2,51,
|
||||
24,24,24,24,28,29,90,50,51,28,29,24,25,23,24,24,
|
||||
28,29,24,24,50,32,29,28,29,50,51,89,50,32,29,24,
|
||||
50,51,24,24,24,50,32,10,51,24,89,24,24,25,23,24,
|
||||
24,24,24,24,24,24,50,32,29,24,24,24,24,50,51,24,
|
||||
90,24,24,24,24,24,24,25,45,29,24,24,24,89,28,29,
|
||||
24,24,24,24,28,29,24,25,1,51,24,24,24,24,50,32,
|
||||
28,29,28,29,50,32,46,10,51,28,29,24,24,24,24,50,
|
||||
47,45,10,51,24,50,2,32,46,47,23,24,89,90,24,24,
|
||||
111,115,23,24,24,90,24,50,2,2,32,29,24,89,28,46,
|
||||
1,2,51,28,46,46,29,24,28,29,50,32,29,28,47,111,
|
||||
51,24,24,50,3,114,23,24,50,32,46,47,23,25,111,111
|
||||
</chunk>
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
166
ZoFo/GameCore/GameManagers/MapManager/TileSets/TileSet 1.tsj
Normal file
|
@ -0,0 +1,166 @@
|
|||
{ "class":"Tile",
|
||||
"columns":22,
|
||||
"grid":
|
||||
{
|
||||
"height":24,
|
||||
"orientation":"orthogonal",
|
||||
"width":24
|
||||
},
|
||||
"image":"..\/..\/..\/..\/Content\/Textures\/Background\/TilesetFloor.png",
|
||||
"imageheight":417,
|
||||
"imagewidth":352,
|
||||
"margin":0,
|
||||
"name":"TileSet 1",
|
||||
"spacing":0,
|
||||
"tilecount":572,
|
||||
"tiledversion":"1.10.2",
|
||||
"tileheight":16,
|
||||
"tiles":[
|
||||
{
|
||||
"id":27,
|
||||
"probability":0.5
|
||||
},
|
||||
{
|
||||
"id":28,
|
||||
"probability":0.5
|
||||
},
|
||||
{
|
||||
"id":49,
|
||||
"probability":0.5
|
||||
},
|
||||
{
|
||||
"id":50,
|
||||
"probability":0.5
|
||||
},
|
||||
{
|
||||
"id":88,
|
||||
"probability":0.100000001490116
|
||||
},
|
||||
{
|
||||
"id":89,
|
||||
"probability":0.100000001490116
|
||||
},
|
||||
{
|
||||
"id":110,
|
||||
"probability":2
|
||||
},
|
||||
{
|
||||
"id":111,
|
||||
"probability":0.100000001490116
|
||||
},
|
||||
{
|
||||
"id":112,
|
||||
"probability":0.100000001490116
|
||||
}],
|
||||
"tilewidth":16,
|
||||
"type":"tileset",
|
||||
"version":"1.10",
|
||||
"wangsets":[
|
||||
{
|
||||
"colors":[
|
||||
{
|
||||
"color":"#ff0000",
|
||||
"name":"Sand",
|
||||
"probability":1,
|
||||
"tile":23
|
||||
},
|
||||
{
|
||||
"color":"#00ff00",
|
||||
"name":"SandStone",
|
||||
"probability":0.3,
|
||||
"tile":110
|
||||
}],
|
||||
"name":"\u041f\u0435\u0441\u0447\u0430\u043d\u044b\u0439",
|
||||
"tile":-1,
|
||||
"type":"corner",
|
||||
"wangtiles":[
|
||||
{
|
||||
"tileid":0,
|
||||
"wangid":[0, 2, 0, 1, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":1,
|
||||
"wangid":[0, 2, 0, 1, 0, 1, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":2,
|
||||
"wangid":[0, 2, 0, 2, 0, 1, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":9,
|
||||
"wangid":[0, 2, 0, 1, 0, 2, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":22,
|
||||
"wangid":[0, 1, 0, 1, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":23,
|
||||
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":24,
|
||||
"wangid":[0, 2, 0, 2, 0, 1, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":27,
|
||||
"wangid":[0, 1, 0, 2, 0, 1, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":28,
|
||||
"wangid":[0, 1, 0, 1, 0, 2, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":31,
|
||||
"wangid":[0, 1, 0, 2, 0, 1, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":44,
|
||||
"wangid":[0, 1, 0, 2, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":45,
|
||||
"wangid":[0, 1, 0, 2, 0, 2, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":46,
|
||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":49,
|
||||
"wangid":[0, 2, 0, 1, 0, 1, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":50,
|
||||
"wangid":[0, 1, 0, 1, 0, 1, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":88,
|
||||
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":89,
|
||||
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":110,
|
||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":111,
|
||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":112,
|
||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":113,
|
||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||
},
|
||||
{
|
||||
"tileid":114,
|
||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||
}]
|
||||
}]
|
||||
}
|
|
@ -5,6 +5,7 @@ using System.Net;
|
|||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||
|
@ -20,6 +21,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
List<IUpdateData> updates = new List<IUpdateData>();
|
||||
public delegate void OnDataSent(string Data);
|
||||
public event OnDataSent GetDataSent; // event
|
||||
public bool IsConnected { get { return socket.Connected; } }
|
||||
|
||||
public ClientNetworkManager()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Init() //create endPoint, socket
|
||||
{
|
||||
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
@ -27,11 +35,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
|
||||
public void SendData()
|
||||
{
|
||||
while(socket.Connected)
|
||||
{
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(updates.ToString());
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(updates)); //нужно сериализовать
|
||||
socket.Send(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(IUpdateData UpdateData)
|
||||
{
|
||||
updates.Add(UpdateData);
|
||||
}
|
||||
|
||||
public void StopConnection()
|
||||
|
@ -47,24 +57,21 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
/// <param name="port"></param>
|
||||
public void JoinRoom(string ip) // multyplayer
|
||||
{
|
||||
|
||||
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
|
||||
|
||||
socket.Connect(endPoint);
|
||||
|
||||
SendData();
|
||||
Thread listen = new Thread(StartListening);
|
||||
listen.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// создается
|
||||
/// <summary>
|
||||
/// создается одиночная комната к которой ты подключаешься
|
||||
/// </summary>
|
||||
public void JoinYourself() // single player
|
||||
{
|
||||
endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
|
||||
|
||||
socket.Connect(endPoint);
|
||||
|
||||
SendData();
|
||||
Thread listen = new Thread(StartListening);
|
||||
listen.Start();
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
{
|
||||
public class ServerNetworkManager
|
||||
{
|
||||
private IPAddress ip = IPAddress.Any;
|
||||
private IPAddress ip =IPAddress.Parse("127.0.0.1"); //IPAddress.Any
|
||||
private int port = 7632;
|
||||
private IPEndPoint endPoint;
|
||||
private Socket socket;
|
||||
|
@ -25,13 +25,24 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
public delegate void OnDataSend(string data);
|
||||
public event OnDataSend GetDataSend; // event
|
||||
Dictionary<Socket, Thread> managerThread;
|
||||
Thread serverTheread;
|
||||
|
||||
public void Init() //create Socket
|
||||
public ServerNetworkManager() { Init(); }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize varibles and Sockets
|
||||
/// </summary>
|
||||
private void Init()
|
||||
{
|
||||
endPoint = new IPEndPoint(ip, port);
|
||||
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
managerThread = new Dictionary<Socket, Thread>();
|
||||
clients = new List<Socket>();
|
||||
updates = new List<IUpdateData>();
|
||||
managerThread = new Dictionary<Socket, Thread>();
|
||||
socket.Bind(endPoint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// отправляет клиенту Data
|
||||
/// </summary>
|
||||
|
@ -44,6 +55,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
item.SendAsync(databytes);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// добавляет в лист updates новую data
|
||||
/// </summary>
|
||||
|
@ -53,7 +65,10 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
updates.Add(data);
|
||||
}
|
||||
|
||||
public void CloseConnection() //По сути коне игры и отключение игроков
|
||||
/// <summary>
|
||||
/// По сути конец игры и отключение игроков
|
||||
/// </summary>
|
||||
public void CloseConnection()
|
||||
{
|
||||
foreach (var item in clients)
|
||||
{
|
||||
|
@ -74,11 +89,26 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
clients.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Начинает работу сервера (Ожидает подключений)
|
||||
/// </summary>
|
||||
/// <param name="players"></param>
|
||||
public void Start(object players)
|
||||
{
|
||||
serverTheread = new Thread(StartWaitingForPlayers);
|
||||
serverTheread.Start(players);
|
||||
}
|
||||
|
||||
//Потоки Клиентов
|
||||
public void StartWaitingForPlayers(object players)//Слушает игроков, которые хотят подключиться
|
||||
|
||||
/// <summary>
|
||||
/// Слушает игроков, которые хотят подключиться
|
||||
/// </summary>
|
||||
/// <param name="players"></param>
|
||||
public void StartWaitingForPlayers(object players)
|
||||
{
|
||||
int playNumber = (int)players;
|
||||
socket.Bind(endPoint);
|
||||
|
||||
socket.Listen(playNumber);
|
||||
for (int i = 0; i < playNumber; i++)
|
||||
{
|
||||
|
@ -90,7 +120,12 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
}
|
||||
|
||||
}
|
||||
private void StartListening(object socket)//начать слушать клиентов в самой игре активируют Ивент
|
||||
|
||||
/// <summary>
|
||||
/// начать слушать клиентов в самой игре активируют Ивент
|
||||
/// </summary>
|
||||
/// <param name="socket"></param>
|
||||
private void StartListening(object socket)
|
||||
{
|
||||
// obj to Socket
|
||||
Socket client = (Socket)socket;
|
||||
|
|
|
@ -17,8 +17,10 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
|||
[JsonDerivedType(typeof(UpdateLoot))]
|
||||
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
|
||||
[JsonDerivedType(typeof(UpdatePosition))]
|
||||
[JsonDerivedType(typeof(UpdateTileCreated))]
|
||||
[JsonDerivedType(typeof(UpdateInput))]
|
||||
[JsonDerivedType(typeof(UpdatePlayerExit))]
|
||||
|
||||
public interface IUpdateData
|
||||
{
|
||||
public int IdEntity { get; set; } //Id объекта
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||
{
|
||||
|
||||
public class UpdateTileCreated : IUpdateData
|
||||
{
|
||||
public int IdEntity { get; set; }
|
||||
public string UpdateType { get; set; }
|
||||
public Texture2D TextureTile { get; set; }
|
||||
public Vector2 Position { get; set; }
|
||||
}
|
||||
}
|
|
@ -13,25 +13,11 @@ namespace ZoFo.GameCore.GameObjects.Entities
|
|||
protected override GraphicsComponent graphicsComponent => null;
|
||||
public CollisionComponent collisionComponent { get; protected set; }
|
||||
public int Id { get; set; }
|
||||
public void CollisionComponent()
|
||||
protected Entity(Vector2 position) : base(position)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AnimationComponent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void UpdateLogic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//вектор
|
||||
//вилосити
|
||||
//поситион
|
||||
//текстура
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
||||
public class Collectable : Entity
|
||||
{
|
||||
|
||||
public Collectable(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net.Mime;
|
||||
using System.Reflection;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
|
||||
public class Enemy : LivingEntity
|
||||
{
|
||||
|
||||
public Enemy(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -9,6 +9,9 @@ public class LivingEntity : Entity
|
|||
{
|
||||
public Vector2 velocity;
|
||||
|
||||
public LivingEntity(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
|
||||
public void TextureLoad(SpriteBatch spriteBatch)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,10 @@ public class Player : LivingEntity
|
|||
private int health;
|
||||
Server server = new Server();
|
||||
|
||||
public Player(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
// server.AddData();
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
||||
public class Bullet : Projectile
|
||||
{
|
||||
|
||||
public Bullet(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
||||
public class Projectile : LivingEntity
|
||||
{
|
||||
|
||||
public Projectile(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
||||
public class Rock : Projectile
|
||||
{
|
||||
|
||||
public Rock(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects;
|
||||
|
@ -7,9 +10,82 @@ namespace ZoFo.GameCore.GameObjects;
|
|||
public abstract class GameObject
|
||||
{
|
||||
public Vector2 position;
|
||||
public Vector2 rotation;
|
||||
|
||||
public Vector2 rotation; //вектор направления объекта
|
||||
protected abstract GraphicsComponent graphicsComponent { get; }
|
||||
public void Draw() { }
|
||||
|
||||
#region ServerSide
|
||||
public GameObject(Vector2 position)
|
||||
{
|
||||
this.position = position;
|
||||
}
|
||||
public virtual void UpdateLogic(GameTime gameTime)
|
||||
{
|
||||
PlayAnimation_OnServer();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Это вызывается в логике игры, которая на сервере, здесь будет вызываться уведомление об анимации
|
||||
/// </summary>
|
||||
public void PlayAnimation_OnServer()
|
||||
{
|
||||
graphicsComponent.Update();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Client Side
|
||||
|
||||
/// <summary>
|
||||
/// Для клиента
|
||||
/// Это вызывается в клиентской части игры
|
||||
/// </summary>
|
||||
public void PlayAnimation_OnClient()
|
||||
{
|
||||
graphicsComponent.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Для клиента
|
||||
/// Загрузка графического компонента
|
||||
/// </summary>
|
||||
public void LoadContent()
|
||||
{
|
||||
graphicsComponent.LoadContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Для клиента
|
||||
/// Обновление, которое вызывается у клиента, для просмотра анимаций
|
||||
/// </summary>
|
||||
public virtual void UpdateAnimations(GameTime gameTime)
|
||||
{
|
||||
PlayAnimation_OnClient();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Для клиента
|
||||
/// </summary>
|
||||
public virtual void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch);
|
||||
//debug
|
||||
if (AppManager.Instance.InputManager.CollisionsCheat)
|
||||
DrawDebugRectangle(spriteBatch, graphicsComponent.ObjectDrawRectangle);
|
||||
|
||||
}
|
||||
public void DrawDebugRectangle(SpriteBatch spriteBatch, Rectangle _rectangle, Nullable<Color> color = null)
|
||||
{
|
||||
if (color is null) color = new Color(1, 0, 0, 0.25f);
|
||||
if (color.Value.A == 255) color = new Color(color.Value, 0.25f);
|
||||
//spriteBatch.Draw(debugTexture,
|
||||
// new Rectangle((_rectangle.X - GraphicsComponent.CameraPosition.X) * GraphicsComponent.scaling,
|
||||
// (_rectangle.Y - GraphicsComponent.CameraPosition.Y) * GraphicsComponent.scaling,
|
||||
// _rectangle.Width * GraphicsComponent.scaling,
|
||||
// _rectangle.Height * GraphicsComponent.scaling), color.Value);
|
||||
|
||||
//TODO: debugTexture
|
||||
}
|
||||
#endregion
|
||||
}
|
30
ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.MapObjects
|
||||
{
|
||||
public class MapObject : GameObject
|
||||
{
|
||||
public virtual bool IsColliderOn { get; protected set; } = true;
|
||||
private Rectangle _sourceRectangle;
|
||||
protected override GraphicsComponent graphicsComponent => new("tiles");
|
||||
|
||||
public MapObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position)
|
||||
{
|
||||
_sourceRectangle = sourceRectangle;
|
||||
graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0, (int)size.X, (int)size.Y);
|
||||
}
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, _sourceRectangle);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||
|
||||
public class StopObject : MapObject
|
||||
{
|
||||
CollisionComponent collisionComponent;
|
||||
|
||||
protected StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position, size, sourceRectangle, textureName)
|
||||
{
|
||||
// TODO: Написать коллизию, пусть тразмер будет чисто таким же как и текстурка.
|
||||
// Поменяйте уровень защиты конструктора, после снимите в MapManager комментарий в методе LoadMap с создания StopObject-а
|
||||
}
|
||||
}
|
8
ZoFo/GameCore/GameObjects/MapObjects/Tiles/Tile.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.MapObjects.Tiles;
|
||||
|
||||
public class Tile
|
||||
{
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.StopObjects;
|
||||
|
||||
public class StopObject
|
||||
{
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects;
|
||||
|
||||
public class Tile
|
||||
{
|
||||
|
||||
}
|
|
@ -15,9 +15,8 @@ namespace ZoFo.GameCore
|
|||
{
|
||||
public class Server
|
||||
{
|
||||
private List<GameObject> gameObjects;
|
||||
private ServerNetworkManager networkManager;
|
||||
private List<Entity> entity; //entity
|
||||
private int ticks = 0;
|
||||
public Server()
|
||||
{
|
||||
networkManager = new ServerNetworkManager();
|
||||
|
@ -30,31 +29,57 @@ namespace ZoFo.GameCore
|
|||
//ТУТ Switch case будет честное слово
|
||||
}
|
||||
/// <summary>
|
||||
/// Для красоты) Отдел Серверов
|
||||
/// Для красоты) Отдел Серверов
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public void AddData(IUpdateData data)//добавляет в лист updates новую data
|
||||
{
|
||||
networkManager.AddData(data);
|
||||
}
|
||||
public void CreateRoom(int players) //Создает комнату и запускает ожидание подключений
|
||||
|
||||
/// <summary>
|
||||
/// Создает комнату и запускает ожидание подключений
|
||||
/// </summary>
|
||||
/// <param name="players"></param>
|
||||
public void CreateRoom(int players)
|
||||
{
|
||||
networkManager.StartWaitingForPlayers(players);
|
||||
networkManager.Start(players);
|
||||
}
|
||||
|
||||
// public void StartGame() { } принудительный запуск
|
||||
public void EndGame() //Добавляет UpdateGameEnded и отключает игроков
|
||||
|
||||
/// <summary>
|
||||
/// Добавляет UpdateGameEnded и отключает игроков
|
||||
/// </summary>
|
||||
public void EndGame()
|
||||
{
|
||||
UpdateGameEnded gameEnded = new UpdateGameEnded();
|
||||
networkManager.AddData(gameEnded);
|
||||
networkManager.CloseConnection();
|
||||
}
|
||||
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
}
|
||||
|
||||
private List<GameObject> gameObjects;
|
||||
private List<Entity> entities; //entity
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ
|
||||
{
|
||||
foreach (var go in gameObjects)
|
||||
{
|
||||
go.UpdateLogic(gameTime);
|
||||
}
|
||||
ticks = 0;
|
||||
networkManager.SendData();
|
||||
}
|
||||
ticks++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Регистрирует игровой объект
|
||||
/// </summary>
|
||||
/// <param name="gameObject"></param>
|
||||
public void RegisterEntity(GameObject gameObject)
|
||||
{
|
||||
gameObjects.Add(gameObject);
|
||||
|
|
|
@ -15,6 +15,10 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
|
||||
public class GraphicsComponent
|
||||
{
|
||||
public Rectangle ObjectDrawRectangle { get; set; }
|
||||
|
||||
|
||||
|
||||
public event Action<string> actionOfAnimationEnd;
|
||||
private List<AnimationContainer> animations;
|
||||
private List<Texture2D> textures;
|
||||
|
|