Exemplo n.º 1
0
 protected override void OnStart()
 {
     Options.Initialize();
     Global.Initialize();
     Teams.Initialize();
     DuckRig.Initialize();
     Unlocks.Initialize();
     ConnectionStatusUI.Initialize();
     Unlocks.CalculateTreeValues();
     Profiles.Initialize();
     Dialogue.Initialize();
     DuckTitle.Initialize();
     News.Initialize();
     Script.Initialize();
     DuckNews.Initialize();
     VirtualBackground.InitializeBack();
     AmmoType.InitializeTypes();
     DestroyType.InitializeTypes();
     VirtualTransition.Initialize();
     Unlockables.Initialize();
     UIInviteMenu.Initialize();
     LevelGenerator.Initialize();
     DuckFile.CompleteSteamCloudInitializate();
     Main.ResetMatchStuff();
     foreach (Profile profile in Profiles.active)
     {
         profile.RecordPreviousStats();
     }
     Main.editor = new DuckGameEditor();
     foreach (string file in DuckFile.GetFiles(Directory.GetCurrentDirectory(), "*.hat"))
     {
         Team t = Team.Deserialize(file);
         if (t != null)
         {
             Teams.AddExtraTeam(t);
         }
     }
     Main.SetPurchaseDetails(9.99f, "USD");
     if (Main.connectID != 0UL)
     {
         NCSteam.inviteLobbyID = Main.connectID;
         Level.current         = (Level) new JoinServer(Main.connectID);
     }
     else
     {
         Level.current = !MonoMain.noIntro ? (Level) new BIOSScreen() : (!MonoMain.startInEditor ? (Level) new TitleScreen() : (Level)Main.editor);
     }
     this._font = new BitmapFont("biosFont", 8);
     Highlights.StartRound();
 }
Exemplo n.º 2
0
 public void UpdateDefault()
 {
     if (Profiles.IsDefault(Profiles.active[0]))
     {
         InputProfile inputProfile = Profiles.active[0].inputProfile;
         Team         team         = Profiles.active[0].team;
         Profiles.active[0].team              = (Team)null;
         Profiles.DefaultPlayer1.team         = team;
         Profiles.DefaultPlayer1.inputProfile = inputProfile;
     }
     if (Level.current == null)
     {
         return;
     }
     foreach (Door door in Level.current.things[typeof(Door)])
     {
         if (door._lockDoor)
         {
             door.locked = !Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]);
         }
     }
 }
