Exemplo n.º 1
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            Color col;

            float alpha = 1;

            if (_diff == FractionDifficulty.NEUTRAL)
            {
                if (_spawnPercentage >= 1)
                {
                    alpha = 1 - (_movementTime * SPEED / (_pipe.Length / 2));
                }
                col = FlatColors.Asbestos;
            }
            else
            {
                col = FractionDifficultyHelper.GetColor(_diff);
            }

            if (alpha < 0)
            {
                return;
            }

            sbatch.DrawCentered(Textures.TexParticle[14], Position, DIAMETER * _spawnPercentage, DIAMETER * _spawnPercentage, col * alpha);
        }
Exemplo n.º 2
0
        public HUDDifficultyButton(int depth, FractionDifficulty diff, HUDDifficultyButtonMode mode, Action a)
        {
            Depth      = depth;
            difficulty = diff;

            icon   = FractionDifficultyHelper.GetIcon(diff);
            action = a;

            switch (mode)
            {
            case HUDDifficultyButtonMode.DEACTIVATED:
                BackgroundColor = FlatColors.ButtonHUD;
                ForegroundColor = FlatColors.BackgroundHUD;
                break;

            case HUDDifficultyButtonMode.UNLOCKANIMATION:
                BackgroundColor = FlatColors.ButtonHUD;
                ForegroundColor = FlatColors.SunFlower;
                AddOperation(new HUDDifficultyButtonGainOperation());
                AddOperation(new HUDDifficultyButtonBlinkingIconOperation());
                break;

            case HUDDifficultyButtonMode.ACTIVATED:
                BackgroundColor = FlatColors.BackgroundHUD2;
                ForegroundColor = FlatColors.SunFlower;
                AddOperation(new HUDDifficultyButtonBlinkingIconOperation());
                break;

            default:
                SAMLog.Error("HDB::EnumSwitch_CTR", "value: " + mode);
                break;
            }
        }
        public EnhancedHUDDifficultyButton(int depth, FractionDifficulty diff, Action a)
        {
            Depth = depth;

            icon   = FractionDifficultyHelper.GetIcon(diff);
            action = a;
        }
Exemplo n.º 4
0
        public static void ListUnfinishedCount(GraphBlueprint g, out int missPoints, out int missLevel)
        {
            missPoints = 0;
            missLevel  = 0;

            var p = MainGame.Inst.Profile;

            foreach (var levelnode in g.LevelNodes)
            {
                if (!p.GetLevelData(levelnode).HasCompletedOrBetter(FractionDifficulty.DIFF_0))
                {
                    missLevel++; missPoints += FractionDifficultyHelper.GetScore(FractionDifficulty.DIFF_0);
                }
                if (!p.GetLevelData(levelnode).HasCompletedOrBetter(FractionDifficulty.DIFF_1))
                {
                    missLevel++; missPoints += FractionDifficultyHelper.GetScore(FractionDifficulty.DIFF_1);
                }
                if (!p.GetLevelData(levelnode).HasCompletedOrBetter(FractionDifficulty.DIFF_2))
                {
                    missLevel++; missPoints += FractionDifficultyHelper.GetScore(FractionDifficulty.DIFF_2);
                }
                if (!p.GetLevelData(levelnode).HasCompletedOrBetter(FractionDifficulty.DIFF_3))
                {
                    missLevel++; missPoints += FractionDifficultyHelper.GetScore(FractionDifficulty.DIFF_3);
                }
            }
        }
Exemplo n.º 5
0
        private void StartDownload()
        {
            _btnPlay0.ImageRotation      = 0f;
            _btnPlay0.ImageRotationSpeed = 0.25f;
            _btnPlay0.Image        = Textures.CannonCogBig;
            _btnPlay0.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0);
            _btnPlay0.ImagePadding = 8;

            _btnPlay1.ImageRotation      = 0f;
            _btnPlay1.ImageRotationSpeed = 0.25f;
            _btnPlay1.Image        = Textures.CannonCogBig;
            _btnPlay1.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1);
            _btnPlay1.ImagePadding = 8;

            _btnPlay2.ImageRotation      = 0f;
            _btnPlay2.ImageRotationSpeed = 0.25f;
            _btnPlay2.Image        = Textures.CannonCogBig;
            _btnPlay2.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2);
            _btnPlay2.ImagePadding = 8;

            _btnPlay3.ImageRotation      = 0f;
            _btnPlay3.ImageRotationSpeed = 0.25f;
            _btnPlay3.Image        = Textures.CannonCogBig;
            _btnPlay3.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3);
            _btnPlay3.ImagePadding = 8;

            StartDownloadLevel().RunAsync();
            _downloadState = DownloadState.Downloading;
        }
