public override void Update() { ChallengeLevel._timer.Update(); if (this._fading) { DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, 0.0f, 0.05f); if ((double)DuckGame.Graphics.fade >= 0.00999999977648258) { return; } if (this._validityTest) { ArcadeTestDialogue.success = this._challenge.wonTrophies.Count > 0 && this._challenge.wonTrophies[0].type == TrophyType.Developer; Level.current = (Level)ArcadeTestDialogue.currentEditor; DuckGame.Graphics.fade = 1f; } else { if (this.things[typeof(EditorTestLevel)].Count <Thing>() > 0) { Level.current = (Level)(this.things[typeof(EditorTestLevel)].First <Thing>() as EditorTestLevel).editor; Music.Stop(); } else { Level.current = Arcade.currentArcade == null ? (Level)ArcadeLevel.currentArcade : (Level)Arcade.currentArcade; } this._fading = false; } } else { if ((double)this._restartMessageWait > 0.0) { this._restartMessageWait -= 0.008f; } else { HUD.CloseCorner(HUDCorner.TopLeft); } if (this._doRestart) { ChallengeLevel.running = false; this._waitForRestart -= 0.04f; if ((double)this._waitForRestart <= 0.0) { this._restarting = true; } } this._waitFade -= 0.04f; if (!this._didFade && (double)this._waitFade <= 0.0 && (double)DuckGame.Graphics.fade < 1.0) { DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, 1f, 0.04f); } else if (this._restarting) { ChallengeLevel.running = false; this.transitionSpeedMultiplier = 2f; EditorTestLevel editorTestLevel = (EditorTestLevel)null; if (this.things[typeof(EditorTestLevel)].Count <Thing>() > 0) { editorTestLevel = this.things[typeof(EditorTestLevel)].First <Thing>() as EditorTestLevel; } Level.current = !(this._level != "") ? (Level) new ChallengeLevel(this._levelData, this._validityTest) : (Level) new ChallengeLevel(this._level); Level.current.transitionSpeedMultiplier = 2f; ((ChallengeLevel)Level.current)._waitSpawn = 0.0f; if (editorTestLevel == null) { return; } Level.current.AddThing((Thing)editorTestLevel); } else { if ((double)this._waitFade > 0.0) { return; } this._didFade = true; if (this._finished) { ChallengeLevel.running = false; this.PauseLogic(); if ((double)this._finishWait > 0.0) { this._finishWait -= 0.01f; } else { if (!this._playedEndMusic) { this._playedEndMusic = true; Level.current.simulatePhysics = false; ArcadeFrame arcadeFrame = (ArcadeFrame)null; if (this._win) { if (ArcadeLevel.currentArcade != null) { arcadeFrame = ArcadeLevel.currentArcade.GetFrame(); if (arcadeFrame != null) { Vec2 renderTargetSize = arcadeFrame.GetRenderTargetSize(); float renderTargetZoom = arcadeFrame.GetRenderTargetZoom(); if (this._captureTarget == null) { this._captureTarget = new RenderTarget2D((int)((double)renderTargetSize.x * 6.0), (int)((double)renderTargetSize.y * 6.0)); } int num = DuckGame.Graphics.width / 320; Camera camera = new Camera(0.0f, 0.0f, (float)this._captureTarget.width * renderTargetZoom, (float)this._captureTarget.height * renderTargetZoom); if (ChallengeLevel._duck != null) { Layer.HUD.visible = false; MonoMain.RenderGame(MonoMain.screenCapture); Layer.HUD.visible = true; Matrix result; Matrix.CreateOrthographicOffCenter(0.0f, (float)MonoMain.screenCapture.width, (float)MonoMain.screenCapture.height, 0.0f, 0.0f, -1f, out result); result.M41 += -0.5f * result.M11; result.M42 += -0.5f * result.M22; Matrix matrix = Level.current.camera.getMatrix(); Vec3 vec3 = (Vec3)DuckGame.Graphics.viewport.Project((Vector3) new Vec3(ChallengeLevel._duck.cameraPosition.x, ChallengeLevel._duck.cameraPosition.y, 0.0f), (Microsoft.Xna.Framework.Matrix)result, (Microsoft.Xna.Framework.Matrix)matrix, (Microsoft.Xna.Framework.Matrix)Matrix.Identity); DuckGame.Graphics.SetRenderTarget(this._captureTarget); camera.center = new Vec2(vec3.x, vec3.y); if ((double)camera.bottom > (double)MonoMain.screenCapture.height) { camera.centerY = (float)MonoMain.screenCapture.height - camera.height / 2f; } if ((double)camera.top < 0.0) { camera.centerY = camera.height / 2f; } if ((double)camera.right > (double)MonoMain.screenCapture.width) { camera.centerX = (float)MonoMain.screenCapture.width - camera.width / 2f; } if ((double)camera.left < 0.0) { camera.centerX = camera.width / 2f; } DuckGame.Graphics.Clear(Color.Black); DuckGame.Graphics.screen.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.DepthRead, RasterizerState.CullNone, (MTEffect)null, camera.getMatrix()); DuckGame.Graphics.Draw((Tex2D)MonoMain.screenCapture, 0.0f, 0.0f); DuckGame.Graphics.screen.End(); DuckGame.Graphics.SetRenderTarget((RenderTarget2D)null); } } } if (this._challenge.wonTrophies.Count > 0 && this._challenge.wonTrophies[0].type == TrophyType.Developer) { SFX.Play("developerWin"); } else { SFX.Play("challengeWin"); } this._showEndTextWait = 1f; } else { SFX.Play("challengeLose"); this._showEndTextWait = 1f; } if (this._challenge.wonTrophies.Count > 0) { this._trophyGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); this._trophyMenu = new UIMenu("@LWING@" + this._challenge.challenge.name + "@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 210f, conString: "@DPAD@MOVE @SELECT@SELECT"); UIDivider uiDivider1 = new UIDivider(false, 0.0f, 6f); UIDivider uiDivider2 = new UIDivider(true, 0.0f); SpriteMap spriteMap = new SpriteMap("challengeTrophy", 70, 65); if (this._challenge.wonTrophies.Count > 0) { if (this._challenge.wonTrophies[0].type == TrophyType.Bronze) { spriteMap.frame = 1; uiDivider2.leftSection.Add((UIComponent) new UIText("BRONZE", Colors.Bronze, UIAlign.Top), true); } else if (this._challenge.wonTrophies[0].type == TrophyType.Silver) { spriteMap.frame = 2; uiDivider2.leftSection.Add((UIComponent) new UIText("SILVER", Colors.Silver, UIAlign.Top), true); } else if (this._challenge.wonTrophies[0].type == TrophyType.Gold) { spriteMap.frame = 3; uiDivider2.leftSection.Add((UIComponent) new UIText("GOLD", Colors.Gold, UIAlign.Top), true); } else if (this._challenge.wonTrophies[0].type == TrophyType.Platinum) { spriteMap.frame = 4; uiDivider2.leftSection.Add((UIComponent) new UIText("PLATINUM", Colors.Platinum, UIAlign.Top), true); } else if (this._challenge.wonTrophies[0].type == TrophyType.Developer) { spriteMap.frame = 5; uiDivider2.leftSection.Add((UIComponent) new UIText("UR THE BEST", Colors.Developer, UIAlign.Top), true); } } uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); bool flag = false; ChallengeSaveData saveData = Challenges.GetSaveData(this.id, ChallengeLevel._duck.profile); int bestTime = saveData.bestTime; if (saveData.bestTime == 0 || (int)(ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0) < saveData.bestTime) { saveData.bestTime = (int)(ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0); } if (this._challenge.wonTrophies[0].type > saveData.trophy) { saveData.trophy = this._challenge.wonTrophies[0].type; if (saveData.trophy > TrophyType.Silver) { flag = true; } } int targets1 = saveData.targets; if (ChallengeLevel.targetsShot > saveData.targets) { saveData.targets = ChallengeLevel.targetsShot; } int targets2 = saveData.targets; if (ChallengeLevel.goodiesGot > saveData.goodies) { saveData.goodies = ChallengeLevel.goodiesGot; } if (this._challenge.challenge.hasTimeRequirements) { uiDivider2.leftSection.Add((UIComponent) new UIText("TIME", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText(MonoMain.TimeString(ChallengeLevel.timer.elapsed, small: true), Color.Lime, UIAlign.Right), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); if (targets1 != 0) { if ((double)bestTime < ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0) { TimeSpan span = TimeSpan.FromMilliseconds(ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0 - (double)bestTime); uiDivider2.leftSection.Add((UIComponent) new UIText("DIFFERENCE", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText("+" + MonoMain.TimeString(span, small: true), Color.Red, UIAlign.Right), true); } else { TimeSpan span = TimeSpan.FromMilliseconds((double)bestTime - ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0); uiDivider2.leftSection.Add((UIComponent) new UIText("DIFFERENCE", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText("-" + MonoMain.TimeString(span, small: true), Color.Lime, UIAlign.Right), true); flag = true; } } else { uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); } } if (saveData.trophy < TrophyType.Gold) { flag = false; } if (this._challenge.challenge.countTargets) { if (this._challenge.challenge.prefix != "" && this._challenge.challenge.prefix != null) { uiDivider2.leftSection.Add((UIComponent) new UIText(this._challenge.challenge.prefix, Color.White, UIAlign.Left), true); } else { uiDivider2.leftSection.Add((UIComponent) new UIText("TARGETS", Color.White, UIAlign.Left), true); } string textVal = Convert.ToString(ChallengeLevel.targetsShot); Color c = Color.Lime; if (targets1 != 0) { if (targets1 < ChallengeLevel.targetsShot) { int num = ChallengeLevel.targetsShot - targets1; c = Color.Lime; textVal = textVal + " (+" + Convert.ToString(num) + ")"; flag = true; } else if (targets1 > ChallengeLevel.targetsShot) { int num = targets1 - ChallengeLevel.targetsShot; c = Color.Red; textVal = textVal + " (-" + Convert.ToString(num) + ")"; } else { c = Color.White; } } uiDivider2.leftSection.Add((UIComponent) new UIText(textVal, c, UIAlign.Right), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); } if (this._challenge.challenge.countGoodies) { if (this._challenge.challenge.prefix != "" && this._challenge.challenge.prefix != null) { uiDivider2.leftSection.Add((UIComponent) new UIText(this._challenge.challenge.prefix, Color.White, UIAlign.Left), true); } else { uiDivider2.leftSection.Add((UIComponent) new UIText("NUMBER", Color.White, UIAlign.Left), true); } string textVal = Convert.ToString(ChallengeLevel.goodiesGot); Color c = Color.Lime; if (targets2 != 0) { if (targets2 < ChallengeLevel.goodiesGot) { int num = ChallengeLevel.goodiesGot - targets2; c = Color.Lime; textVal = textVal + " (+" + Convert.ToString(num) + ")"; flag = true; } else if (targets2 > ChallengeLevel.goodiesGot) { int num = targets2 - ChallengeLevel.goodiesGot; c = Color.Red; textVal = textVal + " (-" + Convert.ToString(num) + ")"; } else { c = Color.White; } } uiDivider2.leftSection.Add((UIComponent) new UIText(textVal, c, UIAlign.Right), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); } uiDivider2.rightSection.Add((UIComponent) new UIImage((Sprite)spriteMap, UIAlign.Right), true); uiDivider1.leftSection.Add((UIComponent)uiDivider2, true); uiDivider1.rightSection.vertical = false; uiDivider1.rightSection.borderSize.y = 2f; if (this._validityTest) { if (this._challenge.wonTrophies.Count > 0 && this._challenge.wonTrophies[0].type == TrophyType.Developer) { uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("CONTINUE ", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._quit), UIAlign.Left), true); } else { uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("RETRY", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._restart), UIAlign.Left), true); } } else { uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("CONTINUE ", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._quit), UIAlign.Left), true); uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("RETRY", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._restart), UIAlign.Left), true); } this._trophyMenu.Add((UIComponent)uiDivider1, true); this._trophyMenu.Close(); this._trophyGroup.Add((UIComponent)this._trophyMenu, false); this._trophyGroup.Close(); Level.Add((Thing)this._trophyGroup); if (arcadeFrame != null && flag && saveData != null) { saveData.frameID = arcadeFrame._identifier; saveData.frameImage = Editor.TextureToString((Texture2D)(Tex2D)this._captureTarget); arcadeFrame.saveData = saveData; } Challenges.Save(this.id); Profiles.Save(ChallengeLevel._duck.profile); } else { this._trophyGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); this._trophyMenu = new UIMenu("@LWING@" + this._challenge.challenge.name + "@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 210f, conString: "@DPAD@MOVE @SELECT@SELECT"); UIDivider uiDivider1 = new UIDivider(false, 0.0f, 6f); UIDivider uiDivider2 = new UIDivider(true, 0.0f); uiDivider2.leftSection.Add((UIComponent) new UIText("FAILED", Color.Red, UIAlign.Top), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.Lime, UIAlign.Right), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); uiDivider2.leftSection.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Left), true); uiDivider2.rightSection.Add((UIComponent) new UIImage((Sprite) new SpriteMap("challengeTrophy", 70, 65) { frame = 0 }, UIAlign.Right), true); uiDivider1.leftSection.Add((UIComponent)uiDivider2, true); uiDivider1.rightSection.vertical = false; uiDivider1.rightSection.borderSize.y = 2f; uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("CONTINUE ", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._quit), UIAlign.Left), true); uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("RETRY", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._restart), UIAlign.Left), true); this._trophyMenu.Add((UIComponent)uiDivider1, true); this._trophyMenu.Close(); this._trophyGroup.Add((UIComponent)this._trophyMenu, false); this._trophyGroup.Add((UIComponent)Options.optionsMenu, false); Options.openOnClose = this._trophyMenu; this._trophyGroup.Close(); Level.Add((Thing)this._trophyGroup); } } if ((double)this._showEndTextWait > 0.0) { this._showEndTextWait -= 0.01f; } else { this._fontFade = 1f; if ((double)this._showResultsWait > 0.0) { this._showResultsWait -= 0.01f; } else if (!this._showedEndMenu) { this._trophyGroup.Open(); this._trophyMenu.Open(); MonoMain.pauseMenu = this._trophyGroup; SFX.Play("pause", 0.6f, -0.2f); this._showedEndMenu = true; } if (this._restart.value) { this._restarting = true; SFX.Play("resume", 0.6f); } else { if (!this._quit.value) { return; } this._fading = true; SFX.Play("resume", 0.6f); } } } } else { this._waitSpawn -= 0.06f; if ((double)this._waitSpawn > 0.0) { return; } if (this._pendingSpawns != null && this._pendingSpawns.Count > 0) { this._waitSpawn = 0.5f; Duck pendingSpawn = this._pendingSpawns[0]; this.AddThing((Thing)pendingSpawn); this._pendingSpawns.RemoveAt(0); Vec3 color = pendingSpawn.profile.persona.color; Level.Add((Thing) new SpawnLine(pendingSpawn.x, pendingSpawn.y, 0, 0.0f, new Color((int)color.x, (int)color.z, (int)color.z), 32f)); Level.Add((Thing) new SpawnLine(pendingSpawn.x, pendingSpawn.y, 0, -4f, new Color((int)color.x, (int)color.y, (int)color.z), 4f)); Level.Add((Thing) new SpawnLine(pendingSpawn.x, pendingSpawn.y, 0, 4f, new Color((int)color.x, (int)color.y, (int)color.z), 4f)); SFX.Play("pullPin", 0.7f); ChallengeLevel._duck = pendingSpawn; this._challenge = this.things[typeof(ChallengeMode)].First <Thing>() as ChallengeMode; ChallengeLevel.random = this._challenge.random.value; this._challenge.duck = pendingSpawn; ChallengeLevel._timer.maxTime = TimeSpan.FromSeconds((double)this._challenge.challenge.trophies[0].timeRequirement); HUD.AddCornerTimer(HUDCorner.BottomRight, "", (Timer)ChallengeLevel._timer); if (this._challenge.challenge.countTargets) { int targets = this._challenge.challenge.trophies[0].targets; HUD.AddCornerCounter(HUDCorner.BottomLeft, "@RETICULE@", new FieldBinding((object)this, "targetsShot"), targets > 0 ? targets : 0); } if (this._challenge.challenge.countGoodies) { MultiMap <System.Type, ISequenceItem> multiMap = new MultiMap <System.Type, ISequenceItem>(); foreach (ISequenceItem element in Level.current.things[typeof(ISequenceItem)]) { System.Type type = element.GetType(); SequenceItem sequence = (element as Thing).sequence; if (sequence.isValid && sequence.type == SequenceItemType.Goody) { multiMap.Add(type, element); } } System.Type key = (System.Type)null; int num = 0; foreach (KeyValuePair <System.Type, List <ISequenceItem> > keyValuePair in (MultiMap <System.Type, ISequenceItem, List <ISequenceItem> >)multiMap) { if (keyValuePair.Value.Count > num) { key = keyValuePair.Key; num = keyValuePair.Value.Count; } } if (key != (System.Type)null) { ISequenceItem sequenceItem = multiMap[key][0]; string text = "@STARGOODY@"; switch (sequenceItem) { case LapGoody _: case InvisiGoody _: text = "@LAPGOODY@"; break; case SuitcaseGoody _: text = "@SUITCASEGOODY@"; break; case Window _: case YellowBarrel _: case Door _: text = "@RETICULE@"; break; } int goodies = this._challenge.challenge.trophies[0].goodies; HUD.AddCornerCounter(HUDCorner.BottomLeft, text, new FieldBinding((object)this, "goodiesGot"), goodies > 0 ? goodies : 0); } } if (this._firstStart) { if (ChallengeLevel.random) { IEnumerable <Thing> thing = this.things[typeof(ISequenceItem)]; if (thing.Count <Thing>() > 0) { thing.ElementAt <Thing>(Rando.Int(thing.Count <Thing>() - 1)).sequence.BeginRandomSequence(); } } else { foreach (TargetDuck targetDuck in this.things[typeof(TargetDuck)]) { if (targetDuck.sequence.order == 0) { targetDuck.sequence.Activate(); } } } this._firstStart = false; } if (!Music.stopped) { return; } if ((string)this._challenge.music == "") { Music.Load("Challenging"); } else if ((string)this._challenge.music == "donutmystery") { Music.Load("spacemystery"); } else { Music.Load(Music.FindSong((string)this._challenge.music)); } } else if (!this._started) { this._waitAfterSpawn -= 0.06f; if ((double)this._waitAfterSpawn > 0.0) { return; } ++this._waitAfterSpawnDings; if (this._waitAfterSpawnDings > 2) { this._started = true; this.simulatePhysics = true; ChallengeLevel.running = true; SFX.Play("ding"); ChallengeLevel._timer.Start(); if (Music.stopped) { Music.PlayLoaded(); } } else { SFX.Play("preStartDing"); } this._waitSpawn = 1.1f; } else { this._fontFade -= 0.1f; if ((double)this._fontFade < 0.0) { this._fontFade = 0.0f; } this.PauseLogic(); } } } } }
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(); } } }
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(); }