コード例 #1
0
 public void OpenCrate()
 {
     if (Singleton <TimeManager> .Instance.HasTimer(this.identifier))
     {
         Singleton <TimeManager> .Instance.RemoveTimer(this.identifier);
     }
     GameProgress.DeleteKey(this.identifier, GameProgress.Location.Local);
     LootCrate.SpawnLootCrateOpeningDialog(this.crateType, 1, WPFMonoBehaviour.s_hudCamera, null, new LootCrate.AnalyticData("Slot", this.unlockPrice.ToString(), LootCrate.AdWatched.NotApplicaple));
     this.ChangeState(LootCrateSlot.State.Empty);
     LootCrateSlots.InformCrateOpened(this.identifier, this.crateType);
 }
コード例 #2
0
 protected override void Start()
 {
     base.Start();
     base.OnDataLoaded();
     this.originalCratePosition = base.transform.position;
     if (this.dialog == null)
     {
         this.dialog = LootCrate.SpawnLootCrateOpeningDialog();
     }
     base.rigidbody.useGravity  = false;
     base.rigidbody.isKinematic = true;
 }
コード例 #3
0
    public void GiveReward()
    {
        int @int = GameProgress.GetInt(this.crateID + this.crateType.ToString(), 0, GameProgress.Location.Local, null);

        if (@int <= 0)
        {
            GameProgress.SetInt(this.crateID + this.crateType.ToString(), @int + 1, GameProgress.Location.Local);
            WorkshopMenu.AnyLootCrateCollected = true;
            if (FreeLootCrate.OnFreeLootCrateCollected != null)
            {
                FreeLootCrate.OnFreeLootCrateCollected();
            }
            Camera hudCamera = Singleton <GuiManager> .Instance.FindCamera();

            LootCrate.SpawnLootCrateOpeningDialog(this.crateType, 1, hudCamera, null, new LootCrate.AnalyticData(this.crateID, "free", LootCrate.AdWatched.NotApplicaple));
            this.TryReportAchievements();
        }
        base.gameObject.SetActive(false);
    }
コード例 #4
0
ファイル: LootCrateSlots.cs プロジェクト: mrdivdiz/bpvita
    private void Awake()
    {
        LootCrateSlots.instance = this;
        List <LootCrateSlot> list = new List <LootCrateSlot>();

        for (int i = 0; i < this.slotCount; i++)
        {
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.lootCrateSlotPrefab);
            if (gameObject != null)
            {
                gameObject.name             = string.Format("Slot{0}", i + 1);
                gameObject.transform.parent = base.transform;
                LootCrateSlot component = gameObject.GetComponent <LootCrateSlot>();
                component.Initialize(false, i, LootCrateType.None);
                list.Add(component);
            }
        }
        this.slots = list.ToArray();
        LootCrateSlots.SlotsAvailable = this.slots.Length;
        GridLayout component2 = base.GetComponent <GridLayout>();

        component2.UpdateLayout();
        if (this.slotsFullBubble != null)
        {
            this.slotsFullBubble.transform.position = this.slots[this.slotCount - 1].transform.position;
        }
        this.ShowFullBubble(LootCrateSlots.AreSlotsFull());
        if (LootCrateSlots.overflowCrateType != LootCrateType.None)
        {
            LootCrateType crateType = LootCrateSlots.overflowCrateType;
            this.unlockCrateSlotDialog = this.ShowNoFreeSlotsDialog(crateType, delegate
            {
                if (this.unlockCrateSlotDialog != null && GameProgress.UseSnoutCoins(this.unlockCrateSlotDialog.SnoutCoinPrice))
                {
                    Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(WPFMonoBehaviour.gameData.commonAudioCollection.snoutCoinUse);
                    LootCrate.SpawnLootCrateOpeningDialog(crateType, 1, WPFMonoBehaviour.hudCamera, null, new LootCrate.AnalyticData("CakeRaceOverflowUnlock", this.unlockCrateSlotDialog.SnoutCoinPrice.ToString(), LootCrate.AdWatched.NotApplicaple));
                    this.SendLootCrateUnlockedFlurryEvent(crateType, this.unlockCrateSlotDialog.SnoutCoinPrice, "overflow");
                }
            });
            LootCrateSlots.overflowCrateType = LootCrateType.None;
        }
    }