Exemplo n.º 6
0
        private void DrawInfoLine(IBatchRenderer sbatch, FractionDifficulty d, int idx, string strTime, bool colorize)
        {
            var p1 = Position + new Vector2(32, HEADER_HEIGHT + 40 + 56 * idx);
            var p2 = Position + new Vector2(64, HEADER_HEIGHT + 40 + 56 * idx);
            var p3 = Position + new Vector2(224, HEADER_HEIGHT + 40 + 56 * idx);

            var ic = (node.LevelData.HasCompletedOrBetter(d) ? FractionDifficultyHelper.GetColor(d) : FlatColors.Concrete) * progressDisplay;
            var tc = (node.LevelData.HasCompletedOrBetter(d) ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay;

            if (colorize && node.LevelData.Data[d].GlobalBestUserID >= 0 && node.LevelData.Data[d].GlobalBestUserID == MainGame.Inst.Profile.OnlineUserID)
            {
                tc = FlatColors.SunFlower * progressDisplay;
            }

            sbatch.DrawCentered(Textures.TexCircle, p1, 48, 48, FlatColors.WetAsphalt * progressDisplay);
            sbatch.DrawCentered(FractionDifficultyHelper.GetIcon(d), p1, 32, 32, ic);
            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontRegular, 32, FractionDifficultyHelper.GetDescription(d), tc, p2);
            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontRegular, 32, strTime, tc, p3);
        }
Exemplo n.º 7
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            {             // background
                SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
                SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);
            }

            {             // difficulty
                var tex = (PersonalBest == null) ? Textures.TexDifficultyLineNone : FractionDifficultyHelper.GetIcon(PersonalBest.Value);
                var col = (PersonalBest == null) ? FlatColors.Silver : FractionDifficultyHelper.GetColor(PersonalBest.Value);
                sbatch.DrawCentered(tex, new FPoint(bounds.Left + 5 + 16, bounds.Top + (Height - 25 - 32) / 2 + 16), 32, 32, col);
            }

            {             // name
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _meta.LevelName, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            }

            {             // user
                sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, FlatColors.WetAsphalt);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, _meta.Username ?? "Unknown", FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));
            }


            if (_meta.GridSize != SCCMLevelData.SIZES[0])             // [XL] marker
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            {             // star counter
                var pointPos = new FPoint(bottomrect.Right - 100, bottomrect.CenterY);
                sbatch.DrawCentered(Textures.TexIconStar, pointPos, 20, 20, FlatColors.SunFlower);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 24, _meta.Stars.ToString(), FlatColors.MidnightBlue, pointPos + new Vector2(16, 0));
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }
Exemplo n.º 8
0
        private void OnDownloadSuccess()
        {
            _downloadState = DownloadState.Finished;

            AddOperationDelayed(new SingleLambdaOperation <SCCMLevelPreviewDialog>("FinishButton0", e =>
            {
                _btnPlay0.ImageRotation      = 0f;
                _btnPlay0.ImageRotationSpeed = 0f;
                _btnPlay0.Image        = Textures.TexDifficultyLine0;
                _btnPlay0.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0);
                _btnPlay0.ImagePadding = 8;
            }), 0 * 0.150f);

            AddOperationDelayed(new SingleLambdaOperation <SCCMLevelPreviewDialog>("FinishButton1", e =>
            {
                _btnPlay1.ImageRotation      = 0f;
                _btnPlay1.ImageRotationSpeed = 0f;
                _btnPlay1.Image        = Textures.TexDifficultyLine1;
                _btnPlay1.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1);
                _btnPlay1.ImagePadding = 8;
            }), 1 * 0.150f);

            AddOperationDelayed(new SingleLambdaOperation <SCCMLevelPreviewDialog>("FinishButton2", e =>
            {
                _btnPlay2.ImageRotation      = 0f;
                _btnPlay2.ImageRotationSpeed = 0f;
                _btnPlay2.Image        = Textures.TexDifficultyLine2;
                _btnPlay2.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2);
                _btnPlay2.ImagePadding = 8;
            }), 2 * 0.150f);

            AddOperationDelayed(new SingleLambdaOperation <SCCMLevelPreviewDialog>("FinishButton3", e =>
            {
                _btnPlay3.ImageRotation      = 0f;
                _btnPlay3.ImageRotationSpeed = 0f;
                _btnPlay3.Image        = Textures.TexDifficultyLine3;
                _btnPlay3.ImageColor   = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3);
                _btnPlay3.ImagePadding = 8;
            }), 3 * 0.150f);
        }
Exemplo n.º 9
0
        protected override void OnPointerClick(FPoint relPositionPoint, InputState istate)
        {
            if (_rectHeader1.Contains(relPositionPoint))
            {
                var tabNext = 0;
                tabTimer = tabNext * TAB_SWITCHTIME;
            }
            else if (_rectHeader2.Contains(relPositionPoint))
            {
                var tabNext = 1;
                tabTimer = tabNext * TAB_SWITCHTIME;
            }
            else if (_rectHeader3.Contains(relPositionPoint))
            {
                var tabNext = 2;
                tabTimer = tabNext * TAB_SWITCHTIME;
            }
            else if (_rectRow1.Contains(relPositionPoint))
            {
                tabTimer = tab * TAB_SWITCHTIME;

                switch (tab)
                {
                case 0:
                    if (node.LevelData.HasCompletedExact(FractionDifficulty.DIFF_0))
                    {
                        Toast_1(L10N.TF(L10NImpl.STR_INFOTOAST_1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_0, true)));
                    }
                    else
                    {
                        Toast_4(L10N.TF(L10NImpl.STR_INFOTOAST_4, FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_0)));
                    }
                    break;

                case 1:
                    Toast_2(L10N.TF(L10NImpl.STR_INFOTOAST_2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalBestTime, true)));
                    break;

                case 2:
                    Toast_3(L10N.TF(L10NImpl.STR_INFOTOAST_3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalCompletionCount), FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_0)));
                    break;

                default:
                    SAMLog.Error("INFD::EnumSwitch_OPC1", "value: " + tab);
                    break;
                }
            }
            else if (_rectRow2.Contains(relPositionPoint))
            {
                tabTimer = tab * TAB_SWITCHTIME;

                switch (tab)
                {
                case 0:
                    if (node.LevelData.HasCompletedExact(FractionDifficulty.DIFF_1))
                    {
                        Toast_1(L10N.TF(L10NImpl.STR_INFOTOAST_1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_1, true)));
                    }
                    else
                    {
                        Toast_4(L10N.TF(L10NImpl.STR_INFOTOAST_4, FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_1)));
                    }
                    break;

                case 1:
                    Toast_2(L10N.TF(L10NImpl.STR_INFOTOAST_2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalBestTime, true)));
                    break;

                case 2:
                    Toast_3(L10N.TF(L10NImpl.STR_INFOTOAST_3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalCompletionCount), FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_1)));
                    break;


                default:
                    SAMLog.Error("INFD::EnumSwitch_OPC2", "value: " + tab);
                    break;
                }
            }
            else if (_rectRow3.Contains(relPositionPoint))
            {
                tabTimer = tab * TAB_SWITCHTIME;

                switch (tab)
                {
                case 0:
                    if (node.LevelData.HasCompletedExact(FractionDifficulty.DIFF_2))
                    {
                        Toast_1(L10N.TF(L10NImpl.STR_INFOTOAST_1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_2, true)));
                    }
                    else
                    {
                        Toast_4(L10N.TF(L10NImpl.STR_INFOTOAST_4, FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_2)));
                    }
                    break;

                case 1:
                    Toast_1(L10N.TF(L10NImpl.STR_INFOTOAST_2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalBestTime, true)));
                    break;

                case 2:
                    Toast_2(L10N.TF(L10NImpl.STR_INFOTOAST_3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalCompletionCount), FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_2)));
                    break;


                default:
                    SAMLog.Error("INFD::EnumSwitch_OPC3", "value: " + tab);
                    break;
                }
            }
            else if (_rectRow4.Contains(relPositionPoint))
            {
                tabTimer = tab * TAB_SWITCHTIME;

                switch (tab)
                {
                case 0:
                    if (node.LevelData.HasCompletedExact(FractionDifficulty.DIFF_3))
                    {
                        Toast_1(L10N.TF(L10NImpl.STR_INFOTOAST_1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_3, true)));
                    }
                    else
                    {
                        Toast_4(L10N.TF(L10NImpl.STR_INFOTOAST_4, FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_3)));
                    }
                    break;

                case 1:
                    Toast_2(L10N.TF(L10NImpl.STR_INFOTOAST_2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalBestTime, true)));
                    break;

                case 2:
                    Toast_3(L10N.TF(L10NImpl.STR_INFOTOAST_3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalCompletionCount), FractionDifficultyHelper.GetDescription(FractionDifficulty.DIFF_3)));
                    break;


                default:
                    SAMLog.Error("INFD::EnumSwitch_OPC4", "value: " + tab);
                    break;
                }
            }
            else
            {
                var tabNext = (int)(tabTimer / TAB_SWITCHTIME + 1) % 3;
                tabTimer = tabNext * TAB_SWITCHTIME;
            }
        }
