public MatchmakingService(Scene scene) { this._scene = scene; MatchState = MatchState.Unknown; scene.AddRoute("match.update", OnMatchUpdateCallback); scene.AddRoute("match.parameters.update", OnMatchParametersUpdateCallback); scene.AddRoute("match.ready.update", OnMatchReadyUpdateCallBack); }
public override void Init(Scene s) { s.AddRoute("chat", OnChat); s.AddRoute("UpdateInfo", OnUpdateInfo); s.AddRoute("DiscardInfo", OnDiscardInfo); SendBtn.onClick.AddListener(OnSendMessage); chatSlider.onValueChanged.AddListener(ShowMessages); Infos = new ChatUserInfo(); Infos.User = UserInfo; }
public GameSessionService(Scene scene) { this._scene = scene; _scene.AddRoute("server.started", packet => { _waitServerTce.TrySetResult(true); }); _scene.AddRoute <PlayerUpdate>("player.update", OnPlayerUpdate); }
private void onGettingPublicScene(Task<Stormancer.Scene> task) { if (task.IsFaulted) { m_connecting = false; return; } Debug.Log("Scene get..."); m_scene = task.Result; m_scene.AddRoute("UpdateGame", onUpdateGame); m_scene.AddRoute("JoinStartedGame", onJoinStartedGame); m_scene.AddRoute("GetIdPlayer", onGetIdPlayer); m_scene.Connect().ContinueWith(onSceneConnecting); }
public override void Init(Scene s) { if (s != null) { Debug.Log("replicator initializing"); Clock = s.DependencyResolver.GetComponent<IClock>(); s.AddProcedure("RequestObjects", OnRequestObjects); s.AddRoute("PlayerDisconnected", OnPlayerDisconnect); s.AddRoute("CreateObject", OnCreateObject); s.AddRoute("DestroyObject", OnDestroyObject); s.AddRoute("ForceUpdate", OnForceUpdate); s.AddRoute("UpdateObject", OnUpdateObject); } }
private void onSceneConnecting(Task<Scene> task) { if (task.IsFaulted) { Debug.Log("Can't get scene."); m_connecting = false; return; } m_scene = task.Result; m_scene.AddRoute("CreateEntity", onCreateEntity); m_scene.AddRoute("DestroyEntity", onDestroyEntity); m_scene.AddRoute("PosUpdatePlayer", onUpdatePos); m_scene.AddRoute("PlayerDisconnected", onPlayerDisconnected); m_scene.Connect().ContinueWith(onConnected); }
public TransactionBrokerService(Scene scene) { this._scene = scene; this._logger = scene.DependencyResolver.Resolve <ILogger>(); _scene.AddRoute <string>("tbt.desync", OnDesynchCallBack); _scene.AddProcedure("transaction.execute", OnExecuteTransaction, true); _scene.AddProcedure("tbt.replayTLog", OnReplayLogs, true); }
/// <summary> /// Listen to messages on the specified route, deserialize them and execute the given handler for eah of them. (Duplicate of AddRoute for compatibility) /// </summary> /// <typeparam name="TData"></typeparam> /// <param name="scene">The remote scene proxy on which the route messages will be listened.</param> /// <param name="route">The route to listen.</param> /// <param name="handler">The handler to execute for each message on the route.</param> /// <returns>An IDisposable object you can use to unregister the handler.</returns> /// <remarks>RegisterRoute is an alias to the AddRoute method.</remarks> public static IDisposable RegisterRoute <TData>(this Scene scene, string route, Action <TData> handler) { return(scene.AddRoute(route, handler)); }
private void ConfigureScene(Scene scene) { scene.AddRoute<string>("msg", msg => UniRx.MainThreadDispatcher.Post(()=> this.Text.text = msg)); }
void Connect() { if (_connected == false && _connecting == false) { Debug.Log ("start connection procedure"); ConnectionDtO cdto = new ConnectionDtO(connectionPanel.username.text, version); connectionPanel.error.text = "Connecting"; _connecting = true; _local_client.GetPublicScene ("main", cdto).ContinueWith (task => { if (task.IsFaulted) { Debug.Log ("connection failed : " + task.Exception.Message); _connecting = false; } else { _scene = task.Result; Debug.Log ("configuring routes"); _scene.AddRoute ("create_ball", onCreateBalls); _scene.AddRoute ("destroy_ball", onDestroyBalls); Debug.Log ("connecting to remote scene"); _scene.Connect().ContinueWith( t => { if (_scene.Connected) { _connected = true; _connecting = false; Debug.Log("connection succeful"); UniRx.MainThreadDispatcher.Post (() =>{ connectionPanel.error.text = "Please enter a username"; connectionPanel.connectBtn.enabled = true; }); } else { Debug.Log ("connection failed: " + t.Exception.InnerException.Message); _connecting = false; UniRx.MainThreadDispatcher.Post (() =>{ connectionPanel.error.text = t.Exception.InnerException.Message; }); } }); } }); } }