Exemple #1
0
 private void Awake()
 {
     readyBtn.onClick.RemoveAllListeners();
     readyBtn.onClick.AddListener(() =>
     {
         if (GamePlayManager.IsMultiPlayer)
         {
             if (!PhotonNetwork.isMasterClient)
             {
                 PhotonNetwork.RaiseEvent(100, null, true, new RaiseEventOptions()
                 {
                     Receivers = ReceiverGroup.MasterClient
                 });
             }
             else if (PhotonNetwork.isMasterClient)
             {
                 directController.playManager.RefreshRoomProperties(GamePlayManager.GameplayEvent.StartQuest);
             }
         }
         else
         {
             GamePlayManager.RaiseGameplayEvent("", GamePlayManager.GameplayEvent.StartQuest);
         }
         PF_GamePlay.OutroPane(this.gameObject, 0);
     }
                                  );
 }
Exemple #2
0
    public void ShowInfo(DisplayStates state)
    {
        activeState = state;

        if (state == DisplayStates.ActIntro)
        {
            UpdateFields_Act();
        }
        else if (state == DisplayStates.ActOutro)
        {
            UpdateFields_Act();
        }
        else if (state == DisplayStates.BossIntro)
        {
            // hack to make sure that we do not stomp on already existing info slides
            if (cg.alpha == 0)
            {
                UpdateFields_Boss();

                StartCoroutine(Spin());
                PF_GamePlay.IntroPane(gameObject, .75f);
            }
        }
        else if (state == DisplayStates.PlayerDied)
        {
            UpdateFields_Fail();
            PF_GamePlay.IntroPane(gameObject, .75f);
        }
    }
Exemple #3
0
    public IEnumerator Spin()
    {
        titleAnimator.PlayForward();
        descriptionAnimator.PlayForward();

        startTime = Time.time;
        while (startTime + waitTime > Time.time)
        {
            yield return(new WaitForEndOfFrame());
        }

        descriptionAnimator.PlayReverse();

        StartCoroutine(PF_GamePlay.Wait(.55f, () =>
        {
            titleAnimator.PlayReverse();
            PF_GamePlay.OutroPane(gameObject, .5f);

            if (activeState == DisplayStates.PlayerDied)
            {
                ContinueToGameOver();
            }
            else if (PF_GamePlay.UseRaidMode)
            {
                GameplayController.RaiseGameplayEvent(GlobalStrings.QUEST_COMPLETE_EVENT, PF_GamePlay.GameplayEventTypes.OutroQuest);
            }
            else
            {
                StartQuest();
            }
        }));
    }
Exemple #4
0
    public static void GetEncounterLists(List <string> encounters)
    {
        var request = new GetTitleDataRequest {
            Keys = encounters
        };
        var JsonUtil = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer);

        DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetTitleData_Specific);
        PlayFabClientAPI.GetTitleData(request, result =>
        {
            // Clear encounters for now (until we have reasons to merge dicts);
            PF_GamePlay.ClearQuestProgress();
            Encounters.Clear();

            foreach (var item in encounters)
            {
                if (result.Data.ContainsKey(item))
                {
                    Encounters.Add(item, JsonUtil.DeserializeObject <Dictionary <string, UB_EncounterData> >(result.Data[item]));
                }
            }

            PF_Bridge.RaiseCallbackSuccess("Encounters Loaded!", PlayFabAPIMethods.GetTitleData_Specific, MessageDisplayStyle.none);
        }, PF_Bridge.PlayFabErrorCallback);
    }
Exemple #5
0
 public void OnSkipClicked()
 {
     titleAnimator.PlayReverse();
     if (this.activeState == DisplayStates.BossIntro)
     {
         PF_GamePlay.OutroPane(this.gameObject, .5f, () =>
         {
         });
     }
     else if (this.activeState == DisplayStates.PlayerDied)
     {
         ContinueToGameOver();
     }
     else
     {
         if (PF_GamePlay.UseRaidMode)
         {
             GameplayController.RaiseGameplayEvent(GlobalStrings.QUEST_COMPLETE_EVENT, PF_GamePlay.GameplayEventTypes.OutroQuest);
         }
         else
         {
             StartQuest();
         }
         PF_GamePlay.OutroPane(this.gameObject, .5f);
     }
 }
 public void InitiatePurchase()
 {
     //NEED TO KNOW WHICH PURCHASE FLOW TO USE
     //Debug.Log ("Starting purchase of " + selectedItem.catalogItem.ItemId);
     PF_GamePlay.StartBuyStoreItem(this.selectedItem.catalogItem, this.StoreName.text);
     HideSelectedItem();
 }
