/// <summary> /// Check if information provided is valid and creates new game if so /// </summary> public void NewGame() { var colorsPri = new PlayGen.RAGE.SportsTeamManager.Simulation.Color((int)(_colorImagePrimary.color.r * 255), (int)(_colorImagePrimary.color.g * 255), (int)(_colorImagePrimary.color.b * 255)); var colorsSec = new PlayGen.RAGE.SportsTeamManager.Simulation.Color((int)(_colorImageSecondary.color.r * 255), (int)(_colorImageSecondary.color.g * 255), (int)(_colorImageSecondary.color.b * 255)); _boatName.text = _boatName.text.TrimEnd(); _managerName.text = _managerName.text.TrimEnd(); var language = string.IsNullOrEmpty(Localization.SelectedLanguage.Parent.Name) ? Localization.SelectedLanguage.EnglishName : Localization.SelectedLanguage.Parent.EnglishName; Loading.Start(); GameManagement.GameManager.NewGameTask(GameManagement.GameSavePath, _boatName.text, colorsPri, colorsSec, _managerName.text, _tutorialToggle.isOn, language, success => { if (success) { if (GameManagement.Team != null && GameManagement.TeamName == _boatName.text) { TrackerEventSender.SendEvent(new TraceEvent("GameStarted", TrackerAsset.Verb.Initialized, new Dictionary <TrackerContextKey, object> { { TrackerContextKey.GameName, GameManagement.TeamName }, { TrackerContextKey.BoatLayout, GameManagement.PositionString } }, CompletableTracker.Completable.Game)); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.UserProfile, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "setupnewteam" } }); UIManagement.StateManager.GoToState(State.TeamManagement); Loading.Stop(); return; } } _errorText.text = Localization.Get("NEW_GAME_CREATION_ERROR"); Loading.Stop(); }); }
protected override void OnEnter() { CommandQueue.AddCommand(new CloseModulesCommand()); ResetFeedbackAnim(); _scenarioController.GetPlayerDialogueSuccessEvent += UpdatePlayerDialogue; _scenarioController.GetCharacterDialogueSuccessEvent += UpdateCharacterDialogue; _scenarioController.GetCharacterStrongestEmotionSuccessEvent += UpdateCharacterExpression; _scenarioController.FinalStateEvent += HandleFinalState; _scenarioController.StopTalkAnimationEvent += StopCharacterTalkAnimation; _scenarioController.GetFeedbackEvent += UpdateFeedbackForChoice; TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameFlow, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.PieceType, "GameState" }, { TrackerEvaluationKey.PieceId, "0" }, { TrackerEvaluationKey.PieceCompleted, "success" } }); ShowCharacter(_scenarioController.CurrentCharacter); CommandQueue.AddCommand(new RefreshPlayerDialogueCommand()); CommandQueue.AddCommand(new RefreshCharacterResponseCommand()); _panel.SetActive(true); _background.SetActive(true); _npcDialoguePanel.text = string.Empty; }
protected override void OnTick(float deltaTime) { if (_timeSinceStart <= _signInTriggerTime) { _timeSinceStart += deltaTime; if (_timeSinceStart > _signInTriggerTime) { // Check for SUGAR login SUGARManager.Unity.gameObject.GetComponent <AccountUnityClientAdditions> ().DisplayPanel(success => { if (success) { TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameUsage, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "GameStart" } }); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.UserProfile, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "SUGARSignIn" } }); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.AssetActivity, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.AssetId, "SUGAR" }, { TrackerEvaluationKey.Action, "SignIn" } }); } SUGARManager.Unity.StopSpinner(); LoggedInEvent?.Invoke(); }); } } }
/// <summary> /// Trigger showing SUGAR sign-in screen or run auto sign-in if setting is active /// </summary> public void SignIn() { _signInButton.Active(true); _userSignedInText.gameObject.SetActive(false); SUGARManager.Account.DisplayPanel(success => { if (success) { _signInButton.Active(false); OnLanguageChange(); DoBestFit(); var settings = new EvaluationAssetSettings { PlayerId = SUGARManager.CurrentUser.Name }; EvaluationAsset.Instance.Settings = settings; TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.UserProfile, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "sugarsignin" } }); } else { _signInButton.Active(true); } }); }
/// <summary> /// Enable the GameObject, set the text and enable/disable the image. /// </summary> internal void SetText(string achieveName, bool completed) { gameObject.Active(true); _achieveName.text = achieveName; _achieveImage.enabled = completed; TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.Gamification, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "displayachievementpopup" } }); }
/// <summary> /// Trigger DoBestFit method and add event listeners for when resolution and language changes. /// </summary> private void OnEnable() { DoBestFit(); BestFit.ResolutionChange += DoBestFit; Localization.LanguageChange += OnLanguageChange; TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.Gamification, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "displayachievementlist" } }); }
private void SendTrackerEvent(string key) { TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.AssetActivity, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.AssetId, "SUGAR" }, { TrackerEvaluationKey.Action, key } }); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.Gamification, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, key } }); }
protected override void OnEnter() { TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameFlow, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.PieceType, "ReviewState" }, { TrackerEvaluationKey.PieceId, "0" }, { TrackerEvaluationKey.PieceCompleted, "success" } }); _scenarioController.GetReviewDataSuccessEvent += BuildReviewData; CommandQueue.AddCommand(new GetReviewDataCommand()); _panel.SetActive(true); _background.SetActive(true); }
protected override void OnEnter() { TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameFlow, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.PieceType, "SettingsState" }, { TrackerEvaluationKey.PieceId, "0" }, { TrackerEvaluationKey.PieceCompleted, "success" } }); _panel.SetActive(true); _background.SetActive(true); _feedbackMode.SetActive(!_feedbackMode || SUGARManager.CurrentUser == null || !CommandLineUtility.CustomArgs.ContainsKey("feedback")); _creator.RebuildLayout(); }
protected override void OnEnter() { TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameFlow, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.PieceType, "LevelSelectState" }, { TrackerEvaluationKey.PieceId, "0" }, { TrackerEvaluationKey.PieceCompleted, "success" } }); _scenarioController.RefreshSuccessEvent += UpdateLevelList; _scenarioController.SetLevelSuccessEvent += LevelLoaded; ConfigureGridSize(3); _panel.SetActive(true); _background.SetActive(true); CommandQueue.AddCommand(new RefreshLevelDataCommand()); }
protected override void OnEnter() { _scenarioController.GetPlayerDialogueSuccessEvent += UpdatePlayerDialogue; _scenarioController.GetCharacterDialogueSuccessEvent += UpdateCharacterDialogue; _scenarioController.FinalStateEvent += HandleFinalState; TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameFlow, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.PieceType, "QuestionnaireState" }, { TrackerEvaluationKey.PieceId, "0" }, { TrackerEvaluationKey.PieceCompleted, "success" } }); _panel.SetActive(true); _background.SetActive(true); CommandQueue.AddCommand(new RefreshPlayerDialogueCommand()); CommandQueue.AddCommand(new RefreshCharacterResponseCommand()); _questionText.text = string.Empty; ShowCharacter(); }
/// <summary> /// Advance the tutorial one stage forward, finishing it if the last tutorial stage has been completed /// </summary> public void AdvanceStage() { var stage = GameManagement.TutorialStage; var saveIndex = GetLastSafeStage(stage); GameManagement.GameManager.SaveTutorialProgress(saveIndex, SectionCount <= stage + 1); _tutorialExitBlocker.Active(SectionCount == stage + 2); if (GameManagement.ShowTutorial) { _tutorialDisplay.Construct(_tutorialSections[GameManagement.TutorialStage]); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.Support, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "tutorialcontinued" } }); } else { SUGARManager.GameData.Send("Tutorial Finished", true); QuitTutorial(); } }
/// <summary> /// Triggered by button click. Load currently selected game. /// </summary> public void LoadGame() { if (_selectedName != null) { _errorText.text = string.Empty; //check if the game exists Loading.Start(); GameManagement.GameManager.LoadGameTask(GameManagement.GameSavePath, _selectedName, success => { if (success) { if (GameManagement.Team != null && string.Equals(GameManagement.TeamName, _selectedName, StringComparison.CurrentCultureIgnoreCase)) { var newString = GameManagement.PositionString; TrackerEventSender.SendEvent(new TraceEvent("GameStarted", TrackerAsset.Verb.Initialized, new Dictionary <TrackerContextKey, object> { { TrackerContextKey.GameName, GameManagement.TeamName }, { TrackerContextKey.BoatLayout, string.IsNullOrEmpty(newString) ? "NullAsGameFinished" : newString } }, CompletableTracker.Completable.Game)); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.UserProfile, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "loadedoldteam" } }); UIManagement.StateManager.GoToState(State.TeamManagement); } else { //display error and remove game from the list if the game could not be found _errorText.text = Localization.Get("LOAD_GAME_MISSING_FILES"); _selectedIcon.transform.SetParent(_gameContainer.transform, true); _selectedIcon.Active(false); Destroy(_gameContainer.transform.FindObject(_selectedName)); _selectedName = string.Empty; _loadButton.interactable = false; } } Loading.Stop(); }); } }
private static void SendTrackerEvents(string eventKey, string evaluationEventKey, string moduleType = "", string moduleId = "") { var eventValues = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(moduleType)) { eventValues.Add(TrackerContextKey.SelectedModuleType.ToString(), moduleType); } if (!string.IsNullOrEmpty(moduleId)) { eventValues.Add(TrackerContextKey.SelectedModule.ToString(), moduleId); } TrackerEventSender.SendEvent(new TraceEvent(eventKey, TrackerAsset.Verb.Accessed, eventValues, AccessibleTracker.Accessible.Screen)); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameActivity, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, evaluationEventKey }, { TrackerEvaluationKey.GoalOrientation, "Neutral" }, { TrackerEvaluationKey.Tool, "ModuleMenu" } }); }
public void SetPlayerAction(Guid actionId) { var reply = _currentPlayerDialogue.FirstOrDefault(a => a.Id.Equals(actionId)); if (reply != null && _chatScoreHistory.LastOrDefault(c => c.ChatObject.Agent == "Player")?.ChatObject.CurrentState != reply.CurrentState) { var actionFormat = $"Speak({reply.CurrentState},{reply.NextState},{reply.Meaning},{reply.Style})"; // Submit dialogue choice to the IAT event list. _events.Add(EventHelper.ActionStart(IATConsts.PLAYER, actionFormat, CurrentCharacter.CharacterName.ToString())); _events.Add(EventHelper.ActionEnd(IATConsts.PLAYER, actionFormat, CurrentCharacter.CharacterName.ToString())); _events.Add(EventHelper.PropertyChange(string.Format(IATConsts.DIALOGUE_STATE_PROPERTY, IATConsts.PLAYER), reply.NextState, "Player")); // UCM tracker tracks the filename ID of each player dialogue choice made TrackerEventSender.SendEvent(new TraceEvent("DialogueSelection", TrackerAsset.Verb.Initialized, new Dictionary <string, string> { { TrackerContextKey.PlayerDialogueState.ToString(), reply.CurrentState }, { TrackerContextKey.PlayerDialogueCode.ToString(), reply.FileName }, { TrackerContextKey.PlayerDialogueText.ToString(), reply.Utterance } })); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.AssetActivity, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.AssetId, "FAtiMA" }, { TrackerEvaluationKey.Action, "DialogueSelection" } }); TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameActivity, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.Event, "DialogueSelection" }, { TrackerEvaluationKey.GoalOrientation, "Progression" }, { TrackerEvaluationKey.Tool, "DialogueChoices" } }); _feedbackScores.Clear(); UpdateFeedbackScores(reply, "Player"); GetCharacterResponse(); GetFeedbackEvent?.Invoke(_feedbackScores, FeedbackLevel); } }
protected override void OnEnter() { TrackerEventSender.SendEvaluationEvent(TrackerEvalautionEvent.GameFlow, new Dictionary <TrackerEvaluationKey, string> { { TrackerEvaluationKey.PieceType, "MainMenuState" }, { TrackerEvaluationKey.PieceId, "0" }, { TrackerEvaluationKey.PieceCompleted, "success" } }); OnQuitAttempt(true); _menuPanel.BestFit(); _panel.SetActive(true); _background.SetActive(true); if (_startTimeGap == TimeSpan.MinValue && SUGARManager.CurrentUser != null && CommandLineUtility.CustomArgs.ContainsKey("wipeprogress")) { PlayerPrefs.DeleteKey("CurrentLevel" + _scenarioController.RoundNumber); PlayerPrefs.DeleteKey("GameUnlocked"); _gameUnlocked = false; _scenarioController.CurrentLevel = 0; } var isPilot = SUGARManager.CurrentUser != null && CommandLineUtility.CustomArgs != null && CommandLineUtility.CustomArgs.Count != 0; var gameLocked = !_gameUnlocked && isPilot && _scenarioController.LevelMax > 0 && _scenarioController.CurrentLevel >= _scenarioController.LevelMax; _gameUnlocked = PlayerPrefs.GetInt("GameUnlocked") == 1; var lockedTitleText = Localization.Get(LockedTitle, true); var lockedDescriptionText = Localization.Get(LockedDescription); // Game locking control for when in pilot if (isPilot) { if (_startTimeGap == TimeSpan.MinValue) { if (SUGARManager.CurrentUser != null && (CommandLineUtility.CustomArgs.ContainsKey("forcelaunch") || !CommandLineUtility.CustomArgs.ContainsKey("feedback"))) { _startTimeGap = DateTimeOffset.Now.Subtract(DateTimeOffset.Now.AddSeconds(-10)); } else { string dateTimeArg; DateTimeOffset launchTime; if (SUGARManager.CurrentUser == null || !CommandLineUtility.CustomArgs.TryGetValue("tstamp", out dateTimeArg) || !DateTimeOffset.TryParse(dateTimeArg, out launchTime)) { gameLocked = true; _startTimeGap = TimeSpan.MaxValue; } else { _startTimeGap = DateTimeOffset.Now.Subtract(launchTime); } } } if (_startTimeGap.TotalSeconds < 0 || _startTimeGap.TotalHours >= 1) { gameLocked = true; lockedTitleText = Localization.Get(ExpiredTitle, true); lockedDescriptionText = Localization.Get(ExpiredDescription); Debug.LogWarning("Game Locked: Time Expired"); } } // for iOS build, we cannot simply lock the game, see: Guideline 4.2.3 https://developer.apple.com/app-store/review/guidelines/#minimum-functionality _playButton.interactable = !gameLocked; _messagePanel.SetActive(isPilot); _messagePanel.transform.FindText("TitleText").text = gameLocked ? lockedTitleText : Localization.Get(PilotTitle); _messagePanel.transform.FindText("DescriptionText").text = gameLocked ? lockedDescriptionText : Localization.Get(PilotDescription); }