Exemple #1
0
 public void CompletionAnimation(EndgameBundleMenu menu, bool playSound = true, int delay = 0)
 {
     if (delay <= 0)
     {
         CompletionAnimation(playSound);
     }
     else
     {
         completionTimer = delay;
     }
 }
Exemple #2
0
        public Item?TryToDepositThisItem(Item?item, ClickableTextureComponent slot, string noteTextureName)
        {
            if (item is not SObject || item is Furniture)
            {
                return(item);
            }

            for (int i = 0; i < bundle.Ingredients.Count; i++)
            {
                if (IsValidItemForTheBundle(item, bundle.Ingredients[i]) && slot.item is null)
                {
                    item.Stack -= bundle.Ingredients[i].Amount;
                    bundle.Ingredients[i].Completed = true;
                    IngredientDepositAnimation(slot, noteTextureName);
                    int index = bundle.Ingredients[i].ItemID;

                    if (index < 0)
                    {
                        index = EndgameBundleMenu.GetObjectOrCategoryIndex(index);
                    }

                    slot.item = new SObject(index, bundle.Ingredients[i].ItemID, isRecipe: false, -1, bundle.Ingredients[i].Quality);
                    Game1.playSound("newArtifact");

                    // TODO: bundle logic
                    //(Game1.getLocationFromName("CommunityCenter") as CommunityCenter)!.bundles.FieldDict[bundleIndex][i] = true;
                    //ModEntry.bundles[bundleIndex] = true;

                    slot.sourceRect.X = 512;
                    slot.sourceRect.Y = 244;
                    //Game1.multiplayer.globalChatInfoMessage("BundleDonate", Game1.player.displayName, slot.item.DisplayName);
                    break;
                }
            }

            if (item.Stack > 0)
            {
                return(item);
            }

            return(null);
        }
Exemple #3
0
        public EndgameBundlePage(int bundleIndex, EndgameBundle bundle, Point position, string textureName, EndgameBundleMenu menu)
            : base(new Rectangle(position.X, position.Y, 64, 64), "")
        {
            this.bundle = bundle;

            this.bundleIndex = bundleIndex;
            //string[] split = rawBundleInfo.Split('/');
            name  = bundle.Name;
            label = bundle.Name;

            if (LocalizedContentManager.CurrentLanguageCode != 0)
            {
                // TODO: Localization
                label = bundle.Name;
            }

            //rewardDescription = split[1];

            //TODO: Localization support for the images

            /*if (split.Length > 5 && (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en || split.Length > 6))
             * {
             *      string bundle_image_override = split[5];
             *
             *      try
             *      {
             *              if (bundle_image_override.Contains(':'))
             *              {
             *                      string[] bundle_image_parts = bundle_image_override.Split(':');
             *                      bundleTextureOverride = Game1.content.Load<Texture2D>(bundle_image_parts[0]);
             *                      bundleTextureIndexOverride = int.Parse(bundle_image_parts[1]);
             *              }
             *              else
             *              {
             *                      bundleTextureIndexOverride = int.Parse(bundle_image_override);
             *              }
             *      }
             *      catch (Exception)
             *      {
             *              bundleTextureOverride = null;
             *              bundleTextureIndexOverride = -1;
             *      }
             * }*/

            // What's this part?

            /*string[] ingredientsSplit = split[2].Split(' ');
             * complete = true;
             * ingredients = new List<BundleIngredientDescription>();
             * int tally = 0;
             *
             * for (int i = 0; i < ingredientsSplit.Length; i += 3)
             * {
             *      ingredients.Add(new BundleIngredientDescription(Convert.ToInt32(ingredientsSplit[i]), Convert.ToInt32(ingredientsSplit[i + 1]), Convert.ToInt32(ingredientsSplit[i + 2]), completedIngredientsList[i / 3]));
             *
             *      if (!completedIngredientsList[i / 3])
             *      {
             *              complete = false;
             *      }
             *      else
             *      {
             *              tally++;
             *      }
             * }*/

            Random random = new Random();

            bundleColor = random.Next(0, 7);
            //bundleColor = Convert.ToInt32(split[3]);

            /*int count = 4;
             *
             * if (LocalizedContentManager.CurrentLanguageCode != 0)
             * {
             *      count = 5;
             * }*/

            //numberOfIngredientSlots = (split.Length > count) ? Convert.ToInt32(split[4]) : ingredients.Count;
            numberOfIngredientSlots = bundle.Ingredients.Count > bundle.MinRequiredAmount && bundle.MinRequiredAmount != -1 ? bundle.MinRequiredAmount : bundle.Ingredients.Count;

            /*if (tally >= numberOfIngredientSlots)
             * {
             *      complete = true;
             * }*/

            sprite = new TemporaryAnimatedSprite(textureName, new Rectangle(bundleColor * 256 % 512, 244 + bundleColor * 256 / 512 * 16, 16, 16), 70f, 3, 99999, new Vector2(bounds.X, bounds.Y), flicker: false, flipped: false, 0.8f, 0f, Color.White, 4f, 0f, 0f, 0f)
            {
                pingPong = true,
                paused   = true
            };

            sprite.sourceRect.X += sprite.sourceRect.Width;

            if (name.ToLower().Contains(Game1.currentSeason) && !complete)
            {
                Shake();
            }

            if (complete)
            {
                CompletionAnimation(menu, playSound: false);
            }
        }