Exemplo n.º 10
0
        private void EndGame(bool playerWon, Fraction winner)
        {
            MainGame.Inst.Profile.SingleplayerGameSpeed = GameSpeedMode;
            MainGame.Inst.SaveProfile();

            HasFinished = true;
            PlayerWon   = playerWon;

            var ctime = (int)(LevelTime * 1000);

            if (playerWon)
            {
                int scoreGain = 0;
                HashSet <FractionDifficulty> gains = new HashSet <FractionDifficulty>();

                for (FractionDifficulty diff = FractionDifficulty.DIFF_0; diff <= Difficulty; diff++)
                {
                    if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedOrBetter(diff))
                    {
                        scoreGain += FractionDifficultyHelper.GetScore(diff);
                        gains.Add(diff);
                    }
                }

                {
                    if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedExact(Difficulty))
                    {
                        GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true);
                    }
                    var localdata = GDOwner.Profile.LevelData[Blueprint.UniqueID].Data[Difficulty];

                    if (ctime < localdata.BestTime)
                    {
                        // update PB
                        GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true);
                    }

                    // Fake the online data until next sync
                    localdata.GlobalCompletionCount++;
                    if (ctime < localdata.GlobalBestTime || localdata.GlobalBestTime == -1)
                    {
                        if (localdata.GlobalBestTime != -1)
                        {
                            // WURLD RECARD !!
                            // Dispatch is trick to put in infront of score panel ...
                            MainGame.Inst.DispatchBeginInvoke(() => { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_WORLDRECORD)); });
                        }

                        localdata.GlobalBestTime   = ctime;
                        localdata.GlobalBestUserID = GDOwner.Profile.OnlineUserID;
                    }
                }

                GDOwner.SaveProfile();
                ShowScorePanel(Blueprint, GDOwner.Profile, gains, true, scoreGain, ctime);
                MainGame.Inst.GDSound.PlayEffectGameWon();

                EndGameConvert(winner);
            }
            else
            {
                ShowScorePanel(Blueprint, GDOwner.Profile, new HashSet <FractionDifficulty>(), false, 0, ctime);

                MainGame.Inst.GDSound.PlayEffectGameOver();

                EndGameConvert(winner);
            }

            foreach (var cannon in Entities.Enumerate().OfType <Cannon>())
            {
                cannon.ForceUpdateController();
            }
        }
Exemplo n.º 11
0
        private void EndGame(bool playerWon, Fraction winner)
        {
            HasFinished = true;
            PlayerWon   = playerWon;

            var ctime = (int)(LevelTime * 1000);

            if (playerWon)
            {
                int scoreGain = 0;
                HashSet <FractionDifficulty> gains = new HashSet <FractionDifficulty>();

                for (FractionDifficulty diff = FractionDifficulty.DIFF_0; diff <= Difficulty; diff++)
                {
                    if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedOrBetter(diff))
                    {
                        scoreGain += FractionDifficultyHelper.GetScore(diff);
                        gains.Add(diff);
                    }
                }

                {
                    if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedExact(Difficulty))
                    {
                        GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true);
                    }
                    var localdata = GDOwner.Profile.LevelData[Blueprint.UniqueID].Data[Difficulty];

                    if (ctime < localdata.BestTime)
                    {
                        // update PB
                        GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true);
                    }

                    // Fake the online data until next sync
                    localdata.GlobalCompletionCount++;
                    if (ctime < localdata.GlobalBestTime || localdata.GlobalBestTime == -1)
                    {
                        localdata.GlobalBestTime   = ctime;
                        localdata.GlobalBestUserID = GDOwner.Profile.OnlineUserID;
                    }
                }

                GDOwner.SaveProfile();
                ShowScorePanel(Blueprint, GDOwner.Profile, gains, true, scoreGain, ctime);
                MainGame.Inst.GDSound.PlayEffectGameWon();

                EndGameConvert(winner);
            }
            else
            {
                ShowScorePanel(Blueprint, GDOwner.Profile, new HashSet <FractionDifficulty>(), false, 0, ctime);

                MainGame.Inst.GDSound.PlayEffectGameOver();

                EndGameConvert(winner);
            }

            foreach (var cannon in Entities.Enumerate().OfType <Cannon>())
            {
                cannon.ForceUpdateController();
            }
        }
