public GameScene(int playerSpriteIndex)
        {
            this.playerSpriteIndex = playerSpriteIndex;

            this.networkService = WaveServices.GetService<NetworkService>();
            //Register the scene to use the synchronization components. This scene sync the entities in the scenes with the same sceneId in other clients.
            this.networkManager = this.networkService.RegisterScene(this, GameSceneIdentifier);
        }
        public SelectPlayerScene()
        {
            this.networkService = WaveServices.GetService<NetworkService>();
            this.networkService.HostMessageReceived += this.HostMessageReceived;
            this.networkService.ClientMessageReceived += this.ClientMessageReceived;

            this.assignedPlayerSprites = new Dictionary<int, string>();
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkManager" /> class.
        /// </summary>
        /// <param name="scene">The scene.</param>
        /// <param name="networkService">The network service.</param>
        /// <exception cref="System.ArgumentNullException">The 'scene' or 'networkService' argument can't be null.</exception>
        internal NetworkManager(Scene scene, NetworkService networkService)
        {
            if (scene == null)
            {
                throw new ArgumentNullException("The 'scene' argument can't be null.");
            }

            if (networkService == null)
            {
                throw new ArgumentNullException("The 'networkService' argument can't be null.");
            }

            this.scene = scene;
            this.networkService = networkService;
            this.factories = new Dictionary<string, Func<string, string, Entity>>();
            this.entityBehaviors = new Dictionary<string, NetworkBehavior>();
            this.serializer = SerializerFactory.GetSerializer<Entity>(SerializationType.DATACONTRACT);
        }
 public MainScene()
 {
     this.networkService = WaveServices.GetService<NetworkService>();
     this.discoveredHostButtons = new List<Entity>();
 }