Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Sort the crew members in the container by the current value in the dropdown. Triggered by a change of value on the dropdown.
    /// </summary>
    public void SortCrew(bool playerTriggered = false)
    {
        var sortedCrewMembers = CrewMembers.Where(c => c.transform.parent == _crewContainer.transform).ToList();
        var sortType          = string.Empty;

        switch (_crewSort.value)
        {
        case 0:
            sortedCrewMembers = sortedCrewMembers.OrderBy(c => c.name).ToList();
            sortType          = "Name";
            CrewMembers.ForEach(c => c.SetSortValue(string.Empty));
            break;

        case 1:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedSkills[Skill.Charisma]).ToList();
            sortType          = "Charisma";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RevealedSkills[Skill.Charisma] == 0 ? "?" : c.CrewMember.RevealedSkills[Skill.Charisma].ToString()));
            break;

        case 2:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedSkills[Skill.Perception]).ToList();
            sortType          = "Perception";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RevealedSkills[Skill.Perception] == 0 ? "?" : c.CrewMember.RevealedSkills[Skill.Perception].ToString()));
            break;

        case 3:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedSkills[Skill.Quickness]).ToList();
            sortType          = "Quickness";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RevealedSkills[Skill.Quickness] == 0 ? "?" : c.CrewMember.RevealedSkills[Skill.Quickness].ToString()));
            break;

        case 4:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedSkills[Skill.Body]).ToList();
            sortType          = "Strength";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RevealedSkills[Skill.Body] == 0 ? "?" : c.CrewMember.RevealedSkills[Skill.Body].ToString()));
            break;

        case 5:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedSkills[Skill.Willpower]).ToList();
            sortType          = "Willpower";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RevealedSkills[Skill.Willpower] == 0 ? "?" : c.CrewMember.RevealedSkills[Skill.Willpower].ToString()));
            break;

        case 6:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedSkills[Skill.Wisdom]).ToList();
            sortType          = "Wisdom";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RevealedSkills[Skill.Wisdom] == 0 ? "?" : c.CrewMember.RevealedSkills[Skill.Wisdom].ToString()));
            break;

        case 7:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.GetMood()).ToList();
            sortType          = "Mood";
            CrewMembers.ForEach(c => c.SetSortValue(string.Empty));
            break;

        case 8:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedCrewOpinions.Values.Sum() / (float)c.CrewMember.RevealedCrewOpinions.Count).ToList();
            sortType          = "Average Opinion";
            CrewMembers.ForEach(c => c.SetSortValue(string.Empty));
            break;

        case 9:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RevealedCrewOpinions[GameManagement.ManagerName]).ToList();
            sortType          = "Manager Opinion";
            CrewMembers.ForEach(c => c.SetSortValue(string.Empty));
            break;

        case 10:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.SessionsIncluded()).ToList();
            sortType          = "Races";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.SessionsIncluded().ToString()));
            break;

        case 11:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.RacesWon()).ToList();
            sortType          = "Wins";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.RacesWon().ToString()));
            break;

        case 12:
            sortedCrewMembers = sortedCrewMembers.OrderBy(c => c.CrewMember.Age).ToList();
            sortType          = "Age";
            CrewMembers.ForEach(c => c.SetSortValue(c.CrewMember.Age.ToString()));
            break;

        case 13:
            sortedCrewMembers = sortedCrewMembers.OrderByDescending(c => c.CrewMember.Avatar.Height * (c.CrewMember.Avatar.IsMale ? 1 : 0.935f)).ToList();
            sortType          = "Height";
            CrewMembers.ForEach(c => c.SetSortValue(string.Empty));
            break;
        }
        var sortedCrew = sortedCrewMembers.Select(c => c.transform).ToList();

        sortedCrew.AddRange(_recruitButtons.Select(recruit => recruit.transform));
        sortedCrew.ForEach(c => c.SetAsLastSibling());
        if (playerTriggered)
        {
            TrackerEventSender.SendEvent(new TraceEvent("CrewSortChanged", TrackerAsset.Verb.Selected, new Dictionary <TrackerContextKey, object>(), sortType, AlternativeTracker.Alternative.Dialog));
        }
    }
    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);
    }