public static void Initialize() { try { DuckRig._hatPoints.Clear(); DuckRig._chestPoints.Clear(); BinaryReader binaryReader = new BinaryReader((Stream)File.OpenRead(Content.path + "rig_duckRig.rig")); int num = binaryReader.ReadInt32(); for (int index = 0; index < num; ++index) { DuckRig._hatPoints.Add(new Vec2() { x = (float)binaryReader.ReadInt32(), y = (float)binaryReader.ReadInt32() }); DuckRig._chestPoints.Add(new Vec2() { x = (float)binaryReader.ReadInt32(), y = (float)binaryReader.ReadInt32() }); } binaryReader.Close(); binaryReader.Dispose(); } catch (Exception ex) { Program.LogLine(MonoMain.GetExceptionString((object)ex)); } }
private static void UnhandledExceptionTrapperTestServer( object sender, UnhandledExceptionEventArgs e) { string exceptionString = MonoMain.GetExceptionString(e); StreamWriter streamWriter = new StreamWriter("ducklog.txt", true); streamWriter.WriteLine(exceptionString + "\n"); streamWriter.Close(); Environment.Exit(1); }
public static void WriteToLog(string s) { try { StreamWriter streamWriter = new StreamWriter("ducklog.txt", true); streamWriter.WriteLine(s + "\n"); streamWriter.Close(); Program.MakeNetLog(); MonoMain.UploadError(s); } catch (Exception ex) { StreamWriter streamWriter = new StreamWriter("ducklog.txt", true); streamWriter.WriteLine(ex.ToString() + "\n"); streamWriter.Close(); } }
public static void HandleGameCrash(Exception e) { try { string s = !MonoMain.hadInfiniteLoop ? MonoMain.GetExceptionString((object)e) : MonoMain.infiniteLoopDetails; Exception exception = e; bool flag1 = false; bool flag2 = false; Assembly assembly = (Assembly)null; try { foreach (Mod allMod in (IEnumerable <Mod>)ModLoader.allMods) { switch (allMod) { case CoreMod _: case DisabledMod _: continue; default: bool flag3 = allMod.configuration.assembly == exception.TargetSite.DeclaringType.Assembly; if (!flag3) { foreach (System.Type type in allMod.configuration.assembly.GetTypes()) { if (e.StackTrace.Contains(type.ToString())) { flag3 = true; break; } if (e.InnerException != null && e.InnerException.StackTrace.Contains(type.ToString())) { flag3 = true; break; } } } if (flag3) { assembly = allMod.configuration.assembly; flag1 = true; if (!MonoMain.modDebugging) { allMod.configuration.Disable(); flag2 = true; continue; } continue; } continue; } } Exception innerException = e.InnerException; } catch (Exception ex) { } try { s = s.Replace("E:\\gamedev\\DuckGame_Steam\\duckgame_halloween_new\\duckgame\\", ""); } catch (Exception ex) { } Program.WriteToLog(s); Program.SendMessage(Program.main.Window.Handle, 16U, IntPtr.Zero, IntPtr.Zero); Process.Start("CrashWindow.exe", "-modResponsible " + (flag1 ? "1" : "0") + " -modDisabled " + (flag2 ? "1" : "0") + " -modAssembly " + (assembly != (Assembly)null ? assembly.GetName().Name : "UNKNOWN") + " -exceptionString \"" + s.Replace("\n", "|NEWLINE|").Replace("\r", "|NEWLINE2|") + "\" -source " + exception.Source + " -commandLine \"" + Program.commandLine + "\" -executable \"" + Application.ExecutablePath + "\""); Environment.Exit(1); } catch (Exception ex) { StreamWriter streamWriter = new StreamWriter("ducklog.txt", true); streamWriter.WriteLine("Failed to write exception to log.\n"); streamWriter.Close(); } }
public override void DoUpdate() { this.lefpres = Mouse.left == InputState.Pressed; List <DCLine> dcLineList = (List <DCLine>)null; lock (DevConsole.debuggerLines) { dcLineList = DevConsole.debuggerLines; DevConsole.debuggerLines = new List <DCLine>(); } for (int index1 = 0; index1 < 4; ++index1) { if (index1 >= NetworkDebugger._instances.Count || !NetworkDebugger._instances[index1].active) { if (index1 <= NetworkDebugger._instances.Count) { int init = -1; InputProfile inputProfile1 = (InputProfile)null; foreach (InputProfile defaultProfile in InputProfile.defaultProfiles) { if (defaultProfile.Pressed("START")) { foreach (InputProfile inputProfile2 in NetworkDebugger.inputProfiles) { if (defaultProfile == inputProfile2) { break; } } for (int index2 = 0; index2 < 4; ++index2) { if (NetworkDebugger.inputProfiles[index2].name == "") { bool flag = false; foreach (NetDebugInterface netDebugInterface in NetworkDebugger._interfaces) { if (netDebugInterface.visible) { flag = true; break; } } if (!flag) { init = index1; inputProfile1 = defaultProfile; } NetworkDebugger.inputProfiles[index2] = defaultProfile; break; } } } } if (init != -1) { this.CreateInstance(init, false); NetworkDebugger._instances[index1].ipro = inputProfile1; } } } else { NetworkInstance instance = NetworkDebugger._instances[index1]; NetworkDebugger._networkDrawingIndex = index1; this.LockInstance(instance); float volume = SFX.volume; if (NetworkDebugger.Mute(NetworkDebugger._networkDrawingIndex)) { SFX.volume = 0.0f; } InputProfile.Update(); foreach (DCLine dcLine in dcLineList) { if (dcLine.threadIndex == index1) { DevConsole.core.lines.Enqueue(dcLine); } } DevConsole.Update(); Network.PreUpdate(); FireManager.Update(); Level.UpdateLevelChange(); Level.UpdateCurrentLevel(); MonoMain.UpdatePauseMenu(); int index2 = 0; foreach (NetDebugInterface netDebugInterface in NetworkDebugger._interfaces) { MonoMain.instance.IsMouseVisible = true; if (index2 == index1 && index2 < NetworkDebugger._instances.Count) { netDebugInterface.Update(NetworkDebugger._instances[index2].network); } ++index2; } Network.PostUpdate(); if (DuckNetwork.status == DuckNetStatus.Disconnected) { NetworkDebugger._instances[index1].active = false; foreach (Profile profile in NetworkDebugger._instances[index1].duckNetworkCore.profiles) { for (int index3 = 0; index3 < 4; ++index3) { if (NetworkDebugger.inputProfiles[index3] == profile.inputProfile || NetworkDebugger.inputProfiles[index3] == NetworkDebugger._instances[index1].ipro) { NetworkDebugger.inputProfiles[index3] = new InputProfile(); } } } } SFX.volume = volume; this.UnlockInstance(); } } if (!Keyboard.Pressed(Keys.F11)) { return; } foreach (NetworkInstance instance in NetworkDebugger._instances) { instance.network.core.ForcefulTermination(); } Network.activeNetwork.core.ForcefulTermination(); NetworkDebugger._instances.Clear(); NetworkDebugger.inputProfiles.Clear(); Level.current = (Level) new NetworkDebugger(); }
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() { RockScoreboard rockScore = (RockScoreboard)Level.current; /* * FieldInfo matchesPlayed = globaldatatype.GetField("matchesPlayed", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); * FieldInfo longestMatchPlayed = globaldatatype.GetField("longestMatchPlayed", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); * FieldInfo onlineWins = globaldatatype.GetField("onlineWins", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); * FieldInfo winsAsSwack = globaldatatype.GetField("winsAsSwack", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); */ MethodInfo globalWinMatch = type.GetMethod("WinMatch", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); Type pedestal = ass.GetType("DuckGame.Pedestal"); Type ginormoboard = ass.GetType("DuckGame.GinormoBoard"); Type boardmode = ass.GetType("DuckGame.BoardMode"); var boardmode1 = boardmode.GetField("Wins", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(null); var boardmode2 = boardmode.GetField("Points", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(null); Type music = ass.GetType("DuckGame.Music"); PropertyInfo musicvolume = music.GetProperty("volume", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); MethodInfo musicvolumeset = musicvolume.GetSetMethod(); MethodInfo musicplay = music.GetMethod("Play", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(string), typeof(bool), typeof(float) }, null); Type options = ass.GetType("DuckGame.Options"); var optionsdata = options.GetField("_data", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(null); Type optionsdatavolume = ass.GetType("DuckGame.OptionsData"); dynamic ayylmao = optionsdatavolume.GetProperty("musicVolume", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(optionsdata); FieldInfo didSkip = ass.GetType("DuckGame.HighlightLevel").GetField("didSkip", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); Type distancemarker = ass.GetType("DuckGame.DistanceMarker"); FieldInfo _inputsField = inputtype.GetField("_inputs", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _inputs = _inputsField.GetValue(Level.current as RockScoreboard); FieldInfo _afterHighlightsField = inputtype.GetField("_afterHighlights", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _afterHighlights = _afterHighlightsField.GetValue(Level.current as RockScoreboard); FieldInfo _skipFadeField = inputtype.GetField("_skipFade", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _skipFade = _skipFadeField.GetValue(Level.current as RockScoreboard); FieldInfo _weatherField = inputtype.GetField("_weather", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _weather = _weatherField.GetValue(Level.current as RockScoreboard); FieldInfo _sunshineField = inputtype.GetField("_sunshineTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _sunshineTarget = _sunshineField.GetValue(Level.current as RockScoreboard); FieldInfo _screenField = inputtype.GetField("_screenTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _screenTarget = _screenField.GetValue(Level.current as RockScoreboard); FieldInfo _pixelField = inputtype.GetField("_pixelTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _pixelTarget = _pixelField.GetValue(Level.current as RockScoreboard); FieldInfo _sunLayerField = inputtype.GetField("_sunLayer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _sunLayer = _sunLayerField.GetValue(Level.current as RockScoreboard); FieldInfo sunThingField = inputtype.GetField("sunThing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic sunThing = sunThingField.GetValue(Level.current as RockScoreboard); FieldInfo rainbowThingField = inputtype.GetField("rainbowThing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic rainbowThing = rainbowThingField.GetValue(Level.current as RockScoreboard); FieldInfo rainbowThing2Field = inputtype.GetField("rainbowThing2", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic rainbowThing2 = rainbowThing2Field.GetValue(Level.current as RockScoreboard); FieldInfo _crowdField = inputtype.GetField("_crowd", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _crowd = _crowdField.GetValue(Level.current as RockScoreboard); FieldInfo _fieldField = inputtype.GetField("_field", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _field = _fieldField.GetValue(Level.current as RockScoreboard); FieldInfo _bleacherSeatsField = inputtype.GetField("_bleacherSeats", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _bleacherSeats = _bleacherSeatsField.GetValue(Level.current as RockScoreboard); FieldInfo _bleachersField = inputtype.GetField("_bleachers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _bleachers = _bleachersField.GetValue(Level.current as RockScoreboard); FieldInfo _intermissionTextField = inputtype.GetField("_intermissionText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _intermissionText = _intermissionTextField.GetValue(Level.current as RockScoreboard); FieldInfo _winnerPostField = inputtype.GetField("_winnerPost", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _winnerPost = _winnerPostField.GetValue(Level.current as RockScoreboard); FieldInfo _winnerBannerField = inputtype.GetField("_winnerBanner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _winnerBanner = _winnerBannerField.GetValue(Level.current as RockScoreboard); FieldInfo _fontField = inputtype.GetField("_font", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _font = _fontField.GetValue(Level.current as RockScoreboard); FieldInfo _modeField = inputtype.GetField("_mode", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _mode = _modeField.GetValue(Level.current as RockScoreboard); FieldInfo _intermissionSlideField = inputtype.GetField("_intermissionSlide", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _intermissionSlide = _intermissionSlideField.GetValue(Level.current as RockScoreboard); FieldInfo _tieField = inputtype.GetField("_tie", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _tie = _tieField.GetValue(Level.current as RockScoreboard); FieldInfo _highestSlotField = inputtype.GetField("_highestSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _highestSlot = _highestSlotField.GetValue(Level.current as RockScoreboard); FieldInfo _fieldWidthField = inputtype.GetField("_fieldWidth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _fieldWidth = _fieldWidthField.GetValue(Level.current as RockScoreboard); FieldInfo _matchOverField = inputtype.GetField("_matchOver", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _matchOver = _matchOverField.GetValue(Level.current as RockScoreboard); FieldInfo _winningTeamField = inputtype.GetField("_winningTeam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _winningTeam = _winningTeamField.GetValue(Level.current as RockScoreboard); FieldInfo _stateField = inputtype.GetField("_state", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _state = _stateField.GetValue(Level.current as RockScoreboard); FieldInfo _scoreBoardField = inputtype.GetField("_scoreBoard", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _scoreBoard = _scoreBoardField.GetValue(Level.current as RockScoreboard); FieldInfo _wallField = inputtype.GetField("_wall", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _wall = _wallField.GetValue(Level.current as RockScoreboard); FieldInfo _fieldForegroundField = inputtype.GetField("_fieldForeground", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _fieldForeground = _fieldForegroundField.GetValue(Level.current as RockScoreboard); FieldInfo _fieldForeground2Field = inputtype.GetField("_fieldForeground2", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _fieldForeground2 = _fieldForeground2Field.GetValue(Level.current as RockScoreboard); FieldInfo _bottomRightField = typeof(Level).GetField("_bottomRight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic _bottomRight = _bottomRightField.GetValue(Level.current as RockScoreboard); if (Network.isActive && Network.isServer) { int num = 0; foreach (Profile profile in DuckNetwork.profiles) { if (profile.connection != null) { InputObject inputObject = new InputObject(); inputObject.profileNumber = (sbyte)num; Level.Add((Thing)inputObject); _inputs.Add(inputObject); ++num; } } } didSkip.SetValue(Level.current as RockScoreboard, false); if (_afterHighlights) { _skipFade = true; } _weather = new RockWeather(Level.current as RockScoreboard); _weather.Start(); Level.Add((Thing)_weather); for (int index = 0; index < 350; ++index) { _weather.Update(); } if (RockScoreboard._sunEnabled) { float num = 9f / 16f; _sunshineTarget = new RenderTarget2D(DuckGame.Graphics.width / 12, (int)((double)DuckGame.Graphics.width * (double)num) / 12, false); _screenTarget = new RenderTarget2D(DuckGame.Graphics.width, (int)((double)DuckGame.Graphics.width * (double)num), false); _pixelTarget = new RenderTarget2D(160, (int)(320.0 * (double)num / 2.0), false); _sunLayer = new Layer("SUN LAYER", 99999, (Camera)null, false, new Vec2()); Layer.Add(_sunLayer); Thing thing = (Thing) new SpriteThing(150f, 120f, new Sprite("sun", 0.0f, 0.0f)); thing.z = -9999f; thing.depth = -0.99f; thing.layer = _sunLayer; thing.xscale = 1f; thing.yscale = 1f; thing.collisionSize = new Vec2(1f, 1f); thing.collisionOffset = new Vec2(0.0f, 0.0f); Level.Add(thing); sunThing = thing; SpriteThing spriteThing1 = new SpriteThing(150f, 80f, new Sprite("rainbow", 0.0f, 0.0f)); spriteThing1.alpha = 0.15f; spriteThing1.z = -9999f; spriteThing1.depth = -0.99f; spriteThing1.layer = _sunLayer; spriteThing1.xscale = 1f; spriteThing1.yscale = 1f; spriteThing1.color = new Color(100, 100, 100); spriteThing1.collisionSize = new Vec2(1f, 1f); spriteThing1.collisionOffset = new Vec2(0.0f, 0.0f); Level.Add((Thing)spriteThing1); rainbowThing = (Thing)spriteThing1; rainbowThing.visible = false; SpriteThing spriteThing2 = new SpriteThing(150f, 80f, new Sprite("rainbow", 0.0f, 0.0f)); spriteThing2.z = -9999f; spriteThing2.depth = -0.99f; spriteThing2.layer = _sunLayer; spriteThing2.xscale = 1f; spriteThing2.yscale = 1f; spriteThing2.color = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 90); spriteThing2.collisionSize = new Vec2(1f, 1f); spriteThing2.collisionOffset = new Vec2(0.0f, 0.0f); Level.Add((Thing)spriteThing2); rainbowThing2 = (Thing)spriteThing2; rainbowThing2.visible = false; } List <Team> allRandomized = Teams.allRandomized; if (RockScoreboard.returnLevel == null && !Network.isActive) { allRandomized[0].Join(Profiles.DefaultPlayer1, true); allRandomized[1].Join(Profiles.DefaultPlayer2, true); allRandomized[0].score = 10; allRandomized[1].score = 2; Teams.Player3.score = 3; Teams.Player4.score = 4; } _crowd = new Crowd(); Level.Add((Thing)_crowd); Crowd.mood = Mood.Calm; _field = new FieldBackground("FIELD", 9999); Layer.Add((Layer)_field); _bleacherSeats = new Sprite("bleacherSeats", 0.0f, 0.0f); _bleachers = RockWeather.weather != Weather.Snowing ? new Sprite("bleacherBack", 0.0f, 0.0f) : new Sprite("bleacherBackSnow", 0.0f, 0.0f); _bleachers.center = new Vec2((float)(_bleachers.w / 2), (float)(_bleachers.height - 3)); _intermissionText = new Sprite("rockThrow/intermission", 0.0f, 0.0f); _winnerPost = new Sprite("rockThrow/winnerPost", 0.0f, 0.0f); _winnerBanner = new Sprite("rockThrow/winnerBanner", 0.0f, 0.0f); _font = new BitmapFont("biosFont", 8, -1); List <Team> teamList1 = new List <Team>(); foreach (Team team in Teams.all) { if (team.activeProfiles.Count > 0) { teamList1.Add(team); } } foreach (Team team in teamList1) { team.rockScore = team.score; if (RockScoreboard.wallMode) { team.score = Math.Min(team.score, GameMode.winsPerSet); } } if (_mode == ScoreBoardMode.ShowScores) { _intermissionSlide = 1f; DuckGame.Graphics.fade = 1f; Layer.Game.fade = 0.0f; Layer.Background.fade = 0.0f; Crowd.UpdateFans(); int num1 = 0; Stack <Depth> depthStack = new Stack <Depth>(); for (int index = 0; index < 8; ++index) { depthStack.Push(new Depth((float)index * 0.02f)); } int num2 = 0; foreach (Team team in teamList1) { Depth depth = depthStack.Pop(); float num3 = 223f; float ypos = 0.0f; float num4 = 26f; if (num1 == 1) { num4 = 24f; } else if (num1 == 2) { num4 = 27f; } else if (num1 == 3) { num4 = 32f; } float num5 = (float)(158.0 - num1 * num4); int prevScoreboardScore = team.prevScoreboardScore; int num6 = GameMode.winsPerSet * 2; int num7 = team.score; if (RockScoreboard.wallMode && num7 > GameMode.winsPerSet) { num7 = GameMode.winsPerSet; } rockScore._slots.Add(new Slot3D()); if (num7 >= GameMode.winsPerSet && num7 == num2) { _tie = true; } else if (num7 >= GameMode.winsPerSet && num7 > num2) { _tie = false; num2 = num7; _highestSlot = rockScore._slots[rockScore._slots.Count - 1]; } List <Profile> profileList = new List <Profile>(); Profile profile1 = (Profile)null; bool flag = false; foreach (Profile activeProfile in team.activeProfiles) { if (flag) { profile1 = activeProfile; flag = false; } if (activeProfile.wasRockThrower) { activeProfile.wasRockThrower = false; flag = true; } profileList.Add(activeProfile); } if (profile1 == null) { profile1 = team.activeProfiles[0]; } profileList.Remove(profile1); profileList.Insert(0, profile1); profile1.wasRockThrower = true; byte num8 = (byte)(rockScore._slots.Count - 1); int num9 = 0; foreach (Profile profile2 in profileList) { if (profile2 == profile1) { rockScore._slots[(int)num8].duck = (Duck) new RockThrowDuck(num3 - (float)(num9 * 10), ypos - 16f, profile2); rockScore._slots[(int)num8].duck.planeOfExistence = num8; rockScore._slots[(int)num8].duck.ignoreGhosting = true; rockScore._slots[(int)num8].duck.forceMindControl = true; Level.Add((Thing)rockScore._slots[(int)num8].duck); rockScore._slots[(int)num8].duck.connection = DuckNetwork.localConnection; TeamHat equipment = rockScore._slots[rockScore._slots.Count - 1].duck.GetEquipment(typeof(TeamHat)) as TeamHat; if (equipment != null) { equipment.ignoreGhosting = true; } rockScore._slots[rockScore._slots.Count - 1].duck.z = num5; rockScore._slots[rockScore._slots.Count - 1].duck.depth = depth; rockScore._slots[rockScore._slots.Count - 1].ai = new DuckAI(profile2.inputProfile); if (Network.isActive && profile2.connection != DuckNetwork.localConnection) { rockScore._slots[rockScore._slots.Count - 1].ai._manualQuack = rockScore.GetNetInput((sbyte)profile2.networkIndex); } rockScore._slots[rockScore._slots.Count - 1].duck.derpMindControl = false; rockScore._slots[rockScore._slots.Count - 1].duck.mindControl = (InputProfile)rockScore._slots[rockScore._slots.Count - 1].ai; rockScore._slots[rockScore._slots.Count - 1].rock = new ScoreRock((float)((double)num3 + 18.0 + (double)prevScoreboardScore / (double)num6 * (double)_fieldWidth), ypos, profile2); rockScore._slots[rockScore._slots.Count - 1].rock.planeOfExistence = num8; rockScore._slots[rockScore._slots.Count - 1].rock.ignoreGhosting = true; Level.Add((Thing)rockScore._slots[rockScore._slots.Count - 1].rock); rockScore._slots[rockScore._slots.Count - 1].rock.z = num5; rockScore._slots[rockScore._slots.Count - 1].rock.depth = rockScore._slots[rockScore._slots.Count - 1].duck.depth + 1; rockScore._slots[rockScore._slots.Count - 1].rock.grounded = true; rockScore._slots[rockScore._slots.Count - 1].duck.isRockThrowDuck = true; } else { Duck duck = (Duck) new RockThrowDuck(num3 - (float)(num9 * 12), ypos - 16f, profile2); duck.forceMindControl = true; duck.planeOfExistence = num8; duck.ignoreGhosting = true; Level.Add((Thing)duck); duck.depth = depth; duck.z = num5; duck.derpMindControl = false; DuckAI duckAi = new DuckAI(profile2.inputProfile); if (Network.isActive && profile2.connection != DuckNetwork.localConnection) { duckAi._manualQuack = rockScore.GetNetInput((sbyte)profile2.networkIndex); } duck.mindControl = (InputProfile)duckAi; duck.isRockThrowDuck = true; duck.connection = DuckNetwork.localConnection; rockScore._slots[rockScore._slots.Count - 1].subDucks.Add(duck); rockScore._slots[rockScore._slots.Count - 1].subAIs.Add(duckAi); } ++num9; } rockScore._slots[rockScore._slots.Count - 1].slotIndex = num1; rockScore._slots[rockScore._slots.Count - 1].startX = num3; ++num1; } for (int index = 0; index < 4; ++index) { Block block = new Block(-50f, 0.0f, 1200f, 32f, PhysicsMaterial.Default); block.planeOfExistence = (byte)index; Level.Add((Thing)block); } if (!_tie && num2 > 0) { _matchOver = true; } if (_tie) { GameMode.showdown = true; } } else { if (Teams.active.Count > 1 && !_afterHighlights) { setGlobalStat("matchesPlayed", getGlobalStat("matchesPlayed") + 1); //matchesPlayed.SetValue(globaldata, matchesPlayed.GetValue(globaldata) + 1); globalWinMatch.Invoke(null, new Team[] { Teams.winning[0] }); if (Network.isActive) { foreach (Profile activeProfile in Teams.winning[0].activeProfiles) { if (activeProfile.connection == DuckNetwork.localConnection) { DuckNetwork.GiveXP("Won Match", 0, 10, 4, 9999999, 9999999, 9999999); break; } } } if (GameMode.winsPerSet > (int)getGlobalStat("longestMatchPlayed")) { setGlobalStat("longestMatchPlayed", getGlobalStat("longestMatchPlayed")); } //longestMatchPlayed.SetValue(globaldata, GameMode.winsPerSet); } _intermissionSlide = 0.0f; teamList1.Sort((Comparison <Team>)((a, b) => { if (a.score == b.score) { return(0); } return(a.score >= b.score ? -1 : 1); })); float num1 = (float)(160.0 - (double)(teamList1.Count * 42 / 2) + 21.0); foreach (Team team in Teams.all) { team.prevScoreboardScore = 0; } List <List <Team> > source = new List <List <Team> >(); foreach (Team team in teamList1) { int score = team.score; bool flag = false; for (int index = 0; index < source.Count; ++index) { if (source[index][0].score < score) { source.Insert(index, new List <Team>()); source[index].Add(team); flag = true; break; } if (source[index][0].score == score) { source[index].Add(team); flag = true; break; } } if (!flag) { source.Add(new List <Team>()); source.Last <List <Team> >().Add(team); } } _winningTeam = teamList1[0]; rockScore.controlMessage = 1; _state = ScoreBoardState.None; Crowd.mood = Mood.Dead; bool flag1 = false; if (!_afterHighlights) { int place = 0; int num2 = 0; foreach (List <Team> teamList2 in source) { foreach (Team team in teamList2) { Level.Add((Thing)Activator.CreateInstance(pedestal, new object[] { num1 + (num2 * 42), 150f, team, place })); ++num2; } ++place; } if (_winningTeam.activeProfiles.Count > 1) { ++_winningTeam.wins; } else { ++_winningTeam.activeProfiles[0].wins; } foreach (Profile activeProfile in _winningTeam.activeProfiles) { ++activeProfile.stats.trophiesWon; activeProfile.stats.trophiesSinceLastWin = activeProfile.stats.trophiesSinceLastWinCounter; activeProfile.stats.trophiesSinceLastWinCounter = 0; if (Network.isActive && activeProfile.connection == DuckNetwork.localConnection && !flag1) { flag1 = true; setGlobalStat("onlineWins", getGlobalStat("onlineWins") + 1); //onlineWins.SetValue(globaldata, onlineWins.GetValue(globaldata)+1); if (activeProfile.team.name == "SWACK") { setGlobalStat("winsAsSwack", getGlobalStat("winsAsSwack") + 1); } //winsAsSwack.SetValue(globaldata, winsAsSwack.GetValue(globaldata) + 1); } if (!Network.isActive && activeProfile.team.name == "SWACK") { setGlobalStat("winsAsSwack", getGlobalStat("winsAsSwack") + 1); } //winsAsSwack.SetValue(globaldata, winsAsSwack.GetValue(globaldata) + 1); } MonoMain.LogPlay(); foreach (Team team in teamList1) { foreach (Profile activeProfile in team.activeProfiles) { ++activeProfile.stats.trophiesSinceLastWinCounter; ++activeProfile.stats.gamesPlayed; } } Main.lastLevel = ""; } } _bottomRight = new Vec2(1000f, 1000f); rockScore.lowestPoint = 1000f; _scoreBoard = Activator.CreateInstance(ginormoboard, new object[] { 300f, -320f, _mode == ScoreBoardMode.ShowScores ? boardmode2 : boardmode1 }); // _scoreBoard = new GinormoBoard(300f, -320f, _mode == ScoreBoardMode.ShowScores ? boardmode.Points : BoardMode.Wins); _scoreBoard.z = -130f; Level.Add((Thing)_scoreBoard); rockScore.backgroundColor = new Color(0, 0, 0); musicvolumeset.Invoke(null, new object[] { ayylmao }); if (_mode != ScoreBoardMode.ShowWinner && !_afterHighlights) { musicplay.Invoke(null, new object[] { "SportsTime", true, 0.0f }); } Level.current.camera.y = 0.0f; _field.ypos = 0.0f; Sprite s1 = RockWeather.weather != Weather.Snowing ? (RockWeather.weather != Weather.Raining ? new Sprite("fieldNoise", 0.0f, 0.0f) : new Sprite("fieldNoiseRain", 0.0f, 0.0f)) : new Sprite("fieldNoiseSnow", 0.0f, 0.0f); s1.scale = new Vec2(4f, 4f); s1.depth = (Depth)0.5f; s1.y -= 16f; _field.AddSprite(s1); Sprite s2 = new Sprite("fieldWall", 0.0f, 0.0f); s2.scale = new Vec2(4f, 4f); s2.depth = (Depth)0.5f; s2.y -= 16f; _wall = new WallLayer("FIELDWALL", 80); if (RockScoreboard.wallMode) { _wall.AddWallSprite(s2); } Layer.Add((Layer)_wall); _fieldForeground = new FieldBackground("FIELDFOREGROUND", 80); _fieldForeground.fieldHeight = -13f; Layer.Add((Layer)_fieldForeground); _fieldForeground2 = new FieldBackground("FIELDFOREGROUND2", 70); _fieldForeground2.fieldHeight = -15f; Layer.Add((Layer)_fieldForeground2); if (_mode != ScoreBoardMode.ShowWinner) { Sprite s3 = new Sprite("rockThrow/chairSeat", 0.0f, 0.0f); s3.CenterOrigin(); s3.x = 300f; s3.y = 20f; s3.scale = new Vec2(1.2f, 1.2f); _fieldForeground.AddSprite(s3); Sprite s4 = new Sprite("rockThrow/tableTop", 0.0f, 0.0f); s4.CenterOrigin(); s4.x = 450f; s4.y = 14f; s4.scale = new Vec2(1.2f, 1.4f); _fieldForeground2.AddSprite(s4); int num = -95; Sprite spr1 = new Sprite("rockThrow/chairBottomBack", 0.0f, 0.0f); Thing thing1 = (Thing) new SpriteThing(300f, -10f, spr1); thing1.center = new Vec2((float)(spr1.w / 2), (float)(spr1.h / 2)); thing1.z = (float)(106 + num); thing1.depth = (Depth)0.5f; thing1.layer = Layer.Background; Level.Add(thing1); Sprite spr2 = new Sprite("rockThrow/chairBottom", 0.0f, 0.0f); Thing thing2 = (Thing) new SpriteThing(300f, -6f, spr2); thing2.center = new Vec2((float)(spr2.w / 2), (float)(spr2.h / 2)); thing2.z = (float)(120 + num); thing2.depth = (Depth)0.8f; thing2.layer = Layer.Background; Level.Add(thing2); Sprite spr3 = new Sprite("rockThrow/chairFront", 0.0f, 0.0f); Thing thing3 = (Thing) new SpriteThing(300f, -9f, spr3); thing3.center = new Vec2((float)(spr3.w / 2), (float)(spr3.h / 2)); thing3.z = (float)(122 + num); thing3.depth = (Depth)0.9f; thing3.layer = Layer.Background; Level.Add(thing3); Sprite spr4 = new Sprite("rockThrow/tableBottomBack", 0.0f, 0.0f); Thing thing4 = (Thing) new SpriteThing(450f, -7f, spr4); thing4.center = new Vec2((float)(spr4.w / 2), (float)(spr4.h / 2)); thing4.z = (float)(106 + num); thing4.depth = (Depth)0.5f; thing4.layer = Layer.Background; Level.Add(thing4); Sprite spr5 = new Sprite("rockThrow/tableBottom", 0.0f, 0.0f); Thing thing5 = (Thing) new SpriteThing(450f, -7f, spr5); thing5.center = new Vec2((float)(spr5.w / 2), (float)(spr5.h / 2)); thing5.z = (float)(120 + num); thing5.depth = (Depth)0.8f; thing5.layer = Layer.Background; Level.Add(thing5); Sprite spr6 = new Sprite("rockThrow/keg", 0.0f, 0.0f); Thing thing6 = (Thing) new SpriteThing(460f, -24f, spr6); thing6.center = new Vec2((float)(spr6.w / 2), (float)(spr6.h / 2)); thing6.z = (float)(120 + num - 4); thing6.depth = -0.4f; thing6.layer = Layer.Game; Level.Add(thing6); Sprite spr7 = new Sprite("rockThrow/cup", 0.0f, 0.0f); Thing thing7 = (Thing) new SpriteThing(445f, -21f, spr7); thing7.center = new Vec2((float)(spr7.w / 2), (float)(spr7.h / 2)); thing7.z = (float)(120 + num - 6); thing7.depth = -0.5f; thing7.layer = Layer.Game; Level.Add(thing7); Sprite spr8 = new Sprite("rockThrow/cup", 0.0f, 0.0f); Thing thing8 = (Thing) new SpriteThing(437f, -20f, spr8); thing8.center = new Vec2((float)(spr8.w / 2), (float)(spr8.h / 2)); thing8.z = (float)(120 + num); thing8.depth = -0.3f; thing8.layer = Layer.Game; Level.Add(thing8); Sprite spr9 = new Sprite("rockThrow/cup", 0.0f, 0.0f); Thing thing9 = (Thing) new SpriteThing(472f, -20f, spr9); thing9.center = new Vec2((float)(spr9.w / 2), (float)(spr9.h / 2)); thing9.z = (float)(120 + num - 7); thing9.depth = -0.5f; thing9.layer = Layer.Game; thing9.angleDegrees = 80f; Level.Add(thing9); } for (int index = 0; index < 3; ++index) { dynamic distanceMarker = Activator.CreateInstance(distancemarker, new object[] { (float)(230 + index * 175), -25f, (int)Math.Round(index * GameMode.winsPerSet / 2.0) }); distanceMarker.z = 0.0f; distanceMarker.depth = (Depth)0.34f; distanceMarker.layer = Layer.Background; Level.Add((Thing)distanceMarker); } Sprite spr = RockWeather.weather != Weather.Snowing ? new Sprite("bleacherBack", 0.0f, 0.0f) : new Sprite("bleacherBackSnow", 0.0f, 0.0f); for (int index = 0; index < 24; ++index) { SpriteThing spriteThing = new SpriteThing((float)(100 + index * (spr.w + 13)), (float)(spr.h + 15), spr); spriteThing.center = new Vec2((float)(spr.w / 2), (float)(spr.h - 1)); spriteThing.collisionOffset = new Vec2(spriteThing.collisionOffset.x, (float)-spr.h); spriteThing.z = 0.0f; spriteThing.depth = (Depth)0.33f; spriteThing.layer = Layer.Background; Level.Add((Thing)spriteThing); } SpriteThing spriteThing3 = new SpriteThing(600f, 0.0f, new Sprite("blackSquare", 0.0f, 0.0f)); spriteThing3.z = -90f; spriteThing3.centery = 7f; spriteThing3.depth = (Depth)0.1f; spriteThing3.layer = Layer.Background; spriteThing3.xscale = 100f; spriteThing3.yscale = 7f; Level.Add((Thing)spriteThing3); _weather.Update(); _inputsField.SetValue(Level.current as RockScoreboard, _inputs); _afterHighlightsField.SetValue(Level.current as RockScoreboard, _afterHighlights); _skipFadeField.SetValue(Level.current as RockScoreboard, _skipFade); _weatherField.SetValue(Level.current as RockScoreboard, _weather); _sunshineField.SetValue(Level.current as RockScoreboard, _sunshineTarget); _screenField.SetValue(Level.current as RockScoreboard, _screenTarget); _pixelField.SetValue(Level.current as RockScoreboard, _pixelTarget); _sunLayerField.SetValue(Level.current as RockScoreboard, _sunLayer); sunThingField.SetValue(Level.current as RockScoreboard, sunThing); rainbowThingField.SetValue(Level.current as RockScoreboard, rainbowThing); rainbowThing2Field.SetValue(Level.current as RockScoreboard, rainbowThing2); _crowdField.SetValue(Level.current as RockScoreboard, _crowd); _fieldField.SetValue(Level.current as RockScoreboard, _field); _bleacherSeatsField.SetValue(Level.current as RockScoreboard, _bleacherSeats); _bleachersField.SetValue(Level.current as RockScoreboard, _bleachers); _intermissionTextField.SetValue(Level.current as RockScoreboard, _intermissionText); _winnerPostField.SetValue(Level.current as RockScoreboard, _winnerPost); _winnerBannerField.SetValue(Level.current as RockScoreboard, _winnerBanner); _fontField.SetValue(Level.current as RockScoreboard, _font); _modeField.SetValue(Level.current as RockScoreboard, _mode); _intermissionSlideField.SetValue(Level.current as RockScoreboard, _intermissionSlide); _tieField.SetValue(Level.current as RockScoreboard, _tie); _highestSlotField.SetValue(Level.current as RockScoreboard, _highestSlot); _fieldWidthField.SetValue(Level.current as RockScoreboard, _fieldWidth); _matchOverField.SetValue(Level.current as RockScoreboard, _matchOver); _winningTeamField.SetValue(Level.current as RockScoreboard, _winningTeam); _stateField.SetValue(Level.current as RockScoreboard, _state); _scoreBoardField.SetValue(Level.current as RockScoreboard, _scoreBoard); _wallField.SetValue(Level.current as RockScoreboard, _wall); _fieldForegroundField.SetValue(Level.current as RockScoreboard, _fieldForeground); _fieldForeground2Field.SetValue(Level.current as RockScoreboard, _fieldForeground2); _bottomRightField.SetValue(Level.current as RockScoreboard, _bottomRight); }