Ejemplo n.º 1
0
        public void PushCollectibleDetails(Collectible collectible, Action onClose = null)
        {
            var content = collectible.Content;

            var mediaContent = content as MediaContent;

            var data = new InventoryCollectible(collectible, 1);

            if (mediaContent != null && mediaContent.MediaItem != null)
            {
                switch (mediaContent.MediaItem.MediaType)
                {
                case Motive.Core.Media.MediaType.Video:
                    PanelManager.Instance.Push(VideoPanel, data, onClose);
                    return;

                case Motive.Core.Media.MediaType.Audio:
                    PanelManager.Instance.Push(AudioPanel, data, onClose);
                    return;

                case Motive.Core.Media.MediaType.Image:
                    PanelManager.Instance.Push(ImagePanel, data, onClose);
                    return;
                }
            }

            // Otherwise
            PanelManager.Instance.Push(ImagePanel, data, onClose);
        }
Ejemplo n.º 2
0
        public virtual void Populate(InventoryCollectible invCollectible)
        {
            if (PopulatedObject)
            {
                PopulatedObject.SetActive(true);
            }

            this.InventoryCollectible = invCollectible;
            var collectible = invCollectible.Collectible;
            var count       = invCollectible.Count;

            ObjectHelper.SetObjectActive(NumberLayout, !collectible.IsSingleton);

            if (NumberText)
            {
                if (count > 0 || !HideCountIfZero)
                {
                    NumberText.text = count.ToString();
                }
                else
                {
                    NumberText.gameObject.SetActive(false);
                }
            }

            if (UseColorIfZero && Image && count == 0)
            {
                Image.color = NoItemColor;
            }

            base.Populate(collectible);
        }
Ejemplo n.º 3
0
        public override void Populate(ValuablesCollection data)
        {
            if (CollectiblesTable)
            {
                CollectiblesTable.Clear();
            }

            if (CurrenciesTable)
            {
                CurrenciesTable.Clear();
            }

            bool hasCollectibles = false;
            bool hasCurrencies   = false;

            if (data != null)
            {
                if (data.CollectibleCounts != null && CollectiblesTable)
                {
                    hasCollectibles = true;

                    int count = 0;

                    foreach (var cc in data.CollectibleCounts)
                    {
                        var collectible = cc.Collectible;

                        if (collectible != null)
                        {
                            var item = CollectiblesTable.AddItem(CollectibleItemPrefab);

                            var ic = new InventoryCollectible(collectible, cc.Count);

                            item.Populate(ic);

                            if (++count > MaximumItems)
                            {
                                break;
                            }
                        }
                    }
                }

                if (data.CurrencyCounts != null && CurrenciesTable)
                {
                    hasCurrencies = true;

                    foreach (var cc in data.CurrencyCounts)
                    {
                        var item = CurrenciesTable.AddItem(CurrencyItemPrefab);

                        item.SetText("+ " + cc.Count.ToString() + " " + cc.Currency);
                    }
                }
            }

            ObjectHelper.SetObjectActive(Collectibles, hasCollectibles);
            ObjectHelper.SetObjectActive(Currencies, hasCurrencies);

            base.Populate(data);
        }
Ejemplo n.º 4
0
        //void Instance_RewardAdded(object sender, RewardEventArgs e)
        //{
        //    PanelManager.Instance.Push(this, e.Valuables);
        //}

        public override void Populate(PlayerTaskDriver data)
        {
            if (RewardCollectiblesTable)
            {
                RewardCollectiblesTable.Clear();
            }

            if (GiveCollectiblesTable)
            {
                GiveCollectiblesTable.Clear();
            }

            var rewardItems = new List<CollectibleCount>();
            var hasReward = false;

            var giveItems = new List<CollectibleCount>();
            var hasGive = false;

            if (data != null)
            {
                if (Data.IsGiveTask
                    && Data.Task.ActionItems != null
                    && Data.Task.ActionItems.CollectibleCounts != null
                    && Data.Task.ActionItems.CollectibleCounts.Count() > 0)
                {
                    giveItems.AddRange(Data.Task.ActionItems.CollectibleCounts);
                }

                if (Data.IsTakeTask
                    && Data.Task.ActionItems != null
                    && Data.Task.ActionItems.CollectibleCounts != null
                    && Data.Task.ActionItems.CollectibleCounts.Count() > 0)
                {
                    rewardItems.AddRange(Data.Task.ActionItems.CollectibleCounts);
                }

                if (Data.Task.Reward != null
                    && Data.Task.Reward.CollectibleCounts != null
                    && Data.Task.Reward.CollectibleCounts.Count() > 0)
                {
                    rewardItems.AddRange(Data.Task.Reward.CollectibleCounts);
                }


                //// populate tables
                // give items
                if (giveItems.Count() > 0 && GiveCollectiblesTable && GiveCollectibles)
                {
                    hasGive = true;
                    int displayCount = 0;
                    foreach (var cc in giveItems)
                    {
                        var collectible = cc.Collectible;
                        if (collectible != null)
                        {
                            var item = GiveCollectiblesTable.AddItem(CollectibleItemPrefab);

                            var ic = new InventoryCollectible(collectible, cc.Count);

                            item.Populate(ic);

                            if (++displayCount > MaximumItems) break;
                        }
                    }
                }
                // reward items
                if (rewardItems.Count() > 0 && RewardCollectiblesTable && RewardCollectibles)
                {
                    hasReward = true;
                    int displayCount = 0;
                    foreach (var cc in rewardItems)
                    {
                        var collectible = cc.Collectible;
                        if (collectible != null)
                        {
                            var item = RewardCollectiblesTable.AddItem(CollectibleItemPrefab);

                            var ic = new InventoryCollectible(collectible, cc.Count);

                            item.Populate(ic);

                            if (++displayCount > MaximumItems) break;
                        }
                    }
                }

            }

            ObjectHelper.SetObjectActive(RewardCollectibles, hasReward);
            ObjectHelper.SetObjectActive(GiveCollectibles, hasGive);

            base.Populate(data);
        }