├── .editorconfig
├── .gitattributes
├── .gitignore
├── CodeAnalysis.ruleset
├── EntityNetwork.sln
├── LICENSE
├── NOTE.md
├── README.md
├── appveyor.yml
├── build.cmd
├── build.devlink
├── build.fsx
├── core
├── CodeGenerator-Templates
│ ├── EmptyFile.cs
│ ├── EntityNetwork.Templates.Release.md
│ ├── EntityNetwork.Templates.nuspec
│ ├── EntityNetwork.Templates.props
│ ├── EntityNetwork.Templates.targets
│ └── protobuf-net
│ │ ├── IKVM-LICENSE
│ │ ├── IKVM.Reflection.dll
│ │ ├── Licence.txt
│ │ ├── precompile.exe
│ │ └── protobuf-net.dll
├── CodeGenerator
│ ├── App.config
│ ├── AssemblyLoader.cs
│ ├── CodeAnalaysisExtensions.cs
│ ├── CodeGenerator.csproj
│ ├── EntityCodeGenerator.cs
│ ├── MethodDeclarationComparer.cs
│ ├── Options.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Utility.cs
│ └── packages.config
├── EntityNetwork.Net35
│ ├── EntityNetwork.Net35.csproj
│ └── packages.config
├── EntityNetwork.Tests
│ ├── Entities.cs
│ ├── EntityBasicTest.cs
│ ├── EntityDataTest.cs
│ ├── EntityFactoryTest.cs
│ ├── EntityNetwork.Tests.csproj
│ ├── EntityOwnershipTest.cs
│ ├── EntityServerOnlyTest.cs
│ ├── EntitySingletonTest.cs
│ ├── EntityTimerTest.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── EntityNetwork.CodeGen.cs
│ │ └── TrackableData.CodeGen.cs
│ ├── TestEntityBase.cs
│ ├── TestZone.cs
│ ├── TestZoneBuilder.cs
│ └── packages.config
├── EntityNetwork
│ ├── Attributes.cs
│ ├── ClientEntity.cs
│ ├── ClientZone.cs
│ ├── Entity.cs
│ ├── EntityFactory.cs
│ ├── EntityNetwork.Release.md
│ ├── EntityNetwork.csproj
│ ├── EntityNetwork.nuspec
│ ├── EntityTimerProvider.cs
│ ├── Payload.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── AssemblyInfoGenerated.cs
│ ├── ProtobufChannel.cs
│ ├── ServerEntity.cs
│ ├── ServerZone.cs
│ ├── Zone.cs
│ └── packages.config
└── UnityPackage
│ ├── EntityNetwork.unitypackage.json
│ └── Sources
│ ├── ClientEntityFactory.cs
│ ├── EntityNetworkChannel.cs
│ ├── EntityNetworkClient.cs
│ ├── EntityNetworkClient.prefab
│ └── EntityNetworkManager.cs
├── plugins
└── EntityNetwork.Unity3D
│ ├── EntityNetwork.Unity3D.Release.md
│ ├── EntityNetwork.Unity3D.csproj
│ ├── EntityNetwork.Unity3D.nuspec
│ ├── EntityNetworkBehaviour.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ └── AssemblyInfoGenerated.cs
│ └── packages.config
├── samples
├── Basic
│ ├── App.config
│ ├── Basic.csproj
│ ├── Bullet.cs
│ ├── IBullet.cs
│ ├── ISpaceShip.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── EntityNetwork.CodeGen.cs
│ │ └── TrackableData.CodeGen.cs
│ ├── SpaceShip.cs
│ └── packages.config
└── Unity
│ ├── Domain.Unity3D
│ ├── Properties
│ │ ├── Akka.Interfaced.CodeGen.Slim.cs
│ │ ├── Akka.Interfaced.CodeGen.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── EntityNetwork.CodeGen.cs
│ │ └── TrackableData.CodeGen.cs
│ ├── Unity.Domain.Unity3D.csproj
│ └── packages.config
│ ├── Domain
│ ├── Entity
│ │ ├── Bullet.cs
│ │ ├── IBullet.cs
│ │ ├── ISpaceShip.cs
│ │ └── SpaceShip.cs
│ ├── Interface
│ │ ├── GameInfo.cs
│ │ ├── IGame.cs
│ │ ├── IGameClient.cs
│ │ ├── IGameObserver.cs
│ │ └── IUser.cs
│ ├── Properties
│ │ ├── Akka.Interfaced.CodeGen.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── EntityNetwork.CodeGen.cs
│ │ └── TrackableData.CodeGen.cs
│ ├── Unity.Domain.csproj
│ ├── app.config
│ └── packages.config
│ ├── Program.Client
│ ├── .gitignore
│ ├── Assets
│ │ ├── Resources.meta
│ │ ├── Resources
│ │ │ ├── ClientBullet.prefab
│ │ │ ├── ClientBullet.prefab.meta
│ │ │ ├── ClientSpaceShip.prefab
│ │ │ └── ClientSpaceShip.prefab.meta
│ │ ├── Scenes.meta
│ │ ├── Scenes
│ │ │ ├── MainScene.unity
│ │ │ ├── MainScene.unity.meta
│ │ │ ├── TestScene.unity
│ │ │ └── TestScene.unity.meta
│ │ ├── Scripts.meta
│ │ ├── Scripts
│ │ │ ├── ClientBullet.cs
│ │ │ ├── ClientBullet.cs.meta
│ │ │ ├── ClientSpaceShip.cs
│ │ │ ├── ClientSpaceShip.cs.meta
│ │ │ ├── G.cs
│ │ │ ├── G.cs.meta
│ │ │ ├── MainScene.cs
│ │ │ ├── MainScene.cs.meta
│ │ │ ├── SelfHostEntityNetworkManager.cs
│ │ │ ├── SelfHostEntityNetworkManager.cs.meta
│ │ │ ├── TestScene.cs
│ │ │ ├── TestScene.cs.meta
│ │ │ ├── Unity.Domain.ProtobufSerializer.dll
│ │ │ ├── Unity.Domain.ProtobufSerializer.dll.meta
│ │ │ ├── Unity.Domain.Unity3D.dll
│ │ │ └── Unity.Domain.Unity3D.dll.meta
│ │ ├── UnityPackages.meta
│ │ └── UnityPackages
│ │ │ ├── AkkaInterfaced.meta
│ │ │ ├── AkkaInterfaced.unitypackage.json
│ │ │ ├── AkkaInterfaced.unitypackage.json.meta
│ │ │ ├── AkkaInterfaced
│ │ │ ├── Akka.Interfaced-Base.dll
│ │ │ ├── Akka.Interfaced-Base.dll.mdb
│ │ │ ├── Akka.Interfaced-Base.dll.mdb.meta
│ │ │ └── Akka.Interfaced-Base.dll.meta
│ │ │ ├── AkkaInterfacedSlimSocket.meta
│ │ │ ├── AkkaInterfacedSlimSocket.unitypackage.json
│ │ │ ├── AkkaInterfacedSlimSocket.unitypackage.json.meta
│ │ │ ├── AkkaInterfacedSlimSocket
│ │ │ ├── Akka.Interfaced.SlimSocket.Base.dll
│ │ │ ├── Akka.Interfaced.SlimSocket.Base.dll.mdb
│ │ │ ├── Akka.Interfaced.SlimSocket.Base.dll.mdb.meta
│ │ │ ├── Akka.Interfaced.SlimSocket.Base.dll.meta
│ │ │ ├── Akka.Interfaced.SlimSocket.Client.dll
│ │ │ ├── Akka.Interfaced.SlimSocket.Client.dll.mdb
│ │ │ ├── Akka.Interfaced.SlimSocket.Client.dll.mdb.meta
│ │ │ ├── Akka.Interfaced.SlimSocket.Client.dll.meta
│ │ │ ├── ChannelEventDispatcher.cs
│ │ │ ├── ChannelEventDispatcher.cs.meta
│ │ │ ├── ChannelFactoryBuilder.cs
│ │ │ ├── ChannelFactoryBuilder.cs.meta
│ │ │ ├── UnitySlimTaskCompletionSource.cs
│ │ │ ├── UnitySlimTaskCompletionSource.cs.meta
│ │ │ ├── UnitySlimTaskFactory.cs
│ │ │ └── UnitySlimTaskFactory.cs.meta
│ │ │ ├── CommonLogging.meta
│ │ │ ├── CommonLogging.unitypackage.json
│ │ │ ├── CommonLogging.unitypackage.json.meta
│ │ │ ├── CommonLogging
│ │ │ ├── Common.Logging.Core.dll
│ │ │ ├── Common.Logging.Core.dll.mdb
│ │ │ ├── Common.Logging.Core.dll.mdb.meta
│ │ │ ├── Common.Logging.Core.dll.meta
│ │ │ ├── Common.Logging.Extensions.dll
│ │ │ ├── Common.Logging.Extensions.dll.mdb
│ │ │ ├── Common.Logging.Extensions.dll.mdb.meta
│ │ │ ├── Common.Logging.Extensions.dll.meta
│ │ │ ├── Common.Logging.dll
│ │ │ ├── Common.Logging.dll.mdb
│ │ │ ├── Common.Logging.dll.mdb.meta
│ │ │ └── Common.Logging.dll.meta
│ │ │ ├── EntityNetwork.meta
│ │ │ ├── EntityNetwork.unitypackage.json
│ │ │ ├── EntityNetwork.unitypackage.json.meta
│ │ │ ├── EntityNetwork
│ │ │ ├── ClientEntityFactory.cs
│ │ │ ├── ClientEntityFactory.cs.meta
│ │ │ ├── EntityNetwork.Unity3D.dll
│ │ │ ├── EntityNetwork.Unity3D.dll.mdb
│ │ │ ├── EntityNetwork.Unity3D.dll.mdb.meta
│ │ │ ├── EntityNetwork.Unity3D.dll.meta
│ │ │ ├── EntityNetwork.dll
│ │ │ ├── EntityNetwork.dll.mdb
│ │ │ ├── EntityNetwork.dll.mdb.meta
│ │ │ ├── EntityNetwork.dll.meta
│ │ │ ├── EntityNetworkChannel.cs
│ │ │ ├── EntityNetworkChannel.cs.meta
│ │ │ ├── EntityNetworkClient.cs
│ │ │ ├── EntityNetworkClient.cs.meta
│ │ │ ├── EntityNetworkClient.prefab
│ │ │ ├── EntityNetworkClient.prefab.meta
│ │ │ ├── EntityNetworkManager.cs
│ │ │ └── EntityNetworkManager.cs.meta
│ │ │ ├── JsonNet.meta
│ │ │ ├── JsonNet.unitypackage.json
│ │ │ ├── JsonNet.unitypackage.json.meta
│ │ │ ├── JsonNet
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ ├── Newtonsoft.Json.dll.mdb
│ │ │ ├── Newtonsoft.Json.dll.mdb.meta
│ │ │ └── Newtonsoft.Json.dll.meta
│ │ │ ├── LidgrenUdpNet.meta
│ │ │ ├── LidgrenUdpNet.unitypackage.json
│ │ │ ├── LidgrenUdpNet.unitypackage.json.meta
│ │ │ ├── LidgrenUdpNet
│ │ │ ├── LidgrenUdpNet.dll
│ │ │ ├── LidgrenUdpNet.dll.mdb
│ │ │ ├── LidgrenUdpNet.dll.mdb.meta
│ │ │ └── LidgrenUdpNet.dll.meta
│ │ │ ├── NetLegacySupport.meta
│ │ │ ├── NetLegacySupport.unitypackage.json
│ │ │ ├── NetLegacySupport.unitypackage.json.meta
│ │ │ ├── NetLegacySupport
│ │ │ ├── NetLegacySupport.Action.dll
│ │ │ ├── NetLegacySupport.Action.dll.mdb
│ │ │ ├── NetLegacySupport.Action.dll.mdb.meta
│ │ │ ├── NetLegacySupport.Action.dll.meta
│ │ │ ├── NetLegacySupport.ConcurrentDictionary.dll
│ │ │ ├── NetLegacySupport.ConcurrentDictionary.dll.mdb
│ │ │ ├── NetLegacySupport.ConcurrentDictionary.dll.mdb.meta
│ │ │ ├── NetLegacySupport.ConcurrentDictionary.dll.meta
│ │ │ ├── NetLegacySupport.Tuple.dll
│ │ │ ├── NetLegacySupport.Tuple.dll.mdb
│ │ │ ├── NetLegacySupport.Tuple.dll.mdb.meta
│ │ │ └── NetLegacySupport.Tuple.dll.meta
│ │ │ ├── TrackableData.meta
│ │ │ ├── TrackableData.unitypackage.json
│ │ │ ├── TrackableData.unitypackage.json.meta
│ │ │ ├── TrackableData
│ │ │ ├── TrackableData.Json.dll
│ │ │ ├── TrackableData.Json.dll.mdb
│ │ │ ├── TrackableData.Json.dll.mdb.meta
│ │ │ ├── TrackableData.Json.dll.meta
│ │ │ ├── TrackableData.Protobuf.dll
│ │ │ ├── TrackableData.Protobuf.dll.mdb
│ │ │ ├── TrackableData.Protobuf.dll.mdb.meta
│ │ │ ├── TrackableData.Protobuf.dll.meta
│ │ │ ├── TrackableData.dll
│ │ │ ├── TrackableData.dll.mdb
│ │ │ ├── TrackableData.dll.mdb.meta
│ │ │ └── TrackableData.dll.meta
│ │ │ ├── TypeAlias.meta
│ │ │ ├── TypeAlias.unitypackage.json
│ │ │ ├── TypeAlias.unitypackage.json.meta
│ │ │ ├── TypeAlias
│ │ │ ├── TypeAlias.dll
│ │ │ ├── TypeAlias.dll.mdb
│ │ │ ├── TypeAlias.dll.mdb.meta
│ │ │ └── TypeAlias.dll.meta
│ │ │ ├── protobuf-net.meta
│ │ │ ├── protobuf-net.unitypackage.json
│ │ │ ├── protobuf-net.unitypackage.json.meta
│ │ │ └── protobuf-net
│ │ │ ├── protobuf-net.dll
│ │ │ └── protobuf-net.dll.meta
│ ├── ProjectSettings
│ │ ├── AudioManager.asset
│ │ ├── ClusterInputManager.asset
│ │ ├── DynamicsManager.asset
│ │ ├── EditorBuildSettings.asset
│ │ ├── EditorSettings.asset
│ │ ├── GraphicsSettings.asset
│ │ ├── InputManager.asset
│ │ ├── NavMeshAreas.asset
│ │ ├── NetworkManager.asset
│ │ ├── Physics2DSettings.asset
│ │ ├── ProjectSettings.asset
│ │ ├── ProjectVersion.txt
│ │ ├── QualitySettings.asset
│ │ ├── TagManager.asset
│ │ ├── TimeManager.asset
│ │ ├── UnityAdsSettings.asset
│ │ └── UnityConnectSettings.asset
│ └── UnityPackages.json
│ └── Program.Server
│ ├── App.config
│ ├── GameActor.cs
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Unity.Program.Server.csproj
│ ├── UserActor.cs
│ └── packages.config
├── src
└── .nuget
│ └── nuget.exe
└── tools
├── nuget
├── NuGet.Config
├── NuGet.targets
├── nuget.exe
└── packages.config
└── unity3d
├── UnityEngine.dll
└── pdb2mdb.exe
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*.{cs, py, fsx}]
4 | indent_style = space
5 | indent_size = 4
6 | trim_trailing_whitespace = true
7 | insert_final_newline = true
8 |
9 | [*.{json, xml}]
10 | indent_style = space
11 | indent_size = 2
12 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # User-specific files
2 | *.suo
3 | *.user
4 | *.userosscache
5 | *.sln.docstates
6 |
7 | # Build results
8 | [Dd]ebug/
9 | [Dd]ebugPublic/
10 | [Rr]elease/
11 | [Rr]eleases/
12 | x64/
13 | x86/
14 | build/
15 | bld/
16 | [Bb]in/
17 | [Oo]bj/
18 |
19 | # Coverity output
20 | cov-int/
21 |
22 | # Visual Studio 2015 cache/options directory
23 | .vs/
24 |
25 | # DNX
26 | project.lock.json
27 | artifacts/
28 |
29 | # Visual Studio profiler
30 | *.psess
31 | *.vsp
32 | *.vspx
33 |
34 | # Visual Studio Code
35 | .vscode
36 |
37 | # Click-Once directory
38 | [Pp]ublish/
39 |
40 | # NuGet Packages
41 | *.nupkg
42 | # The packages folder can be ignored because of Package Restore
43 | **/packages/*
44 | # except build/, which is used as an MSBuild target.
45 | !**/packages/build/
46 | # Uncomment if necessary however generally it will be regenerated when needed
47 | #!**/packages/repositories.config
48 |
49 | # Windows Azure Build Output
50 | csx/
51 | *.build.csdef
52 |
53 | # Windows Store app package directory
54 | AppPackages/
55 |
56 | # Visual Studio cache files
57 | # files ending in .cache can be ignored
58 | *.[Cc]ache
59 | # but keep track of directories ending in .cache
60 | !*.[Cc]ache/
61 |
62 | # Fake
63 | .fake/
64 |
65 | # No APK
66 | *.apk
67 |
68 | # Temporary files
69 | *.bak
70 | *.tmp
71 | *.error
72 |
73 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 SaladLab
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/NOTE.md:
--------------------------------------------------------------------------------
1 | # TODO
2 |
3 | ## Game Controller
4 |
5 | - Because there is no game controller now,
6 | it's tricky to decide where to place the controller.
7 |
8 | ## TrackableData Extensibility
9 |
10 | - Current implementation supports only TrackablePoco.
11 | This limitation is based on code generation using syntax analysis.
12 | This can be alleviated by heuristic type guess.
13 |
14 | ## Time
15 |
16 | - Time is an essential factor for game
17 |
18 | ## Ownership *Done*
19 |
20 | Every entity has ownership.
21 | - If owner leave the network, owned entity will be despawned.
22 | - Only server and owner client can control server entity.
23 | - Ownership can be handed over to another client
24 | - When Owner leave but entity should stay.
25 | - When Owner hand over voluntarily
26 |
27 | ## State
28 |
29 | - Use TrackableData! (Done)
30 | - Client-side update ? (allowed?)
31 |
32 | ## Constructor or Initializer *Done*
33 |
34 | - It's required to init entities showing up properly. (Done with Snapshot)
35 |
36 | ## Saved Method
37 |
38 | - [Saved] for new comers (REPLACED WITH TrackableData)
39 |
40 | # IDEA
41 |
42 | ## Intrusive Client in Server *Done*
43 |
44 | I am not sure but it is a considerable idea that ServerEntity may inherit ClientRef
45 | to allow use methods of ClientRef in a natual fashion.
46 |
47 | ## Fast redirection
48 |
49 | For fast forwarding, it's better to have an option for redirecting message toward self.
50 | When a client send 'Rpc' to master, master may broadcast this message to all except sender
51 | and sender client get Rpc by itself.
52 |
53 | ## Inheritance
54 |
55 | To support IMonster : ICreature
56 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # EntityNetwork
2 |
3 | [](https://www.nuget.org/packages/EntityNetwork/)
4 | [](https://ci.appveyor.com/project/veblush/entitynetwork)
5 | [](https://coveralls.io/github/SaladLab/EntityNetwork?branch=master)
6 | [](https://scan.coverity.com/projects/saladlab-entitynetwork)
7 |
8 | Entity Network System for Online Game
9 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 0.2.0.{build}
2 | os: Visual Studio 2015
3 | environment:
4 | NUGETKEY:
5 | secure: z2fJQckgBQJ7IKfjOyrZYPM2+xDj4xYuqaUDBG7MrJs+b1bNc0vzYMTxpF6Sb1mA
6 | COVERALLSKEY:
7 | secure: c+9Hw7g/z2OI1bbzXRxnYtF4VBFbtwl1wqMUBhdJmZZFrkW5+j8GX2CV3G8kn9Iq
8 | test: off
9 | build_script:
10 | - cmd: build.cmd ci nugetkey=%NUGETKEY% nugetpublishurl=https://www.myget.org/F/saladlab/api/v2/package nugetprerelease=%APPVEYOR_BUILD_NUMBER% coverallskey=%COVERALLSKEY%
11 | artifacts:
12 | - path: './bin/nuget/*.nupkg'
13 | name: NugetPackage
14 | - path: './bin/unity/*.unitypackage'
15 | name: UnityPackage
16 | cache:
17 | - packages -> **\packages.config
18 |
--------------------------------------------------------------------------------
/build.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | pushd %~dp0
4 |
5 | SET PACKAGEPATH=.\packages\
6 | SET NUGET=.\tools\nuget\NuGet.exe
7 | SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion
8 |
9 | IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.28.0 (
10 | RD /S/Q %PACKAGEPATH%FAKE
11 | %NUGET% install FAKE -Version 4.28.0 %NUGETOPTIONS%
12 | COPY NUL %PACKAGEPATH%FAKE\Ver_4.28.0
13 | )
14 |
15 | IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.6 (
16 | RD /S/Q %PACKAGEPATH%FAKE.BuildLib
17 | %NUGET% install FAKE.BuildLib -Version 0.3.6 %NUGETOPTIONS%
18 | COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.6
19 | )
20 |
21 | set encoding=utf-8
22 | "%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*
23 |
24 | popd
25 |
--------------------------------------------------------------------------------
/build.devlink:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/build.fsx:
--------------------------------------------------------------------------------
1 | #I @"packages/FAKE/tools"
2 | #I @"packages/FAKE.BuildLib/lib/net451"
3 | #r "FakeLib.dll"
4 | #r "BuildLib.dll"
5 |
6 | open Fake
7 | open BuildLib
8 |
9 | let solution =
10 | initSolution
11 | "./EntityNetwork.sln" "Release"
12 | [ { emptyProject with Name = "EntityNetwork"
13 | Folder = "./core/EntityNetwork"
14 | PackagePrerelease = "beta"
15 | Dependencies =
16 | [ ("protobuf-net", "")
17 | ("TrackableData", "")
18 | ("TrackableData.Protobuf", "")
19 | ("TypeAlias", "") ] }
20 | { emptyProject with Name = "EntityNetwork.Templates"
21 | Folder = "./core/CodeGenerator-Templates"
22 | Template = true
23 | PackagePrerelease = "beta"
24 | Dependencies = [ ("EntityNetwork", "") ] }
25 | { emptyProject with Name = "EntityNetwork.Unity3D"
26 | Folder = "./plugins/EntityNetwork.Unity3D"
27 | DefaultTarget = "net35"
28 | PackagePrerelease = "beta"
29 | Dependencies = [ ("EntityNetwork", "") ] } ]
30 |
31 | Target "Clean" <| fun _ -> cleanBin
32 |
33 | Target "AssemblyInfo" <| fun _ -> generateAssemblyInfo solution
34 |
35 | Target "Restore" <| fun _ -> restoreNugetPackages solution
36 |
37 | Target "Build" <| fun _ -> buildSolution solution
38 |
39 | Target "Test" <| fun _ -> testSolution solution
40 |
41 | Target "Cover" <| fun _ ->
42 | coverSolutionWithParams
43 | (fun p -> { p with Filter = "+[EntityNetwork*]* -[*.Tests]*" })
44 | solution
45 |
46 | Target "Coverity" <| fun _ -> coveritySolution solution "SaladLab/EntityNetwork"
47 |
48 | Target "PackNuget" <| fun _ -> createNugetPackages solution
49 |
50 | Target "PackUnity" <| fun _ ->
51 | packUnityPackage "./core/UnityPackage/EntityNetwork.unitypackage.json"
52 |
53 | Target "Pack" <| fun _ -> ()
54 |
55 | Target "PublishNuget" <| fun _ -> publishNugetPackages solution
56 |
57 | Target "PublishUnity" <| fun _ -> ()
58 |
59 | Target "Publish" <| fun _ -> ()
60 |
61 | Target "CI" <| fun _ -> ()
62 |
63 | Target "Help" <| fun _ ->
64 | showUsage solution (fun _ -> None)
65 |
66 | "Clean"
67 | ==> "AssemblyInfo"
68 | ==> "Restore"
69 | ==> "Build"
70 | ==> "Test"
71 |
72 | "Build" ==> "Cover"
73 | "Restore" ==> "Coverity"
74 |
75 | let isPublishOnly = getBuildParam "publishonly"
76 |
77 | "Build" ==> "PackNuget" =?> ("PublishNuget", isPublishOnly = "")
78 | "Build" ==> "PackUnity" =?> ("PublishUnity", isPublishOnly = "")
79 | "PackNuget" ==> "Pack"
80 | "PackUnity" ==> "Pack"
81 | "PublishNuget" ==> "Publish"
82 | "PublishUnity" ==> "Publish"
83 |
84 | "Test" ==> "CI"
85 | "Cover" ==> "CI"
86 | "Publish" ==> "CI"
87 |
88 | RunTargetOrDefault "Help"
89 |
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/EmptyFile.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/core/CodeGenerator-Templates/EmptyFile.cs
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/EntityNetwork.Templates.Release.md:
--------------------------------------------------------------------------------
1 | ## 0.2.1 (Released 2016/05/31)
2 |
3 | * Update protobuf-net 2.1.0-alpha-1
4 |
5 | ## 0.2.0 (Released 2015/12/18)
6 |
7 | * Initial Release
8 |
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/EntityNetwork.Templates.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @project@
5 | @project@@title@
6 | @build.number@
7 | Esun Kim
8 | Esun Kim
9 | EntityNetwork
10 | https://raw.githubusercontent.com/SaladLab/EntityNetwork/master/LICENSE
11 | https://github.com/SaladLab/EntityNetwork
12 | false
13 | @releaseNotes@
14 | Copyright © 2016 SaladLab
15 | entity network online game
16 | @dependencies@
17 | @references@
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/EntityNetwork.Templates.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | $(MSBuildThisFileDirectory)..\tools\protobuf-net\precompile.exe
9 |
10 |
11 |
12 |
13 |
14 | $(MSBuildThisFileDirectory)..\CodeGenerator-Templates\protobuf-net\precompile.exe
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/EntityNetwork.Templates.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | $(MSBuildThisFileDirectory)..\tools
9 |
10 |
11 |
12 |
13 |
14 | $(MSBuildThisFileDirectory)..\CodeGenerator\bin\$(ConfigurationName)
15 |
16 |
17 |
18 |
19 |
20 |
21 | $(EntityNetworkCodeGenToolExeDir)CodeGenerator.exe
22 |
23 |
24 |
25 |
26 | $(EntityNetworkCodeGenToolExeDir)\CodeGenerator.exe
27 |
28 |
29 |
30 |
31 |
32 |
37 |
38 |
43 |
44 | $(IntermediateOutputPath)$(TargetName).EntityNetwork.CodeGen.Args.txt
45 | @(Compile->'%(Identity)', ';')
46 | @(ReferencePath->'%(Identity)', ';')
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/protobuf-net/IKVM.Reflection.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/core/CodeGenerator-Templates/protobuf-net/IKVM.Reflection.dll
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/protobuf-net/Licence.txt:
--------------------------------------------------------------------------------
1 | The core Protocol Buffers technology is provided courtesy of Google.
2 | At the time of writing, this is released under the BSD license.
3 | Full details can be found here:
4 |
5 | http://code.google.com/p/protobuf/
6 |
7 |
8 | This .NET implementation is Copyright 2008 Marc Gravell
9 |
10 | Licensed under the Apache License, Version 2.0 (the "License");
11 | you may not use this file except in compliance with the License.
12 | You may obtain a copy of the License at
13 |
14 | http://www.apache.org/licenses/LICENSE-2.0
15 |
16 | Unless required by applicable law or agreed to in writing, software
17 | distributed under the License is distributed on an "AS IS" BASIS,
18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | See the License for the specific language governing permissions and
20 | limitations under the License.
21 |
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/protobuf-net/precompile.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/core/CodeGenerator-Templates/protobuf-net/precompile.exe
--------------------------------------------------------------------------------
/core/CodeGenerator-Templates/protobuf-net/protobuf-net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/core/CodeGenerator-Templates/protobuf-net/protobuf-net.dll
--------------------------------------------------------------------------------
/core/CodeGenerator/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/CodeGenerator/AssemblyLoader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Reflection;
6 | using Microsoft.CodeAnalysis;
7 | using Microsoft.CodeAnalysis.CSharp;
8 |
9 | namespace CodeGen
10 | {
11 | internal static class AssemblyLoader
12 | {
13 | private static ResolveEventHandler _lastResolveHandler;
14 |
15 | public static Assembly BuildAndLoad(string[] sourcePaths, string[] referencePaths, string[] defines)
16 | {
17 | var assemblyName = Path.GetRandomFileName();
18 | var syntaxTrees =
19 | sourcePaths.Select(file => CSharpSyntaxTree.ParseText(File.ReadAllText(file), path: file)).ToArray();
20 | var references = referencePaths.Select(file => MetadataReference.CreateFromFile(file)).ToArray();
21 |
22 | // TODO: how to handle defines option?
23 |
24 | CSharpCompilation compilation = CSharpCompilation.Create(
25 | assemblyName,
26 | syntaxTrees: syntaxTrees,
27 | references: references,
28 | options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
29 |
30 | using (var ms = new MemoryStream())
31 | {
32 | var result = compilation.Emit(ms);
33 |
34 | if (!result.Success)
35 | {
36 | IEnumerable failures = result.Diagnostics.Where(diagnostic =>
37 | diagnostic.IsWarningAsError ||
38 | diagnostic.Severity ==
39 | DiagnosticSeverity.Error);
40 |
41 | foreach (Diagnostic diagnostic in failures)
42 | {
43 | var line = diagnostic.Location.GetLineSpan();
44 | Console.Error.WriteLine("{0}({1}): {2} {3}",
45 | line.Path,
46 | line.StartLinePosition.Line + 1,
47 | diagnostic.Id,
48 | diagnostic.GetMessage());
49 | }
50 | return null;
51 | }
52 | else
53 | {
54 | ms.Seek(0, SeekOrigin.Begin);
55 |
56 | // To load referenced assemblies, set customized resolved during using this assembly.
57 |
58 | var currentDomain = AppDomain.CurrentDomain;
59 | var resolveHandler = new ResolveEventHandler((sender, args) =>
60 | {
61 | var nameOnly = args.Name.Substring(0, args.Name.IndexOf(","));
62 | foreach (var path in referencePaths)
63 | {
64 | if (path.Contains(nameOnly))
65 | return Assembly.LoadFrom(path);
66 | }
67 | return null;
68 | });
69 |
70 | if (_lastResolveHandler != null)
71 | currentDomain.AssemblyResolve -= _lastResolveHandler;
72 | currentDomain.AssemblyResolve += resolveHandler;
73 | _lastResolveHandler = resolveHandler;
74 |
75 | var assembly = Assembly.Load(ms.ToArray());
76 | return assembly;
77 | }
78 | }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/core/CodeGenerator/CodeAnalaysisExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using Microsoft.CodeAnalysis;
3 | using Microsoft.CodeAnalysis.CSharp.Syntax;
4 |
5 | namespace CodeGen
6 | {
7 | internal static class CodeAnalaysisExtensions
8 | {
9 | public static string GetTypeName(this InterfaceDeclarationSyntax node)
10 | {
11 | var parts = node.GetFullTypeName().Split('.');
12 | return parts[parts.Length - 1];
13 | }
14 |
15 | public static string GetFullTypeName(this InterfaceDeclarationSyntax node)
16 | {
17 | var ns = GetNamespaceScope(node.Parent);
18 | var fullName = (ns.Any() ? ns + "." : "") + node.Identifier;
19 | return fullName;
20 | }
21 |
22 | public static string GetNamespaceScope(this SyntaxNode node)
23 | {
24 | if (node == null)
25 | return "";
26 | var namespaceDecl = node as NamespaceDeclarationSyntax;
27 | var current = (namespaceDecl != null) ? namespaceDecl.Name.ToString() : "";
28 | var parent = GetNamespaceScope(node.Parent);
29 | if (parent.Any() && current.Any())
30 | return parent + "." + current;
31 | if (parent.Any())
32 | return parent;
33 | return current;
34 | }
35 |
36 | public static SyntaxNode GetRootNode(this SyntaxNode node)
37 | {
38 | if (node == null)
39 | return null;
40 | if (node.Parent == null)
41 | return node;
42 | else
43 | return GetRootNode(node.Parent);
44 | }
45 |
46 | public static PropertyDeclarationSyntax[] GetProperties(this InterfaceDeclarationSyntax node)
47 | {
48 | return node.Members.OfType().ToArray();
49 | }
50 |
51 | public static AttributeSyntax GetAttribute(this SyntaxList attributeLists, string name)
52 | {
53 | var canonicalName = name.EndsWith("Attribute") ? name : name + "Attribute";
54 | foreach (var attributeList in attributeLists)
55 | {
56 | foreach (var attribute in attributeList.Attributes)
57 | {
58 | var attrName = attribute.Name.ToString();
59 | var attrCanonicalName = attrName.EndsWith("Attribute") ? attrName : attrName + "Attribute";
60 | if (CompareTypeName(attrCanonicalName, canonicalName))
61 | return attribute;
62 | }
63 | }
64 | return null;
65 | }
66 |
67 | public static GenericNameSyntax GetGenericBase(this InterfaceDeclarationSyntax node, string name)
68 | {
69 | if (node.BaseList == null)
70 | return null;
71 | foreach (var type in node.BaseList.Types)
72 | {
73 | var genericName = type.Type as GenericNameSyntax;
74 | if (genericName != null)
75 | {
76 | if (CompareTypeName(genericName.Identifier.ToString(), name))
77 | return genericName;
78 | }
79 | }
80 | return null;
81 | }
82 |
83 | public static bool HasBase(this InterfaceDeclarationSyntax node, string name)
84 | {
85 | if (node.BaseList == null)
86 | return false;
87 | foreach (var type in node.BaseList.Types)
88 | {
89 | if (CompareTypeName(type.Type.ToString(), name))
90 | return true;
91 | }
92 | return false;
93 | }
94 |
95 | public static bool CompareTypeName(string a, string b)
96 | {
97 | var ap = a.Split('.').Reverse();
98 | var bp = b.Split('.').Reverse();
99 | return ap.Zip(bp, (x, y) => x == y).All(x => x);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/core/CodeGenerator/MethodDeclarationComparer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using Microsoft.CodeAnalysis.CSharp.Syntax;
5 |
6 | namespace CodeGen
7 | {
8 | public class MethodDeclarationSyntaxComparer : IComparer
9 | {
10 | public int Compare(MethodDeclarationSyntax x, MethodDeclarationSyntax y)
11 | {
12 | var ret = string.Compare(x.Identifier.Text, y.Identifier.Text, StringComparison.Ordinal);
13 | if (ret != 0)
14 | return ret;
15 |
16 | var xp = x.ParameterList.Parameters;
17 | var yp = y.ParameterList.Parameters;
18 | for (var i = 0; i < Math.Min(xp.Count, yp.Count); i++)
19 | {
20 | var ret2 = string.Compare(xp[i].Identifier.Text, yp[i].Identifier.Text, StringComparison.Ordinal);
21 | if (ret2 != 0)
22 | return ret2;
23 |
24 | var ret3 = string.Compare(xp[i].Type.ToFullString(), yp[i].Type.ToFullString(), StringComparison.Ordinal);
25 | if (ret3 != 0)
26 | return ret3;
27 | }
28 |
29 | return xp.Count - yp.Count;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/core/CodeGenerator/Options.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using CommandLine;
3 |
4 | namespace CodeGen
5 | {
6 | internal class Options
7 | {
8 | [Option('p', "path", HelpText = "Base path for processing sources, references and target.")]
9 | public string Path { get; set; }
10 |
11 | [Option('s', "source", Separator = ';', HelpText = "Input source files.")]
12 | public IEnumerable Sources { get; set; }
13 |
14 | [Option('r', "reference", Separator = ';', HelpText = "Input reference files for building sources.")]
15 | public IEnumerable References { get; set; }
16 |
17 | [Option('d', "define", HelpText = "Defines name as a symbol which is used in compiling.")]
18 | public IEnumerable Defines { get; set; }
19 |
20 | [Option('t', "target", HelpText = "Filename of a generated code.")]
21 | public string TargetFile { get; set; }
22 |
23 | [Option('c', "protobuf", Default = true, HelpText = "Use protobuf-net for serializing generated message type.")]
24 | public bool UseProtobuf { get; set; }
25 |
26 | [Option("serverentity", HelpText = "Name of server entity base class")]
27 | public string ServerEntity { get; set; }
28 |
29 | [Option("cliententity", HelpText = "Name of client entity base class")]
30 | public string ClientEntity { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/core/CodeGenerator/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("CodeGenerator")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("CodeGenerator")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b9858319-eb58-49fe-a06c-fde806890f9e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/core/CodeGenerator/Utility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.CodeAnalysis.CSharp.Syntax;
3 |
4 | namespace CodeGen
5 | {
6 | public static class Utility
7 | {
8 | public static string GetPayloadTableClassName(InterfaceDeclarationSyntax idecl)
9 | {
10 | return idecl.Identifier + "_PayloadTable";
11 | }
12 |
13 | public static string GetServerEntityBaseClassName(InterfaceDeclarationSyntax idecl)
14 | {
15 | return idecl.Identifier.ToString().Substring(1) + "ServerBase";
16 | }
17 |
18 | public static string GetClientEntityBaseClassName(InterfaceDeclarationSyntax idecl)
19 | {
20 | return idecl.Identifier.ToString().Substring(1) + "ClientBase";
21 | }
22 |
23 | public static string GetTrackerClassName(TypeSyntax type)
24 | {
25 | return "TrackablePocoTracker<" + type + ">";
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/core/CodeGenerator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Net35/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/EntityBasicTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xunit;
3 |
4 | namespace EntityNetwork.Tests
5 | {
6 | public class EntityBasicTest
7 | {
8 | [Fact]
9 | public void Spawn_SyncedToClient()
10 | {
11 | // Arrange
12 |
13 | var s = TestZoneBuilder.Build();
14 |
15 | // Act
16 |
17 | IServerEntity so = null;
18 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(IBullet), 1));
19 | Assert.NotNull(so);
20 | Assert.IsType(so);
21 |
22 | // Assert
23 |
24 | foreach (var clientZone in s.ClientZones)
25 | {
26 | IClientEntity co = clientZone.GetEntity(so.Id);
27 | Assert.NotNull(co);
28 | Assert.IsType(co);
29 | }
30 | }
31 |
32 | [Fact]
33 | public void Client_CallToServer_Called()
34 | {
35 | // Arrange
36 |
37 | var s = TestZoneBuilder.Build();
38 | IServerEntity so = null;
39 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(ISpaceShip), 1));
40 |
41 | // Act
42 |
43 | s.ClientZones[0].RunAction(z => ((ClientSpaceShip)z.GetEntity(so.Id)).Shoot(1, 2));
44 |
45 | // Assert
46 |
47 | Assert.Equal(Tuple.Create(so.Id, "OnShoot(1, 2)"),
48 | s.ServerZone.Log(-1));
49 | }
50 |
51 | [Fact]
52 | public void Server_CallToClient_Called()
53 | {
54 | // Arrange
55 |
56 | var s = TestZoneBuilder.Build();
57 | IServerEntity so = null;
58 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(ISpaceShip), 1, EntityFlags.Normal));
59 |
60 | // Act
61 |
62 | s.ServerZone.RunAction(z => ((ServerSpaceShip)so).Hit(1, 2));
63 |
64 | // Assert
65 |
66 | foreach (var clientZone in s.ClientZones)
67 | {
68 | Assert.Equal(Tuple.Create(so.Id, "OnHit(1, 2)"),
69 | clientZone.Log(-1));
70 | }
71 | }
72 |
73 | [Fact]
74 | public void Client_CallPassThrough_Called()
75 | {
76 | // Arrange
77 |
78 | var s = TestZoneBuilder.Build();
79 | IServerEntity so = null;
80 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(ISpaceShip), 1, EntityFlags.Normal));
81 |
82 | // Act
83 |
84 | s.ClientZones[0].RunAction(z => ((ClientSpaceShip)z.GetEntity(so.Id)).Say("Hello"));
85 |
86 | // Assert
87 |
88 | foreach (var clientZone in s.ClientZones)
89 | {
90 | Assert.Equal(Tuple.Create(so.Id, "OnSay(Hello)"),
91 | clientZone.Log(-1));
92 | }
93 | }
94 |
95 | [Fact]
96 | public void AddClient_AddedClientZone_Synced()
97 | {
98 | // Arrange
99 |
100 | var s = TestZoneBuilder.Build();
101 | IServerEntity so = null;
102 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(ISpaceShip), 1, EntityFlags.Normal));
103 |
104 | // Act
105 |
106 | var zone = s.AddClient();
107 |
108 | // Assert
109 |
110 | var co = zone.Value.GetEntity(so.Id);
111 | Assert.NotNull(co);
112 | Assert.IsType(co);
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/EntityDataTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using Xunit;
4 |
5 | namespace EntityNetwork.Tests
6 | {
7 | public class EntityDataTest
8 | {
9 | [Fact]
10 | public void Spawn_Snapshot_Synced()
11 | {
12 | // Arrange
13 |
14 | var s = TestZoneBuilder.Build();
15 | IServerEntity so = null;
16 |
17 | // Act
18 |
19 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(ISpaceShip), 1, EntityFlags.Normal, "Enterprise"));
20 |
21 | // Assert
22 |
23 | foreach (var clientZone in s.ClientZones)
24 | {
25 | Assert.Equal(Tuple.Create(so.Id, "OnSnapshot(Enterprise)"),
26 | clientZone.Log(-2));
27 | Assert.Equal(Tuple.Create(so.Id, "Spawn"),
28 | clientZone.Log(-1));
29 | }
30 | }
31 |
32 | [Fact]
33 | public void Change_TrackableData_Synced()
34 | {
35 | // Arrange
36 |
37 | var s = TestZoneBuilder.Build();
38 | IServerEntity so = null;
39 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(ISpaceShip), 1, EntityFlags.Normal));
40 |
41 | // Act
42 |
43 | s.ClientZones[0].RunAction(z => ((ClientSpaceShip)z.GetEntity(so.Id)).Shoot(1, 2));
44 |
45 | // Assert
46 |
47 | foreach (var clientZone in s.ClientZones)
48 | {
49 | var clientEntity = (ClientSpaceShip)clientZone.GetEntity(so.Id);
50 | Assert.Equal(1, clientEntity.Data.Score);
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/EntityFactoryTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xunit;
3 |
4 | namespace EntityNetwork.Tests
5 | {
6 | public class EntityFactoryTest
7 | {
8 | [Fact]
9 | public void ServerEntityFactory_GetProtoType_From_ServerEntityType()
10 | {
11 | var factory = (IServerEntityFactory)new EntityFactory();
12 | var entityType = factory.GetProtoType(typeof(BulletServerBase));
13 | Assert.Equal(typeof(IBullet), entityType);
14 | }
15 |
16 | [Fact]
17 | public void ServerEntityFactory_GetProtoType_From_WrongEntityType()
18 | {
19 | var factory = (IServerEntityFactory)new EntityFactory();
20 | var entityType = factory.GetProtoType(typeof(BulletClientBase));
21 | Assert.Equal(null, entityType);
22 | }
23 |
24 | [Fact]
25 | public void ClientEntityFactory_GetProtoType_From_ClientEntityType()
26 | {
27 | var factory = (IClientEntityFactory)new EntityFactory();
28 | var entityType = factory.GetProtoType(typeof(BulletClientBase));
29 | Assert.Equal(typeof(IBullet), entityType);
30 | }
31 |
32 | [Fact]
33 | public void ClientEntityFactory_GetProtoType_From_WrongEntityType()
34 | {
35 | var factory = (IClientEntityFactory)new EntityFactory();
36 | var entityType = factory.GetProtoType(typeof(BulletServerBase));
37 | Assert.Equal(null, entityType);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/EntityServerOnlyTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using Xunit;
4 |
5 | namespace EntityNetwork.Tests
6 | {
7 | public class EntityServerOnlyTest
8 | {
9 | [Fact]
10 | public void Spawn_ServerOnlyEntity_WhenSpawn_ClientCannotSee()
11 | {
12 | // Arrange
13 |
14 | var s = TestZoneBuilder.Build();
15 |
16 | // Act
17 |
18 | IServerEntity so = null;
19 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(IMonitor), 0));
20 | Assert.NotNull(so);
21 | Assert.IsType(so);
22 |
23 | // Assert
24 |
25 | foreach (var clientZone in s.ClientZones)
26 | {
27 | IClientEntity co = clientZone.GetEntity(so.Id);
28 | Assert.Null(co);
29 | }
30 | }
31 |
32 | [Fact]
33 | public void Spawn_ServerOnlyEntity_WhenAddNewClient_ClientCannotSee()
34 | {
35 | // Arrange
36 |
37 | var s = TestZoneBuilder.Build();
38 |
39 | // Act
40 |
41 | IServerEntity so = null;
42 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(IMonitor), 0));
43 | var zone = s.AddClient();
44 |
45 | // Assert
46 |
47 | var co = zone.Value.GetEntity(so.Id);
48 | Assert.Null(co);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/EntitySingletonTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using Xunit;
4 |
5 | namespace EntityNetwork.Tests
6 | {
7 | public class EntitySingletonTest
8 | {
9 | [Fact]
10 | public void Spawn_SingletonEntity_When_NoExists_Succeed()
11 | {
12 | // Arrange
13 |
14 | var s = TestZoneBuilder.Build();
15 |
16 | // Act
17 |
18 | IServerEntity so = null;
19 | s.ServerZone.RunAction(z => so = z.Spawn(typeof(IEarth), 1));
20 |
21 | // Assert
22 |
23 | Assert.NotNull(so);
24 | Assert.IsType(so);
25 | }
26 |
27 | [Fact]
28 | public void Spawn_SingletonEntity_When_AlreadyExists_Fail()
29 | {
30 | // Arrange
31 |
32 | var s = TestZoneBuilder.Build();
33 | s.ServerZone.RunAction(z => z.Spawn(typeof(IEarth), 1));
34 |
35 | // Act & Assert
36 |
37 | Assert.Throws(() =>
38 | {
39 | s.ServerZone.RunAction(z => z.Spawn(typeof(IEarth), 1));
40 | });
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/EntityTimerTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Linq;
4 | using Xunit;
5 |
6 | namespace EntityNetwork.Tests
7 | {
8 | public class EntityTimerTest
9 | {
10 | [Fact]
11 | private void ServerEntity_SetTimerOnce()
12 | {
13 | // Arrange
14 |
15 | var s = TestZoneBuilder.Build();
16 | IServerEntity o = null;
17 | s.ServerZone.RunAction(z => { o = z.Spawn(typeof(IBullet), 0); });
18 |
19 | // Act & Assert
20 |
21 | var called = false;
22 | o.SetTimerOnce(1, TimeSpan.FromSeconds(1), (e, t) =>
23 | {
24 | Assert.Equal(e, o);
25 | Assert.Equal(1, t);
26 | called = true;
27 | });
28 | s.UpdateTime(TimeSpan.FromSeconds(1));
29 | Assert.True(called);
30 | }
31 |
32 | [Fact]
33 | private void ServerEntity_SetTimerRepeatedly()
34 | {
35 | // Arrange
36 |
37 | var s = TestZoneBuilder.Build();
38 | IServerEntity o = null;
39 | s.ServerZone.RunAction(z => { o = z.Spawn(typeof(IBullet), 0); });
40 |
41 | // Act & Assert
42 |
43 | var callCount = 0;
44 | o.SetTimerRepeatedly(1, TimeSpan.FromSeconds(1), (e, t) =>
45 | {
46 | Assert.Equal(e, o);
47 | Assert.Equal(1, t);
48 | callCount += 1;
49 | });
50 |
51 | s.UpdateTime(TimeSpan.FromSeconds(1));
52 | Assert.Equal(1, callCount);
53 |
54 | s.UpdateTime(TimeSpan.FromSeconds(1));
55 | Assert.Equal(2, callCount);
56 | }
57 |
58 | [Fact]
59 | private void ServerEntity_RemoveTimer()
60 | {
61 | // Arrange
62 |
63 | var s = TestZoneBuilder.Build();
64 | IServerEntity o = null;
65 | s.ServerZone.RunAction(z => { o = z.Spawn(typeof(IBullet), 0); });
66 |
67 | // Act & Assert
68 |
69 | var called1 = false;
70 | var called2 = false;
71 | o.SetTimerOnce(1, TimeSpan.FromSeconds(1), (e, t) =>
72 | {
73 | called1 = true;
74 | });
75 | o.SetTimerOnce(2, TimeSpan.FromSeconds(1), (e, t) =>
76 | {
77 | called2 = true;
78 | });
79 |
80 | o.RemoveTimer(1);
81 | s.UpdateTime(TimeSpan.FromSeconds(1));
82 |
83 | Assert.False(called1);
84 | Assert.True(called2);
85 | }
86 |
87 | [Fact]
88 | private void ServerEntity_RemoveTimerAll()
89 | {
90 | // Arrange
91 |
92 | var s = TestZoneBuilder.Build();
93 | IServerEntity o = null;
94 | s.ServerZone.RunAction(z => { o = z.Spawn(typeof(IBullet), 0); });
95 |
96 | // Act & Assert
97 |
98 | var called1 = false;
99 | var called2 = false;
100 | o.SetTimerOnce(1, TimeSpan.FromSeconds(1), (e, t) =>
101 | {
102 | called1 = true;
103 | });
104 | o.SetTimerOnce(2, TimeSpan.FromSeconds(1), (e, t) =>
105 | {
106 | called2 = true;
107 | });
108 |
109 | o.RemoveTimerAll();
110 | s.UpdateTime(TimeSpan.FromSeconds(1));
111 |
112 | Assert.False(called1);
113 | Assert.False(called2);
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("EntityNetwork.Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("EntityNetwork.Tests")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("9128479e-beb7-4984-8725-29d5a948abff")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/TestEntityBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EntityNetwork.Tests
4 | {
5 | public abstract class TestServerEntity : ServerEntity
6 | {
7 | protected void Log(string msg)
8 | {
9 | var z = (TestServerZone)Zone;
10 | z.Logs.Add(Tuple.Create(Id, msg));
11 | }
12 | }
13 |
14 | public abstract class TestClientEntity : ClientEntity
15 | {
16 | protected void Log(string msg)
17 | {
18 | var z = (TestClientZone)Zone;
19 | z.Logs.Add(Tuple.Create(Id, msg));
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/TestZone.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace EntityNetwork.Tests
5 | {
6 | internal class TestServerZone : ServerZone
7 | {
8 | public List> Logs = new List>();
9 |
10 | public Tuple Log(int index)
11 | {
12 | return index >= 0 ? Logs[index] : Logs[Logs.Count + index];
13 | }
14 |
15 | public TestServerZone(IServerEntityFactory entityFactory)
16 | : base(entityFactory)
17 | {
18 | EntitySpawned = OnSpawn;
19 | EntityDespawned = OnDespawn;
20 | EntityInvalidOwnershipInvoked = OnInvalidOwnershipInvoke;
21 | }
22 |
23 | private void OnSpawn(IServerEntity entity)
24 | {
25 | Logs.Add(Tuple.Create(entity.Id, "Spawn"));
26 | }
27 |
28 | private void OnDespawn(IServerEntity entity)
29 | {
30 | Logs.Add(Tuple.Create(entity.Id, "Despawn"));
31 | }
32 |
33 | private void OnInvalidOwnershipInvoke(int clientId, IServerEntity entity, IInvokePayload payload)
34 | {
35 | Logs.Add(Tuple.Create(entity.Id, "InvalidOwnershipInvoke"));
36 | }
37 | }
38 |
39 | internal class TestClientZone : ClientZone
40 | {
41 | public List> Logs = new List>();
42 |
43 | public Tuple Log(int index)
44 | {
45 | return index >= 0 ? Logs[index] : Logs[Logs.Count + index];
46 | }
47 |
48 | public TestClientZone(IClientEntityFactory entityFactory, ProtobufChannelToServerZoneOutbound serverChannel)
49 | : base(entityFactory, serverChannel)
50 | {
51 | EntitySpawned = OnSpawn;
52 | EntityDespawned = OnDespawn;
53 | }
54 |
55 | private void OnSpawn(IClientEntity entity)
56 | {
57 | Logs.Add(Tuple.Create(entity.Id, "Spawn"));
58 | }
59 |
60 | private void OnDespawn(IClientEntity entity)
61 | {
62 | Logs.Add(Tuple.Create(entity.Id, "Despawn"));
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/core/EntityNetwork.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/core/EntityNetwork/Attributes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EntityNetwork
4 | {
5 | [AttributeUsage(AttributeTargets.Method)]
6 | public sealed class PassThroughAttribute : Attribute
7 | {
8 | }
9 |
10 | [AttributeUsage(AttributeTargets.Method)]
11 | public sealed class ToServerAttribute : Attribute
12 | {
13 | }
14 |
15 | [AttributeUsage(AttributeTargets.Method)]
16 | public sealed class ToClientAttribute : Attribute
17 | {
18 | }
19 |
20 | [AttributeUsage(AttributeTargets.Method)]
21 | public sealed class AnyoneCanCallAttribute : Attribute
22 | {
23 | }
24 |
25 | [AttributeUsage(AttributeTargets.Interface)]
26 | public sealed class SingletonAttribute : Attribute
27 | {
28 | }
29 |
30 | [AttributeUsage(AttributeTargets.Interface)]
31 | public sealed class ServerOnlyAttribute : Attribute
32 | {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/core/EntityNetwork/ClientEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TrackableData;
3 |
4 | namespace EntityNetwork
5 | {
6 | // TODO: Remove setter of properties
7 |
8 | public interface IClientEntity : IEntity
9 | {
10 | Type ProtoType { get; set; }
11 | IClientZone Zone { get; set; }
12 | int OwnerId { get; set; }
13 | EntityFlags Flags { get; set; }
14 |
15 | object Snapshot { set; }
16 |
17 | int TrackableDataCount { get; }
18 | ITrackable GetTrackableData(int index);
19 | void SetTrackableData(int index, ITrackable trackable);
20 |
21 | void OnTrackableDataChanging(int index, ITracker tracker);
22 | void OnTrackableDataChanged(int index, ITracker tracker);
23 |
24 | void OnSpawn();
25 | void OnDespawn();
26 |
27 | void SetTimerOnce(int timerId, TimeSpan delay, Action action);
28 | void SetTimerRepeatedly(int timerId, TimeSpan interval, Action action);
29 | bool RemoveTimer(int timerId);
30 | void RemoveTimerAll();
31 | }
32 |
33 | public abstract class ClientEntity : IClientEntity
34 | {
35 | public int Id { get; set; }
36 | public Type ProtoType { get; set; }
37 | public IClientZone Zone { get; set; }
38 | public int OwnerId { get; set; }
39 | public EntityFlags Flags { get; set; }
40 |
41 | public virtual object Snapshot
42 | {
43 | set { }
44 | }
45 |
46 | public abstract int TrackableDataCount { get; }
47 | public abstract ITrackable GetTrackableData(int index);
48 | public abstract void SetTrackableData(int index, ITrackable trackable);
49 |
50 | public virtual void OnTrackableDataChanging(int index, ITracker tracker)
51 | {
52 | }
53 |
54 | public virtual void OnTrackableDataChanged(int index, ITracker tracker)
55 | {
56 | }
57 |
58 | public virtual void OnSpawn()
59 | {
60 | }
61 |
62 | public virtual void OnDespawn()
63 | {
64 | }
65 |
66 | public void SetTimerOnce(int timerId, TimeSpan delay, Action action)
67 | {
68 | Zone.TimerProvider.SetTimerOnce(Id, timerId, delay, action);
69 | }
70 |
71 | public void SetTimerRepeatedly(int timerId, TimeSpan interval, Action action)
72 | {
73 | Zone.TimerProvider.SetTimerRepeatedly(Id, timerId, interval, action);
74 | }
75 |
76 | public bool RemoveTimer(int timerId)
77 | {
78 | return Zone.TimerProvider.RemoveTimer(Id, timerId);
79 | }
80 |
81 | public void RemoveTimerAll()
82 | {
83 | Zone.TimerProvider.RemoveTimerAll(Id);
84 | }
85 |
86 | protected void SendInvoke(IInvokePayload payload)
87 | {
88 | Zone.Invoke(Id, payload);
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/core/EntityNetwork/Entity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EntityNetwork
4 | {
5 | public interface IEntityPrototype
6 | {
7 | }
8 |
9 | public interface IEntityServerHandler
10 | {
11 | }
12 |
13 | public interface IEntityClientHandler
14 | {
15 | }
16 |
17 | public interface IEntity
18 | {
19 | int Id { get; set; }
20 | }
21 |
22 | [Flags]
23 | public enum EntityFlags : byte
24 | {
25 | Normal = 0,
26 | Singleton = 1,
27 | ServerOnly = 2,
28 | LiveWhenOwnerGoAway = 4,
29 | AnyoneCanControl = 8,
30 | // TODO: ClientCanUpdateTrackableData
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/core/EntityNetwork/EntityNetwork.Release.md:
--------------------------------------------------------------------------------
1 | ## 0.2.1 (Released 2016/05/31)
2 |
3 | * Update protobuf-net 2.1.0-alpha-1
4 |
5 | ## 0.2.0 (Released 2015/12/18)
6 |
7 | * Initial Release
8 |
--------------------------------------------------------------------------------
/core/EntityNetwork/EntityNetwork.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @project@
5 | @project@@title@
6 | @build.number@
7 | Esun Kim
8 | Esun Kim
9 | EntityNetwork
10 | https://raw.githubusercontent.com/SaladLab/EntityNetwork/master/LICENSE
11 | https://github.com/SaladLab/EntityNetwork
12 | false
13 | @releaseNotes@
14 | Copyright © 2016 SaladLab
15 | entity network online game
16 | @dependencies@
17 | @references@
18 |
19 |
20 |
--------------------------------------------------------------------------------
/core/EntityNetwork/Payload.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EntityNetwork
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public sealed class PayloadTableForEntity : Attribute
7 | {
8 | public Type Type { get; private set; }
9 |
10 | public PayloadTableForEntity(Type type)
11 | {
12 | Type = type;
13 | }
14 | }
15 |
16 | [Flags]
17 | public enum PayloadFlags
18 | {
19 | PassThrough = 1,
20 | ToServer = 2,
21 | ToClient = 4,
22 | AnyoneCanCall = 8,
23 | }
24 |
25 | public interface IInvokePayload
26 | {
27 | PayloadFlags Flags { get; }
28 | /*
29 | Type GetInterfaceType();
30 | Type GetServerInterfaceType();
31 | Type GetClientInterfaceType();
32 | */
33 | void InvokeServer(IEntityServerHandler target);
34 | void InvokeClient(IEntityClientHandler target);
35 | }
36 |
37 | public interface ISpawnPayload
38 | {
39 | void Gather(IServerEntity entity);
40 | void Notify(IClientEntity entity);
41 | }
42 |
43 | public interface IUpdateChangePayload
44 | {
45 | void Gather(IServerEntity entity);
46 | void Notify(IClientEntity entity);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/core/EntityNetwork/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("EntityNetwork")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("SaladLab")]
13 | [assembly: AssemblyProduct("EntityNetwork")]
14 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 |
22 | [assembly: ComVisible(false)]
23 |
24 | // The following GUID is for the ID of the typelib if this project is exposed to COM
25 |
26 | [assembly: Guid("b4dabd10-05b5-47f6-92d2-53f1cbe4214e")]
27 |
28 | [assembly: InternalsVisibleTo("EntityNetwork.Tests")]
29 |
--------------------------------------------------------------------------------
/core/EntityNetwork/Properties/AssemblyInfoGenerated.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System.Reflection;
3 |
4 | [assembly: AssemblyVersionAttribute("0.0.0")]
5 | [assembly: AssemblyFileVersionAttribute("0.2.1")]
6 | [assembly: AssemblyInformationalVersionAttribute("0.2.1")]
7 | namespace System {
8 | internal static class AssemblyVersionInformation {
9 | internal const string Version = "0.0.0";
10 | internal const string InformationalVersion = "0.2.1";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/core/EntityNetwork/ServerEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TrackableData;
3 |
4 | namespace EntityNetwork
5 | {
6 | // TODO: Remove setter of properties
7 |
8 | public interface IServerEntity : IEntity
9 | {
10 | Type ProtoType { get; set; }
11 | IServerZone Zone { get; set; }
12 | int OwnerId { get; set; }
13 | EntityFlags Flags { get; set; }
14 |
15 | object Snapshot { get; }
16 |
17 | int TrackableDataCount { get; }
18 | ITrackable GetTrackableData(int index);
19 | void SetTrackableData(int index, ITrackable trackable);
20 |
21 | ISpawnPayload GetSpawnPayload();
22 | IUpdateChangePayload GetUpdateChangePayload();
23 |
24 | void OnSpawn(object param);
25 | void OnDespawn();
26 |
27 | void SetTimerOnce(int timerId, TimeSpan delay, Action action);
28 | void SetTimerRepeatedly(int timerId, TimeSpan interval, Action action);
29 | bool RemoveTimer(int timerId);
30 | void RemoveTimerAll();
31 | }
32 |
33 | public abstract class ServerEntity : IServerEntity
34 | {
35 | public int Id { get; set; }
36 | public Type ProtoType { get; set; }
37 | public IServerZone Zone { get; set; }
38 | public int OwnerId { get; set; }
39 | public EntityFlags Flags { get; set; }
40 |
41 | public virtual object Snapshot
42 | {
43 | get { return null; }
44 | }
45 |
46 | public abstract int TrackableDataCount { get; }
47 | public abstract ITrackable GetTrackableData(int index);
48 | public abstract void SetTrackableData(int index, ITrackable trackable);
49 |
50 | public virtual ISpawnPayload GetSpawnPayload()
51 | {
52 | return null;
53 | }
54 |
55 | public virtual IUpdateChangePayload GetUpdateChangePayload()
56 | {
57 | return null;
58 | }
59 |
60 | public virtual void OnSpawn(object param)
61 | {
62 | }
63 |
64 | public virtual void OnDespawn()
65 | {
66 | }
67 |
68 | public void SetTimerOnce(int timerId, TimeSpan delay, Action action)
69 | {
70 | Zone.TimerProvider.SetTimerOnce(Id, timerId, delay, action);
71 | }
72 |
73 | public void SetTimerRepeatedly(int timerId, TimeSpan interval, Action action)
74 | {
75 | Zone.TimerProvider.SetTimerRepeatedly(Id, timerId, interval, action);
76 | }
77 |
78 | public bool RemoveTimer(int timerId)
79 | {
80 | return Zone.TimerProvider.RemoveTimer(Id, timerId);
81 | }
82 |
83 | public void RemoveTimerAll()
84 | {
85 | Zone.TimerProvider.RemoveTimerAll(Id);
86 | }
87 |
88 | protected void SendInvoke(IInvokePayload payload)
89 | {
90 | Zone.Invoke(Id, payload);
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/core/EntityNetwork/Zone.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using TrackableData;
4 |
5 | namespace EntityNetwork
6 | {
7 | public interface IZone
8 | {
9 | IEntity GetEntity(int entityId);
10 | void Invoke(int entityId, IInvokePayload payload);
11 | TimeSpan GetTime();
12 | }
13 |
14 | public interface IServerZone : IZone
15 | {
16 | IServerEntity Spawn(Type protoType, int ownerId, EntityFlags flags, object param);
17 | bool Despawn(int id);
18 | new IServerEntity GetEntity(int entityId);
19 | IServerEntity GetEntity(Type protoType);
20 | T GetEntity()
21 | where T : class, IServerEntity;
22 | IEnumerable GetEntityIds();
23 | IEnumerable GetEntities();
24 | IEnumerable GetEntities(Type protoType);
25 | IEnumerable GetEntities()
26 | where T : class, IServerEntity;
27 | IEntityTimerProvider TimerProvider { get; }
28 | }
29 |
30 | public interface IEntityTimerProvider
31 | {
32 | void SetTimerOnce(int entityId, int timerId, TimeSpan delay, Action action);
33 | void SetTimerRepeatedly(int entityId, int timerId, TimeSpan interval, Action action);
34 | bool RemoveTimer(int entityId, int timerId);
35 | void RemoveTimerAll(int entityId);
36 | }
37 |
38 | public interface IClientZone : IZone
39 | {
40 | int ClientId { get; }
41 | new IClientEntity GetEntity(int entityId);
42 | IClientEntity GetEntity(Type protoType);
43 | T GetEntity()
44 | where T : class, IClientEntity;
45 | IEnumerable GetEntityIds();
46 | IEnumerable GetEntities();
47 | IEnumerable GetEntities(Type protoType);
48 | IEnumerable GetEntities()
49 | where T : class, IClientEntity;
50 | IEntityTimerProvider TimerProvider { get; }
51 | }
52 |
53 | public interface IChannelToServerZone
54 | {
55 | void Invoke(int clientId, int entityId, IInvokePayload payload);
56 | void UpdateChange(int clientId, int entityId, int trackableDataIndex, ITracker tracker);
57 | }
58 |
59 | public interface IChannelToClientZone
60 | {
61 | void Init(int clientId, DateTime startTime, TimeSpan elapsedTime);
62 | void Spawn(int entityId, Type protoType, int ownerId, EntityFlags flags, ISpawnPayload payload);
63 | void Despawn(int entityId);
64 | void Invoke(int entityId, IInvokePayload payload);
65 | void UpdateChange(int entityId, IUpdateChangePayload payload);
66 | void OwnershipChange(int entityId, int ownerId);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/core/EntityNetwork/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/core/UnityPackage/EntityNetwork.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "EntityNetwork",
3 | "version": "0.2.1",
4 | "authors": [ "Esun Kim" ],
5 | "owners": [ "Esun Kim" ],
6 | "description": "EntityNetwork",
7 | "dependencies": {
8 | "NetLegacySupport": {
9 | "version": "1.*",
10 | "source": "github:SaladLab/NetLegacySupport"
11 | },
12 | "protobuf-net": {
13 | "version": "2.1.0-alpha-1",
14 | "source": "nuget:net30"
15 | },
16 | "TrackableData": {
17 | "version": "1.*",
18 | "source": "github:SaladLab/TrackableData"
19 | }
20 | },
21 | "files": [
22 | "../EntityNetwork.Net35/bin/Release/EntityNetwork.dll",
23 | "../../plugins/EntityNetwork.Unity3D/bin/Release/EntityNetwork.Unity3D.dll",
24 | "Sources/*.cs",
25 | "Sources/*.prefab",
26 | "$dependencies$"
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/core/UnityPackage/Sources/ClientEntityFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using EntityNetwork;
4 | using EntityNetwork.Unity3D;
5 | using UnityEngine;
6 |
7 | public class ClientEntityFactory : IClientEntityFactory
8 | {
9 | private static ClientEntityFactory _default;
10 |
11 | public static ClientEntityFactory Default
12 | {
13 | get { return _default ?? (_default = new ClientEntityFactory()); }
14 | }
15 |
16 | public Transform RootTransform { get; set; }
17 |
18 | private readonly ConcurrentDictionary _clientEntityToProtoTypeMap =
19 | new ConcurrentDictionary();
20 |
21 | Type IClientEntityFactory.GetProtoType(Type entityType)
22 | {
23 | return _clientEntityToProtoTypeMap.GetOrAdd(entityType, t =>
24 | {
25 | var type = entityType;
26 | while (type != null && type != typeof(object))
27 | {
28 | if (type.Name.EndsWith("ClientBase"))
29 | {
30 | var typePrefix = type.Namespace.Length > 0 ? type.Namespace + "." : "";
31 | var protoType = type.Assembly.GetType(typePrefix + "I" +
32 | type.Name.Substring(0, type.Name.Length - 10));
33 | if (protoType != null && typeof(IEntityPrototype).IsAssignableFrom(protoType))
34 | {
35 | return protoType;
36 | }
37 | }
38 | type = type.BaseType;
39 | }
40 | return null;
41 | });
42 | }
43 |
44 | IClientEntity IClientEntityFactory.Create(Type protoType)
45 | {
46 | var resourceName = "Client" + protoType.Name.Substring(1);
47 | var resource = Resources.Load(resourceName);
48 | if (resource == null)
49 | throw new InvalidOperationException("Failed to load resource(" + resourceName + ")");
50 |
51 | var go = (GameObject)UnityEngine.Object.Instantiate(resource);
52 | if (go == null)
53 | throw new InvalidOperationException("Failed to instantiate resource(" + resourceName + ")");
54 |
55 | if (RootTransform != null)
56 | go.transform.SetParent(RootTransform, false);
57 |
58 | return go.GetComponent();
59 | }
60 |
61 | void IClientEntityFactory.Delete(IClientEntity entity)
62 | {
63 | var enb = ((EntityNetworkBehaviour)entity);
64 | UnityEngine.Object.Destroy(enb.gameObject);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/core/UnityPackage/Sources/EntityNetworkChannel.cs:
--------------------------------------------------------------------------------
1 | using EntityNetwork;
2 |
3 | public class EntityNetworkChannelToServerZone : IByteChannel
4 | {
5 | public EntityNetworkClient NetworkClient;
6 |
7 | public void Write(byte[] bytes)
8 | {
9 | NetworkClient.CmdBuffer(bytes);
10 | }
11 | }
12 |
13 | public class EntityNetworkChannelToClientZone : IByteChannel
14 | {
15 | public EntityNetworkClient NetworkClient;
16 |
17 | public void Write(byte[] bytes)
18 | {
19 | if (bytes == null)
20 | return;
21 |
22 | NetworkClient.RpcBuffer(bytes);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/core/UnityPackage/Sources/EntityNetworkClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using EntityNetwork;
3 | using UnityEngine;
4 | using UnityEngine.Networking;
5 |
6 | public class EntityNetworkClient : NetworkBehaviour
7 | {
8 | public static int LocalClientId;
9 | public static ClientZone LocalClientZone;
10 |
11 | private int _clientId;
12 | private ClientZone _zone;
13 | private ProtobufChannelToClientZoneInbound _zoneChannel;
14 |
15 | public int ClientId
16 | {
17 | get { return _clientId; }
18 | }
19 |
20 | // Registration
21 |
22 | public override void OnStartClient()
23 | {
24 | // In OnStartClient, ClientRpc is not called.
25 | // To workaround this limitation, use coroutine
26 | StartCoroutine(AddClientToZone());
27 | }
28 |
29 | private void OnDestroy()
30 | {
31 | EntityNetworkManager.Instance.RemoveClientToZone(_clientId);
32 | }
33 |
34 | private IEnumerator AddClientToZone()
35 | {
36 | // By OnStartClient's note
37 | yield return null;
38 |
39 | if (hasAuthority == false)
40 | yield break;
41 |
42 | var channel = new ProtobufChannelToServerZoneOutbound
43 | {
44 | OutboundChannel = new EntityNetworkChannelToServerZone { NetworkClient = this },
45 | TypeTable = EntityNetworkManager.Instance.GetTypeAliasTable(),
46 | TypeModel = EntityNetworkManager.Instance.GetTypeModel()
47 | };
48 |
49 | _clientId = (int)netId.Value;
50 | _zone = new ClientZone(EntityNetworkManager.Instance.GetClientEntityFactory(), channel);
51 | _zoneChannel = new ProtobufChannelToClientZoneInbound
52 | {
53 | TypeTable = EntityNetworkManager.Instance.GetTypeAliasTable(),
54 | TypeModel = EntityNetworkManager.Instance.GetTypeModel(),
55 | InboundClientZone = _zone
56 | };
57 |
58 | LocalClientId = _clientId;
59 | LocalClientZone = _zone;
60 |
61 | CmdAddClientToZone();
62 | }
63 |
64 | [Command]
65 | public void CmdAddClientToZone()
66 | {
67 | _clientId = (int)netId.Value;
68 |
69 | var result = EntityNetworkManager.Instance.AddClientToZone(_clientId, this);
70 | RpcAddClientToZoneDone(result);
71 | }
72 |
73 | [ClientRpc]
74 | public void RpcAddClientToZoneDone(bool added)
75 | {
76 | if (hasAuthority == false)
77 | return;
78 |
79 | Debug.LogFormat("EntityNetworkClient({0}).RpcAddClientToZoneDone({1})", _clientId, added);
80 | if (added)
81 | {
82 | CmdAddClientToZoneDone();
83 | }
84 | else
85 | {
86 | _clientId = 0;
87 | _zone = null;
88 | _zoneChannel = null;
89 | LocalClientId = 0;
90 | }
91 | }
92 |
93 | [Command]
94 | public void CmdAddClientToZoneDone()
95 | {
96 | Debug.LogFormat("EntityNetworkClient({0}).CmdAddClientToZoneDone", _clientId);
97 | }
98 |
99 | // Zone Channel
100 |
101 | [Command]
102 | public void CmdBuffer(byte[] bytes)
103 | {
104 | EntityNetworkManager.Instance.WriteZoneChannel(ClientId, bytes);
105 | }
106 |
107 | [ClientRpc]
108 | public void RpcBuffer(byte[] bytes)
109 | {
110 | if (hasAuthority == false)
111 | return;
112 |
113 | _zoneChannel.Write(bytes);
114 | }
115 |
116 | private void Update()
117 | {
118 | if (_zone != null)
119 | ((EntityTimerProvider)_zone.TimerProvider).ProcessWork();
120 | }
121 |
122 | public override void OnNetworkDestroy()
123 | {
124 | Debug.LogFormat("EntityNetworkClient({0}).OnNetworkDestroy", _clientId);
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/core/UnityPackage/Sources/EntityNetworkClient.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &187252
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 4: {fileID: 413176}
11 | - 114: {fileID: 11463654}
12 | - 114: {fileID: 11461522}
13 | m_Layer: 0
14 | m_Name: EntityNetworkClient
15 | m_TagString: Untagged
16 | m_Icon: {fileID: 0}
17 | m_NavMeshLayer: 0
18 | m_StaticEditorFlags: 0
19 | m_IsActive: 1
20 | --- !u!4 &413176
21 | Transform:
22 | m_ObjectHideFlags: 1
23 | m_PrefabParentObject: {fileID: 0}
24 | m_PrefabInternal: {fileID: 100100000}
25 | m_GameObject: {fileID: 187252}
26 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
27 | m_LocalPosition: {x: 0, y: 0, z: 0}
28 | m_LocalScale: {x: 1, y: 1, z: 1}
29 | m_Children: []
30 | m_Father: {fileID: 0}
31 | m_RootOrder: 0
32 | --- !u!114 &11461522
33 | MonoBehaviour:
34 | m_ObjectHideFlags: 1
35 | m_PrefabParentObject: {fileID: 0}
36 | m_PrefabInternal: {fileID: 100100000}
37 | m_GameObject: {fileID: 187252}
38 | m_Enabled: 1
39 | m_EditorHideFlags: 0
40 | m_Script: {fileID: 11500000, guid: d1b06c79502b5b63aa25f519ccc85630, type: 3}
41 | m_Name:
42 | m_EditorClassIdentifier:
43 | --- !u!114 &11463654
44 | MonoBehaviour:
45 | m_ObjectHideFlags: 1
46 | m_PrefabParentObject: {fileID: 0}
47 | m_PrefabInternal: {fileID: 100100000}
48 | m_GameObject: {fileID: 187252}
49 | m_Enabled: 1
50 | m_EditorHideFlags: 0
51 | m_Script: {fileID: 372142912, guid: 870353891bb340e2b2a9c8707e7419ba, type: 3}
52 | m_Name:
53 | m_EditorClassIdentifier:
54 | m_SceneId:
55 | m_Value: 0
56 | m_AssetId:
57 | i0: 29
58 | i1: 72
59 | i2: 233
60 | i3: 101
61 | i4: 219
62 | i5: 19
63 | i6: 60
64 | i7: 164
65 | i8: 139
66 | i9: 31
67 | i10: 35
68 | i11: 104
69 | i12: 26
70 | i13: 239
71 | i14: 232
72 | i15: 27
73 | m_ServerOnly: 0
74 | m_LocalPlayerAuthority: 1
75 | --- !u!1001 &100100000
76 | Prefab:
77 | m_ObjectHideFlags: 1
78 | serializedVersion: 2
79 | m_Modification:
80 | m_TransformParent: {fileID: 0}
81 | m_Modifications:
82 | - target: {fileID: 0}
83 | propertyPath: m_LocalPlayerAuthority
84 | value: 1
85 | objectReference: {fileID: 0}
86 | m_RemovedComponents: []
87 | m_ParentPrefab: {fileID: 0}
88 | m_RootGameObject: {fileID: 187252}
89 | m_IsPrefabParent: 1
90 |
--------------------------------------------------------------------------------
/plugins/EntityNetwork.Unity3D/EntityNetwork.Unity3D.Release.md:
--------------------------------------------------------------------------------
1 | ## 0.2.1 (Released 2016/05/31)
2 |
3 | * Update protobuf-net 2.1.0-alpha-1
4 |
5 | ## 0.2.0 (Released 2015/12/18)
6 |
7 | * Initial Release
8 |
--------------------------------------------------------------------------------
/plugins/EntityNetwork.Unity3D/EntityNetwork.Unity3D.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @project@
5 | @project@@title@
6 | @build.number@
7 | Esun Kim
8 | Esun Kim
9 | EntityNetwork for Unity3D
10 | https://raw.githubusercontent.com/SaladLab/EntityNetwork/master/LICENSE
11 | https://github.com/SaladLab/EntityNetwork
12 | false
13 | @releaseNotes@
14 | Copyright © 2016 SaladLab
15 | entity network online game unity3d
16 | @dependencies@
17 | @references@
18 |
19 |
20 |
--------------------------------------------------------------------------------
/plugins/EntityNetwork.Unity3D/EntityNetworkBehaviour.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TrackableData;
3 | using UnityEngine;
4 |
5 | namespace EntityNetwork.Unity3D
6 | {
7 | public abstract class EntityNetworkBehaviour : MonoBehaviour, IClientEntity
8 | {
9 | public int Id { get; set; }
10 | public Type ProtoType { get; set; }
11 | public IClientZone Zone { get; set; }
12 | public int OwnerId { get; set; }
13 | public EntityFlags Flags { get; set; }
14 |
15 | public virtual object Snapshot { set { } }
16 |
17 | public abstract int TrackableDataCount { get; }
18 | public abstract ITrackable GetTrackableData(int index);
19 | public abstract void SetTrackableData(int index, ITrackable trackable);
20 |
21 | public virtual void OnTrackableDataChanging(int index, ITracker tracker)
22 | {
23 | }
24 |
25 | public virtual void OnTrackableDataChanged(int index, ITracker tracker)
26 | {
27 | }
28 |
29 | public virtual void OnSpawn()
30 | {
31 | }
32 |
33 | public virtual void OnDespawn()
34 | {
35 | }
36 |
37 | public void SetTimerOnce(int timerId, TimeSpan delay, Action action)
38 | {
39 | Zone.TimerProvider.SetTimerOnce(Id, timerId, delay, action);
40 | }
41 |
42 | public void SetTimerRepeatedly(int timerId, TimeSpan interval, Action action)
43 | {
44 | Zone.TimerProvider.SetTimerRepeatedly(Id, timerId, interval, action);
45 | }
46 |
47 | public bool RemoveTimer(int timerId)
48 | {
49 | return Zone.TimerProvider.RemoveTimer(Id, timerId);
50 | }
51 |
52 | public void RemoveTimerAll()
53 | {
54 | Zone.TimerProvider.RemoveTimerAll(Id);
55 | }
56 |
57 | protected void SendInvoke(IInvokePayload payload)
58 | {
59 | Zone.Invoke(Id, payload);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/plugins/EntityNetwork.Unity3D/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("EntityNetwork.Unity3D")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("EntityNetwork.Unity3D")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3727abfb-0b48-45fc-ba83-76d4fedcd200")]
24 |
--------------------------------------------------------------------------------
/plugins/EntityNetwork.Unity3D/Properties/AssemblyInfoGenerated.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System.Reflection;
3 |
4 | [assembly: AssemblyVersionAttribute("0.0.0")]
5 | [assembly: AssemblyFileVersionAttribute("0.2.1")]
6 | [assembly: AssemblyInformationalVersionAttribute("0.2.1")]
7 | namespace System {
8 | internal static class AssemblyVersionInformation {
9 | internal const string Version = "0.0.0";
10 | internal const string InformationalVersion = "0.2.1";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/plugins/EntityNetwork.Unity3D/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/samples/Basic/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/samples/Basic/Bullet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Basic
4 | {
5 | public class ServerBullet : BulletServerBase, IBulletServerHandler
6 | {
7 | public void OnHit(float x = 0, float y = 0)
8 | {
9 | Console.WriteLine($"Bullet({Id}).Hit({x}, {y})");
10 | }
11 | }
12 |
13 | public class ClientBullet : BulletClientBase, IBulletClientHandler
14 | {
15 | public void OnHit(float x = 0, float y = 0)
16 | {
17 | Console.WriteLine($"Bullet({Id}).Hit({x}, {y})");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/samples/Basic/IBullet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using EntityNetwork;
7 | using TypeAlias;
8 |
9 | namespace Basic
10 | {
11 | [TypeAlias]
12 | public interface IBullet : IEntityPrototype
13 | {
14 | void Hit(float x = 0f, float y = 0f);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/Basic/ISpaceShip.cs:
--------------------------------------------------------------------------------
1 | using EntityNetwork;
2 | using ProtoBuf;
3 | using TrackableData;
4 | using TypeAlias;
5 |
6 | namespace Basic
7 | {
8 | [TypeAlias]
9 | public interface ISpaceShip : IEntityPrototype
10 | {
11 | ISpaceShipData Data { get; }
12 | SpaceShipSnapshot Snapshot { get; }
13 |
14 | void Say(string msg);
15 | [PassThrough] void Move(float x, float y, float dx, float dy);
16 | [PassThrough] void Stop(float x, float y);
17 | [ToServer] void Shoot(float x, float y, float dx, float dy);
18 | [ToClient] void Hit(float x = 0f, float y = 0f);
19 | }
20 |
21 | [ProtoContract]
22 | public interface ISpaceShipData : ITrackablePoco
23 | {
24 | [ProtoMember(1)] float Hp { get; set; }
25 | [ProtoMember(2)] float Score { get; set; }
26 | }
27 |
28 | [ProtoContract, TypeAlias]
29 | public class SpaceShipSnapshot
30 | {
31 | [ProtoMember(1)] public string Name;
32 | [ProtoMember(2)] public float X;
33 | [ProtoMember(3)] public float Y;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/Basic/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using EntityNetwork;
7 | using ProtoBuf.Meta;
8 | using TrackableData;
9 | using TypeAlias;
10 |
11 | namespace Basic
12 | {
13 | internal class DummyChannelToServerZoneInbound : IByteChannel
14 | {
15 | public ProtobufChannelToServerZoneInbound Channel;
16 |
17 | public void Write(byte[] bytes)
18 | {
19 | ((ServerZone)Channel.InboundServerZone).RunAction(_ => { Channel.Write(bytes); });
20 | }
21 | }
22 |
23 | internal class Program
24 | {
25 | private static void Main(string[] args)
26 | {
27 | var typeTable = new TypeAliasTable();
28 |
29 | var typeModel = TypeModel.Create();
30 | typeModel.Add(typeof(TrackablePocoTracker), false)
31 | .SetSurrogate(typeof(TrackableSpaceShipDataTrackerSurrogate));
32 |
33 | var serverZone = new ServerZone(EntityFactory.Default);
34 |
35 | var clientZones = Enumerable.Range(0, 2).Select(i =>
36 | {
37 | var channelUp = new ProtobufChannelToServerZoneOutbound
38 | {
39 | TypeTable = typeTable,
40 | TypeModel = typeModel,
41 | OutboundChannel = new DummyChannelToServerZoneInbound
42 | {
43 | Channel = new ProtobufChannelToServerZoneInbound
44 | {
45 | TypeTable = typeTable,
46 | TypeModel = typeModel,
47 | ClientId = i + 1,
48 | InboundServerZone = serverZone,
49 | }
50 | }
51 | };
52 | var clientZone = new ClientZone(EntityFactory.Default, channelUp);
53 | var channel = new ProtobufChannelToClientZoneOutbound
54 | {
55 | TypeTable = typeTable,
56 | TypeModel = typeModel,
57 | OutboundChannel = new ProtobufChannelToClientZoneInbound()
58 | {
59 | TypeTable = typeTable,
60 | TypeModel = typeModel,
61 | InboundClientZone = clientZone,
62 | }
63 | };
64 | serverZone.AddClient(i + 1, channel);
65 | return clientZone;
66 | }).ToArray();
67 |
68 | serverZone.RunAction(zone =>
69 | {
70 | zone.Spawn(typeof(ISpaceShip), 0, EntityFlags.AnyoneCanControl);
71 | });
72 |
73 | var cship1A = (ClientSpaceShip)clientZones[0].GetEntity(1);
74 | var cship1B = (ClientSpaceShip)clientZones[1].GetEntity(1);
75 |
76 | Console.WriteLine($"cship1A.Score = {cship1A.Data.Score}");
77 | clientZones[0].RunAction(_ => cship1A.Say("Hello"));
78 | Console.WriteLine($"cship1A.Score = {cship1A.Data.Score}");
79 | clientZones[0].RunAction(_ => cship1A.Stop(1, 2));
80 | clientZones[1].RunAction(_ =>
81 | {
82 | cship1B.Say("World");
83 | cship1B.Shoot(1, 2, 3, 4);
84 | });
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/samples/Basic/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Basic")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("Basic")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("596c5a87-a78e-4659-b679-62362e61e3c8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/samples/Basic/SpaceShip.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using EntityNetwork;
3 |
4 | namespace Basic
5 | {
6 | public class ServerSpaceShip : SpaceShipServerBase, ISpaceShipServerHandler
7 | {
8 | private string _name;
9 | private float _x;
10 | private float _y;
11 |
12 | public override void OnSpawn(object param)
13 | {
14 | _name = (string)param;
15 | }
16 |
17 | public override SpaceShipSnapshot OnSnapshot()
18 | {
19 | return new SpaceShipSnapshot { Name = _name };
20 | }
21 |
22 | public void OnSay(string msg)
23 | {
24 | Console.WriteLine($"Say({msg})");
25 | Say(msg);
26 | Data.Score += 1;
27 | }
28 |
29 | public void OnShoot(float x, float y, float dx, float dy)
30 | {
31 | Console.WriteLine($"SpaceShip({Id}).Shoot({x}, {y}, {dx}, {dy})");
32 |
33 | // TEST
34 | var bullet = (ServerBullet)Zone.Spawn(typeof(IBullet), 0, EntityFlags.Normal, null);
35 | bullet.Hit(1, 1);
36 | }
37 | }
38 |
39 | public class ClientSpaceShip : SpaceShipClientBase, ISpaceShipClientHandler
40 | {
41 | public override void OnSnapshot(SpaceShipSnapshot snapshot)
42 | {
43 | Console.WriteLine($"Client.OnSnapshot({snapshot.Name})");
44 | }
45 |
46 | public void OnSay(string msg)
47 | {
48 | Console.WriteLine($"Client.OnSay({msg})");
49 | }
50 |
51 | public void OnMove(float x, float y, float dx, float dy)
52 | {
53 | Console.WriteLine($"Client.OnMove({x}, {y}, {dx}, {dy})");
54 | }
55 |
56 | public void OnStop(float x, float y)
57 | {
58 | Console.WriteLine($"Client.OnStop({x}, {y})");
59 | }
60 |
61 | public void OnHit(float x = 0, float y = 0)
62 | {
63 | Console.WriteLine($"Client.OnHit({x}, {y})");
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/samples/Basic/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/samples/Unity/Domain.Unity3D/Properties/Akka.Interfaced.CodeGen.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Domain.Unity3D/Properties/Akka.Interfaced.CodeGen.cs
--------------------------------------------------------------------------------
/samples/Unity/Domain.Unity3D/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Unity.Domain.Net35")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("Unity.Domain.Net35")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("2a07b47b-4e18-4330-bd07-1a0e8ec53b1e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/samples/Unity/Domain.Unity3D/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Entity/Bullet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Domain
4 | {
5 | public class ServerBullet : BulletServerBase, IBulletServerHandler
6 | {
7 | public void OnHit(float x = 0, float y = 0)
8 | {
9 | Console.WriteLine($"Bullet({Id}).Hit({x}, {y})");
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Entity/IBullet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using EntityNetwork;
6 | using TypeAlias;
7 |
8 | namespace Domain
9 | {
10 | [TypeAlias]
11 | public interface IBullet : IEntityPrototype
12 | {
13 | void Hit(float x = 0f, float y = 0f);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Entity/ISpaceShip.cs:
--------------------------------------------------------------------------------
1 | using EntityNetwork;
2 | using ProtoBuf;
3 | using TrackableData;
4 | using TypeAlias;
5 |
6 | namespace Domain
7 | {
8 | [TypeAlias]
9 | public interface ISpaceShip : IEntityPrototype
10 | {
11 | SpaceShipSnapshot Snapshot { get; }
12 | ISpaceShipData Data { get; }
13 |
14 | void Say(string msg);
15 | [PassThrough] void Move(float x, float y, float dx, float dy);
16 | [PassThrough] void Stop(float x, float y);
17 | [ToServer] void Shoot(float x, float y, float dx, float dy);
18 | [ToClient] void Hit(float x = 0f, float y = 0f);
19 | }
20 |
21 | [ProtoContract, TypeAlias]
22 | public class SpaceShipSnapshot
23 | {
24 | [ProtoMember(1)] public string Name;
25 | [ProtoMember(2)] public float X;
26 | [ProtoMember(3)] public float Y;
27 | }
28 |
29 | [ProtoContract]
30 | public interface ISpaceShipData : ITrackablePoco
31 | {
32 | [ProtoMember(1)] float Hp { get; set; }
33 | [ProtoMember(2)] float Score { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Entity/SpaceShip.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using EntityNetwork;
3 |
4 | namespace Domain
5 | {
6 | public class ServerSpaceShip : SpaceShipServerBase, ISpaceShipServerHandler
7 | {
8 | public override SpaceShipSnapshot OnSnapshot()
9 | {
10 | return new SpaceShipSnapshot();
11 | }
12 |
13 | public void OnSay(string msg)
14 | {
15 | Console.WriteLine($"Say({msg})");
16 | Say(msg);
17 | }
18 |
19 | public void OnShoot(float x, float y, float dx, float dy)
20 | {
21 | Console.WriteLine($"SpaceShip({Id}).Shoot({x}, {y}, {dx}, {dy})");
22 |
23 | // TEST
24 | var bullet = (ServerBullet)Zone.Spawn(typeof(IBullet), 0, EntityFlags.Normal, null);
25 | bullet.Hit(1, 1);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Interface/GameInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using ProtoBuf;
4 |
5 | namespace Domain
6 | {
7 | [ProtoContract]
8 | public class GameInfo
9 | {
10 | [ProtoMember(1)] public string Name;
11 | [ProtoMember(2)] public List Users;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Interface/IGame.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Akka.Interfaced;
4 |
5 | namespace Domain
6 | {
7 | public interface IGame : IInterfacedActor
8 | {
9 | Task> Enter(string userId, IGameObserver observer);
10 | Task Leave(string userId);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Interface/IGameClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using Akka.Interfaced;
4 |
5 | namespace Domain
6 | {
7 | // Any user who is in a game
8 | [TagOverridable("senderUserId")]
9 | public interface IGameClient : IInterfacedActor
10 | {
11 | Task ZoneChange(string senderUserId, byte[] bytes);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Interface/IGameObserver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Akka.Interfaced;
3 |
4 | namespace Domain
5 | {
6 | public interface IGameObserver : IInterfacedObserver
7 | {
8 | void Enter(string userId);
9 | void Leave(string userId);
10 | void ZoneChange(byte[] bytes);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Interface/IUser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Akka.Interfaced;
4 |
5 | namespace Domain
6 | {
7 | public interface IUser : IInterfacedActor
8 | {
9 | Task GetId();
10 | Task> EnterGame(string name, IGameObserver observer);
11 | Task LeaveGame();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Unity.Domain")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("Unity.Domain")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("8bc6e409-057f-44c5-a968-16b614c8fba6")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/samples/Unity/Domain/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 | /Output/
6 |
7 | # Autogenerated VS/MD solution and project files
8 | *.csproj
9 | *.unityproj
10 | *.sln
11 | *.suo
12 | *.tmp
13 | *.user
14 | *.userprefs
15 | *.pidb
16 | *.booproj
17 |
18 | # Unity3D generated meta files
19 | *.pidb.meta
20 |
21 | # Unity3D Generated File On Crash Reports
22 | sysinfo.txt
23 |
24 | # UnityPackage
25 | *.unitypackage
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1d4448ed948d9274eb9d1293095caa5a
3 | folderAsset: yes
4 | timeCreated: 1449031409
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Resources/ClientBullet.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &160556
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 224: {fileID: 22424942}
11 | - 114: {fileID: 11488154}
12 | - 222: {fileID: 22235378}
13 | - 114: {fileID: 11490350}
14 | m_Layer: 5
15 | m_Name: ClientBullet
16 | m_TagString: Untagged
17 | m_Icon: {fileID: 0}
18 | m_NavMeshLayer: 0
19 | m_StaticEditorFlags: 0
20 | m_IsActive: 1
21 | --- !u!114 &11488154
22 | MonoBehaviour:
23 | m_ObjectHideFlags: 1
24 | m_PrefabParentObject: {fileID: 0}
25 | m_PrefabInternal: {fileID: 100100000}
26 | m_GameObject: {fileID: 160556}
27 | m_Enabled: 1
28 | m_EditorHideFlags: 0
29 | m_Script: {fileID: 11500000, guid: 8d1c38a210c614c4faf25146566b5815, type: 3}
30 | m_Name:
31 | m_EditorClassIdentifier:
32 | --- !u!114 &11490350
33 | MonoBehaviour:
34 | m_ObjectHideFlags: 1
35 | m_PrefabParentObject: {fileID: 0}
36 | m_PrefabInternal: {fileID: 100100000}
37 | m_GameObject: {fileID: 160556}
38 | m_Enabled: 1
39 | m_EditorHideFlags: 0
40 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
41 | m_Name:
42 | m_EditorClassIdentifier:
43 | m_Material: {fileID: 0}
44 | m_Color: {r: 1, g: 0, b: 0, a: 1}
45 | m_RaycastTarget: 1
46 | m_OnCullStateChanged:
47 | m_PersistentCalls:
48 | m_Calls: []
49 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
50 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
51 | m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
52 | m_Type: 0
53 | m_PreserveAspect: 0
54 | m_FillCenter: 1
55 | m_FillMethod: 4
56 | m_FillAmount: 1
57 | m_FillClockwise: 1
58 | m_FillOrigin: 0
59 | --- !u!222 &22235378
60 | CanvasRenderer:
61 | m_ObjectHideFlags: 1
62 | m_PrefabParentObject: {fileID: 0}
63 | m_PrefabInternal: {fileID: 100100000}
64 | m_GameObject: {fileID: 160556}
65 | --- !u!224 &22424942
66 | RectTransform:
67 | m_ObjectHideFlags: 1
68 | m_PrefabParentObject: {fileID: 0}
69 | m_PrefabInternal: {fileID: 100100000}
70 | m_GameObject: {fileID: 160556}
71 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
72 | m_LocalPosition: {x: 0, y: 0, z: 0}
73 | m_LocalScale: {x: 1, y: 1, z: 1}
74 | m_Children: []
75 | m_Father: {fileID: 0}
76 | m_RootOrder: 0
77 | m_AnchorMin: {x: 0.5, y: 0.5}
78 | m_AnchorMax: {x: 0.5, y: 0.5}
79 | m_AnchoredPosition: {x: 100, y: 0}
80 | m_SizeDelta: {x: 20, y: 20}
81 | m_Pivot: {x: 0.5, y: 0.5}
82 | --- !u!1001 &100100000
83 | Prefab:
84 | m_ObjectHideFlags: 1
85 | serializedVersion: 2
86 | m_Modification:
87 | m_TransformParent: {fileID: 0}
88 | m_Modifications: []
89 | m_RemovedComponents: []
90 | m_ParentPrefab: {fileID: 0}
91 | m_RootGameObject: {fileID: 160556}
92 | m_IsPrefabParent: 1
93 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Resources/ClientBullet.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a95a7280ac60db14c87ba4f0c98c90f1
3 | timeCreated: 1449033296
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Resources/ClientSpaceShip.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &151796
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 224: {fileID: 22443660}
11 | - 114: {fileID: 11445530}
12 | - 222: {fileID: 22266956}
13 | - 114: {fileID: 11401270}
14 | m_Layer: 5
15 | m_Name: ClientSpaceShip
16 | m_TagString: Untagged
17 | m_Icon: {fileID: 0}
18 | m_NavMeshLayer: 0
19 | m_StaticEditorFlags: 0
20 | m_IsActive: 1
21 | --- !u!114 &11401270
22 | MonoBehaviour:
23 | m_ObjectHideFlags: 1
24 | m_PrefabParentObject: {fileID: 0}
25 | m_PrefabInternal: {fileID: 100100000}
26 | m_GameObject: {fileID: 151796}
27 | m_Enabled: 1
28 | m_EditorHideFlags: 0
29 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
30 | m_Name:
31 | m_EditorClassIdentifier:
32 | m_Material: {fileID: 0}
33 | m_Color: {r: 1, g: 1, b: 1, a: 1}
34 | m_RaycastTarget: 1
35 | m_OnCullStateChanged:
36 | m_PersistentCalls:
37 | m_Calls: []
38 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
39 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
40 | m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
41 | m_Type: 1
42 | m_PreserveAspect: 0
43 | m_FillCenter: 1
44 | m_FillMethod: 4
45 | m_FillAmount: 1
46 | m_FillClockwise: 1
47 | m_FillOrigin: 0
48 | --- !u!114 &11445530
49 | MonoBehaviour:
50 | m_ObjectHideFlags: 1
51 | m_PrefabParentObject: {fileID: 0}
52 | m_PrefabInternal: {fileID: 100100000}
53 | m_GameObject: {fileID: 151796}
54 | m_Enabled: 1
55 | m_EditorHideFlags: 0
56 | m_Script: {fileID: 11500000, guid: 85289b90a2d88f9418d38700dca88417, type: 3}
57 | m_Name:
58 | m_EditorClassIdentifier:
59 | --- !u!222 &22266956
60 | CanvasRenderer:
61 | m_ObjectHideFlags: 1
62 | m_PrefabParentObject: {fileID: 0}
63 | m_PrefabInternal: {fileID: 100100000}
64 | m_GameObject: {fileID: 151796}
65 | --- !u!224 &22443660
66 | RectTransform:
67 | m_ObjectHideFlags: 1
68 | m_PrefabParentObject: {fileID: 0}
69 | m_PrefabInternal: {fileID: 100100000}
70 | m_GameObject: {fileID: 151796}
71 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
72 | m_LocalPosition: {x: 0, y: 0, z: 0}
73 | m_LocalScale: {x: 1, y: 1, z: 1}
74 | m_Children: []
75 | m_Father: {fileID: 0}
76 | m_RootOrder: 0
77 | m_AnchorMin: {x: 0.5, y: 0.5}
78 | m_AnchorMax: {x: 0.5, y: 0.5}
79 | m_AnchoredPosition: {x: 0, y: 0}
80 | m_SizeDelta: {x: 100, y: 100}
81 | m_Pivot: {x: 0.5, y: 0.5}
82 | --- !u!1001 &100100000
83 | Prefab:
84 | m_ObjectHideFlags: 1
85 | serializedVersion: 2
86 | m_Modification:
87 | m_TransformParent: {fileID: 0}
88 | m_Modifications: []
89 | m_RemovedComponents: []
90 | m_ParentPrefab: {fileID: 0}
91 | m_RootGameObject: {fileID: 151796}
92 | m_IsPrefabParent: 1
93 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Resources/ClientSpaceShip.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 018dc155f9a30e344bda65d49263f72d
3 | timeCreated: 1449033294
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 350814142ec1c924d8a249beaa87776f
3 | folderAsset: yes
4 | timeCreated: 1449018855
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scenes/MainScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ace374769afcbd44590199e8ece2464b
3 | timeCreated: 1449018855
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scenes/TestScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cf32b7102166268419647d3daa0f45ac
3 | timeCreated: 1449803770
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c2b95dfad0ade0343926cc30285b631b
3 | folderAsset: yes
4 | timeCreated: 1449018747
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/ClientBullet.cs:
--------------------------------------------------------------------------------
1 | using Domain;
2 | using UnityEngine;
3 |
4 | public class ClientBullet : BulletClientBase, IBulletClientHandler
5 | {
6 | void IBulletClientHandler.OnHit(float x, float y)
7 | {
8 | Debug.Log("OnHit");
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/ClientBullet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8d1c38a210c614c4faf25146566b5815
3 | timeCreated: 1449030673
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/ClientSpaceShip.cs:
--------------------------------------------------------------------------------
1 | using Domain;
2 | using EntityNetwork;
3 | using UnityEngine;
4 |
5 | public class ClientSpaceShip : SpaceShipClientBase, ISpaceShipClientHandler
6 | {
7 | private Vector2 _moveDirection = Vector2.zero;
8 | private float _moveSpeed = 100;
9 |
10 | private void FixedUpdate()
11 | {
12 | if (OwnerId == Zone.ClientId)
13 | UpdateInput();
14 | }
15 |
16 | private void Update()
17 | {
18 | // update position
19 |
20 | if (_moveDirection != Vector2.zero)
21 | {
22 | var rt = GetComponent();
23 | var pos = rt.localPosition +
24 | new Vector3(_moveDirection.x, _moveDirection.y, 0) * _moveSpeed * Time.deltaTime;
25 | rt.localPosition = pos;
26 | }
27 | }
28 |
29 | private void UpdateInput()
30 | {
31 | var dir = Vector2.zero;
32 | if (Input.GetKey(KeyCode.LeftArrow))
33 | dir.x = -1;
34 | if (Input.GetKey(KeyCode.RightArrow))
35 | dir.x = +1;
36 | if (Input.GetKey(KeyCode.UpArrow))
37 | dir.y = +1;
38 | if (Input.GetKey(KeyCode.DownArrow))
39 | dir.y = -1;
40 |
41 | if (dir != _moveDirection)
42 | {
43 | var rt = GetComponent();
44 | ((ClientZone)Zone).RunAction(_ => { Move(rt.localPosition.x, rt.localPosition.y, dir.x, dir.y); });
45 | _moveDirection = dir;
46 | }
47 | }
48 |
49 | public override void OnSnapshot(SpaceShipSnapshot snapshot)
50 | {
51 | }
52 |
53 | void ISpaceShipClientHandler.OnSay(string msg)
54 | {
55 | Debug.Log("OnSay");
56 | }
57 |
58 | void ISpaceShipClientHandler.OnMove(float x, float y, float dx, float dy)
59 | {
60 | if (OwnerId == Zone.ClientId)
61 | return;
62 |
63 | var rt = GetComponent();
64 | rt.localPosition = new Vector3(x, y, 0);
65 | _moveDirection = new Vector2(dx, dy);
66 | }
67 |
68 | void ISpaceShipClientHandler.OnStop(float x, float y)
69 | {
70 | Debug.Log("OnStop");
71 | }
72 |
73 | void ISpaceShipClientHandler.OnHit(float x, float y)
74 | {
75 | Debug.Log("OnHit");
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/ClientSpaceShip.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 85289b90a2d88f9418d38700dca88417
3 | timeCreated: 1449030673
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/G.cs:
--------------------------------------------------------------------------------
1 | using Akka.Interfaced.SlimSocket.Client;
2 | using Common.Logging;
3 |
4 | public static class G
5 | {
6 | static G()
7 | {
8 | _logger = LogManager.GetLogger("G");
9 | }
10 |
11 | // Channel
12 |
13 | private static IChannel _channel;
14 |
15 | public static IChannel Channel
16 | {
17 | get { return _channel; }
18 | set { _channel = value; }
19 | }
20 |
21 | // Logger
22 |
23 | private static readonly ILog _logger;
24 |
25 | public static ILog Logger
26 | {
27 | get { return _logger; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/G.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 340664e519dd67e4ea7f09aea831ea44
3 | timeCreated: 1446901437
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/MainScene.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4eafd02dce1a02f479d348a72ceeedfb
3 | timeCreated: 1449034520
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/SelfHostEntityNetworkManager.cs:
--------------------------------------------------------------------------------
1 | using Domain;
2 | using ProtoBuf.Meta;
3 | using TypeAlias;
4 |
5 | public class SelfHostEntityNetworkManager : EntityNetworkManager
6 | {
7 | private static TypeAliasTable _typeAliasTable;
8 | private static TypeModel _typeModel;
9 |
10 | public override TypeAliasTable GetTypeAliasTable()
11 | {
12 | return _typeAliasTable ?? (_typeAliasTable = new TypeAliasTable());
13 | }
14 |
15 | public override TypeModel GetTypeModel()
16 | {
17 | return _typeModel ?? (_typeModel = new DomainProtobufSerializer());
18 | }
19 |
20 | protected override void OnClientAdd(int clientId)
21 | {
22 | Zone.RunAction(zone => { zone.Spawn(typeof(ISpaceShip), clientId); });
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/SelfHostEntityNetworkManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 92b7dbc6714647f4b9766ba987bad980
3 | timeCreated: 1450742649
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/TestScene.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class TestScene : MonoBehaviour
4 | {
5 | private void Start()
6 | {
7 | ClientEntityFactory.Default.RootTransform = GameObject.Find("Entities").transform;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/TestScene.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 66beba82684630342be3ace8e1ae644f
3 | timeCreated: 1449803834
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/Unity.Domain.ProtobufSerializer.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/Scripts/Unity.Domain.ProtobufSerializer.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/Unity.Domain.ProtobufSerializer.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dae130c5516322e40971a8367d654c9b
3 | timeCreated: 1449706394
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Any:
12 | enabled: 1
13 | settings: {}
14 | Editor:
15 | enabled: 0
16 | settings:
17 | DefaultValueInitialized: true
18 | WindowsStoreApps:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | userData:
23 | assetBundleName:
24 | assetBundleVariant:
25 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/Unity.Domain.Unity3D.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/Scripts/Unity.Domain.Unity3D.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/Scripts/Unity.Domain.Unity3D.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4d83424c5f630d74580bd1566f48b916
3 | timeCreated: 1449706393
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Any:
12 | enabled: 1
13 | settings: {}
14 | Editor:
15 | enabled: 0
16 | settings:
17 | DefaultValueInitialized: true
18 | WindowsStoreApps:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | userData:
23 | assetBundleName:
24 | assetBundleVariant:
25 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c6f56356a2b35684b5f54f789b789d3e
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e913dba231d54179581f6e769337aaf
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "AkkaInterfaced",
3 | "Version": "0.4.1",
4 | "Authors": [
5 | "Esun Kim"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "Akka.Interfaced SlimClient for Unity3D",
11 | "MergedDependencies": {},
12 | "Files": [
13 | "Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll",
14 | "Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll.mdb"
15 | ]
16 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 53d7424426cb5b6c99822b07cc687abe
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a0f24b4f6a3358fe8b0bf952f073ca59
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfaced/Akka.Interfaced-Base.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 30eadbcb9c5c5a00a38e1dd5a021f365
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 03ada339cf2d59df86958e976bb597e7
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d7a79cc161055039a84f0e07b527e5c9
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Base.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Base.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Base.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Base.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Base.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d1affdae78ba5e448394b22e52dda5fb
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Base.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 00bc6c5829e65129a15e59a15a26ae93
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Client.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Client.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Client.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Client.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Client.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24fcaed46b0f50c0b09165906a3166e2
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/Akka.Interfaced.SlimSocket.Client.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 95650fd08d60545ca713d27bacb044c5
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/ChannelEventDispatcher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using UnityEngine;
5 |
6 | namespace Akka.Interfaced.SlimSocket.Client
7 | {
8 | public class ChannelEventDispatcher : MonoBehaviour
9 | {
10 | private static ChannelEventDispatcher s_instance;
11 | private static bool s_instanceExists;
12 |
13 | private static readonly List> s_posts =
14 | new List>();
15 |
16 | public static ChannelEventDispatcher Instance
17 | {
18 | get { return s_instance; }
19 | }
20 |
21 | public static bool TryInit()
22 | {
23 | if (s_instanceExists)
24 | return false;
25 |
26 | s_instanceExists = true;
27 |
28 | var go = new GameObject("_ChannelEventDispatcher");
29 | s_instance = go.AddComponent();
30 | DontDestroyOnLoad(go);
31 | return true;
32 | }
33 |
34 | public static void Post(SendOrPostCallback callback, object state)
35 | {
36 | lock (s_posts)
37 | {
38 | s_posts.Add(Tuple.Create(callback, state));
39 | }
40 | }
41 |
42 | private void Awake()
43 | {
44 | if (s_instance)
45 | {
46 | DestroyImmediate(this);
47 | }
48 | else
49 | {
50 | s_instance = this;
51 | s_instanceExists = true;
52 | }
53 | }
54 |
55 | private void OnDestroy()
56 | {
57 | if (s_instance == this)
58 | {
59 | s_instance = null;
60 | s_instanceExists = false;
61 | }
62 | }
63 |
64 | private void Update()
65 | {
66 | lock (s_posts)
67 | {
68 | foreach (var post in s_posts)
69 | {
70 | post.Item1(post.Item2);
71 | }
72 | s_posts.Clear();
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/ChannelEventDispatcher.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 63df13a909b85f9883ee58b62ed4bff8
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/ChannelFactoryBuilder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using Akka.Interfaced.SlimSocket;
4 | using Common.Logging;
5 | using ProtoBuf.Meta;
6 | using TypeAlias;
7 |
8 | namespace Akka.Interfaced.SlimSocket.Client
9 | {
10 | public static class ChannelFactoryBuilder
11 | {
12 | public static ChannelFactory Build(IPEndPoint endPoint = null, Func createChannelLogger = null)
13 | where TTypeModel : TypeModel, new()
14 | {
15 | var serializer = PacketSerializer.CreatePacketSerializer();
16 | return Build(serializer, endPoint, createChannelLogger);
17 | }
18 |
19 | public static ChannelFactory Build(IPacketSerializer packetSerializer = null, IPEndPoint endPoint = null, Func createChannelLogger = null)
20 | {
21 | ChannelEventDispatcher.TryInit();
22 |
23 | if (packetSerializer == null)
24 | packetSerializer = PacketSerializer.CreatePacketSerializer();
25 |
26 | var channelFactory = new ChannelFactory
27 | {
28 | Type = ChannelType.Tcp,
29 | ConnectEndPoint = endPoint,
30 | CreateChannelLogger = createChannelLogger,
31 | TaskFactory = new UnitySlimTaskFactory { Owner = ChannelEventDispatcher.Instance },
32 | ObserverEventPoster = c => ChannelEventDispatcher.Post(c, null),
33 | PacketSerializer = packetSerializer
34 | };
35 |
36 | return channelFactory;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/ChannelFactoryBuilder.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9178e2dfe5425b5594ec6f5e75a728bd
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/UnitySlimTaskCompletionSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using UnityEngine;
4 |
5 | namespace Akka.Interfaced.SlimSocket.Client
6 | {
7 | public class UnitySlimTaskCompletionSource : Task, ISlimTaskCompletionSource
8 | {
9 | internal MonoBehaviour Owner { get; set; }
10 |
11 | private Exception _exception;
12 | private TResult _result;
13 |
14 | // Handle for Unity Coroutine.
15 | // It may be used like as 'yield return task.WaitHandle'
16 | public object WaitHandle
17 | {
18 | get { return Owner.StartCoroutine(WaitForCompleted()); }
19 | }
20 |
21 | private IEnumerator WaitForCompleted()
22 | {
23 | while (IsCompleted == false)
24 | yield return null;
25 | }
26 |
27 | public TaskStatus Status
28 | {
29 | get; private set;
30 | }
31 |
32 | public Exception Exception
33 | {
34 | get
35 | {
36 | return _exception;
37 | }
38 | set
39 | {
40 | if (IsCompleted)
41 | throw new InvalidOperationException("Already completed. status=" + Status);
42 |
43 | _exception = value;
44 | Status = TaskStatus.Faulted;
45 | }
46 | }
47 |
48 | public TResult Result
49 | {
50 | get
51 | {
52 | if (Status != TaskStatus.RanToCompletion)
53 | throw new InvalidOperationException("Result is not set yet. status=" + Status);
54 |
55 | return _result;
56 | }
57 |
58 | set
59 | {
60 | if (IsCompleted)
61 | throw new InvalidOperationException("Already completed. status=" + Status);
62 |
63 | _result = value;
64 | Status = TaskStatus.RanToCompletion;
65 | }
66 | }
67 |
68 | public bool IsCompleted
69 | {
70 | get
71 | {
72 | return Status == TaskStatus.RanToCompletion ||
73 | Status == TaskStatus.Canceled ||
74 | Status == TaskStatus.Faulted;
75 | }
76 | }
77 |
78 | public bool IsSucceeded
79 | {
80 | get { return Status == TaskStatus.RanToCompletion; }
81 | }
82 |
83 | public bool IsFailed
84 | {
85 | get
86 | {
87 | return Status == TaskStatus.Canceled ||
88 | Status == TaskStatus.Faulted;
89 | }
90 | }
91 |
92 | public bool TrySetCanceled()
93 | {
94 | if (IsCompleted)
95 | return false;
96 |
97 | _exception = new OperationCanceledException();
98 | Status = TaskStatus.Canceled;
99 | return true;
100 | }
101 |
102 | public bool TrySetException(Exception e)
103 | {
104 | if (IsCompleted)
105 | return false;
106 |
107 | Exception = e;
108 | return true;
109 | }
110 |
111 | public bool TrySetResult(TResult result)
112 | {
113 | if (IsCompleted)
114 | return false;
115 |
116 | Result = result;
117 | return true;
118 | }
119 |
120 | public override string ToString()
121 | {
122 | if (Status == TaskStatus.RanToCompletion)
123 | return "Result: " + Result;
124 | if (Status == TaskStatus.Faulted)
125 | return "Faulted: " + Exception;
126 | if (Status == TaskStatus.Canceled)
127 | return "Canceled";
128 |
129 | return "Status: " + Status;
130 | }
131 |
132 | public Task Task
133 | {
134 | get { return this; }
135 | }
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/UnitySlimTaskCompletionSource.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 04f066c38d265d979e91eb613831ffb4
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/UnitySlimTaskFactory.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Akka.Interfaced.SlimSocket.Client
4 | {
5 | public class UnitySlimTaskFactory : ISlimTaskFactory
6 | {
7 | internal MonoBehaviour Owner { get; set; }
8 |
9 | public ISlimTaskCompletionSource Create()
10 | {
11 | return new UnitySlimTaskCompletionSource { Owner = Owner };
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/AkkaInterfacedSlimSocket/UnitySlimTaskFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2edda98f30f05b5faaa829c9cdb72391
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 71a73a78add353a9b949e1cabb6a2cb9
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "CommonLogging",
3 | "Version": "3.3.1",
4 | "Authors": [
5 | "Aleksandar Seovic",
6 | "Mark Pollack",
7 | "Erich Eichinger",
8 | "Stephen Bohlen"
9 | ],
10 | "Owners": [
11 | "Esun Kim"
12 | ],
13 | "Description": "Unity3D port of Common.Logging library which introduces a simple abstraction to allow you to select a specific logging implementation at runtime.",
14 | "Files": [
15 | "Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll",
16 | "Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll.mdb",
17 | "Assets/UnityPackages/CommonLogging/Common.Logging.dll",
18 | "Assets/UnityPackages/CommonLogging/Common.Logging.dll.mdb",
19 | "Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll",
20 | "Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll.mdb",
21 | {
22 | "Target": "Assets/UnityPackages/CommonLoggingSample/CommonLoggingSample.cs",
23 | "Extra": true
24 | },
25 | {
26 | "Target": "Assets/UnityPackages/CommonLoggingSample/CommonLoggingSample.unity",
27 | "Extra": true
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a4209abf60305b139cfbe093122b023e
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8ae2a3047cc15314aac0bd33e08b9fe0
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Core.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18e83e85e8af585f964dbbb5a44cfb76
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 260e0cc54d315e85a6642e7285c2cead
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.Extensions.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b83dcf65b4e572dadec17c4fba310ab
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7ce60b26b775e719112295f34d853ce
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/CommonLogging/Common.Logging.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 802633c9400b5afabc999a7cce79b1f6
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2de543fc3ff35eca90e6bfd99a3909de
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "EntityNetwork",
3 | "Version": "0.2.1",
4 | "Authors": [
5 | "Esun Kim"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "EntityNetwork",
11 | "Dependencies": {
12 | "NetLegacySupport": {
13 | "Version": "1.*",
14 | "Source": "github:SaladLab/NetLegacySupport"
15 | },
16 | "protobuf-net": {
17 | "Version": "2.1.0-alpha-1",
18 | "Source": "nuget:net30"
19 | },
20 | "TrackableData": {
21 | "Version": "1.*",
22 | "Source": "github:SaladLab/TrackableData"
23 | }
24 | },
25 | "MergedDependencies": {
26 | "NetLegacySupport": {
27 | "Version": "1.1.0"
28 | },
29 | "protobuf-net": {
30 | "Version": "2.1.0-alpha-1"
31 | },
32 | "TrackableData": {
33 | "Version": "1.1.1"
34 | },
35 | "JsonNet": {
36 | "Version": "8.0.3"
37 | }
38 | },
39 | "Files": [
40 | "Assets/UnityPackages/EntityNetwork/EntityNetwork.dll",
41 | "Assets/UnityPackages/EntityNetwork/EntityNetwork.dll.mdb",
42 | "Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll",
43 | "Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll.mdb",
44 | "Assets/UnityPackages/EntityNetwork/ClientEntityFactory.cs",
45 | "Assets/UnityPackages/EntityNetwork/EntityNetworkChannel.cs",
46 | "Assets/UnityPackages/EntityNetwork/EntityNetworkClient.cs",
47 | "Assets/UnityPackages/EntityNetwork/EntityNetworkManager.cs",
48 | "Assets/UnityPackages/EntityNetwork/EntityNetworkClient.prefab",
49 | {
50 | "Target": "Assets/UnityPackages/JsonNet.unitypackage.json",
51 | "Merged": true
52 | },
53 | {
54 | "Target": "Assets/UnityPackages/NetLegacySupport.unitypackage.json",
55 | "Merged": true
56 | },
57 | {
58 | "Target": "Assets/UnityPackages/protobuf-net.unitypackage.json",
59 | "Merged": true
60 | },
61 | {
62 | "Target": "Assets/UnityPackages/TrackableData.unitypackage.json",
63 | "Merged": true
64 | },
65 | {
66 | "Target": "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb",
67 | "Merged": true
68 | },
69 | {
70 | "Target": "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll",
71 | "Merged": true
72 | },
73 | {
74 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.mdb",
75 | "Merged": true
76 | },
77 | {
78 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll",
79 | "Merged": true
80 | },
81 | {
82 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.mdb",
83 | "Merged": true
84 | },
85 | {
86 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll",
87 | "Merged": true
88 | },
89 | {
90 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.mdb",
91 | "Merged": true
92 | },
93 | {
94 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll",
95 | "Merged": true
96 | },
97 | {
98 | "Target": "Assets/UnityPackages/protobuf-net/protobuf-net.dll",
99 | "Merged": true
100 | },
101 | {
102 | "Target": "Assets/UnityPackages/TrackableData/TrackableData.dll.mdb",
103 | "Merged": true
104 | },
105 | {
106 | "Target": "Assets/UnityPackages/TrackableData/TrackableData.dll",
107 | "Merged": true
108 | },
109 | {
110 | "Target": "Assets/UnityPackages/TrackableData/TrackableData.Json.dll.mdb",
111 | "Merged": true
112 | },
113 | {
114 | "Target": "Assets/UnityPackages/TrackableData/TrackableData.Json.dll",
115 | "Merged": true
116 | },
117 | {
118 | "Target": "Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll.mdb",
119 | "Merged": true
120 | },
121 | {
122 | "Target": "Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll",
123 | "Merged": true
124 | }
125 | ]
126 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 31faf1a26fba5bfcbe83b9bcdd7c75b6
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/ClientEntityFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using EntityNetwork;
4 | using EntityNetwork.Unity3D;
5 | using UnityEngine;
6 |
7 | public class ClientEntityFactory : IClientEntityFactory
8 | {
9 | private static ClientEntityFactory _default;
10 |
11 | public static ClientEntityFactory Default
12 | {
13 | get { return _default ?? (_default = new ClientEntityFactory()); }
14 | }
15 |
16 | public Transform RootTransform { get; set; }
17 |
18 | private readonly ConcurrentDictionary _clientEntityToProtoTypeMap =
19 | new ConcurrentDictionary();
20 |
21 | Type IClientEntityFactory.GetProtoType(Type entityType)
22 | {
23 | return _clientEntityToProtoTypeMap.GetOrAdd(entityType, t =>
24 | {
25 | var type = entityType;
26 | while (type != null && type != typeof(object))
27 | {
28 | if (type.Name.EndsWith("ClientBase"))
29 | {
30 | var typePrefix = type.Namespace.Length > 0 ? type.Namespace + "." : "";
31 | var protoType = type.Assembly.GetType(typePrefix + "I" +
32 | type.Name.Substring(0, type.Name.Length - 10));
33 | if (protoType != null && typeof(IEntityPrototype).IsAssignableFrom(protoType))
34 | {
35 | return protoType;
36 | }
37 | }
38 | type = type.BaseType;
39 | }
40 | return null;
41 | });
42 | }
43 |
44 | IClientEntity IClientEntityFactory.Create(Type protoType)
45 | {
46 | var resourceName = "Client" + protoType.Name.Substring(1);
47 | var resource = Resources.Load(resourceName);
48 | if (resource == null)
49 | throw new InvalidOperationException("Failed to load resource(" + resourceName + ")");
50 |
51 | var go = (GameObject)UnityEngine.Object.Instantiate(resource);
52 | if (go == null)
53 | throw new InvalidOperationException("Failed to instantiate resource(" + resourceName + ")");
54 |
55 | if (RootTransform != null)
56 | go.transform.SetParent(RootTransform, false);
57 |
58 | return go.GetComponent();
59 | }
60 |
61 | void IClientEntityFactory.Delete(IClientEntity entity)
62 | {
63 | var enb = ((EntityNetworkBehaviour)entity);
64 | UnityEngine.Object.Destroy(enb.gameObject);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/ClientEntityFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e0a294c00a7557eea340a631c8e6ce77
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d95b3742eb225a9d89631a2deb3783ee
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.Unity3D.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 98748186bd345725b78fac87544b9e4a
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4b11574146de58ea8ba5c28d947a4e37
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetwork.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1e807c1067dc55d9872193d95b275910
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkChannel.cs:
--------------------------------------------------------------------------------
1 | using EntityNetwork;
2 |
3 | public class EntityNetworkChannelToServerZone : IByteChannel
4 | {
5 | public EntityNetworkClient NetworkClient;
6 |
7 | public void Write(byte[] bytes)
8 | {
9 | NetworkClient.CmdBuffer(bytes);
10 | }
11 | }
12 |
13 | public class EntityNetworkChannelToClientZone : IByteChannel
14 | {
15 | public EntityNetworkClient NetworkClient;
16 |
17 | public void Write(byte[] bytes)
18 | {
19 | if (bytes == null)
20 | return;
21 |
22 | NetworkClient.RpcBuffer(bytes);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkChannel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 34c6e08f3b865a538f233299e96125cb
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using EntityNetwork;
3 | using UnityEngine;
4 | using UnityEngine.Networking;
5 |
6 | public class EntityNetworkClient : NetworkBehaviour
7 | {
8 | public static int LocalClientId;
9 | public static ClientZone LocalClientZone;
10 |
11 | private int _clientId;
12 | private ClientZone _zone;
13 | private ProtobufChannelToClientZoneInbound _zoneChannel;
14 |
15 | public int ClientId
16 | {
17 | get { return _clientId; }
18 | }
19 |
20 | // Registration
21 |
22 | public override void OnStartClient()
23 | {
24 | // In OnStartClient, ClientRpc is not called.
25 | // To workaround this limitation, use coroutine
26 | StartCoroutine(AddClientToZone());
27 | }
28 |
29 | private void OnDestroy()
30 | {
31 | EntityNetworkManager.Instance.RemoveClientToZone(_clientId);
32 | }
33 |
34 | private IEnumerator AddClientToZone()
35 | {
36 | // By OnStartClient's note
37 | yield return null;
38 |
39 | if (hasAuthority == false)
40 | yield break;
41 |
42 | var channel = new ProtobufChannelToServerZoneOutbound
43 | {
44 | OutboundChannel = new EntityNetworkChannelToServerZone { NetworkClient = this },
45 | TypeTable = EntityNetworkManager.Instance.GetTypeAliasTable(),
46 | TypeModel = EntityNetworkManager.Instance.GetTypeModel()
47 | };
48 |
49 | _clientId = (int)netId.Value;
50 | _zone = new ClientZone(EntityNetworkManager.Instance.GetClientEntityFactory(), channel);
51 | _zoneChannel = new ProtobufChannelToClientZoneInbound
52 | {
53 | TypeTable = EntityNetworkManager.Instance.GetTypeAliasTable(),
54 | TypeModel = EntityNetworkManager.Instance.GetTypeModel(),
55 | InboundClientZone = _zone
56 | };
57 |
58 | LocalClientId = _clientId;
59 | LocalClientZone = _zone;
60 |
61 | CmdAddClientToZone();
62 | }
63 |
64 | [Command]
65 | public void CmdAddClientToZone()
66 | {
67 | _clientId = (int)netId.Value;
68 |
69 | var result = EntityNetworkManager.Instance.AddClientToZone(_clientId, this);
70 | RpcAddClientToZoneDone(result);
71 | }
72 |
73 | [ClientRpc]
74 | public void RpcAddClientToZoneDone(bool added)
75 | {
76 | if (hasAuthority == false)
77 | return;
78 |
79 | Debug.LogFormat("EntityNetworkClient({0}).RpcAddClientToZoneDone({1})", _clientId, added);
80 | if (added)
81 | {
82 | CmdAddClientToZoneDone();
83 | }
84 | else
85 | {
86 | _clientId = 0;
87 | _zone = null;
88 | _zoneChannel = null;
89 | LocalClientId = 0;
90 | }
91 | }
92 |
93 | [Command]
94 | public void CmdAddClientToZoneDone()
95 | {
96 | Debug.LogFormat("EntityNetworkClient({0}).CmdAddClientToZoneDone", _clientId);
97 | }
98 |
99 | // Zone Channel
100 |
101 | [Command]
102 | public void CmdBuffer(byte[] bytes)
103 | {
104 | EntityNetworkManager.Instance.WriteZoneChannel(ClientId, bytes);
105 | }
106 |
107 | [ClientRpc]
108 | public void RpcBuffer(byte[] bytes)
109 | {
110 | if (hasAuthority == false)
111 | return;
112 |
113 | _zoneChannel.Write(bytes);
114 | }
115 |
116 | private void Update()
117 | {
118 | if (_zone != null)
119 | ((EntityTimerProvider)_zone.TimerProvider).ProcessWork();
120 | }
121 |
122 | public override void OnNetworkDestroy()
123 | {
124 | Debug.LogFormat("EntityNetworkClient({0}).OnNetworkDestroy", _clientId);
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkClient.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d1b06c79502b5b63aa25f519ccc85630
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkClient.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &187252
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 4: {fileID: 413176}
11 | - 114: {fileID: 11463654}
12 | - 114: {fileID: 11461522}
13 | m_Layer: 0
14 | m_Name: EntityNetworkClient
15 | m_TagString: Untagged
16 | m_Icon: {fileID: 0}
17 | m_NavMeshLayer: 0
18 | m_StaticEditorFlags: 0
19 | m_IsActive: 1
20 | --- !u!4 &413176
21 | Transform:
22 | m_ObjectHideFlags: 1
23 | m_PrefabParentObject: {fileID: 0}
24 | m_PrefabInternal: {fileID: 100100000}
25 | m_GameObject: {fileID: 187252}
26 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
27 | m_LocalPosition: {x: 0, y: 0, z: 0}
28 | m_LocalScale: {x: 1, y: 1, z: 1}
29 | m_Children: []
30 | m_Father: {fileID: 0}
31 | m_RootOrder: 0
32 | --- !u!114 &11461522
33 | MonoBehaviour:
34 | m_ObjectHideFlags: 1
35 | m_PrefabParentObject: {fileID: 0}
36 | m_PrefabInternal: {fileID: 100100000}
37 | m_GameObject: {fileID: 187252}
38 | m_Enabled: 1
39 | m_EditorHideFlags: 0
40 | m_Script: {fileID: 11500000, guid: d1b06c79502b5b63aa25f519ccc85630, type: 3}
41 | m_Name:
42 | m_EditorClassIdentifier:
43 | --- !u!114 &11463654
44 | MonoBehaviour:
45 | m_ObjectHideFlags: 1
46 | m_PrefabParentObject: {fileID: 0}
47 | m_PrefabInternal: {fileID: 100100000}
48 | m_GameObject: {fileID: 187252}
49 | m_Enabled: 1
50 | m_EditorHideFlags: 0
51 | m_Script: {fileID: 372142912, guid: 870353891bb340e2b2a9c8707e7419ba, type: 3}
52 | m_Name:
53 | m_EditorClassIdentifier:
54 | m_SceneId:
55 | m_Value: 0
56 | m_AssetId:
57 | i0: 29
58 | i1: 72
59 | i2: 233
60 | i3: 101
61 | i4: 219
62 | i5: 19
63 | i6: 60
64 | i7: 164
65 | i8: 139
66 | i9: 31
67 | i10: 35
68 | i11: 104
69 | i12: 26
70 | i13: 239
71 | i14: 232
72 | i15: 27
73 | m_ServerOnly: 0
74 | m_LocalPlayerAuthority: 1
75 | --- !u!1001 &100100000
76 | Prefab:
77 | m_ObjectHideFlags: 1
78 | serializedVersion: 2
79 | m_Modification:
80 | m_TransformParent: {fileID: 0}
81 | m_Modifications:
82 | - target: {fileID: 0}
83 | propertyPath: m_LocalPlayerAuthority
84 | value: 1
85 | objectReference: {fileID: 0}
86 | m_RemovedComponents: []
87 | m_ParentPrefab: {fileID: 0}
88 | m_RootGameObject: {fileID: 187252}
89 | m_IsPrefabParent: 1
90 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkClient.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3f9e9b4ff63d5c6c8fa50ed73f3b2b29
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/EntityNetwork/EntityNetworkManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb6bb717be065a86b6f38c734d38ec8c
3 | DefaultImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: af0406f5930e589db58fb8338d5d91c2
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "JsonNet",
3 | "Version": "8.0.3",
4 | "Authors": [
5 | "James Newton-King"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "Unity3D port of Json.NET which is a popular high-performance JSON framework for .NET",
11 | "Files": [
12 | "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll",
13 | "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb",
14 | {
15 | "Target": "Assets/UnityPackages/JsonNetSample/JsonNetSample.cs",
16 | "Extra": true
17 | },
18 | {
19 | "Target": "Assets/UnityPackages/JsonNetSample/JsonNetSample.unity",
20 | "Extra": true
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cc20ca1b9dc45b619a5bf851837691b9
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9d84eeb258e65c169f0958973f6d2099
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 878a269ee50954f5843ce9e2d98a44a6
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4c12e315280b5d249e13c580e1e7dbcf
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "LidgrenUdpNet",
3 | "Version": "1.0.4",
4 | "Authors": [
5 | "Michael Lidgren"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "Modifier version of Lidgren.Network",
11 | "Dependencies": {},
12 | "MergedDependencies": {},
13 | "Files": [
14 | "Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll",
15 | "Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll.mdb"
16 | ]
17 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 98b27a0f19835f448c7e4508be3f42e3
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b2e06e29cfc75a3f93917de1d980bb6c
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/LidgrenUdpNet/LidgrenUdpNet.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1c0e3637ce257d290c74cd4ca7fbd91
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fc140aa0dc115c859737925a31f9de46
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "NetLegacySupport",
3 | "Version": "1.1.0",
4 | "Authors": [
5 | "Microsoft"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "Action, Func, Tuple and ConcurrentDictionary for Unity3D. This is a backport from .NET Core.",
11 | "Files": [
12 | "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll",
13 | "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.mdb",
14 | "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll",
15 | "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.mdb",
16 | "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll",
17 | "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.mdb"
18 | ]
19 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1517746b7868577981ad4a09b5a4da46
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a4f79775b26c5e5aa01e61fce634179b
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0926cb56577f5239a7c73c34335d8451
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a555f73aebd650578cea1adfd3c83d1c
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 25ca39d0c68d5ab3bffedb1d54535698
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 82970df46baf55c5818f9bb52dc81e45
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fff91e999bdb53f89f045e9ef0bbfcb1
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f54eb2348d305a11b91139272bf0311b
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "TrackableData",
3 | "Version": "1.1.1",
4 | "Authors": [
5 | "Esun Kim"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "POCO, list, dictionary, set and container which can track changes. These changes can be saved or rollbacked or replayed to another object.",
11 | "Dependencies": {
12 | "JsonNet": {
13 | "Version": ">=8.0.0",
14 | "Source": "github:SaladLab/Json.Net.Unity3D"
15 | },
16 | "protobuf-net": {
17 | "Version": "2.1.0-alpha-1",
18 | "Source": "nuget:net30"
19 | }
20 | },
21 | "MergedDependencies": {
22 | "JsonNet": {
23 | "Version": "8.0.3"
24 | },
25 | "protobuf-net": {
26 | "Version": "2.1.0-alpha-1"
27 | }
28 | },
29 | "Files": [
30 | "Assets/UnityPackages/TrackableData/TrackableData.dll",
31 | "Assets/UnityPackages/TrackableData/TrackableData.dll.mdb",
32 | "Assets/UnityPackages/TrackableData/TrackableData.Json.dll",
33 | "Assets/UnityPackages/TrackableData/TrackableData.Json.dll.mdb",
34 | "Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll",
35 | "Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll.mdb",
36 | {
37 | "Target": "Assets/UnityPackages/JsonNet.unitypackage.json",
38 | "Merged": true
39 | },
40 | {
41 | "Target": "Assets/UnityPackages/protobuf-net.unitypackage.json",
42 | "Merged": true
43 | },
44 | {
45 | "Target": "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb",
46 | "Merged": true
47 | },
48 | {
49 | "Target": "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll",
50 | "Merged": true
51 | },
52 | {
53 | "Target": "Assets/UnityPackages/protobuf-net/protobuf-net.dll",
54 | "Merged": true
55 | }
56 | ]
57 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 805609aa716753d9ae3f666c68134af9
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Json.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Json.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Json.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Json.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 55f9dc5a97cf5700ad46b612e499e8ca
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Json.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: efaf957ceea15996b19d3c26c8b348a1
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 12a55164485753d58a2bb963f88f48f8
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.Protobuf.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d18e4f37368c56068456c004e7528cdb
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2063ef80458f5f61b003a946fe4217cb
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TrackableData/TrackableData.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5a9de3f6ef750539bfceff9e76983fa
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1e1b981e6c25ccaaf9b8311fa881e11
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "TypeAlias",
3 | "Version": "1.1.2",
4 | "Authors": [
5 | "Esun Kim"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "Library that makes the unique alias of types in .NET.",
11 | "Dependencies": {
12 | "NetLegacySupport": {
13 | "Version": "1.*",
14 | "Source": "github:SaladLab/NetLegacySupport"
15 | }
16 | },
17 | "MergedDependencies": {
18 | "NetLegacySupport": {
19 | "Version": "1.1.0"
20 | }
21 | },
22 | "Files": [
23 | "Assets/UnityPackages/TypeAlias/TypeAlias.dll",
24 | "Assets/UnityPackages/TypeAlias/TypeAlias.dll.mdb",
25 | {
26 | "Target": "Assets/UnityPackages/NetLegacySupport.unitypackage.json",
27 | "Merged": true
28 | },
29 | {
30 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll.mdb",
31 | "Merged": true
32 | },
33 | {
34 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Action.dll",
35 | "Merged": true
36 | },
37 | {
38 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll.mdb",
39 | "Merged": true
40 | },
41 | {
42 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.ConcurrentDictionary.dll",
43 | "Merged": true
44 | },
45 | {
46 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll.mdb",
47 | "Merged": true
48 | },
49 | {
50 | "Target": "Assets/UnityPackages/NetLegacySupport/NetLegacySupport.Tuple.dll",
51 | "Merged": true
52 | }
53 | ]
54 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 382dc954f04d5d6793e868503a9b6599
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias/TypeAlias.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias/TypeAlias.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias/TypeAlias.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias/TypeAlias.dll.mdb
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias/TypeAlias.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f24cec78b83855f499f0fc00e9640caf
3 | DefaultImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/TypeAlias/TypeAlias.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 86174a0992215b488a1990fbd4f85082
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/protobuf-net.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5607ed5b44575dbebd43201a78bcbe2f
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/protobuf-net.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "protobuf-net",
3 | "Version": "2.1.0-alpha-1",
4 | "Description": "Nuget package (TFM:net30)",
5 | "Files": [
6 | "protobuf-net.dll"
7 | ]
8 | }
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/protobuf-net.unitypackage.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d84d8ec3f30a5deeaada2d601da65d6c
3 | TextScriptImporter:
4 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/protobuf-net/protobuf-net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/samples/Unity/Program.Client/Assets/UnityPackages/protobuf-net/protobuf-net.dll
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/Assets/UnityPackages/protobuf-net/protobuf-net.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3536e94788525ec2a98d33a025099d13
3 | MonoAssemblyImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | userData:
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | m_Volume: 1
7 | Rolloff Scale: 1
8 | Doppler Factor: 1
9 | Default Speaker Mode: 2
10 | m_SampleRate: 0
11 | m_DSPBufferSize: 0
12 | m_VirtualVoiceCount: 512
13 | m_RealVoiceCount: 32
14 | m_SpatializerPlugin:
15 | m_DisableAudio: 0
16 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Gravity: {x: 0, y: -9.81, z: 0}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_BounceThreshold: 2
10 | m_SleepThreshold: 0.005
11 | m_DefaultContactOffset: 0.01
12 | m_SolverIterationCount: 6
13 | m_QueriesHitTriggers: 1
14 | m_EnableAdaptiveForce: 0
15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
16 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes:
8 | - enabled: 1
9 | path: Assets/Scenes/MainScene.unity
10 | - enabled: 1
11 | path: Assets/Scenes/TestScene.unity
12 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!159 &1
4 | EditorSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 3
7 | m_ExternalVersionControlSupport: Visible Meta Files
8 | m_SerializationMode: 2
9 | m_WebSecurityEmulationEnabled: 0
10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
11 | m_DefaultBehaviorMode: 1
12 | m_SpritePackerMode: 2
13 | m_SpritePackerPaddingPower: 1
14 | m_ProjectGenerationIncludedExtensions:
15 | m_ProjectGenerationRootNamespace:
16 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!30 &1
4 | GraphicsSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 5
7 | m_Deferred:
8 | m_Mode: 1
9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
10 | m_DeferredReflections:
11 | m_Mode: 1
12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13 | m_LegacyDeferred:
14 | m_Mode: 1
15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
16 | m_AlwaysIncludedShaders:
17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
23 | m_PreloadedShaders: []
24 | m_ShaderSettings:
25 | useScreenSpaceShadows: 1
26 | m_BuildTargetShaderSettings: []
27 | m_LightmapStripping: 0
28 | m_FogStripping: 0
29 | m_LightmapKeepPlain: 1
30 | m_LightmapKeepDirCombined: 1
31 | m_LightmapKeepDirSeparate: 1
32 | m_LightmapKeepDynamicPlain: 1
33 | m_LightmapKeepDynamicDirCombined: 1
34 | m_LightmapKeepDynamicDirSeparate: 1
35 | m_FogKeepLinear: 1
36 | m_FogKeepExp: 1
37 | m_FogKeepExp2: 1
38 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshAreas:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | areas:
8 | - name: Walkable
9 | cost: 1
10 | - name: Not Walkable
11 | cost: 1
12 | - name: Jump
13 | cost: 2
14 | - name:
15 | cost: 1
16 | - name:
17 | cost: 1
18 | - name:
19 | cost: 1
20 | - name:
21 | cost: 1
22 | - name:
23 | cost: 1
24 | - name:
25 | cost: 1
26 | - name:
27 | cost: 1
28 | - name:
29 | cost: 1
30 | - name:
31 | cost: 1
32 | - name:
33 | cost: 1
34 | - name:
35 | cost: 1
36 | - name:
37 | cost: 1
38 | - name:
39 | cost: 1
40 | - name:
41 | cost: 1
42 | - name:
43 | cost: 1
44 | - name:
45 | cost: 1
46 | - name:
47 | cost: 1
48 | - name:
49 | cost: 1
50 | - name:
51 | cost: 1
52 | - name:
53 | cost: 1
54 | - name:
55 | cost: 1
56 | - name:
57 | cost: 1
58 | - name:
59 | cost: 1
60 | - name:
61 | cost: 1
62 | - name:
63 | cost: 1
64 | - name:
65 | cost: 1
66 | - name:
67 | cost: 1
68 | - name:
69 | cost: 1
70 | - name:
71 | cost: 1
72 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!149 &1
4 | NetworkManager:
5 | m_ObjectHideFlags: 0
6 | m_DebugLevel: 0
7 | m_Sendrate: 15
8 | m_AssetToPrefab: {}
9 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Gravity: {x: 0, y: -9.81}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_VelocityIterations: 8
10 | m_PositionIterations: 3
11 | m_VelocityThreshold: 1
12 | m_MaxLinearCorrection: 0.2
13 | m_MaxAngularCorrection: 8
14 | m_MaxTranslationSpeed: 100
15 | m_MaxRotationSpeed: 360
16 | m_MinPenetrationForPenalty: 0.01
17 | m_BaumgarteScale: 0.2
18 | m_BaumgarteTimeOfImpactScale: 0.75
19 | m_TimeToSleep: 0.5
20 | m_LinearSleepTolerance: 0.01
21 | m_AngularSleepTolerance: 2
22 | m_QueriesHitTriggers: 1
23 | m_QueriesStartInColliders: 1
24 | m_ChangeStopsCallbacks: 0
25 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.5f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags: []
7 | layers:
8 | - Default
9 | - TransparentFX
10 | - Ignore Raycast
11 | -
12 | - Water
13 | - UI
14 | -
15 | -
16 | -
17 | -
18 | -
19 | -
20 | -
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | m_SortingLayers:
41 | - name: Default
42 | uniqueID: 0
43 | locked: 0
44 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: 0.02
7 | Maximum Allowed Timestep: 0.33333334
8 | m_TimeScale: 1
9 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!292 &1
4 | UnityAdsSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_InitializeOnStartup: 1
8 | m_TestMode: 0
9 | m_EnabledPlatforms: 4294967295
10 | m_IosGameId:
11 | m_AndroidGameId:
12 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | UnityPurchasingSettings:
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | UnityAnalyticsSettings:
10 | m_Enabled: 0
11 | m_InitializeOnStartup: 1
12 | m_TestMode: 0
13 | m_TestEventUrl:
14 | m_TestConfigUrl:
15 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Client/UnityPackages.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "AkkaInterfacedSlimSocket": {
4 | "version": "0.4.*",
5 | "source": "github:SaladLab/Akka.Interfaced.SlimSocket"
6 | },
7 | "EntityNetwork": {
8 | "version": "0.2.*",
9 | "source": "github:SaladLab/EntityNetwork"
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Net;
4 | using System.Threading.Tasks;
5 | using Akka.Actor;
6 | using Akka.Interfaced;
7 | using Akka.Interfaced.SlimServer;
8 | using Akka.Interfaced.SlimSocket;
9 | using Akka.Interfaced.SlimSocket.Server;
10 | using Common.Logging;
11 | using Domain;
12 |
13 | namespace Unity.Program.Server
14 | {
15 | internal class Program
16 | {
17 | private static void Main(string[] args)
18 | {
19 | if (typeof(IUser) == null)
20 | throw new Exception("Force interface module to be loaded");
21 |
22 | var system = ActorSystem.Create("MySystem");
23 | DeadRequestProcessingActor.Install(system);
24 |
25 | var gateway = StartListen(system, ChannelType.Tcp, new IPEndPoint(IPAddress.Any, 5000)).Result;
26 |
27 | Console.WriteLine("Please enter key to quit.");
28 | Console.ReadLine();
29 |
30 | gateway.Stop().Wait();
31 | system.Terminate().Wait();
32 | }
33 |
34 | private static async Task StartListen(ActorSystem system, ChannelType channelType, IPEndPoint listenEndPoint)
35 | {
36 | var serializer = PacketSerializer.CreatePacketSerializer();
37 |
38 | var initiator = new GatewayInitiator
39 | {
40 | ListenEndPoint = listenEndPoint,
41 | GatewayLogger = LogManager.GetLogger($"Gateway({channelType})"),
42 | CreateChannelLogger = (ep, _) => LogManager.GetLogger($"Channel({ep}"),
43 | ConnectionSettings = new TcpConnectionSettings { PacketSerializer = serializer },
44 | PacketSerializer = serializer,
45 | CreateInitialActors = (context, connection) => new[]
46 | {
47 | Tuple.Create(
48 | context.ActorOf(Props.Create(() =>
49 | new UserActor(context.Self.Cast(), CreateUserId()))),
50 | new TaggedType[] { typeof(IUser) },
51 | ActorBindingFlags.StopThenCloseChannel)
52 | }
53 | };
54 |
55 | var gateway = (channelType == ChannelType.Tcp)
56 | ? system.ActorOf(Props.Create(() => new TcpGateway(initiator)), "TcpGateway").Cast()
57 | : system.ActorOf(Props.Create(() => new UdpGateway(initiator)), "UdpGateway").Cast();
58 |
59 | await gateway.Start();
60 | return gateway;
61 | }
62 |
63 | private static int _lastUserId = 0;
64 |
65 | private static string CreateUserId()
66 | {
67 | var id = ++_lastUserId;
68 | return "User:" + id;
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Unity.Program.Server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("SaladLab")]
12 | [assembly: AssemblyProduct("Unity.Program.Server")]
13 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("db45ac5e-cc05-4626-ae49-0bfb479d7c11")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Server/UserActor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Akka.Actor;
4 | using Akka.Interfaced;
5 | using Akka.Interfaced.LogFilter;
6 | using Akka.Interfaced.SlimServer;
7 | using Common.Logging;
8 | using Domain;
9 |
10 | namespace Unity.Program.Server
11 | {
12 | [Log]
13 | public class UserActor : InterfacedActor, IUser
14 | {
15 | private ILog _logger;
16 | private readonly ActorBoundChannelRef _channel;
17 | private string _id;
18 | private GameRef _enteredGame;
19 |
20 | public UserActor(ActorBoundChannelRef channel, string id)
21 | {
22 | _logger = LogManager.GetLogger($"UserActor({id})");
23 | _channel = channel;
24 | _id = id;
25 | }
26 |
27 | protected override void PostStop()
28 | {
29 | UnlinkAll();
30 | base.PostStop();
31 | }
32 |
33 | private void UnlinkAll()
34 | {
35 | if (_enteredGame != null)
36 | {
37 | _enteredGame.WithNoReply().Leave(_id);
38 | _enteredGame = null;
39 | }
40 | }
41 |
42 | Task IUser.GetId()
43 | {
44 | return Task.FromResult(_id);
45 | }
46 |
47 | async Task> IUser.EnterGame(string name, IGameObserver observer)
48 | {
49 | if (_enteredGame != null)
50 | throw new InvalidOperationException();
51 |
52 | // try to get game ref
53 |
54 | IActorRef actor;
55 | try
56 | {
57 | actor = await Context.ActorSelection("/user/game_" + name).ResolveOne(TimeSpan.Zero);
58 | }
59 | catch (ActorNotFoundException)
60 | {
61 | actor = Context.System.ActorOf(Props.Create(() => new GameActor(name)), "game_" + name);
62 | }
63 | var game = actor.Cast().WithRequestWaiter(this);
64 |
65 | // enter the game
66 |
67 | var join = await game.Enter(_id, observer);
68 |
69 | // Bind an game actor to channel
70 |
71 | var boundActor = await _channel.BindActor(game.CastToIActorRef(),
72 | new[] { new TaggedType(typeof(IGameClient), _id) });
73 | if (boundActor == null)
74 | {
75 | await game.Leave(_id);
76 | _logger.Error($"Failed in binding GameClient");
77 | throw new InvalidOperationException();
78 | }
79 |
80 | _enteredGame = game;
81 | return Tuple.Create((IGameClient)boundActor.Cast(), join.Item1, join.Item2);
82 | }
83 |
84 | async Task IUser.LeaveGame()
85 | {
86 | if (_enteredGame == null)
87 | throw new InvalidOperationException();
88 |
89 | // Let's exit from the room !
90 |
91 | await _enteredGame.Leave(_id);
92 |
93 | // Unbind an game actor from channel
94 |
95 | _channel.WithNoReply().UnbindActor(_enteredGame.CastToIActorRef());
96 | _enteredGame = null;
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/samples/Unity/Program.Server/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/.nuget/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/src/.nuget/nuget.exe
--------------------------------------------------------------------------------
/tools/nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tools/nuget/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/tools/nuget/nuget.exe
--------------------------------------------------------------------------------
/tools/nuget/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tools/unity3d/UnityEngine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/tools/unity3d/UnityEngine.dll
--------------------------------------------------------------------------------
/tools/unity3d/pdb2mdb.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/EntityNetwork/62372ecc1e109858f491e8b3f7dbf6e33fe6b41c/tools/unity3d/pdb2mdb.exe
--------------------------------------------------------------------------------