v.0.4
This commit is contained in:
parent
aa6580dc22
commit
651feb9ee0
41 changed files with 305 additions and 65 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -43,7 +43,7 @@ namespace Bowling.Classes
|
|||
public void LoadContent(ContentManager manager)
|
||||
{
|
||||
arrow.LoadContent(manager);
|
||||
texture = manager.Load<Texture2D>("ball (2)");
|
||||
texture = manager.Load<Texture2D>("ball");
|
||||
radius = texture.Width / 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Text;
|
|||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using Newtonsoft.Json;
|
||||
using NetLib;
|
||||
|
||||
namespace Bowling.Classes
|
||||
{
|
||||
|
@ -12,18 +11,12 @@ namespace Bowling.Classes
|
|||
internal class Player
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
private string name { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("score")]
|
||||
private List<int> score { get; set; }
|
||||
public List<int> Score { get; set; }
|
||||
|
||||
|
||||
public Player(string name)
|
||||
{
|
||||
this.name = name;
|
||||
score = new List<int>();
|
||||
}
|
||||
|
||||
public string Serialize()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
|
@ -32,8 +25,8 @@ namespace Bowling.Classes
|
|||
public void Deserialize(string json)
|
||||
{
|
||||
Player player = JsonConvert.DeserializeObject<Player>(json);
|
||||
name = player.name;
|
||||
score = player.score;
|
||||
Name = player.Name;
|
||||
Score = player.Score;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ namespace Bowling.Classes.UI
|
|||
public Vector2 Position { get; set; }
|
||||
public string Text { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public string fontName = "gameFont";
|
||||
|
||||
public string FontName { set { fontName = value; } }
|
||||
|
||||
public Label()
|
||||
{
|
||||
|
@ -37,7 +40,7 @@ namespace Bowling.Classes.UI
|
|||
|
||||
public void LoadContent(ContentManager Content)
|
||||
{
|
||||
spriteFont = Content.Load<SpriteFont>("gameFont");
|
||||
spriteFont = Content.Load<SpriteFont>(fontName);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
/processorParam:TextureFormat=Compressed
|
||||
/build:gameFont.spritefont
|
||||
|
||||
#begin gameFont2.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:gameFont2.spritefont
|
||||
|
||||
#begin keggle.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
|
BIN
Bowling/Content/bin/Windows/Content/gameFont2.xnb
Normal file
BIN
Bowling/Content/bin/Windows/Content/gameFont2.xnb
Normal file
Binary file not shown.
BIN
Bowling/Content/bin/Windows/gameFont2.xnb
Normal file
BIN
Bowling/Content/bin/Windows/gameFont2.xnb
Normal file
Binary file not shown.
60
Bowling/Content/gameFont2.spritefont
Normal file
60
Bowling/Content/gameFont2.spritefont
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file contains an xml description of a font, and will be read by the XNA
|
||||
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||
of the font in your game, and to change the characters which are available to draw
|
||||
with.
|
||||
-->
|
||||
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||
<Asset Type="Graphics:FontDescription">
|
||||
|
||||
<!--
|
||||
Modify this string to change the font that will be imported.
|
||||
-->
|
||||
<FontName>Impact</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>36</Size>
|
||||
|
||||
<!--
|
||||
Spacing is a float value, measured in pixels. Modify this value to change
|
||||
the amount of spacing in between characters.
|
||||
-->
|
||||
<Spacing>0</Spacing>
|
||||
|
||||
<!--
|
||||
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||
will be used when placing characters.
|
||||
-->
|
||||
<UseKerning>true</UseKerning>
|
||||
|
||||
<!--
|
||||
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||
and "Bold, Italic", and are case sensitive.
|
||||
-->
|
||||
<Style>Regular</Style>
|
||||
|
||||
<!--
|
||||
If you uncomment this line, the default character will be substituted if you draw
|
||||
or measure text that contains characters which were not included in the font.
|
||||
-->
|
||||
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||
|
||||
<!--
|
||||
CharacterRegions control what letters are available in the font. Every
|
||||
character from Start to End will be built and made available for drawing. The
|
||||
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||
character set. The characters are ordered according to the Unicode standard.
|
||||
See the documentation for more information.
|
||||
-->
|
||||
<CharacterRegions>
|
||||
<CharacterRegion>
|
||||
<Start> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
|
@ -4,11 +4,12 @@
|
|||
<Platform>Windows</Platform>
|
||||
<Config />
|
||||
<SourceFiles>
|
||||
<File>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/arrow.png</File>
|
||||
<File>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/ball.png</File>
|
||||
<File>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/gameFont.spritefont</File>
|
||||
<File>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/keggle.png</File>
|
||||
<File>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/logo.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/arrow.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/ball.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont.spritefont</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont2.spritefont</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/keggle.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/logo.png</File>
|
||||
</SourceFiles>
|
||||
<DestFiles>
|
||||
<File xsi:nil="true" />
|
||||
|
@ -16,5 +17,6 @@
|
|||
<File xsi:nil="true" />
|
||||
<File xsi:nil="true" />
|
||||
<File xsi:nil="true" />
|
||||
<File xsi:nil="true" />
|
||||
</DestFiles>
|
||||
</SourceFileCollection>
|
|
@ -1,6 +1,7 @@
|
|||
Source File,Dest File,Processor Type,Content Type,Source File Size,Dest File Size,Build Seconds
|
||||
"C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/arrow.png","C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/arrow.xnb","TextureProcessor","Texture2DContent",365,2725,0,1655622
|
||||
"C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/ball.png","C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/ball.xnb","TextureProcessor","Texture2DContent",652,10085,0,0049702
|
||||
"C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/gameFont.spritefont","C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/gameFont.xnb","FontDescriptionProcessor","SpriteFontContent",2069,70690,0,1821461
|
||||
"C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/keggle.png","C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/keggle.xnb","TextureProcessor","Texture2DContent",276,4181,0,0110304
|
||||
"C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/logo.png","C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/logo.xnb","TextureProcessor","Texture2DContent",28661,504373,0,0495372
|
||||
"C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/arrow.png","C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/arrow.xnb","TextureProcessor","Texture2DContent",365,2725,0,1815462
|
||||
"C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/ball.png","C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/ball.xnb","TextureProcessor","Texture2DContent",652,10085,0,0060204
|
||||
"C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont.spritefont","C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/gameFont.xnb","FontDescriptionProcessor","SpriteFontContent",2069,70690,0,1249094
|
||||
"C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont2.spritefont","C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/gameFont2.xnb","FontDescriptionProcessor","SpriteFontContent",2069,136226,0,0442164
|
||||
"C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/keggle.png","C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/keggle.xnb","TextureProcessor","Texture2DContent",276,4181,0,0052916
|
||||
"C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/logo.png","C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/logo.xnb","TextureProcessor","Texture2DContent",28661,504373,0,0264658
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/arrow.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/ball.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont.spritefont</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont2.spritefont</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/keggle.png</File>
|
||||
<File>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/logo.png</File>
|
||||
</SourceFiles>
|
||||
|
@ -16,5 +17,6 @@
|
|||
<File xsi:nil="true" />
|
||||
<File xsi:nil="true" />
|
||||
<File xsi:nil="true" />
|
||||
<File xsi:nil="true" />
|
||||
</DestFiles>
|
||||
</SourceFileCollection>
|
22
Bowling/Content/obj/Windows/Content/gameFont2.mgcontent
Normal file
22
Bowling/Content/obj/Windows/Content/gameFont2.mgcontent
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont2.spritefont</SourceFile>
|
||||
<SourceTime>2022-04-23T14:47:06+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/Content/gameFont2.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:31.1175145+03:00</DestTime>
|
||||
<Importer>FontDescriptionImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>FontDescriptionProcessor</Processor>
|
||||
<ProcessorTime>2020-08-10T16:17:54+03:00</ProcessorTime>
|
||||
<Parameters>
|
||||
<Key>PremultiplyAlpha</Key>
|
||||
<Value>True</Value>
|
||||
</Parameters>
|
||||
<Parameters>
|
||||
<Key>TextureFormat</Key>
|
||||
<Value>Compressed</Value>
|
||||
</Parameters>
|
||||
<Dependencies />
|
||||
<BuildAsset />
|
||||
<BuildOutput />
|
||||
</PipelineBuildEvent>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/arrow.png</SourceFile>
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/arrow.png</SourceFile>
|
||||
<SourceTime>2022-04-23T00:23:58+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/arrow.xnb</DestFile>
|
||||
<DestTime>2022-04-23T11:30:46.7563702+03:00</DestTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/arrow.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:29.6382629+03:00</DestTime>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/ball.png</SourceFile>
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/ball.png</SourceFile>
|
||||
<SourceTime>2021-05-04T12:20:30+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/ball.xnb</DestFile>
|
||||
<DestTime>2022-04-23T11:30:46.7723273+03:00</DestTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/ball.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:29.6552207+03:00</DestTime>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/gameFont.spritefont</SourceFile>
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont.spritefont</SourceFile>
|
||||
<SourceTime>2011-04-01T09:42:38+04:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/gameFont.xnb</DestFile>
|
||||
<DestTime>2022-04-23T11:30:46.9518493+03:00</DestTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/gameFont.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:29.7826428+03:00</DestTime>
|
||||
<Importer>FontDescriptionImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>FontDescriptionProcessor</Processor>
|
||||
|
|
22
Bowling/Content/obj/Windows/gameFont2.mgcontent
Normal file
22
Bowling/Content/obj/Windows/gameFont2.mgcontent
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/gameFont2.spritefont</SourceFile>
|
||||
<SourceTime>2022-04-23T14:47:06+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/gameFont2.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:29.8289166+03:00</DestTime>
|
||||
<Importer>FontDescriptionImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>FontDescriptionProcessor</Processor>
|
||||
<ProcessorTime>2020-08-10T16:17:54+03:00</ProcessorTime>
|
||||
<Parameters>
|
||||
<Key>PremultiplyAlpha</Key>
|
||||
<Value>True</Value>
|
||||
</Parameters>
|
||||
<Parameters>
|
||||
<Key>TextureFormat</Key>
|
||||
<Value>Compressed</Value>
|
||||
</Parameters>
|
||||
<Dependencies />
|
||||
<BuildAsset />
|
||||
<BuildOutput />
|
||||
</PipelineBuildEvent>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/keggle.png</SourceFile>
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/keggle.png</SourceFile>
|
||||
<SourceTime>2022-04-23T00:12:43.2915834+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/keggle.xnb</DestFile>
|
||||
<DestTime>2022-04-23T11:30:46.9648137+03:00</DestTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/keggle.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:29.8349009+03:00</DestTime>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/logo.png</SourceFile>
|
||||
<SourceFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/logo.png</SourceFile>
|
||||
<SourceTime>2022-04-23T11:30:44.0139383+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/source/repos/Bowling/Bowling/Content/bin/Windows/logo.xnb</DestFile>
|
||||
<DestTime>2022-04-23T11:30:47.0166746+03:00</DestTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/ProgtimeHack2022_Bowling/Bowling/Content/bin/Windows/logo.xnb</DestFile>
|
||||
<DestTime>2022-04-23T16:59:29.8628251+03:00</DestTime>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<ImporterTime>2020-08-10T16:17:54+03:00</ImporterTime>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
|
|
142
Bowling/Game1.cs
142
Bowling/Game1.cs
|
@ -6,12 +6,13 @@ using Bowling.Classes.UI;
|
|||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using NetLib;
|
||||
using System.Threading;
|
||||
|
||||
namespace Bowling
|
||||
{
|
||||
public enum GameState
|
||||
{
|
||||
Menu, Game, Exit, Connect_to_server
|
||||
Menu, Game, Exit, Connect_to_server, EndGame
|
||||
}
|
||||
public class Game1 : Game
|
||||
{
|
||||
|
@ -35,14 +36,11 @@ namespace Bowling
|
|||
private Classes.UI.Label lblCountP1;
|
||||
private Classes.UI.Label lblCountP2;
|
||||
|
||||
private int knockedPins;
|
||||
|
||||
private List<Pin> pins = new List<Pin>();
|
||||
|
||||
public static GameState gameState = GameState.Connect_to_server;
|
||||
|
||||
Player player;
|
||||
|
||||
public static int Gutter_height { get { return gutter_height; } }
|
||||
public static int Gutter_top_y { get { return gutter_top_y; } }
|
||||
public static int Gutter_bottom_y { get { return gutter_bottom_y; } }
|
||||
|
@ -95,7 +93,6 @@ namespace Bowling
|
|||
ball.LoadContent(Content);
|
||||
whiteRectangle = new Texture2D(GraphicsDevice, 1, 1);
|
||||
whiteRectangle.SetData(new[] { Color.White });
|
||||
|
||||
menu.LoadContent(Content);
|
||||
}
|
||||
|
||||
|
@ -118,12 +115,17 @@ namespace Bowling
|
|||
if (connect.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
gameState = GameState.Menu;
|
||||
player = new Player(connec t.name); // Игрок, потом из него подключение к серверу
|
||||
gameState = GameState.Menu;
|
||||
player1 = new Player() { Name = connect.Name, Score = new List<int>() };
|
||||
NetLib.NetLib.IP = connect.IP;
|
||||
NetLib.NetLib.port = connect.Port;
|
||||
NetLib.NetLib.Connect();
|
||||
NetLib.NetLib.Send(player.Serialize());
|
||||
System.Console.WriteLine(NetLib.NetLib.Receive());
|
||||
SendPlayerData(player1);
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
player2.Deserialize(NetLib.NetLib.Receive());
|
||||
});
|
||||
thread.Start();
|
||||
}
|
||||
else { gameState = GameState.Exit; }
|
||||
break;
|
||||
|
@ -140,6 +142,7 @@ namespace Bowling
|
|||
switch (gameState)
|
||||
{
|
||||
case GameState.Game:
|
||||
DrawGrid();
|
||||
_spriteBatch.Draw(whiteRectangle, new Rectangle(0, gutter_top_y - gutter_height, 10000, gutter_height), Color.Aquamarine);
|
||||
_spriteBatch.Draw(whiteRectangle, new Rectangle(0, gutter_bottom_y, 10000, gutter_height), Color.Aquamarine);
|
||||
for (int i = 0; i < pins.Count; i++)
|
||||
|
@ -147,7 +150,10 @@ namespace Bowling
|
|||
pins[i].Draw(_spriteBatch);
|
||||
}
|
||||
ball.Draw(_spriteBatch);
|
||||
base.Draw(gameTime);
|
||||
foreach (Classes.UI.Label lbl in tableLabels)
|
||||
{
|
||||
lbl.Draw(_spriteBatch);
|
||||
}
|
||||
break;
|
||||
case GameState.Menu:
|
||||
menu.Draw(_spriteBatch);
|
||||
|
@ -165,13 +171,127 @@ namespace Bowling
|
|||
foreach (Pin pin in collides_keggles)
|
||||
{
|
||||
pin.IsVisible = false;
|
||||
knockedPins++;
|
||||
intermediateScore++;
|
||||
}
|
||||
if (ball.State == State.Gone)
|
||||
{
|
||||
player1.Score.Add(intermediateScore);
|
||||
intermediateScore = 0;
|
||||
ball = new Ball(ballStartPosition, Vector2.Zero, Color.Blue, Gutter_top_y, gutter_bottom_y, gutter_height, _graphics.PreferredBackBufferWidth);
|
||||
ball.LoadContent(Content);
|
||||
if (player1.Score.Count <= 20 && player1.Score.Count % 2 == 0)
|
||||
{
|
||||
NewMove();
|
||||
}
|
||||
else if (player1.Score.Count == 20)
|
||||
{
|
||||
if (player1.Score[18] + player1.Score[19] == 10) NewMove();
|
||||
}
|
||||
if (player1.Score.Count == 20 && player1.Score[18] + player1.Score[19] != 10)
|
||||
{
|
||||
gameState = GameState.EndGame;
|
||||
}
|
||||
SendPlayerData(player1);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetOpponentName()
|
||||
private void DrawGrid()
|
||||
{
|
||||
tableLabels.Clear();
|
||||
int currentRow = 0;
|
||||
int currentColumn = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
_spriteBatch.Draw(whiteRectangle, new Rectangle((i == 0 || i % 2 == 1) ? tableMarginLeft : tableMarginLeft + rowWidth,
|
||||
currentRow + tableMarginTop, (i == 0 || i % 2 == 1) ? 13 * rowWidth : 12 * rowWidth, 2), Color.Black);
|
||||
currentRow += (i != 0 && i % 2 == 0) ? 2 * rowHeight : rowHeight;
|
||||
}
|
||||
for (int i = 0; i < 13; i++)
|
||||
{
|
||||
_spriteBatch.Draw(whiteRectangle, new Rectangle(currentColumn + tableMarginLeft, tableMarginTop, 2, currentRow - rowHeight),
|
||||
Color.Black);
|
||||
currentColumn += (i == 10) ? 2 * rowWidth : rowWidth;
|
||||
}
|
||||
for (int i = 1; i < 11; i++)
|
||||
{
|
||||
int shift = (i == 10) ? tableMarginLeft - 5 + rowWidth * i + rowWidth : tableMarginLeft - 5 + rowWidth * i + rowWidth / 2;
|
||||
Classes.UI.Label lbl = new Classes.UI.Label(i.ToString(), new Vector2(shift, tableMarginTop + 2), Color.Red);
|
||||
lbl.LoadContent(Content);
|
||||
tableLabels.Add(lbl);
|
||||
}
|
||||
Classes.UI.Label label = new Classes.UI.Label("TTL", new Vector2(tableMarginLeft + currentColumn - 2 * rowWidth + 10, tableMarginTop + 5), Color.Red);
|
||||
label.LoadContent(Content);
|
||||
tableLabels.Add(label);
|
||||
for (int i = 0; i < player1.Score.Count; i++)
|
||||
{
|
||||
string score = (player1.Score[i] == 0) ? "-" : player1.Score[i].ToString();
|
||||
if (i != 0 && i % 2 == 1) score = (player1.Score[i] + player1.Score[i - 1] == 10) ? "/" : score;
|
||||
Classes.UI.Label lbl = new Classes.UI.Label(score, new Vector2(tableMarginLeft + rowWidth + i * (rowWidth / 2) + 10, tableMarginTop + rowHeight + 5),
|
||||
Color.Fuchsia);
|
||||
lbl.LoadContent(Content);
|
||||
tableLabels.Add(lbl);
|
||||
}
|
||||
for (int i = 0; i < player1.Score.Count / 2; i++)
|
||||
{
|
||||
int score = player1.Score[i * 2] + player1.Score[i * 2 + 1];
|
||||
Classes.UI.Label lbl = new Classes.UI.Label(score.ToString(), new Vector2(tableMarginLeft + rowWidth + i * rowWidth + 30, tableMarginTop + 2 * rowHeight + 25)
|
||||
, Color.Fuchsia);
|
||||
lbl.FontName = "gameFont2";
|
||||
lbl.LoadContent(Content);
|
||||
tableLabels.Add(lbl);
|
||||
}
|
||||
int countRows = 1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int score = 0;
|
||||
if (i % 2 == 0) score = 0;
|
||||
else if (i == 1) score = Sum(player1.Score);
|
||||
else score = Sum(player2.Score);
|
||||
Classes.UI.Label lbl = new Classes.UI.Label(score.ToString(), new Vector2(tableMarginLeft + rowWidth * 12 + rowWidth / 2, tableMarginTop + countRows + rowHeight + 5),
|
||||
Color.Fuchsia);
|
||||
lbl.LoadContent(Content);
|
||||
tableLabels.Add(lbl);
|
||||
countRows += (i != 0 && i % 2 == 1) ? 2 * rowHeight : rowHeight;
|
||||
}
|
||||
for (int i = 0; i < player2.Score.Count; i++)
|
||||
{
|
||||
string score = (player2.Score[i] == 0) ? "-" : player2.Score[i].ToString();
|
||||
if (i != 0 && i % 2 == 1) score = (player2.Score[i] + player2.Score[i - 1] == 10) ? "/" : score;
|
||||
Classes.UI.Label lbl = new Classes.UI.Label(score, new Vector2(tableMarginLeft + rowWidth + i * (rowWidth / 2) + 10, tableMarginTop + rowHeight * 4 + 5),
|
||||
Color.Fuchsia);
|
||||
lbl.LoadContent(Content);
|
||||
tableLabels.Add(lbl);
|
||||
}
|
||||
for (int i = 0; i < player2.Score.Count / 2; i++)
|
||||
{
|
||||
int score = player2.Score[i * 2] + player2.Score[i * 2 + 1];
|
||||
Classes.UI.Label lbl = new Classes.UI.Label(score.ToString(), new Vector2(tableMarginLeft + rowWidth + i * rowWidth + 30, tableMarginTop + 5 * rowHeight + 25)
|
||||
, Color.Fuchsia);
|
||||
lbl.FontName = "gameFont2";
|
||||
lbl.LoadContent(Content);
|
||||
tableLabels.Add(lbl);
|
||||
}
|
||||
}
|
||||
|
||||
private void NewMove()
|
||||
{
|
||||
pins.Clear();
|
||||
LoadContent();
|
||||
}
|
||||
|
||||
private int Sum(List<int> score)
|
||||
{
|
||||
int sum = 0;
|
||||
foreach (int a in score)
|
||||
{
|
||||
sum += a;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
private void SendPlayerData(Player player)
|
||||
{
|
||||
NetLib.NetLib.Send(player.Serialize());
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
BIN
Bowling/bin/Debug/netcoreapp3.1/Content/gameFont2.xnb
Normal file
BIN
Bowling/bin/Debug/netcoreapp3.1/Content/gameFont2.xnb
Normal file
Binary file not shown.
Binary file not shown.
|
@ -92,3 +92,4 @@ C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Bowling\obj
|
|||
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Bowling\obj\Debug\netcoreapp3.1\Bowling.dll
|
||||
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Bowling\obj\Debug\netcoreapp3.1\Bowling.pdb
|
||||
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Bowling\obj\Debug\netcoreapp3.1\Bowling.genruntimeconfig.cache
|
||||
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Bowling\bin\Debug\netcoreapp3.1\Content\gameFont2.xnb
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -9,23 +9,14 @@ namespace Bowling_Server.Classes
|
|||
internal class Player
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string name { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("score")]
|
||||
public List<int> score { get; set; }
|
||||
public List<int> Score { get; set; }
|
||||
|
||||
[NonSerialized]
|
||||
public Socket socket;
|
||||
|
||||
public Player(string name)
|
||||
{
|
||||
this.name = name;
|
||||
score = new List<int>();
|
||||
}
|
||||
public Player()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string Serialize()
|
||||
{
|
||||
|
@ -35,8 +26,8 @@ namespace Bowling_Server.Classes
|
|||
public void Deserialize(string json)
|
||||
{
|
||||
Player player = JsonConvert.DeserializeObject<Player>(json);
|
||||
name = player.name;
|
||||
score = player.score;
|
||||
Name = player.Name;
|
||||
Score = player.Score;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,22 @@ namespace Bowling_Server
|
|||
{
|
||||
Console.WriteLine("OK");
|
||||
CastOpponents(group);
|
||||
foreach (var player in group)
|
||||
{
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
byte[] data = new byte[1024];
|
||||
while (true)
|
||||
{
|
||||
int dataLength = player.socket.Receive(data);
|
||||
string json = Encoding.ASCII.GetString(data, 0, dataLength);
|
||||
player.Deserialize(json);
|
||||
CastOpponents(group);
|
||||
}
|
||||
}
|
||||
);
|
||||
thread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue