コード例 #1
0
    public void OnReturnToHubClick()
    {
        if (PF_GamePlay.QuestProgress.isQuestWon)
        {
            Dictionary <string, object> eventData = new Dictionary <string, object>()
            {
                { "Current_Quest", PF_GamePlay.ActiveQuest.levelName },
                { "Character_ID", PF_PlayerData.activeCharacter.characterDetails.CharacterId }
            };
            PF_Bridge.LogCustomEvent(PF_Bridge.CustomEventTypes.Client_LevelComplete, eventData);
        }

        if (PF_PlayerData.activeCharacter.PlayerVitals.didLevelUp)
        {
            Dictionary <string, object> eventData = new Dictionary <string, object>()
            {
                { "New_Level", PF_PlayerData.activeCharacter.characterData.CharacterLevel + 1 },
                { "Character_ID", PF_PlayerData.activeCharacter.characterDetails.CharacterId },
                { "Current_Quest", PF_GamePlay.ActiveQuest.levelName }
            };
            PF_Bridge.LogCustomEvent(PF_Bridge.CustomEventTypes.Client_LevelUp, eventData);
        }

        // Only save if the game has been won
        // may want to add in some stats for missions failed / deaths
        if (PF_GamePlay.QuestProgress.isQuestWon)
        {
            PF_GamePlay.SavePlayerData();
            SaveStatistics();

            if (PF_GamePlay.QuestProgress.areItemsAwarded == false)
            {
                PF_GamePlay.RetriveQuestItems();
            }
        }

        var loadingDelay = .5f;

        if (PF_GamePlay.UseRaidMode)
        {
            var eventData = new Dictionary <string, object>
            {
                { "Killed_By", "Raid Mode" },
                { "Enemy_Health", "Raid Mode" },
                { "Current_Quest", PF_GamePlay.ActiveQuest.levelName },
                { "Character_ID", PF_PlayerData.activeCharacter.characterDetails.CharacterId }
            };

            for (var z = 0; z < PF_GamePlay.QuestProgress.Deaths; z++)
            {
                PF_PlayerData.SubtractLifeFromPlayer();
                PF_Bridge.LogCustomEvent(PF_Bridge.CustomEventTypes.Client_PlayerDied, eventData);
            }
        }

        GameController.Instance.sceneController.RequestSceneChange(SceneController.GameScenes.Profile, loadingDelay);
    }
コード例 #2
0
    public void OnTryAgainClick()
    {
        //Debug.Log("Try Again not implemented");
        int hearts;

        PF_PlayerData.virtualCurrency.TryGetValue(GlobalStrings.HEART_CURRENCY, out hearts);
        if (hearts > 0)
        {
            // decrement HT currency
            hearts -= 1;
            PF_PlayerData.virtualCurrency[GlobalStrings.HEART_CURRENCY] = hearts;
            PF_PlayerData.SubtractLifeFromPlayer();
            // will need to trigger Cloud Script to tick this on the server side

            PF_PlayerData.activeCharacter.RefillVitals();

            PF_GamePlay.OutroPane(gameObject, .333f, null);
            GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_RESPAWN_EVENT, PF_GamePlay.GameplayEventTypes.EnemyTurnEnds);
        }
    }