예제 #1
0
 /// <summary>
 /// Add the enhancer to the pool.
 /// </summary>
 /// <param name="enhancerData">EnhancerData to be added to the pool</param>
 /// <param name="enhancerPoolID">Name of the Enhancer pool to add to</param>
 public static void AddEnhancerToPool(EnhancerData enhancerData, string enhancerPoolID)
 {
     if (!CustomEnhancerPoolData.ContainsKey(enhancerPoolID))
     {
         CustomEnhancerPoolData[enhancerPoolID] = new List <EnhancerData>();
     }
     if (!CustomEnhancerPoolData[enhancerPoolID].Contains(enhancerData))
     {
         CustomEnhancerPoolData[enhancerPoolID].Add(enhancerData);
     }
 }
        /// <summary>
        /// Builds the EnhancerData represented by this builder's parameters.
        /// </summary>
        /// <returns>The newly created EnhancerData</returns>
        public EnhancerData Build()
        {
            EnhancerData enhancerData = new EnhancerData();
            var          t            = Traverse.Create(enhancerData);

            // Set the name for the unity object
            enhancerData.name = this.ID;

            // Upgrades are contained within a relic effect - this is mandatory or the game will crash
            List <RelicEffectData> Effects = new List <RelicEffectData>
            {
                new RelicEffectDataBuilder
                {
                    relicEffectClassName  = "RelicEffectCardUpgrade",
                    ParamCardUpgradeData  = Upgrade.Build(),
                    ParamCardType         = CardType,
                    ParamCharacterSubtype = "SubtypesData_None",
                }.Build()
            };

            t.Field("effects").SetValue(Effects);

            // Grab the LinkedClass from the ClanID
            this.LinkedClass = ProviderManager.SaveManager.GetAllGameData().FindClassData(this.ClanID);
            t.Field("linkedClass").SetValue(LinkedClass);

            // Take care of the localized strings
            BuilderUtils.ImportStandardLocalization(this.DescriptionKey, this.Description);
            t.Field("descriptionKey").SetValue(DescriptionKey);

            BuilderUtils.ImportStandardLocalization(this.NameKey, this.Name);
            t.Field("nameKey").SetValue(NameKey);

            // Create the icon from the asset path
            if (this.AssetPath != null)
            {
                Sprite iconSprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.AssetPath);
                t.Field("icon").SetValue(iconSprite);
            }

            // A steak pun is a rare medium well done.
            t.Field("rarity").SetValue(Rarity);

            return(enhancerData);
        }