Merge branch 'DevelopmentX' into AddPlayers

This commit is contained in:
SergoDobro 2024-08-20 19:29:12 +03:00 committed by GitHub
commit 439009ad4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 3004 additions and 429 deletions

View file

@ -102,7 +102,8 @@ public class ItemDisplayButton : Button
fontColor2 = fontColor1,
fontName2 = fontName1,
scale2 = scale1,
itemTextureName1 = itemTextureName
itemTextureName1 = itemTextureName,
textureName = "Textures/GUI/Back"
};
hoverWindow.Initialize(content);
hoverWindow.LoadTexture(content);

View file

@ -111,7 +111,8 @@ public class ItemDisplayLabel : DrawableUIElement
fontColor2 = fontColor1,
fontName2 = fontName1,
scale2 = scale1,
itemTextureName1 = itemTextureName
itemTextureName1 = itemTextureName,
textureName = "Textures/GUI/Back"
};
hoverWindow.Initialize(content);
hoverWindow.LoadTexture(content);

View file

@ -83,6 +83,12 @@
/processorParam:Quality=Best
/build:sounds/Craft sound.wav
#begin sounds/gun-gunshot-01.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:sounds/gun-gunshot-01.wav
#begin sounds/Loot.wav
/importer:WavImporter
/processor:SoundEffectProcessor
@ -173,68 +179,74 @@
#begin Textures/Animations/player_left_idle.animation
/copy:Textures/Animations/player_left_idle.animation
#begin Textures/Animations/player_look_down_weapon.animation
/copy:Textures/Animations/player_look_down_weapon.animation
#begin Textures/Animations/player_look_down.animation
/copy:Textures/Animations/player_look_down.animation
#begin Textures/Animations/player_look_left_down_weapon.animation
/copy:Textures/Animations/player_look_left_down_weapon.animation
#begin Textures/Animations/player_look_left_down.animation
/copy:Textures/Animations/player_look_left_down.animation
#begin 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
/copy:Textures/Animations/player_look_left_weapon.animation
#begin Textures/Animations/player_look_down_weapon.animation
/copy:Textures/Animations/player_look_down_weapon.animation
#begin Textures/Animations/player_look_left.animation
/copy:Textures/Animations/player_look_left.animation
#begin Textures/Animations/player_look_right_down_weapon.animation
/copy:Textures/Animations/player_look_right_down_weapon.animation
#begin Textures/Animations/player_look_left_down.animation
/copy:Textures/Animations/player_look_left_down.animation
#begin Textures/Animations/player_look_right_down.animation
/copy:Textures/Animations/player_look_right_down.animation
#begin Textures/Animations/player_look_left_down_weapon.animation
/copy:Textures/Animations/player_look_left_down_weapon.animation
#begin Textures/Animations/player_look_right_up_weapon.animation
/copy:Textures/Animations/player_look_right_up_weapon.animation
#begin Textures/Animations/player_look_left_up.animation
/copy:Textures/Animations/player_look_left_up.animation
#begin Textures/Animations/player_look_right_up.animation
/copy:Textures/Animations/player_look_right_up.animation
#begin Textures/Animations/player_look_left_up_weapon.animation
/copy:Textures/Animations/player_look_left_up_weapon.animation
#begin Textures/Animations/player_look_right_weapon.animation
/copy:Textures/Animations/player_look_right_weapon.animation
#begin Textures/Animations/player_look_left_weapon.animation
/copy:Textures/Animations/player_look_left_weapon.animation
#begin Textures/Animations/player_look_right.animation
/copy:Textures/Animations/player_look_right.animation
#begin Textures/Animations/player_look_up_weapon.animation
/copy:Textures/Animations/player_look_up_weapon.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
/copy:Textures/Animations/player_look_right_down_weapon.animation
#begin Textures/Animations/player_look_right_up.animation
/copy:Textures/Animations/player_look_right_up.animation
#begin Textures/Animations/player_look_right_up_weapon.animation
/copy:Textures/Animations/player_look_right_up_weapon.animation
#begin Textures/Animations/player_look_right_weapon.animation
/copy:Textures/Animations/player_look_right_weapon.animation
#begin Textures/Animations/player_look_up.animation
/copy:Textures/Animations/player_look_up.animation
#begin Textures/Animations/player_look_up_weapon.animation
/copy:Textures/Animations/player_look_up_weapon.animation
#begin 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.animation
/copy:Textures/Animations/player_run_left.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.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_right_down.animation
/copy:Textures/Animations/player_run_right_down.animation
@ -242,12 +254,6 @@
#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
@ -287,18 +293,6 @@
#begin Textures/Animations/zombie_walk.animation
/copy:Textures/Animations/zombie_walk.animation
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.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_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_idle.png
/importer:TextureImporter
/processor:TextureProcessor
@ -311,6 +305,18 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_idle.png
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.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_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png
/importer:TextureImporter
/processor:TextureProcessor
@ -335,18 +341,6 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.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_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_running.png
/importer:TextureImporter
/processor:TextureProcessor
@ -359,6 +353,18 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_running.png
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.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_gun.png
#begin Textures/AnimationTextures/unicorn.png
/importer:TextureImporter
/processor:TextureProcessor
@ -395,7 +401,7 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png
#begin Textures/Effects/explosion.png
#begin Textures/Effects/explosion.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -405,7 +411,19 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/Effects/explosion.png
/build:Textures/Effects/explosion.png
#begin Textures/GUI/back.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/back.png
#begin Textures/GUI/background/base.png
/importer:TextureImporter
@ -491,7 +509,7 @@
/processorParam:TextureFormat=Color
/build:Textures/GUI/background/waiting.png
#begin Textures/GUI/checkboxs_off-on.png
#begin Textures/GUI/Button.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -501,7 +519,19 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/checkboxs_off-on.png
/build:Textures/GUI/Button.png
#begin Textures/GUI/Button2.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/Button2.png
#begin Textures/GUI/checkboxs_off.png
/importer:TextureImporter
@ -515,6 +545,18 @@
/processorParam:TextureFormat=Color
/build:Textures/GUI/checkboxs_off.png
#begin Textures/GUI/checkboxs_off-on.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/checkboxs_off-on.png
#begin Textures/GUI/checkboxs_on.png
/importer:TextureImporter
/processor:TextureProcessor
@ -551,18 +593,6 @@
/processorParam:TextureFormat=Color
/build:Textures/GUI/mouse.png
#begin Textures/GUI/Switch_backgrownd.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/Switch_backgrownd.png
#begin Textures/GUI/switch.png
/importer:TextureImporter
/processor:TextureProcessor
@ -575,6 +605,18 @@
/processorParam:TextureFormat=Color
/build:Textures/GUI/switch.png
#begin Textures/GUI/Switch_backgrownd.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/Switch_backgrownd.png
#begin Textures/icons/12.png
/importer:TextureImporter
/processor:TextureProcessor
@ -779,6 +821,30 @@
/processorParam:TextureFormat=Color
/build:Textures/icons/Collectables/Wood.png
#begin Textures/icons/ExitZone.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/icons/ExitZone.png
#begin Textures/icons/ExitZone.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/icons/ExitZone.png
#begin Textures/icons/Material/Fabric.png
/importer:TextureImporter
/processor:TextureProcessor

View file

@ -1,15 +1,24 @@
{
"activeFile": "TileMaps/main.tmj",
"expandedProjectPaths": [
"Templates",
"Templates/Zones",
"TileMaps",
".",
"Templates/Enemies"
],
"fileStates": {
"TileMaps/main.tmj": {
"scale": 0.33,
"selectedLayer": 0,
"scale": 2,
"selectedLayer": 1,
"viewCenter": {
"x": -463.63636363636374,
"y": 300
"x": -682.5,
"y": 1140.25
}
},
"TileSets/IconSet.tsj": {
"dynamicWrapping": true
"dynamicWrapping": true,
"scaleInDock": 1
},
"TileSets/TileSet 1.tsj": {
"dynamicWrapping": false,
@ -18,9 +27,21 @@
"TileSets/TilesetNature.tsj": {
"scaleInDock": 1.5
},
"TileSets/bonfire.tsj": {
"dynamicWrapping": false,
"scaleInDock": 1
},
"TileSets/tileset 1 collision.tsj": {
"dynamicWrapping": false,
"scaleInDock": 1
}
}
},
"last.objectTemplatePath": "C:/Users/artem/source/repos/ZoFo/ZoFo/Content/MapData/Templates/Zones",
"openFiles": [
"TileMaps/main.tmj"
],
"project": "MapSession.tiled-project",
"recentFiles": [
"TileMaps/main.tmj"
]
}

