コード例 #1
0
 private bool AnyLootCrateCollectible(out int index)
 {
     index = -1;
     for (int i = 0; i < this.slotCount; i++)
     {
         string slotIdentifier = LootCrateSlot.GetSlotIdentifier(i);
         if (GameProgress.HasKey(slotIdentifier, GameProgress.Location.Local, null))
         {
             string[] array = GameProgress.GetString(slotIdentifier, string.Empty, GameProgress.Location.Local, null).Split(new char[]
             {
                 ','
             });
             if (array.Length > 0 && array[0] == "Unlocked")
             {
                 index = i;
                 return(true);
             }
             if (Singleton <TimeManager> .Instance.HasTimer(slotIdentifier) && Singleton <TimeManager> .Instance.TimeLeft(slotIdentifier) <= 0f)
             {
                 index = i;
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
    private LootCrateType GetLootCrateType(int index)
    {
        string slotIdentifier = LootCrateSlot.GetSlotIdentifier(index);

        string[] array = GameProgress.GetString(slotIdentifier, string.Empty, GameProgress.Location.Local, null).Split(new char[]
        {
            ','
        });
        return((LootCrateType)Enum.Parse(typeof(LootCrateType), array[1], true));
    }
コード例 #3
0
    private void SetTimer(int index)
    {
        string slotIdentifier = LootCrateSlot.GetSlotIdentifier(index);

        if (Singleton <TimeManager> .Instance.HasTimer(slotIdentifier))
        {
            float seconds = Singleton <TimeManager> .Instance.TimeLeft(slotIdentifier);

            base.StartCoroutine(CoroutineRunner.DelayActionSequence(new Action(this.Check), seconds, true));
        }
    }
コード例 #4
0
ファイル: LootCrateSlots.cs プロジェクト: mrdivdiz/bpvita
    public UnlockLootCrateSlotDialog ShowNoFreeSlotsDialog(LootCrateType crateType, TextDialog.OnConfirm onConfirm)
    {
        if (WPFMonoBehaviour.gameData.m_noFreeCrateSlotsPopup == null)
        {
            return(null);
        }
        UnlockLootCrateSlotDialog component = UnityEngine.Object.Instantiate <GameObject>(WPFMonoBehaviour.gameData.m_noFreeCrateSlotsPopup).GetComponent <UnlockLootCrateSlotDialog>();

        component.Open();
        component.SetOnConfirm(onConfirm);
        int openTimeForCrate = LootCrateSlots.GetOpenTimeForCrate(crateType);

        component.InitPopup(LootCrateSlot.GetSnoutCoinPrice(crateType, (float)openTimeForCrate), openTimeForCrate, LootCrateSlots.GetCratePrefab(crateType), crateType);
        return(component);
    }
コード例 #5
0
    private void UpdateLabels()
    {
        string formattedTimeFromSeconds = LootCrateSlot.GetFormattedTimeFromSeconds((int)this.TimeLeftInSeconds());

        this.nextLabelUpdateTime = Time.realtimeSinceStartup + 1f;
        TextMeshHelper.UpdateTextMeshes(this.timeLabel, formattedTimeFromSeconds, false);
        TextMeshHelper.UpdateTextMeshes(this.priceLabel, string.Format("{0} [snout]", LootCrateSlot.GetSnoutCoinPrice(this.crateType, this.TimeLeftInSeconds())), false);
        TextMeshSpriteIcons[] componentsInChildren = this.priceTf.GetComponentsInChildren <TextMeshSpriteIcons>();
        if (componentsInChildren != null)
        {
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                componentsInChildren[i].UpdateIcons();
            }
        }
    }
コード例 #6
0
    private bool FindNextUnlock(out int index)
    {
        index = -1;
        float num = float.MaxValue;

        for (int i = 0; i < this.slotCount; i++)
        {
            string slotIdentifier = LootCrateSlot.GetSlotIdentifier(i);
            if (Singleton <TimeManager> .Instance.HasTimer(slotIdentifier) && Singleton <TimeManager> .Instance.TimeLeft(slotIdentifier) < num)
            {
                index = i;
                num   = Singleton <TimeManager> .Instance.TimeLeft(slotIdentifier);
            }
        }
        return(index >= 0);
    }
コード例 #7
0
 public void Initialize(bool isNew, int index, LootCrateType crateType)
 {
     this.FindComponents();
     this.index      = index;
     this.crateType  = crateType;
     this.identifier = LootCrateSlot.GetSlotIdentifier(index);
     this.hasTimer   = false;
     if (isNew)
     {
         LootCrateSlots.AddLootCrateToSlot(index, crateType);
         this.ChangeState(LootCrateSlot.State.Inactive);
     }
     else
     {
         this.TryRecover();
     }
 }
コード例 #8
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;
        }
    }
コード例 #9
0
    private void ShowPurchasePopup(UnlockLootCrateSlotDialog.UnlockType unlockType)
    {
        this.unlockPrice = 0;
        int snoutPrice = LootCrateSlot.GetSnoutCoinPrice(this.crateType, this.TimeLeftInSeconds());

        this.lootCrateSlots.ShowUnlockDialog(this.crateType, snoutPrice, (int)this.TimeLeftInSeconds(), delegate
        {
            if (unlockType == UnlockLootCrateSlotDialog.UnlockType.StartUnlocking)
            {
                this.ActivateLootCrateSlot();
            }
            else if (GameProgress.UseSnoutCoins(snoutPrice))
            {
                this.unlockPrice = snoutPrice;
                Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(WPFMonoBehaviour.gameData.commonAudioCollection.snoutCoinUse);
                SnoutButton.Instance.UpdateAmount(false);
                this.OnCrateUnlocked(0);
                this.OpenCrate();
            }
        }, unlockType);
    }
コード例 #10
0
    public void InitPopup(int price, int secondsLeft, GameObject cratePrefab, LootCrateType lootCrate)
    {
        this.currentCrateType = lootCrate;
        this.SnoutCoinPrice   = price;
        if (this.priceLabel)
        {
            TextMesh[] componentsInChildren = this.priceLabel.gameObject.GetComponentsInChildren <TextMesh>();
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                componentsInChildren[i].text = string.Format("[snout] {0}", this.SnoutCoinPrice);
                TextMeshSpriteIcons.EnsureSpriteIcon(componentsInChildren[i]);
            }
        }
        string formattedTimeFromSeconds = LootCrateSlot.GetFormattedTimeFromSeconds(secondsLeft);

        if (this.timerLabel)
        {
            TextMesh[] componentsInChildren2 = this.timerLabel.gameObject.GetComponentsInChildren <TextMesh>();
            TextMeshHelper.UpdateTextMeshes(componentsInChildren2, formattedTimeFromSeconds, false);
        }
        if (this.unlockNowControls != null)
        {
            Transform transform = this.unlockNowControls.transform.Find("StartUnlockButton/TimeLabel");
            if (transform != null)
            {
                TextMesh[] componentsInChildren3 = transform.gameObject.GetComponentsInChildren <TextMesh>();
                TextMeshHelper.UpdateTextMeshes(componentsInChildren3, formattedTimeFromSeconds, false);
            }
        }
        if (this.skeletonAnimation)
        {
            this.skeletonAnimation.initialSkinName = lootCrate.ToString();
            this.skeletonAnimation.Initialize(true);
            this.skeletonAnimation.state.AddAnimation(0, "Idle", true, 0f);
        }
        this.InitRewardItems(lootCrate);
    }
