Beispiel #1
0
    //Reward Portals will Initialize this function on Trigger Enter if the type Signature of the collided object has this IReceivesReward interface
    //Function used to communicate with Reward Portals
    //Also gets Rewards from IPlayerCanKill type objects through this function

    public void ReceiveReward(RewardTypes Rewardtype, float RewardValue)
    {
        switch (Rewardtype)
        {
        case RewardTypes.SizeUp:
            if (SizeFactor < MaxSizeFactor)
            {
                SizeFactor = (1 + RewardValue) * SizeFactor;
                if (SizeFactor >= MaxSizeFactor)
                {
                    SizeFactor = MaxSizeFactor;
                }
                try
                {
                    ScoreBoard.Board.UpdateScoreboard("SizeFactor", SizeFactor);
                }
                catch (System.Exception e)
                {
                    Debug.Log(e);
                }
                Animate(RewardValue);
            }
            break;

        case RewardTypes.PowerUp:
            if (PowerFactor < MaxPowerFactor)
            {
                Score      += Score * RewardValue;
                PowerFactor = (1 + RewardValue) * PowerFactor;
                if (PowerFactor >= MaxPowerFactor)
                {
                    PowerFactor = MaxPowerFactor;
                }
                try
                {
                    ScoreBoard.Board.UpdateScoreboard("Score", Score);
                    ScoreBoard.Board.UpdateScoreboard("PowerFactor", PowerFactor);
                }
                catch (System.Exception e)
                {
                    Debug.Log(e);
                }
            }
            break;

        case RewardTypes.EnemyKill:
            Score += RewardValue * PowerFactor;
            try
            {
                ScoreBoard.Board.UpdateScoreboard("Score", Score);
            }
            catch (System.Exception e)
            {
                Debug.Log(e);
            }
            Debug.Log("SCORE!!");
            //Scoreboard Code Modification
            break;
        }
    }
 //Settting Up the Reward Portal
 public virtual void SetupReward(RewardTypes _rewardType, bool _randomizeReward, float _baseReward, Text _displayReward)
 {
     Type            = _rewardType;
     displayReward   = _displayReward;
     randomizeReward = _randomizeReward;
     BaseReward      = _baseReward;
 }
        /// <summary>
        /// TODO: public or private?
        /// Gets the reward colors by identifier.
        /// </summary>
        /// <param name="_rewardItemId">The reward item identifier.</param>
        /// <returns></returns>
        static List <RewardColorItem> GetRewardColorsById(string _rewardItemId, RewardTypes _rewardType)
        {
            List <RewardColorItem> returnList = new List <RewardColorItem>();

            // TODO: logic
            return(returnList);
        }
Beispiel #4
0
 public override string ToString()
 {
     string abilities = "";
     foreach (var a in Abilities)
     {
         abilities = abilities + a.ToString() + "\r\n";
     }
     return String.Format(
         "Name {7} (iLevel {6}) Level {3} (ID {10})\r\n" +
         "{0}\r\n" +
         "Cost: {1} Duration: {2}  Type {4} State {5} Location {8}\r\n" +
         "Rare {9} Followers {11} \r\n" +
         "Rewards {12} [{27}] GarrisonReward {21} XpReward {22} Apexis {23} Gold {24} ItemId {25} {26}\r\n" +
         "XP {13} Material {14} SuccessChance {15} XpBonus {16} Success {17}\r\n" +
         "{18} {19}\r\n" +
         "Abilities\r\n{20}",
         Description, Cost, Duration, Level, Type, State, ItemLevel, Name, Location, Rare, Id,
         Followers, Rewards, Xp, Material, SuccessChance, XpBonus, Success,
         !MarkedAsCompleted ? "" : "Marked as Completed",
         !BonusRolled ? "" : "Rolled Bonus",
         abilities,
         GarrisonReward, XpReward, ApexisReward, GoldReward,
         ItemIdReward, ItemIdReward2 > 0 ? ItemIdReward2.ToString() : "",
         RewardTypes.ToString());
 }