Exemple #7
0
    public void ContinueToNextAct()
    {
        dirCanvasController.gameplayController.turnController.AdvanceAct();

        UnityAction afterActAdvances = () => { ShowInfo(DisplayStates.ActIntro); };

        PF_GamePlay.Wait(1.0f, afterActAdvances);
    }
Exemple #8
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);
    }
 public void FadeAdsIn(UnityAction callback = null)
 {
     PF_GamePlay.IntroPane(AdObject, .5f, () =>
     {
         if (callback != null)
         {
             callback();
         }
     });
 }
    public void UpdateQuestStats()
    {
        //TODO update mastery stars to reflect difficulty.
        if (PF_GamePlay.QuestProgress != null)
        {
            this.CreepEncountersText.text = string.Format("x{0}", PF_GamePlay.QuestProgress.CreepEncounters);
            this.GoldCollectedText.text   = string.Format("+{0:n0}", PF_GamePlay.QuestProgress.GoldCollected);
            this.ItemsCollectedText.text  = string.Format("+{0}", PF_GamePlay.QuestProgress.ItemsFound.Count);
            this.HeroEncountersText.text  = string.Format("x{0}", PF_GamePlay.QuestProgress.HeroRescues);
            this.LivesLostText.text       = string.Format("- {0}", PF_GamePlay.QuestProgress.Deaths);

            if (PF_GamePlay.QuestProgress.isQuestWon)
            {
                PF_GamePlay.IntroPane(this.WinGraphics.gameObject, .333f, null);
                PF_GamePlay.OutroPane(this.LoseGraphics.gameObject, .01f, null);
                this.colorTweener.from = Color.blue;
                this.colorTweener.to   = Color.magenta;
                this.BG.overrideSprite = this.winBG;
            }
            else
            {
                PF_GamePlay.IntroPane(this.LoseGraphics.gameObject, .333f, null);
                PF_GamePlay.OutroPane(this.WinGraphics.gameObject, .01f, null);
                this.colorTweener.from = Color.red;
                this.colorTweener.to   = Color.yellow;
                this.BG.overrideSprite = this.loseBG;
            }
        }

        if (PF_PlayerData.activeCharacter != null && PF_GamePlay.ActiveQuest.levelIcon != null)
        {
            //this.PlayerIcon.overrideSprite = GameController.Instance.iconManager.GetIconById(PF_PlayerData.activeCharacter.baseClass.Icon);
            this.QuestIcon.overrideSprite = PF_GamePlay.ActiveQuest.levelIcon;
            this.QuestName.text           = PF_GamePlay.ActiveQuest.levelName;

            int balance;
            this.LivesRemaining.text = string.Format("{0}", PF_PlayerData.characterVirtualCurrency.TryGetValue(GlobalStrings.HEART_CURRENCY, out balance) ? balance : -1);

            var nextLevelStr = string.Format("{0}", PF_PlayerData.activeCharacter.characterData.CharacterLevel + 1);
            if (PF_GameData.CharacterLevelRamp.ContainsKey(nextLevelStr) && PF_GamePlay.QuestProgress != null && PF_GamePlay.QuestProgress.isQuestWon)
            {
                this.XpBar.maxValue = PF_GameData.CharacterLevelRamp[nextLevelStr];
                StartCoroutine(this.XpBar.UpdateBarWithCallback(PF_PlayerData.activeCharacter.characterData.ExpThisLevel + PF_GamePlay.QuestProgress.XpCollected, false, this.EvaluateLevelUp));

                ViewItems.interactable = true;
                //	this.PlayerLevel.text = "" + PF_PlayerData.activeCharacter.characterData.CharacterLevel;

                //	this.PlayerName.text = PF_PlayerData.activeCharacter.characterDetails.CharacterName;
            }
            else
            {
                // do nothing
            }
        }
    }
Exemple #11
0
    void HandleStoreRequest(string storeID)
    {
        UnityAction <List <StoreItem> > afterGetStoreItems = (List <StoreItem> resultSet) =>
        {
            // ENABLE THIS AFTER WE HAVE A CONSISTENT WAY TO HIDE TINTS
            //ShowTint();
            this.floatingStorePrompt.InitiateStore(storeID, resultSet);
        };

        PF_GamePlay.RetriveStoreItems(storeID, afterGetStoreItems);
    }
Exemple #12
0
    // NEED TO MAKE THIS A COROUTINE
    public void CloseSettingsMenu()
    {
        TweenPos.Tween(this.menuOverlayPanel.gameObject, .5f, new Vector3(Screen.width / 2, Screen.height / 2, 0), new Vector3(0, 0, 0), TweenMain.Style.Once, TweenMain.Method.EaseIn, null, Space.World);
        TweenScale.Tween(this.menuOverlayPanel.gameObject, .5f, new Vector3(1, 1, 1), new Vector3(0, 0, 0), TweenMain.Style.Once, TweenMain.Method.EaseIn, null);

        StartCoroutine(PF_GamePlay.Wait(.75f, () =>
        {
            menuOverlayPanel.gameObject.SetActive(false);
            ToggleOpenCloseButtons();
        }));
    }
Exemple #13
0
 public void LevelUpCharacter()
 {
     if (selectedSlot != null)
     {
         QuestTracker quest = new QuestTracker {
             XpCollected = PF_GameData.CharacterLevelRamp[(selectedSlot.saved.characterData.CharacterLevel).ToString()]
         };
         EvaluateLevelUp(quest);
         PF_GamePlay.SavePlayerData(selectedSlot.saved, quest);
     }
 }
Exemple #14
0
    public void RedeemCoupon()
    {
        UnityAction <string> afterPrompt = (string response) =>
        {
            if (!string.IsNullOrEmpty(response))
            {
                PF_GamePlay.RedeemCoupon(response);
            }
        };

        DialogCanvasController.RequestTextInputPrompt("Redeem a Coupon Code", "Enter a valid code to redeem rewards.", (string response) => { afterPrompt(response); }, "XXX-XXXX-XXX");
    }
Exemple #15
0
    void EvaluateLevelUp()
    {
        if (XpBar.maxValue < PF_PlayerData.activeCharacter.characterData.ExpThisLevel + PF_GamePlay.QuestProgress.XpCollected)
        {
            // Level Up!!!
            PF_PlayerData.activeCharacter.PlayerVitals.didLevelUp = true;
            PF_GamePlay.IntroPane(LevelUp.gameObject, .333f, null);

            LevelUpPane.Init();
            StartCoroutine(PF_GamePlay.Wait(1.5f, () => { PF_GamePlay.IntroPane(LevelUpPane.gameObject, .333f, null); }));
        }
    }
