Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
more code
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed May 30, 2016
1 parent 6ccb9cc commit 53f6999
Show file tree
Hide file tree
Showing 38 changed files with 3,731 additions and 786 deletions.
5 changes: 5 additions & 0 deletions .nuget/Client_ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Download [Photon Server SDK] https://www.photonengine.com/en-US/OnPremise/Download
Add and reference following dlls.

lib/ExitGamesLibs.dll
lib/Photon3DotNet.dll
6 changes: 6 additions & 0 deletions .nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file added .nuget/NuGet.exe
Binary file not shown.
144 changes: 144 additions & 0 deletions .nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>

<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup>
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
</PropertyGroup>

<PropertyGroup>
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>

<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>

<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
32 changes: 32 additions & 0 deletions .nuget/PhotonWire.Client.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>PhotonWire.Client</id>
<version>1.0.2</version>
<title>PhotonWire.Client</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Typed Asynchronous RPC Layer for Photon Server. This package is for .NET client implementation.</description>
<releaseNotes>
<![CDATA[
Initial Release.
]]>
</releaseNotes>
<language>en-US</language>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>https://github.com/neuecc/PhotonWire</projectUrl>
<tags>Photon MultiPlayer Distributed websockets streaming realtime unity</tags>
<dependencies>
<dependency id="MsgPack.Cli" version="0.6.5" />
<dependency id="Newtonsoft.Json" version="7.0.1" />
<dependency id="Rx-Main" version="2.2.5" />
</dependencies>
</metadata>
<files>
<file src="..\Source\PhotonWire.Client\bin\Release\PhotonWire.Client.dll" target="lib" />
<file src="..\Source\PhotonWire.Client\bin\Release\PhotonWire.Client.xml" target="lib" />
<file src="Client_ReadMe.txt" target="readme.txt" />
<file src="..\Source\PhotonWire.UnityClient\Assets\Plugins\PhotonWire\PhotonWireProxy.tt" target="Content" />
</files>
</package>
31 changes: 31 additions & 0 deletions .nuget/PhotonWire.Server.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>PhotonWire.Server</id>
<version>1.0.2</version>
<title>PhotonWire.Server</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Typed Asynchronous RPC Layer for Photon Server. This package is for realtime server implementation.</description>
<releaseNotes>
<![CDATA[
Initial Release.
]]>
</releaseNotes>
<language>en-US</language>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>https://github.com/neuecc/PhotonWire</projectUrl>
<tags>Photon MultiPlayer Distributed websockets streaming realtime unity</tags>
<dependencies>
<dependency id="MsgPack.Cli" version="0.6.5" />
<dependency id="Newtonsoft.Json" version="7.0.1" />
<dependency id="System.Collections.Immutable" version="1.1.37" />
</dependencies>
</metadata>
<files>
<file src="..\Source\PhotonWire.Server\bin\Release\PhotonWire.Server.dll" target="lib" />
<file src="..\Source\PhotonWire.Server\bin\Release\PhotonWire.Server.xml" target="lib" />
<file src="Server_ReadMe.txt" target="readme.txt" />
</files>
</package>
28 changes: 28 additions & 0 deletions .nuget/PhotonWire.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>PhotonWire</id>
<version>1.0.2</version>
<title>PhotonWire</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Typed Asynchronous RPC Layer for Photon Server. This package includes Server libs + Analyzer + HubInvoker</description>
<releaseNotes>
<![CDATA[
Initial Release.
]]>
</releaseNotes>
<language>en-US</language>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>https://github.com/neuecc/PhotonWire</projectUrl>
<tags>Photon MultiPlayer Distributed websockets streaming realtime unity</tags>
<dependencies>
<dependency id="PhotonWire.Server" version="1.0.2" />
<dependency id="PhotonWire.Analyzer" version="1.0.2" />
</dependencies>
</metadata>
<files>
<file src="..\Source\PhotonWire.HubInvoker\bin\Release\" target="tools\PhotonWire.HubInvoker" />
</files>
</package>
102 changes: 102 additions & 0 deletions .nuget/Server_ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Package does not includes Photon SDK,
please download from [Photon Server SDK]
https://www.photonengine.com/en-US/OnPremise/Download
Add and reference following dlls.

lib/ExitGamesLibs.dll
lib/Photon.SocketServer.dll
lib/PhotonHostRuntimeInterfaces.dll