View file

@ -0,0 +1,12 @@
{ "object":
{
"height":124,
"id":218,
"name":"Exit",
"rotation":0,
"type":"",
"visible":true,
"width":74
},
"type":"template"
}

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

View file

@ -202,6 +202,7 @@ namespace ZoFo.GameCore
else if (update is UpdateGameObjectCreated)
{
//TODO
Entity created_gameObject;
if ((update as UpdateGameObjectCreated).GameObjectType == "Player")
{
@ -246,9 +247,13 @@ namespace ZoFo.GameCore
if (ent != null)
DeleteObject(ent);
}
else if (update is UpdatePlayerParametrs && update.IdEntity == myPlayer.Id) //aaa
}
else if (update is UpdateGameEnded)
{
GameEnd();
}
else if (update is UpdatePlayerParametrs && update.IdEntity == myPlayer.Id) //aaa
{
UpdatePlayerHealth(update as UpdatePlayerParametrs);
}
@ -309,10 +314,13 @@ namespace ZoFo.GameCore
{
(ent as Player).health = (update as UpdatePlayerParametrs).health;
(ent as Player).rad = (update as UpdatePlayerParametrs).radiatoin;
}
}
}
public void GameEnd()
{
AppManager.Instance.SetGUI(new FinishingGUI());
}
public Entity FindEntityById(int id)
{

View file

@ -54,14 +54,16 @@ public class BaseGUI : AbstractGUI
rectangle = new Rectangle(width / 2 - (height / 16 + (int)(width / 2.5)) / 2,
height / 2 - (int)(height / 1.5) / 2,
height / 40 + width / 5, (int)(height / 1.5)),
mainColor = Color.LightGray
mainColor = Color.LightGray,
textureName = "Textures/GUI/Back"
};
Elements.Add(baseItemBack);
DrawableUIElement baseCraftBack = new DrawableUIElement(Manager)
{
rectangle = new Rectangle(width / 2 + height / 160, height / 2 - (int)(height / 1.5) / 2,
height / 40 + width / 5, (int)(height / 1.5)),
mainColor = Color.LightGray
mainColor = Color.LightGray,
textureName = "Textures/GUI/Back"
};
Elements.Add(baseCraftBack);
@ -85,7 +87,8 @@ public class BaseGUI : AbstractGUI
mainColor = Color.Gray,
fontName1 = "Fonts\\Font4",
discriptions1 = itemInfo.description,
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft,
textureName = "Textures/GUI/Button"
};
Elements.Add(temp);
temp.Initialize();
@ -134,7 +137,8 @@ public class BaseGUI : AbstractGUI
mainColor = Color.Gray,
fontName1 = "Fonts\\Font4",
discriptions1 = itemInfo.description,
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft,
textureName = "Textures/GUI/Button"
};
Elements.Add(temp);
temp.Initialize();
@ -161,7 +165,7 @@ public class BaseGUI : AbstractGUI
{
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"
textureName = "Textures/GUI/Button2"
};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new MainMenuGUI());

View file

@ -36,7 +36,8 @@ public class ExitGameGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
endButton.LeftButtonPressed += () =>
{

View file

@ -38,7 +38,8 @@ public class FinishingGUI : AbstractGUI
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
mainColor = Color.LightGray,
textureName = "Textures/GUI/Back"
};
Elements.Add(inventoryBack);
@ -50,9 +51,20 @@ public class FinishingGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts\\Font",
textureName = "Textures/GUI/Button"
};
ExitButton.LeftButtonPressed += () => {
foreach (var item in AppManager.Instance.client.myPlayer.lootData.loots)
{
AppManager.Instance.playerData.AddLoot(item.Key, item.Value);
}
AppManager.Instance.SetGUI(new MainMenuGUI());
};
ExitButton.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new MainMenuGUI()); };
Elements.Add(ExitButton);
//player itams

View file

