// Use this for initialization
    void Start()
    {
        state = ServerState.OFF;

        gr = GetComponent <GameRunner>();
        gr.Reset(true);
        gr.GenerateTerrainSeed();

        ch = new ServerConnectionHandler(this.HandleIncomingData);

        cl = new ServerConnectionListener(port, 100, ch.AddConnection);
    }
Exemple #2
0
 public BrokerRunner(string metadataDir = null, IRegistryProvider registryProvider = null)
 {
     _workingDir       = Directory.GetCurrentDirectory();
     metadataDir       = metadataDir ?? Path.Combine(_workingDir, "metadata");
     _transportServers = new ITransportServer[]
     {
         new TransportServer(new PipeTransmissionServer(_workingDir), DefaultTransportSerializationProvider),
         new TransportServer(new WebSocketTransmissionServer(_workingDir), DefaultTransportSerializationProvider)
     };
     _connectionListener = new ServerConnectionListener(_transportServers);
     registryProvider    = registryProvider ?? JsonRegistryProvider.Initialize(Path.Combine(metadataDir, "interop.json"));
     _connectionTracker  = new AppLifecycleManager(metadataDir);
     _brokerProcessor    = new BrokerProcessor(
         _connectionListener.In,
         registryProvider,
         DefaultProtocolSerializationProvider,
         _connectionTracker);
     OnStop(_connectionListener.Stop);
 }
Exemple #3
0
 /// <summary>
 /// リスナーを削除
 /// </summary>
 /// <param name="listener"></param>
 public void RemoveListener(ServerConnectionListener listener)
 {
     ServerConnectionListeners.Remove(listener);
 }
Exemple #4
0
 /// <summary>
 /// リスナーを追加
 /// </summary>
 /// <param name="listener"></param>
 public void AddListener(ServerConnectionListener listener)
 {
     ServerConnectionListeners.Add(listener);
 }