Exemple #16
0
    void OnGameplayEventReceived(string message, PF_GamePlay.GameplayEventTypes type)
    {
        //Debug.Log(string.Format("{0} -- {1}",type.ToString(), message));

        if (type == PF_GamePlay.GameplayEventTypes.IntroAct)
        {
            ActIntroObject.ShowInfo(ActIntroController.DisplayStates.ActIntro);
            PF_GamePlay.OutroPane(QuestIntroObject.gameObject, .75f);
        }

//		if(type == PF_GamePlay.GameplayEventTypes.OutroAct)
//		{
//			//ActIntroObject.ShowInfo(ActIntroController.DisplayStates.ActOutro);
//			//PF_GamePlay.IntroPane(ActIntroObject.gameObject, .75f);
//		}

        if (type == PF_GamePlay.GameplayEventTypes.IntroQuest)
        {
            //QuestIntroObject.UpdateLevedetails();
            //PF_GamePlay.IntroPane(QuestIntroObject.gameObject, .75f);
        }

        if (type == PF_GamePlay.GameplayEventTypes.StartBossBattle)
        {
            ActIntroObject.ShowInfo(ActIntroController.DisplayStates.BossIntro);
            //PF_GamePlay.IntroPane(ActIntroObject.gameObject, .75f);
        }

        if (type == PF_GamePlay.GameplayEventTypes.PlayerDied)
        {
            ActIntroObject.ShowInfo(ActIntroController.DisplayStates.PlayerDied);
            PF_GamePlay.IntroPane(ActIntroObject.gameObject, .75f);

            this.QuestCompleteObject.UpdateQuestStats();
            PF_GamePlay.IntroPane(this.QuestCompleteObject.gameObject, .75f);
        }


        if (type == PF_GamePlay.GameplayEventTypes.OutroQuest)
        {
//			if(PF_GamePlay.UseRaidMode == false)
//			{
//				//ActIntroObject.ShowInfo(ActIntroController.DisplayStates.ActOutro);
//				PF_GamePlay.IntroPane(ActIntroObject.gameObject, .75f);
//			}

            this.QuestCompleteObject.UpdateQuestStats();
            PF_GamePlay.IntroPane(this.QuestCompleteObject.gameObject, .75f);
        }
    }
    public void RetrunToProfile()
    {
        //update to playfab
        if (PF_GamePlay.QuestProgress.isQuestWon)
        {
            PF_GamePlay.SavePlayerData(PF_PlayerData.SavedTeam[0], PF_GamePlay.QuestProgress);
        }
        if (!PF_GamePlay.QuestProgress.areItemsAwarded)
        {
            PF_GamePlay.RetriveQuestItems();
        }

        PhotonNetwork.Disconnect();
        GameController.Instance.sceneController.RequestSceneChange(SceneController.GameScenes.Profile, 1f);
    }
    public void CastSpell(UnityAction callback = null)
    {
        //fade in
        PF_GamePlay.IntroPane(this.gameObject, .25f, () =>
        {
            // fade out after wait period
            UnityAction fadeOut = () =>
            {
                PF_GamePlay.OutroPane(this.gameObject, .5f, callback);
            };

            // wait period
            StartCoroutine(PF_GamePlay.Wait(1.0f, fadeOut));
        });
    }
    public void UseItem()
    {
        Action <string> afterPickItem = (string item) =>
        {
            Debug.Log("Using " + item);

            InventoryCategory obj;
            PF_PlayerData.characterInvByCategory.TryGetValue(item, out obj);

            if (obj != null)
            {
                var first = obj.inventory.FirstOrDefault();
                if (first != null)
                {
                    var attributes = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, string> >(obj.catalogRef.CustomData);
                    if (attributes.ContainsKey("modifies") && attributes.ContainsKey("modifyPercent") && attributes.ContainsKey("target"))
                    {
                        if (string.Equals(attributes["target"], "self"))
                        {
                            // item effect applies to the player
                            string mod        = attributes["modifies"];
                            float  modPercent = float.Parse(attributes["modifyPercent"]);

                            switch (mod)
                            {
                            case "HP":
                                this.pendingValue = Mathf.CeilToInt((float)this.LifeBar.maxValue * modPercent);
                                Debug.Log(string.Format("Player Heals {0}", this.pendingValue));
                                PF_PlayerData.activeCharacter.PlayerVitals.Health += this.pendingValue;
                                RequestShake(defaultShakeTime, PF_GamePlay.ShakeEffects.IncreaseHealth);
                                break;
                            }

                            gameplayController.DecrementPlayerCDs();
                            PF_GamePlay.ConsumeItem(first.ItemInstanceId);
                            PF_GamePlay.QuestProgress.ItemsUsed++;
                        }
                    }
                }
            }
        };


        DialogCanvasController.RequestInventoryPrompt(afterPickItem, DialogCanvasController.InventoryFilters.UsableInCombat, false, FloatingInventoryController.InventoryMode.Character);
    }
    void OnGameplayEventReceived(string message, PF_GamePlay.GameplayEventTypes type)
    {
        if (type == PF_GamePlay.GameplayEventTypes.IntroQuest)
        {
            ActionBar.UpdateSpellBar();
            Init();
        }

        if (type == PF_GamePlay.GameplayEventTypes.IntroEncounter)
        {
            StartCoroutine(PF_GamePlay.Wait(.5f, () => { TransitionEncounterBarIn(); }));
        }

        if (type == PF_GamePlay.GameplayEventTypes.PlayerTurnBegins)
        {
            TransitionActionBarIn();
        }
    }