And PhotonSocketServer.exe binary copy to $(SolutionDir)\PhotonLibs\bin_Win64

PhotonWire.HubInvoker is in packages\PhotonWire\tools\

---

1. Create Startup.cs

```
using PhotonWire.Server;

public class Startup : PhotonWireApplicationBase
{

}
```

2. Create Hub

```csharp
using PhotonWire.Server;

[Hub(0)]
public class MyFirstHub : Hub
{
[Operation(0)]
public int Sum(int x, int y)
{
return x + y;
}
}
```

3. Create PhotonServer.config (must be UTF-8 without BOM)

```xml
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<!-- Manual -->
<!-- http://doc.photonengine.com/en/onpremise/current/reference/server-config-settings -->

<!-- Instances -->
<GettingStarted>
<IOPool>
<NumThreads>8</NumThreads>
</IOPool>

<!-- .NET 4.5~6's CLRVersion is v4.0 -->
<Runtime
Assembly="PhotonHostRuntime, Culture=neutral"
Type="PhotonHostRuntime.PhotonDomainManager"
CLRVersion="v4.0"
UnhandledExceptionPolicy="Ignore">
</Runtime>

<!-- Configuration of listeners -->
<TCPListeners>
<TCPListener
IPAddress="127.0.0.1"
Port="4530"
ListenBacklog="1000"
InactivityTimeout="60000">
</TCPListener>
</TCPListeners>

<!-- Applications -->
<Applications Default="GettingStarted.Server" PassUnknownAppsToDefaultApp="true">
<Application
Name="GettingStarted.Server"
BaseDirectory="GettingStarted.Server"
Assembly="GettingStarted.Server"
Type="GettingStarted.Server.Startup"
EnableShadowCopy="true"
EnableAutoRestart="true"
ForceAutoRestart="true"
ApplicationRootDirectory="PhotonLibs">
</Application>
</Applications>

</GettingStarted>
</Configuration>
```

4. Setup VisualStudio debugging option

// Start external program:
/* Absolute Dir Paths */\PhotonLibs\bin_Win64\PhotonSocketServer.exe

// Star Options, Command line arguments:
/debug GettingStarted /config GettingStarted.Server\bin\PhotonServer.config

// Star Options, Working directory:
/* Absolute Path */\PhotonLibs\
3 changes: 3 additions & 0 deletions .nuget/pack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nuget pack PhotonWire.nuspec
nuget pack PhotonWire.Server.nuspec
nuget pack PhotonWire.Client.nuspec
4 changes: 4 additions & 0 deletions .nuget/push.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nuget push PhotonWire.1.0.2.nupkg
nuget push PhotonWire.Server.1.0.2.nupkg
nuget push PhotonWire.Client.1.0.2.nupkg
nuget push ..\Source\PhotonWire.Analyzer\bin\Release\PhotonWire.Analyzer.1.0.2.0.nupkg
11 changes: 7 additions & 4 deletions PhotonWire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{7341F80B-AC69-42CA-BBDC-3BD667C7C640}"
ProjectSection(SolutionItems) = preProject
VSDocToMarkdown.csx = VSDocToMarkdown.csx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{8C25F347-E802-4BFF-BBA7-5EFA3E8CB03A}"
EndProject
Expand Down Expand Up @@ -36,8 +33,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotonWire.UnityClient.CSha
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F69EC9CD-AD54-4725-BF65-40C2D488E465}"
ProjectSection(SolutionItems) = preProject
.nuget\Client_ReadMe.txt = .nuget\Client_ReadMe.txt
.nuget\pack.bat = .nuget\pack.bat
.nuget\PhotonWire.Client.nuspec = .nuget\PhotonWire.Client.nuspec
.nuget\PhotonWire.nuspec = .nuget\PhotonWire.nuspec
.nuget\PhotonWire.Server.nuspec = .nuget\PhotonWire.Server.nuspec
.nuget\push.bat = .nuget\push.bat
README.md = README.md
VSDocToMarkdown.csx = VSDocToMarkdown.csx
.nuget\Server_ReadMe.txt = .nuget\Server_ReadMe.txt
EndProjectSection
EndProject
Global
Expand Down
Loading

0 comments on commit 53f6999

Please sign in to comment.