Exemplo n.º 1
0
        private static void DrawQuests(SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor)
        {
            LinearGradientBrush linGrBrush = new LinearGradientBrush();

            linGrBrush.StartPoint = new Point(0, 0);
            linGrBrush.EndPoint   = new Point(0, 1);
            linGrBrush.GradientStops.Add(new GradientStop(Color.FromArgb(75, SecondaryColor.Color.R, SecondaryColor.Color.G, SecondaryColor.Color.B), 0));
            linGrBrush.GradientStops.Add(new GradientStop(Color.FromArgb(25, PrimaryColor.Color.R, PrimaryColor.Color.G, PrimaryColor.Color.B), 0.15));
            linGrBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 0, 0, 0), 1));

            IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, 256, 1024, 144));
            IconCreator.ICDrawingContext.DrawRectangle(linGrBrush, null, new Rect(0, 256, 1024, 144));

            Typeface typeface = new Typeface(TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal);

            y = 310;
            bool isBundleLevelup      = false;
            bool isRequiresBattlePass = false;

            foreach (BundleInfosEntry entry in ChallengeBundleInfos.BundleData)
            {
                #region DESIGN

                #region UNLOCK TYPE
                if (!string.IsNullOrEmpty(entry.TheQuestUnlockType))
                {
                    switch (entry.TheQuestUnlockType)
                    {
                    case "EChallengeBundleQuestUnlockType::BundleLevelup":
                        if (!isBundleLevelup)
                        {
                            IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 40));
                            DrawUnlockType(PrimaryColor, SecondaryColor, "/FortniteGame/Content/UI/Foundation/Textures/Icons/Items/T-FNBR-MissionIcon-L", y);
                            isBundleLevelup = true;
                            y += 40;
                        }
                        break;

                    case "EChallengeBundleQuestUnlockType::RequiresBattlePass":
                        if (!isRequiresBattlePass)
                        {
                            IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 40));
                            DrawUnlockType(PrimaryColor, SecondaryColor, "/FortniteGame/Content/UI/Foundation/Textures/Icons/Items/T-FNBR-BattlePass-L", y);
                            isRequiresBattlePass = true;
                            y += 40;
                        }
                        break;
                    }
                }
                #endregion

                IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 90));
                IconCreator.ICDrawingContext.DrawRectangle(PrimaryColor, null, new Rect(25, y, 1024 - 50, 70));

                Point         dStart    = new Point(32, y + 5);
                LineSegment[] dSegments = new[]
                {
                    new LineSegment(new Point(29, y + 67), true),
                    new LineSegment(new Point(1024 - 160, y + 62), true),
                    new LineSegment(new Point(1024 - 150, y + 4), true)
                };
                PathFigure   dFigure = new PathFigure(dStart, dSegments, true);
                PathGeometry dGeo    = new PathGeometry(new[] { dFigure });
                IconCreator.ICDrawingContext.DrawGeometry(ChallengesUtility.LightBrush(PrimaryColor, 0.04f), null, dGeo);

                IconCreator.ICDrawingContext.DrawRectangle(SecondaryColor, null, new Rect(60, y + 47, 500, 7));

                dStart    = new Point(39, y + 35);
                dSegments = new[]
                {
                    new LineSegment(new Point(45, y + 32), true),
                    new LineSegment(new Point(48, y + 37), true),
                    new LineSegment(new Point(42, y + 40), true)
                };
                dFigure = new PathFigure(dStart, dSegments, true);
                dGeo    = new PathGeometry(new[] { dFigure });
                IconCreator.ICDrawingContext.DrawGeometry(SecondaryColor, null, dGeo);
                #endregion

                #region DESCRIPTION
                new UpdateMyConsole(entry.TheQuestDescription, CColors.ChallengeDescription).Append();

                FormattedText formattedText =
                    new FormattedText(
                        entry.TheQuestDescription,
                        CultureInfo.CurrentUICulture,
                        FlowDirection.LeftToRight,
                        typeface,
                        27,
                        Brushes.White,
                        IconCreator.PPD
                        );
                formattedText.TextAlignment = TextAlignment.Left;
                formattedText.MaxTextWidth  = 800;
                formattedText.MaxLineCount  = 1;
                Point textLocation = new Point(60, y + 15);
                IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                #endregion

                #region COUNT
                new UpdateMyConsole("\t\tCount: " + entry.TheQuestCount.ToString(), CColors.ChallengeCount).Append();

                formattedText =
                    new FormattedText(
                        "0 /",
                        CultureInfo.CurrentUICulture,
                        FlowDirection.LeftToRight,
                        typeface,
                        15,
                        new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)),
                        IconCreator.PPD
                        );
                formattedText.TextAlignment = TextAlignment.Left;
                formattedText.MaxLineCount  = 1;
                textLocation = new Point(565, y + 44);
                IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);

                formattedText =
                    new FormattedText(
                        entry.TheQuestCount.ToString(),
                        CultureInfo.CurrentUICulture,
                        FlowDirection.LeftToRight,
                        typeface,
                        15,
                        new SolidColorBrush(Color.FromArgb(200, 255, 255, 255)),
                        IconCreator.PPD
                        );
                formattedText.TextAlignment = TextAlignment.Left;
                formattedText.MaxLineCount  = 1;
                textLocation = new Point(584, y + 44);
                IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                #endregion

                new UpdateMyConsole("\t\tReward: " + Path.GetFileNameWithoutExtension(entry.TheRewardPath) + " x" + entry.TheRewardQuantity, CColors.ChallengeReward, true).Append();
                ChallengeRewards.DrawRewards(entry.TheRewardPath, entry.TheRewardQuantity, y);

                y += 90;
            }
            new UpdateMyConsole("• ------------------------------ •", CColors.White, true).Append();
        }