@ -36,7 +36,8 @@ public class GameEndedGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
endButton.LeftButtonPressed += () =>
{

View file

@ -23,8 +23,12 @@ public class HUD : AbstractGUI
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
Button pauseButton = new Button(Manager)
{ 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"};
Button pauseButton = new Button(Manager)
{
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/Button2"
};
Elements.Add(pauseButton);
pauseButton.LoadTexture(AppManager.Instance.Content);
pauseButton.LeftButtonPressed += () =>
@ -36,8 +40,12 @@ public class HUD : AbstractGUI
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"};
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/Button2"
};
Elements.Add(invButton);
invButton.LoadTexture(AppManager.Instance.Content);
invButton.LeftButtonPressed += () =>

View file

@ -31,7 +31,8 @@ public class InventoryGUI : AbstractGUI
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
mainColor = Color.LightGray,
textureName = "Textures/GUI/Back"
};
Elements.Add(inventoryBack);
@ -43,7 +44,8 @@ public class InventoryGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts\\Font",
textureName = "Textures/GUI/Button"
};
continueButton.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new HUD()); };
Elements.Add(continueButton);
@ -69,7 +71,8 @@ public class InventoryGUI : AbstractGUI
mainColor = Color.Gray,
fontName1 = "Fonts\\Font4",
discriptions1 = itemInfo.description,
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft
resourcesNeededToCraft1 = itemInfo.resourcesNeededToCraft,
textureName = "Texturs/GUI/Button"
};
Elements.Add(temp);
temp.Initialize();

View file