Exemplo n.º 3
0
        public static int GetTicketCount(Profile p)
        {
            int num = 0;

            foreach (KeyValuePair <string, ChallengeData> challenge in Challenges._challenges)
            {
                if (Challenges.challengesInArcade.Contains(challenge.Value))
                {
                    ChallengeSaveData saveData = Challenges.GetSaveData(challenge.Value.levelID, p, true);
                    if (saveData != null)
                    {
                        if (saveData.trophy >= TrophyType.Bronze)
                        {
                            num += Challenges.valueBronze;
                        }
                        if (saveData.trophy >= TrophyType.Silver)
                        {
                            num += Challenges.valueSilver;
                        }
                        if (saveData.trophy >= TrophyType.Gold)
                        {
                            num += Challenges.valueGold;
                        }
                        if (saveData.trophy >= TrophyType.Platinum)
                        {
                            num += Challenges.valuePlatinum;
                        }
                    }
                }
            }
            foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Any))
            {
                if (unlock.ProfileUnlocked(p))
                {
                    num -= unlock.cost;
                }
            }
            return(num);
        }
 public override void Activate()
 {
     TeamSelect2.GetMatchSetting("requiredwins").value = (object)(int)this.winsPerSet;
     TeamSelect2.GetMatchSetting("restsevery").value   = (object)(int)this.roundsPerIntermission;
     TeamSelect2.GetMatchSetting("randommaps").value   = (object)(int)this.randomPercent;
     TeamSelect2.GetMatchSetting("workshopmaps").value = (object)(int)this.workshopPercent;
     TeamSelect2.GetMatchSetting("normalmaps").value   = (object)(int)this.normalPercent;
     TeamSelect2.GetMatchSetting("custommaps").value   = (object)(int)this.customPercent;
     TeamSelect2.GetMatchSetting("wallmode").value     = (object)this.wallmode;
     RockScoreboard.wallMode = this.wallmode;
     TeamSelect2.GetOnlineSetting("teams").value = (object)this.teams;
     TeamSelect2.prevCustomLevels = TeamSelect2.customLevels;
     TeamSelect2.customLevels     = this.customLevels;
     foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier))
     {
         unlock.enabled = this._enabledModifiers.Contains(Unlocks.modifierToByte[unlock.id]);
         if (this.initialSettings)
         {
             unlock.prevEnabled = unlock.enabled;
         }
     }
     GameMode.roundsBetweenIntermission = (int)this.roundsPerIntermission;
     GameMode.winsPerSet = (int)this.winsPerSet;
     TeamSelect2.UpdateModifierStatus();
     if (this.initialSettings)
     {
         foreach (MatchSetting matchSetting in TeamSelect2.matchSettings)
         {
             matchSetting.prevValue = matchSetting.value;
         }
         foreach (MatchSetting onlineSetting in TeamSelect2.onlineSettings)
         {
             onlineSetting.prevValue = onlineSetting.value;
         }
     }
     base.Activate();
 }
        public static void Initialize()
        {
            Unlockables._unlocks.Add((Unlockable) new UnlockableHats("hatpack1", new List <Team>()
            {
                Teams.GetTeam("BAWB"),
                Teams.GetTeam("Frank"),
                Teams.GetTeam("Meeee")
            }, (Func <bool>)(() => Unlocks.IsUnlocked("HATTY1")), "Hat Pack 1", "Check out these nifty cool hats."));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHats("hatpack2", new List <Team>()
            {
                Teams.GetTeam("Pulpy"),
                Teams.GetTeam("Joey"),
                Teams.GetTeam("Cowboys")
            }, (Func <bool>)(() => Unlocks.IsUnlocked("HATTY2")), "Hat Pack 2", "More cool hats! WOW!"));
            bool futz = false;

            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("gamerduck", (Func <bool>)(() => Global.data.timesSpawned > (futz ? 0 : 99)), "Duck Gamer", "Spawn 100 times.", "play100"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("chancyHat", Teams.GetTeam("Chancy"), (Func <bool>)(() => Unlocks.IsUnlocked("ULTIMATE")), "Chancy", "Got platinum on all challenges", "chancy"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("ritual", (Func <bool>)(() => Global.data.timesSpawned > (futz ? 1 : 999)), "Ritual", "Spawn 1000 times.", "play1000"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("skully", Teams.GetTeam("SKULLY"), (Func <bool>)(() => Global.data.kills > (futz ? 3 : 999)), "SKULLY", "Kill 1000 Ducks", "kill1000"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("endurance", (Func <bool>)(() => Global.data.longestMatchPlayed > (futz ? 5 : 49)), "Endurance", "Play through a 50 point match", "endurance"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("outgoing", (Func <bool>)(() => Global.data.onlineWins > (futz ? 0 : 9)), "Outgoing", "Win 10 online matches", "online10"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("basement", (Func <bool>)(() => Unlocks.IsUnlocked("BASEMENTKEY")), "Basement Dweller", "Unlock the basement", "basement"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("poweruser", (Func <bool>)(() => Global.data.customMapPlayCount.Count > (futz ? 0 : 9)), "Power User", "Play on 10 different custom maps", "editor"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("drawbreaker", (Func <bool>)(() => Global.data.drawsPlayed > (futz ? 0 : 9)), "Draw Breaker", "Break 10 draws", "drawbreaker"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("hotstuff", (Func <bool>)(() => (double)Profiles.MostTimeOnFire() > (futz ? 2.0 : 899.0)), "Hot Stuff", "Spend 15 minutes on fire with any one profile", "fire"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("myboy", (Func <bool>)(() => Profiles.experienceProfile != null && Profiles.experienceProfile.numLittleMen > 0), "That's My Boy", "Raise a little man.", "myboy"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("jukebox", (Func <bool>)(() => Profiles.experienceProfile != null && Profiles.experienceProfile.numLittleMen > 7), "Jukebox Hero", "Raise eight little men.", "jukebox"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableAchievement("kingme", (Func <bool>)(() => Profiles.experienceProfile != null && Profiles.experienceProfile.xp >= DuckNetwork.GetLevel(999).xpRequired), "King Me", "Level up all the way.", "kingme"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("ballz", Teams.GetTeam("BALLZ"), (Func <bool>)(() => Global.data.ducksCrushed > (futz ? 0 : 49)), "BALLZ", "Crush 50 Ducks", "crate"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("hearts", Teams.GetTeam("Hearts"), (Func <bool>)(() => Global.data.matchesPlayed > (futz ? 0 : 49)), "<3", "Finish 50 whole matches.", "finish50"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("swackHat", Teams.GetTeam("SWACK"), (Func <bool>)(() => Global.data.matchesPlayed > 0), "SWACK", "Play through a match"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("BRODUCK", Teams.GetTeam("BRODUCK"), (Func <bool>)(() => Global.data.strafeDistance > (futz ? 0.25f : 10f)), "BRODUCK", "Strafe 10 Kilometers"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("astropal", Teams.GetTeam("astropal"), (Func <bool>)(() => Global.data.jetFuelUsed > (futz ? 5f : 200f)), "ASTROPAL", "Burn 200 gallons of rocket fuel."));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("eggpal", Teams.GetTeam("eggpal"), (Func <bool>)(() => Global.data.winsAsSwack > (futz ? 0 : 4)), "EGGPAL", "Win 5 rounds as SWACK"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("brad", Teams.GetTeam("brad"), (Func <bool>)(() => Global.data.disarms > (futz ? 0 : 99)), "BRAD DUNGEON", "Disarm 100 ducks."));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("brick", Teams.GetTeam("BRICK"), (Func <bool>)(() => Global.data.laserBulletsFired > (futz ? 0 : 149)), "BRICK", "Fire 150 laser bullets."));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("ducks", Teams.GetTeam("DUCKS"), (Func <bool>)(() => Global.data.quacks > 999), "DUCK", "Quack 1000 times."));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("funnyman", Teams.GetTeam("FUNNYMAN"), (Func <bool>)(() => Global.data.hatsStolen > 100), "FUNNYMAN", "Wear 100 different faces."));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("wizards", Teams.GetTeam("Wizards"), (Func <bool>)(() => Global.data.angleShots > 25), "Wizard", "Make 25 angle trick shots."));
            string str1 = "CYCLOPS";

            if (Teams.GetTeam(str1) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str1.ToLowerInvariant(), Teams.GetTeam(str1), (Func <bool>)(() => Global.data.boughtHats.Contains("CYCLOPS")), str1, Teams.GetTeam(str1).description));
            }
            string str2 = "MOTHERS";

            if (Teams.GetTeam(str2) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str2.ToLowerInvariant(), Teams.GetTeam(str2), (Func <bool>)(() => Global.data.boughtHats.Contains("MOTHERS")), str2, Teams.GetTeam(str2).description));
            }
            string str3 = "BIG ROBO";

            if (Teams.GetTeam(str3) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str3.ToLowerInvariant(), Teams.GetTeam(str3), (Func <bool>)(() => Global.data.boughtHats.Contains("BIG ROBO")), str3, Teams.GetTeam(str3).description));
            }
            string str4 = "TINCAN";

            if (Teams.GetTeam(str4) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str4.ToLowerInvariant(), Teams.GetTeam(str4), (Func <bool>)(() => Global.data.boughtHats.Contains("TINCAN")), str4, Teams.GetTeam(str4).description));
            }
            string str5 = "WELDERS";

            if (Teams.GetTeam(str5) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str5.ToLowerInvariant(), Teams.GetTeam(str5), (Func <bool>)(() => Global.data.boughtHats.Contains("WELDERS")), str5, Teams.GetTeam(str5).description));
            }
            string str6 = "PONYCAP";

            if (Teams.GetTeam(str6) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str6.ToLowerInvariant(), Teams.GetTeam(str6), (Func <bool>)(() => Global.data.boughtHats.Contains("PONYCAP")), str6, Teams.GetTeam(str6).description));
            }
            string str7 = "TRICORNE";

            if (Teams.GetTeam(str7) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str7.ToLowerInvariant(), Teams.GetTeam(str7), (Func <bool>)(() => Global.data.boughtHats.Contains("TRICORNE")), str7, Teams.GetTeam(str7).description));
            }
            string str8 = "TWINTAIL";

            if (Teams.GetTeam(str8) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str8.ToLowerInvariant(), Teams.GetTeam(str8), (Func <bool>)(() => Global.data.boughtHats.Contains("TWINTAIL")), str8, Teams.GetTeam(str8).description));
            }
            string str9 = "MAJESTY";

            if (Teams.GetTeam(str9) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str9.ToLowerInvariant(), Teams.GetTeam(str9), (Func <bool>)(() => Global.data.boughtHats.Contains("MAJESTY")), str9, "Max out your level (holy crap!!)"));
            }
            string str10 = "MOONWALK";

            if (Teams.GetTeam(str10) != null)
            {
                Unlockables._unlocks.Add((Unlockable) new UnlockableHat(str10.ToLowerInvariant(), Teams.GetTeam(str10), (Func <bool>)(() => Global.data.boughtHats.Contains("MOONWALK")), str10, "Raise 8 little men."));
            }
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("devtimes", Teams.GetTeam("CAPTAIN"), (Func <bool>)(() => ((int)Profile.CalculateLocalFlippers() & 16) != 0), "UR THE BEST", "Thank you for playing Duck Game <3"));
            Unlockables._unlocks.Add((Unlockable) new UnlockableHat("eyebob", Teams.GetTeam("eyebob"), (Func <bool>)(() => Global.data.giantLaserKills > 24), "CHARGE SHOT", "Get 25 Kills With the Giant Death Laser"));
            foreach (Unlockable unlock in Unlockables._unlocks)
            {
                unlock.Initialize();
                if (unlock.CheckCondition())
                {
                    unlock.DoUnlock();
                }
            }
        }
Exemplo n.º 6
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;
            }
        }
Exemplo n.º 7
0
        public override void Initialize()
        {
            TeamSelect2.DefaultSettings();
            base.Initialize();
            this.UpdateDefault();
            bool flag = true;

            foreach (Profile prof in Profiles.active)
            {
                if (flag)
                {
                    flag = false;
                }
                else
                {
                    if (prof.team != null)
                    {
                        prof.team.Leave(prof);
                    }
                    prof.inputProfile = (InputProfile)null;
                }
            }
            this._pendingSpawns = new Deathmatch((Level)this).SpawnPlayers();
            this._pendingSpawns = this._pendingSpawns.OrderBy <Duck, float>((Func <Duck, float>)(sp => sp.x)).ToList <Duck>();
            foreach (Duck pendingSpawn in this._pendingSpawns)
            {
                this.followCam.Add((Thing)pendingSpawn);
                ((ArcadeHatConsole)Level.First <ArcadeHatConsole>())?.MakeHatSelector(pendingSpawn);
            }
            this.followCam.Adjust();
            foreach (ArcadeMachine arcadeMachine in this.things[typeof(ArcadeMachine)])
            {
                this._challenges.Add(arcadeMachine);
            }
            Profiles.active[0].ticketCount = Challenges.GetTicketCount(Profiles.active[0]);
            if (Profiles.active[0].ticketCount < 0)
            {
                Profiles.active[0].ticketCount = 0;
            }
            foreach (ArcadeFrame arcadeFrame in this.things[typeof(ArcadeFrame)])
            {
                this._frames.Add(arcadeFrame);
            }
            foreach (ChallengeSaveData challengeSaveData in Challenges.GetAllSaveData())
            {
                if (challengeSaveData.frameID != "")
                {
                    ArcadeFrame frame = this.GetFrame(challengeSaveData.frameID);
                    if (frame != null)
                    {
                        frame.saveData = challengeSaveData;
                    }
                }
            }
            foreach (ArcadeMachine challenge in this._challenges)
            {
                challenge.unlocked = challenge.CheckUnlocked(false);
            }
            this._hud       = new ArcadeHUD();
            this._hud.alpha = 0.0f;
            Level.Add((Thing)this._hud);
            this._unlockScreen       = new UnlockScreen();
            this._unlockScreen.alpha = 0.0f;
            Level.Add((Thing)this._unlockScreen);
            this._pauseGroup  = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f);
            this._pauseMenu   = new UIMenu("@LWING@CHALLENGE MODE@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@DPAD@MOVE  @SELECT@SELECT");
            this._confirmMenu = new UIMenu("REALLY QUIT?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT");
            UIDivider uiDivider = new UIDivider(true, 0.8f);

            uiDivider.leftSection.Add((UIComponent) new UIMenuItem("RESUME", (UIMenuAction) new UIMenuActionCloseMenu(this._pauseGroup), UIAlign.Left), true);
            uiDivider.leftSection.Add((UIComponent) new UIMenuItem("OPTIONS", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)Options.optionsMenu), UIAlign.Left), true);
            uiDivider.leftSection.Add((UIComponent) new UIMenuItem("QUIT", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)this._confirmMenu), UIAlign.Left), true);
            uiDivider.rightSection.Add((UIComponent) new UIImage("pauseIcons", UIAlign.Right), true);
            this._pauseMenu.Add((UIComponent)uiDivider, true);
            this._pauseMenu.Close();
            this._pauseGroup.Add((UIComponent)this._pauseMenu, false);
            this._pauseGroup.Add((UIComponent)Options.optionsMenu, false);
            Options.openOnClose = this._pauseMenu;
            this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._confirmMenu, (UIComponent)this._pauseMenu)), true);
            this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._quit)), true);
            this._confirmMenu.Close();
            this._pauseGroup.Add((UIComponent)this._confirmMenu, false);
            this._pauseGroup.Close();
            Level.Add((Thing)this._pauseGroup);
            this._prizeTable = this.things[typeof(PrizeTable)].FirstOrDefault <Thing>() as PrizeTable;
            if (this._prizeTable == null)
            {
                this._prizeTable = new PrizeTable(730f, 124f);
            }
            Chancy.activeChallenge    = (ChallengeData)null;
            Chancy.atCounter          = true;
            Chancy.lookingAtChallenge = false;
            Graphics.fade             = 1f;
            this.basementWasUnlocked  = Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]);
            Level.Add((Thing)this._prizeTable);
            Music.Play("Arcade");
        }
Exemplo n.º 8
0
        public static void CalculateTreeValues()
        {
            ArcadeLevel arcadeLevel = new ArcadeLevel(Content.GetLevelID("arcade"));

            arcadeLevel.InitializeMachines();
            int num1 = 0;

            foreach (ArcadeMachine challenge in arcadeLevel._challenges)
            {
                num1 += challenge.data.challenges.Count;
            }
            int num2  = num1 + Challenges.GetAllChancyChallenges().Count;
            int num3  = num2 * Challenges.valueBronze;
            int num4  = num2 * Challenges.valueSilver;
            int num5  = num2 * Challenges.valueGold;
            int num6  = num2 * Challenges.valuePlatinum;
            int num7  = num3;
            int num8  = num3 + num4;
            int num9  = num3 + num4 + num5;
            int num10 = num3 + num4 + num5 + num6;

            Unlocks.bronzeTotalTickets   = num7;
            Unlocks.silverTotalTickets   = num8;
            Unlocks.goldTotalTickets     = num9;
            Unlocks.platinumTotalTickets = num10;
            int num11 = 0;
            int num12 = 0;
            int num13 = 0;
            int num14 = 0;

            foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Any))
            {
                if (unlock.priceTier == UnlockPrice.Cheap)
                {
                    ++num11;
                }
                else if (unlock.priceTier == UnlockPrice.Normal)
                {
                    ++num12;
                }
                else if (unlock.priceTier == UnlockPrice.High)
                {
                    ++num13;
                }
                else if (unlock.priceTier == UnlockPrice.Ridiculous)
                {
                    ++num14;
                }
            }
            int num15 = (int)Math.Round((double)num9 * 0.100000001490116);
            int num16 = (int)Math.Round((double)num9 * 0.300000011920929);
            int num17 = (int)Math.Round((double)num9 * 0.400000005960464);
            int num18 = (int)Math.Round((double)num9 * 0.200000002980232);
            int num19 = (int)Math.Round((double)num15 / (double)num11);
            int num20 = (int)Math.Round((double)num16 / (double)num12);
            int num21 = (int)Math.Round((double)num17 / (double)num13);
            int num22 = (int)Math.Round((double)num18 / (double)num14);

            while (num19 * num11 + num20 * num12 + num21 * num13 + num22 * num14 > num9)
            {
                --num22;
            }
            while (num19 * num11 + num20 * num12 + num21 * num13 + num22 * num14 < num9)
            {
                ++num22;
            }
            foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Any))
            {
                if (unlock.priceTier == UnlockPrice.Cheap)
                {
                    unlock.cost = num19;
                }
                else if (unlock.priceTier == UnlockPrice.Normal)
                {
                    unlock.cost = num20;
                }
                else if (unlock.priceTier == UnlockPrice.High)
                {
                    unlock.cost = num21;
                }
                else if (unlock.priceTier == UnlockPrice.Ridiculous)
                {
                    unlock.cost = num22;
                }
                else if (unlock.priceTier == UnlockPrice.Chancy)
                {
                    unlock.cost = num6;
                }
            }
        }