Beispiel #1
0
    public void Spin()
    {
        if (!this.initialized || this.spinner.IsSpinning)
        {
            return;
        }
        WheelSlot target = this.GetRewardSlot(0);

        if (target != null && GameProgress.UseSnoutCoins(this.currentPrice))
        {
            if (this.currentPrice > 0)
            {
                Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(WPFMonoBehaviour.gameData.commonAudioCollection.snoutCoinUse);
            }
            SnoutButton.Instance.UpdateAmount(false);
            this.popup.SpinButtonEnabled = false;
            this.popup.DoneButtonEnabled = false;
            this.spinner.Spin(target, this.initialSpinTime, this.spinVelocity, this.decelerationRate, this.tickSoundRate, delegate
            {
                this.OnSpinEnd(target);
            });
            this.SendFlurryLootWheelSpinEvent(target, this.currentPrice);
        }
        else
        {
            Singleton <IapManager> .Instance.OpenShopPage(delegate
            {
                this.popup.gameObject.SetActive(true);
            }, "SnoutCoinShop");

            this.popup.gameObject.SetActive(false);
        }
    }
    /// <summary>
    /// 添加 Slot
    /// </summary>
    /// <param name="slot">WheelSlot 结构体</param>
    public void AddSlot(WheelSlot slot)
    {
        if (slots == null)
        {
            slots = new List <WheelSlot>();
        }

        slots.Add(slot);
    }
Beispiel #3
0
    private void GiveReward(WheelSlot slot)
    {
        LootWheelRewards.LootWheelReward reward;
        if (!slot.GetReward(out reward))
        {
            return;
        }
        switch (reward.Type)
        {
        case LootWheelRewards.RewardType.Dessert:
            this.RewardDesserts(reward.Amount);
            break;

        case LootWheelRewards.RewardType.Scrap:
            this.RewardScrap(reward.Amount);
            ScrapButton.Instance.UpdateAmount(false);
            break;

        case LootWheelRewards.RewardType.Powerup:
            this.RewardPowerup(reward.PowerupReward);
            break;

        case LootWheelRewards.RewardType.Part:
            this.RewardPart(reward.PartReward);
            break;
        }
        if (slot.SlotType == LootWheel.WheelSlotType.Part)
        {
            this.SetStarsEnabled((BasePart.PartTier)slot.RewardIndex, true, delegate
            {
                this.shakeAnimation.state.AddAnimation(0, this.shakeAnimationName, false, 0f);
                CoroutineRunner.Instance.DelayAction(delegate
                {
                    this.ShowRewardRoutine(slot, reward.Amount, reward.Type, delegate
                    {
                        this.SetCheckMark((BasePart.PartTier)slot.RewardIndex, true);
                    });
                }, 0.3f, false);
            });
        }
        else
        {
            this.ShowRewardRoutine(slot, reward.Amount, reward.Type, delegate
            {
                slot.SetCollectIndicator(true);
            });
        }
    }
Beispiel #4
0
    private void ShowRewardRoutine(WheelSlot slot, int rewardAmount, LootWheelRewards.RewardType reward, Action OnEnd)
    {
        bool       showHorns;
        GameObject copy;

        LootWheelRewardingRoutine.BackgroundType bgType;
        if (slot.SlotType == LootWheel.WheelSlotType.Part)
        {
            if (slot.RewardIndex == 1)
            {
                copy   = this.commonPart.transform.parent.gameObject;
                bgType = LootWheelRewardingRoutine.BackgroundType.Common;
            }
            else if (slot.RewardIndex == 2)
            {
                copy   = this.rarePart.transform.parent.gameObject;
                bgType = LootWheelRewardingRoutine.BackgroundType.Rare;
            }
            else
            {
                copy   = this.epicPart.transform.parent.gameObject;
                bgType = LootWheelRewardingRoutine.BackgroundType.Epic;
            }
            showHorns = true;
            bgType    = ((reward != LootWheelRewards.RewardType.Part) ? LootWheelRewardingRoutine.BackgroundType.Regular : bgType);
            Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(WPFMonoBehaviour.gameData.commonAudioCollection.lootWheelJackPot);
        }
        else
        {
            copy      = slot.CollectableIcon;
            bgType    = LootWheelRewardingRoutine.BackgroundType.Regular;
            showHorns = false;
        }
        CoroutineRunner.Instance.DelayAction(delegate
        {
            this.rewardRoutine.ShowRewarding(showHorns, rewardAmount, UnityEngine.Object.Instantiate <GameObject>(copy), bgType, OnEnd);
            this.popup.DoneButtonEnabled = true;
            if ((!Singleton <BuildCustomizationLoader> .Instance.IsOdyssey && this.currentSpin < this.TotalRewards) || (Singleton <BuildCustomizationLoader> .Instance.IsOdyssey && this.currentSpin < this.odysseySpinCount))
            {
                this.popup.SpinButtonEnabled = true;
                this.currentPrice            = this.CalculateSpinPrice(this.currentSpin);
                this.SetPriceToButton(this.currentPrice);
                this.SetSpinText(this.currentSpin);
            }
        }, 0.5f, false);
    }
Beispiel #5
0
    /// <summary>
    /// 获取灯具 Wheels 信息
    /// </summary>
    private static void GetWheelsData(GDTF_Data data)
    {
        if (wheelsNode == null)
        {
            Debug.Log("Not Found Wheels Node!");
            return;
        }

        // 如果节点下存在子节点
        if (wheelsNode.HasChildNodes)
        {
            foreach (XmlNode wheelNode in wheelsNode.ChildNodes)
            {
                if (wheelNode.Name != "Wheel")
                {
                    continue;
                }

                if (wheelNode.HasChildNodes)
                {
                    // 创建 GDTF_WheelsData 对象,并设置该组 Wheel 名称
                    GDTF_WheelsData wheelsData = new GDTF_WheelsData()
                    {
                        wheelName = GetNodeAttribute(wheelNode, "Name")
                    };

                    foreach (XmlNode slotNode in wheelNode.ChildNodes)
                    {
                        WheelSlot slotData = new WheelSlot();
                        slotData.name          = GetNodeAttribute(slotNode, "Name");
                        slotData.color         = XmlColorToColor(GetNodeAttribute(slotNode, "Color"));
                        slotData.mediaFileName = GetNodeAttribute(slotNode, "MediaFileName");

                        // 将该条 slot 信息添加
                        wheelsData.slots.Add(slotData);
                    }

                    data.wheels.Add(wheelsData);
                }
            }
        }
    }
Beispiel #6
0
 private void SendFlurryLootWheelSpinEvent(WheelSlot slot, int snoutCost)
 {
 }
Beispiel #7
0
 private void OnSpinEnd(WheelSlot reward)
 {
     this.currentSpin++;
     this.GiveReward(reward);
 }