Exemplo n.º 12
0
        public override void OnInitialize()
        {
            #region Header

            AddElement(new HUDRectangle(-99)
            {
                Alignment        = HUDAlignment.TOPCENTER,
                RelativePosition = FPoint.Zero,
                Size             = new FSize(WIDTH, 1.40f * TW),

                Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD.Darken(0.9f), 16, true, true, false, false),
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTER,
                Alignment        = HUDAlignment.TOPCENTER,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(WIDTH, 1.40f * TW),

                Font     = Textures.HUDFontBold,
                FontSize = TW,

                Text      = _meta?.LevelName ?? _blueprint.FullName,
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = Color.White,
            });

            var starred = MainGame.Inst.Profile.HasCustomLevelStarred(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID);
            var mylevel = ((_meta?.UserID ?? _blueprint.CustomMeta_UserID) == MainGame.Inst.Profile.OnlineUserID);

            AddElement(_btnStar = new HUDEllipseImageButton
            {
                Alignment        = HUDAlignment.TOPRIGHT,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(64, 64),

                Image             = Textures.TexIconStar,
                BackgroundNormal  = Color.Transparent,
                BackgroundPressed = FlatColors.ButtonPressedHUD,
                ImageColor        = (starred || mylevel) ? FlatColors.SunFlower : FlatColors.Silver,
                ImageAlignment    = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale        = HUDImageScaleAlgorithm.STRETCH,

                Click = (s, a) => ToggleStar(),

                IsEnabled = ((_meta?.UserID ?? _blueprint.CustomMeta_UserID) != MainGame.Inst.Profile.OnlineUserID) && (MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID)),
            });

            AddElement(_lblStar = new HUDLabel
            {
                Alignment        = HUDAlignment.TOPRIGHT,
                RelativePosition = new FPoint(0, 55),
                Size             = new FSize(64, 32),

                Font     = Textures.HUDFontRegular,
                FontSize = 24,

                Text          = (_meta == null) ? "?" : _meta.Stars.ToString(),
                WordWrap      = HUDWordWrap.NoWrap,
                TextColor     = (starred || mylevel) ? FlatColors.SunFlower : FlatColors.Silver,
                TextAlignment = HUDAlignment.TOPCENTER,
            });

            #endregion

            #region Tab Header

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.BOTTOMLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(1 * TW, 1 * TW),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontBold,
                FontSize = 32,

                L10NText  = L10NImpl.STR_INF_YOU,
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.BOTTOMLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(4 * TW, 1 * TW),
                Size             = new FSize(6 * TW, TW),

                Font     = Textures.HUDFontBold,
                FontSize = 32,

                L10NText  = L10NImpl.STR_INF_HIGHSCORE,
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.BOTTOMLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(10 * TW, 1 * TW),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontBold,
                FontSize = 32,

                L10NText  = L10NImpl.STR_INF_CLEARS,
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = FlatColors.Clouds,
            });

            #endregion

            #region Tab Col Images

            AddElement(new HUDImage
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(8, 2 * TW + 16 + (48 + 16) * 0 + 8),
                Size             = new FSize(48, 48),

                Image          = Textures.TexDifficultyLine0,
                Color          = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0) : FlatColors.Silver,
                ImageAlignment = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale     = HUDImageScaleAlgorithm.STRETCH,
            });

            AddElement(new HUDImage
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(8, 2 * TW + 16 + (48 + 16) * 1 + 8),
                Size             = new FSize(48, 48),

                Image          = Textures.TexDifficultyLine1,
                Color          = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1) : FlatColors.Silver,
                ImageAlignment = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale     = HUDImageScaleAlgorithm.STRETCH,
            });

            AddElement(new HUDImage
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(8, 2 * TW + 16 + (48 + 16) * 2 + 8),
                Size             = new FSize(48, 48),

                Image          = Textures.TexDifficultyLine2,
                Color          = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2) : FlatColors.Silver,
                ImageAlignment = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale     = HUDImageScaleAlgorithm.STRETCH,
            });

            AddElement(new HUDImage
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(8, 2 * TW + 16 + (48 + 16) * 3 + 8),
                Size             = new FSize(48, 48),

                Image          = Textures.TexDifficultyLine3,
                Color          = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3) : FlatColors.Silver,
                ImageAlignment = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale     = HUDImageScaleAlgorithm.STRETCH,
            });

            #endregion

            #region Tab Col 1

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(1 * TW, 2 * TW + 16 + (48 + 16) * 0),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = MainGame.Inst.Profile.GetCustomLevelTimeString(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_0),
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(1 * TW, 2 * TW + 16 + (48 + 16) * 1),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = MainGame.Inst.Profile.GetCustomLevelTimeString(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_1),
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(1 * TW, 2 * TW + 16 + (48 + 16) * 2),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = MainGame.Inst.Profile.GetCustomLevelTimeString(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_2),
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(1 * TW, 2 * TW + 16 + (48 + 16) * 3),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = MainGame.Inst.Profile.GetCustomLevelTimeString(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_3),
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3) : FlatColors.TextHUD,
            });

            #endregion

            #region Tab Col 2

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(4 * TW, 2 * TW + 16 + (48 + 16) * 0),
                Size             = new FSize(6 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_0].FormatHighscoreCell() ?? "",
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(4 * TW, 2 * TW + 16 + (48 + 16) * 1),
                Size             = new FSize(6 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_1].FormatHighscoreCell() ?? "",
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(4 * TW, 2 * TW + 16 + (48 + 16) * 2),
                Size             = new FSize(6 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_2].FormatHighscoreCell() ?? "",
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(4 * TW, 2 * TW + 16 + (48 + 16) * 3),
                Size             = new FSize(6 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_3].FormatHighscoreCell() ?? "",
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3) : FlatColors.TextHUD,
            });

            #endregion

            #region Tab Col 3

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(10 * TW, 2 * TW + 16 + (48 + 16) * 0),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_0].FormatGlobalClearsCell() ?? "",
                WordWrap  = HUDWordWrap.NoWrap,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(10 * TW, 2 * TW + 16 + (48 + 16) * 1),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_1].FormatGlobalClearsCell() ?? "",
                WordWrap  = HUDWordWrap.NoWrap,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(10 * TW, 2 * TW + 16 + (48 + 16) * 2),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_2].FormatGlobalClearsCell() ?? "",
                WordWrap  = HUDWordWrap.NoWrap,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2) : FlatColors.TextHUD,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(10 * TW, 2 * TW + 16 + (48 + 16) * 3),
                Size             = new FSize(3 * TW, TW),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Highscores[(int)FractionDifficulty.DIFF_3].FormatGlobalClearsCell() ?? "",
                WordWrap  = HUDWordWrap.NoWrap,
                TextColor = MainGame.Inst.Profile.HasCustomLevelBeaten(_meta?.OnlineID ?? _blueprint.CustomMeta_LevelID, FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3) : FlatColors.TextHUD,
            });

            #endregion

            #region Footer

            AddElement(new HUDRectangle
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = FPoint.Zero,
                Size             = new FSize(WIDTH, 1.5f * TW),

                Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true),
            });

            AddElement(new HUDSeperator(HUDOrientation.Horizontal, 3)
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = new FPoint(0, 1.5f * TW),
                Size             = new FSize(WIDTH, HUD.PixelWidth),

                Color = FlatColors.SeperatorHUD,
            });

            AddElement(_btnPlay0 = new HUDEllipseImageButton
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = new FPoint(-84 / 2 - 16 - 84 - 32, 6),
                Size             = new FSize(84, 84),

                Image             = Textures.TexDifficultyLine0,
                BackgroundNormal  = FlatColors.ButtonHUD,
                BackgroundPressed = FlatColors.ButtonPressedHUD,
                ImageColor        = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_0),
                ImageAlignment    = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale        = HUDImageScaleAlgorithm.STRETCH,

                Click = (s, a) => Play(FractionDifficulty.DIFF_0),
            });

            AddElement(_btnPlay1 = new HUDEllipseImageButton
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = new FPoint(-84 / 2 - 16, 6),
                Size             = new FSize(84, 84),

                Image             = Textures.TexDifficultyLine1,
                BackgroundNormal  = FlatColors.ButtonHUD,
                BackgroundPressed = FlatColors.ButtonPressedHUD,
                ImageColor        = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_1),
                ImageAlignment    = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale        = HUDImageScaleAlgorithm.STRETCH,

                Click = (s, a) => Play(FractionDifficulty.DIFF_1),
            });

            AddElement(_btnPlay2 = new HUDEllipseImageButton
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = new FPoint(+84 / 2 + 16, 6),
                Size             = new FSize(84, 84),

                Image             = Textures.TexDifficultyLine2,
                BackgroundNormal  = FlatColors.ButtonHUD,
                BackgroundPressed = FlatColors.ButtonPressedHUD,
                ImageColor        = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_2),
                ImageAlignment    = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale        = HUDImageScaleAlgorithm.STRETCH,

                Click = (s, a) => Play(FractionDifficulty.DIFF_2),
            });

            AddElement(_btnPlay3 = new HUDEllipseImageButton
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = new FPoint(+84 / 2 + 16 + 84 + 32, 6),
                Size             = new FSize(84, 84),

                Image             = Textures.TexDifficultyLine3,
                BackgroundNormal  = FlatColors.ButtonHUD,
                BackgroundPressed = FlatColors.ButtonPressedHUD,
                ImageColor        = FractionDifficultyHelper.GetColor(FractionDifficulty.DIFF_3),
                ImageAlignment    = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale        = HUDImageScaleAlgorithm.STRETCH,

                Click = (s, a) => Play(FractionDifficulty.DIFF_3),
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.BOTTOMRIGHT,
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(4, 4),
                Size             = new FSize(236, 32),

                Font     = Textures.HUDFontRegular,
                FontSize = 32,

                Text      = _meta?.Username ?? "???",
                WordWrap  = HUDWordWrap.Ellipsis,
                TextColor = FlatColors.GreenSea,
            });

            #endregion

            if (_blueprint == null && _meta != null)
            {
                StartDownload();
            }
            else if (_blueprint != null && _meta == null)
            {
                StartMetaUpdate();
            }
            else if (_blueprint != null && _meta != null)
            {
                _downloadState = DownloadState.Finished;
            }
            else
            {
                SAMLog.Error("SCCMLPD::EnumSwitch_OI", $"_blueprint: '{_blueprint}' | _meta = '{_meta}'");
            }
        }