Exemple #21
0
    private void OnGameplayEventReceive(string message, GamePlayManager.GameplayEvent type)
    {
        if (type == GamePlayManager.GameplayEvent.IntroQuest)
        {
            //PF_GamePlay.IntroPane(actIntroObject.gameObject, 0);
            actIntroObject.ShowInfo();
        }

        if (type == GamePlayManager.GameplayEvent.OnAllPlayerReady)
        {
            actIntroObject.RefreshConfirmPanel();
        }

        if (type == GamePlayManager.GameplayEvent.OutroAct)
        {
            actOutroObject.UpdateQuestStats();
            PF_GamePlay.IntroPane(actOutroObject.gameObject, 0);
        }
    }
    IEnumerator Shake(float seconds, PF_GamePlay.ShakeEffects effect = PF_GamePlay.ShakeEffects.None)
    {
        yield return(new WaitForSeconds(seconds));

        this.shaker.ResetToBeginning();             //new Vector3 (0,this.transform.position.y, this.transform.position.z);
        this.isShaking      = false;
        this.shaker.enabled = false;

        if (effect == PF_GamePlay.ShakeEffects.DecreaseHealth)
        {
            int remainingHP = LifeBar.currentValue - this.pendingValue;
            yield return(StartCoroutine(LifeBar.UpdateBar(remainingHP)));

            if (remainingHP > 0)
            {
                StartCoroutine(PF_GamePlay.Wait(1.0f, () => { GameplayController.RaiseGameplayEvent(GlobalStrings.ENEMY_TURN_END_EVENT, PF_GamePlay.GameplayEventTypes.EnemyTurnEnds); }));
            }
            else
            {
                GameplayController.RaiseGameplayEvent(GlobalStrings.OUTRO_PLAYER_DEATH_EVENT, PF_GamePlay.GameplayEventTypes.OutroEncounter);
            }
        }
        else if (effect == PF_GamePlay.ShakeEffects.IncreaseHealth)
        {
            int remainingHP = LifeBar.currentValue + this.pendingValue;
            yield return(StartCoroutine(LifeBar.UpdateBar(remainingHP)));

            StartCoroutine(PF_GamePlay.Wait(.5f, () => { GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_TURN_END_EVENT, PF_GamePlay.GameplayEventTypes.PlayerTurnEnds); }));
        }
        else if (effect == PF_GamePlay.ShakeEffects.DecreaseMana)
        {
            StartCoroutine(ManaBar.UpdateBar(LifeBar.currentValue - this.pendingValue));
        }
        else if (effect == PF_GamePlay.ShakeEffects.IncreaseMana)
        {
            StartCoroutine(ManaBar.UpdateBar(LifeBar.currentValue + this.pendingValue));
        }

        this.pendingValue = 0;

        yield break;
    }
Exemple #23
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);
        }
    }
Exemple #24
0
    IEnumerator Shake(float seconds, PF_GamePlay.ShakeEffects effect = PF_GamePlay.ShakeEffects.None)
    {
        yield return(new WaitForSeconds(seconds));

        this.shaker.value   = new Vector3(this.shaker.from.x + (this.shaker.to.x - this.shaker.from.x) / 2, this.shaker.from.y, this.shaker.from.z);
        this.isShaking      = false;
        this.shaker.enabled = false;

        if (effect == PF_GamePlay.ShakeEffects.DecreaseHealth)
        {
            yield return(StartCoroutine(bar.UpdateBar(this.pendingValue)));

            if (this.pendingValue > 0)
            {
                StartCoroutine(PF_GamePlay.Wait(.5f, () => { GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_TURN_END_EVENT, PF_GamePlay.GameplayEventTypes.PlayerTurnEnds); }));
            }
            else
            {
                GameplayController.RaiseGameplayEvent(GlobalStrings.OUTRO_ENEMY_DIED_EVENT, PF_GamePlay.GameplayEventTypes.OutroEncounter);
            }
        }
        else if (effect == PF_GamePlay.ShakeEffects.IncreaseHealth)
        {
            StartCoroutine(bar.UpdateBar(this.pendingValue));
        }
        else if (effect == PF_GamePlay.ShakeEffects.DecreaseMana)
        {
            StartCoroutine(bar.UpdateBar(this.pendingValue));
        }
        else if (effect == PF_GamePlay.ShakeEffects.IncreaseMana)
        {
            StartCoroutine(bar.UpdateBar(this.pendingValue));
        }

        this.pendingValue = 0;



        yield break;
    }
    private void UseCombatItem(string item)
    {
        var JsonUtil = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer);

        Debug.Log("Using " + item);

        InventoryCategory obj;

        if (!PF_PlayerData.inventoryByCategory.TryGetValue(item, out obj) || obj.count == 0)
        {
            return;
        }

        var attributes = JsonUtil.DeserializeObject <Dictionary <string, string> >(obj.catalogRef.CustomData);

        if (!attributes.ContainsKey("modifies") ||
            !attributes.ContainsKey("modifyPercent") ||
            !attributes.ContainsKey("target") ||
            !string.Equals(attributes["target"], "self"))
        {
            return;
        }

        // item effect applies to the player
        var mod        = attributes["modifies"];
        var modPercent = float.Parse(attributes["modifyPercent"]);

        switch (mod)
        {
        case "HP":
            pendingValue = Mathf.CeilToInt(LifeBar.maxValue * modPercent);
            PF_PlayerData.activeCharacter.PlayerVitals.Health += pendingValue;
            RequestShake(defaultShakeTime, PF_GamePlay.ShakeEffects.IncreaseHealth);
            break;
        }

        gameplayController.DecrementPlayerCDs();
        PF_GamePlay.ConsumeItem(obj.inventory[0].ItemInstanceId);
        PF_GamePlay.QuestProgress.ItemsUsed++;
    }
