Пример #1
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);
    }
Пример #2
0
    private GameObject InstantiateRewardImage(Transform root, LootWheelRewards.LootWheelReward reward)
    {
        GameObject gameObject = root.parent.Find("Label").gameObject;

        LootWheelRewards.RewardType type = reward.Type;
        GameObject gameObject2;

        if (type != LootWheelRewards.RewardType.Part)
        {
            if (type != LootWheelRewards.RewardType.Scrap)
            {
                return(null);
            }
            gameObject.SetActive(true);
            gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.scrapIconPrefab);
            GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(this.genericTextPrefab);
            gameObject3.transform.parent        = gameObject.transform;
            gameObject3.transform.localPosition = Vector3.zero;
            gameObject3.transform.position     += new Vector3(0f, -0.05f, -0.1f);
            gameObject3.transform.localScale    = new Vector3(0.08f, 0.08f, 1f);
            TextMesh[] componentsInChildren = gameObject3.GetComponentsInChildren <TextMesh>();
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                componentsInChildren[i].alignment = TextAlignment.Center;
                componentsInChildren[i].anchor    = TextAnchor.MiddleCenter;
                componentsInChildren[i].text      = reward.Amount.ToString();
            }
            this.SetLayer(gameObject3, base.gameObject.layer);
            this.SetSortingLayer(gameObject3, "Popup");
            this.SetOrderInLayer(gameObject3, 0);
        }
        else
        {
            gameObject2 = UnityEngine.Object.Instantiate <GameObject>(reward.PartReward.m_constructionIconSprite.gameObject);
            gameObject.SetActive(false);
        }
        gameObject2.transform.parent        = root;
        gameObject2.transform.localPosition = Vector3.zero;
        this.SetSortingLayer(gameObject2, "Popup");
        this.SetLayer(gameObject2, base.gameObject.layer);
        this.SetOrderInLayer(gameObject2, 0);
        return(gameObject2);
    }