Пример #1
0
 public RewardPack(RewardBaseType baseType, RewardBase rewardBase, RewardColor rewardColor)
 {
     this.BaseType    = baseType;
     this.RewardBase  = rewardBase;
     this.RewardColor = rewardColor;
     this.unlockData  = null; // Null = locked
 }
Пример #2
0
        /// <summary>
        /// Gets all the color items for a given base
        /// </summary>
        public List <RewardColorItem> GetRewardColorItemsForBase(RewardBase _Base)
        {
            List <RewardColorItem> returnList = new List <RewardColorItem>();

            // Load all colors for the given reward base
            var packsOfBase = GetRewardPacks().Where(x => x.RewardBase == _Base);

            foreach (var pack in packsOfBase)
            {
                bool isToBeShown = pack.IsUnlocked;
                if (isToBeShown)
                {
                    RewardColorItem rci = new RewardColorItem
                    {
                        data  = pack.RewardColor,
                        IsNew = pack.IsNew
                    };

                    returnList.Add(rci);
                    //Debug.Log("Found color: " + pack.RewardColor.Color1RGB + " and " + pack.RewardColor.Color2RGB);
                }
                else
                {
                    returnList.Add(null);
                }
            }

            // Selection state
            RewardPack alreadyEquippedPack = AppManager.I.Player.CurrentAnturaCustomizations.GetEquippedPack(_Base.ID);

            if (alreadyEquippedPack != null)
            {
                // If we already equipped a pack of that base, we use the previous color
                returnList.Find(item => item != null && item.data == alreadyEquippedPack.RewardColor).IsSelected = true;
            }
            else
            {
                // Else, we select the first available color
                foreach (var firstItem in returnList)
                {
                    if (firstItem != null)
                    {
                        firstItem.IsSelected = true;
                        return(returnList);
                    }
                }
            }

            return(returnList);
        }
Пример #3
0
        /// <summary>
        /// Selects the actual reward to show on Antura
        /// </summary>
        public void SelectRewardColorItem(RewardBase _rewardBase, RewardColor _rewardColor)
        {
            var currentSelectedReward = GetRewardPackByPartsIds(_rewardBase.ID, _rewardColor.ID);

            if (OnRewardSelectionChanged != null)
            {
                OnRewardSelectionChanged(currentSelectedReward);
            }

            // Makes sure to set everything pack with that color as seen
            foreach (var pack in GetUnlockedRewardPacksForBase(_rewardBase))
            {
                pack.SetNew(false);
            }
            SaveRewardsUnlockDataChanges();
        }
Пример #4
0
 public bool IsRewardBaseUnlocked(RewardBase rewardBase)
 {
     return(GetUnlockedRewardPacks().Any(x => x.RewardBase == rewardBase));
 }
Пример #5
0
 private bool IsRewardBaseNew(RewardBase rewardBase)
 {
     return(GetUnlockedRewardPacks().Any(r => r.BaseId == rewardBase.ID && r.IsNew));
 }
Пример #6
0
 private bool IsRewardColorNew(RewardBase rewardBase, RewardColor rewardColor)
 {
     return(GetUnlockedRewardPacks().Any(r => r.BaseId == rewardBase.ID && r.ColorId == rewardColor.ID && r.IsNew));
 }
Пример #7
0
 private IEnumerable <RewardPack> GetLockedRewardPacksForBase(RewardBase _Base)
 {
     return(GetLockedRewardPacks().Where(x => x.RewardBase == _Base));
 }