/// <summary> /// Call back when Connection status changed, just log the changes here /// </summary> /// <param name="connected"></param> /// <param name="hostname"></param> public void OnConnectionChangeEvent(bool connected, string hostname) { chkForConnection = true; string status = connected ? "Good" : "Broken"; if (status == "Broken") { //if (IsRestartCalled == false) //{ // IsRestartCalled = true; createLogFile(); // OMS Application restart .... ResetApp ts = new ResetApp(); ts.methodRestart(); //} } Console.WriteLine("The connection to Call server at " + hostname + " is " + status); }
private void Awake() { _appStateBroker = AppStateBroker.Instance; AutoTest = AutoTest_External; #if !UNITY_EDITOR DevMode = false; #endif //Debug msg binding Observable .EveryUpdate() .Select(_ => TargetLane) .DistinctUntilChanged() .Subscribe(_ => { TargetLane_External = _; }).AddTo(gameObject); Observable .EveryUpdate() .Select(_ => TargetObject) .DistinctUntilChanged() .Subscribe(_ => { TargetObject_External = _; }).AddTo(gameObject); //to reset ResetApp .Where(b => b) .Take(1) .Subscribe(x => { ResetApp.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => SceneManager.LoadScene(SceneManager.GetActiveScene().name)) .AddTo(gameObject); }) .AddTo(gameObject); //to clibration CalibrationMode .Where(b => b) .Take(1) .Subscribe(x => { CalibrationMode.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => SceneManager.LoadScene(Open4thLane?"MainScene_4Lane_Cal":"MainScene_3Lane_Cal")) .AddTo(gameObject); }) .AddTo(gameObject); //to main game GameMode .Where(b => b) .Take(1) .Subscribe(x => { GameMode.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => { SceneManager.LoadScene(Open4thLane ? "MainScene_4Lane" : "MainScene_3Lane"); }) .AddTo(gameObject); }) .AddTo(gameObject); //auto test if (AutoTest) { DebugOutputObjects.SetActive(true); ManualTeamSelectAllowed = ManualTeamSelectAllowedExternal = false; Observable.EveryUpdate().Select(_ => TestCount).Subscribe(x => { DubugOutput.text = x.ToString(); ThrowAllowed.gameObject.SetActive(TestCount % 2 != 0); }).AddTo(gameObject); _appStateBroker .CurrentRound .Subscribe(round => { switch (round) { case Rounds.Idle: Observable.Timer(TimeSpan.FromSeconds(2f)) .Take(1) .Subscribe(_ => { var len = Open4thLane ? 4 : 3; for (int i = 0; i < len; i++) { var client = new ORTCPEventParams(); var team = AutoTestIndexProvider.GetTeamIndex(); client.message = "{\"state\":10,\"station_id\":" + i + ",\"team\":" + team + "}"; _appStateBroker.ComReceivingStream.OnNext(client); } DelayedSanp(); }).AddTo(gameObject); break; case Rounds.R1: case Rounds.R2: case Rounds.R3: DelayedSanp(); break; case Rounds.Finish: DelayedSanp(); TestCount++; Debug.LogFormat("[{0}] Testing Count : {1}", name, TestCount); break; } }) .AddTo(gameObject); } else { DebugOutputObjects.SetActive(false); } }