public UIConnectionInfo(Profile p, UIMenu rootMenu, UIMenu kickMenu) : base(p.name) { this._profile = p; this._littleFont = new BitmapFont("smallBiosFontUI", 7, 5); this.SetFont(this._littleFont); string str1 = "|WHITE|"; if (p.networkIndex == (byte)1) { str1 = "|LIGHTGRAY|"; } else if (p.networkIndex == (byte)2) { str1 = "|DGYELLOW|"; } else if (p.networkIndex == (byte)3) { str1 = "|MENUORANGE|"; } string source1 = p.name; int num1 = source1.Count <char>(); bool flag1 = false; if (p.connection != null && p.connection.isHost) { flag1 = true; ++num1; } int num2 = 17; if (flag1) { num2 = 16; } if (num1 > num2) { source1 = source1.Substring(0, num2 - 1) + "."; num1 = num2; } for (; num1 < num2 + 2; ++num1) { source1 += " "; } if (flag1) { source1 = "@HOSTCROWN@" + source1; } this._nameText = str1 + source1; bool flag2 = false; int num3; if (this._profile.connection != null) { num3 = (int)Math.Round((double)this._profile.connection.manager.ping * 1000.0); flag2 = this._profile.connection.status == ConnectionStatus.Connected; } else { num3 = 1000; } string source2 = num3.ToString() + "|WHITE|MS"; int num4 = source2.Count <char>(); string str2 = num3 >= 150 ? (num3 >= 250 ? (!flag2 ? "|DGRED|" + source2 + "@SIGNALDEAD@" : "|DGRED|" + source2 + "@SIGNALBAD@") : "|DGYELLOW|" + source2 + "@SIGNALNORMAL@") : "|DGGREEN|" + source2 + "@SIGNALGOOD@"; for (; num4 < 5; ++num4) { str2 = " " + str2; } this._textElement.text = str1 + source1 + str2; if (Network.isServer && p.connection != DuckNetwork.localConnection) { this.controlString = "@DPAD@MOVE @GRAB@KICK"; } this._kickMenu = kickMenu; this._rootMenu = rootMenu; }
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"); }
public UIControlConfig( UIMenu openOnClose, string title, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null) : base(title, xpos, ypos, wide, high, conString, conProfile) { this._openOnClose = openOnClose; List <string> stringList1 = new List <string>() { "P1 ", "P2 ", "P3 ", "P4" }; List <string> stringList2 = new List <string>() { "GAMEPAD", "KEYBOARD", "PAD + KEYS" }; BitmapFont bitmapFont = new BitmapFont("smallBiosFontUI", 7, 5); UIBox uiBox = new UIBox(isVisible: false); this._configuringToggle = new UIMenuItemToggle("", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.SwitchConfigType)), new FieldBinding((object)this, nameof(inputConfigType)), multi: this.inputTypes, compressedMulti: true, tiny: true); uiBox.Add((UIComponent)this._configuringToggle, true); UIText uiText1 = new UIText(" ", Color.White); this._controlElements.Add(new UIControlElement("|DGBLUE|{LEFT", "LEFT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|/RIGHT", "RIGHT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|}UP", "UP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|~DOWN", "DOWN", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|START", "START", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|ACCEPT", "SELECT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|JUMP", "JUMP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|GRAB", "GRAB", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|TRIP", "RAGDOLL", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|FIRE", "SHOOT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|STRAFE", "STRAFE", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|QUACK", "QUACK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|L STICK", "LSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|R STICK", "RSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|L TRIGGER", "LTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|R TRIGGER", "RTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); UIMenuItem uiMenuItem = new UIMenuItem("|RED|REVERT TO DEFAULT", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.ResetToDefault))); uiMenuItem.SetFont(bitmapFont); uiBox.Add((UIComponent)uiMenuItem, true); UIText uiText2 = new UIText(" ", Color.White); uiText2.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText2, true); UIText uiText3 = new UIText("PERSONAL CONTROLS CAN BE", Color.White); uiText3.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText3, true); UIText uiText4 = new UIText("SET IN PROFILE SCREEN", Color.White); uiText4.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText4, true); this._controlBox = uiBox; this._playerBoxes.Add(uiBox); this.Add((UIComponent)this._playerBoxes[0], true); this._confirmMenu = new UIMenu("SAVE CHANGES?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenuSaving))), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenu))), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("CANCEL!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._confirmMenu, (UIComponent)this)), true); this._confirmMenu.Close(); }
public override void Initialize() { this._background = new SpriteThing(313f, -40f, new Sprite("arcade/arcadeOuya")); this._background.center = new Vec2(0.0f, 0.0f); this._background.layer = Layer.Background; this._duck = new Duck(730f, 100f, Profiles.active[0]); Level.Add((Thing)this._background); Level.Add((Thing)this._duck); this._followCam.Add((Thing)this._duck); Chancy.Add("SUP MOTHARFUCKAR :P"); Level.Add((Thing) new Block(0.0f, 187f, 295f, 53f)); Level.Add((Thing) new Block(289f, 195f, 14f, 45f)); Level.Add((Thing) new Block(290f, 203f, 190f, 37f)); Level.Add((Thing) new Block(467f, 195f, 17f, 45f)); Level.Add((Thing) new Block(475f, 187f, 217f, 53f)); Level.Add((Thing) new Block(639f, 179f, 32f, 16f)); Level.Add((Thing) new Block(647f, 171f, 32f, 16f)); Level.Add((Thing) new Block(655f, 163f, 32f, 16f)); Level.Add((Thing) new Block(663f, 155f, 32f, 16f)); Level.Add((Thing) new Block(671f, 147f, 32f, 16f)); Level.Add((Thing) new Block(679f, 139f, 124f, 16f)); Level.Add((Thing) new Block(787f, 0.0f, 64f, 300f)); Level.Add((Thing) new Block(-16f, 0.0f, 21f, 300f)); Level.Add((Thing) new Platform(648f, 131f, 12f, 8f)); Level.Add((Thing) new Platform(640f, 123f, 12f, 8f)); Level.Add((Thing) new Platform(632f, 115f, 12f, 8f)); Level.Add((Thing) new Block(624f, 107f, 12f, 8f)); Level.Add((Thing) new Block(616f, 99f, 12f, 8f)); Level.Add((Thing) new Block(-100f, 91f, 720f, 14f)); Level.Add((Thing) new Block(251f, 83f, 268f, 10f)); Level.Add((Thing) new Block(259f, 75f, 252f, 10f)); Level.Add((Thing) new Block(254f, 0.0f, 64f, 300f)); List <Vec2> vec2List = new List <Vec2>() { new Vec2(380f, 186f), new Vec2(520f, 170f), new Vec2(565f, 74f), new Vec2(375f, 58f), new Vec2(455f, 58f) }; Vec2 vec2_1 = vec2List[this._challenges.Count]; Vec2 vec2_2 = vec2List[this._challenges.Count]; ArcadeMachine arcadeMachine1 = new ArcadeMachine(vec2_2.x, vec2_2.y, new ChallengeGroup() { name = "TARGETS", challenges = { "challenge/targets01", "challenge/targets03ouya", "challenge/targets02ouya" }, trophiesRequired = 0 }, 0); arcadeMachine1.lightColor = 2; arcadeMachine1.unlocked = true; Level.Add((Thing)arcadeMachine1); this._challenges.Add(arcadeMachine1); Vec2 vec2_3 = vec2List[this._challenges.Count]; ArcadeMachine arcadeMachine2 = new ArcadeMachine(vec2_3.x, vec2_3.y, new ChallengeGroup() { name = "VARIETY ZONE", challenges = { "challenge/obstacle", "challenge/shootout02", "challenge/jetpack02" }, trophiesRequired = 0 }, 6); arcadeMachine2.lightColor = 1; Level.Add((Thing)arcadeMachine2); this._challenges.Add(arcadeMachine2); Vec2 vec2_4 = vec2List[this._challenges.Count]; ArcadeMachine arcadeMachine3 = new ArcadeMachine(vec2_4.x, vec2_4.y, new ChallengeGroup() { name = "TELEPORTER", challenges = { "challenge/tele02", "challenge/tele01", "challenge/tele03" }, trophiesRequired = 1 }, 4); arcadeMachine3.lightColor = 1; Level.Add((Thing)arcadeMachine3); this._challenges.Add(arcadeMachine3); Vec2 vec2_5 = vec2List[this._challenges.Count]; ArcadeMachine arcadeMachine4 = new ArcadeMachine(vec2_5.x, vec2_5.y, new ChallengeGroup() { name = "WEAPON TRAINING", challenges = { "challenge/magnumouya", "challenge/chaingunouya", "challenge/sniper" }, trophiesRequired = 4 }, 5); arcadeMachine4.lightColor = 2; Level.Add((Thing)arcadeMachine4); this._challenges.Add(arcadeMachine4); Vec2 vec2_6 = vec2List[this._challenges.Count]; ArcadeMachine arcadeMachine5 = new ArcadeMachine(vec2_6.x, vec2_6.y, new ChallengeGroup() { name = "VARIETY ZONE 2", challenges = { "challenge/ball01", "challenge/glass01ouya", "challenge/grapple04" }, trophiesRequired = 9 }, 8); arcadeMachine5.lightColor = 1; Level.Add((Thing)arcadeMachine5); this._challenges.Add(arcadeMachine5); this._prizeTable = new PrizeTable(730f, 124f); Level.Add((Thing)this._prizeTable); this._hud = new ArcadeHUD(); this._hud.alpha = 0.0f; 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); Music.Play(nameof(Arcade)); base.Initialize(); }
public UIGachaBoxNew( float xpos, float ypos, float wide = -1f, float high = -1f, bool rare = false, UIMenu openOnClose = null) : base("", xpos, ypos, wide, high) { this._openOnClose = openOnClose; this._rare = rare; this._duckCoin = new SpriteMap("duckCoin", 18, 18); this._duckCoin.CenterOrigin(); this._gachaMachine = new Sprite("arcade/gotcha/machine"); this._gachaMachine.CenterOrigin(); this._gachaGlass = new Sprite("arcade/gotcha/glass"); this._gachaGlass.CenterOrigin(); this._gachaDoor = new Sprite("arcade/gotcha/door"); this._gachaDoor.CenterOrigin(); this._gachaTwister = new Sprite("arcade/gotcha/twister"); this._gachaTwister.CenterOrigin(); this._gachaBall = new SpriteMap("arcade/gotcha/balls", 40, 42); this._gachaBall.CenterOrigin(); this._gachaTwisterShadow = new Sprite("arcade/gotcha/twisterShadow"); this._gachaTwisterShadow.CenterOrigin(); this._whiteCircle = new Sprite("furni/whiteCircle"); this._whiteCircle.CenterOrigin(); this._coin = new SpriteMap("arcade/gotcha/coin", 22, 22); this._coin.CenterOrigin(); this._coinSlot = new Sprite("arcade/gotcha/coinSlot"); this._coinSlot.CenterOrigin(); this._rainbow = new Sprite("arcade/rainbow"); Graphics.fade = 1f; this._frame = new Sprite("unlockFrame"); this._frame.CenterOrigin(); this._furni = new Sprite("furni/tub"); this._furni.center = new Vec2((float)(this._furni.width / 2), (float)this._furni.height); this._star = new Sprite("prettyStar"); this._star.CenterOrigin(); this._font = new BitmapFont("biosFontUI", 8, 7); this._fancyFont = new FancyBitmapFont("smallFontGacha"); this._gachaEgg = new SpriteMap("gachaEgg", 44, 36); this._capsule = new SpriteMap("arcade/egg", 40, 23); this._capsule.CenterOrigin(); this._capsuleBorder = new SpriteMap("arcade/eggBorder", 66, 65); this._capsuleBorder.CenterOrigin(); this._rare = false; this.numGenerate = MonoMain.core.gachas; this.numGenerateRare = MonoMain.core.rareGachas; for (int index = 0; index < this.numGenerate; ++index) { Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.Common, 1, gacha: true)[0]; furniture.ballRot = Rando.Float(360f); furniture.rareGen = false; this.prizes.Add(furniture); } for (int index = 0; index < this.numGenerateRare; ++index) { Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.VeryVeryRare, 1, 0.4f, true).OrderBy <Furniture, int>((Func <Furniture, int>)(x => - x.rarity)).ElementAt <Furniture>(0); furniture.ballRot = Rando.Float(360f); furniture.rareGen = true; this.prizes.Add(furniture); } for (int index = 0; index < 3; ++index) { Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.Common, 1, gacha: true)[0]; furniture.ballRot = Rando.Float(360f); furniture.rareGen = false; this.prizes.Add(furniture); } this.LoadNextPrize(); this._gachaEgg.CenterOrigin(); }
public override void Initialize() { ChallengeLevel.targetsShot = 0; ChallengeLevel.goodiesGot = 0; ChallengeLevel.allTargetsShot = true; ChallengeLevel.running = false; ChallengeLevel._timer = new ChallengeTimer(); base.Initialize(); this._font = new BitmapFont("biosFont", 8); foreach (Team team in Teams.all) { team.prevScoreboardScore = team.score = 0; } 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 (Thing pendingSpawn in this._pendingSpawns) { this.followCam.Add(pendingSpawn); } this._pauseGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); this._pauseMenu = new UIMenu("@LWING@PAUSE@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"); this._captureMenu = (UIMenu) new UICaptureBox(this._pauseMenu, Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f); this._captureMenu.Close(); this._pauseGroup.Add((UIComponent)this._captureMenu, false); UIDivider uiDivider = new UIDivider(true, 0.8f); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("RESTART!", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._restart), UIAlign.Left), true); 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); if (this.things[typeof(EditorTestLevel)].Count <Thing>() > 0) { uiDivider.leftSection.Add((UIComponent) new UIText("", Color.White), true); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("CAPTURE ICON", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)this._captureMenu), 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); Music.volume = 1f; this.followCam.Adjust(); }
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 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(); }
public override void Initialize() { this._pauseGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); this._pauseMenu = new UIMenu("@LWING@PAUSE@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"); this._testMode = new UIMenu("TEST MODE", 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("RESTART", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._restart), UIAlign.Left), true); 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("TEST MODE", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)this._testMode), UIAlign.Left), true); uiDivider.leftSection.Add((UIComponent) new UIText("", Color.White), true); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("QUIT", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._quit), 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._testMode.Add((UIComponent) new UIMenuItemNumber("PLAYERS", field: new FieldBinding((object)this, "numPlayers", 2f, 4f, 1f)), true); this._testMode.Add((UIComponent) new UIMenuItem("START", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._startTestMode)), true); this._testMode.Add((UIComponent) new UIText("", Color.White), true); this._testMode.Add((UIComponent) new UIMenuItem("CANCEL", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._testMode, (UIComponent)this._pauseMenu), backButton: true), true); this._testMode.Close(); this._pauseGroup.Add((UIComponent)this._testMode, false); this._pauseGroup.Close(); Level.Add((Thing)this._pauseGroup); if (this._level == "RANDOM") { LevelGenerator.MakeLevel(this._center, this._center.left && this._center.right, this._seed, this._genType, Editor._procTilesWide, Editor._procTilesHigh, Editor._procXPos, Editor._procYPos).LoadParts(0.0f, 0.0f, (Level)this, this._seed); List <SpawnPoint> source1 = new List <SpawnPoint>(); foreach (SpawnPoint spawnPoint in this.things[typeof(SpawnPoint)]) { source1.Add(spawnPoint); } List <SpawnPoint> chosenSpawns = new List <SpawnPoint>(); for (int index = 0; index < 4; ++index) { if (chosenSpawns.Count == 0) { chosenSpawns.Add(source1.ElementAt <SpawnPoint>(Rando.Int(source1.Count - 1))); } else { IOrderedEnumerable <SpawnPoint> source2 = source1.OrderByDescending <SpawnPoint, int>((Func <SpawnPoint, int>)(x => { int num = 9999999; foreach (Transform transform in chosenSpawns) { num = (int)Math.Min((transform.position - x.position).length, (float)num); } return(num); })); chosenSpawns.Add(source2.First <SpawnPoint>()); } } foreach (SpawnPoint spawnPoint in source1) { if (!chosenSpawns.Contains(spawnPoint)) { Level.Remove((Thing)spawnPoint); } } PyramidBackground pyramidBackground = new PyramidBackground(0.0f, 0.0f); pyramidBackground.visible = false; Level.Add((Thing)pyramidBackground); } else { this._level = this._level.Replace(Directory.GetCurrentDirectory() + "\\", ""); LevelData levelData = DuckFile.LoadLevel(this._level); if (levelData != null) { foreach (BinaryClassChunk node in levelData.objects.objects) { Thing t = Thing.LoadThing(node); if (t != null) { if (!t.visibleInGame) { t.visible = false; } this.AddThing(t); } } } } this.things.RefreshState(); foreach (Duck spawnPlayer in new Deathmatch((Level)this).SpawnPlayers()) { Level.Add((Thing)spawnPlayer); this.followCam.Add((Thing)spawnPlayer); } }