Exemplo n.º 2
0
        public static void DrawChallengeCompletion(JArray AssetProperties, SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, int y)
        {
            JArray bundleCompletionRewardsArray = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "BundleCompletionRewards", "data");

            if (bundleCompletionRewardsArray != null)
            {
                new UpdateMyProcessEvents("Completion Rewards...", "Waiting").Update();
                IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 40));
                y += 40;

                foreach (JToken data in bundleCompletionRewardsArray)
                {
                    JArray challengeBundleRewardsArray = data["struct_type"]["properties"].Value <JArray>();
                    if (challengeBundleRewardsArray != null)
                    {
                        string completionCount      = string.Empty;
                        JToken completionCountToken = AssetsUtility.GetPropertyTag <JToken>(challengeBundleRewardsArray, "CompletionCount");
                        if (completionCountToken != null)
                        {
                            completionCount = completionCountToken.Value <string>();
                        }

                        JArray rewardsArray = AssetsUtility.GetPropertyTagText <JArray>(challengeBundleRewardsArray, "Rewards", "data");
                        if (rewardsArray != null)
                        {
                            foreach (JToken reward in rewardsArray)
                            {
                                if (reward["struct_name"] != null && reward["struct_type"] != null && string.Equals(reward["struct_name"].Value <string>(), "AthenaRewardItemReference"))
                                {
                                    JArray dataPropertiesArray = reward["struct_type"]["properties"].Value <JArray>();
                                    if (dataPropertiesArray != null)
                                    {
                                        string rewardPath     = string.Empty;
                                        string rewardQuantity = string.Empty;

                                        JToken quantityToken = AssetsUtility.GetPropertyTag <JToken>(dataPropertiesArray, "Quantity");
                                        if (quantityToken != null)
                                        {
                                            rewardQuantity = quantityToken.Value <string>();
                                        }

                                        JToken questDefinitionToken = AssetsUtility.GetPropertyTagText <JToken>(dataPropertiesArray, "ItemDefinition", "asset_path_name");
                                        if (questDefinitionToken != null)
                                        {
                                            if (questDefinitionToken.Value <string>().Contains("/Game/Items/Tokens/") || questDefinitionToken.Value <string>().Contains("Quest_BR_"))
                                            {
                                                continue;
                                            }

                                            if (string.Equals(questDefinitionToken.Value <string>(), "None", StringComparison.InvariantCultureIgnoreCase))
                                            {
                                                //banners
                                                JToken templateIdToken = AssetsUtility.GetPropertyTag <JToken>(dataPropertiesArray, "TemplateId");
                                                if (templateIdToken != null)
                                                {
                                                    DrawCompletionText(completionCount, PrimaryColor, SecondaryColor, y);
                                                    ChallengeRewards.DrawRewards(templateIdToken.Value <string>(), rewardQuantity, y);
                                                    y += 90;
                                                }
                                            }
                                            else
                                            {
                                                rewardPath = FoldersUtility.FixFortnitePath(questDefinitionToken.Value <string>());

                                                DrawCompletionText(completionCount, PrimaryColor, SecondaryColor, y);
                                                ChallengeRewards.DrawRewards(rewardPath, rewardQuantity, y);
                                                y += 90;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }