XNA sample zipped to enable autobuilding; many sample and unconnected sample now don't reference missing file
@@ -99,7 +99,6 @@
|
|||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
@@ -61,7 +61,6 @@
|
|||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
@@ -61,7 +61,6 @@
|
|||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
BIN
Samples/Old XNA sample.zip
Normal file
@@ -1,62 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
|
||||||
# Visual C# Express 2010
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XnaGameClient", "XnaGameClient\XnaGameClient.csproj", "{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XnaGameServer", "XnaGameServer\XnaGameServer.csproj", "{2A16EEC3-99B7-45D8-B185-6E1101225540}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "..\..\Lidgren.Network\Lidgren.Network.csproj", "{AE483C29-042E-4226-BA52-D247CE7676DA}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XnaGameClientContent", "XnaGameClient\Content\Content.contentproj", "{416F5A82-22D8-4A94-BC19-4C6A24F34A73}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
Release|Mixed Platforms = Release|Mixed Platforms
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Debug|Any CPU.ActiveCfg = Debug|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Debug|x86.ActiveCfg = Debug|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Debug|x86.Build.0 = Debug|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Release|Any CPU.ActiveCfg = Release|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Release|Mixed Platforms.Build.0 = Release|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Release|x86.ActiveCfg = Release|x86
|
|
||||||
{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}.Release|x86.Build.0 = Release|x86
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{2A16EEC3-99B7-45D8-B185-6E1101225540}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{416F5A82-22D8-4A94-BC19-4C6A24F34A73}.Debug|Any CPU.ActiveCfg = Debug|x86
|
|
||||||
{416F5A82-22D8-4A94-BC19-4C6A24F34A73}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
|
||||||
{416F5A82-22D8-4A94-BC19-4C6A24F34A73}.Debug|x86.ActiveCfg = Debug|x86
|
|
||||||
{416F5A82-22D8-4A94-BC19-4C6A24F34A73}.Release|Any CPU.ActiveCfg = Release|x86
|
|
||||||
{416F5A82-22D8-4A94-BC19-4C6A24F34A73}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
|
||||||
{416F5A82-22D8-4A94-BC19-4C6A24F34A73}.Release|x86.ActiveCfg = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ProjectGuid>416f5a82-22d8-4a94-bc19-4c6a24f34a73</ProjectGuid>
|
|
||||||
<ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
|
||||||
<XnaFrameworkVersion>v3.1</XnaFrameworkVersion>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<XnaPlatform>Windows</XnaPlatform>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<XnaPlatform>Windows</XnaPlatform>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.VideoImporters, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="c1.png">
|
|
||||||
<Name>c1</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="c2.png">
|
|
||||||
<Name>c2</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="c3.png">
|
|
||||||
<Name>c3</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="c4.png">
|
|
||||||
<Name>c4</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="c5.png">
|
|
||||||
<Name>c5</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 9.5 KiB |
@@ -1,2 +0,0 @@
|
|||||||
D:\dev\GoogleCode\lidgren-network\Generation3\Samples\XNA sample\XnaGameClient\XnaGameClient\Content\obj\x86\Debug\ResolveAssemblyReference.cache
|
|
||||||
D:\dev\GoogleCode\lidgren-network\Generation3\Samples\XNA sample\XnaGameClient\Content\obj\x86\Debug\ResolveAssemblyReference.cache
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline">
|
|
||||||
<Asset Type="Pipeline:BuildItemCollection">
|
|
||||||
<Item>
|
|
||||||
<Source>c1.png</Source>
|
|
||||||
<Name>c1</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
<Options>None</Options>
|
|
||||||
<Output>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\bin\x86\Debug\Content\c1.xnb</Output>
|
|
||||||
<Time>2010-10-19T20:01:33.7036561+02:00</Time>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Source>c2.png</Source>
|
|
||||||
<Name>c2</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
<Options>None</Options>
|
|
||||||
<Output>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\bin\x86\Debug\Content\c2.xnb</Output>
|
|
||||||
<Time>2010-10-19T20:01:33.7036561+02:00</Time>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Source>c3.png</Source>
|
|
||||||
<Name>c3</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
<Options>None</Options>
|
|
||||||
<Output>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\bin\x86\Debug\Content\c3.xnb</Output>
|
|
||||||
<Time>2010-10-19T20:01:33.7036561+02:00</Time>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Source>c4.png</Source>
|
|
||||||
<Name>c4</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
<Options>None</Options>
|
|
||||||
<Output>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\bin\x86\Debug\Content\c4.xnb</Output>
|
|
||||||
<Time>2010-10-19T20:01:33.7036561+02:00</Time>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Source>c5.png</Source>
|
|
||||||
<Name>c5</Name>
|
|
||||||
<Importer>TextureImporter</Importer>
|
|
||||||
<Processor>TextureProcessor</Processor>
|
|
||||||
<Options>None</Options>
|
|
||||||
<Output>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\bin\x86\Debug\Content\c5.xnb</Output>
|
|
||||||
<Time>2010-10-19T20:01:33.7036561+02:00</Time>
|
|
||||||
</Item>
|
|
||||||
<BuildSuccessful>true</BuildSuccessful>
|
|
||||||
<Settings>
|
|
||||||
<TargetPlatform>Windows</TargetPlatform>
|
|
||||||
<TargetProfile>HiDef</TargetProfile>
|
|
||||||
<BuildConfiguration>Debug</BuildConfiguration>
|
|
||||||
<CompressContent>false</CompressContent>
|
|
||||||
<RootDirectory>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\Content\</RootDirectory>
|
|
||||||
<LoggerRootDirectory>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\</LoggerRootDirectory>
|
|
||||||
<IntermediateDirectory>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\Content\obj\x86\Debug\</IntermediateDirectory>
|
|
||||||
<OutputDirectory>F:\dev\GoogleCode\lidgren-network-gen3\Samples\XNA sample\XnaGameClient\bin\x86\Debug\Content\</OutputDirectory>
|
|
||||||
</Settings>
|
|
||||||
<Assemblies>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key>
|
|
||||||
<Value>2010-08-23T12:41:18+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.VideoImporters.dll</Key>
|
|
||||||
<Value>2010-08-23T12:41:18+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll</Key>
|
|
||||||
<Value>2010-08-23T12:41:18+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll</Key>
|
|
||||||
<Value>2010-08-23T12:41:18+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll</Key>
|
|
||||||
<Value>2010-08-23T12:41:18+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.AudioImporters.dll</Key>
|
|
||||||
<Value>2010-08-23T12:41:18+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
<Assembly>
|
|
||||||
<Key>C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key>
|
|
||||||
<Value>2010-10-29T20:35:38.8804757+02:00</Value>
|
|
||||||
</Assembly>
|
|
||||||
</Assemblies>
|
|
||||||
</Asset>
|
|
||||||
</XnaContent>
|
|
||||||
|
Before Width: | Height: | Size: 4.2 KiB |
@@ -1,135 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using Microsoft.Xna.Framework.Input;
|
|
||||||
|
|
||||||
using Lidgren.Network;
|
|
||||||
|
|
||||||
namespace XnaGameClient
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This is the main type for your game
|
|
||||||
/// </summary>
|
|
||||||
public class Game1 : Microsoft.Xna.Framework.Game
|
|
||||||
{
|
|
||||||
GraphicsDeviceManager graphics;
|
|
||||||
SpriteBatch spriteBatch;
|
|
||||||
|
|
||||||
Texture2D[] textures;
|
|
||||||
Dictionary<long, Vector2> positions = new Dictionary<long, Vector2>();
|
|
||||||
NetClient client;
|
|
||||||
|
|
||||||
public Game1()
|
|
||||||
{
|
|
||||||
graphics = new GraphicsDeviceManager(this);
|
|
||||||
Content.RootDirectory = "Content";
|
|
||||||
|
|
||||||
NetPeerConfiguration config = new NetPeerConfiguration("xnaapp");
|
|
||||||
config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
|
|
||||||
|
|
||||||
client = new NetClient(config);
|
|
||||||
client.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
client.DiscoverLocalPeers(14242);
|
|
||||||
base.Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadContent()
|
|
||||||
{
|
|
||||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
|
||||||
textures = new Texture2D[5];
|
|
||||||
for (int i = 0; i < 5; i++)
|
|
||||||
textures[i] = Content.Load<Texture2D>("c" + (i + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Collect input
|
|
||||||
//
|
|
||||||
int xinput = 0;
|
|
||||||
int yinput = 0;
|
|
||||||
KeyboardState keyState = Keyboard.GetState();
|
|
||||||
|
|
||||||
// exit game if escape or Back is pressed
|
|
||||||
if (keyState.IsKeyDown(Keys.Escape) || GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
|
|
||||||
this.Exit();
|
|
||||||
|
|
||||||
// use arrows or dpad to move avatar
|
|
||||||
if (GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed || keyState.IsKeyDown(Keys.Left))
|
|
||||||
xinput = -1;
|
|
||||||
if (GamePad.GetState(PlayerIndex.One).DPad.Right == ButtonState.Pressed || keyState.IsKeyDown(Keys.Right))
|
|
||||||
xinput = 1;
|
|
||||||
if (GamePad.GetState(PlayerIndex.One).DPad.Up == ButtonState.Pressed || keyState.IsKeyDown(Keys.Up))
|
|
||||||
yinput = -1;
|
|
||||||
if (GamePad.GetState(PlayerIndex.One).DPad.Down == ButtonState.Pressed || keyState.IsKeyDown(Keys.Down))
|
|
||||||
yinput = 1;
|
|
||||||
|
|
||||||
if (xinput != 0 || yinput != 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// If there's input; send it to server
|
|
||||||
//
|
|
||||||
NetOutgoingMessage om = client.CreateMessage();
|
|
||||||
om.Write(xinput); // very inefficient to send a full Int32 (4 bytes) but we'll use this for simplicity
|
|
||||||
om.Write(yinput);
|
|
||||||
client.SendMessage(om, NetDeliveryMethod.Unreliable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// read messages
|
|
||||||
NetIncomingMessage msg;
|
|
||||||
while ((msg = client.ReadMessage()) != null)
|
|
||||||
{
|
|
||||||
switch (msg.MessageType)
|
|
||||||
{
|
|
||||||
case NetIncomingMessageType.DiscoveryResponse:
|
|
||||||
// just connect to first server discovered
|
|
||||||
client.Connect(msg.SenderEndpoint);
|
|
||||||
break;
|
|
||||||
case NetIncomingMessageType.Data:
|
|
||||||
// server sent a position update
|
|
||||||
long who = msg.ReadInt64();
|
|
||||||
int x = msg.ReadInt32();
|
|
||||||
int y = msg.ReadInt32();
|
|
||||||
positions[who] = new Vector2(x, y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
base.Update(gameTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Draw(GameTime gameTime)
|
|
||||||
{
|
|
||||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend);
|
|
||||||
|
|
||||||
// draw all players
|
|
||||||
foreach (var kvp in positions)
|
|
||||||
{
|
|
||||||
// use player unique identifier to choose an image
|
|
||||||
int num = Math.Abs((int)kvp.Key) % textures.Length;
|
|
||||||
|
|
||||||
// draw player
|
|
||||||
spriteBatch.Draw(textures[num], kvp.Value, Color.White);
|
|
||||||
}
|
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
base.Draw(gameTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnExiting(object sender, EventArgs args)
|
|
||||||
{
|
|
||||||
client.Shutdown("bye");
|
|
||||||
|
|
||||||
base.OnExiting(sender, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 5.6 KiB |
@@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace XnaGameClient
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
using (Game1 game = new Game1())
|
|
||||||
{
|
|
||||||
game.Run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("XnaGameClient")]
|
|
||||||
[assembly: AssemblyProduct("XnaGameClient")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyCompany("Microsoft")]
|
|
||||||
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("d2337e59-5903-486c-a4f0-4beb3020c965")]
|
|
||||||
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ProjectGuid>{D084E1C2-CE6B-42A5-918E-37EC7D2B5132}</ProjectGuid>
|
|
||||||
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>XnaGameClient</RootNamespace>
|
|
||||||
<AssemblyName>XnaGameClient</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
|
|
||||||
<XnaPlatform>Windows</XnaPlatform>
|
|
||||||
<XnaCrossPlatformGroupID>e7198d36-15ad-4289-ac23-fa03d866c3e5</XnaCrossPlatformGroupID>
|
|
||||||
<ApplicationIcon>Game.ico</ApplicationIcon>
|
|
||||||
<Thumbnail>GameThumbnail.png</Thumbnail>
|
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<XnaUpgrade>
|
|
||||||
</XnaUpgrade>
|
|
||||||
<XnaOutputType>Game</XnaOutputType>
|
|
||||||
<XnaProfile>HiDef</XnaProfile>
|
|
||||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
|
||||||
<FileUpgradeFlags>
|
|
||||||
</FileUpgradeFlags>
|
|
||||||
<UpgradeBackupLocation>
|
|
||||||
</UpgradeBackupLocation>
|
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
|
||||||
<PublishUrl>publish\</PublishUrl>
|
|
||||||
<Install>true</Install>
|
|
||||||
<InstallFrom>Disk</InstallFrom>
|
|
||||||
<UpdateEnabled>false</UpdateEnabled>
|
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
|
||||||
<UpdateInterval>7</UpdateInterval>
|
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
|
||||||
<UpdateRequired>false</UpdateRequired>
|
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\x86\Debug</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<NoStdLib>true</NoStdLib>
|
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<XnaCompressContent>false</XnaCompressContent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\x86\Release</OutputPath>
|
|
||||||
<DefineConstants>TRACE;WINDOWS</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<NoStdLib>true</NoStdLib>
|
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<XnaCompressContent>True</XnaCompressContent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Input.Touch, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="mscorlib">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Core">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.Linq">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Game1.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Game.ico" />
|
|
||||||
<Content Include="GameThumbnail.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<NestedContentProject Include="Content\Content.contentproj">
|
|
||||||
<Project>416f5a82-22d8-4a94-bc19-4c6a24f34a73</Project>
|
|
||||||
<Visible>False</Visible>
|
|
||||||
</NestedContentProject>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Windows Installer 3.1</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.3.1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft XNA Framework Redistributable 3.1</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.4.0">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft XNA Framework Redistributable 4.0</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\..\Lidgren.Network\Lidgren.Network.csproj">
|
|
||||||
<Project>{FA245447-5F23-4AA1-BD5F-8D2DDF33CFBD}</Project>
|
|
||||||
<Name>Lidgren.Network</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="Content\Content.contentproj">
|
|
||||||
<Project>{416F5A82-22D8-4A94-BC19-4C6A24F34A73}</Project>
|
|
||||||
<Name>XnaGameClientContent %28Content%29</Name>
|
|
||||||
<XnaReferenceType>Content</XnaReferenceType>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
Content\c1.xnb
|
|
||||||
Content\c2.xnb
|
|
||||||
Content\c3.xnb
|
|
||||||
Content\c4.xnb
|
|
||||||
Content\c5.xnb
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<PublishUrlHistory>
|
|
||||||
</PublishUrlHistory>
|
|
||||||
<InstallUrlHistory>
|
|
||||||
</InstallUrlHistory>
|
|
||||||
<SupportUrlHistory>
|
|
||||||
</SupportUrlHistory>
|
|
||||||
<UpdateUrlHistory>
|
|
||||||
</UpdateUrlHistory>
|
|
||||||
<BootstrapperUrlHistory>
|
|
||||||
</BootstrapperUrlHistory>
|
|
||||||
<FallbackCulture>en-US</FallbackCulture>
|
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
|
||||||
<ErrorReportUrlHistory />
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
using Lidgren.Network;
|
|
||||||
|
|
||||||
namespace XnaGameServer
|
|
||||||
{
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
NetPeerConfiguration config = new NetPeerConfiguration("xnaapp");
|
|
||||||
config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
|
|
||||||
config.Port = 14242;
|
|
||||||
|
|
||||||
// create and start server
|
|
||||||
NetServer server = new NetServer(config);
|
|
||||||
server.Start();
|
|
||||||
|
|
||||||
// schedule initial sending of position updates
|
|
||||||
double nextSendUpdates = NetTime.Now;
|
|
||||||
|
|
||||||
// run until escape is pressed
|
|
||||||
while (!Console.KeyAvailable || Console.ReadKey().Key != ConsoleKey.Escape)
|
|
||||||
{
|
|
||||||
NetIncomingMessage msg;
|
|
||||||
while ((msg = server.ReadMessage()) != null)
|
|
||||||
{
|
|
||||||
switch (msg.MessageType)
|
|
||||||
{
|
|
||||||
case NetIncomingMessageType.DiscoveryRequest:
|
|
||||||
//
|
|
||||||
// Server received a discovery request from a client; send a discovery response (with no extra data attached)
|
|
||||||
//
|
|
||||||
server.SendDiscoveryResponse(null, msg.SenderEndpoint);
|
|
||||||
break;
|
|
||||||
case NetIncomingMessageType.VerboseDebugMessage:
|
|
||||||
case NetIncomingMessageType.DebugMessage:
|
|
||||||
case NetIncomingMessageType.WarningMessage:
|
|
||||||
case NetIncomingMessageType.ErrorMessage:
|
|
||||||
//
|
|
||||||
// Just print diagnostic messages to console
|
|
||||||
//
|
|
||||||
Console.WriteLine(msg.ReadString());
|
|
||||||
break;
|
|
||||||
case NetIncomingMessageType.StatusChanged:
|
|
||||||
NetConnectionStatus status = (NetConnectionStatus)msg.ReadByte();
|
|
||||||
if (status == NetConnectionStatus.Connected)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// A new player just connected!
|
|
||||||
//
|
|
||||||
Console.WriteLine(NetUtility.ToHexString(msg.SenderConnection.RemoteUniqueIdentifier) + " connected!");
|
|
||||||
|
|
||||||
// randomize his position and store in connection tag
|
|
||||||
msg.SenderConnection.Tag = new int[] {
|
|
||||||
NetRandom.Instance.Next(10, 100),
|
|
||||||
NetRandom.Instance.Next(10, 100)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case NetIncomingMessageType.Data:
|
|
||||||
//
|
|
||||||
// The client sent input to the server
|
|
||||||
//
|
|
||||||
int xinput = msg.ReadInt32();
|
|
||||||
int yinput = msg.ReadInt32();
|
|
||||||
|
|
||||||
int[] pos = msg.SenderConnection.Tag as int[];
|
|
||||||
|
|
||||||
// fancy movement logic goes here; we just append input to position
|
|
||||||
pos[0] += xinput;
|
|
||||||
pos[1] += yinput;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// send position updates 30 times per second
|
|
||||||
//
|
|
||||||
double now = NetTime.Now;
|
|
||||||
if (now > nextSendUpdates)
|
|
||||||
{
|
|
||||||
// Yes, it's time to send position updates
|
|
||||||
|
|
||||||
// for each player...
|
|
||||||
foreach (NetConnection player in server.Connections)
|
|
||||||
{
|
|
||||||
// ... send information about every other player (actually including self)
|
|
||||||
foreach (NetConnection otherPlayer in server.Connections)
|
|
||||||
{
|
|
||||||
// send position update about 'otherPlayer' to 'player'
|
|
||||||
NetOutgoingMessage om = server.CreateMessage();
|
|
||||||
|
|
||||||
// write who this position is for
|
|
||||||
om.Write(otherPlayer.RemoteUniqueIdentifier);
|
|
||||||
|
|
||||||
if (otherPlayer.Tag == null)
|
|
||||||
otherPlayer.Tag = new int[2];
|
|
||||||
|
|
||||||
int[] pos = otherPlayer.Tag as int[];
|
|
||||||
om.Write(pos[0]);
|
|
||||||
om.Write(pos[1]);
|
|
||||||
|
|
||||||
// send message
|
|
||||||
server.SendMessage(om, player, NetDeliveryMethod.Unreliable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// schedule next update
|
|
||||||
nextSendUpdates += (1.0 / 30.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// sleep to allow other processes to run smoothly
|
|
||||||
Thread.Sleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
server.Shutdown("app exiting");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("XnaGameServer")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("Microsoft")]
|
|
||||||
[assembly: AssemblyProduct("XnaGameServer")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("ad24f34e-32a4-4619-a19f-c16f126d186e")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>9.0.21022</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{2A16EEC3-99B7-45D8-B185-6E1101225540}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>XnaGameServer</RootNamespace>
|
|
||||||
<AssemblyName>XnaGameServer</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<FileUpgradeFlags>
|
|
||||||
</FileUpgradeFlags>
|
|
||||||
<UpgradeBackupLocation>
|
|
||||||
</UpgradeBackupLocation>
|
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core">
|
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\..\Lidgren.Network\Lidgren.Network.csproj">
|
|
||||||
<Project>{FA245447-5F23-4AA1-BD5F-8D2DDF33CFBD}</Project>
|
|
||||||
<Name>Lidgren.Network</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||