public override void Initialize()
 {
     if (Music.currentSong != "RaceDay")
     {
         Music.Play("RaceDay");
     }
     this._door = new Sprite("litDoor");
     this._door.CenterOrigin();
     this._unlitDoor = new Sprite("unlitDoor");
     this._unlitDoor.CenterOrigin();
     this._profiles = Profiles.allCustomProfiles;
     this._profile  = this._profiles[this._selectorPosition];
     HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@");
     if (this._profiles.Count > 0)
     {
         HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@SELECT");
     }
     HUD.AddCornerMessage(HUDCorner.TopLeft, "ALBUM@GRAB@");
     HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@EXIT");
     this.backgroundColor = Color.Black;
     base.Initialize();
 }
 public override void Initialize()
 {
     if (this._text == "INCOMPATIBLE MOD SETUP!")
     {
         this._downloadModsMenu = new UIMenu("MODS REQUIRED!", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 290f, conString: "@SELECT@SELECT");
         this._downloadModsMenu.Add((UIComponent) new UIText("You're missing the mods required", Colors.DGBlue), true);
         this._downloadModsMenu.Add((UIComponent) new UIText("to join this game. Would you", Colors.DGBlue), true);
         this._downloadModsMenu.Add((UIComponent) new UIText("like to automatically subscribe to", Colors.DGBlue), true);
         this._downloadModsMenu.Add((UIComponent) new UIText("all required mods, restart and", Colors.DGBlue), true);
         this._downloadModsMenu.Add((UIComponent) new UIText("join the game?", Colors.DGBlue), true);
         this._downloadModsMenu.Add((UIComponent) new UIText("", Colors.DGBlue), true);
         this._downloadModsMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCloseMenu((UIComponent)this._downloadModsMenu)), true);
         this._downloadModsMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)this._downloadModsMenu, new UIMenuActionCloseMenuCallFunction.Function(UIServerBrowser.SubscribeAndRestart))), true);
         this._downloadModsMenu.Close();
         this._downloadModsMenu.Open();
         MonoMain.pauseMenu = (UIComponent)this._downloadModsMenu;
     }
     DuckNetwork.ClosePauseMenu();
     ConnectionStatusUI.Hide();
     this._startCalled = true;
     HUD.AddCornerMessage(HUDCorner.BottomRight, "@START@CONTINUE");
     base.Initialize();
 }
Exemple #3
0
        public override void Update()
        {
            Options.openOnClose = this._pauseMenu;
            if (this.spawnKey)
            {
                if ((double)this.spawnKeyWait > 0.0)
                {
                    this.spawnKeyWait -= Maths.IncFrameTimer();
                }
                else
                {
                    SFX.Play("ching");
                    this.spawnKey = false;
                    Key key = new Key(this._prizeTable.x, this._prizeTable.y);
                    key.vSpeed = -4f;
                    key.depth  = this._duck.depth + 50;
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)key);
                }
            }
            Chancy.Update();
            if (this._pendingSpawns != null && this._pendingSpawns.Count > 0)
            {
                Duck pendingSpawn = this._pendingSpawns[0];
                this.AddThing((Thing)pendingSpawn);
                this._pendingSpawns.RemoveAt(0);
                this._duck   = pendingSpawn;
                this._arcade = this.things[typeof(ArcadeMode)].First <Thing>() as ArcadeMode;
            }
            Layer.Lighting.fade  = Layer.Lighting2.fade = 1f - Math.Min(1f, Math.Max(0.0f, (float)((1.0 - (double)Layer.Game.fade) * 1.5)));
            this.backgroundColor = Color.Black;
            if (UnlockScreen.open || ArcadeHUD.open)
            {
                foreach (Thing challenge in this._challenges)
                {
                    challenge.visible = false;
                }
                this._prizeTable.visible = false;
            }
            else
            {
                foreach (Thing challenge in this._challenges)
                {
                    challenge.visible = true;
                }
                this._prizeTable.visible = true;
            }
            if (this._state == this._desiredState && this._state != ArcadeState.UnlockMachine && this._state != ArcadeState.LaunchChallenge)
            {
                if (!this._quitting)
                {
                    if (Input.Pressed("START"))
                    {
                        this._pauseGroup.Open();
                        this._pauseMenu.Open();
                        MonoMain.pauseMenu = this._pauseGroup;
                        if (!this._paused)
                        {
                            Music.Pause();
                            SFX.Play("pause", 0.6f);
                            this._paused           = true;
                            this._duck.immobilized = true;
                        }
                        this.simulatePhysics = false;
                        return;
                    }
                    if (this._paused && MonoMain.pauseMenu == null)
                    {
                        this._paused = false;
                        SFX.Play("resume", 0.6f);
                        if (this._quit.value)
                        {
                            this._quitting = true;
                        }
                        else
                        {
                            Music.Resume();
                            this._duck.immobilized = false;
                            this.simulatePhysics   = true;
                        }
                    }
                }
                else
                {
                    Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.02f);
                    if ((double)Graphics.fade > 0.00999999977648258)
                    {
                        return;
                    }
                    Level.current = (Level) new TitleScreen();
                    return;
                }
            }
            if (this._paused)
            {
                return;
            }
            if (this._hud.launchChallenge)
            {
                this._desiredState = ArcadeState.LaunchChallenge;
            }
            if (this._desiredState != this._state)
            {
                this._duck.active = false;
                bool flag = false;
                if (this._desiredState == ArcadeState.ViewChallenge)
                {
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
                    this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
                    if ((double)this._followCam.manualViewSize < 30.0)
                    {
                        Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.08f);
                        if ((double)this._followCam.manualViewSize < 3.0 && (double)this._hud.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                        {
                            flag = true;
                        }
                    }
                }
                else if (this._desiredState == ArcadeState.Normal)
                {
                    if (!this._flipState)
                    {
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._duck);
                        HUD.CloseAllCorners();
                    }
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
                    if (this._state == ArcadeState.ViewChallenge || this._state == ArcadeState.UnlockScreen)
                    {
                        this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
                    }
                    Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
                    {
                        flag = true;
                        this._followCam.manualViewSize = -1f;
                        this._duck.alpha = 1f;
                    }
                    if (Unlockables.HasPendingUnlocks())
                    {
                        MonoMain.pauseMenu = (UIComponent) new UIUnlockBox(Unlockables.GetPendingUnlocks().ToList <Unlockable>(), Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f);
                    }
                }
                else if (this._desiredState == ArcadeState.ViewSpecialChallenge || this._desiredState == ArcadeState.ViewChallengeList || this._desiredState == ArcadeState.ViewProfileSelector)
                {
                    if (!this._flipState)
                    {
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._duck);
                        HUD.CloseAllCorners();
                    }
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
                    if (this._state == ArcadeState.ViewChallenge || this._state == ArcadeState.UnlockScreen)
                    {
                        this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
                    }
                    Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
                    {
                        flag = true;
                        this._followCam.manualViewSize = -1f;
                        this._duck.alpha = 1f;
                    }
                }
                else if (this._desiredState == ArcadeState.UnlockMachine)
                {
                    if (!this._flipState)
                    {
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._unlockMachines[0]);
                        HUD.CloseAllCorners();
                    }
                    if (this._state == ArcadeState.ViewChallenge)
                    {
                        this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
                    }
                    this._duck.alpha         = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
                    Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    this._unlockMachineWait  = 1f;
                    if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
                    {
                        flag = true;
                        this._followCam.manualViewSize = -1f;
                        this._duck.alpha = 1f;
                    }
                }
                else if (this._desiredState == ArcadeState.LaunchChallenge)
                {
                    if (!this._flipState)
                    {
                        HUD.CloseAllCorners();
                    }
                    Music.volume             = Lerp.Float(Music.volume, 0.0f, 0.01f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.02f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    if ((double)this._hud.alpha == 0.0)
                    {
                        flag = true;
                    }
                }
                if (this._desiredState == ArcadeState.UnlockScreen)
                {
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
                    this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
                    if ((double)this._followCam.manualViewSize < 30.0)
                    {
                        Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 1f, 0.08f);
                        if ((double)this._followCam.manualViewSize < 3.0 && (double)this._unlockScreen.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                        {
                            flag = true;
                        }
                    }
                }
                this._flipState = true;
                if (this._launchedChallenge)
                {
                    Layer.Background.fade = 0.0f;
                    Layer.Game.fade       = 0.0f;
                }
                if (!flag)
                {
                    return;
                }
                this._flipState = false;
                HUD.CloseAllCorners();
                this._state = this._desiredState;
                if (this._state == ArcadeState.ViewChallenge)
                {
                    if (this._afterChallenge)
                    {
                        Music.Play("Arcade");
                        this._afterChallenge = false;
                    }
                    this._hud.MakeActive();
                    Level.Add((Thing)this._hud);
                    this._duck.active = false;
                }
                else if (this._state == ArcadeState.LaunchChallenge)
                {
                    ArcadeLevel.currentArcade = this;
                    foreach (Thing thing in this.things[typeof(ChallengeConfetti)])
                    {
                        Level.Remove(thing);
                    }
                    Music.Stop();
                    Level.current = (Level) new ChallengeLevel(this._hud.selected.challenge.fileName);
                    if (!this.launchSpecialChallenge)
                    {
                        this._desiredState        = ArcadeState.ViewChallenge;
                        this._hud.launchChallenge = false;
                        this._launchedChallenge   = false;
                        this._afterChallenge      = true;
                    }
                    else
                    {
                        this._desiredState          = ArcadeState.ViewSpecialChallenge;
                        this._hud.launchChallenge   = false;
                        this._launchedChallenge     = false;
                        this._afterChallenge        = true;
                        this.launchSpecialChallenge = false;
                    }
                }
                else
                {
                    if (this._state == ArcadeState.UnlockMachine)
                    {
                        return;
                    }
                    if (this._state == ArcadeState.Normal)
                    {
                        this._unlockMachines.Clear();
                        foreach (ArcadeMachine challenge in this._challenges)
                        {
                            if (challenge.CheckUnlocked())
                            {
                                this._unlockMachines.Add(challenge);
                            }
                        }
                        if (this._unlockMachines.Count > 0)
                        {
                            this._desiredState = ArcadeState.UnlockMachine;
                        }
                        else
                        {
                            if (!this.basementWasUnlocked && Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]))
                            {
                                this.spawnKey            = true;
                                this.basementWasUnlocked = true;
                            }
                            this._duck.active = true;
                        }
                    }
                    else if (this._state == ArcadeState.ViewSpecialChallenge)
                    {
                        this._duck.active = false;
                        if (this._afterChallenge)
                        {
                            Music.Play("Arcade");
                            this._afterChallenge = false;
                            HUD.AddCornerCounter(HUDCorner.TopLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
                            Chancy.afterChallenge     = true;
                            Chancy.afterChallengeWait = 1f;
                        }
                        else
                        {
                            HUD.AddCornerControl(HUDCorner.BottomLeft, "ACCEPT@SELECT@");
                            HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@CANCEL");
                            HUD.AddCornerCounter(HUDCorner.TopLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
                        }
                        this._duck.active = false;
                    }
                    else if (this._state == ArcadeState.ViewProfileSelector)
                    {
                        this._duck.active = false;
                        ArcadeHatConsole arcadeHatConsole = (ArcadeHatConsole)Level.First <ArcadeHatConsole>();
                        if (arcadeHatConsole == null)
                        {
                            return;
                        }
                        HUD.CloseAllCorners();
                        arcadeHatConsole.Open();
                    }
                    else if (this._state == ArcadeState.ViewChallengeList)
                    {
                        this._duck.active = false;
                        HUD.AddCornerControl(HUDCorner.BottomLeft, "ACCEPT@SELECT@");
                        HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@BACK");
                    }
                    else
                    {
                        if (this._state != ArcadeState.UnlockScreen)
                        {
                            return;
                        }
                        this.basementWasUnlocked = Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]);
                        this._unlockScreen.MakeActive();
                        this._duck.active = false;
                    }
                }
            }
            else if (this._state == ArcadeState.Normal || this._state == ArcadeState.UnlockMachine)
            {
                Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
                Layer.Background.fade = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
                this._hud.alpha       = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                if (this._state == ArcadeState.Normal)
                {
                    object obj = (object)null;
                    foreach (ArcadeMachine challenge in this._challenges)
                    {
                        double length = (double)(this._duck.position - challenge.position).length;
                        if (challenge.hover)
                        {
                            obj = (object)challenge;
                            if (Input.Pressed("SHOOT"))
                            {
                                this._hud.activeChallengeGroup = challenge.data;
                                this._desiredState             = ArcadeState.ViewChallenge;
                                this._followCam.manualViewSize = this._followCam.viewSize;
                                this._followCam.Clear();
                                this._followCam.Add((Thing)challenge);
                                HUD.CloseAllCorners();
                                this._hoverMachine = (ArcadeMachine)null;
                                this._hoverThing   = (object)null;
                                return;
                            }
                        }
                        if (this._prizeTable.hover)
                        {
                            obj = (object)this._prizeTable;
                            if (Input.Pressed("SHOOT"))
                            {
                                this._desiredState             = ArcadeState.UnlockScreen;
                                this._followCam.manualViewSize = this._followCam.viewSize;
                                this._followCam.Clear();
                                this._followCam.Add((Thing)this._prizeTable);
                                HUD.CloseAllCorners();
                                this._hoverMachine = (ArcadeMachine)null;
                                this._hoverThing   = (object)null;
                                return;
                            }
                        }
                    }
                    if (Chancy.hover && Input.Pressed("SHOOT"))
                    {
                        this._desiredState = ArcadeState.ViewSpecialChallenge;
                        HUD.CloseAllCorners();
                        this._hoverMachine        = (ArcadeMachine)null;
                        this._hoverThing          = (object)null;
                        Chancy.hover              = false;
                        Chancy.lookingAtChallenge = true;
                        Chancy.OpenChallengeView();
                    }
                    else
                    {
                        ArcadeHatConsole arcadeHatConsole = (ArcadeHatConsole)Level.First <ArcadeHatConsole>();
                        if (arcadeHatConsole != null && Input.Pressed("SHOOT") && arcadeHatConsole.hover)
                        {
                            this._desiredState = ArcadeState.ViewProfileSelector;
                            HUD.CloseAllCorners();
                            this._hoverMachine = (ArcadeMachine)null;
                            this._hoverThing   = (object)null;
                        }
                        else
                        {
                            Chancy.hover = false;
                            if (!Chancy.atCounter)
                            {
                                if ((double)(this._duck.position - Chancy.standingPosition).length < 22.0)
                                {
                                    obj          = (object)Chancy.context;
                                    Chancy.hover = true;
                                }
                                if ((double)Chancy.standingPosition.x < (double)Layer.Game.camera.left - 16.0 || (double)Chancy.standingPosition.x > (double)Layer.Game.camera.right + 16.0 || ((double)Chancy.standingPosition.y < (double)Layer.Game.camera.top - 16.0 || (double)Chancy.standingPosition.y > (double)Layer.Game.camera.bottom + 16.0))
                                {
                                    Chancy.atCounter       = true;
                                    Chancy.activeChallenge = (ChallengeData)null;
                                }
                            }
                            else if (this._prizeTable.hoverChancyChallenge)
                            {
                                obj = (object)this._arcade;
                                if (Input.Pressed("SHOOT"))
                                {
                                    this._desiredState = ArcadeState.ViewChallengeList;
                                    HUD.CloseAllCorners();
                                    Chancy.OpenChallengeList();
                                    this._hoverMachine   = (ArcadeMachine)null;
                                    this._hoverThing     = (object)null;
                                    Chancy.hover         = false;
                                    Chancy.lookingAtList = true;
                                    return;
                                }
                            }
                            if (this._hoverThing == obj)
                            {
                                return;
                            }
                            HUD.CloseAllCorners();
                            this._hoverThing   = obj;
                            this._hoverMachine = !(this._hoverThing is ArcadeMachine) ? (ArcadeMachine)null : obj as ArcadeMachine;
                            if (this._hoverMachine != null)
                            {
                                HUD.AddCornerControl(HUDCorner.BottomLeft, "PLAY@SHOOT@");
                                string text = this._hoverMachine.data.name + " ";
                                foreach (string challenge1 in this._hoverMachine.data.challenges)
                                {
                                    ChallengeData challenge2 = Challenges.GetChallenge(challenge1);
                                    if (challenge2 != null)
                                    {
                                        ChallengeSaveData saveData = Challenges.GetSaveData(challenge2.levelID, this._duck.profile);
                                        if (saveData.trophy == TrophyType.Baseline)
                                        {
                                            text += "@BASELINE@";
                                        }
                                        else if (saveData.trophy == TrophyType.Bronze)
                                        {
                                            text += "@BRONZE@";
                                        }
                                        else if (saveData.trophy == TrophyType.Silver)
                                        {
                                            text += "@SILVER@";
                                        }
                                        else if (saveData.trophy == TrophyType.Gold)
                                        {
                                            text += "@GOLD@";
                                        }
                                        else if (saveData.trophy == TrophyType.Platinum)
                                        {
                                            text += "@PLATINUM@";
                                        }
                                        else if (saveData.trophy == TrophyType.Developer)
                                        {
                                            text += "@DEVELOPER@";
                                        }
                                    }
                                }
                                HUD.AddCornerMessage(HUDCorner.TopLeft, text);
                            }
                            else if (this._prizeTable.hover)
                            {
                                if (this._prizeTable.hoverChancyChallenge)
                                {
                                    HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@VIEW CHALLENGES");
                                }
                                else
                                {
                                    HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@SPEND TICKETS");
                                    HUD.AddCornerCounter(HUDCorner.BottomLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
                                }
                            }
                            else
                            {
                                switch (obj)
                                {
                                case ArcadeMode _:
                                    if (!this._prizeTable.hoverChancyChallenge)
                                    {
                                        break;
                                    }
                                    HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@VIEW CHALLENGES");
                                    break;

                                case Chancy _:
                                    HUD.AddCornerControl(HUDCorner.BottomLeft, "CHANCY@SHOOT@");
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (this._state != ArcadeState.UnlockMachine)
                    {
                        return;
                    }
                    this._unlockMachineWait   -= 0.02f;
                    Layer.Lighting2.targetFade = Lerp.Float(Layer.Lighting2.targetFade, 0.5f, 0.01f);
                    if ((double)this._unlockMachineWait >= 0.0)
                    {
                        return;
                    }
                    if (this._unlockingMachine)
                    {
                        this._unlockingMachine = false;
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._unlockMachines[0]);
                        this._unlockMachineWait = 1f;
                    }
                    else if (this._unlockMachines.Count > 0)
                    {
                        this._unlockMachines[0].unlocked = true;
                        this._unlockMachines.RemoveAt(0);
                        this._unlockingMachine = this._unlockMachines.Count > 0;
                        SFX.Play("lightTurnOn", pitch: Rando.Float(-0.1f, 0.1f));
                        this._unlockMachineWait    = 1f;
                        Layer.Lighting2.targetFade = 1f;
                    }
                    else
                    {
                        this._desiredState = ArcadeState.Normal;
                    }
                }
            }
            else if (this._state == ArcadeState.ViewChallenge)
            {
                Graphics.fade         = Lerp.Float(Graphics.fade, 1f, 0.05f);
                Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
                Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
                this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.05f);
                if (!this._hud.quitOut)
                {
                    return;
                }
                this._hud.quitOut  = false;
                this._desiredState = ArcadeState.Normal;
                if (Chancy.activeChallenge != null)
                {
                    return;
                }
                List <ChallengeData> chancyChallenges = Challenges.GetEligibleIncompleteChancyChallenges(Profiles.active[0]);
                if (chancyChallenges.Count <= 0)
                {
                    return;
                }
                Vec2          position      = this._duck.position;
                ArcadeMachine arcadeMachine = Level.Nearest <ArcadeMachine>(this._duck.x, this._duck.y);
                if (arcadeMachine != null)
                {
                    position = arcadeMachine.position;
                }
                chancyChallenges.OrderBy <ChallengeData, int>((Func <ChallengeData, int>)(v => v.GetRequirementValue()));
                Chancy.AddProposition(chancyChallenges[chancyChallenges.Count - 1], position);
            }
            else if (this._state == ArcadeState.UnlockScreen)
            {
                if (!this._unlockScreen.quitOut)
                {
                    return;
                }
                this._unlockScreen.quitOut = false;
                this._desiredState         = ArcadeState.Normal;
            }
            else if (this._state == ArcadeState.ViewSpecialChallenge)
            {
                if (!this.launchSpecialChallenge)
                {
                    Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.05f);
                    if (Input.Pressed("QUACK"))
                    {
                        if (this.returnToChallengeList)
                        {
                            this._desiredState   = ArcadeState.ViewChallengeList;
                            Chancy.hover         = false;
                            Chancy.lookingAtList = true;
                        }
                        else
                        {
                            this._desiredState = ArcadeState.Normal;
                        }
                        Chancy.lookingAtChallenge = false;
                        HUD.CloseAllCorners();
                        SFX.Play("consoleCancel");
                    }
                    else
                    {
                        if (!Input.Pressed("SELECT"))
                        {
                            return;
                        }
                        this.launchSpecialChallenge = true;
                        SFX.Play("consoleSelect");
                    }
                }
                else
                {
                    Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.05f);
                    if ((double)Graphics.fade >= 0.00999999977648258)
                    {
                        return;
                    }
                    this._hud.launchChallenge = true;
                    this._hud.selected        = new ChallengeCard(0.0f, 0.0f, Chancy.activeChallenge);
                    HUD.CloseAllCorners();
                }
            }
            else if (this._state == ArcadeState.ViewChallengeList)
            {
                Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.05f);
                if (Input.Pressed("QUACK"))
                {
                    this._desiredState        = ArcadeState.Normal;
                    Chancy.lookingAtChallenge = false;
                    Chancy.lookingAtList      = false;
                    HUD.CloseAllCorners();
                    SFX.Play("consoleCancel");
                }
                else
                {
                    if (!Input.Pressed("SELECT"))
                    {
                        return;
                    }
                    Chancy.AddProposition(Chancy.selectedChallenge, Chancy.standingPosition);
                    this.returnToChallengeList = true;
                    this._desiredState         = ArcadeState.ViewSpecialChallenge;
                    HUD.CloseAllCorners();
                    this._hoverMachine        = (ArcadeMachine)null;
                    this._hoverThing          = (object)null;
                    Chancy.hover              = false;
                    Chancy.lookingAtChallenge = true;
                    Chancy.lookingAtList      = false;
                    Chancy.OpenChallengeView();
                }
            }
            else
            {
                if (this._state != ArcadeState.ViewProfileSelector)
                {
                    return;
                }
                Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.05f);
                ArcadeHatConsole arcadeHatConsole = (ArcadeHatConsole)Level.First <ArcadeHatConsole>();
                if (arcadeHatConsole == null || arcadeHatConsole.IsOpen())
                {
                    return;
                }
                foreach (ArcadeMachine challenge in this._challenges)
                {
                    challenge.unlocked = challenge.CheckUnlocked(false);
                }
                this._unlockMachines.Clear();
                this.UpdateDefault();
                this._desiredState = ArcadeState.Normal;
            }
        }
 public override void Update()
 {
     this.backgroundColor = Color.Black;
     if (UnlockScreen.open || ArcadeHUD.open)
     {
         this._background.visible = false;
         foreach (Thing challenge in this._challenges)
         {
             challenge.visible = false;
         }
         this._prizeTable.visible = false;
     }
     else
     {
         this._background.visible = true;
         foreach (Thing challenge in this._challenges)
         {
             challenge.visible = true;
         }
         this._prizeTable.visible = true;
     }
     if (this._state == this._desiredState && this._state != ArcadeState.UnlockMachine && this._state != ArcadeState.LaunchChallenge)
     {
         if (!this._quitting)
         {
             if (Input.Pressed("START"))
             {
                 this._pauseGroup.Open();
                 this._pauseMenu.Open();
                 MonoMain.pauseMenu = this._pauseGroup;
                 if (!this._paused)
                 {
                     Music.Pause();
                     SFX.Play("pause", 0.6f);
                     this._paused           = true;
                     this._duck.immobilized = true;
                 }
                 this.simulatePhysics = false;
                 return;
             }
             if (this._paused && MonoMain.pauseMenu == null)
             {
                 this._paused = false;
                 SFX.Play("resume", 0.6f);
                 if (this._quit.value)
                 {
                     this._quitting = true;
                 }
                 else
                 {
                     Music.Resume();
                     this._duck.immobilized = false;
                     this.simulatePhysics   = true;
                 }
             }
         }
         else
         {
             Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.02f);
             if ((double)Graphics.fade <= 0.00999999977648258)
             {
                 Level.current = (Level) new TitleScreen();
             }
         }
     }
     if (this._paused)
     {
         return;
     }
     this._hud.Update();
     if (this._hud.launchChallenge)
     {
         this._desiredState = ArcadeState.LaunchChallenge;
     }
     if (this._desiredState != this._state)
     {
         this._duck.active = false;
         bool flag = false;
         if (this._desiredState == ArcadeState.ViewChallenge)
         {
             this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
             this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
             if ((double)this._followCam.manualViewSize < 30.0)
             {
                 Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.08f);
                 if ((double)this._followCam.manualViewSize < 3.0 && (double)this._hud.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                 {
                     flag = true;
                 }
             }
         }
         else if (this._desiredState == ArcadeState.Normal)
         {
             if (!this._flipState)
             {
                 this._followCam.Clear();
                 this._followCam.Add((Thing)this._duck);
                 HUD.CloseAllCorners();
             }
             this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
             if (this._state == ArcadeState.ViewChallenge || this._state == ArcadeState.UnlockScreen)
             {
                 this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
             }
             Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
             this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
             if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
             {
                 flag = true;
                 this._followCam.manualViewSize = -1f;
                 this._duck.alpha = 1f;
             }
         }
         else if (this._desiredState == ArcadeState.UnlockMachine)
         {
             if (!this._flipState)
             {
                 this._followCam.Clear();
                 this._followCam.Add((Thing)this._unlockMachines[0]);
                 HUD.CloseAllCorners();
             }
             if (this._state == ArcadeState.ViewChallenge)
             {
                 this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
             }
             this._duck.alpha         = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
             Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
             this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
             this._unlockMachineWait  = 1f;
             if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
             {
                 flag = true;
                 this._followCam.manualViewSize = -1f;
                 this._duck.alpha = 1f;
             }
         }
         else if (this._desiredState == ArcadeState.LaunchChallenge)
         {
             if (!this._flipState)
             {
                 HUD.CloseAllCorners();
             }
             Music.volume             = Lerp.Float(Music.volume, 0.0f, 0.01f);
             this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.02f);
             this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
             if ((double)this._hud.alpha == 0.0)
             {
                 flag = true;
             }
         }
         if (this._desiredState == ArcadeState.UnlockScreen)
         {
             this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
             this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
             if ((double)this._followCam.manualViewSize < 30.0)
             {
                 Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 1f, 0.08f);
                 if ((double)this._followCam.manualViewSize < 3.0 && (double)this._unlockScreen.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                 {
                     flag = true;
                 }
             }
         }
         this._flipState = true;
         if (this._launchedChallenge)
         {
             Layer.Background.fade = 0.0f;
             Layer.Game.fade       = 0.0f;
         }
         if (!flag)
         {
             return;
         }
         this._flipState = false;
         HUD.CloseAllCorners();
         this._state = this._desiredState;
         if (this._state == ArcadeState.ViewChallenge)
         {
             if (this._afterChallenge)
             {
                 Music.Play(nameof(Arcade));
                 this._afterChallenge = false;
             }
             this._hud.MakeActive();
             this._duck.active = false;
         }
         else if (this._state == ArcadeState.LaunchChallenge)
         {
             Arcade.currentArcade = this;
             foreach (Thing thing in this.things[typeof(ChallengeConfetti)])
             {
                 Level.Remove(thing);
             }
             Music.Stop();
             Level.current             = (Level) new ChallengeLevel(this._hud.selected.challenge.fileName);
             this._desiredState        = ArcadeState.ViewChallenge;
             this._hud.launchChallenge = false;
             this._launchedChallenge   = false;
             this._afterChallenge      = true;
         }
         else
         {
             if (this._state == ArcadeState.UnlockMachine)
             {
                 return;
             }
             if (this._state == ArcadeState.Normal)
             {
                 this._unlockMachines.Clear();
                 foreach (ArcadeMachine challenge in this._challenges)
                 {
                     if (challenge.CheckUnlocked())
                     {
                         this._unlockMachines.Add(challenge);
                     }
                 }
                 if (this._unlockMachines.Count > 0)
                 {
                     this._desiredState = ArcadeState.UnlockMachine;
                 }
                 else
                 {
                     this._duck.active = true;
                 }
             }
             else if (this._state == ArcadeState.UnlockScreen)
             {
                 this._unlockScreen.MakeActive();
                 this._duck.active = false;
             }
             else
             {
                 if (this._state != ArcadeState.ViewSpecialChallenge)
                 {
                     return;
                 }
                 if (this._afterChallenge)
                 {
                     Music.Play(nameof(Arcade));
                     this._afterChallenge = false;
                 }
                 Chancy.afterChallenge     = true;
                 Chancy.afterChallengeWait = 1f;
                 this._duck.active         = false;
             }
         }
     }
     else if (this._state == ArcadeState.Normal || this._state == ArcadeState.UnlockMachine)
     {
         Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
         Layer.Background.fade = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
         this._hud.alpha       = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
         if (this._state == ArcadeState.Normal)
         {
             object obj = (object)null;
             foreach (ArcadeMachine challenge in this._challenges)
             {
                 double length = (double)(this._duck.position - challenge.position).length;
                 if (challenge.hover)
                 {
                     obj = (object)challenge;
                     if (Input.Pressed("SHOOT"))
                     {
                         this._hud.activeChallengeGroup = challenge.data;
                         this._desiredState             = ArcadeState.ViewChallenge;
                         this._followCam.manualViewSize = this._followCam.viewSize;
                         this._followCam.Clear();
                         this._followCam.Add((Thing)challenge);
                         HUD.CloseAllCorners();
                         this._hoverMachine = (ArcadeMachine)null;
                         this._hoverThing   = (object)null;
                         return;
                     }
                 }
                 if (this._prizeTable.hover)
                 {
                     obj = (object)this._prizeTable;
                     if (Input.Pressed("SHOOT"))
                     {
                         this._desiredState             = ArcadeState.UnlockScreen;
                         this._followCam.manualViewSize = this._followCam.viewSize;
                         this._followCam.Clear();
                         this._followCam.Add((Thing)this._prizeTable);
                         HUD.CloseAllCorners();
                         this._hoverMachine = (ArcadeMachine)null;
                         this._hoverThing   = (object)null;
                         return;
                     }
                 }
             }
             if (this._hoverThing == obj)
             {
                 return;
             }
             HUD.CloseAllCorners();
             this._hoverThing   = obj;
             this._hoverMachine = !(this._hoverThing is ArcadeMachine) ? (ArcadeMachine)null : obj as ArcadeMachine;
             if (this._hoverMachine != null)
             {
                 HUD.AddCornerControl(HUDCorner.BottomLeft, "PLAY@SHOOT@", this._duck.inputProfile);
                 string text = this._hoverMachine.data.name + " ";
                 foreach (string challenge in this._hoverMachine.data.challenges)
                 {
                     ChallengeSaveData saveData = Challenges.GetSaveData(Challenges.GetChallenge(challenge).levelID, this._duck.profile);
                     if (saveData.trophy == TrophyType.Baseline)
                     {
                         text += "@BASELINE@";
                     }
                     else if (saveData.trophy == TrophyType.Bronze)
                     {
                         text += "@BRONZE@";
                     }
                     else if (saveData.trophy == TrophyType.Silver)
                     {
                         text += "@SILVER@";
                     }
                     else if (saveData.trophy == TrophyType.Gold)
                     {
                         text += "@GOLD@";
                     }
                     else if (saveData.trophy == TrophyType.Platinum)
                     {
                         text += "@PLATINUM@";
                     }
                     else if (saveData.trophy == TrophyType.Developer)
                     {
                         text += "@DEVELOPER@";
                     }
                 }
                 HUD.AddCornerMessage(HUDCorner.TopLeft, text);
             }
             else
             {
                 if (!this._prizeTable.hover)
                 {
                     return;
                 }
                 HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@SPEND TICKETS", this._duck.inputProfile);
                 HUD.AddCornerCounter(HUDCorner.BottomLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
             }
         }
         else
         {
             if (this._state != ArcadeState.UnlockMachine)
             {
                 return;
             }
             this._unlockMachineWait -= 0.02f;
             if ((double)this._unlockMachineWait >= 0.0)
             {
                 return;
             }
             if (this._unlockingMachine)
             {
                 this._unlockingMachine = false;
                 this._followCam.Clear();
                 this._followCam.Add((Thing)this._unlockMachines[0]);
                 this._unlockMachineWait = 1f;
             }
             else if (this._unlockMachines.Count > 0)
             {
                 this._unlockMachines[0].unlocked = true;
                 this._unlockMachines.RemoveAt(0);
                 this._unlockingMachine = this._unlockMachines.Count > 0;
                 SFX.Play("lightTurnOn", pitch: Rando.Float(-0.1f, 0.1f));
                 this._unlockMachineWait = 1f;
             }
             else
             {
                 this._desiredState = ArcadeState.Normal;
             }
         }
     }
     else if (this._state == ArcadeState.ViewChallenge)
     {
         Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
         Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
         this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.05f);
         if (!this._hud.quitOut)
         {
             return;
         }
         this._hud.quitOut  = false;
         this._desiredState = ArcadeState.Normal;
     }
     else
     {
         if (this._state != ArcadeState.UnlockScreen || !this._unlockScreen.quitOut)
         {
             return;
         }
         this._unlockScreen.quitOut = false;
         this._desiredState         = ArcadeState.Normal;
     }
 }
        public override void Update()
        {
            int num = (int)this._selection;

            if (this._desiredScreen != this._screen)
            {
                this._fade = Lerp.Float(this._fade, 0.0f, 0.06f);
                if ((double)this._fade <= 0.0)
                {
                    this._screen = this._desiredScreen;
                    if (this._screen == LockerScreen.Stats)
                    {
                        this._statScroll = 0.0f;
                        HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@");
                        HUD.AddCornerMessage(HUDCorner.TopLeft, this._profile.name);
                        HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@BACK");
                    }
                    else if (this._screen == LockerScreen.Trophies)
                    {
                        this._statScroll = 0.0f;
                        HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@");
                        HUD.AddCornerMessage(HUDCorner.TopLeft, "TROPHIES");
                        HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@BACK");
                    }
                    else if (this._screen == LockerScreen.Locker)
                    {
                        HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@");
                        HUD.AddCornerMessage(HUDCorner.TopLeft, "LOCKER ROOM");
                        HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@EXIT");
                    }
                    else if (this._screen == LockerScreen.Exit)
                    {
                        Graphics.fade = 0.0f;
                        Level.current = (Level) new DoorRoom(this._profile);
                    }
                }
            }
            else
            {
                this._fade = Lerp.Float(this._fade, 1f, 0.06f);
                if (this._screen == LockerScreen.Locker)
                {
                    if (InputProfile.active.Pressed("LEFT"))
                    {
                        --num;
                        if (num < 0)
                        {
                            num = 1;
                        }
                    }
                    if (InputProfile.active.Pressed("RIGHT"))
                    {
                        ++num;
                        if (num >= 2)
                        {
                            num = 0;
                        }
                    }
                    this._selection = (LockerSelection)num;
                    if (InputProfile.active.Pressed("SELECT"))
                    {
                        if (this._selection == LockerSelection.Stats)
                        {
                            this._desiredScreen = LockerScreen.Stats;
                            HUD.CloseAllCorners();
                        }
                        if (this._selection == LockerSelection.Trophies)
                        {
                            this._desiredScreen = LockerScreen.Trophies;
                            HUD.CloseAllCorners();
                        }
                    }
                    if (InputProfile.active.Pressed("QUACK"))
                    {
                        this._desiredScreen = LockerScreen.Exit;
                        HUD.CloseAllCorners();
                    }
                }
                else if (this._screen == LockerScreen.Stats)
                {
                    if (InputProfile.active.Down("UP"))
                    {
                        this._statScroll -= 0.02f;
                        if ((double)this._statScroll < 0.0)
                        {
                            this._statScroll = 0.0f;
                        }
                    }
                    if (InputProfile.active.Down("DOWN"))
                    {
                        this._statScroll += 0.02f;
                        if ((double)this._statScroll > 1.0)
                        {
                            this._statScroll = 1f;
                        }
                    }
                    if (InputProfile.active.Pressed("QUACK"))
                    {
                        this._desiredScreen = LockerScreen.Exit;
                        HUD.CloseAllCorners();
                    }
                    if (this._clearStats.value)
                    {
                        this._clearStats.value = false;
                        this._profile.stats    = new ProfileStats();
                        Profiles.Save(this._profile);
                        Level.current = (Level) new LockerRoom(this._profile);
                    }
                    if (InputProfile.active.Pressed("GRAB"))
                    {
                        MonoMain.pauseMenu = this._confirmGroup;
                        this._confirmGroup.Open();
                        this._confirmMenu.Open();
                    }
                }
                else if (this._screen == LockerScreen.Trophies && InputProfile.active.Pressed("QUACK"))
                {
                    this._desiredScreen = LockerScreen.Locker;
                    HUD.CloseAllCorners();
                }
            }
            base.Update();
        }
        public override void Initialize()
        {
            this._background     = new Sprite("gym");
            this._boardHighlight = new Sprite("boardHighlight");
            this._boardHighlight.CenterOrigin();
            this._trophiesHighlight = new Sprite("trophiesHighlight");
            this._trophiesHighlight.CenterOrigin();
            HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@");
            HUD.AddCornerMessage(HUDCorner.TopLeft, this._profile.name);
            HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@EXIT");
            HUD.AddCornerControl(HUDCorner.BottomRight, "@GRAB@RESET");
            this.backgroundColor = Color.Black;
            this._confirmGroup   = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f);
            this._confirmMenu    = new UIMenu("CLEAR STATS?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT");
            this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCloseMenu(this._confirmGroup)), true);
            this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._confirmGroup, this._clearStats)), true);
            this._confirmMenu.Close();
            this._confirmGroup.Add((UIComponent)this._confirmMenu, false);
            this._confirmGroup.Close();
            Level.Add((Thing)this._confirmGroup);
            Profile profile = this._profile;

            this._stats.Add(new LockerStat("KILLS: " + Change.ToString((object)profile.stats.kills), Color.GreenYellow));
            this._stats.Add(new LockerStat("DEATHS: " + Change.ToString((object)profile.stats.timesKilled), Color.Red));
            this._stats.Add(new LockerStat("SUICIDES: " + Change.ToString((object)profile.stats.suicides), Color.Red));
            this._stats.Add(new LockerStat("", Color.Red));
            this._stats.Add(new LockerStat("ROUNDS WON: " + Change.ToString((object)profile.stats.matchesWon), Color.GreenYellow));
            this._stats.Add(new LockerStat("ROUNDS LOST: " + Change.ToString((object)(profile.stats.timesSpawned - profile.stats.matchesWon)), Color.Red));
            this._stats.Add(new LockerStat("GAMES WON: " + Change.ToString((object)profile.stats.trophiesWon), Color.GreenYellow));
            this._stats.Add(new LockerStat("GAMES LOST: " + Change.ToString((object)(profile.stats.gamesPlayed - profile.stats.trophiesWon)), Color.Red));
            this._stats.Add(new LockerStat("", Color.Red));
            this._stats.Add(new LockerStat("FANS: " + Change.ToString((object)profile.stats.GetFans()), Color.Lime));
            int fans = profile.stats.GetFans();
            int num1 = 0;

            if (fans > 0)
            {
                num1 = (int)Math.Round((double)profile.stats.loyalFans / (double)profile.stats.GetFans() * 100.0);
            }
            this._stats.Add(new LockerStat("FAN LOYALTY: " + Change.ToString((object)num1) + "%", Color.Lime));
            this._stats.Add(new LockerStat("", Color.Red));
            float num2 = 0.0f;

            if (profile.stats.bulletsFired > 0)
            {
                num2 = (float)profile.stats.bulletsThatHit / (float)profile.stats.bulletsFired;
            }
            this._stats.Add(new LockerStat("ACCURACY: " + Change.ToString((object)(int)Math.Round((double)num2 * 100.0)) + "%", (double)num2 > 0.600000023841858 ? Color.Green : Color.Red));
            this._stats.Add(new LockerStat("", Color.Red));
            this._stats.Add(new LockerStat("TIMES QUACKED: " + Change.ToString((object)profile.stats.quacks), Color.Orange));
            this._stats.Add(new LockerStat("MINES STEPPED ON: " + Change.ToString((object)profile.stats.minesSteppedOn), Color.Orange));
            this._stats.Add(new LockerStat("PRESENTS OPENED: " + Change.ToString((object)profile.stats.presentsOpened), Color.Orange));
            this._stats.Add(new LockerStat("", Color.Red));
            this._stats.Add(new LockerStat("SPIRITUALITY", Color.White));
            this._stats.Add(new LockerStat("FUNERALS: " + Change.ToString((object)profile.stats.funeralsPerformed), Color.Orange));
            this._stats.Add(new LockerStat("CONVERSIONS: " + Change.ToString((object)profile.stats.conversions), Color.Orange));
            this._stats.Add(new LockerStat("", Color.Red));
            this._stats.Add(new LockerStat("TIME SPENT", Color.White));
            this._stats.Add(new LockerStat("IN NET: " + Change.ToString((object)(int)profile.stats.timeInNet) + " SECONDS", Color.Orange));
            this._stats.Add(new LockerStat("ON FIRE: " + Change.ToString((object)(int)profile.stats.timeOnFire) + " SECONDS", Color.Orange));
            this._stats.Add(new LockerStat("BRAINWASHED: " + Change.ToString((object)(int)profile.stats.timeUnderMindControl) + " SECONDS", Color.Orange));
            this._stats.Add(new LockerStat("MOUTH OPEN: " + Change.ToString((object)(int)profile.stats.timeWithMouthOpen) + " SECONDS", Color.Orange));
            base.Initialize();
        }