public IEnumerator LaunchActivity(string activityId) { if (activityId == null) { Game.Instance.RunTarget("Simva.End", null, false); } else { Activity activity = GetActivity(activityId); if (activity != null) { Debug.Log("[SIMVA] Schedule: " + activity.Type + ". Name: " + activity.Name + " activityId " + activityId); switch (activity.Type) { case "limesurvey": Debug.Log("[SIMVA] Starting Survey..."); Game.Instance.RunTarget("Simva.Survey", null, false); break; case "gameplay": default: var trackerConfig = new TrackerConfig(); trackerConfig.setStorageType(TrackerConfig.StorageType.LOCAL); trackerConfig.setTraceFormat(TrackerConfig.TraceFormat.XAPI); trackerConfig.setRawCopy(true); trackerConfig.setDebug(true); if (ActivityHasDetails(activity, "realtime", "trace_storage")) { // Realtime trackerConfig.setStorageType(TrackerConfig.StorageType.NET); trackerConfig.setHost(simvaController.SimvaConf.URL); trackerConfig.setBasePath(""); trackerConfig.setLoginEndpoint("/users/login"); trackerConfig.setStartEndpoint("/activities/{0}/result"); trackerConfig.setTrackEndpoint("/activities/{0}/result"); trackerConfig.setTrackingCode(activityId); trackerConfig.setUseBearerOnTrackEndpoint(true); Debug.Log("TrackingCode: " + activity.Id + " settings " + trackerConfig.getTrackingCode()); } if (ActivityHasDetails(activity, "backup")) { // Local trackerConfig.setRawCopy(true); } if (ActivityHasDetails(activity, "realtime", "trace_storage", "backup")) { SimvaBridge = new SimvaBridge(API.ApiClient); Debug.Log("[SIMVA] Starting tracker..."); yield return(StartCoroutine(AnalyticsExtension.Instance.StartTracker(trackerConfig, SimvaBridge))); } Debug.Log("[SIMVA] Starting Gameplay..."); Game.Instance.RunTarget(Game.Instance.GameState.InitialChapterTarget.getId(), this); break; } } } }
public IEnumerator LaunchActivity(string activityId) { if (activityId == null) { if (backupOperation != null && !backupOperation.IsCompletedSuccessfully) { Game.Instance.AbortQuit(); DisableAutoSave(); Game.Instance.RunTarget("Simva.Backup", null, false); } else { DisableAutoSave(); Game.Instance.RunTarget("Simva.End", null, false); schedule = null; } } else { Activity activity = GetActivity(activityId); if (activity != null) { Game.Instance.AbortQuit(); Debug.Log("[SIMVA] Schedule: " + activity.Type + ". Name: " + activity.Name + " activityId " + activityId); switch (activity.Type) { case "limesurvey": Debug.Log("[SIMVA] Starting Survey..."); DisableAutoSave(); Game.Instance.RunTarget("Simva.Survey", null, false); break; case "gameplay": default: var trackerConfig = new TrackerConfig(); trackerConfig.setStorageType(TrackerConfig.StorageType.LOCAL); trackerConfig.setTraceFormat(TrackerConfig.TraceFormat.XAPI); trackerConfig.setRawCopy(true); trackerConfig.setDebug(true); if (ActivityHasDetails(activity, "realtime", "trace_storage")) { // Realtime trackerConfig.setStorageType(TrackerConfig.StorageType.NET); trackerConfig.setHost(simvaController.SimvaConf.URL); trackerConfig.setBasePath(""); trackerConfig.setLoginEndpoint("/users/login"); trackerConfig.setStartEndpoint("/activities/{0}/result"); trackerConfig.setTrackEndpoint("/activities/{0}/result"); trackerConfig.setTrackingCode(activityId); trackerConfig.setUseBearerOnTrackEndpoint(true); Debug.Log("TrackingCode: " + activity.Id + " settings " + trackerConfig.getTrackingCode()); } if (ActivityHasDetails(activity, "backup")) { // Local trackerConfig.setRawCopy(true); } if (ActivityHasDetails(activity, "realtime", "trace_storage", "backup")) { SimvaBridge = new SimvaBridge(API.ApiClient); Debug.Log("[SIMVA] Starting tracker..."); yield return(StartCoroutine(AnalyticsExtension.Instance.StartTracker(trackerConfig, auth.Username + "_" + activityId + "_backup.log", SimvaBridge))); } Debug.Log("[SIMVA] Starting Gameplay..."); RestoreAutoSave(); Game.Instance.RunTarget(savedGameTarget, this); if (Game.Instance.GameState.CheckFlag("DisclaimerEnabled") == FlagCondition.FLAG_ACTIVE) { Game.Instance.GameState.SetFlag("SeeingDisclaimer", FlagCondition.FLAG_ACTIVE); } break; } } } }
public IEnumerator LaunchActivity(string activityId) { if (activityId == null || gameplay) { if (backupOperation != null && !backupOperation.IsCompletedSuccessfully) { AbortQuit(); yield return(RunTarget("Simva.Backup")); yield return(new WaitUntil(() => afterBackup)); } //yield return RunTarget("Simva.End"); allowedToQuit = true; schedule = null; } else { Activity activity = GetActivity(activityId); if (activity != null) { AbortQuit(); Debug.Log("[SIMVA] Schedule: " + activity.Type + ". Name: " + activity.Name + " activityId " + activityId); switch (activity.Type) { case "limesurvey": Debug.Log("[SIMVA] Starting Survey..."); yield return(RunTarget("Simva.Survey")); break; case "gameplay": default: var trackerConfig = new TrackerConfig(); trackerConfig.setStorageType(TrackerConfig.StorageType.LOCAL); trackerConfig.setTraceFormat(TrackerConfig.TraceFormat.XAPI); trackerConfig.setRawCopy(true); trackerConfig.setDebug(true); gameplay = true; if (ActivityHasDetails(activity, "realtime", "trace_storage")) { // Realtime trackerConfig.setStorageType(TrackerConfig.StorageType.NET); trackerConfig.setHost(simvaController.SimvaConf.URL); trackerConfig.setBasePath(""); trackerConfig.setLoginEndpoint("/users/login"); trackerConfig.setStartEndpoint("/activities/{0}/result"); trackerConfig.setTrackEndpoint("/activities/{0}/result"); trackerConfig.setTrackingCode(activityId); trackerConfig.setUseBearerOnTrackEndpoint(true); Debug.Log("TrackingCode: " + activity.Id + " settings " + trackerConfig.getTrackingCode()); } if (ActivityHasDetails(activity, "backup")) { // Local trackerConfig.setRawCopy(true); } if (ActivityHasDetails(activity, "realtime", "trace_storage", "backup")) { SimvaBridge = new SimvaBridge(API.ApiClient); Debug.Log("[SIMVA] Starting tracker..."); yield return(StartTracker(trackerConfig, auth.Username + "_" + activityId + "_backup.log", SimvaBridge)); } DestroyImmediate(runner.gameObject); SceneManager.UnloadSceneAsync("Simva"); Debug.Log("[SIMVA] Starting Gameplay..."); LoadManager.Instance.LoadScene("MenuScene"); break; } } } }