public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { _cts = new CancellationTokenSource(); Task.Run(() => { try { //INVOKE THE SHARED CODE var journeyHelper = new JourneyHelper(); journeyHelper.StartListening(_cts.Token).Wait(); } catch (System.OperationCanceledException) { } finally { if (_cts.IsCancellationRequested) { var message = new CancelledMessage(); Device.BeginInvokeOnMainThread( () => MessagingCenter.Send(message, "StopJourneyMessage") ); } } }, _cts.Token); return(StartCommandResult.Sticky); }
public async Task Start() { _cts = new CancellationTokenSource(); _taskId = UIApplication.SharedApplication.BeginBackgroundTask("LongRunningTask", OnExpiration); try { //INVOKE THE SHARED CODE var journeyHelper = new JourneyHelper(); journeyHelper.StartListening(_cts.Token).Wait(); } catch (OperationCanceledException) { } finally { if (_cts.IsCancellationRequested) { var message = new CancelledMessage(); Device.BeginInvokeOnMainThread( () => MessagingCenter.Send(message, "StopJourneyMessage") ); } } UIApplication.SharedApplication.EndBackgroundTask(_taskId); }
private IEnumerator InitCO() { AppSettingsManager = new AppSettingsManager(); AssetManager = new AssetManager(); yield return(ReloadEdition()); // TODO refactor: standardize initialisation of managers VocabularyHelper = new VocabularyHelper(DB); JourneyHelper = new JourneyHelper(DB); ScoreHelper = new ScoreHelper(DB); Teacher = new TeacherAI(DB, VocabularyHelper, ScoreHelper); LogManager = new LogManager(); GameLauncher = new MiniGameLauncher(Teacher); FirstContactManager = new FirstContactManager(); Services = new ServicesManager(); FacebookManager = gameObject.AddComponent <FacebookManager>(); FacebookManager.verbose = true; // MonoBehaviors NavigationManager = gameObject.AddComponent <NavigationManager>(); NavigationManager.Init(); gameObject.AddComponent <KeeperManager>(); gameObject.AddComponent <BookManager>(); RewardSystemManager = new RewardSystemManager(); RewardSystemManager.Init(); PlayerProfileManager = new PlayerProfileManager(); PlayerProfileManager.LoadPlayerSettings(); Services = new ServicesManager(); Debug.Log("AppManager Init(): UIDirector.Init()"); UIDirector.Init(); // Must be called after NavigationManager has been initialized // Debugger setup if (!ApplicationConfig.I.DebugLogEnabled) { Debug.LogWarning("LOGS ARE DISABLED - check the App Config"); } Debug.unityLogger.logEnabled = ApplicationConfig.I.DebugLogEnabled; gameObject.AddComponent <Debugging.DebugManager>(); Debug.Log("AppManager Init(): UpdateAppVersion"); // Update settings AppSettingsManager.UpdateAppVersion(); Time.timeScale = 1; Loaded = true; }
public TeacherAI(DatabaseManager _dbManager, PlayerProfile _playerProfile) { I = this; dbManager = _dbManager; playerProfile = _playerProfile; wordHelper = new WordHelper(_dbManager); journeyHelper = new JourneyHelper(_dbManager, this); scoreHelper = new ScoreHelper(_dbManager); logAI = new LogAI(_dbManager); minigameSelectionAI = new MiniGameSelectionAI(dbManager, playerProfile); wordAI = new WordSelectionAI(dbManager, playerProfile, this, wordHelper); difficultySelectionAI = new DifficultySelectionAI(dbManager, playerProfile); }
/// <summary> /// first Init, from Awake() /// </summary> protected override void Init() { if (alreadySetup) { return; } alreadySetup = true; AppSettingsManager = new AppSettingsManager(); DB = new DatabaseManager(); // TODO refactor: standardize initialisation of managers LogManager = new LogManager(); VocabularyHelper = new VocabularyHelper(DB); JourneyHelper = new JourneyHelper(DB); ScoreHelper = new ScoreHelper(DB); Teacher = new TeacherAI(DB, VocabularyHelper, ScoreHelper); GameLauncher = new MiniGameLauncher(Teacher); FirstContactManager = new FirstContactManager(); Services = new ServicesManager(); FacebookManager = gameObject.AddComponent <FacebookManager>(); FacebookManager.verbose = true; // MonoBehaviors NavigationManager = gameObject.AddComponent <NavigationManager>(); NavigationManager.Init(); gameObject.AddComponent <KeeperManager>(); gameObject.AddComponent <BookManager>(); RewardSystemManager = new RewardSystemManager(); RewardSystemManager.Init(); PlayerProfileManager = new PlayerProfileManager(); PlayerProfileManager.LoadPlayerSettings(); Services = new ServicesManager(); Debug.Log("AppManager Init(): UIDirector.Init()"); UIDirector.Init(); // Must be called after NavigationManager has been initialized // Debugger setup Debug.unityLogger.logEnabled = AppConfig.DebugLogEnabled; gameObject.AddComponent <Debugging.DebugManager>(); Debug.Log("AppManager Init(): UpdateAppVersion"); // Update settings AppSettingsManager.UpdateAppVersion(); }
static void Main(string[] args) { var md = JourneyHelper.GetManhanttenDistance(Journey.Route); Console.WriteLine(md); }