Exemple #26
0
    public void TogglePushNotification()
    {
        if (!PF_PlayerData.isRegisteredForPush)
        {
            DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.Generic);
            UnityAction afterPush = () =>
            {
                changedLoginState = true;
                PF_PlayerData.isRegisteredForPush = true;
                SetCheckBox(registerPush.GetComponent <Image>(), true);
                Debug.Log("AccountStatusController: PUSH ENABLED!");
                PF_Bridge.RaiseCallbackSuccess(string.Empty, PlayFabAPIMethods.Generic, MessageDisplayStyle.none);
            };

            StartCoroutine(PF_GamePlay.Wait(1.5f, () =>
            {
                PF_PlayerData.RegisterForPushNotification(pushToken, afterPush);
            }));
        }
        else
        {
            Action <bool> processResponse = response =>
            {
                if (!response)
                {
                    return;
                }

                changedLoginState = true;
                PF_PlayerData.isRegisteredForPush = false;
                SetCheckBox(registerPush.GetComponent <Image>(), false);
                Debug.Log("AccountStatusController: PUSH DISABLED!");
            };

            DialogCanvasController.RequestConfirmationPrompt(GlobalStrings.PUSH_NOTIFY_PROMPT, GlobalStrings.PUSH_NOTIFY_MSG, processResponse);
        }
    }
Exemple #27
0
    public static void GetEncounterLists(List <string> encounters)
    {
        var request = new GetTitleDataRequest {
            Keys = encounters
        };

        DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetTitleData);
        PlayFabClientAPI.GetTitleData(request, (result) =>
        {
            //clear encounters for now (until we have reasons to merge dicts);
            PF_GamePlay.ClearQuestProgress();
            Encounters.Clear();

            foreach (var item in encounters)
            {
                if (result.Data.ContainsKey(item))
                {
                    Encounters.Add(item, PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_EncounterData> >(result.Data[item], PlayFab.Internal.PlayFabUtil.ApiSerializerStrategy));
                }
            }

            PF_Bridge.RaiseCallbackSuccess("Encounters Loaded!", PlayFabAPIMethods.GetTitleData, MessageDisplayStyle.none);
        }, PF_Bridge.PlayFabErrorCallback);
    }
 public void InitiatePurchase()
 {
     PF_GamePlay.StartBuyStoreItem(catalogItem, storeId, currencyKey, finalPrice);
 }
Exemple #29
0
 public void AcceptLevelupInput(int spellNumber)
 {
     PF_PlayerData.activeCharacter.PlayerVitals.skillSelected = spellNumber;
     PF_GamePlay.OutroPane(LevelUpPane.gameObject, .333f, null);
 }
 public void AcceptLevelupInput(int spellNumber)
 {
     Debug.Log("Level-UP: Spell Number: " + spellNumber);
     PF_PlayerData.activeCharacter.PlayerVitals.skillSelected = spellNumber;
     PF_GamePlay.OutroPane(this.LevelUpPane.gameObject, .333f, null);
 }