@ -36,7 +36,8 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
playButton.LeftButtonPressed += () =>
{
@ -51,7 +52,8 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts\\Font",
textureName = "Textures/GUI/Button"
};
baseButton.LeftButtonPressed += () =>
{
@ -66,7 +68,8 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
optionButton.LeftButtonPressed += () =>
{
@ -81,7 +84,8 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
exitButton.LeftButtonPressed += () =>
{

View file

@ -120,7 +120,11 @@ public class OptionsGUI : AbstractGUI
//--------------------------------------
Button bTExit = new Button(Manager)
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
{
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/Button2"
};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -27,7 +27,8 @@ public class PauseGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts\\Font",
textureName = "Textures/GUI/Button"
};
continueButton.LeftButtonPressed += () =>
{
@ -42,7 +43,8 @@ public class PauseGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts\\Font",
textureName = "Textures/GUI/Button"
};
exitButton.LeftButtonPressed += () =>
{

View file

@ -34,7 +34,8 @@ public class SelectModeMenu : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
singleButton.LeftButtonPressed += () =>
{
@ -67,7 +68,8 @@ public class SelectModeMenu : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
optionButton.LeftButtonPressed += () =>
{
@ -80,7 +82,11 @@ public class SelectModeMenu : AbstractGUI
Elements.Add(optionButton);
Button bTExit = new Button(Manager)
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
{
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/Button2"
};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -36,7 +36,8 @@ public class SelectingServerGUI : AbstractGUI
fontColor = Color.White,
mainColor = Color.Gray,
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left,
fontName = "Fonts/Font3"
fontName = "Fonts/Font3",
textureName = "Textures/GUI/Button"
};
ipBox.TextChanged += input =>
{
@ -61,7 +62,8 @@ public class SelectingServerGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
joinButton.LeftButtonPressed += () =>
{
@ -92,7 +94,8 @@ public class SelectingServerGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
hostButton.LeftButtonPressed += () =>
{
@ -112,7 +115,11 @@ public class SelectingServerGUI : AbstractGUI
Elements.Add(hostButton);
Button bTExit = new Button(Manager)
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off" };
{
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/Button2"
};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -47,7 +47,8 @@ public class WaitingForPlayersGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
startButton.LeftButtonPressed += () =>
{
@ -67,7 +68,8 @@ public class WaitingForPlayersGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
fontName = "Fonts/Font",
textureName = "Textures/GUI/Button"
};
waitButton.LeftButtonPressed += () =>
{
@ -79,7 +81,11 @@ public class WaitingForPlayersGUI : AbstractGUI
}
Button bTExit = new Button(Manager)
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
{
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/Button2"
};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -18,6 +18,15 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
LoadPlayerData();
}
public Dictionary<string, int> items = new Dictionary<string, int>();
public void AddLoot(string loot, int quantity)
{
if (items.ContainsKey(loot))
items[loot] += quantity;
else
items.Add(loot, quantity);
AppManager.Instance.playerData.SavePlayerData();
}
/// <summary>
/// Принимает тэг и крафтит этот объект
/// </summary>

View file

@ -21,7 +21,8 @@ namespace ZoFo.GameCore.GameManagers.MapManager
private static readonly JsonSerializerOptions _options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; // Задача настроек для JsonSerialize
private static readonly Dictionary<string, string> _classPath = new Dictionary<string, string>() {
{ "Collectables", "ZoFo.GameCore.GameObjects." },
{ "Enemies", "ZoFo.GameCore.GameObjects." }
{ "Enemies", "ZoFo.GameCore.GameObjects." },
{ "Zones", "ZoFo.GameCore.GameObjects." }
};
//private static readonly float _scale = 1.0f;

View file

@ -138,6 +138,10 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
update = token.ToObject<UpdateGameObjectCreated>();
data.Add(update);
break;
case "UpdateGameObjectWithoutIdCreated":
update = token.ToObject<UpdateGameObjectWithoutIdCreated>();
data.Add(update);
break;
case "UpdateGameObjectDeleted":
update = token.ToObject<UpdateGameObjectDeleted>();
data.Add(update);

View file

@ -12,6 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
public class UpdateGameObjectDeleted : UpdateData
{
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; isImportant = false; }
public string GameObjectType;
public string GameObjectType { get; set; }
}
}

View file

@ -111,9 +111,11 @@ namespace ZoFo.GameCore.GameObjects
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));
Instantiate(new Particle(position - collisionComponent.stopRectangle.Size.ToVector2() / 2 + ExtentionClass.RandomVector() * 20));
Instantiate(new Particle(position - collisionComponent.stopRectangle.Size.ToVector2() / 2 + ExtentionClass.RandomVector() * 20));
Instantiate(new Particle(position - collisionComponent.stopRectangle.Size.ToVector2() / 2 + ExtentionClass.RandomVector() * 20));
Instantiate(new Particle(position - collisionComponent.stopRectangle.Size.ToVector2() / 2 + ExtentionClass.RandomVector() * 20));
Instantiate(new Particle(position - collisionComponent.stopRectangle.Size.ToVector2() / 2 + ExtentionClass.RandomVector() * 20));
base.DeathEnd();
}

View file

@ -12,6 +12,7 @@ using ZoFo.GameCore.Graphics;
using System.Diagnostics;
using ZoFo.GameCore.GUI;
using System.Runtime.InteropServices;
using System.Linq;
namespace ZoFo.GameCore.GameObjects;
@ -221,7 +222,12 @@ public class Player : LivingEntity
{
InputPlayerRotation = updateInput.InputMovementDirection.GetVector2();
InputWeaponRotation = updateInput.InputAttackDirection.GetVector2();
DebugHUD.DebugSet("dir", InputWeaponRotation.ToString());
if (InputPlayerRotation.X != 0f || InputPlayerRotation.Y != 0f)
{
InputPlayerRotation /= (InputPlayerRotation.Length());
}
DebugHUD.DebugSet("dir", InputPlayerRotation.ToString());
DebugHUD.DebugSet("dir2", InputWeaponRotation.ToString());
}
public void HandleInteract(UpdateInputInteraction updateInputInteraction)
{
@ -252,18 +258,21 @@ public class Player : LivingEntity
reloading = 5;
IsTryingToShoot = true;
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation), this);
List<Entity> entities = AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation), this).ToList();
entities.AddRange(AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation, 2), this).ToList());
entities.AddRange(AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation, 3), this).ToList());
if (entities != null)
{
foreach (Entity entity in entities)
{
if (entity is Enemy)
{
for (int i = 0; i < 3; i++)
for (int i = 3; i <= 3; i++)
{
Instantiate(new Particle(
(collisionComponent.stopRectangle.Location.ToVector2() * i / 3f) +
(collisionComponent.stopRectangle.Location.ToVector2() * (3 - i) / 3f)
((position - graphicsComponent.ObjectDrawRectangle.Size.ToVector2() / 2) * (3 - i) / 3f) +
((entity.position - graphicsComponent.ObjectDrawRectangle.Size.ToVector2() / 2) * i / 3f) + ExtentionClass.RandomVector() * 3
));
}
@ -276,9 +285,11 @@ public class Player : LivingEntity
{
DrawDebugRectangle(spriteBatch, GetDamageArea(AppManager.Instance.InputManager.InputAttackDirection), Color.Green);
DrawDebugRectangle(spriteBatch, GetDamageArea(AppManager.Instance.InputManager.InputAttackDirection, 2), Color.Green);
DrawDebugRectangle(spriteBatch, GetDamageArea(AppManager.Instance.InputManager.InputAttackDirection, 3), Color.Green);
base.Draw(spriteBatch);
}
public Rectangle GetDamageArea(Vector2 direction)
public Rectangle GetDamageArea(Vector2 direction, float mult = 1)
{
direction.Normalize();
var rect = collisionComponent.stopRectangle.SetOrigin(position);
@ -287,7 +298,7 @@ public class Player : LivingEntity
rect.Y -= size;
rect.Width += 2 * size;
rect.Height += 2 * size;
rect = rect.SetOrigin(direction * 40);
rect = rect.SetOrigin(direction * 40 * mult);
return rect;
}
}

View file

@ -16,11 +16,16 @@ namespace ZoFo.GameCore.GameObjects
public Particle(Vector2 position) : base(position)
{
graphicsComponent.ObjectDrawRectangle = new Rectangle(-30, -30,60,60).SetOrigin(position);
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += _ => {
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0,60,60).SetOrigin(position);
AppManager.Instance.SoundManager.StartSound("gun-gunshot-01", Vector2.Zero, Vector2.Zero, 0.5f, (float)(Random.Shared.NextDouble()*2-1));
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += _ => {
if (AppManager.Instance.client!=null)
{
AppManager.Instance.client.DeleteObject(this);
}
};
}
}

View file

@ -0,0 +1,42 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects
{
public class ExitZone : Entity
{
public override GraphicsComponent graphicsComponent { get; } = new StaticGraphicsComponent("Content/Textures/icons/ExitZone");
public ExitZone(Vector2 position) : base(position)
{
collisionComponent.OnTriggerZone += Exit;
graphicsComponent.ObjectDrawRectangle.Width = 100;
graphicsComponent.ObjectDrawRectangle.Height = 100;
position = new Vector2(500f, 500f);
collisionComponent.isTrigger = true;
collisionComponent.triggerRectangle = new Rectangle(0, 0, 100, 100);
}
public void Exit(GameObject sender)
{
if (sender is Player &&
AppManager.Instance.server.collisionManager.GetPlayersInZone(collisionComponent.triggerRectangle.SetOrigin(position)).Length == AppManager.Instance.server.players.Count)
{
sender.position = new Vector2(0f, 0f);
AppManager.Instance.server.EndGame();
AppManager.Instance.debugHud.Set("Exit", sender.position.ToString());
}
}
}
}

View file

@ -24,6 +24,7 @@ public abstract class GameObject
graphicsComponent.ObjectDrawRectangle.X = (int)position.X;
graphicsComponent.ObjectDrawRectangle.Y = (int)position.Y;
positionDraw = position;
}
public virtual void UpdateLogic()
{

View file

@ -133,7 +133,7 @@ namespace ZoFo.GameCore
gameObjects = new List<GameObject>();
entities = new List<Entity>();
networkManager.StartGame();
new MapManager().LoadMap();
new MapManager().LoadMap();
//AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0)));
for (int i = 0; i < networkManager.clientsEP.Count; i++)
@ -141,11 +141,11 @@ namespace ZoFo.GameCore
Player player = new Player(new Vector2(760 - 30 * i, 140));
RegisterGameObject(player);
networkManager.AddData(new UpdateCreatePlayer() { PlayerId = i+1, IdEntity=player.Id});
}
}
//for (int i = 0; i < 20; i++)
// for (int j = 0; j < 20; j++)
// AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1300 + i*70, 1000+j*70)));
}
/// <summary>
@ -154,7 +154,8 @@ namespace ZoFo.GameCore
public void EndGame()
{
UpdateGameEnded gameEnded = new UpdateGameEnded();
networkManager.AddData(gameEnded);
networkManager.AddData(gameEnded);
// networkManager.CloseConnection();
}
public List<GameObject> gameObjects = new List<GameObject>();
@ -225,7 +226,6 @@ namespace ZoFo.GameCore
});
return;
}
if (gameObject is Entity entity)
{
AddData(new UpdateGameObjectCreated()