Beispiel #5
0
 public MissionSettings(RewardTypes type, int success, int priority, int minlevel)
 {
     // RewardType = type;
     SuccessRate  = success;
     Priority     = priority;
     MinimumLevel = minlevel;
 }
 /// <summary>
 /// Selects the reward color item.
 /// </summary>
 /// <param name="_rewardColorItemId">The reward color item identifier.</param>
 /// <param name="_rewardType">Type of the reward.</param>
 public static void SelectRewardColorItem(string _rewardColorItemId, RewardTypes _rewardType)
 {
     CurrentReward.ColorId = _rewardColorItemId;
     if (OnRewardChanged != null)
     {
         OnRewardChanged(CurrentReward);
     }
 }
Beispiel #7
0
 public IBaseRewardMethod GenRewardMethod(RewardTypes rewardType)
 {
     switch (rewardType)
     {
     case RewardTypes.Coins:
     {
         return(new CoinsRewardMethod());
     }
     }
     return(null);
 }
Beispiel #8
0
 protected RewardInfo(RewardTypes rewardType, int goodsId,
                      long count, string name, string description,
                      string imageUrl, AddReason reason)
 {
     RewardType  = rewardType;
     GoodsId     = goodsId;
     Count       = count;
     Name        = name;
     Description = description;
     ImageUrl    = imageUrl;
     Reason      = reason;
 }
        /// <summary>
        /// Gets the next reward pack. Contains all logic to create new reward.
        /// </summary>
        /// <param name="_rewardType">Type of the reward.</param>
        /// <returns></returns>
        public static RewardPack GetRewardPack(string _playsession, RewardTypes _rewardType, bool _random)
        {
            /// TODOs:
            /// - Filter without already unlocked items
            /// - Automatic select reward type by situation
            RewardPack rp = new RewardPack();

            switch (_rewardType)
            {
            case RewardTypes.reward:
                rp = new RewardPack()
                {
                    // If not random take id from list of already unlocked rewards of this type
                    ItemID = _random ? config.Rewards.GetRandom().ID : AppManager.I.Player.RewardsUnlocked.FindAll(r => r.Type == RewardTypes.reward).GetRandom <RewardPack>().ItemID,
                    // Todo: check if color is not already unlocked!
                    ColorId       = config.RewardsColorPairs.GetRandom().ID,
                    Type          = _rewardType,
                    PlaySessionId = _playsession,
                    IsNew         = true,
                };
                break;

            case RewardTypes.texture:
                rp = new RewardPack()
                {
                    ItemID        = config.RewardsTile.GetRandom().ID,
                    ColorId       = config.RewardsTileColor.GetRandom().ID,
                    Type          = _rewardType,
                    PlaySessionId = _playsession,
                    IsNew         = true,
                };
                break;

            case RewardTypes.decal:
                rp = new RewardPack()
                {
                    ItemID        = config.RewardsDecal.GetRandom().ID,
                    ColorId       = config.RewardsDecalColor.GetRandom().ID,
                    Type          = _rewardType,
                    PlaySessionId = _playsession,
                    IsNew         = true,
                };
                break;

            default:
                break;
            }
            return(rp);
        }
