internal void setGameMonitor(GameMonitor _myGameMonitor) { if (myGameMonitor == null) { myGameMonitor = _myGameMonitor; } }
private void OnClosing() { // request monitors to exit gracefully if (LauncherMonitor != null) { LauncherMonitor.Stop(); } if (GameMonitor != null) { GameMonitor.Stop(); } // forcefully kill externals on OSOL exit if requested if (SetHnd.Options.ForceKillExternals && PreLauncherPL != null && PreLauncherPL.ProcWrapper.IsRunning()) { ProcessWrapper.KillProcTreeByName(PreLauncherPL.ProcWrapper.ProcessName); } if (SetHnd.Options.ForceKillExternals && PostGamePL != null && PostGamePL.ProcWrapper.IsRunning()) { ProcessWrapper.KillProcTreeByName(PostGamePL.ProcWrapper.ProcessName); } // clean up system tray TrayUtil.RefreshTrayArea(); // exit gracefully ExitRequested = true; }
public override void Activate() { base.Activate(); #if UNITY_EDITOR GameMonitor.OnDayStateChanged(this); #endif }
public GameMonitorTests() { _threadRunnerMock = new Mock <IThreadRunner>(); _gameStatusRetrieverMock = new Mock <IGameStatusRetriever>(); _gameMonitor = Create(); }
public async Task ProcessLauncher() { // check for running instance of launcher (relaunch if required) if (SetHnd.Options.ReLaunch && LauncherPathValid && ProcessWrapper.IsRunningByName(LauncherName)) {// if the launcher is running before the game kill it so we can run it through Steam ProcessUtils.Logger("OSOL", $"Found previous instance of launcher [{LauncherName}.exe], relaunching..."); ProcessWrapper.KillProcTreeByName(LauncherName); } // run PreLaunchExecPath/Args before the launcher PreLauncherPL = new ProcessLauncher( SetHnd.Paths.PreLaunchExecPath, SetHnd.Paths.PreLaunchExecArgs, elevate: SetHnd.Options.ElevateExternals ); await PreLauncherPL.Launch(); LauncherPL = new ProcessLauncher( SetHnd.Paths.LauncherPath, SetHnd.Paths.LauncherArgs, avoidProcName: GameName ); if (!SetHnd.Options.SkipLauncher && SetHnd.Options.ReLaunch) { await LauncherPL.Launch(); // launching the launcher is optional } LauncherMonitor = new ProcessMonitor( LauncherPL, SetHnd.Options.ProcessAcquisitionTimeout, SetHnd.Options.InterProcessAcquisitionTimeout ); LauncherMonitor.ProcessHardExit += OnLauncherExited; // signal for manual game launch if (SetHnd.Options.SkipLauncher) { OnLauncherAcquired(this, null); } else { LauncherMonitor.ProcessAcquired += OnLauncherAcquired; } // wait for all running threads to exit while (!ExitRequested || PreLauncherPL != null && PreLauncherPL.ProcWrapper.IsRunning() || PostGamePL != null && PostGamePL.ProcWrapper.IsRunning() || LauncherMonitor != null && LauncherMonitor.IsRunning() || GameMonitor != null && GameMonitor.IsRunning()) { await Task.Delay(1000); } }
} // 打牌所增加的经验 //------------------------------------------------------------------------- public override void init() { EnableSave2Db = false; EnableUpdate = false; var et_desktop = Entity.getUserData <Entity>(); CoDesktop = et_desktop.getComponent <CellDesktop <DefDesktop> >(); mGameMonitor = new GameMonitor(Entity.Guid); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } //Set Time to now lastRestart = Time.time; DontDestroyOnLoad(gameObject); //Levelindex int scenecount = SceneManager.sceneCountInBuildSettings; string[] scenes = new string[scenecount]; // Level, Main Menu, Credits string[] _sceneType = new string[scenecount]; // Level, Main Menu, Credits //Looping thorugh all Scenes for (int i = 0; i < scenecount; i++) { //scenes[i] = SceneManager.GetSceneByBuildIndex(i); //Getting Scene Names scenes[i] = System.IO.Path.GetFileNameWithoutExtension(UnityEngine.SceneManagement.SceneUtility.GetScenePathByBuildIndex(i)); if (scenes[i].ToString().Contains("Level")) { _sceneType[i] = "Level"; } if (scenes[i].ToString().Contains("Main Menu")) { _sceneType[i] = "Main Menu"; } if (scenes[i].ToString().Contains("EndScreen")) { _sceneType[i] = "End Screen"; } } sceneType = _sceneType; /*Debug.Log("SceneTypes:"); * foreach (string s in sceneType) * { * Debug.Log("Scene: " + s); * }*/ }
private void OnClosing() { // request monitors to exit gracefully if (LauncherMonitor != null) { LauncherMonitor.Stop(); } if (GameMonitor != null) { GameMonitor.Stop(); } // clean up system tray TrayUtil.RefreshTrayArea(); // exit gracefully ExitRequested = true; }
public void NextUnservedCustomer() { if (customerIndex >= todayCustomersList.customers.Count) { //do nothing so the game doesn't crash lol. just show the last person again //currentCustomer.customer = null; } else { currentCustomer.customer = todayCustomersList.customers[customerIndex]; #if UNITY_EDITOR GameMonitor.OnCustomerChanged(currentCustomer); #endif customerIndex++; } }
private void OnTrackingLost() { Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true); Collider[] colliderComponents = GetComponentsInChildren <Collider>(true); // Disable rendering: foreach (Renderer component in rendererComponents) { component.enabled = false; } // Disable colliders: foreach (Collider component in colliderComponents) { component.enabled = false; } Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost"); mGameMonitor = arCam.GetComponent <GameMonitor>(); if (mGameMonitor) { mGameMonitor.ReportTargetNotFound(mTrackableBehaviour.TrackableName); } }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { List <Player> players; if (_configuration.Simulate) { await _hub.Clients.All.GameFound(); await Task.Delay(4000, stoppingToken); players = new List <Player> { new Player("Rookian", Races.Orc, 1, true) { PlayerStats = PlayerStats() }, new Player("NightEnD", Races.Human, 3, false) { PlayerStats = PlayerStats() }, new Player("Feanor", Races.NightElf, 5, false) { PlayerStats = PlayerStats() }, new Player("ILoveNecropolis", Races.Random, 7, false) { PlayerStats = PlayerStats() }, new Player("FollowGrubby", Races.Orc, 2, false) { PlayerStats = PlayerStats() }, new Player("TimonCrab", Races.Undead, 4, false) { PlayerStats = PlayerStats() }, new Player("RomanticHuman", Races.NightElf, 6, false) { PlayerStats = PlayerStats() }, new Player("123456789012345", Races.Random, 8, false) { PlayerStats = PlayerStats() } }; await _hub.Clients.All.Send(players); await Task.Delay(4000, stoppingToken); } else { players = await GameMonitor.LookForPlayers(async() => await _hub.Clients.All.GameFound()); await _hub.Clients.All.Send(players); await Task.Delay(100); } } }
public void SetFinished() { progressState = ProgressState.Finished; GameMonitor.OnDayStateFlagUpdated(); }
private GameMonitor Create() { return(_gameMonitor = new GameMonitor(_threadRunnerMock.Object, _gameStatusRetrieverMock.Object)); }
public void doChat() { int requestCount = 0; byte[] bytesFrom = new byte[10025]; string dataFromClient = null; string rCount = null; requestCount = 0; while ((true)) { try { requestCount = requestCount + 1; NetworkStream networkStream = clientSocket.GetStream(); networkStream.Read(bytesFrom, 0, (int)clientSocket.ReceiveBufferSize); dataFromClient = Encoding.ASCII.GetString(bytesFrom); dataFromClient = dataFromClient.Substring(0, dataFromClient.IndexOf("$")); Console.WriteLine("From Client - " + clNo + " : " + dataFromClient); rCount = Convert.ToString(requestCount); string response = null; string player = ""; string ready = ""; if (!allReady()) { string[] readys = dataFromClient.Split(','); player = readys[0]; ready = readys[1]; if (ready.Equals("ready")) { playerReady[player] = true; } response = dataFromClient; } Console.WriteLine(JsonConvert.SerializeObject(this.playerReady, Formatting.Indented).ToString()); if (allReady()) { if (this.g == null) { this.g = this.h.g; if (ready.Equals("ready")) { response = "game.started"; } else if (dataFromClient == "get.game.instance") { response = this.g.starter; response += "%%" + GameMonitor.See(this.g); } } else { if (dataFromClient == "get.game.instance") { response = this.g.starter; response += "%%" + GameMonitor.See(this.g); } else { response = this.g.Input(dataFromClient); response += "%" + dataFromClient + "%" + GameMonitor.See(this.g); } } } WPF_Final_v2.HostPage.broadcast(response, clNo, false); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }
private void StartGameMonitor() { _gameMonitor = new GameMonitor(_kataraiApp); _gameMonitor.StartMonitoring(); }
void Awake() { if (Instance == null) { Instance = this; } else if(Instance != this) { Instance.started = false; Instance.Start(); Destroy(gameObject); } DontDestroyOnLoad (gameObject); }
//TODO: rework this whole class using nested classes and this https://stackoverflow.com/questions/2816961/how-to-get-access-to-private-members-of-nested-class/2817005#2817005 //so that only states can set these to in progress, and remove SetInProgress below /*[CreateAssetMenu(menuName = "Flag/TestClass")] * private class TestClass : ScriptableObject * { * public int testInt; * }*/ public void SetInProgress() { progressState = ProgressState.InProgress; GameMonitor.OnDayStateChanged(null); }