コード例 #11
0
ファイル: LootCrateSlots.cs プロジェクト: mrdivdiz/bpvita
    public static int TryToActivateLootCrateAtSlot(int index, LootCrateType crateType, OnTimedOut onCrateUnlocked)
    {
        if (LootCrateSlots.IsUnlockingInProgress())
        {
            return(-1);
        }
        string slotIdentifier = LootCrateSlot.GetSlotIdentifier(index);

        GameProgress.SetString(slotIdentifier, string.Format("{0},{1}", LootCrateSlot.State.Locked.ToString(), crateType.ToString()), GameProgress.Location.Local);
        if (!Singleton <TimeManager> .Instance.HasTimer(slotIdentifier))
        {
            DateTime time = Singleton <TimeManager> .Instance.CurrentTime.AddSeconds((double)LootCrateSlots.GetOpenTimeForCrate(crateType));

            Singleton <TimeManager> .Instance.CreateTimer(slotIdentifier, time, onCrateUnlocked);

            GameProgress.SetString("LootCrateSlotOpening", slotIdentifier, GameProgress.Location.Local);
            if (LootCrateSlots.instance != null)
            {
                LootCrateSlots.instance.ShowFullBubble(LootCrateSlots.AreSlotsFull());
            }
            return(0);
        }
        return(1);
    }
コード例 #12
0
ファイル: LootCrateSlots.cs プロジェクト: mrdivdiz/bpvita
    private static bool IsSlotOccupied(int index)
    {
        string slotIdentifier = LootCrateSlot.GetSlotIdentifier(index);

        return(GameProgress.HasKey(slotIdentifier, GameProgress.Location.Local, null));
    }
コード例 #13
0
ファイル: LootCrateSlots.cs プロジェクト: mrdivdiz/bpvita
    public static void AddLootCrateToSlot(int index, LootCrateType crateType)
    {
        string slotIdentifier = LootCrateSlot.GetSlotIdentifier(index);

        GameProgress.SetString(slotIdentifier, string.Format("{0},{1},{2}", LootCrateSlot.State.Inactive.ToString(), crateType.ToString(), "new"), GameProgress.Location.Local);
    }