Beispiel #10
0
    public RandomEventScript(string name, string description, string buttonOne, string buttonTwo, string buttonThree, int happiness, int cost, int food, string duderCanAvoid, string immuneDuder, bool hasStore, RewardTypes reward, int rewardQty, int rewardButtonIndex)
    {
        eventName        = name;
        eventDescription = description;
        happinessChange  = happiness;
        eventCost        = cost;
        duderFixer       = duderCanAvoid;
        duderImmune      = immuneDuder;
        eventHasStore    = hasStore;
        rewardType       = reward;
        rewardQuantity   = rewardQty;
        foodCost         = food;

        buttonOneText   = buttonOne;
        buttonTwoText   = buttonTwo;
        buttonThreeText = buttonThree;
        rewardIndex     = rewardButtonIndex;
    }
    //Reward Portals will Initialize the function on Collision Enter if the type Signature has IReceivesReward
    public void ReceiveReward(RewardTypes Rewardtype, float RewardValue)
    {
        switch (Rewardtype)
        {
        case RewardTypes.SizeUp:
            if (SizeFactor < MaxSizeFactor)
            {
                SizeFactor = (1 + RewardValue) * SizeFactor;
                Animate(RewardValue);
            }
            break;

        case RewardTypes.PowerUp:
            if (PowerFactor < MaxPowerFactor)
            {
                PowerFactor = (1 + RewardValue) * PowerFactor;
            }
            break;
        }
        rewards = new float[] { Score, PowerFactor, SizeFactor };
        ScoreBoard.scoreBoard.UpdateText("", rewards);
    }
        /// <summary>
        /// Gets the first antura reward.
        /// </summary>
        /// <param name="_rewardType">Type of the reward.</param>
        /// <returns></returns>
        public static RewardPack GetFirstAnturaReward(RewardTypes _rewardType)
        {
            RewardPack rp = new RewardPack();

            switch (_rewardType)
            {
            case RewardTypes.reward:
                rp = GetRewardPack("0.0.0", _rewardType, true);
                break;

            case RewardTypes.texture:
                rp = new RewardPack()
                {
                    ItemID        = "Antura_wool_tilemat",
                    ColorId       = "color1",
                    Type          = _rewardType,
                    PlaySessionId = "0.0.0",
                    IsNew         = true,
                };
                break;

            case RewardTypes.decal:
                rp = new RewardPack()
                {
                    ItemID        = "Antura_decalmap01",
                    ColorId       = "color1",
                    Type          = _rewardType,
                    PlaySessionId = "0.0.0",
                    IsNew         = true,
                };
                break;

            default:
                break;
            }
            return(rp);
        }
        /// <summary>
        /// Gets the reward items by rewardType (always 9 items, if not presente item in the return list is null).
        /// </summary>
        /// <param name="_rewardType">Type of the reward.</param>
        /// <param name="_parentsTransForModels">The parents trans for models.</param>
        /// <param name="_categoryRewardId">The category reward identifier.</param>
        /// <returns></returns>
        public static List <RewardItem> GetRewardItemsByRewardType(RewardTypes _rewardType, List <Transform> _parentsTransForModels, string _categoryRewardId = "")
        {
            List <RewardItem> returnList = new List <RewardItem>();

            /// TODO: logic
            /// - Load returnList by type and category checking unlocked and if exist active one
            switch (_rewardType)
            {
            case RewardTypes.reward:
                // Filter from unlocked elements (only items with this category and only one for itemID)
                foreach (var item in config.Rewards.FindAll(r => r.Category == _categoryRewardId))
                {
                    if (AppManager.I.Player.RewardsUnlocked.FindAll(ur => ur.GetRewardCategory() == _categoryRewardId).Exists(ur => ur.ItemID == item.ID))
                    {
                        returnList.Add(new RewardItem()
                        {
                            ID = item.ID, IsNew = false, IsSelected = AppManager.I.Player.CurrentAnturaCustomizations.Fornitures.Exists(f => f.ItemID == item.ID)
                        });
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                /// - Charge models
                for (int i = 0; i < returnList.Count; i++)
                {
                    if (returnList[i] != null)
                    {
                        ModelsManager.MountModel(returnList[i].ID, _parentsTransForModels[i]);
                    }
                }
                break;

            case RewardTypes.texture:
                // Filter from unlocked elements (only one for itemID)
                foreach (var item in config.RewardsTile)
                {
                    if (AppManager.I.Player.RewardsUnlocked.FindAll(ur => ur.Type == RewardTypes.texture).Exists(ur => ur.ItemID == item.ID))
                    {
                        returnList.Add(new RewardItem()
                        {
                            ID = item.ID, IsNew = false, IsSelected = AppManager.I.Player.CurrentAnturaCustomizations.TileTexture.ItemID == item.ID
                        });
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                /// - Charge texture
                for (int i = 0; i < returnList.Count; i++)
                {
                    if (returnList[i] != null)
                    {
                        string    texturePath  = "AnturaStuff/Textures_and_Materials/";
                        Texture2D inputTexture = Resources.Load <Texture2D>(texturePath + returnList[i].ID);
                        _parentsTransForModels[i].GetComponent <RawImage>().texture = inputTexture;
                    }
                }
                break;

            case RewardTypes.decal:
                // Filter from unlocked elements (only one for itemID)
                foreach (var item in config.RewardsDecal)
                {
                    if (AppManager.I.Player.RewardsUnlocked.FindAll(ur => ur.Type == RewardTypes.decal).Exists(ur => ur.ItemID == item.ID))
                    {
                        returnList.Add(new RewardItem()
                        {
                            ID = item.ID, IsNew = false, IsSelected = AppManager.I.Player.CurrentAnturaCustomizations.DecalTexture.ItemID == item.ID
                        });
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                /// - Charge texture
                for (int i = 0; i < returnList.Count; i++)
                {
                    if (returnList[i] != null)
                    {
                        string    texturePath  = "AnturaStuff/Textures_and_Materials/";
                        Texture2D inputTexture = Resources.Load <Texture2D>(texturePath + returnList[i].ID);
                        _parentsTransForModels[i].GetComponent <RawImage>().texture = inputTexture;
                    }
                }
                break;

            default:
                Debug.LogWarningFormat("Reward typology requested {0} not found", _rewardType);
                break;
            }

            //// add empty results
            //int emptyItemsCount = _parentsTransForModels.Count - returnList.Count;
            //for (int i = 0; i < emptyItemsCount; i++) {
            //    returnList.Add(null);
            //}
            return(returnList);
        }
        /// <summary>
        /// Selects the reward item.
        /// </summary>
        /// <param name="_rewardItemId">The reward item identifier.</param>
        /// <returns></returns>
        public static List <RewardColorItem> SelectRewardItem(string _rewardItemId, RewardTypes _rewardType)
        {
            List <RewardColorItem> returnList = new List <RewardColorItem>();

            /// logic
            /// - Trigger selected reward event.
            /// - Load returnList of color for reward checking unlocked and if exist active one


            switch (_rewardType)
            {
            case RewardTypes.reward:
                foreach (RewardColor color in config.RewardsColorPairs)
                {
                    if (AppManager.I.Player.RewardsUnlocked.Exists(ur => ur.ItemID == _rewardItemId && ur.ColorId == color.ID))
                    {
                        RewardColorItem rci = new RewardColorItem(color);
                        returnList.Add(rci);
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                // set current reward in modification
                CurrentReward = new RewardPack()
                {
                    ItemID = _rewardItemId, Type = RewardTypes.reward
                };
                break;

            case RewardTypes.texture:
                foreach (RewardColor color in config.RewardsTileColor)
                {
                    if (AppManager.I.Player.RewardsUnlocked.Exists(ur => ur.ItemID == _rewardItemId && ur.ColorId == color.ID))
                    {
                        RewardColorItem rci = new RewardColorItem(color);
                        rci.Color2RGB = rci.Color1RGB;     // to avoid exadecimal conversion error on ui rgb code conversion.
                        returnList.Add(rci);
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                // set current reward in modification
                CurrentReward = new RewardPack()
                {
                    ItemID = _rewardItemId, Type = RewardTypes.texture
                };
                break;

            case RewardTypes.decal:
                foreach (RewardColor color in config.RewardsDecalColor)
                {
                    if (AppManager.I.Player.RewardsUnlocked.Exists(ur => ur.ItemID == _rewardItemId && ur.ColorId == color.ID))
                    {
                        RewardColorItem rci = new RewardColorItem(color);
                        rci.Color2RGB = rci.Color1RGB;     // to avoid exadecimal conversion error on ui rgb code conversion.
                        returnList.Add(rci);
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                //foreach (RewardColor color in config.RewardsDecalColor) {
                //    RewardColorItem rci = new RewardColorItem(color);
                //    rci.Color2RGB = rci.Color1RGB; // to avoid exadecimal conversion error on ui rgb code conversion.
                //    returnList.Add(rci);
                //}
                // set current reward in modification
                CurrentReward = new RewardPack()
                {
                    ItemID = _rewardItemId, Type = RewardTypes.decal
                };
                break;

            default:
                Debug.LogWarningFormat("Reward typology requested {0} not found", _rewardType);
                break;
            }
            // check if there is a selected item, if no one select the first.
            if (returnList.Count > 0 && !returnList.Exists(c => c != null && c.IsSelected == true))
            {
                foreach (var firstItem in returnList)
                {
                    if (firstItem != null)
                    {
                        firstItem.IsSelected = true;
                        return(returnList);
                    }
                }
            }
            return(returnList);
        }
        IEnumerator CO_SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            BTRemoveMods.gameObject.SetActive(false);

            // Get rewards list
            currCategory   = _category;
            currRewardType = CategoryToRewardType(_category);
            bool useImages = _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture || _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal;

            foreach (AnturaSpaceItemButton item in btsItems)
            {
                item.SetImage(!useImages);
            }
            if (_category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Ears)
            {
                currRewardDatas = RewardSystemManager.GetRewardItemsByRewardType(currRewardType, rewardsContainers, "EAR_L");
                List <Transform> altRewardContainers = new List <Transform>(rewardsContainers);
                altRewardContainers.RemoveRange(0, currRewardDatas.Count);
                currRewardDatas.AddRange(RewardSystemManager.GetRewardItemsByRewardType(currRewardType, altRewardContainers, "EAR_R"));
            }
            else
            {
                currRewardDatas = RewardSystemManager.GetRewardItemsByRewardType(currRewardType, useImages ? rewardsImagesContainers : rewardsContainers, _category.ToString());
            }
            yield return(null);

            // Hide non-existent items
            for (int i = currRewardDatas.Count - 1; i < btsItems.Length; ++i)
            {
                btsItems[i].gameObject.SetActive(false);
            }
            // Setup and show items
            RewardItem selectedRewardData = null;

            for (int i = 0; i < currRewardDatas.Count; ++i)
            {
                RewardItem            rewardData = currRewardDatas[i];
                AnturaSpaceItemButton item       = btsItems[i];
                item.gameObject.SetActive(true);
                item.Data = rewardData;
                if (rewardData != null)
                {
                    if (!useImages)
                    {
                        item.RewardContainer.gameObject.SetLayerRecursive(GenericUtilities.LayerMaskToIndex(RewardsLayer));
                        CameraHelper.FitRewardToUICamera(item.RewardContainer.GetChild(0), item.RewardCamera, FlipRewards);
                    }
                    item.SetAsNew(rewardData.IsNew);
                    item.Toggle(rewardData.IsSelected);
                    if (rewardData.IsSelected)
                    {
                        selectedRewardData = rewardData;
                    }
                }
                else
                {
                    item.Toggle(false);
                }
                item.Lock(rewardData == null);
            }

            ItemsContainer.gameObject.SetActive(true);
            showItemsTween.PlayForward();

            // Select eventual reward
            if (selectedRewardData != null)
            {
                SelectReward(selectedRewardData);
            }
            else
            {
                showSwatchesTween.Rewind();
            }
        }
 public RewardInformation(RewardTypes type, int amount)
 {
 }