예제 #1
0
    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);
    }
예제 #2
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);
    }
예제 #3
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();
            }
        }
    }