Merge branch 'DevelopmentX' into AddSoundToGUI
49
MonogameLibrary/UI/Elements/Bar.cs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using MonogameLibrary.UI.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
|
namespace MonogameLibrary.UI.Elements;
|
||||||
|
|
||||||
|
public class Bar : DrawableUIElement
|
||||||
|
{
|
||||||
|
public float percent = 0.5f;
|
||||||
|
private DrawableUIElement barInside;
|
||||||
|
public Color inColor;
|
||||||
|
public string inTextureName;
|
||||||
|
|
||||||
|
public Bar(UIManager manager, int layerIndex = 0, string textureName = "") : base(manager, layerIndex, textureName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
barInside = new DrawableUIElement(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(rectangle.X + rectangle.Height / 8, rectangle.Y + rectangle.Height / 8,
|
||||||
|
(int)((rectangle.Width - rectangle.Height / 4) * percent), rectangle.Height / 8 * 7),
|
||||||
|
mainColor = inColor,
|
||||||
|
textureName = inTextureName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LoadTexture(ContentManager content)
|
||||||
|
{
|
||||||
|
barInside.LoadTexture(content);
|
||||||
|
base.LoadTexture(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(GameTime gameTime, float percent)
|
||||||
|
{
|
||||||
|
barInside.rectangle = new Rectangle(rectangle.X + rectangle.Height / 8, rectangle.Y + rectangle.Height / 8,
|
||||||
|
(int)((rectangle.Width - rectangle.Height / 4) * percent), rectangle.Height / 8 * 7);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ public class ItemDisplayButton : Button
|
||||||
private ContentManager content;
|
private ContentManager content;
|
||||||
public string discriptions1;
|
public string discriptions1;
|
||||||
public Dictionary<string, int> resourcesNeededToCraft1;
|
public Dictionary<string, int> resourcesNeededToCraft1;
|
||||||
|
public TextAligment TextAligment = TextAligment.Left;
|
||||||
|
|
||||||
|
|
||||||
public ItemDisplayButton(UIManager manager) : base(manager)
|
public ItemDisplayButton(UIManager manager) : base(manager)
|
||||||
|
@ -46,7 +47,7 @@ public class ItemDisplayButton : Button
|
||||||
Label itemName = new Label(Manager)
|
Label itemName = new Label(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2 + rectangle.Height / 3 * 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Width / 3, rectangle.Height / 3 * 2),
|
rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2 + rectangle.Height / 3 * 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Width / 3, rectangle.Height / 3 * 2),
|
||||||
fontColor = fontColor1, text = text1, scale = scale1, fontName = fontName1, mainColor = Color.Transparent
|
fontColor = fontColor1, text = text1, scale = scale1, fontName = fontName1, mainColor = Color.Transparent, textAligment = TextAligment
|
||||||
};
|
};
|
||||||
Label itemCount = new Label(Manager)
|
Label itemCount = new Label(Manager)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +88,10 @@ public class ItemDisplayButton : Button
|
||||||
{
|
{
|
||||||
if (presentState != hoverState)
|
if (presentState != hoverState)
|
||||||
{
|
{
|
||||||
|
if (resourcesNeededToCraft1 == null)
|
||||||
|
{
|
||||||
|
resourcesNeededToCraft1 = new Dictionary<string, int>();
|
||||||
|
}
|
||||||
hoverWindow = new HoverWindow(Manager)
|
hoverWindow = new HoverWindow(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(Mouse.GetState().Position.X, Mouse.GetState().Position.Y, rectangle.Width, rectangle.Height * 10),
|
rectangle = new Rectangle(Mouse.GetState().Position.X, Mouse.GetState().Position.Y, rectangle.Width, rectangle.Height * 10),
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class ItemDisplayLabel : DrawableUIElement
|
||||||
public Dictionary<string, int> resourcesNeededToCraft1;
|
public Dictionary<string, int> resourcesNeededToCraft1;
|
||||||
public HoverState hoverState = HoverState.None;
|
public HoverState hoverState = HoverState.None;
|
||||||
private ContentManager content;
|
private ContentManager content;
|
||||||
|
public TextAligment TextAligment = TextAligment.Left;
|
||||||
|
|
||||||
|
|
||||||
public ItemDisplayLabel(UIManager manager) : base(manager)
|
public ItemDisplayLabel(UIManager manager) : base(manager)
|
||||||
|
@ -47,7 +48,7 @@ public class ItemDisplayLabel : DrawableUIElement
|
||||||
Label itemName = new Label(Manager)
|
Label itemName = new Label(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2 + rectangle.Height / 3 * 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Width / 3, rectangle.Height / 3 * 2),
|
rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2 + rectangle.Height / 3 * 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Width / 3, rectangle.Height / 3 * 2),
|
||||||
fontColor = fontColor1, text = text1, scale = scale1, fontName = fontName1, mainColor = Color.Transparent
|
fontColor = fontColor1, text = text1, scale = scale1, fontName = fontName1, mainColor = Color.Transparent, textAligment = TextAligment
|
||||||
};
|
};
|
||||||
Label itemCount = new Label(Manager)
|
Label itemCount = new Label(Manager)
|
||||||
{
|
{
|
||||||
|
|
|
@ -170,57 +170,84 @@
|
||||||
#begin Textures/Animations/player_left_idle.animation
|
#begin Textures/Animations/player_left_idle.animation
|
||||||
/copy:Textures/Animations/player_left_idle.animation
|
/copy:Textures/Animations/player_left_idle.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_down.animation
|
|
||||||
/copy:Textures/Animations/player_look_down.animation
|
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_down_weapon.animation
|
#begin Textures/Animations/player_look_down_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_down_weapon.animation
|
/copy:Textures/Animations/player_look_down_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left.animation
|
#begin Textures/Animations/player_look_down.animation
|
||||||
/copy:Textures/Animations/player_look_left.animation
|
/copy:Textures/Animations/player_look_down.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left_down.animation
|
|
||||||
/copy:Textures/Animations/player_look_left_down.animation
|
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left_down_weapon.animation
|
#begin Textures/Animations/player_look_left_down_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_left_down_weapon.animation
|
/copy:Textures/Animations/player_look_left_down_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left_up.animation
|
#begin Textures/Animations/player_look_left_down.animation
|
||||||
/copy:Textures/Animations/player_look_left_up.animation
|
/copy:Textures/Animations/player_look_left_down.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left_up_weapon.animation
|
#begin Textures/Animations/player_look_left_up_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_left_up_weapon.animation
|
/copy:Textures/Animations/player_look_left_up_weapon.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_look_left_up.animation
|
||||||
|
/copy:Textures/Animations/player_look_left_up.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left_weapon.animation
|
#begin Textures/Animations/player_look_left_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_left_weapon.animation
|
/copy:Textures/Animations/player_look_left_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right.animation
|
#begin Textures/Animations/player_look_left.animation
|
||||||
/copy:Textures/Animations/player_look_right.animation
|
/copy:Textures/Animations/player_look_left.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_down.animation
|
|
||||||
/copy:Textures/Animations/player_look_right_down.animation
|
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_down_weapon.animation
|
#begin Textures/Animations/player_look_right_down_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_right_down_weapon.animation
|
/copy:Textures/Animations/player_look_right_down_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_up.animation
|
#begin Textures/Animations/player_look_right_down.animation
|
||||||
/copy:Textures/Animations/player_look_right_up.animation
|
/copy:Textures/Animations/player_look_right_down.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_up_weapon.animation
|
#begin Textures/Animations/player_look_right_up_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_right_up_weapon.animation
|
/copy:Textures/Animations/player_look_right_up_weapon.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_look_right_up.animation
|
||||||
|
/copy:Textures/Animations/player_look_right_up.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_weapon.animation
|
#begin Textures/Animations/player_look_right_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_right_weapon.animation
|
/copy:Textures/Animations/player_look_right_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_up.animation
|
#begin Textures/Animations/player_look_right.animation
|
||||||
/copy:Textures/Animations/player_look_up.animation
|
/copy:Textures/Animations/player_look_right.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_up_weapon.animation
|
#begin Textures/Animations/player_look_up_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_up_weapon.animation
|
/copy:Textures/Animations/player_look_up_weapon.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_look_up.animation
|
||||||
|
/copy:Textures/Animations/player_look_up.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_right_idle.animation
|
#begin Textures/Animations/player_right_idle.animation
|
||||||
/copy:Textures/Animations/player_right_idle.animation
|
/copy:Textures/Animations/player_right_idle.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_down.animation
|
||||||
|
/copy:Textures/Animations/player_run_down.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_left_down.animation
|
||||||
|
/copy:Textures/Animations/player_run_left_down.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_left_up.animation
|
||||||
|
/copy:Textures/Animations/player_run_left_up.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_left.animation
|
||||||
|
/copy:Textures/Animations/player_run_left.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_right_down.animation
|
||||||
|
/copy:Textures/Animations/player_run_right_down.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_right_up.animation
|
||||||
|
/copy:Textures/Animations/player_run_right_up.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_right.animation
|
||||||
|
/copy:Textures/Animations/player_run_right.animation
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_right.zip
|
||||||
|
/copy:Textures/Animations/player_run_right.zip
|
||||||
|
|
||||||
|
#begin Textures/Animations/player_run_up.animation
|
||||||
|
/copy:Textures/Animations/player_run_up.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_running_top_rotate.animation
|
#begin Textures/Animations/player_running_top_rotate.animation
|
||||||
/copy:Textures/Animations/player_running_top_rotate.animation
|
/copy:Textures/Animations/player_running_top_rotate.animation
|
||||||
|
|
||||||
|
@ -257,18 +284,6 @@
|
||||||
#begin Textures/Animations/zombie_walk.animation
|
#begin Textures/Animations/zombie_walk.animation
|
||||||
/copy:Textures/Animations/zombie_walk.animation
|
/copy:Textures/Animations/zombie_walk.animation
|
||||||
|
|
||||||
#begin Textures/AnimationTextures/Character/hr-level1_idle.png
|
|
||||||
/importer:TextureImporter
|
|
||||||
/processor:TextureProcessor
|
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
|
||||||
/processorParam:ColorKeyEnabled=True
|
|
||||||
/processorParam:GenerateMipmaps=False
|
|
||||||
/processorParam:PremultiplyAlpha=True
|
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
|
||||||
/processorParam:MakeSquare=False
|
|
||||||
/processorParam:TextureFormat=Color
|
|
||||||
/build:Textures/AnimationTextures/Character/hr-level1_idle.png
|
|
||||||
|
|
||||||
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png
|
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -281,6 +296,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png
|
/build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png
|
||||||
|
|
||||||
|
#begin Textures/AnimationTextures/Character/hr-level1_idle.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:Textures/AnimationTextures/Character/hr-level1_idle.png
|
||||||
|
|
||||||
#begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png
|
#begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -305,18 +332,6 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png
|
/build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png
|
||||||
|
|
||||||
#begin Textures/AnimationTextures/Character/hr-level1_running.png
|
|
||||||
/importer:TextureImporter
|
|
||||||
/processor:TextureProcessor
|
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
|
||||||
/processorParam:ColorKeyEnabled=True
|
|
||||||
/processorParam:GenerateMipmaps=False
|
|
||||||
/processorParam:PremultiplyAlpha=True
|
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
|
||||||
/processorParam:MakeSquare=False
|
|
||||||
/processorParam:TextureFormat=Color
|
|
||||||
/build:Textures/AnimationTextures/Character/hr-level1_running.png
|
|
||||||
|
|
||||||
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.png
|
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -329,6 +344,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/AnimationTextures/Character/hr-level1_running_gun.png
|
/build:Textures/AnimationTextures/Character/hr-level1_running_gun.png
|
||||||
|
|
||||||
|
#begin Textures/AnimationTextures/Character/hr-level1_running.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:Textures/AnimationTextures/Character/hr-level1_running.png
|
||||||
|
|
||||||
#begin Textures/AnimationTextures/unicorn.png
|
#begin Textures/AnimationTextures/unicorn.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -365,6 +392,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png
|
/build:Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png
|
||||||
|
|
||||||
|
#begin Textures/Effects/explosion.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/Effects/explosion.png
|
||||||
|
|
||||||
#begin Textures/GUI/background/base.png
|
#begin Textures/GUI/background/base.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -449,18 +488,6 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/background/waiting.png
|
/build:Textures/GUI/background/waiting.png
|
||||||
|
|
||||||
#begin Textures/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:Textures/GUI/checkboxs_off.png
|
|
||||||
|
|
||||||
#begin Textures/GUI/checkboxs_off-on.png
|
#begin Textures/GUI/checkboxs_off-on.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -473,6 +500,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/checkboxs_off-on.png
|
/build:Textures/GUI/checkboxs_off-on.png
|
||||||
|
|
||||||
|
#begin Textures/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:Textures/GUI/checkboxs_off.png
|
||||||
|
|
||||||
#begin Textures/GUI/checkboxs_on.png
|
#begin Textures/GUI/checkboxs_on.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -509,18 +548,6 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/mouse.png
|
/build:Textures/GUI/mouse.png
|
||||||
|
|
||||||
#begin Textures/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:Textures/GUI/switch.png
|
|
||||||
|
|
||||||
#begin Textures/GUI/Switch_backgrownd.png
|
#begin Textures/GUI/Switch_backgrownd.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -533,6 +560,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/Switch_backgrownd.png
|
/build:Textures/GUI/Switch_backgrownd.png
|
||||||
|
|
||||||
|
#begin Textures/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:Textures/GUI/switch.png
|
||||||
|
|
||||||
#begin Textures/icons/12.png
|
#begin Textures/icons/12.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -1505,6 +1544,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/Test/wood.jpg
|
/build:Textures/Test/wood.jpg
|
||||||
|
|
||||||
|
#begin Textures/TileSetImages/Campfire.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/TileSetImages/Campfire.png
|
||||||
|
|
||||||
#begin Textures/TileSetImages/Pipes.png
|
#begin Textures/TileSetImages/Pipes.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
|
|
@ -1,49 +1,26 @@
|
||||||
{
|
{
|
||||||
"activeFile": "TileMaps/main.tmj",
|
|
||||||
"expandedProjectPaths": [
|
|
||||||
"TileMaps",
|
|
||||||
"Templates",
|
|
||||||
".",
|
|
||||||
"TileSets"
|
|
||||||
],
|
|
||||||
"fileStates": {
|
"fileStates": {
|
||||||
"TileMaps/main.tmj": {
|
"TileMaps/main.tmj": {
|
||||||
"scale": 0.75,
|
"scale": 0.33,
|
||||||
"selectedLayer": 1,
|
"selectedLayer": 0,
|
||||||
"viewCenter": {
|
"viewCenter": {
|
||||||
"x": 1860.6666666666665,
|
"x": -463.63636363636374,
|
||||||
"y": 871.3333333333333
|
"y": 300
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TileSets/IconSet.tsj": {
|
"TileSets/IconSet.tsj": {
|
||||||
"dynamicWrapping": true,
|
"dynamicWrapping": true
|
||||||
"scaleInDock": 1,
|
|
||||||
"scaleInEditor": 1
|
|
||||||
},
|
},
|
||||||
"TileSets/TileSet 1.tsj": {
|
"TileSets/TileSet 1.tsj": {
|
||||||
"dynamicWrapping": false,
|
"dynamicWrapping": false,
|
||||||
"scaleInDock": 1.5,
|
"scaleInDock": 1
|
||||||
"scaleInEditor": 3
|
|
||||||
},
|
},
|
||||||
"TileSets/TilesetNature.tsj": {
|
"TileSets/TilesetNature.tsj": {
|
||||||
"scaleInDock": 1.5,
|
"scaleInDock": 1.5
|
||||||
"scaleInEditor": 1
|
|
||||||
},
|
},
|
||||||
"TileSets/tileset 1 collision.tsj": {
|
"TileSets/tileset 1 collision.tsj": {
|
||||||
|
"dynamicWrapping": false,
|
||||||
"scaleInDock": 1
|
"scaleInDock": 1
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"openFiles": [
|
|
||||||
"TileMaps/main.tmj",
|
|
||||||
"TileSets/IconSet.tsj",
|
|
||||||
"TileSets/TileSet 1.tsj",
|
|
||||||
"TileSets/TilesetNature.tsj"
|
|
||||||
],
|
|
||||||
"project": "MapSession.tiled-project",
|
|
||||||
"recentFiles": [
|
|
||||||
"TileSets/TilesetNature.tsj",
|
|
||||||
"TileSets/TileSet 1.tsj",
|
|
||||||
"TileSets/IconSet.tsj",
|
|
||||||
"TileMaps/main.tmj"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,9 @@
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16
|
"width":16
|
||||||
},
|
},
|
||||||
"tileset":
|
"tileset": {
|
||||||
{
|
"firstgid": 1,
|
||||||
"firstgid":1,
|
"source": "..\/..\/TileSets\/IconSet.tsj"
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
|
@ -9,10 +9,9 @@
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16
|
"width":16
|
||||||
},
|
},
|
||||||
"tileset":
|
"tileset": {
|
||||||
{
|
"firstgid": 1,
|
||||||
"firstgid":1,
|
"source": "..\/..\/TileSets\/IconSet.tsj"
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
|
@ -9,10 +9,9 @@
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16
|
"width":16
|
||||||
},
|
},
|
||||||
"tileset":
|
"tileset": {
|
||||||
{
|
"firstgid": 1,
|
||||||
"firstgid":1,
|
"source": "..\/..\/TileSets\/IconSet.tsj"
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
"tileset":
|
"tileset":
|
||||||
{
|
{
|
||||||
"firstgid":1,
|
"firstgid":1,
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
"source":"..\/..\/TileSets\/IconSet.tsj"
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
|
@ -9,10 +9,9 @@
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16
|
"width":16
|
||||||
},
|
},
|
||||||
"tileset":
|
"tileset": {
|
||||||
{
|
"firstgid": 1,
|
||||||
"firstgid":1,
|
"source": "..\/..\/TileSets\/IconSet.tsj"
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
|
@ -9,10 +9,9 @@
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16
|
"width":16
|
||||||
},
|
},
|
||||||
"tileset":
|
"tileset": {
|
||||||
{
|
"firstgid": 1,
|
||||||
"firstgid":1,
|
"source": "..\/..\/TileSets\/IconSet.tsj"
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
|
@ -9,10 +9,9 @@
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16
|
"width":16
|
||||||
},
|
},
|
||||||
"tileset":
|
"tileset": {
|
||||||
{
|
"firstgid": 1,
|
||||||
"firstgid":1,
|
"source": "..\/..\/TileSets\/IconSet.tsj"
|
||||||
"source":"..\/TileSets\/IconSet.tsj"
|
|
||||||
},
|
},
|
||||||
"type":"template"
|
"type":"template"
|
||||||
}
|
}
|
18
ZoFo/Content/MapData/Templates/Enemies/Zombie.tj
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{ "object":
|
||||||
|
{
|
||||||
|
"gid":8,
|
||||||
|
"height":16,
|
||||||
|
"id":1,
|
||||||
|
"name":"Zombie",
|
||||||
|
"rotation":0,
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":16
|
||||||
|
},
|
||||||
|
"tileset":
|
||||||
|
{
|
||||||
|
"firstgid":1,
|
||||||
|
"source":"..\/..\/TileSets\/IconSet.tsj"
|
||||||
|
},
|
||||||
|
"type":"template"
|
||||||
|
}
|
|
@ -8,51 +8,57 @@
|
||||||
"margin":0,
|
"margin":0,
|
||||||
"name":"IconSet",
|
"name":"IconSet",
|
||||||
"spacing":0,
|
"spacing":0,
|
||||||
"tilecount":7,
|
"tilecount":8,
|
||||||
"tiledversion":"1.10.2",
|
"tiledversion":"1.10.2",
|
||||||
"tileheight":1200,
|
"tileheight":1200,
|
||||||
"tiles":[
|
"tiles":[
|
||||||
{
|
{
|
||||||
"id":0,
|
"id":0,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/ammunition.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/Ammo.png",
|
||||||
"imageheight":512,
|
"imageheight":512,
|
||||||
"imagewidth":512
|
"imagewidth":512
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":1,
|
"id":1,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/Blue Potion.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/PureBottleOfWater.png",
|
||||||
"imageheight":32,
|
"imageheight":32,
|
||||||
"imagewidth":32
|
"imagewidth":32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":2,
|
"id":2,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/Water Bottle.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/BottleOfWater.png",
|
||||||
"imageheight":32,
|
"imageheight":32,
|
||||||
"imagewidth":32
|
"imagewidth":32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":3,
|
"id":3,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/Wood Log.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/Wood.png",
|
||||||
"imageheight":32,
|
"imageheight":32,
|
||||||
"imagewidth":32
|
"imagewidth":32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":4,
|
"id":4,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/Silver Ingot.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/Steel.png",
|
||||||
"imageheight":32,
|
"imageheight":32,
|
||||||
"imagewidth":32
|
"imagewidth":32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":5,
|
"id":5,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/Monster Meat.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/RottenFlesh.png",
|
||||||
"imageheight":32,
|
"imageheight":32,
|
||||||
"imagewidth":32
|
"imagewidth":32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":6,
|
"id":6,
|
||||||
"image":"..\/..\/Textures\/icons\/Collectables\/Stone.png",
|
"image":"..\/..\/Textures\/icons\/Collectables\/Peeble.png",
|
||||||
"imageheight":1200,
|
"imageheight":1200,
|
||||||
"imagewidth":1200
|
"imagewidth":1200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":7,
|
||||||
|
"image":"..\/..\/Textures\/icons\/zombie_218153.png",
|
||||||
|
"imageheight":512,
|
||||||
|
"imagewidth":512
|
||||||
}],
|
}],
|
||||||
"tilewidth":1200,
|
"tilewidth":1200,
|
||||||
"type":"tileset",
|
"type":"tileset",
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
"width":24
|
"width":24
|
||||||
},
|
},
|
||||||
"image":"..\/..\/Textures\/TileSetImages\/TilesetFloor.png",
|
"image":"..\/..\/Textures\/TileSetImages\/TilesetFloor.png",
|
||||||
"imageheight":417,
|
"imageheight":464,
|
||||||
"imagewidth":352,
|
"imagewidth":352,
|
||||||
"margin":0,
|
"margin":0,
|
||||||
"name":"TileSet 1",
|
"name":"TileSet 1",
|
||||||
"objectalignment":"topleft",
|
"objectalignment":"topleft",
|
||||||
"spacing":0,
|
"spacing":0,
|
||||||
"tilecount":572,
|
"tilecount":638,
|
||||||
"tiledversion":"1.10.2",
|
"tiledversion":"1.10.2",
|
||||||
"tileheight":16,
|
"tileheight":16,
|
||||||
"tiles":[
|
"tiles":[
|
||||||
|
@ -2314,6 +2314,270 @@
|
||||||
{
|
{
|
||||||
"id":571,
|
"id":571,
|
||||||
"type":"Tile"
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":572,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":573,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":574,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":575,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":576,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":577,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":578,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":579,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":580,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":581,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":582,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":583,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":584,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":585,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":586,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":587,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":588,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":589,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":590,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":591,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":592,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":593,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":594,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":595,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":596,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":597,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":598,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":599,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":600,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":601,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":602,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":603,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":604,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":605,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":606,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":607,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":608,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":609,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":610,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":611,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":612,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":613,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":614,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":615,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":616,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":617,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":618,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":619,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":620,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":621,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":622,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":623,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":624,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":625,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":626,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":627,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":628,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":629,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":630,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":631,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":632,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":633,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":634,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":635,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":636,
|
||||||
|
"type":"Tile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":637,
|
||||||
|
"type":"Tile"
|
||||||
}],
|
}],
|
||||||
"tilewidth":16,
|
"tilewidth":16,
|
||||||
"type":"tileset",
|
"type":"tileset",
|
||||||
|
@ -2332,8 +2596,20 @@
|
||||||
"name":"SandStone",
|
"name":"SandStone",
|
||||||
"probability":0.3,
|
"probability":0.3,
|
||||||
"tile":110
|
"tile":110
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color":"#0000ff",
|
||||||
|
"name":"LightGrass",
|
||||||
|
"probability":1,
|
||||||
|
"tile":265
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color":"#ff7700",
|
||||||
|
"name":"Dirt",
|
||||||
|
"probability":1,
|
||||||
|
"tile":177
|
||||||
}],
|
}],
|
||||||
"name":"\u041f\u0435\u0441\u0447\u0430\u043d\u044b\u0439",
|
"name":"\u0411\u0438\u043e\u043c\u043d\u044b\u0439",
|
||||||
"tile":-1,
|
"tile":-1,
|
||||||
"type":"corner",
|
"type":"corner",
|
||||||
"wangtiles":[
|
"wangtiles":[
|
||||||
|
@ -2424,6 +2700,228 @@
|
||||||
{
|
{
|
||||||
"tileid":114,
|
"tileid":114,
|
||||||
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":154,
|
||||||
|
"wangid":[0, 3, 0, 4, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":155,
|
||||||
|
"wangid":[0, 3, 0, 4, 0, 4, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":156,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 4, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":163,
|
||||||
|
"wangid":[0, 3, 0, 4, 0, 3, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":176,
|
||||||
|
"wangid":[0, 4, 0, 4, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":177,
|
||||||
|
"wangid":[0, 4, 0, 4, 0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":178,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":181,
|
||||||
|
"wangid":[0, 4, 0, 3, 0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":182,
|
||||||
|
"wangid":[0, 4, 0, 4, 0, 3, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":185,
|
||||||
|
"wangid":[0, 4, 0, 3, 0, 4, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":198,
|
||||||
|
"wangid":[0, 4, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":199,
|
||||||
|
"wangid":[0, 4, 0, 3, 0, 3, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":200,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":203,
|
||||||
|
"wangid":[0, 3, 0, 4, 0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":204,
|
||||||
|
"wangid":[0, 4, 0, 4, 0, 4, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":242,
|
||||||
|
"wangid":[0, 4, 0, 4, 0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":243,
|
||||||
|
"wangid":[0, 4, 0, 4, 0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":244,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":245,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":264,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":265,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":266,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":267,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":268,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":578,
|
||||||
|
"wangid":[0, 3, 0, 2, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":579,
|
||||||
|
"wangid":[0, 3, 0, 2, 0, 2, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":580,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 2, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":581,
|
||||||
|
"wangid":[0, 2, 0, 3, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":582,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 3, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":600,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":601,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":602,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":603,
|
||||||
|
"wangid":[0, 3, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":604,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":622,
|
||||||
|
"wangid":[0, 2, 0, 3, 0, 3, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":623,
|
||||||
|
"wangid":[0, 2, 0, 3, 0, 3, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":624,
|
||||||
|
"wangid":[0, 3, 0, 3, 0, 3, 0, 2]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"colors":[
|
||||||
|
{
|
||||||
|
"color":"#ff0000",
|
||||||
|
"name":"",
|
||||||
|
"probability":1,
|
||||||
|
"tile":264
|
||||||
|
}],
|
||||||
|
"name":"\u0422\u0440\u0430\u0432\u0430",
|
||||||
|
"tile":244,
|
||||||
|
"type":"corner",
|
||||||
|
"wangtiles":[
|
||||||
|
{
|
||||||
|
"tileid":244,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":245,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":264,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":265,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":266,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":267,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":268,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"colors":[
|
||||||
|
{
|
||||||
|
"color":"#ff0000",
|
||||||
|
"name":"",
|
||||||
|
"probability":1,
|
||||||
|
"tile":110
|
||||||
|
}],
|
||||||
|
"name":"\u041f\u0435\u0441\u0447\u0430\u043d\u0438\u043a",
|
||||||
|
"tile":111,
|
||||||
|
"type":"corner",
|
||||||
|
"wangtiles":[
|
||||||
|
{
|
||||||
|
"tileid":110,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":111,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":112,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":113,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":114,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
102
ZoFo/Content/MapData/TileSets/bonfire.tsj
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
{ "columns":4,
|
||||||
|
"image":"..\/..\/Textures\/TileSetImages\/Campfire.png",
|
||||||
|
"imageheight":32,
|
||||||
|
"imagewidth":128,
|
||||||
|
"margin":0,
|
||||||
|
"name":"bonfire",
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":22,
|
||||||
|
"tiledversion":"1.10.2",
|
||||||
|
"tileheight":32,
|
||||||
|
"tiles":[
|
||||||
|
{
|
||||||
|
"animation":[
|
||||||
|
{
|
||||||
|
"duration":250,
|
||||||
|
"tileid":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"duration":250,
|
||||||
|
"tileid":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"duration":250,
|
||||||
|
"tileid":2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"duration":250,
|
||||||
|
"tileid":3
|
||||||
|
}],
|
||||||
|
"id":0,
|
||||||
|
"type":"StopObject"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":1,
|
||||||
|
"type":"StopObject"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":2,
|
||||||
|
"type":"StopObject"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":3,
|
||||||
|
"type":"StopObject"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":13
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":14
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":17
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":18
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":19
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":21
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":15
|
||||||
|
}],
|
||||||
|
"tilewidth":32,
|
||||||
|
"type":"tileset",
|
||||||
|
"version":"1.10"
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
"name":"tileset 1 collision",
|
"name":"tileset 1 collision",
|
||||||
"spacing":0,
|
"spacing":0,
|
||||||
"tilecount":240,
|
"tilecount":240,
|
||||||
"tiledversion":"1.10.2",
|
"tiledversion":"1.11.0",
|
||||||
"tileheight":16,
|
"tileheight":16,
|
||||||
"tiles":[
|
"tiles":[
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -133,7 +132,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -161,7 +159,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -189,7 +186,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -217,7 +213,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -245,7 +240,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -273,7 +267,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -301,7 +294,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -329,7 +321,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -357,7 +348,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -385,7 +375,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -449,7 +438,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -477,7 +465,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -505,7 +492,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -533,7 +519,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -561,7 +546,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -589,7 +573,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -617,7 +600,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -645,7 +627,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -673,7 +654,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -701,7 +681,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -729,7 +708,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -861,7 +839,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -889,7 +866,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -917,7 +893,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -1013,7 +988,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -1041,7 +1015,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -1069,7 +1042,6 @@
|
||||||
"objectgroup":
|
"objectgroup":
|
||||||
{
|
{
|
||||||
"draworder":"index",
|
"draworder":"index",
|
||||||
"id":2,
|
|
||||||
"name":"",
|
"name":"",
|
||||||
"objects":[
|
"objects":[
|
||||||
{
|
{
|
||||||
|
@ -1386,10 +1358,56 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":173,
|
"id":173,
|
||||||
|
"objectgroup":
|
||||||
|
{
|
||||||
|
"draworder":"index",
|
||||||
|
"id":2,
|
||||||
|
"name":"",
|
||||||
|
"objects":[
|
||||||
|
{
|
||||||
|
"height":16,
|
||||||
|
"id":1,
|
||||||
|
"name":"",
|
||||||
|
"rotation":0,
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"opacity":1,
|
||||||
|
"type":"objectgroup",
|
||||||
|
"visible":true,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
"type":"StopObject"
|
"type":"StopObject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":174,
|
"id":174,
|
||||||
|
"objectgroup":
|
||||||
|
{
|
||||||
|
"draworder":"index",
|
||||||
|
"id":2,
|
||||||
|
"name":"",
|
||||||
|
"objects":[
|
||||||
|
{
|
||||||
|
"height":16,
|
||||||
|
"id":1,
|
||||||
|
"name":"",
|
||||||
|
"rotation":0,
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"opacity":1,
|
||||||
|
"type":"objectgroup",
|
||||||
|
"visible":true,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
"type":"StopObject"
|
"type":"StopObject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1466,10 +1484,56 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":193,
|
"id":193,
|
||||||
|
"objectgroup":
|
||||||
|
{
|
||||||
|
"draworder":"index",
|
||||||
|
"id":2,
|
||||||
|
"name":"",
|
||||||
|
"objects":[
|
||||||
|
{
|
||||||
|
"height":16,
|
||||||
|
"id":1,
|
||||||
|
"name":"",
|
||||||
|
"rotation":0,
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"opacity":1,
|
||||||
|
"type":"objectgroup",
|
||||||
|
"visible":true,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
"type":"StopObject"
|
"type":"StopObject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":194,
|
"id":194,
|
||||||
|
"objectgroup":
|
||||||
|
{
|
||||||
|
"draworder":"index",
|
||||||
|
"id":2,
|
||||||
|
"name":"",
|
||||||
|
"objects":[
|
||||||
|
{
|
||||||
|
"height":16,
|
||||||
|
"id":1,
|
||||||
|
"name":"",
|
||||||
|
"rotation":0,
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"opacity":1,
|
||||||
|
"type":"objectgroup",
|
||||||
|
"visible":true,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
"type":"StopObject"
|
"type":"StopObject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
1
ZoFo/Content/MapData/TileStamps/bushes.stamp
Normal file
1
ZoFo/Content/MapData/TileStamps/flowers.stamp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"name":"Flowers","variations":[{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZGRgAAAAKwAL","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjYmRgAAAALwAM","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZmRgAAAAMwAN","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjYWRgAAAANwAO","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZWRgAAAAOwAP","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjY2RgAAAAPwAQ","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZ2RgAAAAQwAR","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1}]}
|
1
ZoFo/Content/MapData/TileStamps/green trees.stamp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"name":"Green Trees","variations":[{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwzZWBgMANicyC2AGJfIPYDYn8gDgDiVCBOA+J0IM4AYgBToAOv","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjZGBgYAJiSSCWAmIAAWgANw==","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJw7zsDAcAKI7wPxAyAGACBYA08=","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzbwsjAsBWItwHxGSA+C8TngPgJED8F4mdADACKGwc/","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJwTZGBgEAJiTSDWAmIAA+gAdw==","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALBZ45iAYYLjP7RJS0RUm93hNF1uj9fnB2JABD8=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALCZ45iAYYIjnzZpiYhqszucpsvt8fr8ZyAEbw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJwTZmBgEAFibSDWAWIABDgAfw==","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1}]}
|
|
@ -1 +1 @@
|
||||||
{"name":"Stone Buildings","variations":[{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALBxLMCwwPGvjzZpiYhqszucpsvt8fr8EWABDw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjZWBgYANidiDmAGJJIJYCYmkglgFiXSDWA2J9IDYAYgAWQAE/","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZGBg4AJibiCWBWI5IJYHYkMgNgJiYyAGAA+EAQ8=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjYWBg4AViPiBWAGJFIFYCYhMgNgViMyAGABGgASo=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzY2Bg8AfiACBOAuJkIE4BYgAb1AIX","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1}]}
|
{"name":"Stone Buildings","variations":[{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALBxLMCwwPGvjzZpiYhqszucpsvt8fr8EWABDw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjZWBgYANidiDmAGJJIJYCYmkglgFiXSDWA2J9IDYAYgAWQAE/","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZGBg4AJibiCWBWI5IJYHYkMgNgJiYyAGAA+EAQ8=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjYWBg4AViPiBWAGJFIFYCYhMgNgViMyAGABGgASo=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzY2Bg8AfiACBOAuJkIE4BYgAb1AIX","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":5,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwsRgCAUALBXXqGCQgXQCooV/MRxu9sUEbPJ7OJqsdrsbu4eng4vbx9fP38Kng2j","encoding":"base64","height":5,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":5,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwsRgCAUALBXWqGCQgXQCooV/MRyu9sUEbPJ7OJqsdrsbu4eng4vbx9fP3/WDwxj","encoding":"base64","height":5,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.11.0","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1}]}
|
1
ZoFo/Content/Textures/Animations/explosion_1.animation
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"explosion_1","textureName":"Textures/Effects/explosion","startSpriteRectangle":{"X":0,"Y":0,"Width":100,"Height":100},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":0,"framesCount":33,"isCycle":false,"offset":"0, 0"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_down","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":528,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_left","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":792,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_left_down","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":660,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_left_up","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":924,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_right","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":264,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
BIN
ZoFo/Content/Textures/Animations/player_run_right.zip
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_right_down","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":396,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_right_up","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":132,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
1
ZoFo/Content/Textures/Animations/player_run_up.animation
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"player_run_up","textureName":"Textures/AnimationTextures/Character/hr-level1_running","startSpriteRectangle":{"X":0,"Y":0,"Width":88,"Height":132},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}
|
|
@ -1 +1 @@
|
||||||
{"id":"zombie_death","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":96,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":9,"isCycle":true,"offset":"0, 0"}
|
{"id":"zombie_death","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":96,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":9,"isCycle":false,"offset":"0, 0"}
|
||||||
|
|
BIN
ZoFo/Content/Textures/Effects/explosion.png
Normal file
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 3.8 MiB |
BIN
ZoFo/Content/Textures/TileSetImages/Campfire.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 33 KiB |
BIN
ZoFo/Content/Textures/icons/zombie_218153.png
Normal file
After Width: | Height: | Size: 30 KiB |
|
@ -23,9 +23,11 @@ using System.Web;
|
||||||
using ZoFo.GameCore.GUI;
|
using ZoFo.GameCore.GUI;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
||||||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
namespace ZoFo.GameCore
|
namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
public class Client
|
public class Client
|
||||||
|
@ -40,7 +42,6 @@ namespace ZoFo.GameCore
|
||||||
public Client()
|
public Client()
|
||||||
{
|
{
|
||||||
networkManager = new ClientNetworkManager();
|
networkManager = new ClientNetworkManager();
|
||||||
networkManager.GetDataSent += OnDataSend;
|
|
||||||
|
|
||||||
// Подписка на действия инпутменеджера.
|
// Подписка на действия инпутменеджера.
|
||||||
// Отправляются данные апдейтса с обновлением инпута
|
// Отправляются данные апдейтса с обновлением инпута
|
||||||
|
@ -48,8 +49,8 @@ namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
networkManager.AddData(new UpdateInput()
|
networkManager.AddData(new UpdateInput()
|
||||||
{
|
{
|
||||||
InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection,
|
InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection.Serialize(),
|
||||||
InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection
|
InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection.Serialize()
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -92,11 +93,26 @@ namespace ZoFo.GameCore
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
Player myPlayer;
|
public Player myPlayer;
|
||||||
List<MapObject> mapObjects = new List<MapObject>();
|
List<MapObject> mapObjects = new List<MapObject>();
|
||||||
List<GameObject> gameObjects = new List<GameObject>();
|
List<GameObject> gameObjects = new List<GameObject>();
|
||||||
List<Player> players = new List<Player>();
|
List<Player> players = new List<Player>();
|
||||||
List<StopObject> stopObjects = new List<StopObject>();
|
List<StopObject> stopObjects = new List<StopObject>();
|
||||||
|
List<Particle> particles = new List<Particle>();
|
||||||
|
|
||||||
|
float shakeEffect = 0;
|
||||||
|
public void AddShaking(float power)
|
||||||
|
{
|
||||||
|
shakeEffect += power;
|
||||||
|
}
|
||||||
|
public void UpdateShaking()
|
||||||
|
{
|
||||||
|
shakeEffect *= 0.99f;
|
||||||
|
(GraphicsComponent.CameraPosition) += new Microsoft.Xna.Framework.Point(
|
||||||
|
(int)((Random.Shared.NextDouble() - 0.5) * shakeEffect),
|
||||||
|
(int)((Random.Shared.NextDouble() - 0.5) * shakeEffect)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Клиент должен обнговлять игру анимаций
|
/// Клиент должен обнговлять игру анимаций
|
||||||
|
@ -104,11 +120,15 @@ namespace ZoFo.GameCore
|
||||||
/// <param name="gameTime"></param>
|
/// <param name="gameTime"></param>
|
||||||
internal void Update(GameTime gameTime)
|
internal void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
UpdateShaking();
|
||||||
for (int i = 0; i < gameObjects.Count; i++)
|
for (int i = 0; i < gameObjects.Count; i++)
|
||||||
{
|
{
|
||||||
AppManager.Instance.debugHud.Set("GameTime", gameTime.TotalGameTime.ToString());
|
|
||||||
gameObjects[i].UpdateAnimations();
|
gameObjects[i].UpdateAnimations();
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < particles.Count; i++)
|
||||||
|
{
|
||||||
|
particles[i].UpdateAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
networkManager.SendData();//set to ticks
|
networkManager.SendData();//set to ticks
|
||||||
if (myPlayer != null)
|
if (myPlayer != null)
|
||||||
|
@ -119,6 +139,10 @@ namespace ZoFo.GameCore
|
||||||
) )
|
) )
|
||||||
.ToPoint();
|
.ToPoint();
|
||||||
}
|
}
|
||||||
|
public void SendData()
|
||||||
|
{
|
||||||
|
networkManager.SendData();
|
||||||
|
}
|
||||||
internal void Draw(SpriteBatch spriteBatch)
|
internal void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mapObjects.Count; i++)
|
for (int i = 0; i < mapObjects.Count; i++)
|
||||||
|
@ -133,15 +157,28 @@ namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
gameObjects[i].Draw(spriteBatch);
|
gameObjects[i].Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < particles.Count; i++)
|
||||||
|
{
|
||||||
|
particles[i].Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void UpdatesList(List<UpdateData> updates)
|
||||||
|
{
|
||||||
|
foreach (var item in updates)
|
||||||
|
{
|
||||||
|
GotData(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
internal void GotData(UpdateData update)
|
internal void GotData(UpdateData update)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (update is UpdateTileCreated)
|
if (update is UpdateTileCreated)
|
||||||
{
|
{
|
||||||
mapObjects.Add(
|
mapObjects.Add(
|
||||||
new MapObject(
|
new MapObject(
|
||||||
(update as UpdateTileCreated).Position,
|
(update as UpdateTileCreated).Position.GetVector2(),
|
||||||
(update as UpdateTileCreated).Size.GetPoint().ToVector2(),
|
(update as UpdateTileCreated).Size.GetPoint().ToVector2(),
|
||||||
(update as UpdateTileCreated).sourceRectangle.GetRectangle(),
|
(update as UpdateTileCreated).sourceRectangle.GetRectangle(),
|
||||||
(update as UpdateTileCreated).tileSetName
|
(update as UpdateTileCreated).tileSetName
|
||||||
|
@ -151,7 +188,7 @@ namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
stopObjects.Add(
|
stopObjects.Add(
|
||||||
new StopObject(
|
new StopObject(
|
||||||
(update as UpdateStopObjectCreated).Position,
|
(update as UpdateStopObjectCreated).Position.GetVector2(),
|
||||||
(update as UpdateStopObjectCreated).Size.GetPoint().ToVector2(),
|
(update as UpdateStopObjectCreated).Size.GetPoint().ToVector2(),
|
||||||
(update as UpdateStopObjectCreated).sourceRectangle.GetRectangle(),
|
(update as UpdateStopObjectCreated).sourceRectangle.GetRectangle(),
|
||||||
(update as UpdateStopObjectCreated).tileSetName,
|
(update as UpdateStopObjectCreated).tileSetName,
|
||||||
|
@ -160,22 +197,18 @@ namespace ZoFo.GameCore
|
||||||
}
|
}
|
||||||
else if (update is UpdateGameObjectCreated)
|
else if (update is UpdateGameObjectCreated)
|
||||||
{
|
{
|
||||||
GameObject created_gameObject;
|
Entity created_gameObject;
|
||||||
if((update as UpdateGameObjectCreated).GameObjectType == "Player")
|
if ((update as UpdateGameObjectCreated).GameObjectType == "Player")
|
||||||
{
|
{
|
||||||
created_gameObject = new Player((update as UpdateGameObjectCreated).position);
|
created_gameObject = new Player((update as UpdateGameObjectCreated).position.GetVector2());
|
||||||
players.Add(created_gameObject as Player);
|
players.Add(created_gameObject as Player);
|
||||||
myPlayer = players[0];
|
myPlayer = players[0];
|
||||||
gameObjects.Add(created_gameObject);
|
gameObjects.Add(created_gameObject);
|
||||||
}
|
}
|
||||||
else if((update as UpdateGameObjectCreated).GameObjectType == "Ammo")
|
|
||||||
gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position));
|
|
||||||
else if((update as UpdateGameObjectCreated).GameObjectType == "Zombie")
|
|
||||||
gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Type t = Type.GetType("ZoFo.GameCore.GameObjects." + (update as UpdateGameObjectCreated).GameObjectType);
|
Type t = Type.GetType("ZoFo.GameCore.GameObjects." + (update as UpdateGameObjectCreated).GameObjectType);
|
||||||
GameObject gameObject = Activator.CreateInstance(t, (update as UpdateGameObjectCreated).position) as GameObject;
|
GameObject gameObject = Activator.CreateInstance(t, (update as UpdateGameObjectCreated).position.GetVector2()) as GameObject;
|
||||||
if (gameObject is Entity)
|
if (gameObject is Entity)
|
||||||
(gameObject as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity);
|
(gameObject as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity);
|
||||||
gameObjects.Add(gameObject);
|
gameObjects.Add(gameObject);
|
||||||
|
@ -183,12 +216,19 @@ namespace ZoFo.GameCore
|
||||||
(gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity);
|
(gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (update is UpdateGameObjectWithoutIdCreated)
|
||||||
|
{
|
||||||
|
Type t = Type.GetType("ZoFo.GameCore.GameObjects." + (update as UpdateGameObjectWithoutIdCreated).GameObjectClassName);
|
||||||
|
GameObject gameObject = Activator.CreateInstance(t, (update as UpdateGameObjectWithoutIdCreated).position.GetVector2()) as GameObject;
|
||||||
|
if (gameObject is Particle)
|
||||||
|
particles.Add(gameObject as Particle);
|
||||||
|
}
|
||||||
else if (update is UpdatePosition)
|
else if (update is UpdatePosition)
|
||||||
{
|
{
|
||||||
var ent = FindEntityById(update.IdEntity);
|
var ent = FindEntityById(update.IdEntity);
|
||||||
|
|
||||||
if (ent != null)
|
if (ent != null)
|
||||||
ent.position = (update as UpdatePosition).NewPosition;
|
ent.position = (update as UpdatePosition).NewPosition.GetVector2();
|
||||||
}
|
}
|
||||||
else if (update is UpdateAnimation)
|
else if (update is UpdateAnimation)
|
||||||
{
|
{
|
||||||
|
@ -205,6 +245,60 @@ namespace ZoFo.GameCore
|
||||||
DeleteObject(ent);
|
DeleteObject(ent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (update is UpdatePlayerParametrs)
|
||||||
|
{
|
||||||
|
UpdatePlayerHealth(update as UpdatePlayerParametrs);
|
||||||
|
}
|
||||||
|
else if (update is UpdateLoot)
|
||||||
|
{
|
||||||
|
if ((update as UpdateLoot).quantity == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ent = FindEntityById(update.IdEntity);
|
||||||
|
if (ent != null)
|
||||||
|
(ent as Player).lootData.AddLoot_Client((update as UpdateLoot).lootName, (update as UpdateLoot).quantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void UpdatePlayerHealth(UpdatePlayerParametrs update)
|
||||||
|
{
|
||||||
|
|
||||||
|
//check on player hp lowered
|
||||||
|
|
||||||
|
if (myPlayer != null)
|
||||||
|
{
|
||||||
|
float hpMyPlayerHp = myPlayer.health;
|
||||||
|
|
||||||
|
|
||||||
|
var entity = FindEntityById(update.IdEntity);
|
||||||
|
|
||||||
|
if (entity != null)
|
||||||
|
{
|
||||||
|
(entity as Player).health = (update as UpdatePlayerParametrs).health;
|
||||||
|
(entity as Player).rad = (update as UpdatePlayerParametrs).radiatoin;
|
||||||
|
}
|
||||||
|
if (entity.Equals(myPlayer))
|
||||||
|
{
|
||||||
|
if (hpMyPlayerHp > myPlayer.health)
|
||||||
|
{
|
||||||
|
AppManager.Instance.client.AddShaking((hpMyPlayerHp - myPlayer.health));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var ent = FindEntityById(update.IdEntity);
|
||||||
|
|
||||||
|
if (ent != null)
|
||||||
|
{
|
||||||
|
(ent as Player).health = (update as UpdatePlayerParametrs).health;
|
||||||
|
(ent as Player).rad = (update as UpdatePlayerParametrs).radiatoin;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +316,20 @@ namespace ZoFo.GameCore
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public void DeleteObject(Entity entity)
|
|
||||||
|
public void DeleteObject(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is Entity)
|
||||||
|
{
|
||||||
|
DeleteEntity(gameObject as Entity);
|
||||||
|
}
|
||||||
|
else if (gameObject is Particle)
|
||||||
|
{
|
||||||
|
if (particles.Contains(gameObject))
|
||||||
|
particles.Remove(gameObject as Particle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void DeleteEntity(Entity entity)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (gameObjects.Contains(entity))
|
if (gameObjects.Contains(entity))
|
||||||
|
|
|
@ -38,7 +38,7 @@ public abstract class AbstractGUI
|
||||||
|
|
||||||
public virtual void LoadContent()
|
public virtual void LoadContent()
|
||||||
{
|
{
|
||||||
Manager.LoadContent(AppManager.Instance.Content, "Font");
|
Manager.LoadContent(AppManager.Instance.Content, "Fonts/Font");
|
||||||
mouse = AppManager.Instance.Content.Load<Texture2D>("Textures/GUI/mouse");
|
mouse = AppManager.Instance.Content.Load<Texture2D>("Textures/GUI/mouse");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
52
ZoFo/GameCore/GUI/ExitGameGUI.cs
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
using System;
|
||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.ItemManager;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
|
public class ExitGameGUI : AbstractGUI
|
||||||
|
{
|
||||||
|
private DrawableUIElement menuBackground;
|
||||||
|
protected override void CreateUI()
|
||||||
|
{
|
||||||
|
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 / 5, (int)(width / 4), (int)(height / 20)), text = "Ты вышел из игры и потерял весь лут(((", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font4"});
|
||||||
|
|
||||||
|
Button endButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)),
|
||||||
|
text = "Exit",
|
||||||
|
scale = 0.3f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts/Font"
|
||||||
|
};
|
||||||
|
endButton.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||||
|
};
|
||||||
|
Elements.Add(endButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
}
|
95
ZoFo/GameCore/GUI/FinishingGUI.cs
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
using System;
|
||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.ItemManager;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
|
public class FinishingGUI : AbstractGUI
|
||||||
|
{
|
||||||
|
private List<ItemDisplayLabel> ItemDisplayLabelsList;
|
||||||
|
private int labelIndex = 0;
|
||||||
|
private DrawableUIElement menuBackground;
|
||||||
|
|
||||||
|
protected override void CreateUI()
|
||||||
|
{
|
||||||
|
ItemDisplayLabelsList = new List<ItemDisplayLabel>();
|
||||||
|
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/endGame" };
|
||||||
|
Elements.Add(menuBackground);
|
||||||
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 15, (int)(width / 4), (int)(height / 20)), text = "Mission completed", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||||
|
|
||||||
|
DrawableUIElement inventoryBack = new DrawableUIElement(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - height / 80 - width / 5 / 2,
|
||||||
|
height / 2 - (int)(height / 1.5) / 2,
|
||||||
|
height / 40 + width / 5, (int)(height / 1.5)),
|
||||||
|
mainColor = Color.LightGray
|
||||||
|
};
|
||||||
|
Elements.Add(inventoryBack);
|
||||||
|
|
||||||
|
Button ExitButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - width / 15 / 2,
|
||||||
|
height / 2 + (int)(height / 1.5) / 2 + height / 40, (int)(width / 15), (int)(height / 20)),
|
||||||
|
text = "Exit",
|
||||||
|
scale = 0.2f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts\\Font"
|
||||||
|
};
|
||||||
|
ExitButton.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new MainMenuGUI()); };
|
||||||
|
Elements.Add(ExitButton);
|
||||||
|
|
||||||
|
//player itams
|
||||||
|
foreach (var item in AppManager.Instance.client.myPlayer.lootData.loots)
|
||||||
|
{
|
||||||
|
if (item.Value > 0)
|
||||||
|
{
|
||||||
|
ItemInfo itemInfo = AppManager.Instance.ItemManager.GetItemInfo(item.Key);
|
||||||
|
var temp = new ItemDisplayLabel(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(
|
||||||
|
width / 2 - width / 5 / 2,
|
||||||
|
height / 2 - (int)(height / 1.5) / 2 + height / 80 +
|
||||||
|
(height / 20 + height / 80) * (labelIndex),
|
||||||
|
(int)(width / 5), (int)(height / 20)),
|
||||||
|
text1 = item.Key,
|
||||||
|
scale1 = 0.4f,
|
||||||
|
count = item.Value,
|
||||||
|
itemTextureName = itemInfo.textureName,
|
||||||
|
fontColor1 = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName1 = "Fonts\\Font4",
|
||||||
|
discriptions1 = itemInfo.description,
|
||||||
|
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft
|
||||||
|
};
|
||||||
|
Elements.Add(temp);
|
||||||
|
temp.Initialize();
|
||||||
|
temp.LoadTexture(AppManager.Instance.Content);
|
||||||
|
ItemDisplayLabelsList.Add(temp);
|
||||||
|
|
||||||
|
labelIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
@ -9,19 +10,43 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
using MonogameLibrary.UI.Elements;
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.ItemManager;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GUI;
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class GameEndedGUI : AbstractGUI
|
public class GameEndedGUI : AbstractGUI
|
||||||
{
|
{
|
||||||
|
private DrawableUIElement menuBackground;
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
|
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||||
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||||
|
|
||||||
|
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/endGame" };
|
||||||
|
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 = "The End", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||||
|
|
||||||
|
Button endButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)),
|
||||||
|
text = "End",
|
||||||
|
scale = 0.3f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts/Font"
|
||||||
|
};
|
||||||
|
endButton.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||||
|
};
|
||||||
|
Elements.Add(endButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,22 +15,74 @@ namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class HUD : AbstractGUI
|
public class HUD : AbstractGUI
|
||||||
{
|
{
|
||||||
|
private Bar hpBar;
|
||||||
|
private Bar radBar;
|
||||||
|
public AbstractGUI overlayGUI;
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int width = AppManager.Instance.CurentScreenResolution.X;
|
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||||
|
|
||||||
Button pauseButton = new Button(Manager)
|
Button pauseButton = 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"};
|
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "| |", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width - width / 30 - width / 40, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||||
Elements.Add(pauseButton);
|
Elements.Add(pauseButton);
|
||||||
pauseButton.LeftButtonPressed += () =>
|
pauseButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||||
AppManager.Instance.SetGUI(new PauseGUI());
|
AppManager.Instance.SetGUI(new PauseGUI());
|
||||||
|
//AppManager.Instance.SetGUI(new FinishingGUI());
|
||||||
|
overlayGUI = new PauseGUI();
|
||||||
|
overlayGUI.Initialize();
|
||||||
|
overlayGUI.LoadContent();
|
||||||
};
|
};
|
||||||
|
Button invButton = new Button(Manager)
|
||||||
|
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "inv", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width - width / 30 - width / 40, height / 15 + width / 40, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||||
|
Elements.Add(invButton);
|
||||||
|
invButton.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
overlayGUI = new InventoryGUI();
|
||||||
|
overlayGUI.Initialize();
|
||||||
|
overlayGUI.LoadContent();
|
||||||
|
};
|
||||||
|
|
||||||
|
hpBar = new Bar(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - width / 8 - width / 16, height - height / 10, width / 8, height / 25),
|
||||||
|
percent = 1f,
|
||||||
|
mainColor = Color.LightGray,
|
||||||
|
inColor = Color.Red
|
||||||
|
};
|
||||||
|
hpBar.Initialize();
|
||||||
|
hpBar.LoadTexture(AppManager.Instance.Content);
|
||||||
|
radBar = new Bar(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 + width / 16, height - height / 10, width / 8, height / 25),
|
||||||
|
percent = 0f,
|
||||||
|
mainColor = Color.LightGray,
|
||||||
|
inColor = Color.GreenYellow
|
||||||
|
};
|
||||||
|
radBar.Initialize();
|
||||||
|
radBar.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
overlayGUI?.Update(gameTime);
|
||||||
|
//hpBar.Update(gameTime, AppManager.Instance.client.myPlayer.health / 100f);
|
||||||
|
//radBar.Update(gameTime, AppManager.Instance.client.myPlayer.rad / 100f);
|
||||||
|
if (AppManager.Instance.client.myPlayer != null)
|
||||||
|
{
|
||||||
|
radBar.Update(gameTime, AppManager.Instance.client.myPlayer.rad / AppManager.Instance.client.myPlayer.MaxRad);
|
||||||
|
hpBar.Update(gameTime, AppManager.Instance.client.myPlayer.health / AppManager.Instance.client.myPlayer.MaxHealth);
|
||||||
|
|
||||||
|
}
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
overlayGUI?.Draw(spriteBatch);
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
@ -9,19 +10,83 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
using MonogameLibrary.UI.Elements;
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.ItemManager;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GUI;
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class InventoryGUI : AbstractGUI
|
public class InventoryGUI : AbstractGUI
|
||||||
{
|
{
|
||||||
|
private List<ItemDisplayButton> ItemDisplayButtonsList;
|
||||||
|
private int buttonIndex = 0;
|
||||||
|
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
|
ItemDisplayButtonsList = new List<ItemDisplayButton>();
|
||||||
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||||
|
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||||
|
|
||||||
|
DrawableUIElement inventoryBack = new DrawableUIElement(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - height / 80 - width / 5 / 2,
|
||||||
|
height / 2 - (int)(height / 1.5) / 2 - height / 10,
|
||||||
|
height / 40 + width / 5, (int)(height / 1.5)),
|
||||||
|
mainColor = Color.LightGray
|
||||||
|
};
|
||||||
|
Elements.Add(inventoryBack);
|
||||||
|
|
||||||
|
Button continueButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - width / 5 / 2,
|
||||||
|
height / 2 + (int)(height / 1.5) / 2 + height / 40 - height / 10, (int)(width / 5), (int)(height / 20)),
|
||||||
|
text = "Continue",
|
||||||
|
scale = 0.2f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts\\Font"
|
||||||
|
};
|
||||||
|
continueButton.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new HUD()); };
|
||||||
|
Elements.Add(continueButton);
|
||||||
|
|
||||||
|
//player itams
|
||||||
|
foreach (var item in AppManager.Instance.client.myPlayer.lootData.loots)
|
||||||
|
{
|
||||||
|
if (item.Value > 0)
|
||||||
|
{
|
||||||
|
ItemInfo itemInfo = AppManager.Instance.ItemManager.GetItemInfo(item.Key);
|
||||||
|
var temp = new ItemDisplayButton(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(
|
||||||
|
width / 2 - width / 5 / 2,
|
||||||
|
height / 2 - (int)(height / 1.5) / 2 + height / 80 +
|
||||||
|
(height / 20 + height / 80) * (buttonIndex) - height / 10,
|
||||||
|
(int)(width / 5), (int)(height / 20)),
|
||||||
|
text1 = item.Key,
|
||||||
|
scale1 = 0.3f,
|
||||||
|
count = item.Value,
|
||||||
|
itemTextureName = itemInfo.textureName,
|
||||||
|
fontColor1 = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName1 = "Fonts\\Font4",
|
||||||
|
discriptions1 = itemInfo.description,
|
||||||
|
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft
|
||||||
|
};
|
||||||
|
Elements.Add(temp);
|
||||||
|
temp.Initialize();
|
||||||
|
temp.LoadTexture(AppManager.Instance.Content);
|
||||||
|
ItemDisplayButtonsList.Add(temp);
|
||||||
|
temp.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
buttonIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,11 +44,11 @@ public class SelectModeMenu : AbstractGUI
|
||||||
// single
|
// single
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
Client client = new Client();
|
Client client = new Client();
|
||||||
server.CreateRoom(1);
|
|
||||||
client.JoinYourself(server.MyIp.Port);
|
|
||||||
AppManager.Instance.SetServer(server);
|
AppManager.Instance.SetServer(server);
|
||||||
AppManager.Instance.SetClient(client);
|
AppManager.Instance.SetClient(client);
|
||||||
AppManager.Instance.ChangeState(GameState.HostPlaying);
|
server.CreateRoom(false);
|
||||||
|
client.JoinYourself(server.MyIp.Port);
|
||||||
|
//AppManager.Instance.ChangeState(GameState.HostPlaying);
|
||||||
AppManager.Instance.SetGUI(new HUD());
|
AppManager.Instance.SetGUI(new HUD());
|
||||||
|
|
||||||
//server.CreateRoom(1);
|
//server.CreateRoom(1);
|
||||||
|
|
|
@ -74,6 +74,7 @@ public class SelectingServerGUI : AbstractGUI
|
||||||
{
|
{
|
||||||
if (int.TryParse(endpoint[1], out port))
|
if (int.TryParse(endpoint[1], out port))
|
||||||
{
|
{
|
||||||
|
|
||||||
client.JoinRoom(endpoint[0], port);
|
client.JoinRoom(endpoint[0], port);
|
||||||
AppManager.Instance.SetClient(client);
|
AppManager.Instance.SetClient(client);
|
||||||
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
|
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
|
||||||
|
@ -103,10 +104,10 @@ public class SelectingServerGUI : AbstractGUI
|
||||||
// host
|
// host
|
||||||
Server server = new Server(); //Server Logic MultiPlayer
|
Server server = new Server(); //Server Logic MultiPlayer
|
||||||
Client client = new Client();
|
Client client = new Client();
|
||||||
server.CreateRoom(2);
|
|
||||||
client.JoinYourself(server.MyIp.Port);
|
|
||||||
AppManager.Instance.SetServer(server);
|
AppManager.Instance.SetServer(server);
|
||||||
AppManager.Instance.SetClient(client);
|
AppManager.Instance.SetClient(client);
|
||||||
|
server.CreateRoom(true);
|
||||||
|
client.JoinYourself(server.MyIp.Port);
|
||||||
string key = server.MyIp.ToString();
|
string key = server.MyIp.ToString();
|
||||||
AppManager.Instance.debugHud.Set(key, "MultiPlayer");
|
AppManager.Instance.debugHud.Set(key, "MultiPlayer");
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class WaitingForPlayersGUI : AbstractGUI
|
||||||
// string pcIp =
|
// string pcIp =
|
||||||
|
|
||||||
// string pcIp =
|
// string pcIp =
|
||||||
ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font3" };
|
// ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font3" };
|
||||||
Elements.Add(ip);
|
// Elements.Add(ip);
|
||||||
if (isHost)
|
if (isHost)
|
||||||
{
|
{
|
||||||
ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font3" };
|
ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font3" };
|
||||||
|
@ -52,7 +52,7 @@ public class WaitingForPlayersGUI : AbstractGUI
|
||||||
startButton.LeftButtonPressed += () =>
|
startButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// start
|
// start
|
||||||
AppManager.Instance.ChangeState(GameState.HostPlaying);
|
AppManager.Instance.server.StartGame();
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(startButton);
|
Elements.Add(startButton);
|
||||||
|
@ -72,7 +72,6 @@ public class WaitingForPlayersGUI : AbstractGUI
|
||||||
waitButton.LeftButtonPressed += () =>
|
waitButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// start
|
// start
|
||||||
AppManager.Instance.ChangeState(GameState.ClientPlaying);
|
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(waitButton);
|
Elements.Add(waitButton);
|
||||||
|
|
|
@ -58,7 +58,6 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
Content.RootDirectory = "Content";
|
Content.RootDirectory = "Content";
|
||||||
IsMouseVisible = true;
|
IsMouseVisible = true;
|
||||||
|
|
||||||
server = new Server();
|
|
||||||
playerData = new PlayerData();
|
playerData = new PlayerData();
|
||||||
ItemManager = new ItemManager.ItemManager();
|
ItemManager = new ItemManager.ItemManager();
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
@ -107,7 +106,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
||||||
Keyboard.GetState().IsKeyDown(Keys.Escape)) { server?.CloseConnection(); Exit(); }
|
Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); }
|
||||||
|
|
||||||
|
|
||||||
// debugHud.Set("key", "value");
|
// debugHud.Set("key", "value");
|
||||||
|
|
|
@ -12,7 +12,9 @@ public class AssetManager
|
||||||
|
|
||||||
public AssetContainer Player = new()
|
public AssetContainer Player = new()
|
||||||
{
|
{
|
||||||
Animations = [ "player_look_down" ],
|
Animations = [ "player_look_down", "player_run_up", "player_run_down", "player_run_right",
|
||||||
|
"player_run_left", "player_run_right_up", "player_run_left_up", "player_run_right_down",
|
||||||
|
"player_run_left_down" ],
|
||||||
IdleAnimation = "player_look_down"
|
IdleAnimation = "player_look_down"
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -10,8 +10,10 @@ using Microsoft.Xna.Framework;
|
||||||
using ZoFo.GameCore.GameManagers.MapManager.MapElements;
|
using ZoFo.GameCore.GameManagers.MapManager.MapElements;
|
||||||
using ZoFo.GameCore.GameObjects.Entities;
|
using ZoFo.GameCore.GameObjects.Entities;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
using ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
||||||
|
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.CollisionManager
|
namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
|
@ -24,6 +26,25 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
public List<CollisionComponent> EntitiesWithMovements;
|
public List<CollisionComponent> EntitiesWithMovements;
|
||||||
public List<CollisionComponent> ObjectsWithTriggers;
|
public List<CollisionComponent> ObjectsWithTriggers;
|
||||||
|
|
||||||
|
public List<CollisionComponent> GetEntitiesToUpdate(Player player)
|
||||||
|
{
|
||||||
|
float ViewDistance = 500;
|
||||||
|
|
||||||
|
List<CollisionComponent> EntitiesInPlayerArea = new List<CollisionComponent>();
|
||||||
|
|
||||||
|
Rectangle ViewArea = new Rectangle((int)(player.position.X), (int)(player.position.Y),
|
||||||
|
(int)(ViewDistance), (int)(ViewDistance));
|
||||||
|
|
||||||
|
for (int i = 0; i < ObjectsWithCollisions.Count; i++)
|
||||||
|
{
|
||||||
|
if (ViewArea.Contains((float)ObjectsWithCollisions[i].gameObject.position.X, (float)ObjectsWithCollisions[i].gameObject.position.Y));
|
||||||
|
{
|
||||||
|
EntitiesInPlayerArea.Add(ObjectsWithCollisions[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EntitiesInPlayerArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//чекаем коллизии в листе
|
//чекаем коллизии в листе
|
||||||
|
|
||||||
|
@ -124,7 +145,7 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
|
|
||||||
entity.graphicsComponent.ObjectDrawRectangle.X = (int)entity.position.X;
|
entity.graphicsComponent.ObjectDrawRectangle.X = (int)entity.position.X;
|
||||||
entity.graphicsComponent.ObjectDrawRectangle.Y = (int)entity.position.Y;
|
entity.graphicsComponent.ObjectDrawRectangle.Y = (int)entity.position.Y;
|
||||||
AppManager.Instance.server.AddData(new UpdatePosition() { NewPosition = entity.position, IdEntity = entity.Id });
|
AppManager.Instance.server.AddData(new UpdatePosition() { NewPosition = new SerializableVector2(entity.position), IdEntity = entity.Id });
|
||||||
AppManager.Instance.debugHud.Set("testPos", entity.position.ToString()); //TODO remove
|
AppManager.Instance.debugHud.Set("testPos", entity.position.ToString()); //TODO remove
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +254,12 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
rectangle.Y += (int)origin.Y;
|
rectangle.Y += (int)origin.Y;
|
||||||
return rectangle;
|
return rectangle;
|
||||||
}
|
}
|
||||||
|
public static SerializableVector2 Serialize(this Vector2 vector) => new SerializableVector2(vector);
|
||||||
|
public static Vector2 RandomVector()
|
||||||
|
{
|
||||||
|
return new Vector2((float)Random.Shared.NextDouble() - 0.5f, (float)Random.Shared.NextDouble() - 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,11 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Formats.Tar;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection.Metadata.Ecma335;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ZoFo.GameCore.GUI;
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers
|
namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
public enum ScopeState { Idle, Left, Right, Top, Down, TopLeft, TopRight, DownLeft, DownRight }
|
public enum ScopeState { Idle, Left, Right, Top, Down, TopLeft, TopRight, DownLeft, DownRight }
|
||||||
|
|
||||||
public class InputManager
|
public class InputManager
|
||||||
{
|
{
|
||||||
public event Action ShootEvent; // событие удара(когда нажат X, событие срабатывает)
|
public event Action ShootEvent; // событие удара(когда нажат X, событие срабатывает)
|
||||||
|
@ -40,6 +33,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
private bool isInteract;
|
private bool isInteract;
|
||||||
|
|
||||||
private KeyboardState lastKeyboardState;
|
private KeyboardState lastKeyboardState;
|
||||||
|
private KeyboardState keyBoardState;
|
||||||
private GamePadState lastGamePadState;
|
private GamePadState lastGamePadState;
|
||||||
public ScopeState ScopeState { get => currentScopeState; }
|
public ScopeState ScopeState { get => currentScopeState; }
|
||||||
public string currentControlsState;
|
public string currentControlsState;
|
||||||
|
@ -161,13 +155,13 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
||||||
if (keyBoardState.IsKeyDown(Keys.P) && !isShoot)
|
if ((keyBoardState.IsKeyDown(Keys.P) || keyBoardState.IsKeyDown(Keys.F)) && !isShoot)
|
||||||
{
|
{
|
||||||
isShoot = true;
|
isShoot = true;
|
||||||
ShootEvent?.Invoke();
|
ShootEvent?.Invoke();
|
||||||
Debug.WriteLine("Выстрел");
|
Debug.WriteLine("Выстрел");
|
||||||
}
|
}
|
||||||
else if (keyBoardState.IsKeyUp(Keys.P))
|
else if (keyBoardState.IsKeyUp(Keys.F))
|
||||||
{
|
{
|
||||||
isShoot = false;
|
isShoot = false;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +170,6 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
#region Обработка взаимодействия с collectable(например лутом). Вызывает событие OnInteract
|
#region Обработка взаимодействия с collectable(например лутом). Вызывает событие OnInteract
|
||||||
if (keyBoardState.IsKeyDown(Keys.E) && !isInteract)
|
if (keyBoardState.IsKeyDown(Keys.E) && !isInteract)
|
||||||
{
|
{
|
||||||
|
|
||||||
OnInteract?.Invoke();
|
OnInteract?.Invoke();
|
||||||
Debug.WriteLine("взаимодействие с Collectable");
|
Debug.WriteLine("взаимодействие с Collectable");
|
||||||
}
|
}
|
||||||
|
@ -203,18 +196,33 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
DebugHUD.Instance.Set("controls", currentScopeState.ToString());
|
DebugHUD.Instance.Set("controls", currentScopeState.ToString());
|
||||||
}
|
}
|
||||||
#region работа с ScopeState и Vector2
|
#region работа с ScopeState и Vector2
|
||||||
|
/// <summary>
|
||||||
|
/// возвращает число от -14 до 16, начиная с
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vector"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int ConvertAttackVector2ToState(Vector2 vector){
|
||||||
|
int currentSection = (int)Math.Ceiling(Math.Atan2(vector.Y,
|
||||||
|
vector.X) * (180 / Math.PI) / 360 * 32);
|
||||||
|
return currentSection;
|
||||||
|
}
|
||||||
public ScopeState ConvertVector2ToState(Vector2 vector)
|
public ScopeState ConvertVector2ToState(Vector2 vector)
|
||||||
{
|
{
|
||||||
//if()
|
int currentSection = 0;
|
||||||
int currentSection = (int)Math.Ceiling(Math.Atan2(vector.Y,
|
if(vector.X == 0f && vector.Y == 0f){
|
||||||
|
currentScopeState = ScopeState.Idle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentSection = (int)Math.Ceiling(Math.Atan2(vector.Y,
|
||||||
vector.X) * (180 / Math.PI) / 360 * 16);
|
vector.X) * (180 / Math.PI) / 360 * 16);
|
||||||
|
|
||||||
DebugHUD.DebugSet("current section", currentSection.ToString());
|
|
||||||
//DebugHUD.DebugSet("y", InputMovementDirection.Y.ToString());
|
|
||||||
//DebugHUD.DebugSet("x", InputMovementDirection.X.ToString());
|
|
||||||
|
|
||||||
switch(currentSection)
|
switch(currentSection)
|
||||||
{
|
{
|
||||||
|
case -1:
|
||||||
|
currentScopeState = ScopeState.Idle;
|
||||||
|
break;
|
||||||
case 0 or 1:
|
case 0 or 1:
|
||||||
currentScopeState = ScopeState.Right;
|
currentScopeState = ScopeState.Right;
|
||||||
break;
|
break;
|
||||||
|
@ -242,8 +250,15 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugHUD.DebugSet("current section", currentSection.ToString());
|
||||||
|
DebugHUD.DebugSet("y", vector.Y.ToString());
|
||||||
|
DebugHUD.DebugSet("x", vector.X.ToString());
|
||||||
|
}
|
||||||
return currentScopeState;
|
return currentScopeState;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
public bool ButtonClicked(Keys key) => keyBoardState.IsKeyUp(key) && keyBoardState.IsKeyDown(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,10 +25,15 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
tagItemPairs = new Dictionary<string, ItemInfo>();
|
tagItemPairs = new Dictionary<string, ItemInfo>();
|
||||||
tagItemPairs.Add("wood", new ItemInfo("wood", "бревна кусок", "Textures\\Test\\wood",false,null));
|
tagItemPairs.Add("rottenflesh", new ItemInfo("rottenflesh", "БУХАТЬ", "Textures/icons/Collectables/RottenFlesh",false,null));
|
||||||
tagItemPairs.Add("rock", new ItemInfo("rock", "пять галек", "Textures\\Test\\rock", false, null));
|
tagItemPairs.Add("purebottleofwater", new ItemInfo("purebottleofwater", "БУХАТЬ 2", "Textures/icons/Collectables/PureBottleOfWater",false,null));
|
||||||
tagItemPairs.Add("steel", new ItemInfo("steel", "метал, метал, \nжелезо, метал", "Textures\\Test\\steel", false, null));
|
tagItemPairs.Add("bottleofwater", new ItemInfo("bottleofwater", "БУХАТЬ", "Textures/icons/Collectables/BottleOfWater",false,null));
|
||||||
tagItemPairs.Add("pickaxe", new ItemInfo("steel", "прямой путь к \nстановлению каменьщиком", "Textures\\Test\\pickaxe", true, new Dictionary<string, int>()
|
//tagItemPairs.Add("antiradin", new ItemInfo("antiradin", "радиацию опускает", "Textures/icons/Collectables/Ammo",false,null));
|
||||||
|
tagItemPairs.Add("ammo", new ItemInfo("ammo", "деньги в метро", "Textures/icons/Collectables/Ammo",false,null));
|
||||||
|
tagItemPairs.Add("wood", new ItemInfo("wood", "бревна кусок", "Textures/icons/Collectables/Wood",false,null));
|
||||||
|
tagItemPairs.Add("peeble", new ItemInfo("peeble", "пять галек", "Textures/icons/Collectables/Peeble", false, null));
|
||||||
|
tagItemPairs.Add("steel", new ItemInfo("steel", "метал, метал, \nжелезо, метал", "Textures/icons/Collectables/Steel", false, null));
|
||||||
|
tagItemPairs.Add("pickaxe", new ItemInfo("pickaxe", "прямой путь к \nстановлению каменьщиком", "Textures/Test/pickaxe", true, new Dictionary<string, int>()
|
||||||
{
|
{
|
||||||
{"wood", 2},
|
{"wood", 2},
|
||||||
{"steel", 3}
|
{"steel", 3}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
|
||||||
items = new Dictionary<string, int>();
|
items = new Dictionary<string, int>();
|
||||||
items.Add("wood", 5);
|
items.Add("wood", 5);
|
||||||
items.Add("steel", 110);
|
items.Add("steel", 110);
|
||||||
items.Add("rock", 6);
|
items.Add("peeble", 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
ZoFo/GameCore/GameManagers/MapManager/MapElements/Frame.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
|
{
|
||||||
|
public class Frame
|
||||||
|
{
|
||||||
|
public int Duration { get; set; }
|
||||||
|
public int TileId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,5 +11,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public ObjectGroup Objectgroup { get; set; }
|
public ObjectGroup Objectgroup { get; set; }
|
||||||
|
public List<Frame> Animation { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
private static readonly string _templatePath = "Content/MapData/TileMaps/{0}.tmj";
|
private static readonly string _templatePath = "Content/MapData/TileMaps/{0}.tmj";
|
||||||
private static readonly JsonSerializerOptions _options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; // Задача настроек для JsonSerialize
|
private static readonly JsonSerializerOptions _options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; // Задача настроек для JsonSerialize
|
||||||
private static readonly Dictionary<string, string> _classPath = new Dictionary<string, string>() {
|
private static readonly Dictionary<string, string> _classPath = new Dictionary<string, string>() {
|
||||||
{ "Collectables", "ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables." },
|
{ "Collectables", "ZoFo.GameCore.GameObjects." },
|
||||||
{ "Enemies", "ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies." }
|
{ "Enemies", "ZoFo.GameCore.GameObjects." }
|
||||||
};
|
};
|
||||||
|
|
||||||
//private static readonly float _scale = 1.0f;
|
//private static readonly float _scale = 1.0f;
|
||||||
|
@ -72,6 +72,13 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
if (tileSet.FirstGid <= chunk.Data[i])
|
if (tileSet.FirstGid <= chunk.Data[i])
|
||||||
{
|
{
|
||||||
int number = chunk.Data[i] - tileSet.FirstGid;
|
int number = chunk.Data[i] - tileSet.FirstGid;
|
||||||
|
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
|
||||||
|
|
||||||
|
|
||||||
|
if (tile.Animation is not null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int relativeColumn = number % tileSet.Columns;
|
int relativeColumn = number % tileSet.Columns;
|
||||||
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
|
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
|
||||||
|
@ -84,15 +91,15 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
(i % chunk.Width) * _tileMap.TileWidth + chunk.X * _tileMap.TileWidth,
|
(i % chunk.Width) * _tileMap.TileWidth + chunk.X * _tileMap.TileWidth,
|
||||||
(i / chunk.Height) * _tileMap.TileHeight + chunk.Y * _tileMap.TileHeight);
|
(i / chunk.Height) * _tileMap.TileHeight + chunk.Y * _tileMap.TileHeight);
|
||||||
|
|
||||||
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
|
|
||||||
|
|
||||||
switch (tile.Type)
|
switch (tile.Type)
|
||||||
{
|
{
|
||||||
|
|
||||||
case "Tile":
|
case "Tile":
|
||||||
AppManager.Instance.server.RegisterGameObject(new MapObject(position,
|
AppManager.Instance.server.RegisterGameObject(new MapObject(position,
|
||||||
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
||||||
sourceRectangle,
|
sourceRectangle,
|
||||||
"Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", "")));
|
"Content/Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", "")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "StopObject":
|
case "StopObject":
|
||||||
|
@ -101,7 +108,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
AppManager.Instance.server.RegisterGameObject(new StopObject(position,
|
AppManager.Instance.server.RegisterGameObject(new StopObject(position,
|
||||||
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
||||||
sourceRectangle,
|
sourceRectangle,
|
||||||
"Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""),
|
"Content/Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""),
|
||||||
collisionRectangles.ToArray()));
|
collisionRectangles.ToArray()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlTypes;
|
using System.Data.SqlTypes;
|
||||||
|
@ -10,47 +12,52 @@ using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager
|
namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
{
|
{
|
||||||
public class ClientNetworkManager
|
public class ClientNetworkManager
|
||||||
{
|
{
|
||||||
private int port = 0;
|
private int PlayerId;
|
||||||
private IPEndPoint endPoint;
|
private IPEndPoint endPoint;
|
||||||
|
private IPEndPoint sendingEP;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
List<UpdateData> updates = new List<UpdateData>();
|
List<UpdateData> updates = new List<UpdateData>();
|
||||||
|
private List<Datagramm> waitingDatagramm = new List<Datagramm>();
|
||||||
|
private int currentServerDatagrammId = 0;
|
||||||
public delegate void OnDataSent(string Data);
|
public delegate void OnDataSent(string Data);
|
||||||
public event OnDataSent GetDataSent; // event
|
public event OnDataSent GetDataSent; // event
|
||||||
public bool IsConnected { get { return socket.Connected; } }
|
public bool IsConnected { get { return socket.Connected; } }
|
||||||
public IPEndPoint InfoConnect => (IPEndPoint)socket.LocalEndPoint ?? endPoint;
|
public IPEndPoint InfoConnect => (IPEndPoint)socket.LocalEndPoint ?? endPoint;
|
||||||
|
|
||||||
public ClientNetworkManager()
|
public ClientNetworkManager()
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SocketConnected()
|
|
||||||
{
|
|
||||||
return socket.Connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init() //create endPoint, socket
|
public void Init() //create endPoint, socket
|
||||||
{
|
{
|
||||||
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
GetDataSent += AnalyzeData;
|
||||||
|
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
|
endPoint = new IPEndPoint(GetIp(), 8081);
|
||||||
|
socket.Bind(endPoint);
|
||||||
|
Thread thread = new Thread(StartListening);
|
||||||
|
thread.IsBackground = true;
|
||||||
|
thread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendData()
|
public void SendData()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < updates.Count; i++)
|
if (updates != null)
|
||||||
{
|
{
|
||||||
|
Datagramm Datagramm = new Datagramm();
|
||||||
AppManager.Instance.server.ProcessIUpdateData(updates[i]);
|
Datagramm.updateDatas = updates;
|
||||||
}
|
byte[] bytes = Encoding.UTF8.GetBytes(System.Text.Json.JsonSerializer.Serialize(Datagramm)); //нужно сериализовать
|
||||||
|
socket.SendTo(bytes, sendingEP);
|
||||||
updates.Clear();
|
updates.Clear();
|
||||||
return;// TODO remove
|
}
|
||||||
byte[] bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(updates)); //нужно сериализовать
|
|
||||||
socket.Send(bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddData(UpdateData UpdateData)
|
public void AddData(UpdateData UpdateData)
|
||||||
|
@ -58,12 +65,148 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
updates.Add(UpdateData);
|
updates.Add(UpdateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopConnection()
|
#region Working With Data RDP
|
||||||
|
|
||||||
|
public void AnalyzeData(string data)
|
||||||
{
|
{
|
||||||
socket.Shutdown(SocketShutdown.Both);
|
JObject jObj = JsonConvert.DeserializeObject(data) as JObject;
|
||||||
socket.Close();
|
JToken token = JToken.FromObject(jObj);
|
||||||
|
JToken updateDatas = token["updateDatas"];
|
||||||
|
if (updateDatas.HasValues)
|
||||||
|
{
|
||||||
|
Datagramm Dgramm = new Datagramm();
|
||||||
|
Dgramm.isImportant = token["isImportant"].ToObject<bool>();
|
||||||
|
Dgramm.DatagrammId = token["DatagrammId"].ToObject<int>();
|
||||||
|
if (PlayerId == 0)
|
||||||
|
{
|
||||||
|
PlayerId = token["PlayerId"].ToObject<int>();
|
||||||
|
if (AppManager.Instance.gamestate != GameState.HostPlaying)
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeState(GameState.ClientPlaying);
|
||||||
|
AppManager.Instance.SetGUI(new HUD());
|
||||||
|
}
|
||||||
|
SendAcknowledgement(Dgramm.DatagrammId);
|
||||||
|
}
|
||||||
|
if (Dgramm.isImportant)
|
||||||
|
{
|
||||||
|
if (Dgramm.DatagrammId == currentServerDatagrammId + 1)
|
||||||
|
{
|
||||||
|
currentServerDatagrammId++;
|
||||||
|
Dgramm.updateDatas = GetSentUpdates(token["updateDatas"]);
|
||||||
|
ExecuteDatagramm(Dgramm);
|
||||||
|
CheckDatagramm();
|
||||||
|
}
|
||||||
|
else if (Dgramm.DatagrammId > currentServerDatagrammId + 1 &&
|
||||||
|
waitingDatagramm.Find(x => x.DatagrammId == Dgramm.DatagrammId) == null)
|
||||||
|
{
|
||||||
|
Dgramm.updateDatas = GetSentUpdates(token["updateDatas"]);
|
||||||
|
waitingDatagramm.Add(Dgramm);
|
||||||
|
}
|
||||||
|
SendAcknowledgement(Dgramm.DatagrammId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dgramm.updateDatas = GetSentUpdates(token["updateDatas"]);
|
||||||
|
ExecuteDatagramm(Dgramm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UpdateData> GetSentUpdates(JToken updatesToken)
|
||||||
|
{
|
||||||
|
List<UpdateData> data = new List<UpdateData>();
|
||||||
|
JArray updateDatas = updatesToken as JArray;
|
||||||
|
UpdateData update = new UpdateData();
|
||||||
|
foreach (JObject token in updateDatas.Children())
|
||||||
|
{
|
||||||
|
switch (token["UpdateType"].ToObject<string>())
|
||||||
|
{
|
||||||
|
case "UpdateAnimation":
|
||||||
|
update = token.ToObject<UpdateAnimation>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateEntityHealth":
|
||||||
|
update = token.ToObject<UpdateEntityHealth>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateGameEnded":
|
||||||
|
update = token.ToObject<UpdateGameEnded>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateGameObjectCreated":
|
||||||
|
update = token.ToObject<UpdateGameObjectCreated>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateGameObjectDeleted":
|
||||||
|
update = token.ToObject<UpdateGameObjectDeleted>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateInteraction":
|
||||||
|
update = token.ToObject<UpdateInteraction>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateStopObjectCreated":
|
||||||
|
update = token.ToObject<UpdateStopObjectCreated>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateInteractionReady":
|
||||||
|
update = token.ToObject<UpdateInteractionReady>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateLoot":
|
||||||
|
update = token.ToObject<UpdateLoot>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdatePlayerParametrs":
|
||||||
|
update = token.ToObject<UpdatePlayerParametrs>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdatePosition":
|
||||||
|
update = token.ToObject<UpdatePosition>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateTileCreated":
|
||||||
|
update = token.ToObject<UpdateTileCreated>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendAcknowledgement(int DatagrammId)
|
||||||
|
{
|
||||||
|
|
||||||
|
Datagramm Dgramm = new Datagramm() { DatagrammId = DatagrammId, PlayerId = PlayerId };
|
||||||
|
string data = System.Text.Json.JsonSerializer.Serialize(Dgramm);
|
||||||
|
byte[] buffer = Encoding.UTF8.GetBytes(data);
|
||||||
|
socket.SendTo(buffer, sendingEP);
|
||||||
|
|
||||||
|
}
|
||||||
|
void CheckDatagramm()
|
||||||
|
{
|
||||||
|
Datagramm orderedDgramm = waitingDatagramm.Find(x => x.DatagrammId == currentServerDatagrammId + 1);
|
||||||
|
while (orderedDgramm != null)
|
||||||
|
{
|
||||||
|
currentServerDatagrammId++;
|
||||||
|
ExecuteDatagramm(orderedDgramm);
|
||||||
|
waitingDatagramm.Remove(orderedDgramm);
|
||||||
|
orderedDgramm = waitingDatagramm.Find(x => x.DatagrammId == currentServerDatagrammId + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void ExecuteDatagramm(Datagramm Dgramm)
|
||||||
|
{
|
||||||
|
|
||||||
|
AppManager.Instance.client.UpdatesList(Dgramm.updateDatas);
|
||||||
|
//Достаёт Update и передает в ивент
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region Join
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// приложение пытается подключиться к комнате
|
/// приложение пытается подключиться к комнате
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -71,19 +214,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
public void JoinRoom(string ip, int port) // multyplayer
|
public void JoinRoom(string ip, int port) // multyplayer
|
||||||
{
|
{
|
||||||
|
sendingEP = new IPEndPoint(IPAddress.Parse(ip), port);
|
||||||
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
|
AppManager.Instance.ChangeState(GameState.ClientPlaying);
|
||||||
socket.Connect(endPoint);
|
|
||||||
SendData();
|
|
||||||
Thread listen = new Thread(StartListening);
|
|
||||||
listen.IsBackground = true;
|
|
||||||
listen.Start();
|
|
||||||
}
|
|
||||||
public void JoinRoom(IPEndPoint endPoint) // multyplayer
|
|
||||||
{
|
|
||||||
|
|
||||||
this.endPoint = endPoint;
|
|
||||||
socket.Connect(endPoint);
|
|
||||||
SendData();
|
SendData();
|
||||||
Thread listen = new Thread(StartListening);
|
Thread listen = new Thread(StartListening);
|
||||||
listen.IsBackground = true;
|
listen.IsBackground = true;
|
||||||
|
@ -95,38 +227,45 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void JoinYourself(int port) // single player
|
public void JoinYourself(int port) // single player
|
||||||
{
|
{
|
||||||
endPoint = new IPEndPoint(GetIp(), port);
|
sendingEP = AppManager.Instance.server.MyIp;
|
||||||
socket.Connect(endPoint);
|
|
||||||
SendData();
|
SendData();
|
||||||
Thread listen = new Thread(StartListening);
|
Thread listen = new Thread(StartListening);
|
||||||
listen.IsBackground = true;
|
listen.IsBackground = true;
|
||||||
listen.Start();
|
listen.Start();
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
public static IPAddress GetIp()
|
public static IPAddress GetIp()
|
||||||
{
|
{
|
||||||
/*string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
||||||
var ipList = Dns.GetHostByName(hostName).AddressList;
|
var ipList = Dns.GetHostEntry(hostName).AddressList;
|
||||||
|
var ipV4List = new List<IPAddress>();
|
||||||
foreach (var ip in ipList)
|
foreach (var ip in ipList)
|
||||||
{
|
{
|
||||||
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||||
{
|
{
|
||||||
return ip;
|
ipV4List.Add(ip);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
return IPAddress.Parse("127.0.0.1");
|
if (ipV4List.Count>0)
|
||||||
|
{
|
||||||
|
return ipV4List[ipV4List.Count - 1];
|
||||||
|
}
|
||||||
|
return IPAddress.Loopback;
|
||||||
}
|
}
|
||||||
|
|
||||||
//поток 2
|
//поток 2
|
||||||
public void StartListening()
|
public void StartListening()
|
||||||
{
|
{
|
||||||
while(socket.Connected)
|
byte[] buffer = new byte[65535];
|
||||||
|
string data;
|
||||||
|
while (socket != null)
|
||||||
{
|
{
|
||||||
byte[] bytes = new byte[65535];
|
EndPoint senderRemote = new IPEndPoint(IPAddress.Any, 0);
|
||||||
var countAnsw = socket.Receive(bytes); //Вылетает если кто то закрыл
|
int size = socket.ReceiveFrom(buffer, buffer.Length, SocketFlags.None, ref senderRemote);
|
||||||
string update = Encoding.UTF8.GetString(bytes, 0, countAnsw); // обновление отосланные сервером
|
byte[] correctedBuffer = new byte[size];
|
||||||
GetDataSent(update);
|
Array.Copy(buffer, correctedBuffer, size);
|
||||||
|
data = Encoding.UTF8.GetString(correctedBuffer);
|
||||||
|
GetDataSent(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,11 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
||||||
{
|
{
|
||||||
public class SerializablePoint
|
public class SerializablePoint
|
||||||
{
|
{
|
||||||
public int X;
|
public int X { get; set; }
|
||||||
public int Y;
|
public int Y { get; set; }
|
||||||
|
|
||||||
public SerializablePoint(Point point) { X = point.X; Y = point.Y;}
|
public SerializablePoint(Point point) { X = point.X; Y = point.Y;}
|
||||||
|
public SerializablePoint() { }
|
||||||
public Point GetPoint() { return new Point(X, Y);}
|
public Point GetPoint() { return new Point(X, Y);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,24 +10,20 @@ using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
[JsonSerializable(typeof(SerializableRectangle))]
|
|
||||||
public class SerializableRectangle
|
public class SerializableRectangle
|
||||||
{
|
{
|
||||||
public SerializablePoint Size { get; set; }
|
public SerializablePoint Size { get; set; }
|
||||||
public SerializablePoint Location { get; set; }
|
public SerializablePoint Location { get; set; }
|
||||||
public int X { get; set; }
|
|
||||||
public int Y { get; set; }
|
|
||||||
public SerializableRectangle()
|
public SerializableRectangle()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SerializableRectangle(Rectangle rectangle) { X = rectangle.X; Y = rectangle.Y;
|
public SerializableRectangle(Rectangle rectangle) { Size = new SerializablePoint(rectangle.Size); Location = new SerializablePoint(rectangle.Location); }
|
||||||
Size = new SerializablePoint(rectangle.Size); Location = new SerializablePoint(rectangle.Location); }
|
|
||||||
|
|
||||||
public Rectangle GetRectangle()
|
public Rectangle GetRectangle()
|
||||||
{
|
{
|
||||||
return new Rectangle() { X = X, Y = Y, Size = Size.GetPoint(), Location = Location.GetPoint() };
|
return new Rectangle(Location.GetPoint(), Size.GetPoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.JavaScript;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SerializableVector2
|
||||||
|
{
|
||||||
|
public float X { get; set; }
|
||||||
|
public float Y { get; set; }
|
||||||
|
public SerializableVector2(Vector2 vector)
|
||||||
|
{
|
||||||
|
X = vector.X;
|
||||||
|
Y = vector.Y;
|
||||||
|
}
|
||||||
|
public Vector2 GetVector2()
|
||||||
|
{
|
||||||
|
return new Vector2(X, Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -13,23 +13,32 @@ using System.Text.Json.Serialization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
using ZoFo.GameCore.GUI;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager
|
namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
{
|
{
|
||||||
public class ServerNetworkManager
|
public class ServerNetworkManager
|
||||||
{
|
{
|
||||||
private IPAddress ip = IPAddress.Parse("127.0.0.1");
|
|
||||||
private const int port = 0;
|
|
||||||
private IPEndPoint endPoint;
|
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
private List<Socket> clients;
|
private IPAddress ip;
|
||||||
public List<UpdateData> updates;
|
private bool isMultiplayer;
|
||||||
|
//Player Id to Player endPoint
|
||||||
|
private List<IPEndPoint> clientsEP;
|
||||||
|
public IPEndPoint endPoint;
|
||||||
|
private List<UpdateData> commonUpdates;
|
||||||
|
private List<UpdateData> importantUpdates;
|
||||||
|
private List<Datagramm> sendedData;
|
||||||
|
private List<Datagramm> arrivingDataId;
|
||||||
|
private int currentDatagrammId = 0;
|
||||||
public delegate void OnDataSend(string data);
|
public delegate void OnDataSend(string data);
|
||||||
public event OnDataSend GetDataSend; // event
|
public event OnDataSend GetDataSend; // event
|
||||||
Dictionary<Socket, Thread> managerThread;
|
Thread serverThread;
|
||||||
Thread serverTheread;
|
int datapackSize = 150;
|
||||||
public IPEndPoint InfoConnect => (IPEndPoint)socket.LocalEndPoint ?? endPoint;
|
|
||||||
|
|
||||||
public ServerNetworkManager() { Init(); }
|
public ServerNetworkManager() { Init(); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -37,13 +46,18 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
endPoint = new IPEndPoint(GetIp(), port);
|
endPoint = new IPEndPoint(GetIp(), 8080);
|
||||||
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
managerThread = new Dictionary<Socket, Thread>();
|
clientsEP = new List<IPEndPoint>();
|
||||||
clients = new List<Socket>();
|
commonUpdates = new List<UpdateData>();
|
||||||
updates = new List<UpdateData>();
|
importantUpdates = new List<UpdateData>();
|
||||||
managerThread = new Dictionary<Socket, Thread>();
|
sendedData = new List<Datagramm>();
|
||||||
|
arrivingDataId = new List<Datagramm>();
|
||||||
|
|
||||||
|
GetDataSend += AnalyzeData;
|
||||||
|
|
||||||
socket.Bind(endPoint);
|
socket.Bind(endPoint);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -52,16 +66,26 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IPAddress GetIp()
|
public static IPAddress GetIp()
|
||||||
{
|
{
|
||||||
/*string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
||||||
var ipList = Dns.GetHostByName(hostName).AddressList;
|
var ipList = Dns.GetHostEntry(hostName).AddressList;
|
||||||
|
|
||||||
|
var ipV4List = new List<IPAddress>();
|
||||||
foreach (var ip in ipList)
|
foreach (var ip in ipList)
|
||||||
{
|
{
|
||||||
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||||
{
|
{
|
||||||
return ip;
|
ipV4List.Add(ip);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
return IPAddress.Parse("127.0.0.1");
|
if (ipV4List.Count > 0)
|
||||||
|
{
|
||||||
|
return ipV4List[ipV4List.Count - 1];
|
||||||
|
}
|
||||||
|
return IPAddress.Loopback;
|
||||||
|
}
|
||||||
|
public void SetIsMultiplayer(bool isMultiplayer)
|
||||||
|
{
|
||||||
|
this.isMultiplayer = isMultiplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -69,26 +93,76 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendData()
|
public void SendData()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < updates.Count; i++)
|
#region Network Sending SinglePlayerFix
|
||||||
{
|
//for (int i = 0; i < updates.Count; i++)
|
||||||
|
//{
|
||||||
|
|
||||||
AppManager.Instance.client.GotData(updates[i]);
|
// AppManager.Instance.client.GotData(updates[i]);
|
||||||
}
|
//}
|
||||||
updates.Clear();
|
//updates.Clear();
|
||||||
return; //TODO TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK
|
//return; //TODO TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK
|
||||||
//Что это?
|
//Что это?
|
||||||
//по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT
|
//по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT
|
||||||
List<UpdateData> datasToSend = new List<UpdateData>();
|
#endregion
|
||||||
for (int i = 0; i < 200 && i<updates.Count; i++)
|
if (arrivingDataId.Count != 0)
|
||||||
datasToSend.Add(updates[i]);
|
|
||||||
string data = JsonSerializer.Serialize(datasToSend);
|
|
||||||
var databytes = Encoding.UTF8.GetBytes(data);
|
|
||||||
foreach (Socket socket in clients)
|
|
||||||
{
|
{
|
||||||
clients[0].SendAsync(databytes);
|
List<Datagramm> actualArrivingId = arrivingDataId;
|
||||||
|
for (int i = 0; i < actualArrivingId.Count; i++)
|
||||||
|
{
|
||||||
|
sendedData.Remove(sendedData.Find(x => x.DatagrammId == actualArrivingId[i].DatagrammId
|
||||||
|
&& x.PlayerId == actualArrivingId[i].PlayerId));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 200 && i< datasToSend.Count; i++)
|
arrivingDataId.Clear();
|
||||||
updates.RemoveAt(0);
|
}
|
||||||
|
List<UpdateData> dataToSend;
|
||||||
|
if (importantUpdates.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < clientsEP.Count; i++)
|
||||||
|
{
|
||||||
|
dataToSend = new List<UpdateData>();
|
||||||
|
for (int j = 0; j < datapackSize && j < importantUpdates.Count; j++)
|
||||||
|
dataToSend.Add(importantUpdates[j]);
|
||||||
|
Datagramm impDgramm = new Datagramm();
|
||||||
|
impDgramm.DatagrammId = currentDatagrammId;
|
||||||
|
impDgramm.updateDatas = dataToSend;
|
||||||
|
impDgramm.isImportant = true;
|
||||||
|
impDgramm.PlayerId = i + 1;
|
||||||
|
sendedData.Add(impDgramm);
|
||||||
|
for (int j = 0; j < datapackSize && j < dataToSend.Count; j++)
|
||||||
|
importantUpdates.RemoveAt(0);
|
||||||
|
}
|
||||||
|
currentDatagrammId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sendedData.Count != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < clientsEP.Count; i++)
|
||||||
|
{
|
||||||
|
foreach (Datagramm Dgramm in sendedData.Where(x => x.PlayerId == i+1))
|
||||||
|
{
|
||||||
|
string impData = System.Text.Json.JsonSerializer.Serialize(Dgramm);
|
||||||
|
byte[] impBuffer = Encoding.UTF8.GetBytes(impData);
|
||||||
|
socket.SendTo(impBuffer, clientsEP[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Datagramm unImpDgramm = new Datagramm();
|
||||||
|
|
||||||
|
dataToSend = new List<UpdateData>();
|
||||||
|
for (int i = 0; i < 200 && i < commonUpdates.Count; i++)
|
||||||
|
dataToSend.Add(commonUpdates[i]);
|
||||||
|
|
||||||
|
unImpDgramm.updateDatas = dataToSend;
|
||||||
|
string data = System.Text.Json.JsonSerializer.Serialize(unImpDgramm);
|
||||||
|
byte[] buffer = Encoding.UTF8.GetBytes(data);
|
||||||
|
foreach (EndPoint sendingEP in clientsEP)
|
||||||
|
{
|
||||||
|
socket.SendTo(buffer, sendingEP);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 200 && i < dataToSend.Count; i++)
|
||||||
|
commonUpdates.RemoveAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -97,42 +171,41 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void AddData(UpdateData data)
|
public void AddData(UpdateData data)
|
||||||
{
|
{
|
||||||
updates.Add(data);
|
if (data.isImportant)
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// По сути конец игры и отключение игроков
|
|
||||||
/// </summary>
|
|
||||||
public void CloseConnection()
|
|
||||||
{
|
{
|
||||||
foreach (var item in clients)
|
importantUpdates.Add(data);
|
||||||
{
|
|
||||||
//Закрывает сокеты клиентов
|
|
||||||
item.Shutdown(SocketShutdown.Both);
|
|
||||||
item.Close();
|
|
||||||
}
|
}
|
||||||
foreach (var item in managerThread)
|
else {
|
||||||
{
|
commonUpdates.Add(data);
|
||||||
foreach (var socket in clients)
|
|
||||||
{
|
|
||||||
//Закрывает потоки клиентов
|
|
||||||
managerThread[socket].Interrupt();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//очищает листы
|
|
||||||
managerThread.Clear();
|
|
||||||
clients.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Начинает работу сервера (Ожидает подключений)
|
/// Начинает работу сервера (Ожидает подключений)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="players"></param>
|
/// <param name="players"></param>
|
||||||
public void Start(object players)
|
public void Start()
|
||||||
{
|
{
|
||||||
serverTheread = new Thread(StartWaitingForPlayers);
|
serverThread = new Thread(StartWaitingForPlayers);
|
||||||
serverTheread.IsBackground = true;
|
serverThread.IsBackground = true;
|
||||||
serverTheread.Start(players);
|
serverThread.Start();
|
||||||
|
}
|
||||||
|
public void StartGame()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < clientsEP.Count; i++)
|
||||||
|
{
|
||||||
|
Datagramm initDgramm = new Datagramm();
|
||||||
|
initDgramm.isImportant = true;
|
||||||
|
initDgramm.DatagrammId = currentDatagrammId;
|
||||||
|
initDgramm.PlayerId = i + 1;
|
||||||
|
sendedData.Add(initDgramm);
|
||||||
|
string data = System.Text.Json.JsonSerializer.Serialize(initDgramm);
|
||||||
|
byte[] buffer = Encoding.UTF8.GetBytes(data);
|
||||||
|
socket.SendTo(buffer, clientsEP[i]);
|
||||||
|
}
|
||||||
|
currentDatagrammId++;
|
||||||
|
AppManager.Instance.ChangeState(GameState.HostPlaying);
|
||||||
|
AppManager.Instance.SetGUI(new HUD());////
|
||||||
}
|
}
|
||||||
|
|
||||||
//Потоки Клиентов
|
//Потоки Клиентов
|
||||||
|
@ -140,43 +213,74 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// Слушает игроков, которые хотят подключиться
|
/// Слушает игроков, которые хотят подключиться
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="players"></param>
|
/// <param name="players"></param>
|
||||||
public void StartWaitingForPlayers(object players)
|
public void StartWaitingForPlayers()
|
||||||
{
|
{
|
||||||
int playNumber = (int)players;
|
byte[] buffer = new byte[65535];
|
||||||
|
string data;
|
||||||
socket.Listen(playNumber);
|
while (socket != null)
|
||||||
for (int i = 0; i < playNumber; i++)
|
|
||||||
{
|
{
|
||||||
Socket client = socket.Accept();
|
EndPoint senderRemote = (EndPoint)new IPEndPoint(IPAddress.Any, 0);
|
||||||
AppManager.Instance.debugHud.Log($"Connect {client.LocalEndPoint.ToString()}");
|
int size = socket.ReceiveFrom(buffer, buffer.Length, SocketFlags.None, ref senderRemote);
|
||||||
Thread thread = new Thread(StartListening);
|
if (AppManager.Instance.gamestate != GameState.HostPlaying && !clientsEP.Contains(senderRemote) &&
|
||||||
thread.IsBackground = true;
|
senderRemote != new IPEndPoint(IPAddress.Any, 0))
|
||||||
thread.Start(client);
|
{
|
||||||
managerThread.Add(client, thread);
|
clientsEP.Add((IPEndPoint)senderRemote);
|
||||||
clients.Add(client);
|
AppManager.Instance.debugHud.Log($"Connect {senderRemote.ToString()}");
|
||||||
//AppManager.Instance.ChangeState(GameState.HostPlaying);
|
if (!isMultiplayer) AppManager.Instance.ChangeState(GameState.HostPlaying);
|
||||||
//добавляем клиентов в лист
|
// Отправлять Init апдейт с информацией об ID игрока и ID датаграмма на сервере
|
||||||
|
//Можно добавить bool isInit для Датаграммов
|
||||||
}
|
}
|
||||||
AppManager.Instance.ChangeState(GameState.HostPlaying);
|
byte[] correctedBuffer = new byte[size];
|
||||||
}
|
Array.Copy(buffer, correctedBuffer, size);
|
||||||
|
data = Encoding.UTF8.GetString(correctedBuffer);
|
||||||
/// <summary>
|
GetDataSend(data);
|
||||||
/// начать слушать клиентов в самой игре активируют Ивент
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="socket"></param>
|
|
||||||
private void StartListening(object socket)
|
|
||||||
{
|
|
||||||
// obj to Socket
|
|
||||||
Socket client = (Socket)socket;
|
|
||||||
while (client.Connected)
|
|
||||||
{
|
|
||||||
var buff = new byte[65535];
|
|
||||||
var answ = client.Receive(buff);
|
|
||||||
string response = Encoding.UTF8.GetString(buff, 0, answ);
|
|
||||||
GetDataSend(response);
|
|
||||||
}
|
|
||||||
Task.Delay(-1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void AnalyzeData(string data)
|
||||||
|
{
|
||||||
|
JObject jObj = JsonConvert.DeserializeObject(data) as JObject;
|
||||||
|
JToken token = JToken.FromObject(jObj);
|
||||||
|
JToken updateDatas = token["updateDatas"];
|
||||||
|
Datagramm Dgramm = new Datagramm();
|
||||||
|
Dgramm.PlayerId = token["PlayerId"].ToObject<int>();
|
||||||
|
if (!updateDatas.HasValues)
|
||||||
|
{
|
||||||
|
//Обработка acknowledgement
|
||||||
|
Dgramm.DatagrammId = token["DatagrammId"].ToObject<int>();
|
||||||
|
arrivingDataId.Add(Dgramm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<UpdateData> updates = GetSentUpdates(updateDatas);
|
||||||
|
AppManager.Instance.server.UpdatesList(updates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public List<UpdateData> GetSentUpdates(JToken updatesToken)
|
||||||
|
{
|
||||||
|
List<UpdateData> data = new List<UpdateData>();
|
||||||
|
JArray updateDatas = updatesToken as JArray;
|
||||||
|
UpdateData update = new UpdateData();
|
||||||
|
foreach (JObject token in updateDatas.Children())
|
||||||
|
{
|
||||||
|
switch (token["UpdateType"].ToObject<string>())
|
||||||
|
{
|
||||||
|
case "UpdateInput":
|
||||||
|
update = token.ToObject<UpdateInput>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateInputInteraction":
|
||||||
|
update = token.ToObject<UpdateInputInteraction>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
case "UpdateInputShoot":
|
||||||
|
update = token.ToObject<UpdateInputShoot>();
|
||||||
|
data.Add(update);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,15 @@ using Microsoft.Xna.Framework;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
|
||||||
{
|
{
|
||||||
public class UpdateInput :UpdateData
|
public class UpdateInput :UpdateData
|
||||||
{
|
{
|
||||||
// public int IdEntity { get; set; }
|
// public int IdEntity { get; set; }
|
||||||
public Vector2 InputMovementDirection{get;set;}
|
public SerializableVector2 InputMovementDirection{get;set;}
|
||||||
public Vector2 InputAttackDirection {get;set;}
|
public SerializableVector2 InputAttackDirection {get;set;}
|
||||||
public UpdateInput()
|
public UpdateInput()
|
||||||
{
|
{
|
||||||
UpdateType = "UpdateInput";
|
UpdateType = "UpdateInput";
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
||||||
|
{
|
||||||
|
public class Datagramm
|
||||||
|
{
|
||||||
|
public int DatagrammId { get; set; }
|
||||||
|
public bool isImportant { get; set; }
|
||||||
|
public List<UpdateData> updateDatas { get; set; }
|
||||||
|
public int PlayerId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Хранит новое сосотяние анимации
|
||||||
|
/// </summary>
|
||||||
|
public class UpdateGameObjectWithoutIdCreated : UpdateData
|
||||||
|
{
|
||||||
|
public UpdateGameObjectWithoutIdCreated() { UpdateType = "UpdateGameObjectWithoutIdCreated"; }
|
||||||
|
public string GameObjectClassName { get; set; }
|
||||||
|
public SerializableVector2 position { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
|
@ -12,9 +13,12 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateGameObjectCreated : UpdateData
|
public class UpdateGameObjectCreated : UpdateData
|
||||||
{
|
{
|
||||||
public UpdateGameObjectCreated() { UpdateType = "UpdateGameObjectCreated"; }
|
public UpdateGameObjectCreated() { UpdateType = "UpdateGameObjectCreated"; isImportant = true; }
|
||||||
public string GameObjectType;
|
|
||||||
public string GameObjectId;
|
public string GameObjectType { get; set; }
|
||||||
public Vector2 position;
|
|
||||||
|
public string GameObjectId { get; set; }
|
||||||
|
|
||||||
|
public SerializableVector2 position { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateGameObjectDeleted : UpdateData
|
public class UpdateGameObjectDeleted : UpdateData
|
||||||
{
|
{
|
||||||
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; }
|
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; isImportant = false; }
|
||||||
public string GameObjectType;
|
public string GameObjectType;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,12 +11,16 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateLoot : UpdateData
|
public class UpdateLoot : UpdateData
|
||||||
{
|
{
|
||||||
public string lootName;
|
public string lootName { get; set; }
|
||||||
public UpdateLoot() { UpdateType = "UpdateLoot"; }
|
public int quantity { get; set; }
|
||||||
public UpdateLoot(string lootName)
|
public UpdateLoot() { UpdateType = "UpdateLoot"; isImportant = true; }
|
||||||
|
public UpdateLoot(string lootName, int quantity, int id)
|
||||||
{
|
{
|
||||||
UpdateType = "UpdateLoot";
|
UpdateType = "UpdateLoot";
|
||||||
this.lootName = lootName;
|
this.lootName = lootName;
|
||||||
|
this.quantity = quantity;
|
||||||
|
IdEntity = id;
|
||||||
|
isImportant = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
public class UpdatePlayerParametrs : UpdateData
|
public class UpdatePlayerParametrs : UpdateData
|
||||||
{
|
{
|
||||||
public UpdatePlayerParametrs() { UpdateType = "UpdatePlayerParametrs"; }
|
public UpdatePlayerParametrs() { UpdateType = "UpdatePlayerParametrs"; }
|
||||||
|
public float radiatoin;
|
||||||
|
public float health;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
using ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
|
@ -15,6 +16,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public UpdatePosition() { UpdateType = "UpdatePosition"; }
|
public UpdatePosition() { UpdateType = "UpdatePosition"; }
|
||||||
|
|
||||||
public Vector2 NewPosition { get; set; }
|
public SerializableVector2 NewPosition { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
internal class UpdateStopObjectCreated : UpdateData
|
internal class UpdateStopObjectCreated : UpdateData
|
||||||
{
|
{
|
||||||
public UpdateStopObjectCreated() { UpdateType = "UpdateStopObjectCreated"; }
|
public UpdateStopObjectCreated() { UpdateType = "UpdateStopObjectCreated"; isImportant = true; }
|
||||||
public Texture2D TextureTile { get; set; }
|
public Texture2D TextureTile { get; set; }
|
||||||
public Vector2 Position { get; set; }
|
public SerializableVector2 Position { get; set; }
|
||||||
public SerializablePoint Size { get; set; }
|
public SerializablePoint Size { get; set; }
|
||||||
public SerializableRectangle sourceRectangle { get; set; }
|
public SerializableRectangle sourceRectangle { get; set; }
|
||||||
public string tileSetName { get; set; }
|
public string tileSetName { get; set; }
|
||||||
|
|
|
@ -17,9 +17,9 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateTileCreated : UpdateData
|
public class UpdateTileCreated : UpdateData
|
||||||
{
|
{
|
||||||
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; }
|
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; isImportant = true; }
|
||||||
public Texture2D TextureTile { get; set; }
|
[JsonInclude]
|
||||||
public Vector2 Position { get; set; }
|
public SerializableVector2 Position { get; set; }
|
||||||
public SerializablePoint Size { get; set; }
|
public SerializablePoint Size { get; set; }
|
||||||
public SerializableRectangle sourceRectangle { get; set; }
|
public SerializableRectangle sourceRectangle { get; set; }
|
||||||
public string tileSetName { get; set; }
|
public string tileSetName { get; set; }
|
||||||
|
|
|
@ -15,19 +15,24 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
||||||
[JsonDerivedType(typeof(UpdateGameEnded))]
|
[JsonDerivedType(typeof(UpdateGameEnded))]
|
||||||
[JsonDerivedType(typeof(UpdateGameObjectCreated))]
|
[JsonDerivedType(typeof(UpdateGameObjectCreated))]
|
||||||
[JsonDerivedType(typeof(UpdateGameObjectDeleted))]
|
[JsonDerivedType(typeof(UpdateGameObjectDeleted))]
|
||||||
|
[JsonDerivedType(typeof(UpdateInteraction))]
|
||||||
|
[JsonDerivedType(typeof(UpdateInteractionReady))]
|
||||||
[JsonDerivedType(typeof(UpdateLoot))]
|
[JsonDerivedType(typeof(UpdateLoot))]
|
||||||
|
[JsonDerivedType(typeof(UpdateGameObjectWithoutIdCreated))]
|
||||||
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
|
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
|
||||||
[JsonDerivedType(typeof(UpdatePosition))]
|
[JsonDerivedType(typeof(UpdatePosition))]
|
||||||
|
[JsonDerivedType(typeof(UpdateStopObjectCreated))]
|
||||||
[JsonDerivedType(typeof(UpdateTileCreated))]
|
[JsonDerivedType(typeof(UpdateTileCreated))]
|
||||||
[JsonDerivedType(typeof(UpdateInput))]
|
[JsonDerivedType(typeof(UpdateInput))]
|
||||||
[JsonDerivedType(typeof(UpdatePlayerExit))]
|
[JsonDerivedType(typeof(UpdatePlayerExit))]
|
||||||
[JsonDerivedType(typeof(UpdateInteractionReady))]
|
[JsonDerivedType(typeof(UpdateInputInteraction))]
|
||||||
[JsonDerivedType(typeof(UpdateInteraction))]
|
[JsonDerivedType(typeof(UpdateInputShoot))]
|
||||||
|
|
||||||
public class UpdateData
|
public class UpdateData
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; } //Id объекта
|
public int IdEntity { get; set; } //Id объекта
|
||||||
public string UpdateType { get; protected set; } //тип обновления
|
public string UpdateType { get; set; } //тип обновления
|
||||||
|
public bool isImportant { get; set; }
|
||||||
|
|
||||||
public UpdateData()
|
public UpdateData()
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,11 +14,13 @@ namespace ZoFo.GameCore.GameObjects
|
||||||
//public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List<string> { "тут пишите название анимации" }, "сдублируйте " +
|
//public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List<string> { "тут пишите название анимации" }, "сдублируйте " +
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_idle" }, "zombie_idle");
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_idle" }, "zombie_idle");
|
||||||
|
|
||||||
public EntittyForAnimationTests(Vector2 position) : base(position)
|
public EntittyForAnimationTests(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*20, 16 * 20);
|
graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*20, 16 * 20);
|
||||||
|
|
||||||
position = new Vector2(10, 10);
|
position = new Vector2(10, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,11 @@ namespace ZoFo.GameCore.GameObjects
|
||||||
|
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void Delete()
|
||||||
|
{
|
||||||
|
AppManager.Instance.server.DeleteObject(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,26 +13,10 @@ using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
class Ammo:Collectable
|
class Ammo : Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Ammo");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Ammo");
|
||||||
public Ammo(Vector2 position) : base(position)
|
public Ammo(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
graphicsComponent.ObjectDrawRectangle.Width = 20;
|
|
||||||
graphicsComponent.ObjectDrawRectangle.Height = 20;
|
|
||||||
|
|
||||||
collisionComponent.triggerRectangle = new Rectangle(0, 0, 20, 20);
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
DebugHUD.DebugLog("collected");
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("Ammo"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
|
||||||
{
|
|
||||||
DrawDebugRectangle(spriteBatch, collisionComponent.triggerRectangle.SetOrigin(position), Color.Blue);
|
|
||||||
base.Draw(spriteBatch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,9 @@ using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
||||||
{
|
{
|
||||||
class Antiradine:Collectable
|
class Antiradine : Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new("Antiradine");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new("Antiradine");
|
||||||
public Antiradine(Vector2 position) : base(position)
|
public Antiradine(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("Antiradine"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,19 +10,12 @@ using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
public class BottleOfWater : Collectable
|
public class BottleOfWater : Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "BottleOfWater");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "BottleOfWater");
|
||||||
public BottleOfWater(Vector2 position) : base(position)
|
public BottleOfWater(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("BottleOfWater"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,44 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
public class Collectable : Interactable
|
public class Collectable : Interactable
|
||||||
{
|
{
|
||||||
protected static readonly string _path = "Textures/icons/Collectables/";
|
protected static readonly string _path = "Content/Textures/icons/Collectables/";
|
||||||
public Collectable(Vector2 position) : base(position)
|
public Collectable(Vector2 position) : base(position) {
|
||||||
{
|
|
||||||
|
graphicsComponent.ObjectDrawRectangle.Width = 20;
|
||||||
|
graphicsComponent.ObjectDrawRectangle.Height = 20;
|
||||||
|
|
||||||
|
collisionComponent.triggerRectangle.Width = 20;
|
||||||
|
collisionComponent.triggerRectangle.Height = 20;
|
||||||
|
|
||||||
|
|
||||||
|
int size = 10;
|
||||||
|
collisionComponent.triggerRectangle.X -= size;
|
||||||
|
collisionComponent.triggerRectangle.Y -= size;
|
||||||
|
collisionComponent.triggerRectangle.Width += 2*size;
|
||||||
|
collisionComponent.triggerRectangle.Height += 2*size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInteraction(GameObject sender)
|
public override void OnInteraction(GameObject sender)
|
||||||
{
|
{
|
||||||
//
|
DebugHUD.DebugLog("collected");
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot());
|
string lootname = this.GetType().ToString().ToLower().Split('.').Last();
|
||||||
|
(sender as Player).lootData.AddLoot(lootname, 1, (sender as Player).Id);
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
AppManager.Instance.server.DeleteObject(this);
|
||||||
|
base.OnInteraction(sender);
|
||||||
}
|
}
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
DrawDebugRectangle(spriteBatch, collisionComponent.triggerRectangle.SetOrigin(position), Color.Blue);
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,20 +10,12 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
public class Peeble:Collectable
|
public class Peeble:Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Peeble");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Peeble");
|
||||||
|
|
||||||
public Peeble(Vector2 position) : base(position)
|
public Peeble(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("Peeble"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,12 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
class PureBottleOfWater:Collectable
|
class PureBottleOfWater:Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "PureBottleOfWater");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "PureBottleOfWater");
|
||||||
|
|
||||||
public PureBottleOfWater(Vector2 position) : base(position)
|
public PureBottleOfWater(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("PureBottleOfWater"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,11 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
class RottenFlesh:Collectable
|
class RottenFlesh:Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "RottenFlesh");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "RottenFlesh");
|
||||||
public RottenFlesh(Vector2 position) : base(position)
|
public RottenFlesh(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("RottenFlesh"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,13 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
class Steel:Collectable
|
class Steel:Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Steel");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Steel");
|
||||||
|
|
||||||
public Steel(Vector2 position) : base(position)
|
public Steel(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("Steel"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,11 @@ using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
|
|
||||||
public class Wood : Collectable
|
public class Wood : Collectable
|
||||||
{
|
{
|
||||||
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Wood");
|
public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "Wood");
|
||||||
|
|
||||||
public Wood(Vector2 position) : base(position)
|
public Wood(Vector2 position) : base(position) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public override void OnInteraction(GameObject sender)
|
|
||||||
{
|
|
||||||
AppManager.Instance.server.AddData(new UpdateLoot("Wood"));
|
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
|
|
||||||
|
|
|
@ -4,18 +4,38 @@ using System.Net.Mime;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
public class Enemy : LivingEntity
|
public class Enemy : LivingEntity
|
||||||
{
|
{
|
||||||
protected float speed;
|
protected float speed;
|
||||||
protected int health;
|
protected float health = 5;
|
||||||
|
public bool isAttacking;
|
||||||
|
public bool isDying;
|
||||||
|
|
||||||
public Enemy(Vector2 position) : base(position)
|
public Enemy(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public virtual void TakeDamage(float damage)
|
||||||
|
{
|
||||||
|
if (isDying) return;
|
||||||
|
health -= damage;
|
||||||
|
if (health < 0)
|
||||||
|
Die();
|
||||||
|
}
|
||||||
|
public override void Die()
|
||||||
|
{
|
||||||
|
isDying = true;
|
||||||
|
base.Die();
|
||||||
|
}
|
||||||
|
public override void DeathEnd()
|
||||||
|
{
|
||||||
|
Delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@ namespace ZoFo.GameCore.GameObjects
|
||||||
class Zombie : Enemy
|
class Zombie : Enemy
|
||||||
{
|
{
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_damaged", "zombie_walk", "zombie_idle", "zombie_attack", "zombie_death" }, "zombie_walk");
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_damaged", "zombie_walk", "zombie_idle", "zombie_attack", "zombie_death" }, "zombie_walk");
|
||||||
public bool isAttacking;
|
|
||||||
public Zombie(Vector2 position) : base(position)
|
public Zombie(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
health = 5;
|
health = 5;
|
||||||
|
@ -29,13 +29,22 @@ namespace ZoFo.GameCore.GameObjects
|
||||||
StartAnimation("zombie_walk");
|
StartAnimation("zombie_walk");
|
||||||
collisionComponent.isTrigger = true;
|
collisionComponent.isTrigger = true;
|
||||||
collisionComponent.hasCollision = true;
|
collisionComponent.hasCollision = true;
|
||||||
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += EndAttack;
|
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += (animationIdEnded)=>{
|
||||||
|
if (animationIdEnded == "zombie_attack")
|
||||||
|
EndAttack(animationIdEnded);
|
||||||
|
};
|
||||||
collisionComponent.OnTriggerZone += OnPlayerClose;
|
collisionComponent.OnTriggerZone += OnPlayerClose;
|
||||||
collisionComponent.triggerRectangle = new Rectangle(-5, -5, 40, 40);
|
collisionComponent.triggerRectangle = new Rectangle(-5, -5, 40, 40);
|
||||||
|
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += (str) =>
|
||||||
|
{
|
||||||
|
if (str == "zombie_death")
|
||||||
|
DeathEnd();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
|
if (isDying) return;
|
||||||
float m = 10000000;
|
float m = 10000000;
|
||||||
int j = -1;
|
int j = -1;
|
||||||
for (int i = 0; i < AppManager.Instance.server.players.Count; i++)
|
for (int i = 0; i < AppManager.Instance.server.players.Count; i++)
|
||||||
|
@ -87,14 +96,34 @@ namespace ZoFo.GameCore.GameObjects
|
||||||
var damagedPlayers=AppManager.Instance.server.collisionManager.GetPlayersInZone(collisionComponent.triggerRectangle.SetOrigin(position));
|
var damagedPlayers=AppManager.Instance.server.collisionManager.GetPlayersInZone(collisionComponent.triggerRectangle.SetOrigin(position));
|
||||||
//TODO ДАМАЖИТЬ ИГРОКОВ В ЗОНЕ
|
//TODO ДАМАЖИТЬ ИГРОКОВ В ЗОНЕ
|
||||||
if (damagedPlayers.Length>0) { DebugHUD.DebugLog("End of" + a);
|
if (damagedPlayers.Length>0) { DebugHUD.DebugLog("End of" + a);
|
||||||
AppManager.Instance.server.DeleteObject(this);
|
foreach (var item in damagedPlayers)
|
||||||
|
item.TakeDamage(1);
|
||||||
}
|
}
|
||||||
isAttacking = false;
|
isAttacking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Die()
|
||||||
|
{
|
||||||
|
StartAnimation("zombie_death");
|
||||||
|
base.Die();
|
||||||
|
}
|
||||||
|
public override void DeathEnd()
|
||||||
|
{
|
||||||
|
|
||||||
|
Instantiate(new Particle(collisionComponent.stopRectangle.Location.ToVector2() + position + ExtentionClass.RandomVector() * 20));
|
||||||
|
Instantiate(new Particle(collisionComponent.stopRectangle.Location.ToVector2() + position + ExtentionClass.RandomVector() * 20));
|
||||||
|
Instantiate(new Particle(collisionComponent.stopRectangle.Location.ToVector2() + position + ExtentionClass.RandomVector() * 20));
|
||||||
|
|
||||||
|
base.DeathEnd();
|
||||||
|
}
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
DrawDebugRectangle(spriteBatch, collisionComponent.triggerRectangle.SetOrigin(position), Color.Blue);
|
DrawDebugRectangle(spriteBatch, collisionComponent.triggerRectangle.SetOrigin(position), Color.Blue);
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
public override void TakeDamage(float damage)
|
||||||
|
{
|
||||||
|
base.TakeDamage(damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,9 @@ public class LivingEntity : Entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 velocity;
|
public Vector2 velocity;
|
||||||
|
|
||||||
private InputManager inputManager;
|
|
||||||
|
|
||||||
public LivingEntity(Vector2 position) : base(position)
|
public LivingEntity(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
inputManager = new InputManager();
|
|
||||||
collisionComponent.hasCollision = true;
|
collisionComponent.hasCollision = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,17 +38,28 @@ public class LivingEntity : Entity
|
||||||
{
|
{
|
||||||
base.UpdateAnimations();
|
base.UpdateAnimations();
|
||||||
}
|
}
|
||||||
Vector2 prevPosition_forClient;
|
protected Vector2 prevPosition_forClient;
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
if ((position - prevPosition_forClient).X < 0)
|
if ((positionDraw - prevPosition_forClient).X < 0)
|
||||||
graphicsComponent.Flip = SpriteEffects.FlipHorizontally;
|
graphicsComponent.Flip = SpriteEffects.FlipHorizontally;
|
||||||
else if ((position - prevPosition_forClient).X > 0)
|
else if ((positionDraw - prevPosition_forClient).X > 0)
|
||||||
graphicsComponent.Flip = SpriteEffects.None;
|
graphicsComponent.Flip = SpriteEffects.None;
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
prevPosition_forClient = position;
|
prevPosition_forClient = positionDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void Die()
|
||||||
|
{
|
||||||
|
//deathSound + animationStart
|
||||||
|
}
|
||||||
|
public virtual void DeathEnd()
|
||||||
|
{
|
||||||
|
//deathSound + animationStart
|
||||||
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,37 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects
|
namespace ZoFo.GameCore.GameObjects
|
||||||
{
|
{
|
||||||
class LootData
|
public class LootData
|
||||||
{
|
{
|
||||||
public Dictionary<string, int> loots;
|
public Dictionary<string, int> loots;
|
||||||
|
|
||||||
public void AddLoot(string lootName, int quantity)
|
public void AddLoot(string lootName, int quantity, int id)
|
||||||
{
|
{
|
||||||
|
if (lootName == null)
|
||||||
|
{
|
||||||
|
DebugHUD.DebugLog("PROBLEM, loot is null");
|
||||||
|
DebugHUD.DebugLog("PROBLEM, loot is null");
|
||||||
|
DebugHUD.DebugLog("PROBLEM, loot is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AppManager.Instance.server.AddData(new UpdateLoot(lootName, quantity, id));
|
||||||
|
|
||||||
|
if (loots.ContainsKey(lootName))
|
||||||
|
loots[lootName] +=quantity;
|
||||||
|
else
|
||||||
|
loots.Add(lootName, quantity);
|
||||||
|
}
|
||||||
|
public void AddLoot_Client(string lootName, int quantity)
|
||||||
|
{
|
||||||
|
if (loots.ContainsKey(lootName))
|
||||||
|
loots[lootName] +=quantity;
|
||||||
|
else
|
||||||
loots.Add(lootName, quantity);
|
loots.Add(lootName, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using ZoFo.GameCore.GUI;
|
using ZoFo.GameCore.GUI;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
|
|
||||||
|
@ -18,22 +19,34 @@ public class Player : LivingEntity
|
||||||
{
|
{
|
||||||
public Vector2 InputWeaponRotation { get; set; }
|
public Vector2 InputWeaponRotation { get; set; }
|
||||||
public Vector2 InputPlayerRotation { get; set; }
|
public Vector2 InputPlayerRotation { get; set; }
|
||||||
|
|
||||||
|
private float speed;
|
||||||
|
public int reloading;
|
||||||
|
public float health = 100;
|
||||||
|
public float MaxHealth = 100;
|
||||||
|
|
||||||
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(AppManager.Instance.AssetManager.Player.Animations, AppManager.Instance.AssetManager.Player.IdleAnimation);
|
||||||
|
|
||||||
|
public AnimatedGraphicsComponent animatedGraphicsComponent => graphicsComponent as AnimatedGraphicsComponent;
|
||||||
|
|
||||||
|
public float rad = 0;
|
||||||
|
public float MaxRad = 100;
|
||||||
|
public LootData lootData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsTryingToInteract { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Факт того, что плеер в этом апдейте пытается стрелять
|
/// Факт того, что плеер в этом апдейте пытается стрелять
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//public bool IsTryingToShoot { get; set; }
|
|
||||||
private float speed;
|
|
||||||
private int health;
|
|
||||||
|
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(AppManager.Instance.AssetManager.Player);
|
|
||||||
|
|
||||||
private LootData lootData;
|
|
||||||
public bool IsTryingToInteract { get; set; }
|
|
||||||
public bool IsTryingToShoot { get; set; }
|
public bool IsTryingToShoot { get; set; }
|
||||||
public Player(Vector2 position) : base(position)
|
public Player(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
lootData = new LootData();
|
||||||
|
lootData.loots = new Dictionary<string, int>();
|
||||||
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 30, 30);
|
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 30, 30);
|
||||||
collisionComponent.stopRectangle = new Rectangle(0, 20, 30, 10);
|
collisionComponent.stopRectangle = new Rectangle(10, 15, 10, 15);
|
||||||
speed = 5;
|
speed = 5;
|
||||||
|
|
||||||
StartAnimation("player_look_down");
|
StartAnimation("player_look_down");
|
||||||
|
@ -42,69 +55,179 @@ public class Player : LivingEntity
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
#region анимация управления, стрельбы
|
#region название current текстуры
|
||||||
switch(AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation))
|
var idName = animatedGraphicsComponent.CurrentAnimation.Id;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region анимация управления подбора лута
|
||||||
|
DebugHUD.DebugSet("texture name", idName);
|
||||||
|
if (reloading > 0)
|
||||||
|
{
|
||||||
|
reloading--;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation))
|
||||||
{
|
{
|
||||||
case ScopeState.Top:
|
case ScopeState.Top:
|
||||||
|
if (idName != "player_run_up")
|
||||||
|
StartAnimation("player_run_up");
|
||||||
break;
|
break;
|
||||||
case ScopeState.Down:
|
case ScopeState.Down:
|
||||||
|
if (idName != "player_run_down")
|
||||||
|
StartAnimation("player_run_down");
|
||||||
break;
|
break;
|
||||||
case ScopeState.Right:
|
case ScopeState.Right:
|
||||||
//StartAnimation("player_running_top_rotate");
|
|
||||||
break;
|
|
||||||
case ScopeState.Left:
|
case ScopeState.Left:
|
||||||
|
if (idName != "player_run_right")
|
||||||
|
StartAnimation("player_run_right");
|
||||||
break;
|
break;
|
||||||
case ScopeState.TopRight:
|
case ScopeState.TopRight:
|
||||||
|
|
||||||
break;
|
|
||||||
case ScopeState.TopLeft:
|
case ScopeState.TopLeft:
|
||||||
|
if (idName != "player_run_right_up")
|
||||||
|
StartAnimation("player_run_right_up");
|
||||||
break;
|
break;
|
||||||
case ScopeState.DownRight:
|
case ScopeState.DownRight:
|
||||||
|
|
||||||
break;
|
|
||||||
case ScopeState.DownLeft:
|
case ScopeState.DownLeft:
|
||||||
|
if (idName != "player_run_right_down")
|
||||||
|
StartAnimation("player_run_right_down");
|
||||||
|
break;
|
||||||
|
case ScopeState.Idle:
|
||||||
|
if (idName != "player_look_down")
|
||||||
|
StartAnimation("player_look_down");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region анимация поворота оружия
|
||||||
|
int currentAttackSection = AppManager.Instance.InputManager.ConvertAttackVector2ToState(InputWeaponRotation);
|
||||||
|
switch (currentAttackSection)
|
||||||
|
{
|
||||||
|
case 0 or 1:
|
||||||
|
//right
|
||||||
|
break;
|
||||||
|
case 2 or 3:
|
||||||
|
//down_right_right
|
||||||
|
break;
|
||||||
|
case 4 or 5:
|
||||||
|
//down_right
|
||||||
|
break;
|
||||||
|
case 6 or 7:
|
||||||
|
//down_right_left
|
||||||
|
break;
|
||||||
|
case 8 or 9:
|
||||||
|
//down
|
||||||
|
break;
|
||||||
|
case 10 or 11:
|
||||||
|
//down_left_right
|
||||||
|
break;
|
||||||
|
case 12 or 13:
|
||||||
|
//down_left
|
||||||
|
break;
|
||||||
|
case 14 or 15:
|
||||||
|
//down_left_left
|
||||||
|
break;
|
||||||
|
case 16 or -14:
|
||||||
|
//left
|
||||||
|
break;
|
||||||
|
case -13 or -12:
|
||||||
|
//top_left_left
|
||||||
|
break;
|
||||||
|
case -11 or -10:
|
||||||
|
//top_left
|
||||||
|
break;
|
||||||
|
case -9 or -8:
|
||||||
|
//top_left_right
|
||||||
|
break;
|
||||||
|
case -7 or -6:
|
||||||
|
//top
|
||||||
|
break;
|
||||||
|
case -5 or -4:
|
||||||
|
//top_right_left
|
||||||
|
break;
|
||||||
|
case -3 or -2:
|
||||||
|
//top_right
|
||||||
|
break;
|
||||||
|
case -1 or 0:
|
||||||
|
//top_right_right
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
MovementLogic();
|
MovementLogic();
|
||||||
|
}
|
||||||
|
public void WeaponAttack()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public void MovementLogic()
|
public void MovementLogic()
|
||||||
{
|
{
|
||||||
velocity += InputPlayerRotation * speed;
|
velocity += InputPlayerRotation * speed;
|
||||||
|
DebugHUD.DebugSet("player pos server", position.ToString());
|
||||||
}
|
}
|
||||||
public void HandleNewInput(UpdateInput updateInput)
|
public void HandleNewInput(UpdateInput updateInput)
|
||||||
{
|
{
|
||||||
InputPlayerRotation = updateInput.InputMovementDirection;
|
InputPlayerRotation = updateInput.InputMovementDirection.GetVector2();
|
||||||
InputWeaponRotation = updateInput.InputAttackDirection;
|
InputWeaponRotation = updateInput.InputAttackDirection.GetVector2();
|
||||||
|
|
||||||
}
|
}
|
||||||
public void HandleInteract(UpdateInputInteraction updateInputInteraction)
|
public void HandleInteract(UpdateInputInteraction updateInputInteraction)
|
||||||
{
|
{
|
||||||
IsTryingToInteract = true;
|
IsTryingToInteract = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region MyRegion
|
||||||
|
|
||||||
|
public bool isDying;
|
||||||
|
public virtual void TakeDamage(float damage)
|
||||||
|
{
|
||||||
|
if (isDying) return;
|
||||||
|
health -= damage;
|
||||||
|
AppManager.Instance.server.AddData(new UpdatePlayerParametrs() { health = health, radiatoin = rad, IdEntity = Id });
|
||||||
|
if (health < 0)
|
||||||
|
Die();
|
||||||
|
}
|
||||||
|
public override void Die()
|
||||||
|
{
|
||||||
|
base.Die();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
public void HandleShoot(UpdateInputShoot updateInputShoot)
|
public void HandleShoot(UpdateInputShoot updateInputShoot)
|
||||||
{
|
{
|
||||||
|
if (reloading > 0)
|
||||||
|
return;
|
||||||
|
reloading = 5;
|
||||||
IsTryingToShoot = true;
|
IsTryingToShoot = true;
|
||||||
|
|
||||||
var rect = collisionComponent.stopRectangle.SetOrigin(position);
|
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputPlayerRotation), this);
|
||||||
rect.Width += 100;
|
|
||||||
rect.Height += 100;
|
|
||||||
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rect, this);
|
|
||||||
if (entities.Length>0)
|
|
||||||
{
|
|
||||||
DebugHUD.DebugSet("ent[0]", entities[0].ToString());
|
|
||||||
if (entities != null)
|
if (entities != null)
|
||||||
{
|
{
|
||||||
foreach (Entity entity in entities)
|
foreach (Entity entity in entities)
|
||||||
{
|
{
|
||||||
AppManager.Instance.server.DeleteObject(entity);
|
if (entity is Enemy)
|
||||||
|
{
|
||||||
|
(entity as Enemy).TakeDamage(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
|
||||||
|
DrawDebugRectangle(spriteBatch, GetDamageArea((position - prevPosition_forClient)), Color.Green);
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
public Rectangle GetDamageArea(Vector2 direction)
|
||||||
|
{
|
||||||
|
direction.Normalize();
|
||||||
|
var rect = collisionComponent.stopRectangle.SetOrigin(position);
|
||||||
|
int size = 10;
|
||||||
|
rect.X -= size;
|
||||||
|
rect.Y -= size;
|
||||||
|
rect.Width += 2 * size;
|
||||||
|
rect.Height += 2 * size;
|
||||||
|
rect = rect.SetOrigin(direction*15);
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,25 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player.PlayerAttacks
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player.PlayerAttacks
|
||||||
{
|
{
|
||||||
internal class SwordAttack : IPlayerWeaponAttack
|
internal class SwordAttack : IPlayerWeaponAttack
|
||||||
{
|
{
|
||||||
|
Rectangle rectangle;
|
||||||
|
public SwordAttack(){
|
||||||
|
}
|
||||||
|
public Rectangle Attack(Vector2 position){
|
||||||
|
rectangle = new Rectangle((int)position.X, (int)position.Y, 30, 10);
|
||||||
|
|
||||||
|
return rectangle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
27
ZoFo/GameCore/GameObjects/Entities/Particles/Particle.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameObjects
|
||||||
|
{
|
||||||
|
internal class Particle : GameObject
|
||||||
|
{
|
||||||
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "explosion_1" }, "explosion_1");
|
||||||
|
|
||||||
|
public Particle(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
graphicsComponent.ObjectDrawRectangle = new Rectangle(-30, -30,60,60).SetOrigin(position);
|
||||||
|
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += _ => {
|
||||||
|
|
||||||
|
AppManager.Instance.client.DeleteObject(this);
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,10 @@ public abstract class GameObject
|
||||||
graphicsComponent.Update();
|
graphicsComponent.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Instantiate(GameObject gameObject)
|
||||||
|
{
|
||||||
|
AppManager.Instance.server.RegisterGameObject(gameObject);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +58,7 @@ public abstract class GameObject
|
||||||
public void PlayAnimation_OnClient()
|
public void PlayAnimation_OnClient()
|
||||||
{
|
{
|
||||||
graphicsComponent.Update();
|
graphicsComponent.Update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -65,14 +70,19 @@ public abstract class GameObject
|
||||||
graphicsComponent.LoadContent();
|
graphicsComponent.LoadContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// for smooth client draw
|
||||||
|
/// </summary>
|
||||||
|
public Vector2 positionDraw;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Для клиента
|
/// Для клиента
|
||||||
/// Обновление, которое вызывается у клиента, для просмотра анимаций
|
/// Обновление, которое вызывается у клиента, для просмотра анимаций
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void UpdateAnimations()
|
public virtual void UpdateAnimations()
|
||||||
{
|
{
|
||||||
graphicsComponent.ObjectDrawRectangle.X = (int)position.X; //Move To place where Updates Sets your position
|
positionDraw = (position * 0.15f + positionDraw*0.85f);
|
||||||
graphicsComponent.ObjectDrawRectangle.Y = (int)position.Y;
|
graphicsComponent.ObjectDrawRectangle.X = (int)positionDraw.X; //Move To place where Updates Sets your position
|
||||||
|
graphicsComponent.ObjectDrawRectangle.Y = (int)positionDraw.Y;
|
||||||
PlayAnimation_OnClient();
|
PlayAnimation_OnClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|