コード例 #5
0
ファイル: FreeCrateAdReward.cs プロジェクト: mrdivdiz/bpvita
 private void OnAdFinished()
 {
     LootCrate.SpawnLootCrateOpeningDialog(this.reward, 1, WPFMonoBehaviour.hudCamera, null, new LootCrate.AnalyticData("Advertisement", "0", LootCrate.AdWatched.Yes));
     this.adReward.Load();
 }
コード例 #6
0
    private void OnRankFetched(GetLeaderboardAroundPlayerResult result)
    {
        if (!CakeRaceMenu.IsCakeRaceMenuOpen)
        {
            return;
        }
        if (this.lootCrateSlots.IsPopUpOpen())
        {
            base.StartCoroutine(this.WaitPopUpAndTryRankReward(result));
            return;
        }
        if (result.Leaderboard == null || (result.Leaderboard.Count > 0 && (result.Leaderboard[0].StatValue <= 0 || result.Leaderboard[0].Position >= 500)))
        {
            this.TryToShowCupEndAnimation(false);
            this.TryToUnlockCakeRaceLockScreen();
            return;
        }
        GameObject go = UnityEngine.Object.Instantiate <GameObject>(this.seasonEndDialogPopup, Vector3.zero, Quaternion.identity);

        go.transform.position += Vector3.back * 20f;
        this.seasonEndDialog   = go.GetComponent <LeaderboardSeasonEndDialog>();
        this.seasonEndDialog.SetLoading(true);
        this.seasonEndDialog.onClose += delegate()
        {
            UnityEngine.Object.Destroy(go);
        };
        int currentCupIndex = (int)this.rewardPendingCup;
        int rank            = result.Leaderboard[0].Position + 1;
        int @int            = GameProgress.GetInt("cake_race_highest_rank", 0, GameProgress.Location.Local, null);

        if (@int <= 0 || rank < @int)
        {
            GameProgress.SetInt("cake_race_highest_rank", rank, GameProgress.Location.Local);
        }
        string text = string.Empty;

        if (rank != 1)
        {
            if (rank != 2)
            {
                if (rank == 3)
                {
                    text = "cake_race_bronze_trophies_won";
                }
            }
            else
            {
                text = "cake_race_silver_trophies_won";
            }
        }
        else
        {
            text = "cake_race_gold_trophies_won";
        }
        if (!string.IsNullOrEmpty(text))
        {
            int int2 = GameProgress.GetInt(text, 0, GameProgress.Location.Local, null);
            GameProgress.SetInt(text, int2 + 1, GameProgress.Location.Local);
        }
        int seasonSnoutCoinReward = CakeRaceMenu.GetSeasonSnoutCoinReward(currentCupIndex, rank);

        if (seasonSnoutCoinReward > 0)
        {
            GameProgress.AddSnoutCoins(seasonSnoutCoinReward);
            int int3 = GameProgress.GetInt("cake_race_coins_won", 0, GameProgress.Location.Local, null);
            GameProgress.SetInt("cake_race_coins_won", int3 + seasonSnoutCoinReward, GameProgress.Location.Local);
        }
        LootCrateType crateType = CakeRaceMenu.GetSeasonCrateReward(currentCupIndex, rank);

        if (crateType != LootCrateType.None)
        {
            this.seasonEndDialog.onClose += delegate()
            {
                LootCrate.SpawnLootCrateOpeningDialog(crateType, 1, WPFMonoBehaviour.s_hudCamera, new Dialog.OnClose(this.OnDialogClosed), new LootCrate.AnalyticData(string.Format("{0}_reward", (PlayFabLeaderboard.Leaderboard)currentCupIndex), "0", LootCrate.AdWatched.NotApplicaple));
            };
        }
        else
        {
            this.seasonEndDialog.onClose += this.OnDialogClosed;
        }
        this.seasonEndDialog.SetCrateRankAndReward(crateType, rank, seasonSnoutCoinReward);
        this.isRewardingPlayer = false;
    }